chamba 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -44
  3. package/bin/chamba.js +212 -0
  4. package/dist/commands/advanced.js +278 -0
  5. package/dist/commands/dev.js +619 -0
  6. package/dist/commands/doctor.js +29 -0
  7. package/dist/commands/menu.js +80 -0
  8. package/dist/commands/onboard.js +229 -0
  9. package/dist/commands/settings.js +349 -0
  10. package/dist/lib/agent-context.js +177 -0
  11. package/dist/lib/browser.js +40 -0
  12. package/dist/lib/chamba-yaml.js +191 -0
  13. package/dist/lib/constants.js +135 -0
  14. package/dist/lib/dockerfile-builder.js +267 -0
  15. package/dist/lib/env.js +78 -0
  16. package/dist/lib/global-config.js +66 -0
  17. package/dist/lib/pnpm-store.js +19 -0
  18. package/dist/lib/ports.js +210 -0
  19. package/dist/lib/safe-rm.js +26 -0
  20. package/dist/lib/sessions.js +34 -0
  21. package/dist/lib/shadows.js +174 -0
  22. package/dist/lib/webterm.js +490 -0
  23. package/dist/lib/workspace-identity.js +260 -0
  24. package/package.json +61 -24
  25. package/schema/chamba.schema.json +65 -0
  26. package/templates/.dockerignore +3 -0
  27. package/templates/Dockerfile +173 -0
  28. package/templates/claude-statusline.sh +120 -0
  29. package/templates/context/baseline.md +13 -0
  30. package/templates/context/context-usage.md +1 -0
  31. package/templates/context/git-mode-local.md +1 -0
  32. package/templates/context/git-mode-strict.md +1 -0
  33. package/templates/context/git-mode-unrestricted.md +1 -0
  34. package/templates/context/git-unavailable.md +1 -0
  35. package/templates/context/shadow-paths.md +3 -0
  36. package/templates/context-usage.sh +249 -0
  37. package/templates/git-readonly-wrapper.mjs +309 -0
  38. package/templates/npmrc +2 -0
  39. package/templates/pnpm-config.yaml +9 -0
  40. package/templates/runtime-constants.mjs +18 -0
  41. package/templates/skills/chamba-statusline/SKILL.md +79 -0
  42. package/templates/skills/context-usage/SKILL.md +53 -0
  43. package/templates/skills/web-pane/SKILL.md +62 -0
  44. package/templates/startup-git-mode.mjs +145 -0
  45. package/templates/startup.mjs +333 -0
  46. package/templates/webpane.sh +126 -0
  47. package/templates/webterm/README.md +157 -0
  48. package/templates/webterm/artifacts.js +583 -0
  49. package/templates/webterm/config.js +269 -0
  50. package/templates/webterm/context/claude.md +14 -0
  51. package/templates/webterm/conversation.js +248 -0
  52. package/templates/webterm/package-lock.json +884 -0
  53. package/templates/webterm/package.json +17 -0
  54. package/templates/webterm/pane.js +156 -0
  55. package/templates/webterm/proc.js +89 -0
  56. package/templates/webterm/public/app/alerts.js +472 -0
  57. package/templates/webterm/public/app/cards.js +123 -0
  58. package/templates/webterm/public/app/clipboard.js +229 -0
  59. package/templates/webterm/public/app/composer.js +226 -0
  60. package/templates/webterm/public/app/connection.js +342 -0
  61. package/templates/webterm/public/app/dictation.js +98 -0
  62. package/templates/webterm/public/app/dom.js +37 -0
  63. package/templates/webterm/public/app/drafts.js +244 -0
  64. package/templates/webterm/public/app/frames.js +166 -0
  65. package/templates/webterm/public/app/main.js +82 -0
  66. package/templates/webterm/public/app/new-session.js +188 -0
  67. package/templates/webterm/public/app/note.js +24 -0
  68. package/templates/webterm/public/app/pane-frame.js +166 -0
  69. package/templates/webterm/public/app/pane.js +353 -0
  70. package/templates/webterm/public/app/state.js +51 -0
  71. package/templates/webterm/public/app/status-strip.js +170 -0
  72. package/templates/webterm/public/app/tabs.js +475 -0
  73. package/templates/webterm/public/app/terminal.js +102 -0
  74. package/templates/webterm/public/app/theme.js +46 -0
  75. package/templates/webterm/public/favicon.svg +21 -0
  76. package/templates/webterm/public/index.html +105 -0
  77. package/templates/webterm/public/styles.css +1193 -0
  78. package/templates/webterm/server.js +1142 -0
  79. package/templates/webterm/sessions.js +515 -0
  80. package/templates/webterm/snapshot.js +135 -0
  81. package/templates/webterm.sh +167 -0
  82. package/dist/cli.js +0 -1691
  83. package/dist/server.js +0 -1919
  84. package/inject/annotate.js +0 -18
  85. package/skill/README.md +0 -12
  86. package/skill/SKILL.md +0 -93
  87. package/web/assets/highlighted-body-OFNGDK62-Bn4Eu7CG.js +0 -1
  88. package/web/assets/index-B9DI4F1Z.js +0 -202
  89. package/web/assets/index-DK_n6CTo.css +0 -2
  90. package/web/assets/mermaid-GHXKKRXX-CEMduc-U.js +0 -1
  91. package/web/index.html +0 -28
@@ -1,18 +0,0 @@
1
- (function(){var e=`chamba-annotate/1`;function t(e){let t=null;return window.addEventListener(`message`,n=>{let r=n.data;if(!(!r||r.tag!==`chamba-annotate/1`)){if(r.t===`hello`){if(n.source!==window.parent)return;t=n.origin}t===null||n.origin!==t||e(r)}}),{emit:e=>{t!==null&&window.parent.postMessage(e,t)}}}var n=Object.defineProperty,r=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},i=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})};function a(e){if(e===!0)return`soft`;if(e===!1)return`disabled`;if(typeof e==`string`){let t=e.toLowerCase().trim();if(t===`auto`)return`auto`;if(t===`full`)return`full`;if(t===`soft`||t===`disabled`)return t}return`soft`}function o(e=`soft`){switch(c.session.__counterEpoch=(c.session.__counterEpoch||0)+1,e){case`auto`:c.session.styleMap=new Map,c.session.nodeMap=new Map;return;case`soft`:c.session.styleMap=new Map,c.session.nodeMap=new Map,c.session.styleCache=new WeakMap;return;case`full`:return;case`disabled`:c.session.styleMap=new Map,c.session.nodeMap=new Map,c.session.styleCache=new WeakMap,c.computedStyle=new WeakMap,c.measureHints=new WeakMap,c.baseStyle=new s(50),c.defaultStyle=new s(30),c.image=new s(100),c.background=new s(100),c.resource=new s(150),c.font=new Set;return;default:c.session.styleMap=new Map,c.session.nodeMap=new Map,c.session.styleCache=new WeakMap;return}}var s,c,l=r(()=>{s=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let e=this.keys().next().value;e!==void 0&&this.delete(e)}return super.set(e,t)}},c={image:new s(100),background:new s(100),resource:new s(150),defaultStyle:new s(30),baseStyle:new s(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function u(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith(`#`)?null:n}function d(e){if(!e||e===`none`)return``;let t=e.replace(/translate[XY]?\([^)]*\)/g,``);return t=t.replace(/matrix\(([^)]+)\)/g,(e,t)=>{let n=t.split(`,`).map(e=>e.trim());return n.length===6?(n[4]=`0`,n[5]=`0`,`matrix(${n.join(`, `)})`):`matrix(${t})`}),t=t.replace(/matrix3d\(([^)]+)\)/g,(e,t)=>{let n=t.split(`,`).map(e=>e.trim());return n.length===16?(n[12]=`0`,n[13]=`0`,`matrix3d(${n.join(`, `)})`):`matrix3d(${t})`}),t.trim().replace(/\s{2,}/g,` `)}function f(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function p(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let n=t||typeof document<`u`&&(document.baseURI||document.location?.href)||`http://localhost/`;return new URL(e,n).href}catch{return e}}var m=r(()=>{});function h(e=`[snapDOM]`,{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function a(a,o,s){if(i>=n)return;let c=Date.now();(r.get(o)||0)>c||(r.set(o,c+t),i++,a===`warn`&&console&&console.warn?console.warn(`${e} ${s}`):console&&console.error&&console.error(`${e} ${s}`))}return{warnOnce(e,t){a(`warn`,e,t)},errorOnce(e,t){a(`error`,e,t)},reset(){r.clear(),i=0}}}function g(e){return/^data:|^blob:|^about:blank$/i.test(e)}function _(e,t){try{let n=typeof location<`u`&&location.href?location.href:`http://localhost/`,r=t.includes(`{url}`)?t.split(`{url}`)[0]:t,i=new URL(r||`.`,n),a=new URL(e,n);if(a.origin===i.origin)return!0;let o=a.searchParams;if(o&&(o.has(`url`)||o.has(`target`)))return!0}catch{}return!1}function v(e,t){if(!t||g(e)||_(e,t))return!1;try{let t=typeof location<`u`&&location.href?location.href:`http://localhost/`,n=new URL(e,t);return typeof location<`u`?n.origin!==location.origin:!0}catch{return!!t}}function y(e,t){return t?t.includes(`{url}`)?t.replace(`{urlRaw}`,f(e)).replace(`{url}`,encodeURIComponent(e)):/[?&]url=?$/.test(t)?`${t}${encodeURIComponent(e)}`:t.endsWith(`?`)?`${t}url=${encodeURIComponent(e)}`:t.endsWith(`/`)?`${t}${f(e)}`:`${t}${t.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`:e}function b(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(Error(`read_failed`)),r.readAsDataURL(e)})}function x(e,t){return[t.as||`blob`,t.timeout??3e3,t.useProxy||``,t.errorTTL??8e3,e].join(`|`)}async function S(e,t={}){let n=t.as??`blob`,r=t.timeout??3e3,i=t.useProxy||``,a=t.errorTTL??8e3,o=t.headers||{},s=!!t.silent;if(/^data:/i.test(e))try{if(n===`text`)return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(n===`dataURL`)return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(`;`)[0]||``};let[,t=``,r=``]=String(e).match(/^data:([^,]*),(.*)$/)||[],i=/;base64/i.test(t)?atob(r):decodeURIComponent(r),a=new Uint8Array([...i].map(e=>e.charCodeAt(0))),o=new Blob([a],{type:(t||``).split(`;`)[0]||``});return{ok:!0,data:o,status:200,url:e,fromCache:!1,mime:o.type||``}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:`special_url_error`}}if(/^blob:/i.test(e))try{let t=await fetch(e);if(!t.ok)return{ok:!1,data:null,status:t.status,url:e,fromCache:!1,reason:`http_error`};let r=await t.blob(),i=r.type||t.headers.get(`content-type`)||``;return n===`dataURL`?{ok:!0,data:await b(r),status:t.status,url:e,fromCache:!1,mime:i}:n===`text`?{ok:!0,data:await r.text(),status:t.status,url:e,fromCache:!1,mime:i}:{ok:!0,data:r,status:t.status,url:e,fromCache:!1,mime:i}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:`network`}}if(/^about:blank$/i.test(e))return n===`dataURL`?{ok:!0,data:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==`,status:200,url:e,fromCache:!1,mime:`image/png`}:{ok:!0,data:n===`text`?``:new Blob([]),status:200,url:e,fromCache:!1};let c=x(e,{as:n,timeout:r,useProxy:i,errorTTL:a}),l=T.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&T.delete(c);let u=w.get(c);if(u)return u;let d=v(e,i)?y(e,i):e,f=t.credentials;if(!f)try{let t=typeof location<`u`&&location.href?location.href:`http://localhost/`,n=new URL(e,t);f=typeof location<`u`&&n.origin===location.origin?`include`:`omit`}catch{f=`omit`}let p=new AbortController,m=setTimeout(()=>p.abort(`timeout`),r),h=(async()=>{try{let r=await fetch(d,{signal:p.signal,credentials:f,headers:o});if(!r.ok){let i={ok:!1,data:null,status:r.status,url:d,fromCache:!1,reason:`http_error`};if(a>0&&T.set(c,{until:Date.now()+a,result:i}),!s){let t=`${r.status} ${r.statusText||``}`.trim();C.warnOnce(`http:${r.status}:${n}:${new URL(e,location?.href??`http://localhost/`).origin}`,`HTTP error ${t} while fetching ${n} ${e}`)}return t.onError&&t.onError(i),i}if(n===`text`)return{ok:!0,data:await r.text(),status:r.status,url:d,fromCache:!1};let i=await r.blob(),l=i.type||r.headers.get(`content-type`)||``;return n===`dataURL`?{ok:!0,data:await b(i),status:r.status,url:d,fromCache:!1,mime:l}:{ok:!0,data:i,status:r.status,url:d,fromCache:!1,mime:l}}catch(i){let o=i&&typeof i==`object`&&`name`in i&&i.name===`AbortError`?String(i.message||``).includes(`timeout`)?`timeout`:`abort`:`network`,l={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:o};if(!/^blob:/i.test(e)&&a>0&&T.set(c,{until:Date.now()+a,result:l}),!s){let t=`${o}:${n}:${new URL(e,location?.href??`http://localhost/`).origin}`,i=o===`timeout`?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${e}`:o===`abort`?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;C.errorOnce(t,i)}return t.onError&&t.onError(l),l}finally{clearTimeout(m),w.delete(c)}})();return w.set(c,h),h}var C,w,T,E=r(()=>{m(),C=h(`[snapDOM]`,{ttlMs:3*6e4,maxEntries:10}),w=new Map,T=new Map});async function D(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()===`none`)return e;let n=u(e);if(!n)return e;let r=f(p(n)),i=(t.useProxy||``)+`|`+r;if(c.background.has(i)){let e=c.background.get(i);return e?`url("${e}")`:`none`}try{let e=await S(r,{as:`dataURL`,useProxy:t.useProxy});return e.ok?(c.background.set(i,e.data),`url("${e.data}")`):(c.background.set(i,null),`none`)}catch{return c.background.set(i,null),`none`}}var O=r(()=>{l(),m(),E()});function k(e){if(e=String(e).toLowerCase(),se.has(e)){let t={};return c.defaultStyle.set(e,t),t}if(c.defaultStyle.has(e))return c.defaultStyle.get(e);let t=document.getElementById(`snapdom-sandbox`);t||(t=document.createElement(`div`),t.id=`snapdom-sandbox`,t.setAttribute(`data-snapdom-sandbox`,`true`),t.setAttribute(`aria-hidden`,`true`),t.style.position=`absolute`,t.style.left=`-9999px`,t.style.top=`-9999px`,t.style.width=`0px`,t.style.height=`0px`,t.style.overflow=`hidden`,document.body.appendChild(t));let n=document.createElement(e);n.style.all=`initial`,t.appendChild(n);let r=getComputedStyle(n),i={};for(let e of r)A(e)||(i[e]=r.getPropertyValue(e));return t.removeChild(n),c.defaultStyle.set(e,i),i}function A(e){let t=ue.get(e);if(t===void 0){let n=String(e).toLowerCase();t=P.has(n)||le.test(n)||ce.test(n),ue.set(e,t)}return t}function ee(e,t){return!pe.has(e)&&(t===`inline`||de.has(e)||fe.has(e))}function te(e,t,n=!0,r=!1){if(t=String(t||``).toLowerCase(),se.has(t))return``;let i=[],a=k(t),o=(e.display||``).toLowerCase(),s=o===`inline`,c=ee(t,o)&&n,l=!1;for(let t in e){if(A(t))continue;let n=e[t];if(c){if(me.has(t))continue;if(he.has(t)){n&&n!==a[t]&&(i.push(`${t}:${n}`),n!==`auto`&&(l=!0));continue}}n&&n!==a[t]&&i.push(`${t}:${n}`)}if(c&&!s&&!r&&!l){let t=e.width;t&&t!==`auto`&&t!==a.width&&i.push(`min-width:${t}`)}return i.sort(),i.join(`;`)}function ne(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll==`function`&&e.querySelectorAll(`*`).forEach(e=>t.add(e.tagName.toLowerCase())),Array.from(t))}function re(e){let t=new Map;for(let n of e){let e=c.defaultStyle.get(n);if(!e)continue;let r=Object.entries(e).map(([e,t])=>`${e}:${t};`).sort().join(``);r&&(t.has(r)||t.set(r,[]),t.get(r).push(n))}let n=``;for(let[e,r]of t.entries())n+=`${r.join(`,`)} { ${e} }
2
- `;return n}function ie(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let e of t)n.set(e,`c${r++}`);return n}function ae(e){try{let t=e?.ownerDocument;if(!t)return typeof window<`u`?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle==`function`)return n;if(typeof window<`u`&&window.frames)for(let e=0;e<window.frames.length;e++)try{if(window.frames[e]?.document===t)return window.frames[e]}catch{}}catch{}return typeof window<`u`?window:null}function j(e,t=null){let n=()=>{let e={length:0,getPropertyValue:()=>``,item:()=>``};return e[Symbol.iterator]=function*(){},e};if(!(e instanceof Element)){let r=typeof window<`u`?window:null;if(r&&typeof r.getComputedStyle==`function`)try{return r.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=c.computedStyle.get(e);r||(r=new Map,c.computedStyle.set(e,r));let i=r.get(t);if(!i){let a=ae(e),o=null;try{o=a&&typeof a.getComputedStyle==`function`?a.getComputedStyle(e,t):null}catch{}if(!o&&typeof window<`u`&&typeof window.getComputedStyle==`function`)try{e.ownerDocument===document&&(o=window.getComputedStyle(e,t))}catch{}i=o||n(),r.set(t,i)}return i}function oe(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);for(let e of ge){let n=t[`border-${e}-style`];(n===`none`||n===`hidden`||t[`border-${e}-width`]===`0px`)&&(delete t[`border-${e}-style`],delete t[`border-${e}-width`],delete t[`border-${e}-color`])}return t}function M(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&n++,a===`)`&&n--,a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var N,se,ce,le,P,ue,de,fe,pe,me,he,ge,_e=r(()=>{l(),N=new Set([`meta`,`script`,`noscript`,`title`,`link`,`template`]),se=new Set([`meta`,`link`,`style`,`title`,`noscript`,`script`,`template`,`g`,`defs`,`use`,`marker`,`mask`,`clipPath`,`pattern`,`path`,`polygon`,`polyline`,`line`,`circle`,`ellipse`,`rect`,`filter`,`lineargradient`,`radialgradient`,`stop`]),ce=/(?:^|-)(animation|transition)(?:-|$)/i,le=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,P=new Set([`cursor`,`pointer-events`,`touch-action`,`user-select`,`print-color-adjust`,`speak`,`reading-flow`,`reading-order`,`anchor-name`,`anchor-scope`,`container-name`,`container-type`,`timeline-scope`,`zoom`]),ue=new Map,de=new Set([`span`,`small`,`em`,`strong`,`b`,`i`,`u`,`s`,`code`,`cite`,`mark`,`sub`,`sup`]),fe=new Set([`table`,`thead`,`tbody`,`tfoot`,`tr`,`td`,`th`]),pe=new Set([`img`,`video`,`canvas`,`svg`,`iframe`,`embed`,`object`,`input`,`textarea`,`select`]),me=new Set([`width`,`max-width`,`inline-size`,`max-inline-size`]),he=new Set([`min-width`,`min-inline-size`]),ge=[`top`,`right`,`bottom`,`left`]});function F(e,{fast:t=!1}={}){if(t)return e();`requestIdleCallback`in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ve(){if(typeof navigator>`u`)return!1;if(navigator.userAgentData)return navigator.userAgentData.platform===`iOS`;let e=navigator.userAgent||``,t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function I(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent||``,t=e.toLowerCase(),n=t.includes(`safari`)&&!t.includes(`chrome`)&&!t.includes(`crios`)&&!t.includes(`fxios`)&&!t.includes(`android`),r=/applewebkit/i.test(e),i=/mobile/i.test(e),a=!/safari/i.test(e),o=r&&i&&a,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),l=/ipad|iphone|ipod/.test(t)&&r;return n||o||s||c||l}function ye(){if(typeof navigator>`u`)return!1;let e=(navigator.userAgent||``).toLowerCase();return e.includes(`firefox`)||e.includes(`fxios`)}var be=r(()=>{});function L(e,t,n){let r=e&&typeof e==`object`&&(e.options||e);r&&r.debug&&(n===void 0?console.warn(`[snapdom]`,t):console.warn(`[snapdom]`,t,n))}var xe=r(()=>{}),R=r(()=>{O(),_e(),be(),m(),xe()}),Se={};i(Se,{toCanvas:()=>Ne});function Ce(e){if(!we(e))return e;try{let t=Te(e),n=t.match(/<svg\b[^>]*>/i);if(!n)return e;let r=n[0],i=parseFloat((r.match(/\bwidth="([\d.]+)/i)||[])[1]),a=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(i)||!Number.isFinite(a)||i<=0||a<=0)return e;let o=Math.min(1,z/i,z/a,Math.sqrt(Pe/(i*a)));if(o>=1)return e;let s=Math.max(1,Math.floor(i*o)),c=Math.max(1,Math.floor(a*o));return console.warn(`[snapDOM] Capture ${Math.round(i)}\xD7${Math.round(a)}px exceeds the browser image-decode limit (${z}px/side); downscaling to ${s}\xD7${c}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`),Ee(t.replace(r,r.replace(/(\bwidth=")[\d.]+/i,`$1${s}`).replace(/(\bheight=")[\d.]+/i,`$1${c}`)))}catch{return e}}function we(e){return typeof e==`string`&&/^data:image\/svg\+xml/i.test(e)}function Te(e){let t=e.indexOf(`,`);return t>=0?decodeURIComponent(e.slice(t+1)):``}function Ee(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function De(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&r++,a===`)`&&(r=Math.max(0,r-1)),a===`;`&&r===0?(t.push(n),n=``):n+=a}return n.trim()&&t.push(n),t.map(e=>e.trim()).filter(Boolean)}function Oe(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&r++,a===`)`&&(r=Math.max(0,r-1)),a===`,`&&r===0?(t.push(n.trim()),n=``):n+=a}n.trim()&&t.push(n.trim());let i=[];for(let e of t){if(/\binset\b/i.test(e))continue;let[t=`0px`,n=`0px`,r=`0px`]=e.match(/-?\d+(?:\.\d+)?px/gi)||[],a=e.replace(/-?\d+(?:\.\d+)?px/gi,``).replace(/\binset\b/gi,``).trim().replace(/\s{2,}/g,` `),o=!!a&&a!==`,`;i.push(`drop-shadow(${t} ${n} ${r}${o?` ${a}`:``})`)}return i.join(` `)}function ke(e){let t=De(e),n=null,r=null,i=null,a=[];for(let e of t){let t=e.indexOf(`:`);if(t<0)continue;let o=e.slice(0,t).trim().toLowerCase(),s=e.slice(t+1).trim();o===`box-shadow`?i=s:o===`filter`?n=s:o===`-webkit-filter`?r=s:a.push([o,s])}if(i){let e=Oe(i);e&&(n=n?`${n} ${e}`:e,r=r?`${r} ${e}`:e)}let o=[...a];return n&&o.push([`filter`,n]),r&&o.push([`-webkit-filter`,r]),o.map(([e,t])=>`${e}:${t}`).join(`;`)}function Ae(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,n)=>`${t}{${ke(n)}}`)}function je(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,Ae(t))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,n)=>`style=${t}${ke(n)}${t}`),e}function Me(e){if(!I()||!we(e))return e;try{return Ee(je(Te(e)))}catch{return e}}async function Ne(e,t){let{width:n,height:r,scale:i=1,dpr:a=1,meta:o={},backgroundColor:s}=t;e=Me(e),e=Ce(e);let c=new Image;if(c.loading=`eager`,c.decoding=`sync`,c.crossOrigin=`anonymous`,c.src=e,await c.decode(),I()){c.style.cssText=`position:fixed;left:-99999px;top:-99999px;pointer-events:none`,document.body.appendChild(c);try{await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))}finally{try{c.remove()}catch{}}}let l=c.naturalWidth,u=c.naturalHeight,d=Number.isFinite(o.w0)?o.w0:l,f=Number.isFinite(o.h0)?o.h0:u,p,m,h=Number.isFinite(n),g=Number.isFinite(r);if(h&&g)p=Math.max(1,n),m=Math.max(1,r);else if(h){let e=n/Math.max(1,d);p=n,m=f*e}else if(g){let e=r/Math.max(1,f);m=r,p=d*e}else p=l,m=u;p*=i,m*=i;let _=p*a,v=m*a,y=Math.max(_/z,v/z,Math.sqrt(_*v/Pe));y>1&&(console.warn(`[snapDOM] Output ${Math.round(_)}\xD7${Math.round(v)}px exceeds the browser canvas limit (${z}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),p/=y,m/=y);let b=document.createElement(`canvas`);b.width=p*a,b.height=m*a,b.style.width=`${p}px`,b.style.height=`${m}px`;let x=b.getContext(`2d`);return a!==1&&x.scale(a,a),s&&(x.save(),x.fillStyle=s,x.fillRect(0,0,p,m),x.restore()),x.drawImage(c,0,0,p,m),b}var z,Pe,Fe=r(()=>{be(),z=16384,Pe=16384*16384}),Ie={};i(Ie,{rasterize:()=>Le});async function Le(e,t){let n=await Ne(e,t),r=new Image;return r.src=n.toDataURL(`image/${t.format}`,t.quality),await r.decode(),r.style.width=`${n.width/t.dpr}px`,r.style.height=`${n.height/t.dpr}px`,r}var Re=r(()=>{Fe()}),ze={};i(ze,{toImg:()=>Be,toSvg:()=>Be});async function Be(e,t){let{scale:n=1,width:r,height:i,meta:a={}}=t,o=Number.isFinite(r),s=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||o||s;if(I()&&c)return await Le(e,{...t,format:`png`,quality:1,meta:a});let l=new Image;if(l.decoding=`sync`,l.loading=`eager`,l.src=e,await l.decode(),o&&s)l.style.width=`${r}px`,l.style.height=`${i}px`;else if(o){let e=Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.h0)?a.h0:l.naturalHeight,n=r/Math.max(1,e);l.style.width=`${r}px`,l.style.height=`${Math.round(t*n)}px`}else if(s){let e=Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.h0)?a.h0:l.naturalHeight,n=i/Math.max(1,t);l.style.height=`${i}px`,l.style.width=`${Math.round(e*n)}px`}else{let r=Math.round(l.naturalWidth*n),i=Math.round(l.naturalHeight*n);if(l.style.width=`${r}px`,l.style.height=`${i}px`,typeof e==`string`&&e.startsWith(`data:image/svg+xml`))try{let t=decodeURIComponent(e.split(`,`)[1]).replace(/width="[^"]*"/,`width="${r}"`).replace(/height="[^"]*"/,`height="${i}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,l.src=e}catch(e){L(t,`SVG width/height patch in toImg failed`,e)}}return l}var Ve=r(()=>{R(),Re()}),He={};i(He,{toBlob:()=>Ue});async function Ue(e,t){let n=t.type;if(n===`svg`){let t=decodeURIComponent(e.split(`,`)[1]);return new Blob([t],{type:`image/svg+xml`})}let r=await Ne(e,t);return new Promise(e=>r.toBlob(t=>e(t),`image/${n}`,t.quality))}var We=r(()=>{Fe()}),Ge={};i(Ge,{download:()=>qe});async function Ke(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(e){if(e.name!==`AbortError`)return!1}return!0}async function qe(e,t){let n=new Set([`png`,`jpeg`,`jpg`,`webp`,`svg`]),r=(t?.type||``).toLowerCase(),i=n.has(r)?r:``,a=(t?.format||i||``).toLowerCase(),o=a===`jpg`?`jpeg`:a||`png`,s=t?.filename||`snapdom.${o}`,c={...t||{},format:o,type:o};c.dpr=1;let l=ve();if(o===`svg`){let t=await Ue(e,{...c,type:`svg`});if(l&&await Ke(t,s))return;let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=s,document.body.appendChild(r),r.click(),URL.revokeObjectURL(n),r.remove();return}let u=await Ne(e,c);if(l){let e=`image/${o}`,n=await new Promise(n=>u.toBlob(n,e,t?.quality));if(n&&await Ke(n,s))return}let d=document.createElement(`a`);d.href=u.toDataURL(`image/${o}`,t?.quality),d.download=s,document.body.appendChild(d),d.click(),d.remove()}var Je=r(()=>{We(),Fe(),be()});R(),R(),l();var Ye=new WeakMap,Xe=new Map,Ze=2e3,Qe=0;function $e(){Qe++,Xe.size>Ze&&Xe.clear()}var et=!1;function tt(e=document.documentElement){if(!et){et=!0;try{new MutationObserver(()=>$e()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>$e()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.(`loadingdone`,$e),e.ready?.then(()=>$e()).catch(()=>{}))}catch{}}}function nt(e,t={}){let n={},r=e.getPropertyValue(`visibility`),i=t.excludeStyleProps;for(let t=0;t<e.length;t++){let r=e[t];if(A(r)||i&&(i instanceof RegExp&&i.test(r)||typeof i==`function`&&i(r)))continue;let a=e.getPropertyValue(r);(r===`background-image`||r===`content`)&&a.includes(`url(`)&&!a.includes(`data:`)&&(a=`none`),n[r]=a}for(let t of[`text-decoration-line`,`text-decoration-color`,`text-decoration-style`,`text-decoration-thickness`,`text-underline-offset`,`text-decoration-skip-ink`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}for(let t of[`-webkit-text-stroke`,`-webkit-text-stroke-width`,`-webkit-text-stroke-color`,`paint-order`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}if(t.embedFonts){for(let t of[`font-feature-settings`,`font-variation-settings`,`font-kerning`,`font-variant`,`font-variant-ligatures`,`font-optical-sizing`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}}r===`hidden`&&(n.opacity=`0`);try{(n[`content-visibility`]||e.getPropertyValue(`content-visibility`))===`hidden`&&(n.visibility=`hidden`)}catch{}let a=parseFloat(e.getPropertyValue(`border-top-width`)||0)||0,o=parseFloat(e.getPropertyValue(`border-right-width`)||0)||0,s=parseFloat(e.getPropertyValue(`border-bottom-width`)||0)||0,c=parseFloat(e.getPropertyValue(`border-left-width`)||0)||0;if(a===0&&o===0&&s===0&&c===0){let t=(e.getPropertyValue(`border-image-source`)||``).trim(),r=t&&t!==`none`;for(let e of`border.border-top.border-right.border-bottom.border-left.border-width.border-style.border-color.border-top-width.border-top-style.border-top-color.border-right-width.border-right-style.border-right-color.border-bottom-width.border-bottom-style.border-bottom-color.border-left-width.border-left-style.border-left-color.border-block.border-block-width.border-block-style.border-block-color.border-inline.border-inline-width.border-inline-style.border-inline-color`.split(`.`))delete n[e];r||(n.border=`none`)}return n}function rt(e){if(e.firstElementChild)return!0;for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType===3&&/\S/.test(t.nodeValue||``))return!0;return!1}var it=new WeakMap;function at(e){let t=it.get(e);return t||(t=Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0])).map(([e,t])=>`${e}:${t}`).join(`;`),it.set(e,t),t)}function ot(e,t=null,n={}){let r=Ye.get(e),i=!!(n&&n.embedFonts),a=n&&n.excludeStyleProps||null;if(r&&r.epoch===Qe&&r.embedFonts===i&&r.excludeStyleProps===a)return r.snapshot;let o=t||getComputedStyle(e),s=nt(o,n);return pt(e,o,s),Ye.set(e,{epoch:Qe,snapshot:s,embedFonts:i,excludeStyleProps:a}),s}function st(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Xe,defaultStyle:c.defaultStyle,baseStyle:c.baseStyle,image:c.image,resource:c.resource,background:c.background,font:c.font},options:t||{}}:{session:c.session,persist:{snapshotKeyCache:Xe,defaultStyle:c.defaultStyle,baseStyle:c.baseStyle,image:c.image,resource:c.resource,background:c.background,font:c.font},options:e||t||{}}}function ct(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],a=n.getPropertyValue(i);a&&t.style.setProperty(i,a)}}async function B(e,t,n,r){if(e.tagName===`STYLE`)return;let i=st(n,r),a=i.options&&i.options.cache||`auto`;a!==`disabled`&&tt(document.documentElement),a===`disabled`&&!i.session.__bumpedForDisabled&&($e(),Xe.clear(),i.session.__bumpedForDisabled=!0);let{session:o,persist:s}=i;if(!o.styleCache.has(e)){let t=null;try{t=getComputedStyle(e)}catch{}o.styleCache.set(e,t||getComputedStyle(document.documentElement))}let c=o.styleCache.get(e);e.getAttribute?.(`style`)&&ct(e,t,c);let l=ot(e,c,i.options),u=dt(e);if(u){let e=c.getPropertyValue(`min-width`);(!e||e===`auto`||e===`0px`)&&(l[`min-width`]=`0px`)}let d=e.tagName?.toLowerCase()||`div`,f=at(l),p=!0;ee(d,(l.display||``).toLowerCase())&&(p=rt(e),f=`${f}|${d}${p?`|c`:``}${u?`|f`:``}`);let m=s.snapshotKeyCache.get(f);m===void 0&&(m=te(l,d,p,u),s.snapshotKeyCache.set(f,m)),o.styleMap.set(t,m)}function lt(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function ut(e){return e.backgroundImage&&e.backgroundImage!==`none`||e.backgroundColor&&e.backgroundColor!==`rgba(0, 0, 0, 0)`&&e.backgroundColor!==`transparent`||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||`visible`)!==`visible`}function dt(e){let t=e.parentElement;if(!t)return!1;let n=j(t).display||``;return n.includes(`flex`)||n.includes(`grid`)}function ft(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let n=e.firstElementChild,r=e.lastElementChild;if(n&&n.tagName===`BR`||r&&r.tagName===`BR`)return!0;let i=e.scrollHeight;return i!==0&&i>(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function pt(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||![`div`,`section`,`article`,`main`,`aside`,`header`,`footer`,`nav`].includes(r))return;let i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!==`none`&&t.aspectRatio!==`auto`)return;let a=t.display||``;if(a.includes(`flex`)||a.includes(`grid`)||lt(e))return;let o=t.position;if(o===`absolute`||o===`fixed`||o===`sticky`||t.transform!==`none`||ut(t)||dt(e))return;let s=t.overflowX||t.overflow||`visible`,c=t.overflowY||t.overflow||`visible`;if(s!==`visible`||c!==`visible`)return;let l=t.clip;l&&l!==`auto`&&l!==`rect(auto, auto, auto, auto)`||t.visibility===`hidden`||t.opacity===`0`||ft(e,t)&&(delete n.height,delete n[`block-size`])}_e();var mt=[`fill`,`stroke`,`color`,`background-color`,`stop-color`],ht=new Set([`symbol`,`defs`,`pattern`,`mask`,`clipPath`,`marker`,`linearGradient`,`radialGradient`,`filter`]);function gt(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI===`http://www.w3.org/2000/svg`&&ht.has(t.localName))return!0;t=t.parentNode}return!1}var _t=new Map;function vt(e,t){let n=t+`::`+e.toLowerCase(),r=_t.get(n);if(r)return r;let i=document,a=t===`http://www.w3.org/2000/svg`?i.createElementNS(t,e):i.createElement(e),o=i.createElement(`div`);o.style.cssText=`position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;`,o.appendChild(a),i.documentElement.appendChild(o);let s=getComputedStyle(a),c={};for(let e of mt)c[e]=s.getPropertyValue(e)||``;return o.remove(),_t.set(n,c),c}function yt(e,t){if(!(e instanceof Element)||!(t instanceof Element)||gt(e))return;let n=e.getAttribute?.(`style`),r=!!(n&&n.includes(`var(`));if(!r&&e.attributes?.length){let t=e.attributes;for(let e=0;e<t.length;e++){let n=t[e];if(n&&typeof n.value==`string`&&n.value.includes(`var(`)){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let n=e.style;if(n&&n.length){let e=new Set;for(let r=0;r<n.length;r++){let a=n[r];if(e.has(a))continue;e.add(a);let o=n.getPropertyValue(a);if(!o||!o.includes(`var(`))continue;let s=i&&i.getPropertyValue(a);if(s)try{t.style.setProperty(a,s.trim(),n.getPropertyPriority(a))}catch{}}}}if(r&&e.attributes?.length){let n=e.attributes;for(let e=0;e<n.length;e++){let r=n[e];if(!r||typeof r.value!=`string`||!r.value.includes(`var(`))continue;let a=r.name,o=i&&i.getPropertyValue(a);if(o)try{t.style.setProperty(a,o.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let n=e.namespaceURI||`html`,r=vt(e.tagName,n);for(let e of mt){let n=i.getPropertyValue(e)||``,a=r[e]||``;if(n&&n!==a)try{t.style.setProperty(e,n.trim())}catch{}}}}R(),R(),l(),E();function bt(e,t,n){return Promise.all(e.map(e=>new Promise(r=>{function i(){F(n=>{!(n&&typeof n.timeRemaining==`function`)||n.timeRemaining()>0?t(e,r):i()},{fast:n})}i()})))}function xt(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function St(e,t,n=!0){return e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>e.startsWith(`:where(`)||e.startsWith(`@`)?e:`:where(${t} ${n?xt(e):e})`).join(`, `)}function Ct(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(e,n)=>`:where(${t}:is(${n.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(e,n)=>`:where(:where(${n.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(e,n)=>`:where(${t} ${n.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(e,n,r,i)=>`${n}${r}${St(i,t,!0)}{`),e):``}function wt(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Tt(e){let t=``;try{e.querySelectorAll(`style`).forEach(e=>{t+=(e.textContent||``)+`
3
- `});let n=e.adoptedStyleSheets||[];for(let e of n)try{if(e&&e.cssRules)for(let n of e.cssRules)t+=n.cssText+`
4
- `}catch{}}catch{}return t}function Et(e,t,n){if(!t)return;let r=document.createElement(`style`);r.setAttribute(`data-sd`,n),r.textContent=t,e.insertBefore(r,e.firstChild||null)}function Dt(e,t){try{let n=e.currentSrc||e.src||``;if(!n)return;t.setAttribute(`src`,n),t.removeAttribute(`srcset`),t.removeAttribute(`sizes`),t.loading=`eager`,t.decoding=`sync`}catch{}}function Ot(e){let t=new Set;if(!e)return t;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(e);)t.add(r[1]);return t}function kt(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let e=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(e)return e}catch{}return``}function At(e,t,n){let r=[];for(let n of t){let t=kt(e,n);t&&r.push(`${n}: ${t};`)}return r.length?`${n}{${r.join(``)}}
5
- `:``}function jt(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute(`data-sd-slotted`,``),e.querySelectorAll&&e.querySelectorAll(`*`).forEach(e=>e.setAttribute(`data-sd-slotted`,``)))}async function Mt(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(e=>setTimeout(e,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function Nt(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,a=0;try{let t=getComputedStyle(e);n=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,i=parseFloat(t.borderTopWidth)||0,a=parseFloat(t.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(t.width-(n+r))),contentHeight:Math.max(0,Math.round(t.height-(i+a))),rect:t}}function V(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let e=parseFloat(r.width);!isNaN(e)&&e>0&&(t=e)}if(n===0){let e=parseFloat(r.height);!isNaN(e)&&e>0&&(n=e)}}catch{}if(t===0||n===0)try{if(t===0){let n=parseFloat(e.getAttribute(`width`));!isNaN(n)&&n>0&&(t=n)}if(n===0){let t=parseFloat(e.getAttribute(`height`));!isNaN(t)&&t>0&&(n=t)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function Pt(e,t,n){let r=e.defaultView,i=r?r.scrollX:0,a=r?r.scrollY:0,o=e.body?e.body.scrollLeft:0,s=e.body?e.body.scrollTop:0,c=e.documentElement?e.documentElement.scrollLeft:0,l=e.documentElement?e.documentElement.scrollTop:0,u=0,d=0,f=0,p=0;try{let t=r&&e.body?r.getComputedStyle(e.body):null;t&&(u=(parseFloat(t.marginTop)||0)+(parseFloat(t.paddingTop)||0),d=(parseFloat(t.marginRight)||0)+(parseFloat(t.paddingRight)||0),f=(parseFloat(t.marginBottom)||0)+(parseFloat(t.paddingBottom)||0),p=(parseFloat(t.marginLeft)||0)+(parseFloat(t.paddingLeft)||0))}catch{}try{e.documentElement.setAttribute(`data-sd-pinned`,``)}catch{}let m=e.createElement(`style`);return m.setAttribute(`data-sd-iframe-pin`,``),m.textContent=`html {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}body {margin: 0 !important;padding: ${u}px ${d}px ${f}px ${p}px !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(m),()=>{try{m.remove()}catch{}try{e.documentElement.removeAttribute(`data-sd-pinned`)}catch{}try{r&&typeof r.scrollTo==`function`&&r.scrollTo(i,a),e.body&&(e.body.scrollLeft=o,e.body.scrollTop=s),e.documentElement&&(e.documentElement.scrollLeft=c,e.documentElement.scrollTop=l)}catch{}}}async function Ft(e,t,n){let r=await Mt(e,3);if(!r)throw Error(`iframe document not accessible/ready`);let{contentWidth:i,contentHeight:a,rect:o}=Nt(e),s=n?.snap;if(!s&&typeof window<`u`&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!=`function`)throw Error(`[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.`);let l={...n,scale:1},u=Pt(r,i,a),d=c.session.nodeMap,f=c.session.styleMap,p=c.session.styleCache,m;try{m=await s.toPng(r.documentElement,l)}finally{u(),c.session.nodeMap=d,c.session.styleMap=f,c.session.styleCache=p}m.style.display=`block`,m.style.width=`${i}px`,m.style.height=`${a}px`;let h=document.createElement(`div`);return t.nodeMap.set(h,e),B(e,h,t,n),h.style.overflow=`hidden`,h.style.display=`block`,h.style.width||(h.style.width=`${Math.round(o.width)}px`),h.style.height||(h.style.height=`${Math.round(o.height)}px`),h.appendChild(m),h}function It(e){let{width:t,height:n}=V(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let a=i?parseFloat(i.width):NaN,o=i?parseFloat(i.height):NaN,s=Math.round(t||r.width||0),c=Math.round(n||r.height||0),l=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,s||16),u=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),d=(e.type||`text`).toLowerCase()===`checkbox`,f=!!e.checked,p=!!e.indeterminate,m=Math.max(Math.min(l,u),12),h=`middle`;try{i&&i.verticalAlign&&(h=i.verticalAlign)}catch{}let g=document.createElement(`div`);g.setAttribute(`data-snapdom-input-replacement`,e.type||`checkbox`),g.style.cssText=`display:inline-block;width:${m}px;height:${m}px;vertical-align:${h};flex-shrink:0;line-height:0;`;let _=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);_.setAttribute(`width`,String(m)),_.setAttribute(`height`,String(m)),_.setAttribute(`viewBox`,`0 0 ${m} ${m}`),g.appendChild(_);function v(){let e=`#0a6ed1`;try{i&&(e=i.accentColor||i.color||e)}catch{}let t=m-2;if(_.innerHTML=``,d){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);if(n.setAttribute(`x`,`1`),n.setAttribute(`y`,`1`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`rx`,`2`),n.setAttribute(`ry`,`2`),n.setAttribute(`fill`,f?e:`none`),n.setAttribute(`stroke`,e),n.setAttribute(`stroke-width`,`2`),_.appendChild(n),f){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);e.setAttribute(`d`,`M 3 ${m/2} L ${m/2-1} ${m-1-2} L ${m-1-2} 3`),e.setAttribute(`stroke`,`white`),e.setAttribute(`stroke-width`,`2`),e.setAttribute(`fill`,`none`),e.setAttribute(`stroke-linecap`,`round`),e.setAttribute(`stroke-linejoin`,`round`),_.appendChild(e)}else if(p){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),r=Math.max(6,t-4);n.setAttribute(`x`,String((m-r)/2)),n.setAttribute(`y`,String((m-2)/2)),n.setAttribute(`width`,String(r)),n.setAttribute(`height`,`2`),n.setAttribute(`fill`,e),n.setAttribute(`rx`,`1`),_.appendChild(n)}}else{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);if(t.setAttribute(`cx`,String(m/2)),t.setAttribute(`cy`,String(m/2)),t.setAttribute(`r`,String((m-2)/2)),t.setAttribute(`fill`,f?e:`none`),t.setAttribute(`stroke`,e),t.setAttribute(`stroke-width`,`2`),_.appendChild(t),f){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),t=Math.max(2,(m-4)*.35);e.setAttribute(`cx`,String(m/2)),e.setAttribute(`cy`,String(m/2)),e.setAttribute(`r`,String(t)),e.setAttribute(`fill`,`white`),_.appendChild(e)}}g.style.setProperty(`width`,`${m}px`,`important`),g.style.setProperty(`height`,`${m}px`,`important`),g.style.setProperty(`min-width`,`${m}px`,`important`),g.style.setProperty(`min-height`,`${m}px`,`important`)}return v(),{el:g,applyVisual:v}}var Lt=new s(80);async function Rt(e){if(c.resource?.has(e))return c.resource.get(e);if(Lt.has(e))return Lt.get(e);let t=(async()=>{let t=await S(e,{as:`dataURL`,silent:!0});if(!t.ok||typeof t.data!=`string`)throw Error(`[snapDOM] Failed to read blob URL: ${e}`);return c.resource?.set(e,t.data),t.data})();Lt.set(e,t);try{let n=await t;return Lt.set(e,n),n}catch(t){throw Lt.delete(e),t}}var zt=/\bblob:[^)"'\s]+/g;async function Bt(e){if(!e||e.indexOf(`blob:`)===-1)return e;let t=Array.from(new Set(e.match(zt)||[]));if(t.length===0)return e;let n=e;for(let e of t)try{let t=await Rt(e);n=n.split(e).join(t)}catch{}return n}function Vt(e){return typeof e==`string`&&e.startsWith(`blob:`)}function Ht(e){return(e||``).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/^(\S+)(\s+.+)?$/);return t?{url:t[1],desc:t[2]||``}:null}).filter(Boolean)}function Ut(e){return e.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(`, `)}async function Wt(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll(`img`):[];for(let e of r)try{let t=e.getAttribute(`src`)||e.currentSrc||``;if(Vt(t)){let n=await Rt(t);e.setAttribute(`src`,n)}let r=e.getAttribute(`srcset`);if(r&&r.includes(`blob:`)){let t=Ht(r),i=!1;for(let e of t)if(Vt(e.url))try{e.url=await Rt(e.url),i=!0}catch(e){L(n,`blobUrlToDataUrl for srcset item failed`,e)}i&&e.setAttribute(`srcset`,Ut(t))}}catch(e){L(n,`resolveBlobUrls for img failed`,e)}let i=e.querySelectorAll?e.querySelectorAll(`image`):[];for(let e of i)try{let t=`http://www.w3.org/1999/xlink`,n=e.getAttribute(`href`)||e.getAttributeNS?.(t,`href`);if(Vt(n)){let r=await Rt(n);e.setAttribute(`href`,r),e.removeAttributeNS?.(t,`href`)}}catch(e){L(n,`resolveBlobUrls for SVG image href failed`,e)}let a=e.querySelectorAll?e.querySelectorAll(`[style*='blob:']`):[];for(let e of a)try{let t=e.getAttribute(`style`);if(t&&t.includes(`blob:`)){let n=await Bt(t);e.setAttribute(`style`,n)}}catch(e){L(n,`replaceBlobUrls in inline style failed`,e)}let o=e.querySelectorAll?e.querySelectorAll(`style`):[];for(let e of o)try{let t=e.textContent||``;t.includes(`blob:`)&&(e.textContent=await Bt(t))}catch(e){L(n,`replaceBlobUrls in style tag failed`,e)}for(let t of[`poster`]){let r=e.querySelectorAll?e.querySelectorAll(`[${t}^='blob:']`):[];for(let e of r)try{let n=e.getAttribute(t);Vt(n)&&e.setAttribute(t,await Rt(n))}catch(e){L(n,`resolveBlobUrls for ${t} failed`,e)}}}be();function Gt(e){let{width:t,height:n}=V(e),r=t,i=n;if(!r||!i){let t=e.getBoundingClientRect();r=r||t.width||0,i=i||t.height||0}let a=document.createElement(`div`);return a.style.cssText=`display:inline-block;width:${r}px;height:${i}px;visibility:hidden;`,a}async function Kt(e,t,n){if(!e)throw Error(`Invalid node`);let r=new Set,i=null,a=null;if(e.nodeType===Node.ELEMENT_NODE){let n=(e.localName||e.tagName||``).toLowerCase();if(e.id===`snapdom-sandbox`||e.hasAttribute(`data-snapdom-sandbox`)||N.has(n))return null;if(n===`foreignobject`&&e.parentElement?.closest?.(`foreignObject`))return L(t,`Nested <foreignObject> skipped (SVG spec limitation — not rendered by browsers)`),null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute(`data-capture`)===`exclude`){if(n.excludeMode===`hide`)return Gt(e);if(n.excludeMode===`remove`)return null}if(n.exclude&&Array.isArray(n.exclude))for(let t of n.exclude)try{if(e.matches?.(t)){if(n.excludeMode===`hide`)return Gt(e);if(n.excludeMode===`remove`)return null}}catch(e){console.warn(`Invalid selector in exclude option: ${t}`,e)}if(typeof n.filter==`function`)try{if(!n.filter(e)){if(n.filterMode===`hide`)return Gt(e);if(n.filterMode===`remove`)return null}}catch(e){console.warn(`Error in filter function:`,e)}if(e.tagName===`IFRAME`){let r=!1;try{r=!!(e.contentDocument||e.contentWindow?.document)}catch(e){L(t,`iframe same-origin probe failed`,e)}if(r)try{return await Ft(e,t,n)}catch(e){console.warn(`[SnapDOM] iframe rasterization failed, fallback:`,e)}if(r||console.warn(`[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.`,e),n.placeholders){let{width:r,height:i}=V(e),a=document.createElement(`div`);return a.style.cssText=`width:${r}px;height:${i}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,B(e,a,t,n),a}else{let{width:r,height:i}=V(e),a=document.createElement(`div`);return a.style.cssText=`display:inline-block;width:${r}px;height:${i}px;visibility:hidden;`,B(e,a,t,n),a}}if(e.getAttribute(`data-capture`)===`placeholder`){let r=e.cloneNode(!1);t.nodeMap.set(r,e),B(e,r,t,n);let i=document.createElement(`div`);return i.textContent=e.getAttribute(`data-placeholder-text`)||``,i.style.cssText=`color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;`,r.appendChild(i),r}if(e.tagName===`CANVAS`){let r=``;try{let t=e.getContext(`2d`,{willReadFrequently:!0});try{t&&t.getImageData(0,0,1,1)}catch{}if(await new Promise(e=>requestAnimationFrame(e)),r=e.toDataURL(`image/png`),!r||r===`data:,`){try{t&&t.getImageData(0,0,1,1)}catch{}if(await new Promise(e=>requestAnimationFrame(e)),r=e.toDataURL(`image/png`),!r||r===`data:,`){let t=document.createElement(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n&&(n.drawImage(e,0,0),r=t.toDataURL(`image/png`))}}}catch(e){L(t,`Canvas toDataURL failed, using empty/fallback`,e)}let i=document.createElement(`img`);try{i.decoding=`sync`,i.loading=`eager`}catch(e){L(t,`img decoding/loading hints failed`,e)}r&&(i.src=r),i.width=e.width,i.height=e.height;let{width:a,height:o}=V(e);return a>0&&(i.style.width=`${a}px`),o>0&&(i.style.height=`${o}px`),t.nodeMap.set(i,e),B(e,i,t,n),i}if(e.tagName===`VIDEO`){let r=``;try{let t=document.createElement(`canvas`);t.width=e.videoWidth||e.offsetWidth||320,t.height=e.videoHeight||e.offsetHeight||240;let n=t.getContext(`2d`);n&&(n.drawImage(e,0,0,t.width,t.height),r=t.toDataURL(`image/png`),(!r||r===`data:,`)&&(r=``))}catch(e){L(t,`Video frame capture failed, using poster fallback`,e)}let i=document.createElement(`img`);try{i.decoding=`sync`,i.loading=`eager`}catch{}r?i.src=r:e.poster&&(i.src=e.poster),i.width=e.videoWidth||e.offsetWidth||0,i.height=e.videoHeight||e.offsetHeight||0;let{width:a,height:o}=V(e);return a>0&&(i.style.width=`${a}px`),o>0&&(i.style.height=`${o}px`),i.style.objectFit=`contain`,t.nodeMap.set(i,e),B(e,i,t,n),i}if(e.tagName===`AUDIO`&&e.controls){let{width:r,height:i}=V(e),a=Math.round(r||e.offsetWidth||300),o=Math.round(i||e.offsetHeight||54),s=o/2,c=Math.max(4,o*.16),l=o*.34,u=a-o*.34,d=l+c+o*.55,f=Math.max(0,u-o*.7-d),p=Math.max(9,Math.round(o*.24)),m=`<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${o}" viewBox="0 0 ${a} ${o}"><rect width="${a}" height="${o}" rx="${Math.min(o/2,10)}" fill="#f1f3f4"/><path d="M ${l} ${s-c} L ${l+c} ${s} L ${l} ${s+c} Z" fill="#5f6368"/><rect x="${d}" y="${s-1.5}" width="${f}" height="3" rx="1.5" fill="#bdc1c6"/><circle cx="${d}" cy="${s}" r="${Math.max(3,o*.09)}" fill="#5f6368"/><text x="${u}" y="${s}" fill="#5f6368" font-family="sans-serif" font-size="${p}" text-anchor="end" dominant-baseline="central">0:00</text></svg>`,h=document.createElement(`img`);try{h.decoding=`sync`,h.loading=`eager`}catch{}return h.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,h.width=a,h.height=o,h.style.width=`${a}px`,h.style.height=`${o}px`,t.nodeMap.set(h,e),B(e,h,t,n),h}let o;try{if(o=e.cloneNode(!1),o.attributes?.length)try{for(let e of o.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(e.value)&&o.setAttribute(e.name,e.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,``))}catch{}if(yt(e,o),t.nodeMap.set(o,e),e.tagName===`IMG`){Dt(e,o);try{let{width:t,height:n}=V(e),r=Math.round(t||0),i=Math.round(n||0);r&&(o.dataset.snapdomWidth=String(r)),i&&(o.dataset.snapdomHeight=String(i))}catch(e){L(t,`getUnscaledDimensions for IMG failed`,e)}try{let t=e.getAttribute(`style`)||``,n=window.getComputedStyle(e),r=e=>{let r=t.match(RegExp(`${e}\\s*:\\s*([^;]+)`,`i`)),i=r?r[1].trim():n.getPropertyValue(e);return/%|auto/i.test(String(i||``))},i=parseInt(o.dataset.snapdomWidth||`0`,10),a=parseInt(o.dataset.snapdomHeight||`0`,10),s=r(`width`)||!i,c=r(`height`)||!a;s&&i&&(o.style.width=`${i}px`),c&&a&&(o.style.height=`${a}px`);let l=n.getPropertyValue(`object-fit`),u=n.getPropertyValue(`object-position`);l&&l!==`fill`?(o.style.objectFit=l,u&&(o.style.objectPosition=u)):(i&&(o.style.minWidth=`${i}px`),a&&(o.style.minHeight=`${a}px`))}catch(e){L(t,`IMG dimension freeze failed`,e)}}}catch(t){throw console.error(`[Snapdom] Failed to clone node:`,e,t),t}let s=null;if(e instanceof HTMLTextAreaElement){let{width:t,height:n}=V(e),r=t||e.getBoundingClientRect().width||0,i=n||e.getBoundingClientRect().height||0;r&&(o.style.width=`${r}px`),i&&(o.style.height=`${i}px`)}if(e instanceof HTMLInputElement){let n=(e.type||`text`).toLowerCase();if((n===`checkbox`||n===`radio`)&&ye()){let{el:n,applyVisual:r}=It(e);t.nodeMap.set(n,e),s=r,o=n}else o.value=e.value,o.setAttribute(`value`,e.value),e.checked!==void 0&&(o.checked=e.checked,e.checked&&o.setAttribute(`checked`,``),e.indeterminate&&(o.indeterminate=e.indeterminate))}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&!e.value&&e.placeholder)try{let t=window.getComputedStyle(e,`::placeholder`),n=t&&t.color;if(n&&n!==`rgba(0, 0, 0, 0)`){let e=`snapdom-ph-`+(Math.random()*1e6|0);o.classList.add(e);let r=document.createElement(`style`);r.textContent=`.${e}::placeholder{color:${n}!important;opacity:${t.opacity||`1`}!important;-webkit-text-fill-color:${n}!important;}`,o.prepend(r)}}catch{}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(a=e.value),e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){e.disabled&&o.setAttribute(`disabled`,``),e.required&&o.setAttribute(`required`,``),e.readOnly&&o.setAttribute(`readonly`,``);let t=e;t.min!==void 0&&t.min!==``&&o.setAttribute(`min`,t.min),t.max!==void 0&&t.max!==``&&o.setAttribute(`max`,t.max),t.pattern!==void 0&&t.pattern!==``&&o.setAttribute(`pattern`,t.pattern);let n=e.getAttribute(`aria-invalid`);n!==null&&o.setAttribute(`aria-invalid`,n)}if(gt(e)||B(e,o,t,n),s&&s(),e instanceof SVGElement&&!gt(e)){let t=[`fill`,`stroke`,`stroke-width`,`stroke-dasharray`,`stroke-dashoffset`,`stroke-linecap`,`stroke-linejoin`,`stroke-miterlimit`,`opacity`,`fill-opacity`,`stroke-opacity`,`fill-rule`,`clip-rule`,`marker`,`marker-start`,`marker-mid`,`marker-end`,`visibility`,`display`];try{let n=window.getComputedStyle(e);for(let e of t){let t=n.getPropertyValue(e);t&&o.style.setProperty(e,t)}}catch{}}if(e.shadowRoot){let i=function(e,r){if(e.nodeType===Node.ELEMENT_NODE&&e.tagName===`STYLE`)return r(null);Kt(e,t,n).then(e=>{r(e||null)}).catch(()=>{r(null)})};try{let t=e.shadowRoot.querySelectorAll(`slot`);for(let e of t){let t=[];try{t=e.assignedNodes?.({flatten:!0})||e.assignedNodes?.()||[]}catch{t=e.assignedNodes?.()||[]}for(let e of t)r.add(e)}}catch{}let a=wt(t),s=`[data-sd="${a}"]`;try{o.setAttribute(`data-sd`,a)}catch{}let c=Tt(e.shadowRoot),l=Ct(c,s),u=At(e,Ot(c),s);Et(o,u+l,a);let d=document.createDocumentFragment(),f=await bt(Array.from(e.shadowRoot.childNodes),i,n.fast);d.append(...f.filter(e=>!!e)),o.appendChild(d)}if(e.tagName===`SLOT`){let r=function(e,r){Kt(e,t,n).then(e=>{e&&jt(e),r(e||null)}).catch(()=>{r(null)})},i=e.assignedNodes?.({flatten:!0})||[],a=i.length>0?i:Array.from(e.childNodes),o=document.createDocumentFragment(),s=await bt(Array.from(a),r,n.fast);return o.append(...s.filter(e=>!!e)),o}function c(e,i){if(r.has(e))return i(null);Kt(e,t,n).then(e=>{i(e||null)}).catch(()=>{i(null)})}let l=await bt(Array.from(e.childNodes),c,n.fast);if(o.append(...l.filter(e=>!!e)),i!==null&&o instanceof HTMLSelectElement){o.value=i;for(let e of o.options)e.value===i?e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}return a!==null&&o instanceof HTMLTextAreaElement&&(o.textContent=a),o}R(),m(),l(),l();var qt=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],H=Object.assign({materialIconsFilled:`https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2`,materialIconsOutlined:`https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2`,materialIconsRound:`https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2`,materialIconsSharp:`https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2`},typeof window<`u`&&window.__SNAPDOM_ICON_FONTS__||{}),Jt=[];function Yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xt(e){let t=Array.isArray(e)?e:[e];for(let e of t)e instanceof RegExp?Jt.push(e):typeof e==`string`?Jt.push(new RegExp(Yt(e),`i`)):console.warn(`[snapdom] Ignored invalid iconFont value:`,e)}function U(e){let t=typeof e==`string`?e:``,n=[...qt,...Jt];for(let e of n)if(e instanceof RegExp&&e.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function Zt(e=``){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var Qt=new Map;function $t(e=``){let t=Object.create(null),n=String(e||``),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function en(e,t,n){let r=String(e||``),i=r.toLowerCase(),a=String(t||``).toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i)||!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let o=n&&(n.FILL??n.fill),s=`outlined`;/\brounded\b/.test(a)||/\bround\b/.test(a)?s=`rounded`:/\bsharp\b/.test(a)?s=`sharp`:/\boutlined\b/.test(a)&&(s=`outlined`);let c=o===1,l=null;if(c&&(s===`outlined`&&H.materialIconsFilled?l={url:H.materialIconsFilled,alias:`snapdom-mi-filled`}:s===`rounded`&&H.materialIconsRound?l={url:H.materialIconsRound,alias:`snapdom-mi-round`}:s===`sharp`&&H.materialIconsSharp&&(l={url:H.materialIconsSharp,alias:`snapdom-mi-sharp`})),!l)return{familyForMeasure:r,familyForCanvas:r};if(!Qt.has(l.alias))try{let e=new FontFace(l.alias,`url(${l.url})`,{style:`normal`,weight:`400`});document.fonts.add(e),await e.load(),Qt.set(l.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${l.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function tn(e=`Material Icons`,t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,``)}"`),document.fonts.ready])}catch{}}function nn(e){let t=e.getPropertyValue(`-webkit-text-fill-color`)?.trim()||``,n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&t.toLowerCase()!==`currentcolor`)return t;let r=e.color?.trim();return r&&r!==`inherit`?r:`#000`}async function rn(e,{family:t=`Material Icons`,weight:n=`normal`,fontSize:r=32,color:i=`#000`,variation:a=``,className:o=``}={}){let s=String(t||``).replace(/^['"]+|['"]+$/g,``),c=window.devicePixelRatio||1,{familyForMeasure:l,familyForCanvas:u}=await en(s,o,$t(a));await tn(u.replace(/^["']+|["']+$/g,``),r);let d=document.createElement(`span`);d.textContent=e,d.style.position=`absolute`,d.style.visibility=`hidden`,d.style.left=`-99999px`,d.style.whiteSpace=`nowrap`,d.style.fontFamily=l,d.style.fontWeight=String(n||`normal`),d.style.fontSize=`${r}px`,d.style.lineHeight=`1`,d.style.margin=`0`,d.style.padding=`0`,d.style.fontFeatureSettings=`'liga' 1`,d.style.fontVariantLigatures=`normal`,d.style.color=i,document.body.appendChild(d);let f=d.getBoundingClientRect(),p=Math.max(1,Math.ceil(f.width)),m=Math.max(1,Math.ceil(f.height));document.body.removeChild(d);let h=document.createElement(`canvas`);h.width=p*c,h.height=m*c;let g=h.getContext(`2d`);g.scale(c,c),g.font=`${n?`${n} `:``}${r}px ${u}`,g.textAlign=`left`,g.textBaseline=`top`,g.fillStyle=i;try{g.fontKerning=`normal`}catch{}return g.fillText(e,0,0),{dataUrl:h.toDataURL(),width:p,height:m}}async function an(e,t){if(!(e instanceof Element))return 0;let n=`.material-icons, [class*="material-symbols"]`,r=Array.from(e.querySelectorAll(n)).filter(e=>e&&e.textContent&&e.textContent.trim());if(r.length===0)return 0;let i=c.session.nodeMap,a=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(e=>e&&e.textContent&&e.textContent.trim()):[],o=0;for(let e=0;e<r.length;e++){let t=r[e],n=i&&i.get(t)||a[e]||null;try{let e=getComputedStyle(n||t),r=e.fontFamily||`Material Icons`;if(!Zt(r))continue;let i=(n||t).textContent.trim();if(!i)continue;let a=parseInt(e.fontSize,10)||24,{dataUrl:s,width:c,height:l}=await rn(i,{family:r,weight:e.fontWeight&&e.fontWeight!==`normal`?e.fontWeight:`normal`,fontSize:a,color:nn(e),variation:e.fontVariationSettings&&e.fontVariationSettings!==`normal`?e.fontVariationSettings:``,className:(n||t).className||``});t.textContent=``;let u=t.ownerDocument.createElement(`img`);u.src=s,u.alt=i,u.style.height=`${a}px`,u.style.width=`${Math.max(1,Math.round(c/l*a))}px`,u.style.objectFit=`contain`,u.style.verticalAlign=getComputedStyle(t).verticalAlign||`baseline`,t.appendChild(u),o++}catch{}}return o}E();async function on(e,t,n,r=32,i=`#000`){t=t.replace(/^['"]+|['"]+$/g,``);let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let o=document.createElement(`span`);o.textContent=e,o.style.position=`absolute`,o.style.visibility=`hidden`,o.style.fontFamily=`"${t}"`,o.style.fontWeight=n||`normal`,o.style.fontSize=`${r}px`,o.style.lineHeight=`1`,o.style.whiteSpace=`nowrap`,o.style.padding=`0`,o.style.margin=`0`,document.body.appendChild(o);let s=o.getBoundingClientRect(),c=Math.ceil(s.width),l=Math.ceil(s.height);document.body.removeChild(o);let u=document.createElement(`canvas`);u.width=Math.max(1,c*a),u.height=Math.max(1,l*a);let d=u.getContext(`2d`);return d.scale(a,a),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign=`left`,d.textBaseline=`top`,d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:c,height:l}}var sn=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`emoji`,`math`,`fangsong`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`]),cn=[`katex`,`mathjax`,`mathml`];function ln(e){if(!e)return``;for(let t of e.split(`,`)){let e=t.trim().replace(/^['"]+|['"]+$/g,``);if(e&&!sn.has(e.toLowerCase()))return e}return``}function un(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim().replace(/^['"]+|['"]+$/g,``);e&&(sn.has(e.toLowerCase())||t.push(e))}return t}function dn(e){let t=String(e??`400`).trim().toLowerCase();if(t===`normal`)return 400;if(t===`bold`)return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function fn(e){let t=String(e??`normal`).trim().toLowerCase();return t.startsWith(`italic`)?`italic`:t.startsWith(`oblique`)?`oblique`:`normal`}function pn(e){let t=String(e??`100%`).match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function mn(e){let t=String(e||`400`).trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let e=dn(n[1]),t=dn(n[2]);return{min:Math.min(e,t),max:Math.max(e,t)}}let r=dn(t);return{min:r,max:r}}function hn(e){let t=String(e||`normal`).trim().toLowerCase();return t===`italic`?{kind:`italic`}:t.startsWith(`oblique`)?{kind:`oblique`}:{kind:`normal`}}function gn(e){let t=String(e||`100%`).trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let e=parseFloat(n[1]),t=parseFloat(n[2]);return{min:Math.min(e,t),max:Math.max(e,t)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function _n(e){return!e||typeof e!=`string`?``:e.replace(/\s+(variable|vf|v[0-9]+)$/i,``).trim().toLowerCase().replace(/\s+/g,`-`)}function vn(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if([`fonts.googleapis.com`,`fonts.gstatic.com`,`use.typekit.net`,`p.typekit.net`,`kit.fontawesome.com`,`use.fontawesome.com`,`cdn.jsdelivr.net`,`unpkg.com`,`cdnjs.cloudflare.com`,`esm.sh`].some(e=>i.endsWith(e))||n.some(e=>i===e.toLowerCase()||i.endsWith(`.`+e.toLowerCase())))return!0;let a=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a)||cn.some(e=>a.includes(e)))return!0;for(let e of t){let t=e.toLowerCase().replace(/\s+/g,`+`),n=e.toLowerCase().replace(/\s+/g,`-`),r=_n(e);if(a.includes(t)||a.includes(n)||r&&a.includes(r))return!0}return!1}catch{return!1}}function yn(e){let t=new Set;for(let n of e||[]){let e=String(n).split(`__`)[0]?.trim();e&&t.add(e)}return t}function bn(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(e,n,r)=>{let i=(r||``).trim();if(!i||/^data:|^blob:|^https?:|^file:|^about:/i.test(i))return e;let a=i;try{a=new URL(i,t||location.href).href}catch{}return`url("${a}")`})}var xn=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Sn=4;async function Cn(e,t,n){if(!e)return e;let r=new Set;function i(e,t){try{return new URL(e,t||location.href).href}catch{return e}}async function a(e,t,o=0){if(o>Sn)return console.warn(`[snapDOM] @import depth exceeded (${Sn}) at ${t}`),e;let s=``,c=0,l;for(;l=xn.exec(e);){s+=e.slice(c,l.index),c=xn.lastIndex;let u=i((l[2]||l[4]||``).trim(),t);if(r.has(u)){console.warn(`[snapDOM] Skipping circular @import: ${u}`);continue}r.add(u);let d=``;try{let e=await S(u,{as:`text`,useProxy:n,silent:!0});e.ok&&typeof e.data==`string`&&(d=e.data)}catch{}d?(d=bn(d,u),d=await a(d,u,o+1),s+=`
6
- /* inlined: ${u} */
7
- ${d}
8
- `):s+=l[0]}return s+=e.slice(c),s}let o=bn(e,t||location.href);return o=await a(o,t||location.href,0),o}var wn=/url\((["']?)([^"')]+)\1\)/g,Tn=/@font-face[^{}]*\{[^}]*\}/g;function En(e){if(!e)return[];let t=[],n=e.split(`,`).map(e=>e.trim()).filter(Boolean);for(let e of n){let n=e.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!n)continue;let r=n[1],i=n[2],a=e=>e.includes(`?`)?[parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]:parseInt(e,16);if(i){let e=a(r),n=a(i),o=Array.isArray(e)?e[0]:e,s=Array.isArray(n)?n[1]:n;t.push([Math.min(o,s),Math.max(o,s)])}else{let e=a(r);Array.isArray(e)?t.push([e[0],e[1]]):t.push([e,e])}}return t}function Dn(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[e,r]of t)if(n>=e&&n<=r)return!0;return!1}function On(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(wn)){let e=(r[2]||``).trim();if(!(!e||e.startsWith(`data:`))){if(!/^https?:/i.test(e))try{e=new URL(e,t||location.href).href}catch{}n.push(e)}}return n}async function kn(e,t,n=``){let r=e;for(let i of e.matchAll(wn)){let e=u(i[0]);if(!e)continue;let a=e;if(!a.startsWith(`http`)&&!a.startsWith(`data:`))try{a=new URL(a,t||location.href).href}catch{}if(!U(a)){if(c.resource?.has(a)){c.font?.add(a),r=r.replace(i[0],`url(${c.resource.get(a)})`);continue}try{let e=await S(a,{as:`dataURL`,useProxy:n,silent:!0});if(e.ok&&typeof e.data==`string`){let t=e.data;c.resource?.set(a,t),c.font?.add(a),r=r.replace(i[0],`url(${t})`)}}catch{console.warn(`[snapDOM] Failed to fetch font resource:`,a)}}}return r}function An(e){if(!e.length)return null;let t=(t,n)=>e.some(([e,r])=>!(r<t||e>n)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),a=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?`vietnamese`:a?`cyrillic`:i?`greek`:r?`latin-ext`:n?`latin`:null}function jn(e={}){let t=new Set((e.families||[]).map(e=>String(e).toLowerCase())),n=new Set((e.domains||[]).map(e=>String(e).toLowerCase())),r=new Set((e.subsets||[]).map(e=>String(e).toLowerCase()));return(e,i)=>{if(t.size&&t.has(e.family.toLowerCase()))return!0;if(n.size)for(let t of e.srcUrls)try{if(n.has(new URL(t).host.toLowerCase()))return!0}catch{}if(r.size){let e=An(i);if(e&&r.has(e))return!0}return!1}}function Mn(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let i of e.match(t)||[]){let e=ln(i.match(/font-family:\s*([^;]+);/i)?.[1]||``),t=(i.match(/font-weight:\s*([^;]+);/i)?.[1]||`400`).trim(),a=(i.match(/font-style:\s*([^;]+);/i)?.[1]||`normal`).trim(),o=(i.match(/font-stretch:\s*([^;]+);/i)?.[1]||`100%`).trim(),s=(i.match(/unicode-range:\s*([^;]+);/i)?.[1]||``).trim(),c=(i.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||``).trim(),l=On(c,location.href),u=l.length?l.map(e=>String(e).toLowerCase()).sort().join(`|`):c.toLowerCase(),d=[String(e||``).toLowerCase(),t,a,o,s.toLowerCase(),u].join(`|`);n.has(d)||(n.add(d),r.push(i))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||``)}function Nn(e,t,n,r,i){return`fonts-embed-css::req=${Array.from(e||[]).sort().join(`|`)}::ex=${t?JSON.stringify({families:(t.families||[]).map(e=>String(e).toLowerCase()).sort(),domains:(t.domains||[]).map(e=>String(e).toLowerCase()).sort(),subsets:(t.subsets||[]).map(e=>String(e).toLowerCase()).sort()}):``}::lf=${(n||[]).map(e=>`${(e.family||``).toLowerCase()}::${e.weight||`normal`}::${e.style||`normal`}::${e.src||``}`).sort().join(`|`)}::px=${r||``}::fd=${(i||[]).map(e=>String(e).toLowerCase()).sort().join(`|`)}`}async function Pn(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let a=(e,t)=>{try{return new URL(e,t||location.href).href}catch{return e}};for(let e of i){if(e.type===CSSRule.IMPORT_RULE&&e.styleSheet){let i=e.href?a(e.href,t):t;if(r.depth>=Sn){console.warn(`[snapDOM] CSSOM import depth exceeded (${Sn}) at ${i}`);continue}if(i&&r.visitedSheets.has(i)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${i}`);continue}i&&r.visitedSheets.add(i);let o={...r,depth:(r.depth||0)+1};await Pn(e.styleSheet,i,n,o);continue}if(e.type===CSSRule.FONT_FACE_RULE){let i=ln((e.style.getPropertyValue(`font-family`)||``).trim());if(!i||U(i))continue;let a=(e.style.getPropertyValue(`font-weight`)||`400`).trim(),o=(e.style.getPropertyValue(`font-style`)||`normal`).trim(),s=(e.style.getPropertyValue(`font-stretch`)||`100%`).trim(),c=(e.style.getPropertyValue(`src`)||``).trim(),l=(e.style.getPropertyValue(`unicode-range`)||``).trim();if(!r.faceMatchesRequired(i,o,a,s))continue;let u=En(l);if(!Dn(r.usedCodepoints,u))continue;let d={family:i,weightSpec:a,styleSpec:o,stretchSpec:s,unicodeRange:l,srcRaw:c,srcUrls:On(c,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,u))continue;/url\(/i.test(c)?await n(`@font-face{font-family:${i};src:${await kn(c,t||location.href,r.useProxy)};font-style:${o};font-weight:${a};font-stretch:${s};${l?`unicode-range:${l};`:``}}`):await n(`@font-face{font-family:${i};src:${c};font-style:${o};font-weight:${a};font-stretch:${s};${l?`unicode-range:${l};`:``}}`)}}}async function Fn({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i=``,fontStylesheetDomains:a=[],doc:o=document}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let s=new Map;for(let t of e){let[e,n,r,i]=String(t).split(`__`);if(!e)continue;let a=e.toLowerCase(),o=s.get(a)||[];o.push({w:parseInt(n,10),s:r,st:parseInt(i,10)}),s.set(a,o)}function l(e,t,n,r){let i=String(e).toLowerCase();if(!s.has(i))return!1;let a=s.get(i),o=mn(n),c=hn(t),l=gn(r),u=o.min!==o.max,d=o.min,f=e=>c.kind===`normal`&&e===`normal`||c.kind!==`normal`&&(e===`italic`||e===`oblique`),p=!1;for(let e of a){let t=u?e.w>=o.min&&e.w<=o.max:e.w===d,n=f(fn(e.s)),r=e.st>=l.min&&e.st<=l.max;if(t&&n&&r){p=!0;break}}if(p)return!0;if(!u)for(let e of a){let t=f(fn(e.s)),n=e.st>=l.min&&e.st<=l.max;if(Math.abs(d-e.w)<=300&&t&&n)return!0}if(!u&&c.kind===`normal`&&a.some(e=>fn(e.s)!==`normal`))for(let e of a){let t=Math.abs(d-e.w)<=300,n=e.st>=l.min&&e.st<=l.max;if(t&&n)return!0}return!1}let u=jn(n),d=Nn(e,n,r,i,a);if(c.resource?.has(d))return c.resource.get(d);let f=yn(e),p=[],m=xn;for(let e of o.querySelectorAll(`style`)){let t=e.textContent||``;for(let e of t.matchAll(m)){let t=(e[2]||e[4]||``).trim();!t||U(t)||o.querySelector(`link[rel="stylesheet"][href="${t}"]`)||p.push(t)}}let h=[];p.length&&await Promise.all(p.map(e=>new Promise(t=>{if(o.querySelector(`link[rel="stylesheet"][href="${e}"]`))return t(null);let n=o.createElement(`link`);n.rel=`stylesheet`,n.href=e,n.setAttribute(`data-snapdom`,`injected-import`),n.onload=()=>t(n),n.onerror=()=>t(null),o.head.appendChild(n),h.push(n)})));let g=``,_=Array.from(o.querySelectorAll(`link[rel="stylesheet"]`)).filter(e=>!!e.href);for(let e of h)try{e.remove()}catch{}for(let e of _)try{if(U(e.href))continue;let r=``,s=!1;try{s=new URL(e.href,location.href).origin===location.origin}catch{}if(!s){let t=Array.isArray(a)?a:[];if(!vn(e.href,f,t))continue}if(s){let t=Array.from(o.styleSheets).find(t=>t.href===e.href);if(t)try{let e=t.cssRules||[];r=Array.from(e).map(e=>e.cssText).join(``)}catch{}}if(!r){let t=await S(e.href,{as:`text`,useProxy:i});if(t?.ok&&typeof t.data==`string`&&(r=t.data),U(e.href))continue}r=await Cn(r,e.href,i);let c=``;for(let a of r.match(Tn)||[]){let r=ln((a.match(/font-family:\s*([^;]+);/i)?.[1]||``).trim());if(!r||U(r))continue;let o=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||`400`).trim(),s=(a.match(/font-style:\s*([^;]+);/i)?.[1]||`normal`).trim(),d=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||`100%`).trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||``).trim(),p=(a.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||``).trim(),m=On(p,e.href);if(!l(r,s,o,d))continue;let h=En(f);if(!Dn(t,h))continue;let g={family:r,weightSpec:o,styleSpec:s,stretchSpec:d,unicodeRange:f,srcRaw:p,srcUrls:m,href:e.href};if(n&&u(g,h))continue;let _=/url\(/i.test(p)?await kn(a,e.href,i):a;c+=_}c.trim()&&(g+=c)}catch{console.warn(`[snapDOM] Failed to process stylesheet:`,e.href)}let v={requiredIndex:s,usedCodepoints:t,faceMatchesRequired:l,simpleExcluder:n?jn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let e of o.styleSheets)if(!(e.href&&_.some(t=>t.href===e.href)))try{let t=e.href||location.origin+`/`;t&&v.visitedSheets.add(t),await Pn(e,t,async e=>{g+=e},v)}catch{}try{for(let e of o.fonts||[]){if(!e||!e.family||e.status!==`loaded`||!e._snapdomSrc)continue;let t=String(e.family).replace(/^['"]+|['"]+$/g,``);if(U(t)||!s.has(t.toLowerCase())||n?.families&&n.families.some(e=>String(e).toLowerCase()===t.toLowerCase()))continue;let r=e._snapdomSrc;if(!String(r).startsWith(`data:`)){if(c.resource?.has(e._snapdomSrc))r=c.resource.get(e._snapdomSrc),c.font?.add(e._snapdomSrc);else if(!c.font?.has(e._snapdomSrc))try{let t=await S(e._snapdomSrc,{as:`dataURL`,useProxy:i,silent:!0});if(t.ok&&typeof t.data==`string`)r=t.data,c.resource?.set(e._snapdomSrc,r),c.font?.add(e._snapdomSrc);else continue}catch{console.warn(`[snapDOM] Failed to fetch dynamic font src:`,e._snapdomSrc);continue}}g+=`@font-face{font-family:'${t}';src:url(${r});font-style:${e.style||`normal`};font-weight:${e.weight||`normal`};}`}}catch{}for(let e of r){if(!e||typeof e!=`object`)continue;let t=String(e.family||``).replace(/^['"]+|['"]+$/g,``);if(!t||U(t)||!s.has(t.toLowerCase())||n?.families&&n.families.some(e=>String(e).toLowerCase()===t.toLowerCase()))continue;let r=e.weight==null?`normal`:String(e.weight),a=e.style==null?`normal`:String(e.style),o=e.stretchPct==null?`100%`:`${e.stretchPct}%`,l=String(e.src||``),u=l;if(!u.startsWith(`data:`)){if(c.resource?.has(l))u=c.resource.get(l),c.font?.add(l);else if(!c.font?.has(l))try{let e=await S(l,{as:`dataURL`,useProxy:i,silent:!0});if(e.ok&&typeof e.data==`string`)u=e.data,c.resource?.set(l,u),c.font?.add(l);else continue}catch{console.warn(`[snapDOM] Failed to fetch localFonts src:`,l);continue}}g+=`@font-face{font-family:'${t}';src:url(${u});font-style:${a};font-weight:${r};font-stretch:${o};}`}return g&&(g=Mn(g),c.resource?.set(d,g)),g}function In(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=e=>{let n=un(e.fontFamily);if(n.length)for(let r of n)t.add(((e,t,n)=>`${r}__${dn(e)}__${fn(t)}__${pn(n)}`)(e.fontWeight,e.fontStyle,e.fontStretch))};r(getComputedStyle(e));let i=getComputedStyle(e,`::before`);i&&i.content&&i.content!==`none`&&r(i);let a=getComputedStyle(e,`::after`);for(a&&a.content&&a.content!==`none`&&r(a);n.nextNode();){let e=n.currentNode;r(getComputedStyle(e));let t=getComputedStyle(e,`::before`);t&&t.content&&t.content!==`none`&&r(t);let i=getComputedStyle(e,`::after`);i&&i.content&&i.content!==`none`&&r(i)}return t}function Ln(e){let t=new Set,n=e=>{if(e)for(let n of e)t.add(n.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let e=r.currentNode;if(e.nodeType===Node.TEXT_NODE)n(e.nodeValue||``);else if(e.nodeType===Node.ELEMENT_NODE){let r=e;for(let e of[`::before`,`::after`]){let i=getComputedStyle(r,e)?.getPropertyValue(`content`);if(!(!i||i===`none`))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let e=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(e)for(let n of e)try{t.add(parseInt(n.slice(1),16))}catch{}}}}}return t}async function Rn(e,t=2,n=document){try{await n.fonts.ready}catch{}let r=Array.from(e||[]).filter(Boolean);if(r.length===0)return;let i=()=>{let e=n.createElement(`div`);e.style.cssText=`position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;`;for(let t of r){let r=n.createElement(`span`);r.textContent=`AaBbGg1234ÁÉÍÓÚçñ—∞`,r.style.fontFamily=`"${t}"`,r.style.fontWeight=`700`,r.style.fontStyle=`italic`,r.style.fontSize=`32px`,r.style.lineHeight=`1`,r.style.whiteSpace=`nowrap`,r.style.margin=`0`,r.style.padding=`0`,e.appendChild(r)}n.body.appendChild(e),e.offsetWidth,n.body.removeChild(e)};for(let e=0;e<Math.max(1,t);e++)i(),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))}l();function zn(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||``)}function Bn(e,t=!1){let n=``,r=Math.max(1,e);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return t?n.toUpperCase():n}function Vn(e,t=!0){let n=[[1e3,`M`],[900,`CM`],[500,`D`],[400,`CD`],[100,`C`],[90,`XC`],[50,`L`],[40,`XL`],[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],r=Math.max(1,Math.min(3999,e)),i=``;for(let[e,t]of n)for(;r>=e;)i+=t,r-=e;return t?i:i.toLowerCase()}function Hn(e,t){switch((t||`decimal`).toLowerCase()){case`decimal`:return String(e);case`decimal-leading-zero`:{let t=Math.abs(e);return(e<0?`-`:``)+(t<10?`0`:``)+String(t)}case`lower-alpha`:return Bn(e,!1);case`upper-alpha`:return Bn(e,!0);case`lower-roman`:return Vn(e,!1);case`upper-roman`:return Vn(e,!0);default:return String(e)}}function Un(e){let t=()=>c?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,a=e=>e&&e.tagName===`LI`,o=e=>{let t=0,n=e?.parentElement;if(!n)return 0;for(let r of n.children){if(r===e)break;r.tagName===`LI`&&t++}return t},s=e=>{let t=new Map;for(let[n,r]of e)t.set(n,r.slice());return t},l=(e,t,n)=>{let r=s(e),i;try{i=n.style?.counterReset||getComputedStyle(n).counterReset}catch{}if(i&&i!==`none`)for(let e of i.split(`,`)){let n=e.trim().split(/\s+/),i=n[0],a=Number.isFinite(Number(n[1]))?Number(n[1]):0;if(!i)continue;let o=t.get(i);if(o&&o.length){let e=o.slice();e.push(a),r.set(i,e)}else r.set(i,[a])}let c;try{c=n.style?.counterSet||getComputedStyle(n).counterSet}catch{}if(c&&c!==`none`)for(let e of c.split(`,`)){let t=e.trim().split(/\s+/),n=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):0;if(!n)continue;let a=r.get(n)||[];a.length===0&&a.push(0),a[a.length-1]=i,r.set(n,a)}let l;try{l=n.style?.counterIncrement||getComputedStyle(n).counterIncrement}catch{}if(l&&l!==`none`)for(let e of l.split(`,`)){let t=e.trim().split(/\s+/),n=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):1;if(!n)continue;let a=r.get(n)||[];a.length===0&&a.push(0),a[a.length-1]+=i,r.set(n,a)}try{if(getComputedStyle(n).display===`list-item`&&a(n)){let e=n.parentElement,t=1;if(e&&e.tagName===`OL`){let r=e.getAttribute(`start`),i=Number.isFinite(Number(r))?Number(r):1,a=o(n),s=n.getAttribute(`value`);t=Number.isFinite(Number(s))?Number(s):i+a}else t=1+o(n);let i=r.get(`list-item`)||[];i.length===0&&i.push(0),i[i.length-1]=t,r.set(`list-item`,i)}}catch{}return r},u=(e,t,n)=>{let i=l(n,t,e);r.set(e,i);let a=i;for(let t of e.children)a=u(t,i,a);let o=new Map;for(let[e,t]of n){let n=t.length,r=a.get(e);o.set(e,r&&r.length?r.slice(0,n):t.slice())}for(let[e,n]of a)!o.has(e)&&n.length&&!t.has(e)&&o.set(e,n.slice(0,1));return o},d=new Map;u(i,d,d);function f(){let e=t();if(e!==n){n=e;let t=new Map;u(i,t,t)}}return{get(e,t){f();let n=r.get(e)?.get(t);return n&&n.length?n[n.length-1]:0},getStack(e,t){f();let n=r.get(e)?.get(t);return n?n.slice():[]}}}function Wn(e,t,n){if(!e||e===`none`)return e;try{return e.replace(/\b(counter|counters)\s*\(([^)]+)\)/g,(e,r,i)=>{let a=String(i).split(`,`).map(e=>e.trim());if(r===`counter`){let e=a[0]?.replace(/^["']|["']$/g,``),r=(a[1]||`decimal`).toLowerCase();return Hn(n.get(t,e),r)}else{let e=a[0]?.replace(/^["']|["']$/g,``),r=a[1]?.replace(/^["']|["']$/g,``)??``,i=(a[2]||`decimal`).toLowerCase(),o=n.getStack(t,e);return o.length?o.map(e=>Hn(e,i)).join(r):``}})}catch{return`- `}}E(),l();var W=new WeakMap,Gn=1e3;function Kn(e,t){let n=Jn(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=Xn(e,n),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):Xn(e,n)}function qn(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Jn(e){let t=e.querySelectorAll(`style,link[rel~="stylesheet"]`),n=`n:${t.length}|`,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i.tagName===`STYLE`){let e=i.textContent?i.textContent.length:0;n+=`S${e}|`;let t=i.sheet,a=t?qn(t):null;a&&(r+=a.length)}else{let e=i.getAttribute(`href`)||``,t=i.getAttribute(`media`)||`all`;n+=`L${e}|m:${t}|`;let a=i.sheet,o=a?qn(a):null;o&&(r+=o.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Yn(e,t,n){let r=qn(e);if(!r)return!1;for(let e=0;e<r.length;e++){if(n.budget<=0)return!1;let i=r[e],a=i&&i.cssText?i.cssText:``;n.budget--;for(let e of t)if(a.includes(e))return!0;if(i&&i.cssRules&&i.cssRules.length)for(let e=0;e<i.cssRules.length&&n.budget>0;e++){let r=i.cssRules[e],a=r&&r.cssText?r.cssText:``;n.budget--;for(let e of t)if(a.includes(e))return!0}if(n.budget<=0)return!1}return!1}function Xn(e=document,t=Jn(e)){let n=W.get(e);if(n&&n.fingerprint===t)return n.result;let r=[`::before`,`::after`,`::first-letter`,`:before`,`:after`,`:first-letter`,`counter(`,`counters(`,`counter-increment`,`counter-reset`],i=e.querySelectorAll(`style`);for(let n=0;n<i.length;n++){let a=i[n].textContent||``;for(let n of r)if(a.includes(n))return W.set(e,{fingerprint:t,result:!0}),!0}let a=e.adoptedStyleSheets;if(Array.isArray(a)&&a.length){let n={budget:Gn};try{for(let i of a)if(Yn(i,r,n))return W.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let n=e.querySelectorAll(`style,link[rel~="stylesheet"]`),i={budget:Gn};for(let a=0;a<n.length&&i.budget>0;a++){let o=n[a],s=null;if(o.tagName,s=o.sheet||null,s&&Yn(s,r,i))return W.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector(`[style*="counter("], [style*="counters("]`)?(W.set(e,{fingerprint:t,result:!0}),!0):(W.set(e,{fingerprint:t,result:!1}),!1)}var G=new WeakMap;function Zn(e){for(let t of[`Top`,`Right`,`Bottom`,`Left`]){let n=parseFloat(e[`border${t}Width`])||0,r=e[`border${t}Style`];if(n>0&&r&&r!==`none`&&r!==`hidden`)return!0}return!1}var Qn=-1;function $n(e){if(!e)return``;let t=[],n=/"([^"]*)"/g,r=0,i;for(;i=n.exec(e);){let a=e.slice(r,i.index).trim();a&&t.push(a),t.push(i[1]),r=n.lastIndex}let a=e.slice(r).trim();return a&&t.push(a),t.join(``)}function er(e,t){let n=e.parentElement,r=n?G.get(n):null;return r?{get(e,n){let i=t.get(e,n),a=r.get(n);return typeof a==`number`?Math.max(i,a):i},getStack(e,n){let i=t.getStack(e,n);if(!i.length)return i;let a=r.get(n);if(typeof a==`number`){let e=i.slice();return e[e.length-1]=Math.max(e[e.length-1],a),e}return i}}:t}function tr(e,t,n){let r=new Map;function i(e){let t=[];if(!e||e===`none`)return t;for(let n of String(e).split(`,`)){let e=n.trim().split(/\s+/),r=e[0],i=Number.isFinite(Number(e[1]))?Number(e[1]):void 0;r&&t.push({name:r,num:i})}return t}let a=i(t?.counterReset),o=i(t?.counterSet),s=i(t?.counterIncrement);function c(t){if(r.has(t))return r.get(t).slice();let i=n.getStack(e,t);i=i.length?i.slice():[];let c=a.find(e=>e.name===t);if(c){let e=Number.isFinite(c.num)?c.num:0;i=i.length?[...i,e]:[e]}let l=o.find(e=>e.name===t);if(l){let e=Number.isFinite(l.num)?l.num:0;i.length===0&&(i=[0]),i[i.length-1]=e}let u=s.find(e=>e.name===t);if(u){let e=Number.isFinite(u.num)?u.num:1;i.length===0&&(i=[0]),i[i.length-1]+=e}return r.set(t,i.slice()),i}return{get(e,t){let n=c(t);return n.length?n[n.length-1]:0},getStack(e,t){return c(t)},__incs:s}}function nr(e,t,n){let r;try{r=j(e,t)}catch{}let i=r?.content;if(!i||i===`none`||i===`normal`)return{text:``,incs:[]};let a=er(e,n),o=tr(e,r,a);return{text:$n(zn(i)?Wn(i,e,o):i),incs:o.__incs||[]}}async function rr(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element)||e instanceof HTMLTextAreaElement||!Kn(e.ownerDocument||document,n))return;let i=c?.session?.__counterEpoch??0;if(Qn!==i&&(G=new WeakMap,n&&(n.__counterCtx=null),Qn=i),!n.__counterCtx)try{n.__counterCtx=Un(e.ownerDocument||document)}catch(e){L(n,`buildCounterContext failed`,e)}let a=n.__counterCtx;for(let i of[`::before`,`::after`,`::first-letter`])try{let o=j(e,i);if(!o||o.content===`none`&&o.backgroundImage===`none`&&o.backgroundColor===`transparent`&&!Zn(o)&&(!o.transform||o.transform===`none`)&&o.display===`inline`)continue;if(i===`::first-letter`){let r=j(e),i=(r?.display||``).toLowerCase();if(i.includes(`flex`)||i.includes(`grid`)||!(o.color!==r.color||o.fontSize!==r.fontSize||o.fontWeight!==r.fontWeight||o.fontFamily!==r.fontFamily||o.fontStyle!==r.fontStyle||o.textTransform!==r.textTransform||o.float!==r.float||o.paddingTop!==r.paddingTop||o.paddingRight!==r.paddingRight||o.paddingBottom!==r.paddingBottom||o.paddingLeft!==r.paddingLeft||o.marginTop!==r.marginTop||o.marginRight!==r.marginRight||o.marginBottom!==r.marginBottom||o.marginLeft!==r.marginLeft))continue;let a=Array.from(t.childNodes).find(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim().length>0);if(!a)continue;let s=a.textContent,c=s.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],l=s.slice(c?.length||0);if(!c||/[\uD800-\uDFFF]/.test(c))continue;let u=document.createElement(`span`);u.textContent=c,u.dataset.snapdomPseudo=`::first-letter`;let d=te(oe(o),`span`);n.styleMap.set(u,d);let f=document.createTextNode(l);t.replaceChild(f,a),t.insertBefore(u,f);continue}let s=o.content??``,c=s===``||s===`none`||s===`normal`,{text:l,incs:d}=nr(e,i,a),p=o.backgroundImage,m=o.backgroundColor,h=o.fontFamily,g=parseInt(o.fontSize)||32,_=parseInt(o.fontWeight)||!1,v=o.color||`#000`,y=o.transform,b=U(h),x=!c&&l!==``,C=p&&p!==`none`,w=m&&m!==`transparent`&&m!==`rgba(0, 0, 0, 0)`,T=Zn(o),E=y&&y!==`none`,O=s!==`none`&&s!==`normal`&&((parseFloat(o.width)||0)>0||(parseFloat(o.height)||0)>0);if(!(x||C||w||T||E||O)){if(d&&d.length&&e.parentElement){let t=G.get(e.parentElement)||new Map;for(let{name:n}of d){if(!n)continue;let r=er(e,a),o=tr(e,j(e,i),r).get(e,n);t.set(n,o)}G.set(e.parentElement,t)}continue}let k=!1;if(x&&!b&&l.length>1&&!l.startsWith(`url(`)){let n=j(e),r=parseFloat(n.fontSize)||16,i=parseFloat(n.lineHeight);Number.isFinite(i)||(i=r*1.5),e.getBoundingClientRect().height<i*1.6&&(t.style.whiteSpace=`nowrap`,k=!0)}let A=document.createElement(`span`);A.dataset.snapdomPseudo=i,A.style.pointerEvents=`none`,k&&(A.style.whiteSpace=`nowrap`);let ee=te(oe(o),`span`);if(n.styleMap.set(A,ee),b&&l&&l.length===1){let{dataUrl:e,width:n,height:r}=await on(l,h,_,g,v),i=document.createElement(`img`);i.src=e,i.style=`height:${g}px;width:${n/r*g}px;object-fit:contain;`,A.appendChild(i),t.dataset.snapdomHasIcon=`true`}else if(l&&l.startsWith(`url(`)){let t=u(l);if(t?.trim())try{let e=await S(f(t),{as:`dataURL`,useProxy:r.useProxy});if(e?.ok&&typeof e.data==`string`){let t=document.createElement(`img`);t.src=e.data,t.style=`width:${g}px;height:auto;object-fit:contain;`,A.appendChild(t)}}catch(t){console.error(`[snapdom] Error in pseudo ${i} for`,e,t)}}else!b&&x&&(A.textContent=l);A.style.backgroundImage=`none`,`maskImage`in A.style&&(A.style.maskImage=`none`),`webkitMaskImage`in A.style&&(A.style.webkitMaskImage=`none`);try{A.style.backgroundRepeat=o.backgroundRepeat,A.style.backgroundSize=o.backgroundSize,o.backgroundPositionX&&o.backgroundPositionY?(A.style.backgroundPositionX=o.backgroundPositionX,A.style.backgroundPositionY=o.backgroundPositionY):A.style.backgroundPosition=o.backgroundPosition,A.style.backgroundOrigin=o.backgroundOrigin,A.style.backgroundClip=o.backgroundClip,A.style.backgroundAttachment=o.backgroundAttachment,A.style.backgroundBlendMode=o.backgroundBlendMode}catch{}if(C)try{let e=M(p),t=await Promise.all(e.map(D));A.style.backgroundImage=t.join(`, `)}catch(e){console.warn(`[snapdom] Failed to inline background-image for ${i}`,e)}w&&(A.style.backgroundColor=m);let ne=A.childNodes.length>0||A.textContent?.trim()!==``||C||w||T||E||O;if(d&&d.length&&e.parentElement){let t=G.get(e.parentElement)||new Map,n=er(e,a),r=tr(e,j(e,i),n);for(let{name:n}of d){if(!n)continue;let i=r.get(e,n);t.set(n,i)}G.set(e.parentElement,t)}if(!ne)continue;i===`::before`?(t.dataset.snapdomHasBefore=`1`,t.insertBefore(A,t.firstChild)):(t.dataset.snapdomHasAfter=`1`,t.appendChild(A))}catch(t){console.warn(`[snapdom] Failed to capture ${i} for`,e,t)}let o=Array.from(t.children).filter(e=>!e.dataset.snapdomPseudo);if(n.nodeMap)for(let e of o){let t=n.nodeMap.get(e);t instanceof Element&&await rr(t,e,n,r)}else{let t=Array.from(e.children);for(let e=0;e<Math.min(t.length,o.length);e++)await rr(t[e],o[e],n,r)}}function ir(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll(`svg`));if(i.length===0)return;let a=/url\(\s*#([^)]+)\)/g,o=[`fill`,`stroke`,`filter`,`clip-path`,`mask`,`marker`,`marker-start`,`marker-mid`,`marker-end`],s=e=>window.CSS&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`),c=e=>{if(!e||!e.getAttribute)return null;let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`):null);if(t)return t;let n=e.attributes;if(!n)return null;for(let e=0;e<n.length;e++){let t=n[e];if(!t||!t.name)continue;if(t.name===`href`)return t.value;let r=t.name.indexOf(`:`);if(r!==-1&&t.name.slice(r+1)===`href`)return t.value}return null},l=new Set(Array.from(e.querySelectorAll(`[id]`)).map(e=>e.id)),u=new Set,d=!1,f=(e,t=null)=>{if(!e)return;a.lastIndex=0;let n;for(;n=a.exec(e);){d=!0;let e=(n[1]||``).trim();e&&(l.has(e)||(u.add(e),t&&!t.has(e)&&t.add(e)))}},p=e=>{let t=e.querySelectorAll(`use`);for(let e of t){let t=c(e);if(!t||!t.startsWith(`#`))continue;d=!0;let n=t.slice(1).trim();n&&!l.has(n)&&u.add(n)}let n=e.querySelectorAll(`*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]`);for(let e of n){f(e.getAttribute(`style`)||``);for(let t of o)f(e.getAttribute(t))}};for(let e of i)p(e);if(!d)return;let m=e.querySelector(`svg.inline-defs-container`);m||(m=n.createElementNS(`http://www.w3.org/2000/svg`,`svg`),m.classList.add(`inline-defs-container`),m.setAttribute(`aria-hidden`,`true`),m.setAttribute(`style`,`position:absolute;width:0;height:0;overflow:hidden`),e.insertBefore(m,e.firstChild||null));let h=m.querySelector(`defs`)||null,g=t=>{if(!t||l.has(t))return null;let n=s(t),i=t=>{let n=r.querySelector(t);return n&&!e.contains(n)?n:null};return i(`svg defs > *#${n}`)||i(`svg > symbol#${n}`)||i(`*#${n}`)};if(!u.size)return;let _=new Set(u),v=new Set;for(;_.size;){let e=_.values().next().value;if(_.delete(e),!e||l.has(e)||v.has(e))continue;let t=g(e);if(!t){v.add(e);continue}h||(h=n.createElementNS(`http://www.w3.org/2000/svg`,`defs`),m.appendChild(h));let r=t.cloneNode(!0);r.id||r.setAttribute(`id`,e),h.appendChild(r),v.add(e),l.add(e);let i=[r,...r.querySelectorAll(`*`)];for(let e of i){let t=c(e);if(t&&t.startsWith(`#`)){let e=t.slice(1).trim();e&&!l.has(e)&&!v.has(e)&&_.add(e)}let n=e.getAttribute?.(`style`)||``;n&&f(n,_);for(let t of o){let n=e.getAttribute?.(t);n&&f(n,_)}}}}l();function ar(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;getComputedStyle(t).position===`static`&&(t.style.position=`relative`);let r=e.getBoundingClientRect(),i=e.clientHeight,a=`data-snap-ph`,o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();){let s=o.currentNode,c=getComputedStyle(s),l=c.position;if(l!==`sticky`&&l!==`-webkit-sticky`)continue;let u=or(c.top),d=or(c.bottom);if(u==null&&d==null)continue;let f=cr(t,sr(s,e),a);if(!f)continue;let p=s.getBoundingClientRect(),m=p.width,h=p.height,g=p.left-r.left;if(!(m>0&&h>0)||!Number.isFinite(g))continue;let _=u==null?n+(i-h-d):u+n;if(!Number.isFinite(_))continue;let v=Number.parseInt(c.zIndex,10),y=Number.isFinite(v),b=y?Math.max(v,1)+1:2,x=y?v-1:0,S=f.cloneNode(!1);S.setAttribute(a,`1`),S.style.position=`sticky`,S.style.left=`${g}px`,S.style.top=`${_}px`,S.style.width=`${m}px`,S.style.height=`${h}px`,S.style.visibility=`hidden`,S.style.zIndex=String(x),S.style.overflow=`hidden`,S.style.background=`transparent`,S.style.boxShadow=`none`,S.style.filter=`none`,f.parentElement?.insertBefore(S,f),f.style.position=`absolute`,f.style.left=`${g}px`,f.style.top=`${_}px`,f.style.bottom=`auto`,f.style.zIndex=String(b),f.style.pointerEvents=`none`}}function or(e){if(!e||e===`auto`)return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function sr(e,t){let n=[];for(let r=e;r&&r!==t;){let e=r.parentElement;if(!e)break;n.push(Array.prototype.indexOf.call(e.children,r)),r=e}return n.reverse()}function cr(e,t,n){let r=e;for(let e=0;e<t.length;e++)if(r=lr(r,n)[t[e]],!r)return null;return r instanceof HTMLElement?r:null}function lr(e,t){let n=[],r=e.children;for(let e=0;e<r.length;e++){let i=r[e];i.hasAttribute(t)||n.push(i)}return n}function ur(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,a=t.borderWidth;n!==`none`&&parseFloat(r)>0&&(i===`none`||parseFloat(a)===0)&&(e.style.border=`${r} solid transparent`)}function dr(e){let t=[];try{let n=e.querySelectorAll(`*`);for(let e of n){if(!(e instanceof HTMLElement))continue;let n=e.style.contentVisibility||``,r=getComputedStyle(e),i=r.contentVisibility||r.getPropertyValue(`content-visibility`)||``;(i===`auto`||i===`hidden`)&&(t.push({el:e,original:n}),e.style.contentVisibility=`visible`)}if(e instanceof HTMLElement){let n=getComputedStyle(e),r=n.contentVisibility||n.getPropertyValue(`content-visibility`)||``;(r===`auto`||r===`hidden`)&&(t.push({el:e,original:e.style.contentVisibility||``}),e.style.contentVisibility=`visible`)}}catch{}return()=>{for(let{el:e,original:n}of t)try{e.style.contentVisibility=n}catch{}}}async function fr(e,t={}){let n={styleMap:c.session.styleMap,styleCache:c.session.styleCache,nodeMap:c.session.nodeMap,options:t},r,i=``,a=``;ur(e);let o=dr(e);try{r=await Kt(e,n,t)}catch(e){throw console.warn(`deepClone failed:`,e),e}finally{o()}try{ir(r)}catch(e){console.warn(`inlineExternal defs or symbol failed:`,e)}try{await rr(e,r,n,t)}catch(e){console.warn(`inlinePseudoElements failed:`,e)}await Wt(r,n);try{let e=r.querySelectorAll(`style[data-sd]`);for(let t of e)a+=t.textContent||``,t.remove()}catch(e){L(n,`Failed to extract shadow CSS from style[data-sd]`,e)}let s=ie(n.styleMap);i=Array.from(s.entries()).map(([e,t])=>`.${t}{${e}}`).join(``),i=a+`[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}`+i;for(let[e,t]of n.styleMap.entries()){if(e.tagName===`STYLE`)continue;if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){e.setAttribute(`style`,t.replace(/;/g,`; `));continue}let n=s.get(t);n&&e.classList.add(n);let r=e.style?.backgroundImage,i=e.dataset?.snapdomHasIcon;r&&r!==`none`&&(e.style.backgroundImage=r),i&&(e.style.verticalAlign=`middle`,e.style.display=`inline`)}for(let[e,t]of n.nodeMap.entries()){let n=t.scrollLeft,r=t.scrollTop;if((n||r)&&e instanceof HTMLElement){e.style.overflow=`hidden`,e.style.scrollbarWidth=`none`,e.style.msOverflowStyle=`none`;try{let t=e.querySelectorAll(`*`);for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.style.position;if(t===`fixed`||t===`absolute`){let i=parseFloat(e.style.top)||0,a=parseFloat(e.style.left)||0;e.style.top=`${i+r}px`,e.style.left=`${a+n}px`,t===`fixed`&&(e.style.position=`absolute`)}}}catch{}let t=document.createElement(`div`);for(t.style.all=`unset`,t.style.transform=`translate(${-n}px, ${-r}px)`,t.style.willChange=`transform`,t.style.display=`inline-block`,t.style.width=`100%`;e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}}if(ar(e,r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r),e===n.nodeMap.get(r)){let t=n.styleCache.get(e)||j(e);n.styleCache.set(e,t);let i=d(t.transform);r.style.margin=`0`,r.style.top=`auto`,r.style.left=`auto`,r.style.right=`auto`,r.style.bottom=`auto`,r.style.animation=`none`,r.style.transition=`none`,r.style.willChange=`auto`,r.style.float=`none`,r.style.clear=`none`,r.style.transform=i||``}for(let[e,t]of n.nodeMap.entries())t.tagName===`PRE`&&(e.style.marginTop=`0`,e.style.marginBlockStart=`0`);return{clone:r,classCSS:i,styleCache:n.styleCache}}E(),l();var pr=`http://www.w3.org/1999/xlink`;function mr(e){return e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(pr,`href`):null)}function hr(e){let t=parseInt(e.dataset?.snapdomWidth||``,10)||0,n=parseInt(e.dataset?.snapdomHeight||``,10)||0,r=parseInt(e.getAttribute(`width`)||``,10)||0,i=parseInt(e.getAttribute(`height`)||``,10)||0,a=parseFloat(e.style?.width||``)||0,o=parseFloat(e.style?.height||``)||0;return{width:t||a||r||e.width||e.naturalWidth||100,height:n||o||i||e.height||e.naturalHeight||100}}async function gr(e,t={}){let n=Array.from(e.querySelectorAll(`img`)),r=async e=>{if(!e.getAttribute(`src`)){let t=e.currentSrc||e.src||``;t&&e.setAttribute(`src`,t)}e.removeAttribute(`srcset`),e.removeAttribute(`sizes`);let n=e.src||``;if(!n)return;let r=c.image?.get(n);if(r){e.src=r,e.width||(e.width=e.naturalWidth||100),e.height||(e.height=e.naturalHeight||100);return}let i=await S(n,{as:`dataURL`,useProxy:t.useProxy});if(i.ok&&typeof i.data==`string`&&i.data.startsWith(`data:`)){c.image?.set(n,i.data),e.src=i.data,e.width||(e.width=e.naturalWidth||100),e.height||(e.height=e.naturalHeight||100);return}let{width:a,height:o}=hr(e),{fallbackURL:s}=t||{};if(s)try{let r=typeof s==`function`?await s({width:a,height:o,src:n,element:e}):s;if(r){let n=await S(r,{as:`dataURL`,useProxy:t.useProxy});if(n?.ok&&typeof n.data==`string`){e.src=n.data,e.width||(e.width=a),e.height||(e.height=o);return}}}catch{}if(t.placeholders!==!1){let t=document.createElement(`div`);t.style.cssText=[`width:${a}px`,`height:${o}px`,`background:#ccc`,`display:inline-block`,`text-align:center`,`line-height:${o}px`,`color:#666`,`font-size:12px`,`overflow:hidden`].join(`;`),t.textContent=`img`,e.replaceWith(t)}else{let t=document.createElement(`div`);t.style.cssText=`display:inline-block;width:${a}px;height:${o}px;visibility:hidden;`,e.replaceWith(t)}};for(let e=0;e<n.length;e+=6){let t=n.slice(e,e+6).map(r);await Promise.allSettled(t)}let i=Array.from(e.querySelectorAll(`image`)),a=async e=>{let n=mr(e);if(!n||n.startsWith(`data:`)||n.startsWith(`blob:`))return;let r=await S(n,{as:`dataURL`,useProxy:t.useProxy});r.ok&&typeof r.data==`string`&&r.data.startsWith(`data:`)&&(e.setAttribute(`href`,r.data),e.removeAttribute(`xlink:href`),typeof e.removeAttributeNS==`function`&&e.removeAttributeNS(pr,`href`))};for(let e=0;e<i.length;e+=6){let t=i.slice(e,e+6).map(a);await Promise.allSettled(t)}}R(),l();async function _r(e,t,n,r={}){let i=[[e,t]],a=[`background-image`,`mask`,`mask-image`,`-webkit-mask`,`-webkit-mask-image`,`mask-source`,`mask-box-image-source`,`mask-border-source`,`-webkit-mask-box-image-source`,`border-image`,`border-image-source`],o=[`mask-position`,`mask-size`,`mask-repeat`,`mask-mode`,`mask-composite`,`-webkit-mask-position`,`-webkit-mask-size`,`-webkit-mask-repeat`,`-webkit-mask-composite`,`mask-origin`,`mask-clip`,`-webkit-mask-origin`,`-webkit-mask-clip`,`-webkit-mask-position-x`,`-webkit-mask-position-y`],s=[`background-position`,`background-position-x`,`background-position-y`,`background-size`,`background-repeat`,`background-origin`,`background-clip`,`background-attachment`,`background-blend-mode`],l=[`border-image-slice`,`border-image-width`,`border-image-outset`,`border-image-repeat`];for(;i.length;){let[e,t]=i.shift();if(!t)continue;let u=n.get(e)||j(e);n.has(e)||n.set(e,u);let d=(()=>{let e=u.getPropertyValue(`border-image`),t=u.getPropertyValue(`border-image-source`);return e&&e!==`none`||t&&t!==`none`})(),f=u.getPropertyValue(`background-image`),p=u.getPropertyValue(`background-color`);if(f&&f!==`none`||p&&p!==`rgba(0, 0, 0, 0)`&&p!==`transparent`||/url\s*\(|gradient\s*\(/i.test(u.getPropertyValue(`background`)||``))for(let e of s){let n=u.getPropertyValue(e);n&&t.style.setProperty(e,n)}for(let e of a){let n=u.getPropertyValue(e);if(e===`background-image`&&(!n||n===`none`)){let e=u.getPropertyValue(`background`);e&&/url\s*\(/.test(e)&&(n=M(e).filter(e=>/url\s*\(/.test(e)).join(`, `)||n)}if(!n||n===`none`)continue;let i=M(n),a=await Promise.all(i.map(e=>D(e,r)));a.some(e=>e&&e!==`none`&&!/^url\(undefined/.test(e))&&t.style.setProperty(e,a.join(`, `))}for(let e of o){let n=u.getPropertyValue(e);!n||n===`initial`||t.style.setProperty(e,n)}if(d)for(let e of l){let n=u.getPropertyValue(e);!n||n===`initial`||t.style.setProperty(e,n)}if(e.shadowRoot){let n=Array.from(e.shadowRoot.children).filter(e=>e.tagName!==`STYLE`),r=Array.from(t.children).filter(e=>!e.dataset?.snapdomPseudo&&!(e.tagName===`STYLE`&&e.dataset?.sd));for(let e=0;e<Math.min(n.length,r.length);e++)i.push([n[e],r[e]])}else{let e=c.session.nodeMap;for(let n of t.children){let t=e.get(n);t&&i.push([t,n])}}}}R(),l();function vr(e){if(!e)return()=>{};let t=[];function n(e){let r=getComputedStyle(e),i=yr(e,r);i&&t.push(i);let a=br(e,r);a&&t.push(a);for(let t of e.children||[])n(t)}return n(e),()=>t.forEach(e=>e())}function yr(e,t){if(!e)return()=>{};t=t||getComputedStyle(e);let n=xr(t);if(n<=0||!wr(e))return()=>{};let r=e.textContent??``,i=r,a=Cr(t);e.textContent=`X`;let o=e.scrollHeight-a;e.textContent=r;let s=o>0?o:Sr(t),c=Math.round(s*n+a);if(e.scrollHeight<=c+.5)return()=>{};let l=0,u=r.length,d=-1;for(;l<=u;){let t=l+u>>1;e.textContent=r.slice(0,t)+`…`,e.scrollHeight<=c+.5?(d=t,l=t+1):u=t-1}return e.textContent=(d>=0?r.slice(0,d):``)+`…`,()=>{e.textContent=i}}function br(e,t){if(!e||(t=t||getComputedStyle(e),t.textOverflow!==`ellipsis`)||t.whiteSpace!==`nowrap`&&t.whiteSpace!==`pre`||t.overflowX!==`hidden`&&t.overflowX!==`clip`||!wr(e)||e.scrollWidth<=e.clientWidth+.5)return()=>{};let n=e.textContent??``,r=n,i=0,a=n.length,o=-1;for(;i<=a;){let t=i+a>>1;e.textContent=n.slice(0,t)+`…`,e.scrollWidth<=e.clientWidth+.5?(o=t,i=t+1):a=t-1}return e.textContent=(o>=0?n.slice(0,o):``)+`…`,()=>{e.textContent=r}}function xr(e){let t=e.getPropertyValue(`-webkit-line-clamp`)||e.getPropertyValue(`line-clamp`);t=(t||``).trim();let n=parseInt(t,10);return Number.isFinite(n)&&n>0?n:0}function Sr(e){let t=(e.lineHeight||``).trim(),n=parseFloat(e.fontSize)||16;return!t||t===`normal`?Math.round(n*1.2):t.endsWith(`px`)?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith(`%`)?Math.round(parseFloat(t)/100*n):Math.round(n*1.2)}function Cr(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function wr(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Tr=[];function Er(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return typeof t==`function`?t(n):t}if(typeof e==`object`&&`plugin`in e){let{plugin:t,options:n}=e;return typeof t==`function`?t(n):t}return typeof e==`function`?e():e}function Dr(...e){let t=e.flat();for(let e of t){let t=Er(e);t&&(Tr.some(e=>e&&e.name&&t.name&&e.name===t.name)||Tr.push(t))}}function Or(e){return e&&Array.isArray(e.plugins)?e.plugins:Tr}async function K(e,t,n){let r=n,i=Or(t);for(let n of i){let i=n&&typeof n[e]==`function`?n[e]:null;if(!i)continue;let a=await i(t,r);typeof a<`u`&&(r=a)}return r}async function kr(e,t,n){let r=[],i=Or(t);for(let a of i){let i=a&&typeof a[e]==`function`?a[e]:null;if(!i)continue;let o=await i(t,n);typeof o<`u`&&r.push(o)}return r}function Ar(e){let t=[];if(Array.isArray(e))for(let n of e){let e=Er(n);if(!e||!e.name)continue;let r=t.findIndex(t=>t&&t.name===e.name);r>=0&&t.splice(r,1),t.push(e)}for(let e of Tr)e&&e.name&&!t.some(t=>t.name===e.name)&&t.push(e);return Object.freeze(t)}function jr(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=Ar(t)),e}function Mr(){return Tr.slice()}function q(e){return!!(!e||e.startsWith(`data:`)||e.startsWith(`blob:`)||/^data:image\/(gif|png|svg)/.test(e)&&e.length<200)}function Nr(e,t){return!e||!(e instanceof Element)?!1:e.querySelector(`picture`)?!0:t?!!e.querySelector(`img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]`):!1}function Pr(e,t){let n=e.currentSrc||``;if(n&&!q(n))return n;let r=t.querySelectorAll(`source[srcset]`),i=null;for(let e of r){let t=e.getAttribute(`srcset`);if(!t||q(t))continue;let n=e.getAttribute(`media`);if(n)try{if(window.matchMedia(n).matches)return t.split(`,`)[0].trim().split(/\s+/)[0]}catch{}i||(i=t.split(`,`)[0].trim().split(/\s+/)[0])}return i}function Fr(e){let t=[e.getAttribute(`data-src`),e.getAttribute(`data-lazy-src`),e.getAttribute(`data-original`),e.getAttribute(`data-hi-res-src`)];for(let e of t)if(e&&!q(e))return e;let n=e.getAttribute(`data-srcset`)||e.getAttribute(`data-lazy-srcset`);if(n){let e=n.split(`,`)[0].trim().split(/\s+/)[0];if(e&&!q(e))return e}return null}function Ir(e={}){let t=e.pictureResolver&&typeof e.pictureResolver==`object`?e.pictureResolver:{};return{timeout:t.timeout??5e3,concurrency:t.concurrency??4,resolveLazySrc:t.resolveLazySrc!==!1,silent:t.silent??!1,useProxy:typeof e.useProxy==`string`?e.useProxy:``}}async function Lr(e,t={}){if(!e||!(e instanceof Element)||t.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:r,resolveLazySrc:i,silent:a,useProxy:o}=Ir(t);if(!Nr(e,i))return null;let s=[],c=[];async function l(e){let t=new AbortController,r=setTimeout(()=>t.abort(),n);try{let n=await fetch(e,{credentials:`include`,signal:t.signal});if(!n.ok&&o){let r=o.includes(`{url}`)?o.replace(`{url}`,encodeURIComponent(e)):o.endsWith(`?`)?`${o}${encodeURIComponent(e)}`:`${o}${o.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`;n=await fetch(r,{signal:t.signal})}if(!n.ok)return null;let r=await n.blob();return await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)})}catch{return null}finally{clearTimeout(r)}}async function u(e){for(let t=0;t<e.length;t+=r){let n=e.slice(t,t+r);await Promise.allSettled(n.map(e=>e()))}}let d=e.querySelectorAll(`picture`);for(let e of d){let t=e.querySelector(`img`);if(!t||!q(t.getAttribute(`src`)||``))continue;let n=Pr(t,e);n&&c.push(async()=>{let r=await l(n);if(!r){a||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${n.slice(0,60)}`);return}let i=t.getAttribute(`src`),o=t.getAttribute(`srcset`),c=t.getAttribute(`sizes`),u=[];t.src=r,t.setAttribute(`src`,r),t.removeAttribute(`srcset`),t.removeAttribute(`sizes`);let d=e.querySelectorAll(`source`);for(let e of d)u.push({el:e,parent:e.parentElement,next:e.nextSibling}),e.remove();s.push(()=>{i===null?t.removeAttribute(`src`):t.setAttribute(`src`,i),o!==null&&t.setAttribute(`srcset`,o),c!==null&&t.setAttribute(`sizes`,c);for(let{el:e,parent:t,next:n}of u)t&&t.insertBefore(e,n)})})}if(i){let t=e.querySelectorAll(`img`);for(let e of t){if(e.closest(`picture`)&&q(e.getAttribute(`src`)||``))continue;let t=e.getAttribute(`src`)||``,n=Fr(e);n&&q(t)&&c.push(async()=>{let t=await l(n);if(!t)return;let r=e.getAttribute(`src`);e.src=t,e.setAttribute(`src`,t),e.removeAttribute(`srcset`),e.removeAttribute(`sizes`),s.push(()=>{r===null?e.removeAttribute(`src`):e.setAttribute(`src`,r)})})}}return c.length===0?null:(await u(c),async function(){for(let e of s)try{e()}catch{}})}l();var Rr=.92,zr=.95;async function Br(e){let t=new Image;if(t.decoding=`sync`,t.src=e,typeof t.decode==`function`)try{return await t.decode(),t}catch{}return await new Promise((e,n)=>{t.onload=()=>e(),t.onerror=n}),t}function Vr(e){let t=/^data:([^;,]+)/.exec(e);return t?t[1]:``}async function Hr(e,t,n){if(typeof e!=`string`||!e.startsWith(`data:image`)||e.startsWith(`data:image/svg`))return null;let r;try{r=await Br(e)}catch{return null}let i=r.naturalWidth||r.width,a=r.naturalHeight||r.height;if(!i||!a)return null;let o=Math.min(1,Math.max(t/i,n/a));if(!(o>0)||o>=.95)return null;let s=o*zr,c=Math.max(1,Math.round(i*s)),l=Math.max(1,Math.round(a*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)return null;d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(r,0,0,c,l);let f=Vr(e),p=f===`image/jpeg`?`image/jpeg`:f===`image/webp`?`image/webp`:`image/png`;try{let t=u.toDataURL(p,Rr);if(typeof t==`string`&&t.startsWith(`data:image`)&&t.length<e.length)return t}catch{}return null}async function Ur(e,t){if(!t.compress)return{count:0,before:0,after:0};let n=(t.scale||1)*(t.dpr||1),r=Array.from(e.querySelectorAll(`img`)),i=0,a=0,o=0,s=async e=>{let t=e.getAttribute(`src`)||``;if(!t.startsWith(`data:image`)||t.startsWith(`data:image/svg`))return;let r=parseFloat(e.dataset.snapdomWidth)||parseFloat(e.style.width)||e.width||0,s=parseFloat(e.dataset.snapdomHeight)||parseFloat(e.style.height)||e.height||0;if(!r||!s)return;let c=await Hr(t,r*n,s*n);c&&(i++,a+=t.length,o+=c.length,e.setAttribute(`src`,c))};for(let e=0;e<r.length;e+=6)await Promise.allSettled(r.slice(e,e+6).map(s));return{count:i,before:a,after:o}}function Wr(e){return{w:e.offsetWidth||e.getBoundingClientRect().width||0,h:e.offsetHeight||e.getBoundingClientRect().height||0}}async function Gr(e,t){if(!t.compress)return{count:0};let n=(t.scale||1)*(t.dpr||1),r=c.session.nodeMap,i=[],a=[e,...e.querySelectorAll(`*`)];for(let e of a){let t=e.style&&e.style.backgroundImage;t&&t.includes(`data:image`)&&i.push(e)}let o=0,s=async e=>{let t=r.get(e);if(!t||!t.isConnected)return;let i;try{i=getComputedStyle(t)}catch{return}if((i.backgroundRepeat||`repeat`).toLowerCase().split(`,`).some(e=>e.trim()!==`no-repeat`))return;let{w:a,h:s}=Wr(t);if(!a||!s)return;let c=a*n,l=s*n,u=e.style.backgroundImage,d=[...u.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],f=u;for(let e of d){let t=e[2];if(t.startsWith(`data:image/svg`))continue;let n=await Hr(t,c,l);n&&(f=f.split(t).join(n),o++)}f!==u&&(e.style.backgroundImage=f)};for(let e=0;e<i.length;e+=6)await Promise.allSettled(i.slice(e,e+6).map(s));return{count:o}}async function Kr(e,t){if(!t.compress)return{count:0};let n=(t.scale||1)*(t.dpr||1),r=Array.from(e.querySelectorAll(`image`)),i=0,a=async e=>{let t=e.getAttribute(`href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`):null);if(!t||!t.startsWith(`data:image`)||t.startsWith(`data:image/svg`))return;let r=parseFloat(e.getAttribute(`width`))||0,a=parseFloat(e.getAttribute(`height`))||0;if(!r||!a)return;let o=await Hr(t,r*n,a*n);o&&(e.setAttribute(`href`,o),e.hasAttribute(`xlink:href`)&&e.setAttribute(`xlink:href`,o),i++)};for(let e=0;e<r.length;e+=6)await Promise.allSettled(r.slice(e,e+6).map(a));return{count:i}}async function qr(e,t){t.compress&&(await Ur(e,t),await Gr(e,t),await Kr(e,t))}R();function Jr(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow=`none`}catch(e){L(n,`stripRootShadows boxShadow`,e)}try{t.style.textShadow=`none`}catch(e){L(n,`stripRootShadows textShadow`,e)}try{t.style.outline=`none`}catch(e){L(n,`stripRootShadows outline`,e)}let i=(r.filter||``).replace(/\bblur\([^()]*\)\s*/gi,``).replace(/\bdrop-shadow\([^()]*\)\s*/gi,``).trim().replace(/\s+/g,` `);try{t.style.filter=i.length?i:`none`}catch(e){L(n,`stripRootShadows filter`,e)}}function Yr(e){let t=e.display||``;if(t.includes(`flex`)||t.includes(`grid`)||t.startsWith(`table`)||t===`inline-block`||t===`flow-root`||e.position===`absolute`||e.position===`fixed`||e.float&&e.float!==`none`)return!0;let n=e.overflowX||e.overflow||`visible`,r=e.overflowY||e.overflow||`visible`;return!!(n!==`visible`||r!==`visible`||e.contain&&/\b(layout|content|paint|strict)\b/.test(e.contain))}function Xr(e,t){let n=Array.from(e.childNodes),r=t===`top`?n:n.reverse();for(let e of r){if(e.nodeType===Node.TEXT_NODE){if(/\S/.test(e.textContent||``))return null;continue}if(e.nodeType!==Node.ELEMENT_NODE)continue;let t=getComputedStyle(e),n=String(t.display||``);if(!(n===`none`||n===`contents`)&&!(t.position===`absolute`||t.position===`fixed`))return t.float&&t.float!==`none`||n.startsWith(`inline`)?null:e}return null}function Zr(e,t){if(!e||!t||!t.style)return;let n=getComputedStyle(e);if(!Yr(n))for(let r of[`top`,`bottom`]){let i=r===`top`?`Top`:`Bottom`;if((parseFloat(n[`border${i}Width`])||0)>0||(parseFloat(n[`padding${i}`])||0)>0)continue;let a=e,o=t;for(;a&&o;){let e=Xr(a,r);if(!e)break;let t=Array.from(a.children).indexOf(e),n=t>=0?o.children[t]:null,s=getComputedStyle(e),c=parseFloat(s[`margin${i}`])||0;if(n&&n.style&&c>0&&(n.style[`margin${i}`]=`0px`),Yr(s)||(parseFloat(s[`border${i}Width`])||0)>0||(parseFloat(s[`padding${i}`])||0)>0)break;a=e,o=n}}}function Qr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let e of n)e.remove()}function $r(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set([`xml`,`xlink`]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let e=i.currentNode;for(let t of Array.from(e.attributes)){let i=t.name;if(i.startsWith(`*`)){e.removeAttribute(i);continue}if(i.includes(`@`)){e.removeAttribute(i);continue}if(i.includes(`:`)){let t=i.split(`:`,1)[0];if(!r.has(t)){e.removeAttribute(i);continue}}if(n&&(i.startsWith(`x-`)||i.startsWith(`v-`)||i.startsWith(`:`)||i.startsWith(`on:`)||i.startsWith(`bind:`)||i.startsWith(`let:`)||i.startsWith(`class:`))){e.removeAttribute(i);continue}}}}var ei=/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;function ti(e){if(!e)return;let t=e=>{if(e.nodeType===Node.ELEMENT_NODE){if(e.attributes)for(let t of Array.from(e.attributes)){let n=t.value.replace(ei,``);if(n!==t.value)try{e.setAttribute(t.name,n)}catch{}}}else if(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.CDATA_SECTION_NODE){let t=e.data.replace(ei,``);t!==e.data&&(e.data=t)}};t(e);let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),r;for(;r=n.nextNode();)t(r)}function ni(e,t={}){e&&($r(e,t),Qr(e),ti(e))}function ri(e){try{let t=e.getAttribute?.(`style`)||``;return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function ii(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function ai(e,t){if(!(e instanceof Element)||ri(e)||ii(e))return!1;let n=t.position;if(n===`absolute`||n===`fixed`||n===`sticky`)return!1;let r=t.display||``;return!(r.includes(`flex`)||r.includes(`grid`)||r.startsWith(`table`)||t.transform&&t.transform!==`none`)}function oi(e,t,n=new Map){function r(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.childElementCount>t.childElementCount,a=n.get(e)||getComputedStyle(e);if(n.has(e)||n.set(e,a),i&&ai(e,a)){t.style.height||(t.style.height=`auto`),t.style.width||(t.style.width=`auto`),t.style.removeProperty(`block-size`),t.style.removeProperty(`inline-size`),t.style.minHeight||(t.style.minHeight=`0`),t.style.minWidth||(t.style.minWidth=`0`),t.style.maxHeight||(t.style.maxHeight=`none`),t.style.maxWidth||(t.style.maxWidth=`none`);let e=a.overflowY||a.overflowBlock||`visible`,n=a.overflowX||a.overflowInline||`visible`;(e!==`visible`||n!==`visible`)&&(t.style.overflow=`visible`)}let o=Array.from(e.children),s=Array.from(t.children);for(let e=0;e<Math.min(o.length,s.length);e++)r(o[e],s[e])}r(e,t)}function si(e){let t=getComputedStyle(e);return!(t.display===`none`||t.position===`absolute`||t.position===`fixed`)}function ci(e,t){if(!(e instanceof Element))return!1;if(e.getAttribute(`data-capture`)===`exclude`&&t?.excludeMode===`remove`)return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return t.excludeMode===`remove`}catch(e){L(t,`exclude selector match failed`,e)}return!1}function li(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,a=-1/0,o=!1,s=Array.from(e.children);for(let e of s){if(ci(e,t)||!si(e))continue;let n=e.getBoundingClientRect(),s=n.top-r.top,c=n.bottom-r.top;c<=s||(s<i&&(i=s),c>a&&(a=c),o=!0)}let c=o?Math.max(0,a-i):0,l=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return l+u+d+f+c}var J=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,ui=/::-webkit-scrollbar(-[a-z]+)?\b/i;function di(e,t=new Set){let n=``;if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=di(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let e=di(i.cssRules,t);e&&(n+=`@media ${i.conditionText}{${e}}`);continue}if(i.type===CSSRule.STYLE_RULE){let e=i.selectorText||``;if(ui.test(e)){let e=i.cssText;e&&!t.has(e)&&(t.add(e),n+=e)}}}catch{}}return n}function fi(e){if(!e||!e.styleSheets)return``;let t=new Set,n=``;for(let r of Array.from(e.styleSheets))try{let e=r.cssRules;e&&(n+=di(e,t))}catch{}return n}_e();function pi(e){let t=e.boxShadow||``;if(!t||t===`none`)return{top:0,right:0,bottom:0,left:0};let n=[],r=``,i=0;for(let e=0;e<t.length;e++){let a=t[e];a===`(`?i++:a===`)`&&(i=Math.max(0,i-1)),a===`,`&&i===0?(n.push(r),r=``):r+=a}r.trim()&&n.push(r);let a=0,o=0,s=0,c=0;for(let e of n){if(/\binset\b/i.test(e))continue;let t=e.match(/-?\d+(\.\d+)?px/g)?.map(e=>parseFloat(e))||[];if(t.length<2)continue;let[n,r,i=0,l=0]=t,u=Math.abs(n)+i+l,d=Math.abs(r)+i+l;o=Math.max(o,u+Math.max(n,0)),c=Math.max(c,u+Math.max(-n,0)),s=Math.max(s,d+Math.max(r,0)),a=Math.max(a,d+Math.max(-r,0))}return{top:Math.ceil(a),right:Math.ceil(o),bottom:Math.ceil(s),left:Math.ceil(c)}}function mi(e){let t=e.filter&&e.filter!==`none`?e.filter:e.webkitFilter||``,n=/blur\(\s*([0-9.]+)px\s*\)/gi,r=0,i;for(;i=n.exec(t);)r+=parseFloat(i[1])||0;let a=Math.ceil(r);return{top:a,right:a,bottom:a,left:a}}function hi(e){if((e.outlineStyle||`none`)===`none`)return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||`0`)||0),n=parseFloat(e.outlineOffset||`0`)||0,r=t+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function gi(e){let t=`${e.filter||``} ${e.webkitFilter||``}`.trim();if(!t||t===`none`)return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,a=0,o=0,s=!1;for(let e of n){s=!0;let[t=0,n=0,c=0]=e.match(/-?\d+(?:\.\d+)?px/gi)?.map(e=>parseFloat(e))||[],l=Math.abs(t)+c,u=Math.abs(n)+c;i=Math.max(i,l+Math.max(t,0)),o=Math.max(o,l+Math.max(-t,0)),a=Math.max(a,u+Math.max(n,0)),r=Math.max(r,u+Math.max(-n,0))}return{bleed:{top:J(r),right:J(i),bottom:J(a),left:J(o)},has:s}}function _i(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin=`0 0`}catch{}try{`translate`in t.style&&(t.style.translate=`none`),`rotate`in t.style&&(t.style.rotate=`none`)}catch{}let r=n.transform||`none`;if(!r||r===`none`){let n=null;try{n=bi(e).scale}catch{}try{t.style.transform=`none`}catch{}if(!n)return{a:1,b:0,c:0,d:1};let r=n.trim().split(/\s+/).map(parseFloat),i=Number.isFinite(r[0])?r[0]:1;return{a:i,b:0,c:0,d:Number.isFinite(r[1])?r[1]:i}}function i(e,t,n,r){let i=Math.sqrt(e*e+t*t)||0,a=0,o=0;if(i>0){let s=e/i,c=t/i;a=s*n+c*r;let l=n-s*a,u=r-c*a;o=Math.sqrt(l*l+u*u)||0,o>0?a/=o:a=0}return{a:i,b:0,c:a*o,d:o}}let a=r.match(/^matrix\(\s*([^)]+)\)$/i);if(a){let e=a[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length===6&&e.every(Number.isFinite)){let[n,r,a,o]=e,s=i(n,r,a,o);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}}let o=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(o){let e=o[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length===16&&e.every(Number.isFinite)){let n=e[0],r=e[1],a=e[4],o=e[5],s=i(n,r,a,o);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}}try{let e=new DOMMatrix(r),n=i(e.a,e.b,e.c,e.d);try{t.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, 0, 0)`}catch{}return n}catch{return null}}function vi(e,t,n,r,i){let a=n.a,o=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(e,t){let n=e-r,d=t-i,f=a*n+s*d,p=o*n+c*d;return f+=r+l,p+=i+u,[f,p]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],p=1/0,m=1/0,h=-1/0,g=-1/0;for(let[e,t]of f)e<p&&(p=e),t<m&&(m=t),e>h&&(h=e),t>g&&(g=t);return{minX:p,minY:m,maxX:h,maxY:g,width:h-p,height:g-m}}function yi(e,t,n){let r=(e.transformOrigin||`0 0`).trim().split(/\s+/),[i,a]=[r[0]||`0`,r[1]||`0`],o=(e,t)=>{let n=e.toLowerCase();return n===`left`||n===`top`?0:n===`center`?t/2:n===`right`||n===`bottom`?t:n.endsWith(`px`)?parseFloat(n)||0:n.endsWith(`%`)?(parseFloat(n)||0)*t/100:/^-?\d+(\.\d+)?$/.test(n)&&parseFloat(n)||0};return{ox:o(i,t),oy:o(a,n)}}function bi(e){let t={rotate:`0deg`,scale:null,translate:null},n=typeof e.computedStyleMap==`function`?e.computedStyleMap():null;if(n){let r=e=>{try{return typeof n.has==`function`&&!n.has(e)||typeof n.get!=`function`?null:n.get(e)}catch{return null}},i=r(`rotate`);if(i)if(i.angle){let e=i.angle;t.rotate=e.unit===`rad`?e.value*180/Math.PI+`deg`:e.value+e.unit}else i.unit?t.rotate=i.unit===`rad`?i.value*180/Math.PI+`deg`:i.value+i.unit:t.rotate=String(i);else{let n=getComputedStyle(e);t.rotate=n.rotate&&n.rotate!==`none`?n.rotate:`0deg`}let a=r(`scale`);if(a){let e=`x`in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1;t.scale=`${e} ${`y`in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:e}`}else{let n=getComputedStyle(e);t.scale=n.scale&&n.scale!==`none`?n.scale:null}let o=r(`translate`);if(o){let e=`x`in o&&`value`in o.x?o.x.value:Array.isArray(o)?o[0]?.value:0,n=`y`in o&&`value`in o.y?o.y.value:Array.isArray(o)?o[1]?.value:0;t.translate=`${e}${`x`in o&&o.x?.unit?o.x.unit:`px`} ${n}${`y`in o&&o.y?.unit?o.y.unit:`px`}`}else{let n=getComputedStyle(e);t.translate=n.translate&&n.translate!==`none`?n.translate:null}return t}let r=getComputedStyle(e);return t.rotate=r.rotate&&r.rotate!==`none`?r.rotate:`0deg`,t.scale=r.scale&&r.scale!==`none`?r.scale:null,t.translate=r.translate&&r.translate!==`none`?r.translate:null,t}var xi=null;function Si(){if(xi)return xi;let e=document.createElement(`div`);return e.id=`snapdom-measure-slot`,e.setAttribute(`aria-hidden`,`true`),Object.assign(e.style,{position:`absolute`,left:`-99999px`,top:`0px`,width:`0px`,height:`0px`,overflow:`hidden`,opacity:`0`,pointerEvents:`none`,contain:`size layout style`}),document.documentElement.appendChild(e),xi=e,e}function Ci(e){let t=Si(),n=document.createElement(`div`);n.style.transformOrigin=`0 0`,e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let r=Ti(n);return t.removeChild(n),r}function wi(e){let t=j(e),n=t.transform||`none`;if(n!==`none`&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let r=t.rotate&&t.rotate!==`none`&&t.rotate!==`0deg`,i=t.scale&&t.scale!==`none`&&t.scale!==`1`,a=t.translate&&t.translate!==`none`&&t.translate!==`0px 0px`;return!!(r||i||a)}function Ti(e){let t=getComputedStyle(e).transform;if(!t||t===`none`)return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}function Ei(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(Er(t)?.name===`picture-resolver`)return!0}return Mr().some(e=>e?.name===`picture-resolver`)}async function Di(e,t){if(!e)throw Error(`Element cannot be null or undefined`);o(t.cache);let n=t.fast,r=t.outerTransforms!==!1,i=!!t.outerShadows,a={element:e,options:t,plugins:t.plugins},s,l,u,d=``,f=``,p,m,h=null;await K(`beforeSnap`,a);let g=null;t.resolvePicturePlaceholders!==!1&&!Ei(t)&&(g=await Lr(a.element,a.options)),await K(`beforeClone`,a);let _=vr(a.element);try{({clone:s,classCSS:l,styleCache:u}=await fr(a.element,a.options)),!r&&s&&(h=_i(a.element,s)),!i&&s&&Jr(a.element,s,a.options),s&&Zr(a.element,s)}finally{_()}if(a={clone:s,classCSS:l,styleCache:u,...a},await K(`afterClone`,a),g&&await g(),ni(a.clone),a.options?.excludeMode===`remove`)try{oi(a.element,a.clone,a.styleCache)}catch(e){console.warn(`[snapdom] shrink pass failed:`,e)}try{await an(a.clone,a.element)}catch{}await new Promise(e=>{F(async()=>{await gr(a.clone,a.options),e()},{fast:n})}),await new Promise(e=>{F(async()=>{await _r(a.element,a.clone,a.styleCache,a.options),e()},{fast:n})}),t.compress&&await new Promise(e=>{F(async()=>{await qr(a.clone,a.options),e()},{fast:n})}),t.embedFonts&&await new Promise(e=>{F(async()=>{let t=a.element.ownerDocument||document,n=In(a.element),r=Ln(a.element);I()&&await Rn(new Set(Array.from(n).map(e=>String(e).split(`__`)[0]).filter(Boolean)),1,t),d=await Fn({required:n,usedCodepoints:r,preCached:!1,exclude:a.options.excludeFonts,localFonts:a.options.localFonts,useProxy:a.options.useProxy,fontStylesheetDomains:a.options.fontStylesheetDomains,doc:t}),e()},{fast:n})});let v=ne(a.clone).sort(),y=v.join(`,`);c.baseStyle.has(y)?f=c.baseStyle.get(y):await new Promise(e=>{F(()=>{f=re(v),c.baseStyle.set(y,f),e()},{fast:n})});let b=fi(a.element?.ownerDocument||document);a={fontsCSS:d,baseCSS:f,scrollbarCSS:b,...a},await K(`beforeRender`,a),await new Promise(e=>{F(()=>{let n=j(a.element),o=a.element.getBoundingClientRect(),s=Math.max(1,J(a.element.offsetWidth||parseFloat(n.width)||o.width||1)),l=Math.max(1,J(a.element.offsetHeight||parseFloat(n.height)||o.height||1)),u=a.element.ownerDocument||document;if((a.element===u.body||a.element===u.documentElement)&&!u.documentElement.hasAttribute(`data-sd-pinned`)){let e=Math.max(a.element.scrollHeight||0,u.documentElement?.scrollHeight||0,u.body?.scrollHeight||0),t=Math.max(a.element.scrollWidth||0,u.documentElement?.scrollWidth||0,u.body?.scrollWidth||0);e>0&&(l=Math.max(l,J(e))),t>0&&(s=Math.max(s,J(t)));try{let e=(a.scrollbarCSS||``).length+(a.baseCSS||``).length+(a.fontsCSS||``).length+(a.classCSS||``).length,t=c.measureHints.get(a.element);if(t&&t.cssLen===e&&t.w0===s)t.csh>0&&(l=Math.max(l,J(t.csh))),t.csw>0&&(s=Math.max(s,J(t.csw)));else{let t=u.createElement(`div`);t.style.cssText=`position:absolute!important;left:-9999px!important;top:0!important;width:`+s+`px!important;overflow:visible!important;visibility:hidden!important;`;let n=u.createElement(`style`);n.textContent=(a.scrollbarCSS||``)+a.baseCSS+a.fontsCSS+`svg{overflow:visible;} foreignObject{overflow:visible;}`+a.classCSS,t.appendChild(n),t.appendChild(a.clone.cloneNode(!0)),u.body.appendChild(t);let r=t.scrollHeight,i=t.scrollWidth;u.body.removeChild(t),c.measureHints.set(a.element,{cssLen:e,w0:s,csh:r,csw:i}),r>0&&(l=Math.max(l,J(r))),i>0&&(s=Math.max(s,J(i)))}}catch{}}if(a.options?.excludeMode===`remove`){let e=li(a.element,a.options);Number.isFinite(e)&&e>0&&(l=Math.max(1,Math.min(l,J(e+1))))}let d=(e,t=NaN)=>{let n=typeof e==`string`?parseFloat(e):e;return Number.isFinite(n)?n:t},f=d(a.options.width),g=d(a.options.height),_=s,v=l,y=Number.isFinite(f),b=Number.isFinite(g),x=l>0?s/l:1;y&&b?(_=Math.max(1,J(f)),v=Math.max(1,J(g))):y?(_=Math.max(1,J(f)),v=Math.max(1,J(_/(x||1)))):b?(v=Math.max(1,J(g)),_=Math.max(1,J(v*(x||1)))):(_=s,v=l);let S=0,C=0,w=s,T=l;if(!r&&h&&Number.isFinite(h.a)){let e={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},t=vi(s,l,e,0,0);S=J(t.minX),C=J(t.minY),w=J(t.maxX),T=J(t.maxY)}else if(r&&Oi(a.element)){let e=n.transform&&n.transform!==`none`?n.transform:``,t=bi(a.element),r=Ci({baseTransform:e,rotate:t.rotate||`0deg`,scale:t.scale,translate:t.translate}),{ox:i,oy:o}=yi(n,s,l),c=r.is2D?r:new DOMMatrix(r.toString()),u=vi(s,l,c,i,o);S=J(u.minX),C=J(u.minY),w=J(u.maxX),T=J(u.maxY)}let E=pi(n),D=mi(n),O=hi(n),k=gi(n),A=i?{top:J(E.top+D.top+O.top+k.bleed.top),right:J(E.right+D.right+O.right+k.bleed.right),bottom:J(E.bottom+D.bottom+O.bottom+k.bleed.bottom),left:J(E.left+D.left+O.left+k.bleed.left)}:{top:0,right:0,bottom:0,left:0};S=J(S-A.left),C=J(C-A.top),w=J(w+A.right),T=J(T+A.bottom);let ee=Math.max(1,J(w-S)),te=Math.max(1,J(T-C)),ne=y||b?J(_/s):1,re=b||y?J(v/l):1,ie=Math.max(1,J(ee*ne)),ae=Math.max(1,J(te*re)),oe=`http://www.w3.org/2000/svg`,M=J((I()&&Oi(a.element)?1:0)+ +!r),N=document.createElementNS(oe,`foreignObject`),se=J(S),ce=J(C);N.setAttribute(`x`,String(J(-(se-M)))),N.setAttribute(`y`,String(J(-(ce-M)))),N.setAttribute(`width`,String(J(s+M*2))),N.setAttribute(`height`,String(J(l+M*2))),N.style.overflow=`visible`;let le=document.createElement(`style`);le.textContent=(a.scrollbarCSS||``)+a.baseCSS+a.fontsCSS+`svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}`+a.classCSS,N.appendChild(le);let P=document.createElement(`div`);P.setAttribute(`xmlns`,`http://www.w3.org/1999/xhtml`),P.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${J(s)}px;height:${J(l)}px`,P.appendChild(a.clone),N.appendChild(P);let ue=new XMLSerializer().serializeToString(N),de=J(ee+M*2),fe=J(te+M*2),pe=y||b;t.meta={w0:s,h0:l,vbW:de,vbH:fe,targetW:_,targetH:v},m=`<svg xmlns="${oe}" width="${I()&&pe?de:J(ie+M*2)}" height="${I()&&pe?fe:J(ae+M*2)}" viewBox="0 0 ${de} ${fe}" font-size="${parseFloat(j(u.documentElement)?.fontSize)||16}px">`+ue+`</svg>`,p=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,a={svgString:m,dataURL:p,...a},e()},{fast:n})}),await K(`afterRender`,a);let x=document.getElementById(`snapdom-sandbox`);return x&&x.style.position===`absolute`&&x.remove(),a.dataURL}function Oi(e){return wi(e)}l();function ki(e={}){let t=e.format??`png`;t===`jpg`&&(t=`jpeg`);let n=a(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??`hide`,filter:e.filter??null,filterMode:e.filterMode??`hide`,placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy==`string`?e.useProxy:``,width:e.width??null,height:e.height??null,format:t,type:e.type??`svg`,quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??([`jpeg`,`webp`].includes(t)?`#ffffff`:null),filename:e.filename??`snapDOM`,outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,compress:e.compress!==!1,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null,resolvePicturePlaceholders:e.resolvePicturePlaceholders!==!1,pictureResolver:e.pictureResolver&&typeof e.pictureResolver==`object`?e.pictureResolver:{}}}be(),xe(),R(),E(),l();function Ai(...e){return Dr(...e),Y}var Y=Object.assign(Pi,{plugins:Ai}),ji=Symbol(`snapdom.internal`),Mi=Symbol(`snapdom.internal.silent`),Ni=!1;async function Pi(e,t){if(!e)throw Error(`Element cannot be null or undefined`);let n=ki(t);if(jr(n,t&&t.plugins),I()&&(n.embedFonts===!0||Ii(e))){if(n.embedFonts)try{let t=In(e);await Rn(new Set([...t].map(e=>String(e).split(`__`)[0]).filter(Boolean)),1)}catch{}let r=n.safariWarmupAttempts??3;for(let n=0;n<r;n++)try{await Fi(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&Xt(n.iconFonts),n.snap||(n.snap={toPng:(e,t)=>Y.toPng(e,t),toSvg:(e,t)=>Y.toSvg(e,t)}),Y.capture(e,n,ji)}Y.capture=async(e,t,n)=>{if(n!==ji)throw Error(`[snapdom.capture] is internal. Use snapdom(...) instead.`);let r=await Di(e,t),i={img:async(e,t)=>{let{toImg:n}=await Promise.resolve().then(()=>(Ve(),ze));return n(r,{...e,...t||{}})},svg:async(e,t)=>{let{toSvg:n}=await Promise.resolve().then(()=>(Ve(),ze));return n(r,{...e,...t||{}})},canvas:async(e,t)=>{let{toCanvas:n}=await Promise.resolve().then(()=>(Fe(),Se));return n(r,{...e,...t||{}})},blob:async(e,t)=>{let{toBlob:n}=await Promise.resolve().then(()=>(We(),He));return n(r,{...e,...t||{}})},png:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Re(),Ie));return n(r,{...e,...t||{},format:`png`})},jpeg:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Re(),Ie));return n(r,{...e,...t||{},format:`jpeg`})},webp:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Re(),Ie));return n(r,{...e,...t||{},format:`webp`})},download:async(e,t)=>{let{download:n}=await Promise.resolve().then(()=>(Je(),Ge));return n(r,{...e,...t||{}})}},a={};for(let e of[`img`,`svg`,`canvas`,`blob`,`png`,`jpeg`,`webp`])a[e]=async n=>i[e](t,{...n||{},[Mi]:!0});a.jpg=a.jpeg;let o=await kr(`defineExports`,{...t,export:{url:r},exports:a}),s=Object.assign({},...o.filter(e=>e&&typeof e==`object`).reverse()),c={...i,...s};c.jpeg&&!c.jpg&&(c.jpg=(e,t)=>c.jpeg(e,t));function l(e,n){let r={...t,...n||{}};return[e,r.format,r.type].map(e=>typeof e==`string`?e.toLowerCase():``).find(e=>e===`jpeg`||e===`jpg`||e===`webp`)&&(r.backgroundColor==null||r.backgroundColor===`transparent`)&&(r.backgroundColor=`#ffffff`),r}let u=!1,d=Promise.resolve();async function f(e,n){return d=d.then(async()=>{let i=c[e];if(!i)throw Error(`[snapdom] Unknown export type: ${e}`);let a=l(e,n),o={...t,export:{type:e,options:a,url:r}};await K(`beforeExport`,o,{format:e,options:a});let s=await i(o,a);return await K(`afterExport`,o,{format:e,options:a,result:s}),u||(u=!0,await K(`afterSnap`,t)),s})}let p={url:r,toRaw:()=>r,to:(e,t)=>f(e,t),toImg:e=>f(`img`,e),toSvg:e=>f(`svg`,e),toCanvas:e=>f(`canvas`,e),toBlob:e=>f(`blob`,e),toPng:e=>f(`png`,e),toJpg:e=>f(`jpg`,e),toWebp:e=>f(`webp`,e),download:e=>f(`download`,e)};for(let e of Object.keys(c)){let t=`to`+e.charAt(0).toUpperCase()+e.slice(1);p[t]||(p[t]=t=>f(e,t))}return p},Y.toRaw=(e,t)=>Y(e,t).then(e=>e.toRaw()),Y.toImg=(e,t)=>Y(e,t).then(e=>e.toImg()),Y.toSvg=(e,t)=>Y(e,t).then(e=>e.toSvg()),Y.toCanvas=(e,t)=>Y(e,t).then(e=>e.toCanvas()),Y.toBlob=(e,t)=>Y(e,t).then(e=>e.toBlob()),Y.toPng=(e,t)=>Y(e,{...t,format:`png`}).then(e=>e.toPng()),Y.toJpg=(e,t)=>Y(e,{...t,format:`jpeg`}).then(e=>e.toJpg()),Y.toWebp=(e,t)=>Y(e,{...t,format:`webp`}).then(e=>e.toWebp()),Y.download=(e,t)=>Y(e,t).then(e=>e.download());async function Fi(e,t){if(Ni)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Di(e,n)}catch(e){L(t,`safariWarmup pre-capture failed`,e)}await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),r&&await new Promise(e=>{let n=new Image;try{n.decoding=`sync`,n.loading=`eager`}catch(e){L(t,`safariWarmup img hints failed`,e)}n.style.cssText=`position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;`,n.src=r,document.body.appendChild(n),(async()=>{try{typeof n.decode==`function`&&await n.decode()}catch(e){L(t,`safariWarmup img.decode failed`,e)}let r=performance.now();for(;!(n.complete&&n.naturalWidth>0)&&performance.now()-r<900;)await new Promise(e=>setTimeout(e,200));await new Promise(e=>requestAnimationFrame(e));try{let e=document.createElement(`canvas`);e.width=Math.max(1,n.naturalWidth||10),e.height=Math.max(1,n.naturalHeight||10);let t=e.getContext(`2d`);t&&t.drawImage(n,0,0)}catch{}await new Promise(e=>requestAnimationFrame(e));try{n.remove()}catch(e){L(t,`safariWarmup img.remove failed`,e)}e()})()}),e.querySelectorAll(`canvas`).forEach(e=>{try{let t=e.getContext(`2d`,{willReadFrequently:!0});t&&t.getImageData(0,0,1,1)}catch(e){L(t,`safariWarmup canvas poke failed`,e)}}),Ni=!0}function Ii(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let e=t.currentNode,n=getComputedStyle(e),r=n.backgroundImage&&n.backgroundImage!==`none`,i=n.maskImage&&n.maskImage!==`none`||n.webkitMaskImage&&n.webkitMaskImage!==`none`;if(r||i||e.tagName===`CANVAS`)return!0}return!1}var Li={scale:1,backgroundColor:`#ffffff`};function Ri(e){return Y.toBlob(e,{...Li,type:`png`})}async function zi(e){let t=await Y.toCanvas(document.documentElement,Li),n=Math.max(1,Math.round(e.width)),r=Math.max(1,Math.round(e.height)),i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);if(!a)throw Error(`could not create a 2d context for the region crop`);return a.drawImage(t,e.x+window.scrollX,e.y+window.scrollY,n,r,0,0,n,r),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`region toBlob failed`)),`image/png`)})}function Bi(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/([^A-Za-z0-9_-])/g,`\\$1`)}function Vi(e){let t=[],n=e;for(;n&&n.nodeType===1;){if(n.id){t.unshift(`#${Bi(n.id)}`);break}let e=n.localName,r=n.parentElement;if(r){let t=Array.from(r.children).filter(e=>e.localName===n?.localName);t.length>1&&(e+=`:nth-of-type(${t.indexOf(n)+1})`)}t.unshift(e),n=n.parentElement}return t.join(` > `)}function Hi(e){let t=e.id?`#${e.id}`:``,n=typeof e.className==`string`?e.className.trim():``,r=n?`.${n.split(/\s+/)[0]}`:``,i=(e.textContent??``).replace(/\s+/g,` `).trim().slice(0,40),a=i?` "${i}"`:``;return`${e.localName}${t}${r}${a}`}function Ui(){return{width:window.innerWidth,height:window.innerHeight}}var Wi=`2147483646`,Gi=`#378ADD`;function Ki(e){let t=`off`,n=!1,r={x:0,y:0},i=document.createElement(`div`);i.setAttribute(`data-chamba-annotate`,`root`),X(i,{position:`fixed`,inset:`0`,zIndex:Wi,pointerEvents:`none`,fontFamily:`-apple-system, system-ui, sans-serif`});let a=document.createElement(`div`);X(a,{position:`fixed`,display:`none`,border:`2px solid ${Gi}`,background:`rgba(55,138,221,0.12)`,borderRadius:`3px`,boxSizing:`border-box`,transition:`all 60ms ease-out`});let o=document.createElement(`div`);X(o,{position:`fixed`,display:`none`,border:`2px dashed ${Gi}`,background:`rgba(55,138,221,0.10)`,boxSizing:`border-box`});let s=document.createElement(`div`);X(s,{position:`fixed`,top:`12px`,left:`50%`,transform:`translateX(-50%)`,display:`none`,padding:`6px 12px`,borderRadius:`999px`,background:`#2C2C2A`,color:`#FCFBF8`,fontSize:`12px`,boxShadow:`0 2px 10px rgba(0,0,0,0.25)`,whiteSpace:`nowrap`}),i.append(a,o,s);let c=(e,t)=>{let n=document.elementFromPoint(e,t);return!n||n===i||i.contains(n)?null:n},l=e=>{let t=e.getBoundingClientRect();X(a,{display:`block`,left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`})},u=e=>{if(t===`annotate`){let t=c(e.clientX,e.clientY);t&&l(t)}else t===`region`&&n&&Ji(o,qi(r,{x:e.clientX,y:e.clientY}))},d=e=>{e.relatedTarget||(a.style.display=`none`)},f=e=>{e.preventDefault(),e.stopImmediatePropagation()},p=n=>{if(t===`off`||(f(n),t!==`annotate`))return;let r=c(n.clientX,n.clientY);r&&e.onPick(r)},m=e=>{if(t===`annotate`){f(e);return}t===`region`&&(f(e),n=!0,r={x:e.clientX,y:e.clientY},Ji(o,{x:e.clientX,y:e.clientY,width:0,height:0}))},h=i=>{if(t===`annotate`){f(i);return}if(t===`region`&&n){f(i),n=!1;let t=qi(r,{x:i.clientX,y:i.clientY});o.style.display=`none`,t.width>=8&&t.height>=8&&e.onRegion(t)}},g=t=>{t.key===`Escape`&&e.onExit()},_=e=>{t!==`off`&&f(e)},v=[[`mousemove`,u,!0],[`mouseout`,d,!0],[`click`,p,!0],[`mousedown`,m,!0],[`mouseup`,h,!0],[`dblclick`,_,!0],[`contextmenu`,_,!0],[`keydown`,g,!0]],y=()=>{for(let[e,t,n]of v)document.addEventListener(e,t,n)},b=()=>{for(let[e,t,n]of v)document.removeEventListener(e,t,n)},x=e=>{if(e===t)return;let r=t===`off`;if(t=e,n=!1,a.style.display=`none`,o.style.display=`none`,t===`off`){s.style.display=`none`,document.documentElement.style.cursor=``,i.isConnected&&i.remove(),b();return}s.textContent=t===`annotate`?`Annotate - click an element to comment · Esc to stop`:`Region - drag a box to screenshot · Esc to stop`,s.style.display=`block`,document.documentElement.style.cursor=`crosshair`,i.isConnected||document.documentElement.appendChild(i),r&&y()};return{setMode:x,destroy:()=>x(`off`)}}function qi(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}function Ji(e,t){X(e,{display:`block`,left:`${t.x}px`,top:`${t.y}px`,width:`${t.width}px`,height:`${t.height}px`})}function X(e,t){Object.assign(e.style,t)}var Yi=`bippy-0.6.0`,Xi=Object.defineProperty,Zi=Object.prototype.hasOwnProperty,Qi=()=>{},$i=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},ea=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),ta=!1,na,ra=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>ta?!0:(e&&typeof e.inject==`function`&&(na=e.inject.toString()),!!na?.includes(`(injected)`)),ia=new Set,aa=new Set,oa=e=>{e&&ia.add(e);let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:Yi,checkDCE:$i,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),aa.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,ia.forEach(e=>e())),i},on:Qi,onCommitFiberRoot:Qi,onCommitFiberUnmount:Qi,onPostCommitFiberRoot:Qi,renderers:t,supportsFiber:!0,supportsFlight:!0};try{Xi(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{aa.add(e),t.renderers.set(n,e)}),sa(e))}}});let t=window.hasOwnProperty,n=!1;Xi(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{sa(e)}return r},sa=e=>{e&&ia.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=$i,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=Yi,t._instrumentationIsActive=!1;let e=ea(t);if(e||(t.on=Qi),t.renderers.size){t._instrumentationIsActive=!0,ia.forEach(e=>e());return}let n=t.inject,r=ra(t);r&&!e&&(ta=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return aa.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,ia.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||ra())&&e?.()}catch{}},ca=()=>Zi.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),la=e=>ca()?(sa(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):oa(e),ua=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`));(()=>{try{ua()&&la()}catch{}})();var da=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},fa=e=>!e||typeof e!=`object`?!1:`pendingProps`in e&&!(`containerInfo`in e);function pa(e,t,n=!1){if(!e)return null;let r=t(e);if(r instanceof Promise)return(async()=>{if(await r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=await ha(i,t,n);if(e)return e;i=n?null:i.sibling}return null})();if(r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=ma(i,t,n);if(e)return e;i=n?null:i.sibling}return null}var ma=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=ma(r,t,n);if(e)return e;r=n?null:r.sibling}return null},ha=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await ha(r,t,n);if(e)return e;r=n?null:r.sibling}return null},ga=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?ga(t.type||t.render):null},_a=e=>{let t=e;if(typeof t==`string`)return t;if(typeof t!=`function`&&!(typeof t==`object`&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=ga(t);return r&&(r.displayName||r.name)||null},va=new Set,ya=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),ba=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){if(`_reactRootContainer`in e)return e._reactRootContainer?._internalRoot?.current?.child;let t=e.__internalInstanceHandle??e._internalInstanceHandle;if(fa(t))return t;let n=e;for(let e of va){let t=n[e];if(t)return t}for(let e of Object.keys(n))if(ya(e))return va.add(e),n[e]||null}return null},xa=[`rsc://`,`about://React/`],Sa=/\(at [^)]+\)$/,Ca=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],wa=/(^|@)\S+:\d+/,Ta=/^\s*at .*(\S+:\d+|\(native\))/m,Ea=/^(eval@)?(\[native code\])?$/,Da=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
9
- `),r=[];for(let e of n)if(/^\s*at\s+/.test(e)){let t=Aa(e,void 0)[0];t&&r.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*\(at .*\)$/,``);r.push({functionName:t,source:e})}else if(e.match(wa)){let t=ja(e,void 0)[0];t&&r.push(t)}return ka(r,t)}return e.match(Ta)?Aa(e,t):ja(e,t)},Oa=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},ka=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,Aa=(e,t)=>ka(e.split(`
10
- `).filter(e=>!!e.match(Ta)),t).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=Oa(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),ja=(e,t)=>ka(e.split(`
11
- `).filter(e=>!e.match(Ea)),t).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=Oa(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),Ma=new WeakMap,Na=e=>Ca.some(t=>e.includes(t)),Pa=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},Fa=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=Pa(r);if(Na(i))return{frames:t,isTrusted:!0};if(r.isNative?.()){t.push({functionName:i||void 0});continue}let a=r.getScriptNameOrSourceURL?.()??``;!a&&r.isEval?.()&&(a=r.getEvalOrigin?.()??``),t.push({functionName:i&&i!==`<anonymous>`?i:void 0,fileName:a&&a!==`<anonymous>`?a:void 0,lineNumber:r.getLineNumber?.()??void 0,columnNumber:r.getColumnNumber?.()??void 0,enclosingLineNumber:r.getEnclosingLineNumber?.()??void 0,enclosingColumnNumber:r.getEnclosingColumnNumber?.()??void 0,source:` at ${r.toString()}`})}return{frames:t,isTrusted:!1}},Ia=e=>{let t=-1;for(let n of Ca)if(t=e.indexOf(n),t!==-1)break;return{frames:Da(t===-1?e:e.slice(0,e.lastIndexOf(`
12
- `,t))).slice(1),isTrusted:t!==-1}},La=e=>{let t=Ma.get(e);if(t)return t;let n=null,r=(e,t)=>{n=Fa(t);let r=`${e.name||`Error`}: ${e.message||``}`;for(let e of t)r+=`\n at ${e.toString()}`;return r},i=Error.prepareStackTrace;Error.prepareStackTrace=r;let a;try{a=String(e.stack)}finally{Error.prepareStackTrace=i}let o=n??Ia(a);return Ma.set(e,o),o},Ra=44,za=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ba=new Uint8Array(64),Va=new Uint8Array(128);for(let e=0;e<za.length;e++){let t=za.charCodeAt(e);Ba[e]=t,Va[t]=e}function Ha(e,t){let n=0,r=0,i=0;do i=Va[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function Ua(e,t){return e.pos>=t?!1:e.peek()!==Ra}var Wa=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function Ga(e){let{length:t}=e,n=new Wa(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Ha(n,i),i<u&&(l=!1),u=i,Ua(n,e)?(a=Ha(n,a),o=Ha(n,o),s=Ha(n,s),Ua(n,e)?(c=Ha(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||Ka(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function Ka(e){e.sort(qa)}function qa(e,t){return e[0]-t[0]}var Ja=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Ya=/^data:application\/json[^,]+base64,/,Xa=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Za=new Map,Qa=new Map,$a=(e,t,n,r,i)=>{if(n<0||n>=e.length)return null;let a=e[n];if(!a||a.length===0)return null;let o=null,s=0,c=a.length-1;for(;s<=c;){let e=s+c>>1;a[e][0]<=r?(o=a[e],s=e+1):c=e-1}if(!o||o.length<4)return null;let[,l,u,d]=o;if(l===void 0||u===void 0||d===void 0)return null;let f=t[l];return f?{columnNumber:d,fileName:f,lineNumber:u+1,isIgnoreListed:i?.has(l)??!1}:null},eo=(e,t,n)=>{if(e.sections){let r=t-1,i=null;for(let t of e.sections)if(r>t.offset.line||r===t.offset.line&&n>=t.offset.column)i=t;else break;if(!i)return null;let a=r-i.offset.line,o=r===i.offset.line?n-i.offset.column:n;return $a(i.map.mappings,i.map.sources,a,o,i.map.ignoredSourceIndices)}return $a(e.mappings,e.sources,t-1,n,e.ignoredSourceIndices)},to=(e,t)=>{let n,r=t.length;for(;r>0&&!n;){let e=t.lastIndexOf(`
13
- `,r-1)+1,i=t.slice(e,r).match(Xa);i&&(n=i[1]||i[2]),r=e-1}if(!n)return null;let i=Ja.test(n);if(!(Ya.test(n)||i||n.startsWith(`/`))){let t=e.split(`/`);t[t.length-1]=n,n=t.join(`/`)}return n},no=e=>{let t=e.ignoreList??e.x_google_ignoreList;return Array.isArray(t)&&t.length>0?new Set(t):void 0},ro=e=>({file:e.file,ignoredSourceIndices:no(e),mappings:Ga(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),io=e=>{let t=e.sections.map(({map:e,offset:t})=>({map:{...e,ignoredSourceIndices:no(e),mappings:Ga(e.mappings)},offset:t})),n=new Set;for(let e of t)for(let t of e.map.sources)n.add(t);return{file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},ao=e=>{if(!e)return!1;let t=e.trim();if(!t)return!1;let n=t.match(Ja);if(!n)return!0;let r=n[0].toLowerCase();return r===`http:`||r===`https:`},oo=async(e,t=fetch)=>{if(!ao(e))return null;let n=await t(e);if(!n.ok)return null;let r=await n.text();if(!r)return null;let i=to(e,r);if(!i||!ao(i)&&!Ya.test(i))return null;let a=await t(i);if(!a.ok)return null;try{let e=await a.json();return`sections`in e?io(e):ro(e)}catch{return null}},so=async(e,t=!0,n)=>{if(t&&Za.has(e))return Za.get(e)??null;let r=t?Qa.get(e):void 0;if(r)return(await r).sourceMap;let i=oo(e,n).then(e=>({sourceMap:e,isTransientFailure:!1}),()=>({sourceMap:null,isTransientFailure:!0}));t&&Qa.set(e,i);let{sourceMap:a,isTransientFailure:o}=await i;return t&&(Qa.delete(e),o||Za.set(e,a)),a},co=async(e,t=!0,n)=>await Promise.all(e.map(async e=>{if(!e.fileName)return e;let r=await so(e.fileName,t,n);if(!r||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let i=eo(r,e.lineNumber,e.columnNumber);return i?{...e,source:i.fileName&&e.source?e.source.replace(e.fileName,i.fileName):e.source,fileName:i.fileName,lineNumber:i.lineNumber,columnNumber:i.columnNumber,isIgnoreListed:i.isIgnoreListed,isSymbolicated:!0}:e})),lo=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,uo=e=>{let t=null;if(pa(e,n=>{if(n===e)return!1;let r=n._debugOwner;return(r===e||e.alternate!==null&&r===e.alternate)&&n._debugStack instanceof Error?(t=n._debugStack,!0):!1}),!t)return null;let{frames:n,isTrusted:r}=La(t);if(!r)return null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.fileName)return{...t,lineNumber:t.enclosingLineNumber||t.lineNumber,columnNumber:t.enclosingColumnNumber||t.columnNumber}}return null},fo=()=>{let e=la();for(let t of[...Array.from(aa),...Array.from(e.renderers.values())]){let e=t.currentDispatcherRef;if(e&&typeof e==`object`)return`H`in e?e.H:e.current}return null},po=e=>{for(let t of aa){let n=t.currentDispatcherRef;n&&typeof n==`object`&&(`H`in n?n.H=e:n.current=e)}},Z=e=>`\n in ${e}`,mo=(e,t)=>{let n=Z(e);return t&&(n+=` (at ${t})`),n},ho=!1,go=new WeakMap,_o=(e,t)=>{if(!e||ho)return``;let n=go.get(e);if(n!==void 0)return n;let r=Error.prepareStackTrace;Error.prepareStackTrace=void 0,ho=!0;let i=fo();po(null);let a=console.error,o=console.warn;console.error=()=>{},console.warn=()=>{};try{let n={DetermineComponentFrameRoot(){let n;try{if(t){let t=function(){throw Error()};if(Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){n=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){n=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){n=e}let t=e();t&&typeof t.catch==`function`&&t.catch(()=>{})}}catch(e){if(e instanceof Error&&n instanceof Error&&typeof e.stack==`string`)return[e.stack,n.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`,Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,`name`)?.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});let[r,i]=n.DetermineComponentFrameRoot();if(r&&i){let t=r.split(`
14
- `),n=i.split(`
15
- `),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,r=_a(e);return r&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,r)),go.set(e,n),n}while(a>=1&&o>=0);break}}}finally{ho=!1,Error.prepareStackTrace=r,po(i),console.error=a,console.warn=o}let s=e?_a(e):``,c=s?Z(s):``;return go.set(e,c),c},vo=(e,t)=>{let n=e.tag,r=``;switch(n){case 28:r=Z(`Activity`);break;case 1:r=_o(e.type,!0);break;case 11:r=_o(e.type.render,!1);break;case 0:case 15:r=_o(e.type,!1);break;case 5:case 26:case 27:r=Z(e.type);break;case 16:r=Z(`Lazy`);break;case 13:r=e.child!==t&&t!==null?Z(`Suspense Fallback`):Z(`Suspense`);break;case 19:r=Z(`SuspenseList`);break;case 30:r=Z(`ViewTransition`);break;default:return``}return r},yo=e=>{try{let t=``,n=e,r=null;do{t+=vo(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=mo(r.name,r.env))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nError generating stack: ${e.message}\n${e.stack}`:``}},bo=e=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;let n=e;if(!n)return``;Error.prepareStackTrace=t,n.startsWith(`Error: react-stack-top-frame
16
- `)&&(n=n.slice(29));let r=n.indexOf(`
17
- `);r!==-1&&(n=n.slice(r+1));let i=Math.max(n.indexOf(`react_stack_bottom_frame`),n.indexOf(`react-stack-bottom-frame`));if(i!==-1&&(i=n.lastIndexOf(`
18
- `,i)),i!==-1)n=n.slice(0,i);else return``;return n},xo=e=>!!(e.functionName&&e.fileName&&To(e.fileName)),So=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,Co=e=>{let t=new Map;for(let n of e)for(let e of n.stackFrames){if(!xo(e))continue;let n=e.functionName,r=t.get(n)??[];r.some(t=>So(t,e))||(r.push(e),t.set(n,r))}return t},wo=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(`(at Server)`,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},To=e=>xa.some(t=>e.startsWith(t)),Eo=e=>{let t=[];return pa(e,e=>{if(!lo(e))return;let n=typeof e.type==`string`?e.type:_a(e.type)||`<anonymous>`;t.push({componentName:n,stackFrames:Da(bo(e._debugStack?.stack))})},!0),t},Do=async(e,t=!0,n)=>{let r=Eo(e),i=Da(yo(e)),a=Co(r),o=new Map;return co(i.map(e=>(e.source?.includes(`(at Server)`)??!1)||e.source!=null&&Sa.test(e.source)?wo(e,a,o):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName}),t,n)},Oo=e=>{let t=e._debugSource;return t?typeof t==`object`&&!!t&&`fileName`in t&&typeof t.fileName==`string`&&`lineNumber`in t&&typeof t.lineNumber==`number`:!1},ko=e=>e.fileName?{fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,functionName:e.functionName}:null,Ao=e=>{if(!lo(e))return null;let{frames:t,isTrusted:n}=La(e._debugStack);if(!n)return null;for(let e of t)if(e.fileName)return e;return null},jo=async(e,t=!0,n)=>{if(Oo(e))return e._debugSource||null;let r=Ao(e)??uo(e);if(r){let[e]=await co([r],t,n),i=ko(e);if(i)return i}let i=await Do(e,t,n);for(let e of i)if(e.fileName)return ko(e);return null},Mo=Symbol.for(`react.context`),No=Symbol.for(`react.memo_cache_sentinel`),Po=[],Fo=null,Io=null,Lo=null,Ro=0,zo=null,Bo=Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render."),Q=()=>{let e=Io;return e!==null&&(Io=e.next),e},Vo=e=>{if(Fo===null)return e._currentValue;if(Lo===null)throw Error(`Context reads do not line up with context dependencies.`);if(Object.prototype.hasOwnProperty.call(Lo,`memoizedValue`)){let e=Lo.memoizedValue;return Lo=Lo.next,e}return e._currentValue},$=(e,t,n,r=null)=>{Po.push({displayName:r,primitive:e,stackError:Error(),value:t,dispatcherHookName:n})},Ho=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.then==`function`){let e=zo!==null&&Ro<zo.length?zo[Ro++]:t;switch(e.status){case`fulfilled`:return $(`Promise`,e.value,`Use`),e.value;case`rejected`:throw e.reason}throw $(`Unresolved`,e,`Use`),Bo}if(t.$$typeof===Mo&&`_currentValue`in t){let e=t,n=Vo(e);return $(`Context (use)`,n,`Use`,e.displayName||`Context`),n}}throw Error(`An unsupported type was passed to use(): `+String(e))},Uo=e=>{let t=Vo(e);return $(`Context`,t,`Context`,e.displayName||null),t},Wo=e=>{let t=Q(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return $(`State`,n,`State`),[n,()=>{}]},Go=(e,t,n)=>{let r=Q(),i=r===null?n===void 0?t:n(t):r.memoizedState;return $(`Reducer`,i,`Reducer`),[i,()=>{}]},Ko=e=>{let t=Q(),n=t===null?{current:e}:t.memoizedState;return $(`Ref`,n.current,`Ref`),n},qo=()=>{let e=Q();return $(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},Jo=e=>{Q(),$(`LayoutEffect`,e,`LayoutEffect`)},Yo=e=>{Q(),$(`InsertionEffect`,e,`InsertionEffect`)},Xo=e=>{Q(),$(`Effect`,e,`Effect`)},Zo=e=>{Q();let t;typeof e==`object`&&e&&`current`in e&&(t=e.current),$(`ImperativeHandle`,t,`ImperativeHandle`)},Qo=(e,t)=>{$(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},$o=e=>{let t=Q();return $(`Callback`,t===null?e:t.memoizedState[0],`Callback`),e},es=e=>{let t=Q(),n=t===null?e():t.memoizedState[0];return $(`Memo`,n,`Memo`),n},ts=(e,t)=>{let n=Q();Q();let r=n===null?t():n.memoizedState;return $(`SyncExternalStore`,r,`SyncExternalStore`),r},ns=()=>{let e=Q();Q();let t=e!==null&&e.memoizedState;return $(`Transition`,t,`Transition`),[t,()=>{}]},rs=e=>{let t=Q(),n=t===null?e:t.memoizedState;return $(`DeferredValue`,n,`DeferredValue`),n},is=()=>{let e=Q(),t=e===null?``:e.memoizedState;return $(`Id`,t,`Id`),t},as=e=>{let t=Fo;if(t==null)return[];let n=t.updateQueue?.memoCache;if(n==null)return[];let r=n.data[n.index];return r===void 0&&(r=n.data[n.index]=Array.from({length:e},()=>No)),n.index++,r},os=e=>{let t=Q(),n=t===null?e:t.memoizedState;return $(`Optimistic`,n,`Optimistic`),[n,()=>{}]},ss=(e,t)=>{let n,r=null;if(e!==null){let t=e.memoizedState;if(typeof t==`object`&&t&&`then`in t&&typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:n=e.value;break;case`rejected`:r=e.reason;break;default:r=Bo,n=e}}else n=t}else n=t;return{value:n,error:r}},cs=e=>(t,n)=>{let r=Q();Q(),Q();let i=Error(),{value:a,error:o}=ss(r,n);if(Po.push({displayName:null,primitive:e,stackError:i,value:a,dispatcherHookName:e}),o!==null)throw o;return[a,()=>{},!1]},ls=cs(`ActionState`),us={readContext:Vo,use:Ho,useCallback:$o,useContext:Uo,useEffect:Xo,useImperativeHandle:Zo,useLayoutEffect:Jo,useInsertionEffect:Yo,useMemo:es,useReducer:Go,useRef:Ko,useState:Wo,useDebugValue:Qo,useDeferredValue:rs,useTransition:ns,useSyncExternalStore:ts,useId:is,useHostTransitionStatus:()=>{let e=Vo({_currentValue:null});return $(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:cs(`FormState`),useActionState:ls,useOptimistic:os,useMemoCache:as,useCacheRefresh:qo,useEffectEvent:e=>(Q(),$(`EffectEvent`,e,`EffectEvent`),e)};typeof Proxy>`u`||new Proxy(us,{get(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let n=Error(`Missing method in Dispatcher: `+t);throw n.name=`ReactDebugToolsUnsupportedHookError`,n}});var ds=2e3;function fs(){let e=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e?.renderers&&e.renderers.size>0)return!0;let t=document.querySelector(`#root, #__next, [data-reactroot]`)??document.body;if(!t)return!1;for(let e of[t,...Array.from(t.children).slice(0,4)])if(Object.keys(e).some(e=>e.startsWith(`__reactFiber$`)||e.startsWith(`__reactContainer$`)))return!0;return!1}async function ps(e){let t=hs(e);if(!t)return null;let n=(da(t)?t:pa(t,e=>da(e),!0))??t,r=gs(n);if(!r)return null;let i=await _s(n);return i&&ms(i.file)?null:{name:r,...i?{source:i}:{}}}function ms(e){return e.includes(`node_modules`)}function hs(e){try{return ba(e)}catch{return null}}function gs(e){try{return _a(e.type)}catch{return null}}async function _s(e){try{let t=await vs(jo(e,!0),ds,null);return t?.fileName?{file:t.fileName,...t.lineNumber?{line:t.lineNumber}:{},...t.columnNumber?{column:t.columnNumber}:{}}:void 0}catch{return}}function vs(e,t,n){return new Promise(r=>{let i=!1,a=setTimeout(()=>{i||(i=!0,r(n))},t),o=e=>{i||(i=!0,clearTimeout(a),r(e))};e.then(o,()=>o(n))})}function ys(){if(window.parent===window)return;let n=Ki({onPick:e=>void i(e),onRegion:e=>void a(e),onExit:()=>n.setMode(`off`)}),r=t(t=>{t.t===`hello`?r.emit({tag:e,t:`ready`,react:fs(),url:location.href}):t.t===`mode`&&n.setMode(t.mode)});async function i(t){let n=await ps(t),i={selector:Vi(t),pageUrl:location.href,viewport:Ui(),label:Hi(t),...n?{component:n}:{}},a;try{a=await Ri(t)}catch{}r.emit({tag:e,t:`selected`,target:i,...a?{screenshot:a}:{}})}async function a(t){let i;try{i=await zi(t)}catch{return}r.emit({tag:e,t:`region`,screenshot:i}),n.setMode(`off`)}}ys()})();
package/skill/README.md DELETED
@@ -1,12 +0,0 @@
1
- # skill/
2
-
3
- The `/chamba` skill: the single entry point that opens the browser workspace from
4
- a terminal agent session.
5
-
6
- `SKILL.md` is the tracked source and the published skill. It drives the CLI
7
- through `npx chamba@latest <command>`, so it works in any project once installed
8
- with `npx chamba@latest skill install`.
9
-
10
- In the chamba repo itself the skill is made discoverable to Claude Code by a
11
- symlink at `.claude/skills/chamba` pointing here, and the CLI is driven from the
12
- repo-root script `pnpm -s chamba <command>` against the local sources.
package/skill/SKILL.md DELETED
@@ -1,93 +0,0 @@
1
- ---
2
- name: chamba
3
- description: Open a browser workspace beside this terminal session - a second, parallel conversation where the human can see rendered markdown, paste screenshots the agent can read, point at UI, and view rich HTML pages the agent renders. Use when the user says /chamba, asks to "open chamba", wants to share or receive images, or wants a visual workspace alongside the terminal.
4
- when_to_use: The user typed /chamba, asked to open the chamba workspace, wants to paste or be shown an image/screenshot, or wants a browser surface beside this terminal session.
5
- ---
6
-
7
- # chamba
8
-
9
- chamba is a browser conversation running beside this terminal one - two separate channels you attend at the same time.
10
- Every command is `npx chamba@latest <command>`; conversation content prints on stdout, hints and status on stderr.
11
-
12
- ## Protocol
13
-
14
- 1. `npx chamba@latest open --title "what this is about"` - prints the session URL.
15
- Say exactly: `Chamba available at: <url>` and nothing more.
16
- 2. Launch `npx chamba@latest poll` as a background task.
17
- It parks silently until the human sends something - hours or days, zero cost.
18
- 3. When a poll returns: say `From chamba: <one-line gist of what arrived>`, act on it, answer with `reply`, and relaunch the background `poll` immediately.
19
- While no poll is parked the browser tells the human no agent is listening.
20
- 4. While the browser exchange is live, tighten the loop: poll in the foreground with `poll --for 240000` (give the command a generous timeout), reply, re-poll.
21
- When it goes quiet, drop back to a background `poll`.
22
- 5. Stop only when the session ends (see the cheatsheet).
23
- Then say exactly: `Chamba stopped. Say the word to reopen.`
24
-
25
- Do not narrate opening, polling, or switching beyond those one-liners.
26
- The session is stateless to you: everything lives on disk plus your read cursor, so after any interruption `open` + `poll` puts you exactly back.
27
- Re-running `open` in the same agent session reconnects to the same session (`--new` forces fresh, `--last` rebinds to the newest active one).
28
- If `open` reports no git root, ask where the workspace should live and run `init <dir>` once.
29
-
30
- ## What arrives -> what you do
31
-
32
- | You see | It means | You do |
33
- | --- | --- | --- |
34
- | `you: ...` | a message from the browser | act, then `reply <text>` |
35
- | `you [re #42 agent: "..."]: ...` | a reply to earlier event #42; the bracket is that event's gist | act with that context; use `reply --to 42` when answering that event specifically |
36
- | `you [answer in terminal]: ...` | the human wants the answer HERE, in the terminal | answer in the terminal conversation; do not `reply` |
37
- | ` [file] name -> /abs/path` | an attachment on the message above | `Read` the path (screenshots, mockups, logs) |
38
- | `you [N annotations]:` | numbered element comments from the app tab or your page | per item: use `selector`/`component`/`file:line` to find the code, `Read` the `[shot]`, fix, then `reply` |
39
- | `[chamba <id>#<seq> "..."]` pasted here in the terminal | the human is referencing a browser message | run `npx chamba@latest get <id>#<seq>` to print it, then answer in the terminal |
40
- | `· Session ended` | the human handed back | stop the loop; say the stop line |
41
- | `chamba server stopped` | deliberate stop | stop the loop; `open` again only if work should continue |
42
-
43
- Anything else on stderr (heartbeat, retry note, quiet stretch) means: relaunch `poll` and keep listening.
44
- Polling is at-least-once: a batch re-delivers if you were interrupted before acting on it.
45
-
46
- ## Answer where you were asked
47
-
48
- Terminal input is answered in the terminal; browser input is answered with `reply`.
49
- Never mirror content between the channels.
50
- The only overrides are explicit: `[answer in terminal]` and a pasted `[chamba ...]` reference both move that one answer to the terminal.
51
-
52
- ## Replying
53
-
54
- ```
55
- npx chamba@latest reply on it - here is the diff you asked about
56
- npx chamba@latest reply here's the chart --image /abs/chart.png
57
- npx chamba@latest reply --to 42 yes, exactly that one
58
- ```
59
-
60
- `--file a,b` / `--image a,b` attach files (comma-separated); text is optional alongside them.
61
- `--to <seq>` threads the reply to a specific earlier event - use it when answering something older than the latest message.
62
-
63
- ## Illustration pages
64
-
65
- ```
66
- npx chamba@latest show /abs/page.html --name architecture
67
- ```
68
-
69
- Renders a full HTML page in the browser's Illustration tab - use it proactively for diagrams, mockups, comparisons, anything richer than markdown.
70
-
71
- - The page must be fully self-contained: inline all CSS/JS/SVG; it runs in a sandboxed iframe (`allow-scripts` only) with no network access.
72
- - Re-`show` the same `--name` to revise in place; a new name adds a page.
73
- - The human can annotate your page like any app - comments arrive as an annotation batch with selectors into your own HTML.
74
-
75
- ## The app tab
76
-
77
- The "Your app" tab frames the human's dev app for annotation; it needs chamba's client script inside that app.
78
- When asked to set it up (the tab has a button that sends you the request), add the tag from the "not detected" banner - `<script src="<chamba-origin>/inject/annotate.js"></script>`, chamba-origin being the same host/port as the `open` URL - to the app's HTML entry or root layout, guarded to development.
79
- Then have the app reloaded in the tab.
80
- One-time per app.
81
-
82
- ## Ending
83
-
84
- `npx chamba@latest end` - only when the human explicitly asks to stop or hand back, never on your own initiative.
85
-
86
- ## Notes
87
-
88
- - Each project has its own `.chamba/` workspace (created at the git root on first `open`) and its own server on a derived port; never set a port by hand.
89
- - Presence is automatic: a parked poll shows "listening", a delivered batch flips to "working", a reply or the next poll flips back.
90
- No poll parked shows "away".
91
- - If the server crashed, a parked poll respawns it by itself; after a deliberate `stop` it exits cleanly.
92
- Every message is durable on disk either way.
93
- - Past sessions stay readable in the browser; an ended session opens read-only.
@@ -1 +0,0 @@
1
- import{a as e,n as t,o as n,r,s as i,t as a}from"./index-B9DI4F1Z.js";var o=i(n(),1),s=e(),c=({code:e,language:n,raw:i,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(r),p=t(),[m,h]=(0,o.useState)(i);return(0,o.useEffect)(()=>{if(!p){h(i);return}let t=p.highlight({code:e,language:n,themes:f},e=>{h(e)});t&&h(t)},[e,n,f,p,i]),(0,s.jsx)(a,{className:c,language:n,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};