pk-annotator 0.6.2 → 0.8.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 (27) hide show
  1. package/README.ko.md +17 -9
  2. package/README.md +11 -3
  3. package/dist/overlay.mjs +48 -4
  4. package/dist/{pka-mcp-server-DJ7A2u68.mjs → pka-mcp-server-BhcwUcgs.mjs} +251 -19
  5. package/dist/pka-mcp.mjs +1 -1
  6. package/dist/{pka-overlay-agent-art-BKBtrWqF.mjs → pka-overlay-agent-art-n6aH_1kF.mjs} +1 -1
  7. package/dist/{pka-overlay-agent-theme-CfCyg5Gv.mjs → pka-overlay-agent-theme-BiWi6_IJ.mjs} +13 -1
  8. package/dist/pka-overlay-app-DjGKtS7t.mjs +274 -0
  9. package/dist/pka-overlay-channel-BZI-qbPH.mjs +113 -0
  10. package/dist/pka-overlay-composer-DCu_eGT0.mjs +244 -0
  11. package/dist/{pka-overlay-copy-CvKjfQl1.mjs → pka-overlay-copy-B-PxSL-y.mjs} +1 -1
  12. package/dist/{pka-overlay-gifenc-BGK0llcr.mjs → pka-overlay-gifenc-DqOpaD2I.mjs} +1 -1
  13. package/dist/{pka-overlay-perf-panel-gQYSZ0gA.mjs → pka-overlay-perf-panel-DZY5Nwil.mjs} +2 -2
  14. package/dist/pka-overlay-send-Cu8DXY6B.mjs +139 -0
  15. package/dist/{pka-overlay-snapdom-djDPjHu_.mjs → pka-overlay-snapdom-BArbLl8i.mjs} +1 -1
  16. package/dist/pka-overlay-thread-store-C55iLxND.mjs +1 -0
  17. package/dist/pka-overlay-untracked-fetch-Dj1et-Fv.mjs +1 -0
  18. package/dist/pka.mjs +24 -4
  19. package/dist/{recording-CpEDddkZ.mjs → recording-D_Qkyq0N.mjs} +73 -23
  20. package/dist/vite.mjs +318 -13
  21. package/package.json +1 -1
  22. package/dist/pka-overlay-app-CsIxnRqJ.mjs +0 -246
  23. package/dist/pka-overlay-channel-D5Ghnvgb.mjs +0 -113
  24. package/dist/pka-overlay-composer-CT2x7vgj.mjs +0 -244
  25. package/dist/pka-overlay-send-BZyT4xuW.mjs +0 -139
  26. package/dist/pka-overlay-thread-store-DOxLXsAv.mjs +0 -1
  27. package/dist/pka-overlay-untracked-fetch-BCn3eft5.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./pka-overlay-untracked-fetch-BCn3eft5.mjs";var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})};function i(e){return e===!1||typeof e==`string`&&e.toLowerCase().trim()===`disabled`?`disabled`:`soft`}function a(e=`soft`){e===`disabled`&&(s.computedStyle=/* @__PURE__ */ new WeakMap,s.measureHints=/* @__PURE__ */ new WeakMap,s.baseStyle=new o(50),s.defaultStyle=new o(64),s.image=new o(100),s.background=new o(100),s.resource=new o(150),s.compress=new o(50))}var o,s,c=n(()=>{o=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)}},s={image:new o(100),background:new o(100),resource:new o(150),defaultStyle:new o(64),baseStyle:new o(50),compress:new o(50),computedStyle:/* @__PURE__ */ new WeakMap,measureHints:/* @__PURE__ */ new WeakMap,warnedReconcile:!1}});function l(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith(`#`)?null:n}function u(e){let t=[],n=0,r=0,i=``;for(let a=0;a<e.length;a++){let o=e[a];if(o===`\\`){a++;continue}i?o===i&&(i=``):o===`"`||o===`'`?i=o:o===`(`?r++:o===`)`?r--:o===`,`&&r===0&&(t.push(e.slice(n,a)),n=a+1)}return t.push(e.slice(n)),t}function d(e,t=1){let n=e.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let r=[];for(let e of u(n[1])){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)continue;let n=e.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(n&&!C.test(n[1].trim()))continue;let i=e.replace(/url\((['"]?)[\s\S]*?\1\)/,` `).match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)\b/i),a=1;if(i){let e=parseFloat(i[1]);a=/dpi/i.test(i[2])?e/96:e}r.push({url:t[2].trim(),dppx:a})}return r.length?(r.sort((e,t)=>e.dppx-t.dppx),(r.find(e=>e.dppx>=t)||r[r.length-1]).url):null}function f(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 p(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function m(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}}function h(e){return!!e&&e.tagName===`INPUT`&&(e.getAttribute(`type`)||``).toLowerCase()===`password`}function g(e){return`•`.repeat(String(e??``).length)}function _(e,t){return e?.nodeType===1&&e.localName===t}function v(e){return e?.nodeType===1&&e.namespaceURI===w}function y(e){return e?.nodeType===1&&e.namespaceURI===T}function b(e){return e?.nodeType===11&&!!e.host}function x(e){return e?.nodeType===9}var S,C,w,T,E=n(()=>{S=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i,C=S,w=`http://www.w3.org/1999/xhtml`,T=`http://www.w3.org/2000/svg`});function D(e=`[snapDOM]`,{ttlMs:t=3e5,maxEntries:n=12}={}){let r=/* @__PURE__ */ 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 O(e,t,n){if(P.size>=oe){let e=Date.now();for(let[t,n]of P)n.until<=e&&P.delete(t);for(;P.size>=oe;)P.delete(P.keys().next().value)}P.set(e,{until:Date.now()+n,result:t})}function k(e){return/^data:|^blob:|^about:blank$/i.test(e)}function A(e,t){try{let n=typeof location<`u`&&location.href?location.href:`http://localhost/`,r=t.split(/\{url(?:Raw)?\}/)[0],i=new URL(r||`.`,n);if(new URL(e,n).origin===i.origin)return!0}catch{}return!1}function ee(e,t){if(!t||k(e)||A(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 j(e,t){return t?/\{url(?:Raw)?\}/.test(t)?t.replace(`{urlRaw}`,()=>p(e)).replace(`{url}`,()=>encodeURIComponent(e)):/[?&]url=?$/.test(t)?`${t}${encodeURIComponent(e)}`:t.endsWith(`?`)?`${t}url=${encodeURIComponent(e)}`:t.endsWith(`/`)?`${t}${p(e)}`:`${t}${t.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`:e}function te(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(/* @__PURE__ */ Error(`read_failed`)),r.readAsDataURL(e)})}function ne(e,t){return new Headers(t.headers||{}).keys().next().done?JSON.stringify([t.as||`blob`,t.timeout??3e3,t.useProxy||``,t.errorTTL??8e3,t.credentials||``,e]):null}function M(e){try{return new URL(e,globalThis.location?.href||`http://localhost/`).origin}catch{return`invalid-url`}}function re(e,t){try{e.onError?.(t)}catch{}}async function N(t,n={}){let r=n.as??`blob`,i=n.timeout??3e3,a=n.useProxy||``,o=n.errorTTL??8e3,s=n.headers||{},c=!!n.silent;if(/^data:/i.test(t))try{if(r===`text`)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(r===`dataURL`)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(`;`)[0]||``};let[,e=``,n=``]=String(t).match(/^data:([^,]*),(.*)$/)||[],i=/;base64/i.test(e)?atob(n):decodeURIComponent(n),a=new Uint8Array([...i].map(e=>e.charCodeAt(0))),o=new Blob([a],{type:(e||``).split(`;`)[0]||``});return{ok:!0,data:o,status:200,url:t,fromCache:!1,mime:o.type||``}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:`special_url_error`}}if(/^blob:/i.test(t))try{let n=await e(t);if(!n.ok)return{ok:!1,data:null,status:n.status,url:t,fromCache:!1,reason:`http_error`};let i=await n.blob(),a=i.type||n.headers.get(`content-type`)||``;return r===`dataURL`?{ok:!0,data:await te(i),blob:i,status:n.status,url:t,fromCache:!1,mime:a}:r===`text`?{ok:!0,data:await i.text(),status:n.status,url:t,fromCache:!1,mime:a}:{ok:!0,data:i,status:n.status,url:t,fromCache:!1,mime:a}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:`network`}}if(/^about:blank$/i.test(t))return r===`dataURL`?{ok:!0,data:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==`,status:200,url:t,fromCache:!1,mime:`image/png`}:{ok:!0,data:r===`text`?``:new Blob([]),status:200,url:t,fromCache:!1};let l;try{l=ne(t,{as:r,timeout:i,useProxy:a,errorTTL:o,credentials:n.credentials,headers:s})}catch{let e={ok:!1,data:null,status:0,url:t,fromCache:!1,reason:`network`};return re(n,e),e}let u=P.get(l);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&P.delete(l);let d=ae.get(l);if(d)return d;let f=ee(t,a)?j(t,a):t,p=n.credentials;if(!p)try{let e=typeof location<`u`&&location.href?location.href:`http://localhost/`,n=new URL(t,e);p=typeof location<`u`&&n.origin===location.origin?`include`:`omit`}catch{p=`omit`}let m=new AbortController,h=setTimeout(()=>m.abort(`timeout`),i),g=(async()=>{try{let i=await e(f,{signal:m.signal,credentials:p,headers:s});if(!i.ok){let e={ok:!1,data:null,status:i.status,url:f,fromCache:!1,reason:`http_error`};if(l!==null&&o>0&&O(l,e,o),!c){let e=`${i.status} ${i.statusText||``}`.trim();ie.warnOnce(`http:${i.status}:${r}:${M(t)}`,`HTTP ${e} fetching ${r}: ${t}`)}return re(n,e),e}if(r===`text`)return{ok:!0,data:await i.text(),status:i.status,url:f,fromCache:!1};let a=await i.blob(),u=a.type||i.headers.get(`content-type`)||``;return r===`dataURL`?{ok:!0,data:await te(a),blob:a,status:i.status,url:f,fromCache:!1,mime:u}:{ok:!0,data:a,status:i.status,url:f,fromCache:!1,mime:u}}catch(e){let a=m.signal.aborted?m.signal.reason===`timeout`?`timeout`:`abort`:e&&typeof e==`object`&&e.name===`AbortError`?`abort`:`network`,s={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:a};if(l!==null&&!/^blob:/i.test(t)&&o>0&&O(l,s,o),!c){let e=`${a}:${r}:${M(t)}`,n=a===`timeout`?`Timeout (${i}ms): ${t}. Increase timeout or use a proxy`:a===`abort`?`Aborted fetching ${r}: ${t}`:`Network/CORS fetching ${r}: ${t}. Try useProxy`;ie.errorOnce(e,n)}return re(n,s),s}finally{clearTimeout(h),ae.delete(l)}})();return l!==null&&ae.set(l,g),g}var ie,ae,oe,P,F=n(()=>{E(),ie=D(`[snapDOM]`,{ttlMs:18e4,maxEntries:10}),ae=/* @__PURE__ */ new Map,oe=50,P=/* @__PURE__ */ new Map});async function se(e,t={}){if(/^\s*url\(\s*['"]?data:/i.test(e)||/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()===`none`)return e;let n=d(e,typeof devicePixelRatio<`u`&&devicePixelRatio||1)??l(e);if(!n)return e;let r=p(m(n)),i=(t.useProxy||``)+`|`+r;if(s.background.has(i)){let e=s.background.get(i);return e?`url("${e}")`:`none`}try{let e=await N(r,{as:`dataURL`,useProxy:t.useProxy});return e.ok?(s.background.set(i,e.data),`url("${e.data}")`):(s.background.set(i,null),`none`)}catch{return s.background.set(i,null),`none`}}var ce=n(()=>{c(),E(),F()});function le(e){let t=e.replace(Ce,``).trim();return t?t.replace(/(^|,)(\s*)(?=,|$)/g,`$1$2*`):`*`}function ue(e,t,n,r){for(let i=0;i<e.length;i++){if(--r.budget<0)return!1;let a=e[i],o=a.style;if(o){let e=!!a.selectorText&&be.test(a.selectorText);for(let n=0;n<o.length;n++){let i=o[n];if(t.add(i),e&&r.pseudoProps.add(i),o.getPropertyPriority(i)&&r.importantProps.add(i),i.length>5&&(i[0]===`m`||i[0]===`p`)){let e=i.startsWith(`margin`)?`marginUnstable`:i.startsWith(`padding`)?`paddingUnstable`:null;e&&!r[e]&&xe.test(o.getPropertyValue(i))&&(r[e]=!0)}}}let s=a.selectorText;if(s&&s.includes(`:has(`)&&(r.usesHas=!0),s&&s.includes(`&`))for(let e=a.parentRule;e&&s.includes(`&`);e=e.parentRule)e.selectorText&&(s=s.replace(/&/g,`:is(${e.selectorText})`));if(s&&(r.inContainer||we.test(s)||s.includes(`+`)||s.includes(`~`)))for(let e of me(s,`,`)){let t=e.trim();t&&(r.inContainer||we.test(t)||t.includes(`+`)||t.includes(`~`))&&r.shareUnsafeSels.add(t)}if(s&&s.includes(`:`))for(let e in Se)Se[e].test(s)&&n[e].push(le(s));if(a.styleSheet){if(!de(a.styleSheet,t,n,r))return!1}else if(a.cssRules&&a.cssRules.length){let e=a.constructor?.name===`CSSContainerRule`;e&&r.inContainer++;let i=ue(a.cssRules,t,n,r);if(e&&r.inContainer--,!i)return!1}}return!0}function de(e,t,n,r){let i;try{i=e.cssRules}catch{return!1}return i?ue(i,t,n,r):!1}function fe(e,t){for(let n of e){let e=n.effect?.getKeyframes?.()||[];for(let n of e)for(let e of Object.keys(n))e===`offset`||e===`easing`||e===`composite`||e===`computedOffset`||t.add(e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()))}}function pe(e){let t=/* @__PURE__ */ new Set;return de(e,t,{before:[],after:[],firstLetter:[],marker:[],firstLine:[]},{budget:2e4,usesHas:!1,shareUnsafeSels:/* @__PURE__ */ new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:/* @__PURE__ */ new Set,pseudoProps:/* @__PURE__ */ new Set})?t:null}function me(e,t){if(!e.includes(t))return[e];let n=[],r=0,i=null,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(s===`\\`){o++;continue}if(i){s===i&&(i=null);continue}s===`"`||s===`'`?i=s:s===`(`||s===`[`?r++:s===`)`||s===`]`?r--:r===0&&s===t&&(n.push(e.slice(a,o)),a=o+1)}return n.push(e.slice(a)),n}function he(e){let t=0,n=null,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(n){a===n&&e[i-1]!==`\\`&&(n=null);continue}a===`"`||a===`'`?n=a:a===`(`||a===`[`?t++:a===`)`||a===`]`?t--:t===0&&(a===` `||a===`>`||a===`+`||a===`~`)&&(r=i+1)}let i=``,a=0;for(let t of e.slice(r))t===`(`||t===`[`?a++:t===`)`||t===`]`?a--:a===0&&(i+=t);let o=e=>!e||/\\[0-9a-fA-F]/.test(e)?null:e.replace(/\\(.)/g,`$1`),s=o((i.match(/\.((?:\\.|[\w-])+)/)||[])[1]);if(s)return`c`+s;let c=o((i.match(/#((?:\\.|[\w-])+)/)||[])[1]);if(c)return`i`+c;let l=(i.match(/^([a-zA-Z][\w-]*)/)||[])[1];return l?`t`+l.toLowerCase():null}function I(e,t){if(!t.length)return``;if(t.some(e=>e.includes(`&`)))return null;let n=t.join(`,`);try{return e.matches(n),n}catch{return null}}function L(e,t){let n=e.createElement(`div`),r={};for(let e in t){let i=t[e];(e===`before`||e===`after`)&&i.push(`q`),r[e]=I(n,i)}return r}function ge(e){let t={universe:null,pseudoUniverse:null,usesHas:!0,shareGate:null,marginUnstable:!0,paddingUnstable:!0,importantProps:null,pseudoGates:{before:null,after:null,firstLetter:null,marker:null,firstLine:null}};try{let n=new Set(_e),r={before:[],after:[],firstLetter:[],marker:[],firstLine:[]},i={budget:2e4,usesHas:!1,shareUnsafeSels:/* @__PURE__ */ new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:/* @__PURE__ */ new Set,pseudoProps:/* @__PURE__ */ new Set};for(let a of e.styleSheets)if(!de(a,n,r,i))return t;let a=e.adoptedStyleSheets;if(Array.isArray(a)){for(let e of a)if(!de(e,n,r,i))return t}typeof e.getAnimations==`function`&&fe(e.getAnimations(),n);let o=Array.from(i.shareUnsafeSels),s=I(e.createElement(`div`),o)===null?null:o.map(e=>({sel:e,key:he(e)})),c=new Set(ye);for(let e of ve)n.has(e)&&c.add(e);for(let e of i.pseudoProps)c.add(e);return{universe:n,pseudoUniverse:c,pseudoGates:L(e,r),usesHas:i.usesHas,shareGate:s,marginUnstable:i.marginUnstable,paddingUnstable:i.paddingUnstable,importantProps:i.importantProps}}catch{return t}}var _e,ve,ye,be,xe,Se,Ce,we,Te=n(()=>{_e=/* @__PURE__ */ `display.position.top.right.bottom.left.float.clear.z-index.box-sizing.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.overflow-x.overflow-y.visibility.opacity.content-visibility.vertical-align.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.flex-direction.flex-wrap.flex-grow.flex-shrink.flex-basis.order.align-items.align-self.align-content.justify-content.justify-items.justify-self.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-auto-flow.grid-auto-columns.grid-auto-rows.grid-column-start.grid-column-end.grid-row-start.grid-row-end.color.font-family.font-size.font-weight.font-style.font-stretch.line-height.letter-spacing.word-spacing.white-space.text-align.text-transform.text-indent.text-overflow.text-shadow.direction.unicode-bidi.writing-mode.text-orientation.word-break.overflow-wrap.tab-size.list-style-type.list-style-position.list-style-image.counter-reset.counter-increment.counter-set.background-color.background-image.background-size.background-position.background-repeat.background-clip.background-origin.background-attachment.box-shadow.outline-width.outline-style.outline-color.outline-offset.transform.transform-origin.rotate.scale.translate.filter.mix-blend-mode.clip-path.object-fit.object-position.border-collapse.border-spacing.table-layout.caption-side.empty-cells`.split(`.`),ve=/* @__PURE__ */ `color.font-family.font-size.font-weight.font-style.font-stretch.font-variant.font-kerning.font-feature-settings.font-variation-settings.line-height.letter-spacing.word-spacing.white-space.text-align.text-align-last.text-indent.text-transform.text-shadow.text-rendering.direction.unicode-bidi.word-break.overflow-wrap.writing-mode.text-orientation.hyphens.tab-size.visibility.list-style-type.list-style-position.list-style-image.border-collapse.border-spacing.caption-side.empty-cells.quotes.color-scheme.-webkit-text-fill-color.-webkit-font-smoothing.image-rendering`.split(`.`),ye=[`display`,`width`,`height`,`min-width`,`min-height`],be=/::?(?:before|after|first-letter|first-line|marker)/,xe=/%|\bauto\b|calc\(|var\(/i,Se={before:/::?before\b/,after:/::?after\b/,firstLetter:/::?first-letter\b/,marker:/::marker\b/,firstLine:/::?first-line\b/},Ce=/::?(?:before|after|first-letter|first-line|marker)\b/g,we=/:(nth-|first-child|last-child|only-|first-of-type|last-of-type|empty|hover|focus|active|target|checked|indeterminate|disabled|enabled|read-only|read-write|placeholder-shown|autofill|valid|invalid|user-valid|user-invalid|in-range|out-of-range|required|optional|default|link|any-link|scope|defined|modal|fullscreen|picture-in-picture|playing|paused|dir\(|lang\(|has\()/});function R(e){return De.add(e),e.setAttribute(`data-snapdom-internal`,``),e}function Ee(e){return De.has(e)}var De,z=n(()=>{De=/* @__PURE__ */ new WeakSet});function Oe(e){if(e=String(e).toLowerCase(),Ve.has(e)){let t={};return s.defaultStyle.set(e,t),t}if(s.defaultStyle.has(e))return s.defaultStyle.get(e);let t=[...document.querySelectorAll(`#snapdom-sandbox`)].find(Ee);t||(t=document.createElement(`div`),R(t),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.includes(`-`)?`span`:e);n.style.all=`initial`,t.appendChild(n);let r=getComputedStyle(n),i={};for(let e of r)ke(e)||(i[e]=r.getPropertyValue(e));for(let e of _e)!(e in i)&&!ke(e)&&(i[e]=r.getPropertyValue(e));return t.removeChild(n),s.defaultStyle.set(e,i),i}function ke(e){let t=Ge.get(e);if(t===void 0){let n=String(e).toLowerCase();t=We.has(n)||Ue.test(n)||He.test(n),Ge.set(e,t)}return t}function Ae(e,t){let n=Ze.get(e);if(n===void 0||t[n]!==t[e])return!1;let r=t[`writing-mode`];if(r&&r!==`horizontal-tb`)return!1;let i=t.direction;return!(i&&i!==`ltr`)}function je(e,t){return!Je.has(e)&&(t===`inline`||Ke.has(e)||qe.has(e))}function Me(e,t,n){let r=(t.display||``).toLowerCase();if(r===`inline`||qe.has(e))return!1;if(n)return!0;if((t.float||`none`).toLowerCase()!==`none`)return!1;let i=(t.position||`static`).toLowerCase();return i===`absolute`||i===`fixed`?!1:!$e.has(r)}function Ne(e,t,n=!0,r=!1){if(t=String(t||``).toLowerCase(),Ve.has(t))return``;let i=[],a=Oe(t),o=(e.display||``).toLowerCase(),s=o===`inline`,c=je(t,o),l=e[`text-wrap-mode`]||e[`white-space`]||``,u=l===`nowrap`||l===`pre`,d=c&&n&&!(c&&n&&!s&&u),f=!1;for(let t in e){if(ke(t)||Ae(t,e))continue;let n=e[t];if(d){if(Ye.has(t))continue;if(Xe.has(t)){n&&n!==a[t]&&(i.push(`${t}:${n}`),n!==`auto`&&(f=!0));continue}}if(n&&n!==a[t]){if(!u&&(t===`width`||t===`inline-size`)&&n.endsWith(`px`)&&n.includes(`.`)){let e=parseFloat(n);if(Number.isFinite(e)){i.push(`${t}:${(e+Qe).toFixed(3)}px`);continue}}i.push(`${t}:${n}`)}}if(d&&!s&&!r&&!f){let t=e.width;t&&t!==`auto`&&t!==a.width&&i.push(`min-width:${t}`)}return i.sort(),i.join(`;`)}function Pe(e){let t=/* @__PURE__ */ 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 Fe(e,t=null){let n=/* @__PURE__ */ new Map;for(let r of e){let e=Oe(r);if(!e)continue;let i=(t?Object.entries(e).filter(([e])=>t.has(e)):Object.entries(e)).filter(([t])=>!Ae(t,e)).map(([e,t])=>`${e}:${t};`).sort(),a=i.join(``);a&&(n.has(a)||n.set(a,{tagList:[],declarations:i}),n.get(a).tagList.push(r))}let r=[...n.values()],i=null;for(let{declarations:e}of r){let t=new Set(e);if(!i){i=t;continue}for(let e of i)t.has(e)||i.delete(e)}i??=/* @__PURE__ */ new Set;let a=``;if(i.size&&r.length>1){let e=r.flatMap(e=>e.tagList);a+=`${e.join(`,`)} { ${[...i].join(``)} }
1
+ import{t as e}from"./pka-overlay-untracked-fetch-Dj1et-Fv.mjs";var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})};function i(e){return e===!1||typeof e==`string`&&e.toLowerCase().trim()===`disabled`?`disabled`:`soft`}function a(e=`soft`){e===`disabled`&&(s.computedStyle=/* @__PURE__ */ new WeakMap,s.measureHints=/* @__PURE__ */ new WeakMap,s.baseStyle=new o(50),s.defaultStyle=new o(64),s.image=new o(100),s.background=new o(100),s.resource=new o(150),s.compress=new o(50))}var o,s,c=n(()=>{o=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)}},s={image:new o(100),background:new o(100),resource:new o(150),defaultStyle:new o(64),baseStyle:new o(50),compress:new o(50),computedStyle:/* @__PURE__ */ new WeakMap,measureHints:/* @__PURE__ */ new WeakMap,warnedReconcile:!1}});function l(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith(`#`)?null:n}function u(e){let t=[],n=0,r=0,i=``;for(let a=0;a<e.length;a++){let o=e[a];if(o===`\\`){a++;continue}i?o===i&&(i=``):o===`"`||o===`'`?i=o:o===`(`?r++:o===`)`?r--:o===`,`&&r===0&&(t.push(e.slice(n,a)),n=a+1)}return t.push(e.slice(n)),t}function d(e,t=1){let n=e.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let r=[];for(let e of u(n[1])){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)continue;let n=e.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(n&&!C.test(n[1].trim()))continue;let i=e.replace(/url\((['"]?)[\s\S]*?\1\)/,` `).match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)\b/i),a=1;if(i){let e=parseFloat(i[1]);a=/dpi/i.test(i[2])?e/96:e}r.push({url:t[2].trim(),dppx:a})}return r.length?(r.sort((e,t)=>e.dppx-t.dppx),(r.find(e=>e.dppx>=t)||r[r.length-1]).url):null}function f(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 p(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function m(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}}function h(e){return!!e&&e.tagName===`INPUT`&&(e.getAttribute(`type`)||``).toLowerCase()===`password`}function g(e){return`•`.repeat(String(e??``).length)}function _(e,t){return e?.nodeType===1&&e.localName===t}function v(e){return e?.nodeType===1&&e.namespaceURI===w}function y(e){return e?.nodeType===1&&e.namespaceURI===T}function b(e){return e?.nodeType===11&&!!e.host}function x(e){return e?.nodeType===9}var S,C,w,T,E=n(()=>{S=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i,C=S,w=`http://www.w3.org/1999/xhtml`,T=`http://www.w3.org/2000/svg`});function D(e=`[snapDOM]`,{ttlMs:t=3e5,maxEntries:n=12}={}){let r=/* @__PURE__ */ 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 O(e,t,n){if(P.size>=oe){let e=Date.now();for(let[t,n]of P)n.until<=e&&P.delete(t);for(;P.size>=oe;)P.delete(P.keys().next().value)}P.set(e,{until:Date.now()+n,result:t})}function k(e){return/^data:|^blob:|^about:blank$/i.test(e)}function A(e,t){try{let n=typeof location<`u`&&location.href?location.href:`http://localhost/`,r=t.split(/\{url(?:Raw)?\}/)[0],i=new URL(r||`.`,n);if(new URL(e,n).origin===i.origin)return!0}catch{}return!1}function ee(e,t){if(!t||k(e)||A(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 j(e,t){return t?/\{url(?:Raw)?\}/.test(t)?t.replace(`{urlRaw}`,()=>p(e)).replace(`{url}`,()=>encodeURIComponent(e)):/[?&]url=?$/.test(t)?`${t}${encodeURIComponent(e)}`:t.endsWith(`?`)?`${t}url=${encodeURIComponent(e)}`:t.endsWith(`/`)?`${t}${p(e)}`:`${t}${t.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`:e}function te(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(/* @__PURE__ */ Error(`read_failed`)),r.readAsDataURL(e)})}function ne(e,t){return new Headers(t.headers||{}).keys().next().done?JSON.stringify([t.as||`blob`,t.timeout??3e3,t.useProxy||``,t.errorTTL??8e3,t.credentials||``,e]):null}function M(e){try{return new URL(e,globalThis.location?.href||`http://localhost/`).origin}catch{return`invalid-url`}}function re(e,t){try{e.onError?.(t)}catch{}}async function N(t,n={}){let r=n.as??`blob`,i=n.timeout??3e3,a=n.useProxy||``,o=n.errorTTL??8e3,s=n.headers||{},c=!!n.silent;if(/^data:/i.test(t))try{if(r===`text`)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(r===`dataURL`)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(`;`)[0]||``};let[,e=``,n=``]=String(t).match(/^data:([^,]*),(.*)$/)||[],i=/;base64/i.test(e)?atob(n):decodeURIComponent(n),a=new Uint8Array([...i].map(e=>e.charCodeAt(0))),o=new Blob([a],{type:(e||``).split(`;`)[0]||``});return{ok:!0,data:o,status:200,url:t,fromCache:!1,mime:o.type||``}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:`special_url_error`}}if(/^blob:/i.test(t))try{let n=await e(t);if(!n.ok)return{ok:!1,data:null,status:n.status,url:t,fromCache:!1,reason:`http_error`};let i=await n.blob(),a=i.type||n.headers.get(`content-type`)||``;return r===`dataURL`?{ok:!0,data:await te(i),blob:i,status:n.status,url:t,fromCache:!1,mime:a}:r===`text`?{ok:!0,data:await i.text(),status:n.status,url:t,fromCache:!1,mime:a}:{ok:!0,data:i,status:n.status,url:t,fromCache:!1,mime:a}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:`network`}}if(/^about:blank$/i.test(t))return r===`dataURL`?{ok:!0,data:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==`,status:200,url:t,fromCache:!1,mime:`image/png`}:{ok:!0,data:r===`text`?``:new Blob([]),status:200,url:t,fromCache:!1};let l;try{l=ne(t,{as:r,timeout:i,useProxy:a,errorTTL:o,credentials:n.credentials,headers:s})}catch{let e={ok:!1,data:null,status:0,url:t,fromCache:!1,reason:`network`};return re(n,e),e}let u=P.get(l);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&P.delete(l);let d=ae.get(l);if(d)return d;let f=ee(t,a)?j(t,a):t,p=n.credentials;if(!p)try{let e=typeof location<`u`&&location.href?location.href:`http://localhost/`,n=new URL(t,e);p=typeof location<`u`&&n.origin===location.origin?`include`:`omit`}catch{p=`omit`}let m=new AbortController,h=setTimeout(()=>m.abort(`timeout`),i),g=(async()=>{try{let i=await e(f,{signal:m.signal,credentials:p,headers:s});if(!i.ok){let e={ok:!1,data:null,status:i.status,url:f,fromCache:!1,reason:`http_error`};if(l!==null&&o>0&&O(l,e,o),!c){let e=`${i.status} ${i.statusText||``}`.trim();ie.warnOnce(`http:${i.status}:${r}:${M(t)}`,`HTTP ${e} fetching ${r}: ${t}`)}return re(n,e),e}if(r===`text`)return{ok:!0,data:await i.text(),status:i.status,url:f,fromCache:!1};let a=await i.blob(),u=a.type||i.headers.get(`content-type`)||``;return r===`dataURL`?{ok:!0,data:await te(a),blob:a,status:i.status,url:f,fromCache:!1,mime:u}:{ok:!0,data:a,status:i.status,url:f,fromCache:!1,mime:u}}catch(e){let a=m.signal.aborted?m.signal.reason===`timeout`?`timeout`:`abort`:e&&typeof e==`object`&&e.name===`AbortError`?`abort`:`network`,s={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:a};if(l!==null&&!/^blob:/i.test(t)&&o>0&&O(l,s,o),!c){let e=`${a}:${r}:${M(t)}`,n=a===`timeout`?`Timeout (${i}ms): ${t}. Increase timeout or use a proxy`:a===`abort`?`Aborted fetching ${r}: ${t}`:`Network/CORS fetching ${r}: ${t}. Try useProxy`;ie.errorOnce(e,n)}return re(n,s),s}finally{clearTimeout(h),ae.delete(l)}})();return l!==null&&ae.set(l,g),g}var ie,ae,oe,P,F=n(()=>{E(),ie=D(`[snapDOM]`,{ttlMs:18e4,maxEntries:10}),ae=/* @__PURE__ */ new Map,oe=50,P=/* @__PURE__ */ new Map});async function se(e,t={}){if(/^\s*url\(\s*['"]?data:/i.test(e)||/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()===`none`)return e;let n=d(e,typeof devicePixelRatio<`u`&&devicePixelRatio||1)??l(e);if(!n)return e;let r=p(m(n)),i=(t.useProxy||``)+`|`+r;if(s.background.has(i)){let e=s.background.get(i);return e?`url("${e}")`:`none`}try{let e=await N(r,{as:`dataURL`,useProxy:t.useProxy});return e.ok?(s.background.set(i,e.data),`url("${e.data}")`):(s.background.set(i,null),`none`)}catch{return s.background.set(i,null),`none`}}var ce=n(()=>{c(),E(),F()});function le(e){let t=e.replace(Ce,``).trim();return t?t.replace(/(^|,)(\s*)(?=,|$)/g,`$1$2*`):`*`}function ue(e,t,n,r){for(let i=0;i<e.length;i++){if(--r.budget<0)return!1;let a=e[i],o=a.style;if(o){let e=!!a.selectorText&&be.test(a.selectorText);for(let n=0;n<o.length;n++){let i=o[n];if(t.add(i),e&&r.pseudoProps.add(i),o.getPropertyPriority(i)&&r.importantProps.add(i),i.length>5&&(i[0]===`m`||i[0]===`p`)){let e=i.startsWith(`margin`)?`marginUnstable`:i.startsWith(`padding`)?`paddingUnstable`:null;e&&!r[e]&&xe.test(o.getPropertyValue(i))&&(r[e]=!0)}}}let s=a.selectorText;if(s&&s.includes(`:has(`)&&(r.usesHas=!0),s&&s.includes(`&`))for(let e=a.parentRule;e&&s.includes(`&`);e=e.parentRule)e.selectorText&&(s=s.replace(/&/g,`:is(${e.selectorText})`));if(s&&(r.inContainer||we.test(s)||s.includes(`+`)||s.includes(`~`)))for(let e of me(s,`,`)){let t=e.trim();t&&(r.inContainer||we.test(t)||t.includes(`+`)||t.includes(`~`))&&r.shareUnsafeSels.add(t)}if(s&&s.includes(`:`))for(let e in Se)Se[e].test(s)&&n[e].push(le(s));if(a.styleSheet){if(!de(a.styleSheet,t,n,r))return!1}else if(a.cssRules&&a.cssRules.length){let e=a.constructor?.name===`CSSContainerRule`;e&&r.inContainer++;let i=ue(a.cssRules,t,n,r);if(e&&r.inContainer--,!i)return!1}}return!0}function de(e,t,n,r){let i;try{i=e.cssRules}catch{return!1}return i?ue(i,t,n,r):!1}function fe(e,t){for(let n of e){let e=n.effect?.getKeyframes?.()||[];for(let n of e)for(let e of Object.keys(n))e===`offset`||e===`easing`||e===`composite`||e===`computedOffset`||t.add(e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()))}}function pe(e){let t=/* @__PURE__ */ new Set;return de(e,t,{before:[],after:[],firstLetter:[],marker:[],firstLine:[]},{budget:2e4,usesHas:!1,shareUnsafeSels:/* @__PURE__ */ new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:/* @__PURE__ */ new Set,pseudoProps:/* @__PURE__ */ new Set})?t:null}function me(e,t){if(!e.includes(t))return[e];let n=[],r=0,i=null,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(s===`\\`){o++;continue}if(i){s===i&&(i=null);continue}s===`"`||s===`'`?i=s:s===`(`||s===`[`?r++:s===`)`||s===`]`?r--:r===0&&s===t&&(n.push(e.slice(a,o)),a=o+1)}return n.push(e.slice(a)),n}function he(e){let t=0,n=null,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(n){a===n&&e[i-1]!==`\\`&&(n=null);continue}a===`"`||a===`'`?n=a:a===`(`||a===`[`?t++:a===`)`||a===`]`?t--:t===0&&(a===` `||a===`>`||a===`+`||a===`~`)&&(r=i+1)}let i=``,a=0;for(let t of e.slice(r))t===`(`||t===`[`?a++:t===`)`||t===`]`?a--:a===0&&(i+=t);let o=e=>!e||/\\[0-9a-fA-F]/.test(e)?null:e.replace(/\\(.)/g,`$1`),s=o((i.match(/\.((?:\\.|[\w-])+)/)||[])[1]);if(s)return`c`+s;let c=o((i.match(/#((?:\\.|[\w-])+)/)||[])[1]);if(c)return`i`+c;let l=(i.match(/^([a-zA-Z][\w-]*)/)||[])[1];return l?`t`+l.toLowerCase():null}function I(e,t){if(!t.length)return``;if(t.some(e=>e.includes(`&`)))return null;let n=t.join(`,`);try{return e.matches(n),n}catch{return null}}function L(e,t){let n=e.createElement(`div`),r={};for(let e in t){let i=t[e];(e===`before`||e===`after`)&&i.push(`q`),r[e]=I(n,i)}return r}function ge(e){let t={universe:null,pseudoUniverse:null,usesHas:!0,shareGate:null,marginUnstable:!0,paddingUnstable:!0,importantProps:null,pseudoGates:{before:null,after:null,firstLetter:null,marker:null,firstLine:null}};try{let n=new Set(_e),r={before:[],after:[],firstLetter:[],marker:[],firstLine:[]},i={budget:2e4,usesHas:!1,shareUnsafeSels:/* @__PURE__ */ new Set,inContainer:0,marginUnstable:!1,paddingUnstable:!1,importantProps:/* @__PURE__ */ new Set,pseudoProps:/* @__PURE__ */ new Set};for(let a of e.styleSheets)if(!de(a,n,r,i))return t;let a=e.adoptedStyleSheets;if(Array.isArray(a)){for(let e of a)if(!de(e,n,r,i))return t}typeof e.getAnimations==`function`&&fe(e.getAnimations(),n);let o=Array.from(i.shareUnsafeSels),s=I(e.createElement(`div`),o)===null?null:o.map(e=>({sel:e,key:he(e)})),c=new Set(ye);for(let e of ve)n.has(e)&&c.add(e);for(let e of i.pseudoProps)c.add(e);return{universe:n,pseudoUniverse:c,pseudoGates:L(e,r),usesHas:i.usesHas,shareGate:s,marginUnstable:i.marginUnstable,paddingUnstable:i.paddingUnstable,importantProps:i.importantProps}}catch{return t}}var _e,ve,ye,be,xe,Se,Ce,we,Te=n(()=>{_e=/* @__PURE__ */ `display.position.top.right.bottom.left.float.clear.z-index.box-sizing.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.overflow-x.overflow-y.visibility.opacity.content-visibility.vertical-align.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.flex-direction.flex-wrap.flex-grow.flex-shrink.flex-basis.order.align-items.align-self.align-content.justify-content.justify-items.justify-self.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-auto-flow.grid-auto-columns.grid-auto-rows.grid-column-start.grid-column-end.grid-row-start.grid-row-end.color.font-family.font-size.font-weight.font-style.font-stretch.line-height.letter-spacing.word-spacing.white-space.text-align.text-transform.text-indent.text-overflow.text-shadow.direction.unicode-bidi.writing-mode.text-orientation.word-break.overflow-wrap.tab-size.list-style-type.list-style-position.list-style-image.counter-reset.counter-increment.counter-set.background-color.background-image.background-size.background-position.background-repeat.background-clip.background-origin.background-attachment.box-shadow.outline-width.outline-style.outline-color.outline-offset.transform.transform-origin.rotate.scale.translate.filter.mix-blend-mode.clip-path.object-fit.object-position.border-collapse.border-spacing.table-layout.caption-side.empty-cells`.split(`.`),ve=/* @__PURE__ */ `color.font-family.font-size.font-weight.font-style.font-stretch.font-variant.font-kerning.font-feature-settings.font-variation-settings.line-height.letter-spacing.word-spacing.white-space.text-align.text-align-last.text-indent.text-transform.text-shadow.text-rendering.direction.unicode-bidi.word-break.overflow-wrap.writing-mode.text-orientation.hyphens.tab-size.visibility.list-style-type.list-style-position.list-style-image.border-collapse.border-spacing.caption-side.empty-cells.quotes.color-scheme.-webkit-text-fill-color.-webkit-font-smoothing.image-rendering`.split(`.`),ye=[`display`,`width`,`height`,`min-width`,`min-height`],be=/::?(?:before|after|first-letter|first-line|marker)/,xe=/%|\bauto\b|calc\(|var\(/i,Se={before:/::?before\b/,after:/::?after\b/,firstLetter:/::?first-letter\b/,marker:/::marker\b/,firstLine:/::?first-line\b/},Ce=/::?(?:before|after|first-letter|first-line|marker)\b/g,we=/:(nth-|first-child|last-child|only-|first-of-type|last-of-type|empty|hover|focus|active|target|checked|indeterminate|disabled|enabled|read-only|read-write|placeholder-shown|autofill|valid|invalid|user-valid|user-invalid|in-range|out-of-range|required|optional|default|link|any-link|scope|defined|modal|fullscreen|picture-in-picture|playing|paused|dir\(|lang\(|has\()/});function R(e){return De.add(e),e.setAttribute(`data-snapdom-internal`,``),e}function Ee(e){return De.has(e)}var De,z=n(()=>{De=/* @__PURE__ */ new WeakSet});function Oe(e){if(e=String(e).toLowerCase(),Ve.has(e)){let t={};return s.defaultStyle.set(e,t),t}if(s.defaultStyle.has(e))return s.defaultStyle.get(e);let t=[...document.querySelectorAll(`#snapdom-sandbox`)].find(Ee);t||(t=document.createElement(`div`),R(t),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.includes(`-`)?`span`:e);n.style.all=`initial`,t.appendChild(n);let r=getComputedStyle(n),i={};for(let e of r)ke(e)||(i[e]=r.getPropertyValue(e));for(let e of _e)!(e in i)&&!ke(e)&&(i[e]=r.getPropertyValue(e));return t.removeChild(n),s.defaultStyle.set(e,i),i}function ke(e){let t=Ge.get(e);if(t===void 0){let n=String(e).toLowerCase();t=We.has(n)||Ue.test(n)||He.test(n),Ge.set(e,t)}return t}function Ae(e,t){let n=Ze.get(e);if(n===void 0||t[n]!==t[e])return!1;let r=t[`writing-mode`];if(r&&r!==`horizontal-tb`)return!1;let i=t.direction;return!(i&&i!==`ltr`)}function je(e,t){return!Je.has(e)&&(t===`inline`||Ke.has(e)||qe.has(e))}function Me(e,t,n){let r=(t.display||``).toLowerCase();if(r===`inline`||qe.has(e))return!1;if(n)return!0;if((t.float||`none`).toLowerCase()!==`none`)return!1;let i=(t.position||`static`).toLowerCase();return i===`absolute`||i===`fixed`?!1:!$e.has(r)}function Ne(e,t,n=!0,r=!1){if(t=String(t||``).toLowerCase(),Ve.has(t))return``;let i=[],a=Oe(t),o=(e.display||``).toLowerCase(),s=o===`inline`,c=je(t,o),l=e[`text-wrap-mode`]||e[`white-space`]||``,u=l===`nowrap`||l===`pre`,d=c&&n&&!(c&&n&&!s&&u),f=!1;for(let t in e){if(ke(t)||Ae(t,e))continue;let n=e[t];if(d){if(Ye.has(t))continue;if(Xe.has(t)){n&&n!==a[t]&&(i.push(`${t}:${n}`),n!==`auto`&&(f=!0));continue}}if(n&&n!==a[t]){if(!u&&(t===`width`||t===`inline-size`)&&n.endsWith(`px`)&&n.includes(`.`)){let e=parseFloat(n);if(Number.isFinite(e)){i.push(`${t}:${(e+Qe).toFixed(3)}px`);continue}}i.push(`${t}:${n}`)}}if(d&&!s&&!r&&!f){let t=e.width;t&&t!==`auto`&&t!==a.width&&i.push(`min-width:${t}`)}return i.sort(),i.join(`;`)}function Pe(e){let t=/* @__PURE__ */ 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 Fe(e,t=null){let n=/* @__PURE__ */ new Map;for(let r of e){let e=Oe(r);if(!e)continue;let i=(t?Object.entries(e).filter(([e])=>t.has(e)):Object.entries(e)).filter(([t])=>!Ae(t,e)).map(([e,t])=>`${e}:${t};`).sort(),a=i.join(``);a&&(n.has(a)||n.set(a,{tagList:[],declarations:i}),n.get(a).tagList.push(r))}let r=[...n.values()],i=null;for(let{declarations:e}of r){let t=new Set(e);if(!i){i=t;continue}for(let e of i)t.has(e)||i.delete(e)}i??=/* @__PURE__ */ new Set;let a=``;if(i.size&&r.length>1){let e=r.flatMap(e=>e.tagList);a+=`${e.join(`,`)} { ${[...i].join(``)} }
2
2
  `}for(let{tagList:e,declarations:t}of r){let n=r.length>1?t.filter(e=>!i.has(e)):t;if(!n.length)continue;let o=n.join(``);a+=`${e.join(`,`)} { ${o} }
3
3
  `}return a}function Ie(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=/* @__PURE__ */ new Map,r=1;for(let e of t)n.set(e,`c${r++}`);return n}function Le(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 B(e,t=null){let n=()=>{let e={length:0,getPropertyValue:()=>``,item:()=>``};return e[Symbol.iterator]=function*(){},e};if(e?.nodeType!==1){let r=typeof window<`u`?window:null;if(r&&typeof r.getComputedStyle==`function`)try{return r.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=s.computedStyle.get(e);r||(r=/* @__PURE__ */ new Map,s.computedStyle.set(e,r));let i=r.get(t);if(!i){let a=Le(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 Re(e,t=null){let n={};for(let r of t||e){let t=e.getPropertyValue(r);t&&(n[r]=t)}for(let e of et){let t=n[`border-${e}-style`],r=n[`border-${e}-width`];(t===`none`||t===`hidden`||r===`0px`)&&(delete n[`border-${e}-style`],delete n[`border-${e}-width`],delete n[`border-${e}-color`])}return n}function ze(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 Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt=n(()=>{c(),Te(),z(),Be=/* @__PURE__ */ new Set([`meta`,`script`,`noscript`,`title`,`link`,`template`]),Ve=/* @__PURE__ */ new Set(/* @__PURE__ */ `meta.link.style.title.noscript.script.template.g.defs.use.marker.mask.clipPath.pattern.symbol.path.polygon.polyline.line.circle.ellipse.rect.filter.lineargradient.radialgradient.stop`.split(`.`)),He=/(?:^|-)(animation|transition)(?:-|$)/i,Ue=/^(--.+|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,We=/* @__PURE__ */ new Set([`cursor`,`pointer-events`,`touch-action`,`user-select`,`print-color-adjust`,`speak`,`reading-flow`,`reading-order`,`anchor-name`,`anchor-scope`,`container-name`,`container-type`,`timeline-scope`,`zoom`,`stroke-color`]),Ge=/* @__PURE__ */ new Map,Ke=/* @__PURE__ */ new Set([`span`,`small`,`em`,`strong`,`b`,`i`,`u`,`s`,`code`,`cite`,`mark`,`sub`,`sup`]),qe=/* @__PURE__ */ new Set([`table`,`thead`,`tbody`,`tfoot`,`tr`,`td`,`th`]),Je=/* @__PURE__ */ new Set([`img`,`video`,`canvas`,`svg`,`iframe`,`embed`,`object`,`input`,`textarea`,`select`]),Ye=/* @__PURE__ */ new Set([`width`,`max-width`,`inline-size`,`max-inline-size`]),Xe=/* @__PURE__ */ new Set([`min-width`,`min-inline-size`]),Ze=new Map(Object.entries({"block-size":`height`,"inline-size":`width`,"min-block-size":`min-height`,"min-inline-size":`min-width`,"max-block-size":`max-height`,"max-inline-size":`max-width`,"margin-block-start":`margin-top`,"margin-block-end":`margin-bottom`,"margin-inline-start":`margin-left`,"margin-inline-end":`margin-right`,"padding-block-start":`padding-top`,"padding-block-end":`padding-bottom`,"padding-inline-start":`padding-left`,"padding-inline-end":`padding-right`,"inset-block-start":`top`,"inset-block-end":`bottom`,"inset-inline-start":`left`,"inset-inline-end":`right`,"border-block-start-width":`border-top-width`,"border-block-start-style":`border-top-style`,"border-block-start-color":`border-top-color`,"border-block-end-width":`border-bottom-width`,"border-block-end-style":`border-bottom-style`,"border-block-end-color":`border-bottom-color`,"border-inline-start-width":`border-left-width`,"border-inline-start-style":`border-left-style`,"border-inline-start-color":`border-left-color`,"border-inline-end-width":`border-right-width`,"border-inline-end-style":`border-right-style`,"border-inline-end-color":`border-right-color`,"border-start-start-radius":`border-top-left-radius`,"border-start-end-radius":`border-top-right-radius`,"border-end-start-radius":`border-bottom-left-radius`,"border-end-end-radius":`border-bottom-right-radius`,"overflow-block":`overflow-y`,"overflow-inline":`overflow-x`,"overscroll-behavior-block":`overscroll-behavior-y`,"overscroll-behavior-inline":`overscroll-behavior-x`,"contain-intrinsic-block-size":`contain-intrinsic-height`,"contain-intrinsic-inline-size":`contain-intrinsic-width`})),Qe=.001,$e=/* @__PURE__ */ new Set([`inline-block`,`inline-flex`,`inline-grid`,`inline-table`,`inline-flow-root`,`table`]),et=[`top`,`right`,`bottom`,`left`]});function nt(e=1e3){return typeof requestAnimationFrame!=`function`||typeof document<`u`&&document.visibilityState===`hidden`?Promise.resolve():new Promise(t=>{let n=!1,r=()=>{n||(n=!0,t())};try{requestAnimationFrame(r)}catch{r();return}setTimeout(r,e)})}function rt(e){if(e!==!1&&e!==`auto`)return null;let t=performance.now()+(e===`auto`?st:ot),n=null,r={yielded:!1,due:()=>performance.now()>=t,pause:()=>n||=new Promise(e=>{let i=()=>{n=null,r.yielded=!0,t=performance.now()+ot,e()},a=new MessageChannel;a.port1.onmessage=i,a.port2.postMessage(0)})};return r}function it(){if(typeof navigator>`u`)return!1;if(navigator.userAgentData)return navigator.userAgentData.platform===`iOS`;let e=navigator.userAgent||``,t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function V(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent||``,t=e.toLowerCase(),n=t.includes(`safari`)&&!t.includes(`chrome`)&&!t.includes(`crios`)&&!t.includes(`fxios`)&&!t.includes(`android`),r=/applewebkit/i.test(e),i=/mobile/i.test(e),a=!/safari/i.test(e),o=r&&i&&a,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),l=/ipad|iphone|ipod/.test(t)&&r;return n||o||s||c||l}function at(){return typeof navigator>`u`?!1:(navigator.userAgent||``).toLowerCase().includes(`firefox`)}var ot,st,H=n(()=>{ot=16,st=40});function U(e,t,n){let r=e&&typeof e==`object`&&(e.options||e);r&&r.debug&&(n===void 0?console.warn(`[snapdom]`,t):console.warn(`[snapdom]`,t,n))}function ct(e,t,n,r){let i=e&&e.warnings;i&&i.length<lt&&i.push(r===void 0?{code:t,message:n}:{code:t,message:n,detail:r})}var lt,ut=n(()=>{lt=50}),W=n(()=>{ce(),tt(),H(),E(),ut()}),dt={};r(dt,{MAX_RASTER_AREA:()=>It,MAX_RASTER_SIDE:()=>Ft,cropSvgText:()=>pt,decodeSvgFromDataURL:()=>ht,encodeSvgToDataURL:()=>_t,fixSafariShadows:()=>Et,peekSvgHeader:()=>gt,toCanvas:()=>Pt});function ft(e,t){try{let n=e.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,Ft/i,Ft/a,Math.sqrt(It/(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 ct(t,`raster-clamp`,`capture ${Math.round(i)}x${Math.round(a)}px exceeds decode limits; downscaled to ${s}x${c}px`),console.warn(`[snapdom] Decode limit: ${Math.round(i)}\xD7${Math.round(a)} \u2192 ${s}\xD7${c}. Use ${typeof CompressionStream==`function`?`PNG Blob, `:``}SVG or crop.`),e.replace(r,r.replace(/(\bwidth=")[\d.]+/i,`$1${s}`).replace(/(\bheight=")[\d.]+/i,`$1${c}`))}catch{return e}}function pt(e,t){let n=[`x`,`y`,`width`,`height`].map(e=>Number(t?.[e]));if(!n.every(Number.isFinite)||n[2]<=0||n[3]<=0)throw RangeError(`[snapdom] canvas crop requires finite x/y and positive width/height`);let r=e.match(/<svg\b[^>]*>/i);if(!r)throw Error(`[snapdom] cannot crop a non-SVG capture`);let i=r[0],a=(i.match(/\bviewBox="([^"]+)"/i)||[])[1],o=String(a||``).trim().split(/[\s,]+/).map(Number);if(o.length!==4||!o.every(Number.isFinite)||o[2]<=0||o[3]<=0)throw Error(`[snapdom] cannot crop an SVG without a finite viewBox`);let[s,c,l,u]=o,d=Math.max(s,n[0]),f=Math.max(c,n[1]),p=Math.min(s+l,n[0]+n[2]),m=Math.min(c+u,n[1]+n[3]);if(!(p>d)||!(m>f))throw RangeError(`[snapdom] canvas crop does not intersect the SVG viewBox`);let h=parseFloat((i.match(/\bwidth="([\d.]+)/i)||[])[1]),g=parseFloat((i.match(/\bheight="([\d.]+)/i)||[])[1]),_=Number.isFinite(h)&&h>0?h/l:1,v=Number.isFinite(g)&&g>0?g/u:1,y=Math.max(1,(p-d)*_),b=Math.max(1,(m-f)*v),x=i.replace(/(\bwidth=")[^"]*/i,`$1${y}`).replace(/(\bheight=")[^"]*/i,`$1${b}`).replace(/(\bviewBox=")[^"]*/i,`$1${d} ${f} ${p-d} ${m-f}`);return e.replace(i,x)}function mt(e){return typeof e==`string`&&/^data:image\/svg\+xml/i.test(e)}function ht(e){let t=e.indexOf(`,`);return t>=0?decodeURIComponent(e.slice(t+1)):``}function gt(e){let t=e.indexOf(`,`);if(t<0)return``;let n=e.slice(t+1,t+1201).replace(/%[0-9A-Fa-f]?$/,``);try{return decodeURIComponent(n)}catch{return``}}function _t(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function vt(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 yt(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)||[];r=`${parseFloat(r)/2}px`;let 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 bt(e){let t=vt(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=yt(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 xt(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,n)=>`${t}{${bt(n)}}`)}function St(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,xt(t))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,n)=>`style=${t}${bt(n)}${t}`),e}function Ct(){return Lt||(Lt=(async()=>{try{let e=new Image;e.decoding=`sync`,e.src=`data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%2220%22%3E%3CforeignObject%20width%3D%228%22%20height%3D%2220%22%3E%3Cdiv%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%20style%3D%22width%3A4px%3Bheight%3A4px%3Bmargin-top%3A8px%3Bbackground%3A%23000%3Bbox-shadow%3A0%208px%200%200%20%23000%22%3E%3C%2Fdiv%3E%3C%2FforeignObject%3E%3C%2Fsvg%3E`,await e.decode();let t=document.createElement(`canvas`);t.width=8,t.height=20;let n=t.getContext(`2d`,{willReadFrequently:!0});n.drawImage(e,0,0);let r=n.getImageData(2,18,1,1).data[3]>128,i=n.getImageData(2,2,1,1).data[3]>128;return{native:r||i,flippedY:i&&!r}}catch{return{native:!1,flippedY:!1}}})(),Lt)}function wt(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n=Math.max(0,n-1):a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.map(e=>{let t=0,n=0,r=``,i=0;for(;i<e.length;){let a=e[i];if(a===`(`?t++:a===`)`&&(t=Math.max(0,t-1)),t===0&&(i===0||e[i-1]===` `)){let t=/^-?\d*\.?\d+px/.exec(e.slice(i));if(t){n++,r+=n===2?`${-parseFloat(t[0])}px`:t[0],i+=t[0].length;continue}}r+=a,i++}return r}).join(`,`)}function Tt(e,t){let n=e=>vt(e).map(e=>{let n=e.indexOf(`:`);if(n<0)return e;let r=e.slice(0,n).trim().toLowerCase();return r===`text-shadow`||t&&r===`box-shadow`?`${r}:${wt(e.slice(n+1))}`:e}).join(`;`);return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,t.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,r)=>`${t}{${n(r)}}`))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,r)=>`style=${t}${n(r)}${t}`),e}async function Et(e){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(e))return{svg:e,naturalOnly:!1};let{native:t,flippedY:n}=await Ct();try{let r=e;return t||(r=St(r)),n&&(r=Tt(r,t)),{svg:r,naturalOnly:!0}}catch{return{svg:e,naturalOnly:!0}}}function Dt(){let e=document.createElement(`canvas`);e.width=16,e.height=16;let t=e.getContext(`2d`,{willReadFrequently:!0});return t?e=>{t.clearRect(0,0,16,16),t.drawImage(e,0,0,16,16);let n=t.getImageData(0,0,16,16).data;for(let e=3;e<n.length;e+=4)if(n[e]>0)return!0;return!1}:null}async function Ot(e,t,n){R(e),e.style.cssText=`position:fixed;left:-99999px;top:-99999px;pointer-events:none`,document.body.appendChild(e);try{if(!n)return await Rt(),await Rt(),!1;let r=performance.now()+(t?600:150);for(;;){let t;try{t=n(e)}catch{return!1}if(t)return!0;if(performance.now()>r)return!1;await Rt()}}finally{try{e.remove()}catch{}}}function kt(e){if(typeof document>`u`||!document.body)return new Image;if(G&&!G.contentDocument){try{G.remove()}catch{}G=null}if(G&&Bt>zt&&Vt===0){try{G.remove()}catch{}G=null}if(!G){let e=document.createElement(`iframe`);R(e),e.setAttribute(`aria-hidden`,`true`),e.style.cssText=`position:absolute;left:-9999px;top:0;width:0;height:0;border:0;visibility:hidden;pointer-events:none`;try{document.body.appendChild(e)}catch{}if(e.contentDocument)G=e,Bt=0;else{try{e.remove()}catch{}return new Image}}Bt+=e.length,Vt+=1;let t=G.contentDocument.createElement(`img`);return t.__snapdomDecodeFrame=!0,t}function At(e,t=!1){!e||!e.__snapdomDecodeFrame||(e.__snapdomDecodeFrame=!1,Vt=Math.max(0,Vt-1),t&&(Ht=!0),Ht&&Vt===0&&(G?.remove(),G=null,Bt=0,Ht=!1))}function jt(e,t){return e.loading=`eager`,e.decoding=`sync`,e.crossOrigin=`anonymous`,e.src=t,e.decode()}function Mt(e){if(typeof e!=`string`)return!1;let t=e.indexOf(`,`)+1,n=Math.max(48,Math.floor((e.length-t)/200)),r=0,i=0;for(let a=t;a+48<=e.length;a+=n){let t=e.slice(a,a+48);r++,Kt.some(e=>t.includes(e))||i++}return i*2>r}function Nt(e,t,n,r,i){if(!t.naturalWidth){e.drawImage(t,0,0,n,r);return}let a=n*r,o=a>Ut&&!Mt(i)?Math.min(Gt,Math.ceil(a/Wt)):1;if(o===1){e.drawImage(t,0,0,n,r);return}let s=t.naturalWidth,c=t.naturalHeight/r;for(let i=0;i<o;i++){let a=Math.round(i*r/o),l=i===o-1?r:Math.round((i+1)*r/o);e.drawImage(t,0,a*c,s,(l-a)*c,0,a,n,l-a)}}async function Pt(e,t){let{width:n,height:r,scale:i=1,dpr:a=1,meta:o={},backgroundColor:s,crop:c=null}=t,l=typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement?e:null,u=e,d=!1,f=!1;if(c&&!mt(e))throw RangeError(`[snapdom] canvas crop requires an SVG capture payload`);if(mt(e)){let n=(gt(e).match(/<svg\b[^>]*>/i)||[])[0]||``,r=parseFloat((n.match(/\bwidth="([\d.]+)/i)||[])[1]),i=parseFloat((n.match(/\bheight="([\d.]+)/i)||[])[1]),a=Number.isFinite(r)&&Number.isFinite(i)&&r>0&&i>0&&Math.min(1,Ft/r,Ft/i,Math.sqrt(It/(r*i)))<1;if(c||a||V())try{let n=ht(e);if(c&&(n=pt(n,c)),V()){let e=await Et(n);n=e.svg,d=e.naturalOnly,f=/@font-face|data:image\//i.test(n)}(a||c)&&(n=ft(n,t.__session)),u=_t(n)}catch(t){if(c)throw t;u=e}}let p=l||kt(u);try{l||await jt(p,u)}catch(e){if(!p.__snapdomDecodeFrame)throw e;let n=p;p=kt(u),At(n);try{await jt(p,u)}catch(e){throw At(p,t.__releaseDecodeFrame),e}}try{!l&&!V()&&!at()&&mt(u)&&/(?:%40|@)font-face/i.test(u)&&await new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),t.port2.close(),e()},t.port2.postMessage(0)});let e=V()&&!l?Dt():null,m=!1;e&&(m=await Ot(p,f,e));let h=l?l.width:p.naturalWidth,g=l?l.height:p.naturalHeight,y=c?h:Number.isFinite(o.vbW)?o.vbW:Number.isFinite(o.w0)?o.w0:h,b=c?g:Number.isFinite(o.vbH)?o.vbH:Number.isFinite(o.h0)?o.h0:g,x,S,C=Number.isFinite(n),w=Number.isFinite(r);if(C&&w)x=Math.max(1,n),S=Math.max(1,r);else if(C){let e=n/Math.max(1,y);x=n,S=b*e}else if(w){let e=r/Math.max(1,b);S=r,x=y*e}else{let e=l&&Number.isFinite(o.vbW)&&Number.isFinite(o.vbH);x=e?o.vbW:h,S=e?o.vbH:g}!C&&!w&&(x*=i,S*=i);let T=x*a,E=S*a,D=Math.max(T/Ft,E/Ft,Math.sqrt(T*E/It));D>1&&(ct(t.__session,`canvas-clamp`,`output ${Math.round(T)}x${Math.round(E)}px exceeds canvas limits; downscaled`),console.warn(`[snapdom] Canvas limit: reducing ${Math.round(T)}\xD7${Math.round(E)}. Use ${typeof CompressionStream==`function`?`PNG Blob, `:``}SVG or crop.`),x/=D,S/=D);let O=v(t.canvas)&&_(t.canvas,`canvas`)?t.canvas:document.createElement(`canvas`);O.width=Math.max(1,x*a),O.height=Math.max(1,S*a),O.style.width=`${x}px`,O.style.height=`${S}px`;let k=O.getContext(`2d`);if(!k)throw Error(`[snapdom] toCanvas: the target canvas has no 2d context`);let A=()=>{if(a!==1&&k.scale(a,a),s&&(k.save(),k.fillStyle=s,k.fillRect(0,0,x,S),k.restore()),d&&(Math.round(x*a)!==h||Math.round(S*a)!==g)){let e=document.createElement(`canvas`);e.width=h,e.height=g,Nt(e.getContext(`2d`),p,h,g,u),k.drawImage(e,0,0,x,S)}else k.save(),k.setTransform(1,0,0,1,0,0),Nt(k,p,x*a,S*a,u),k.restore()};if(A(),e&&m&&f){let t=!0;try{t=e(p)}catch{}if(!t){let n=performance.now()+600;do{await Rt();try{t=e(p)}catch{break}}while(!t&&performance.now()<n);O.width=O.width,A()}}return O}finally{At(p,t.__releaseDecodeFrame)}}var Ft,It,Lt,Rt,zt,G,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt=n(()=>{H(),ut(),E(),z(),Ft=V()?16384:32767,It=268435456,Lt=null,Rt=()=>new Promise(e=>{requestAnimationFrame(e),setTimeout(e,50)}),zt=25165824,G=null,Bt=0,Vt=0,Ht=!1,Ut=4e6,Wt=2e6,Gt=8,Kt=[`%3C`,`%3E`,`%20`,`%7B`,`%7D`,`%3B`]}),Jt={};r(Jt,{rasterize:()=>Yt});async function Yt(e,t){let n=await Pt(e,t),r=n.width*n.height<=2e6?n.toDataURL(`image/${t.format}`,t.quality):await new Promise(e=>{let r=()=>e(n.toDataURL(`image/${t.format}`,t.quality));try{n.toBlob(t=>{if(!t)return r();let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.onerror=r,n.readAsDataURL(t)},`image/${t.format}`,t.quality)}catch{r()}}),i=new Image;return i.src=r,V()?await i.decode():await new Promise((e,t)=>{if(i.complete&&i.naturalWidth)return e();i.onload=e,i.onerror=t}),i.style.width=`${n.width/t.dpr}px`,i.style.height=`${n.height/t.dpr}px`,i}var Xt=n(()=>{qt(),H()}),Zt={};r(Zt,{toImg:()=>Qt,toSvg:()=>Qt});async function Qt(e,t){let{scale:n=1,width:r,height:i,meta:a={}}=t,o=Number.isFinite(r),s=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||o||s;if(V()&&c)try{let{svg:t}=await Et(ht(e)),c=(t.match(/<svg\b[^>]*>/i)||[])[0]||``,l=parseFloat((c.match(/\bwidth="([\d.]+)/i)||[])[1]),u=parseFloat((c.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(l)||!Number.isFinite(u))throw Error(`svg without dimensions`);let d=Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:l,f=Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:u,p,m;o&&s?(p=r,m=i):o?(p=r,m=Math.max(1,Math.round(r/Math.max(1,d)*f))):s?(m=i,p=Math.max(1,Math.round(i/Math.max(1,f)*d))):(p=Math.max(1,Math.round(l*n)),m=Math.max(1,Math.round(u*n)));let h=t.replace(/width="[^"]*"/,`width="${p}"`).replace(/height="[^"]*"/,`height="${m}"`),g=new Image;return g.decoding=`sync`,g.loading=`eager`,g.src=_t(h),await g.decode(),g.style.width=`${p}px`,g.style.height=`${m}px`,g}catch(n){return ct(t.__session,`safari-png-fallback`,`Safari vector toImg failed; using PNG`,n),U(t,`Safari vector toImg failed; using PNG`,n),Yt(e,{...t,format:`png`,quality:1,meta:a})}let l=e,u=!1;if(!o&&!s&&n!==1&&typeof e==`string`&&e.startsWith(`data:image/svg+xml`))try{let t=ht(e),r=(t.match(/<svg\b[^>]*>/i)||[])[0]||``,i=Number((r.match(/\bwidth="([\d.]+)"/i)||[])[1]),a=Number((r.match(/\bheight="([\d.]+)"/i)||[])[1]);if(i>0&&a>0){let e=r.replace(/\bwidth="[^"]*"/i,`width="${Math.max(1,Math.round(i*n))}"`).replace(/\bheight="[^"]*"/i,`height="${Math.max(1,Math.round(a*n))}"`);l=_t(t.replace(r,e)),u=!0}}catch{}let d=new Image;d.decoding=`sync`,d.loading=`eager`,d.src=l;try{await d.decode()}catch(t){if(!u)throw t;d.src=e,u=!1,await d.decode()}if(o&&s)d.style.width=`${r}px`,d.style.height=`${i}px`;else if(o){let e=Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:d.naturalWidth,t=Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:d.naturalHeight,n=r/Math.max(1,e);d.style.width=`${r}px`,d.style.height=`${Math.max(1,Math.round(t*n))}px`}else if(s){let e=Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:d.naturalWidth,t=Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:d.naturalHeight,n=i/Math.max(1,t);d.style.height=`${i}px`,d.style.width=`${Math.max(1,Math.round(e*n))}px`}else{let r=Math.max(1,Math.round(d.naturalWidth*(u?1:n))),i=Math.max(1,Math.round(d.naturalHeight*(u?1:n)));if(d.style.width=`${r}px`,d.style.height=`${i}px`,!u&&n!==1&&typeof e==`string`&&e.startsWith(`data:image/svg+xml`))try{let t=decodeURIComponent(e.split(`,`)[1]).replace(/width="[^"]*"/,`width="${r}"`).replace(/height="[^"]*"/,`height="${i}"`);d.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,await d.decode()}catch(n){U(t,`toImg SVG sizing failed`,n),d.src!==e&&(d.src=e,await d.decode().catch(()=>{}))}}return d}var $t=n(()=>{W(),ut(),Xt(),qt()}),en={};r(en,{encodePng:()=>nn});function tn(e,t=/* @__PURE__ */ new Uint8Array){let n=new Uint8Array(t.length+12),r=new DataView(n.buffer);r.setUint32(0,t.length);for(let t=0;t<4;t++)n[t+4]=e.charCodeAt(t);n.set(t,8);let i=4294967295;for(let e=4;e<n.length-4;e++)i=rn[(i^n[e])&255]^i>>>8;return r.setUint32(n.length-4,(i^4294967295)>>>0),n}async function nn(e,t,n){if(![e,t].every(e=>Number.isInteger(e)&&e>0&&e<=2147483647))throw RangeError(`[snapdom] PNG dimensions must be integers from 1 to 2147483647`);let r=/* @__PURE__ */ new Uint8Array(13),i=new DataView(r.buffer);i.setUint32(0,e),i.setUint32(4,t),r[8]=8,r[9]=6;let a=[new Uint8Array([137,80,78,71,13,10,26,10]),tn(`IHDR`,r),tn(`sRGB`,new Uint8Array([0]))],o=e*4,s=Math.max(1,Math.floor(65536/(o+1))),c=new Uint8Array(o),l=0,u=new CompressionStream(`deflate`),d=u.writable.getWriter(),f=u.readable.getReader(),p,m=(async()=>{try{for(;;){let{done:e,value:t}=await f.read();if(e)return;a.push(tn(`IDAT`,t))}}catch(e){p=e,await d.abort(e).catch(()=>{})}})();try{for await(let e of n){if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray)||!e.length||e.length%o)throw RangeError(`[snapdom] PNG input must contain complete RGBA rows`);let n=e.length/o;if(l+n>t)throw RangeError(`[snapdom] PNG input exceeds the declared height`);for(let t=0;t<n;t+=s){let r=Math.min(n,t+s),i=new Uint8Array((r-t)*(o+1));for(let n=t;n<r;n++){let r=e.subarray(n*o,(n+1)*o),a=(n-t)*(o+1),s=0,l=0;for(let e=0;e<o;e++){let t=r[e]-(e<4?0:r[e-4])&255,n=r[e]-c[e]&255;s+=Math.min(t,256-t),l+=Math.min(n,256-n),i[a+e+1]=n}if(i[a]=l<=s?2:1,s<l)for(let e=0;e<o;e++)i[a+e+1]=r[e]-(e<4?0:r[e-4]);c=r}await d.write(i)}c=c.slice(),l+=n}if(l!==t)throw RangeError(`[snapdom] PNG input does not match the declared height`);if(await d.close(),await m,p)throw p;return a.push(tn(`IEND`)),new Blob(a,{type:`image/png`})}catch(e){throw await Promise.allSettled([d.abort(e),f.cancel(e)]),await m,e}finally{d.releaseLock(),f.releaseLock()}}var rn,an=n(()=>{rn=/* @__PURE__ */ new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;rn[e]=t}});function on(e,t){if(typeof e!=`string`||!e.startsWith(`data:image/svg+xml`))return null;let n=gt(e).match(/<svg\b[^>]*>/i)?.[0];if(!n)return null;let r=t.crop?pt(n,t.crop):n,i=parseFloat(r.match(/\bwidth="([^"]+)/i)?.[1]),a=parseFloat(r.match(/\bheight="([^"]+)/i)?.[1]),o=(r.match(/\bviewBox="([^"]+)/i)?.[1]||``).trim().split(/[\s,]+/).map(Number);if(!(i>0&&a>0)||o.length!==4||!o.every(Number.isFinite)||!(o[2]>0&&o[3]>0))return null;let s=Number.isFinite(t.width),c=Number.isFinite(t.height),l=t.meta||{},u=Math.max(1,Math.floor(i)),d=Math.max(1,Math.floor(a)),f=t.crop?u:Number.isFinite(l.vbW)?l.vbW:Number.isFinite(l.w0)?l.w0:u,p=t.crop?d:Number.isFinite(l.vbH)?l.vbH:Number.isFinite(l.h0)?l.h0:d,m=t.dpr??1,h=t.scale??1,g=(s&&c?Math.max(1,t.width):s?t.width:c?t.height*f/Math.max(1,p):u*h)*m,_=(s&&c?Math.max(1,t.height):c?t.height:s?t.width*p/Math.max(1,f):d*h)*m;return Math.max(i,a,g,_)<=Ft&&i*a<=It&&g*_<=It||typeof CompressionStream!=`function`?null:v();async function v(){let{encodePng:s}=await Promise.resolve().then(()=>(an(),en)),c=Math.max(1,Math.floor(g)),l=Math.max(1,Math.floor(_)),f=ht(e),p=f.slice(f.indexOf(n)+n.length,f.lastIndexOf(`</svg>`)),m=r.match(/\bpreserveAspectRatio="([^"]*)"/i)?.[1]||`xMidYMid meet`,h=i/o[2],v=a/o[3],y=0,b=0;/\bnone\b/.test(m)||(h=v=/\bslice\b/.test(m)?Math.max(h,v):Math.min(h,v),y=(i-o[2]*h)*(/xMin/.test(m)?0:/xMax/.test(m)?1:.5),b=(a-o[3]*v)*(/YMin/.test(m)?0:/YMax/.test(m)?1:.5)),y-=o[0]*h,b-=o[1]*v;let x=r.replace(/\s(?:width|height|preserveAspectRatio)="[^"]*"/gi,``).slice(0,-1),S=V()&&/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(f),C=i/g,w=a/_,T=Math.max(1,Math.min(8192,Math.floor(4194304/c),S?Math.floor(2046/w):8192)),E=Math.max(1,Math.min(8192,c,S?Math.floor(2046/C):8192));async function*D(){for(let e=0;e<l;e+=T){let n=Math.min(T,l-e),r=new Uint8Array(c*n*4);for(let i=0;i<c;i+=E){let a=Math.min(E,c-i),s=S?Math.max(0,Math.floor(i*C)-1):i*C,l=S?Math.max(0,Math.floor(e*w)-1):e*w,f=S?Math.min(u,Math.ceil((i+a)*C)+1)-s:a,m=S?Math.min(d,Math.ceil((e+n)*w)+1)-l:n,g=f/o[2],_=m/o[3],T=S?1:1/C,D=S?1:1/w,O=`matrix(${h*T/g},0,0,${v*D/_},${(y-s)*T/g+o[0]},${(b-l)*D/_+o[1]})`,k=await Pt(_t(`${x} width="${f}" height="${m}" preserveAspectRatio="none"><g style="all:unset!important;transform:${O}!important;transform-origin:0 0!important">${p}</g></svg>`),{width:f,height:m,dpr:1,backgroundColor:S?null:t.backgroundColor,__session:t.__session,__releaseDecodeFrame:!0}),A=k;try{if(S){A=document.createElement(`canvas`),A.width=a,A.height=n;let r=A.getContext(`2d`);t.backgroundColor&&(r.fillStyle=t.backgroundColor,r.fillRect(0,0,a,n)),r.drawImage(k,i*C-s,e*w-l,a*C,n*w,0,0,a,n)}let o=A.getContext(`2d`).getImageData(0,0,a,n).data;for(let e=0;e<n;e++)r.set(o.subarray(e*a*4,(e+1)*a*4),(e*c+i)*4)}finally{k.width=k.height=0,A!==k&&(A.width=A.height=0)}}yield r}}return s(c,l,D())}}var sn=n(()=>{qt(),H()}),cn={};r(cn,{toBlob:()=>ln});async function ln(e,t){let n=t.format||t.type||`svg`;if(n===`svg`){if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement)throw Error(`[snapdom] toBlob: engine:'html-in-canvas' produces a raster capture; ask for png/jpeg/webp`);let t=decodeURIComponent(e.split(`,`)[1]);return new Blob([t],{type:`image/svg+xml`})}let r=n===`png`&&on(e,t);if(r)return r;let i=await Pt(e,t);return new Promise(e=>i.toBlob(t=>e(t),`image/${n===`jpg`?`jpeg`:n}`,t.quality))}var un=n(()=>{qt(),sn()}),dn={};r(dn,{download:()=>pn});async function fn(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 pn(e,t){let n=/* @__PURE__ */ 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`,c=/\.(png|jpe?g|webp|svg)$/i.test(s)?s:`${s}.${o}`,l={...t||{},format:o,type:o};l.dpr=1;let u=it(),d=o===`png`&&on(e,l);if(o===`svg`||d){let t=d?await d:await ln(e,{...l,type:`svg`});if(u&&await fn(t,c))return;let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=c,document.body.appendChild(r),r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3),r.remove();return}let f=await Pt(e,l);if(u){let e=`image/${o}`,n=await new Promise(n=>f.toBlob(n,e,t?.quality));if(n&&await fn(n,c))return}let p=document.createElement(`a`);p.href=f.toDataURL(`image/${o}`,t?.quality),p.download=c,document.body.appendChild(p),p.click(),p.remove()}var mn=n(()=>{un(),qt(),sn(),H()});W(),W(),H(),c(),Te(),z();var hn=/* @__PURE__ */ new WeakMap,gn=[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`,`margin-block-start`,`margin-block-end`,`margin-inline-start`,`margin-inline-end`],_n=/* @__PURE__ */ new Map,vn=2e3,yn=0;function K(){yn++}function bn(e){let t=e&&(e.nodeType===1?e:e.parentElement);for(;t;){if(Ee(t))return!0;if(t.parentElement)t=t.parentElement;else{let e=t.getRootNode?.();t=e&&e.host?e.host:null}}return!1}function xn(e){for(let t of e)if(Sn(t))return!0;return!1}function Sn(e){if(bn(e.target))return!1;if(e.type===`childList`){let t=!0;for(let n of e.addedNodes)if(!bn(n)){t=!1;break}if(t){for(let n of e.removedNodes)if(!bn(n)){t=!1;break}}if(t)return!1}return!0}var Cn=/* @__PURE__ */ new WeakMap;function wn(e){for(let t of e){if(!Sn(t))continue;let e=t.target.ownerDocument||document;Cn.set(e,(Cn.get(e)||0)+1);let n=t.target.nodeType===1?t.target:t.target.parentElement||t.target.host;for(;n;n=n.parentElement||n.getRootNode?.()?.host)Cn.set(n,(Cn.get(n)||0)+1)}}function Tn(e){let t=e.ownerDocument||document;return Yn(t),(Cn.get(t)||0)-(Cn.get(e)||0)}var q=0;function En(e=document){return Yn(e),q}function Dn(){return Yn(),yn}function On(e){return e?(Yn(e.ownerDocument||document),In(e,Ln(e))):0}function kn(){K(),q++}var An=/* @__PURE__ */ new WeakMap,jn=0,Mn=0;function Nn(e){An.set(e,++jn)}function Pn(e){if(!e||e.nodeType!==1)return;jn++,An.set(e,jn);let t=e.querySelectorAll(`*`);for(let e=0;e<t.length;e++)An.set(t[e],jn)}function Fn(e){Pn(e.parentElement||e);for(let t=e.parentElement;t;t=t.parentElement)Nn(t)}function In(e,t=null){let n=An.get(e)||0;if(t)for(let e of t)n=Math.max(n,An.get(e)||0);return Mn*1e9+n}function Ln(e){let t=e.getRootNode?.();if(!t?.host)return null;let n=[];for(;t?.host;)t.mode===`open`&&Wn(t),n.push(t.host),t=t.host.getRootNode?.();return n}var Rn=/* @__PURE__ */ new WeakMap;function zn(e){e||=document;let t=Rn.get(e);if(!t||t.env!==q){let n=!0;try{n=ar(e).usesHas}catch{}t={env:q,usesHas:n},Rn.set(e,t)}return!t.usesHas}function Bn(e){let t=e=>e?.nodeType===1&&(e.matches?.(`style,link`)||e.querySelector?.(`style,link`));for(let n of e){let e=n.target,r=e&&(e.nodeType===1?e:e.parentElement);if(r&&(r.tagName===`STYLE`||r.tagName===`LINK`))return r.ownerDocument||document;for(let e of n.addedNodes)if(t(e))return e.ownerDocument||document;for(let r of n.removedNodes)if(t(r))return r.ownerDocument||e&&e.ownerDocument||document}return null}var Vn=/* @__PURE__ */ new WeakSet,Hn=[];function Un(e){if(!xn(e))return;wn(e),K();let t=/* @__PURE__ */ new Set;for(let n of e){if(!Sn(n))continue;let e=n.target.getRootNode&&n.target.getRootNode();if(!e||e.nodeType!==11||t.has(e))continue;t.add(e),e.host?Pn(e.host):jn++;let r=e.querySelectorAll(`*`);for(let e=0;e<r.length;e++)An.set(r[e],jn)}}function Wn(e){if(e&&!Vn.has(e)){Vn.add(e);try{let t=new MutationObserver(Un);t.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),Hn.push({o:t,root:e})}catch{}}}function Gn(e){if(!xn(e))return;wn(e),K();let t=Bn(e);if(t){Rn.delete(t),q++,Mn++;return}let n=/* @__PURE__ */ new Set;for(let t of e){if(!Sn(t))continue;let e=t.target.nodeType===1?t.target:t.target.parentElement;if(!e)continue;let r=e.ownerDocument||document;if(!zn(r)){Mn++;return}if(e===r.documentElement||e===r.body){Mn++;return}let i=e.parentElement||e;n.has(i)||(n.add(i),Fn(e))}}var Kn=/* @__PURE__ */ new WeakSet,qn=null,Jn=[];function Yn(e=document){if(e===qn||!e||e.nodeType!==9)return;if(Kn.has(e)){qn=e;return}Kn.add(e),qn=e;let t=e.defaultView,n=e=>{xn(e)&&(K(),q++)},r=()=>{K(),q++};try{let t=new MutationObserver(Gn);t.observe(e.documentElement,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),Jn.push({o:t,env:!1,doc:e})}catch{}try{let t=new MutationObserver(n);t.observe(e.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),Jn.push({o:t,env:!0,doc:e})}catch{}try{t?.addEventListener(`resize`,r,{passive:!0})}catch{}try{let n=t=>{K();let n=t.composedPath?.()[0]||t.target;n&&n.nodeType===1&&!bn(n)&&zn(n.ownerDocument||e)?Fn(n):Mn++};e.addEventListener(`focusin`,n,{capture:!0,passive:!0}),e.addEventListener(`focusout`,n,{capture:!0,passive:!0}),e.addEventListener(`change`,n,{capture:!0,passive:!0}),e.addEventListener(`pointerdown`,n,{capture:!0,passive:!0}),e.addEventListener(`pointerup`,n,{capture:!0,passive:!0}),e.addEventListener(`pointercancel`,n,{capture:!0,passive:!0}),e.addEventListener(`keydown`,n,{capture:!0,passive:!0}),e.addEventListener(`keyup`,n,{capture:!0,passive:!0}),e.addEventListener(`beforetoggle`,n,{capture:!0,passive:!0}),e.addEventListener(`toggle`,n,{capture:!0,passive:!0}),t?.addEventListener(`hashchange`,()=>{K(),Mn++},{passive:!0})}catch{}try{let t=e.fonts;t&&(t.addEventListener?.(`loadingdone`,r),t.status===`loading`&&t.ready?.then(r).catch(()=>{}))}catch{}}var Xn=/* @__PURE__ */ new WeakMap;function Zn(e,t){if(!e?.querySelectorAll)return;let n;try{n=Array.from(e.querySelectorAll(`:hover`))}catch{return}let r=Xn.get(e)||[];if(r.length===n.length&&r.every((e,t)=>e===n[t]))return;if(Xn.set(e,n),K(),e.nodeType===11){e.host?Pn(e.host):jn++;for(let t of e.querySelectorAll(`*`))An.set(t,jn);return}let i=r.filter(e=>!n.includes(e)).concat(n.filter(e=>!r.includes(e)));for(let e of i)if(e.isConnected){if(zn(t))Fn(e);else{Mn++;return}}}function Qn(e,t=null){if(!e)return;Zn(e,e);let n=t||Hn.filter(({root:e})=>e.host?.isConnected).map(({root:e})=>e);for(let t of n)Zn(t,e)}function $n(){Yn();try{for(let e=Jn.length-1;e>=0;e--){let{o:t,env:n,doc:r}=Jn[e];if(r!==document&&!r.defaultView){try{t.disconnect()}catch{}Kn.delete(r),qn===r&&(qn=null),Jn.splice(e,1);continue}let i=t.takeRecords();i.length&&(n?xn(i)&&(K(),q++):Gn(i))}for(let e=Hn.length-1;e>=0;e--){let{o:t,root:n}=Hn[e];if(!n.host||!n.host.isConnected){try{t.disconnect()}catch{}Vn.delete(n),Hn.splice(e,1);continue}let r=t.takeRecords();r.length&&Un(r)}}catch{}}function er(e){if(e&&e.nodeType===1){hn.delete(e);try{let t=(e.ownerDocument||document).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();)hn.delete(t.currentNode)}catch{}}}var tr=[`mask`,`mask-image`,`-webkit-mask`,`-webkit-mask-image`,`mask-source`,`mask-box-image-source`,`mask-border-source`,`-webkit-mask-box-image-source`,`border-image`,`border-image-source`];function nr(e){let t=hn.get(e);if(t&&Er(t,e)){let e=t.snapshot&&t.snapshot.__needsBgInline;if(e!==void 0)return e}return!0}function rr(e){let t=hn.get(e);if(!t||!Er(t,e))return null;let n=t.snapshot;return!n||n.__bgClipTextFix?null:n}var ir=/* @__PURE__ */ new WeakMap;function ar(e){let t=ir.get(e);if(!t||t.epoch!==yn){let n=t&&t.universe;t={epoch:yn,...ge(e)};let r=t.universe;if(n&&r&&n.size===r.size){let e=!0;for(let t of r)if(!n.has(t)){e=!1;break}e&&(t.universe=n)}ir.set(e,t)}return t}function or(e){try{let t=ar(e.ownerDocument||document).shareGate;if(t===null)return!1;if(!t.length)return!0;let n=/* @__PURE__ */ new Set,r=e=>{n.add(`t`+e.localName),e.id&&n.add(`i`+e.id);let t=e.classList;for(let e=0;e<t.length;e++)n.add(`c`+t[e])};r(e);for(let t of e.querySelectorAll(`*`))r(t);let i=[];for(let{sel:e,key:r}of t)(r===null||n.has(r))&&i.push(e);if(!i.length)return!0;let a=i.join(`,`);return!e.matches(a)&&e.querySelector(a)===null}catch{return!1}}function sr(e){let t=e.ownerDocument||document;return e.getRootNode&&e.getRootNode()!==t?null:ar(t).importantProps}function cr(e,t){let n=e.ownerDocument||document,r=e.getRootNode?e.getRootNode():n;return r===n?ar(n).universe:t&&b(r)?ur(e,r,n,t):null}var lr=/* @__PURE__ */ new WeakMap;function ur(e,t,n,r){let i=r.__shadowUniverse;if(i===null)return null;if(!i){let e=ar(n).universe;if(!e)return r.__shadowUniverse=null;i=r.__shadowUniverse={universe:new Set(e),roots:/* @__PURE__ */ new Set}}let a=e=>{for(;b(e)&&!i.roots.has(e);e=e.host.getRootNode()){i.roots.add(e);for(let t of[...e.styleSheets,...e.adoptedStyleSheets||[]]){let e=lr.get(t);if((!e||e.epoch!==yn)&&lr.set(t,e={epoch:yn,props:pe(t)}),!e.props)return!1;for(let t of e.props)i.universe.add(t)}fe(e.getAnimations(),i.universe)}return!0},o=a(t)&&(!e.shadowRoot||a(e.shadowRoot));for(let t=e.assignedSlot;o&&t;t=t.assignedSlot)o=a(t.getRootNode());return o?i.universe:r.__shadowUniverse=null}function dr(e){let t=e.ownerDocument||document;return e.getRootNode&&e.getRootNode()!==t?null:ar(t).pseudoUniverse}var fr={before:null,after:null,firstLetter:null,marker:null,firstLine:null};function pr(e){let t=e.ownerDocument||document;return e.getRootNode&&e.getRootNode()!==t?fr:ar(t).pseudoGates}function mr(e,t={},n=null,r=null){let i={},a=t.excludeStyleProps,o=t=>{if(i[t]!==void 0||ke(t)||a&&(a instanceof RegExp&&a.test(t)||typeof a==`function`&&a(t)))return;let n=e.getPropertyValue(t);n&&((t===`background-image`||t===`content`)&&n.includes(`url(`)&&!n.includes(`data:`)&&(n=`none`),i[t]=n)};if(r){for(let e of r)o(e);let e=n&&n.style;if(e&&e.length)for(let t=0;t<e.length;t++)o(e[t])}else for(let t=0;t<e.length;t++)o(e[t]);for(let t of[`text-decoration-line`,`text-decoration-color`,`text-decoration-style`,`text-decoration-thickness`,`text-underline-offset`,`text-decoration-skip-ink`])if(!i[t])try{let n=e.getPropertyValue(t);n&&(i[t]=n)}catch{}for(let t of[`-webkit-text-stroke`,`-webkit-text-stroke-width`,`-webkit-text-stroke-color`,`paint-order`])if(!i[t])try{let n=e.getPropertyValue(t);n&&(i[t]=n)}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(!i[t])try{let n=e.getPropertyValue(t);n&&(i[t]=n)}catch{}}try{(i[`content-visibility`]||e.getPropertyValue(`content-visibility`))===`hidden`&&(i[`content-visibility`]=`hidden`)}catch{}Object.defineProperty(i,"__needsBgInline",{value:_r(e),enumerable:!1});let s=parseFloat(e.getPropertyValue(`border-top-width`)||0)||0,c=parseFloat(e.getPropertyValue(`border-right-width`)||0)||0,l=parseFloat(e.getPropertyValue(`border-bottom-width`)||0)||0,u=parseFloat(e.getPropertyValue(`border-left-width`)||0)||0;if(s===0&&c===0&&l===0&&u===0){let t=(e.getPropertyValue(`border-image-source`)||``).trim(),n=t&&t!==`none`;for(let e of/* @__PURE__ */ `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.border-block-start.border-block-start-width.border-block-start-style.border-block-start-color.border-block-end.border-block-end-width.border-block-end-style.border-block-end-color.border-inline-start.border-inline-start-width.border-inline-start-style.border-inline-start-color.border-inline-end.border-inline-end-width.border-inline-end-style.border-inline-end-color`.split(`.`))delete i[e];n||(i.border=`none`)}return hr(i),i}function hr(e){if(!at())return;let t=e[`background-clip`]||e[`-webkit-background-clip`];if(!t||!t.includes(`text`))return;let n=e=>e===`transparent`||e===`rgba(0, 0, 0, 0)`,r=e[`-webkit-text-fill-color`];if(!n(r===void 0?e.color:r))return;let i=gr(e[`background-image`],e[`background-color`]);i&&(n(e.color)&&(e.color=i),r!==void 0&&(e[`-webkit-text-fill-color`]=i),e[`background-image`]=`none`,e[`background-color`]=`transparent`,delete e[`background-clip`],delete e[`-webkit-background-clip`],Object.defineProperty(e,"__bgClipTextFix",{value:i,enumerable:!1}))}function gr(e,t){let n=e=>{let t=[],n=/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s/]+([\d.]+%?))?\s*\)/g,r;for(;r=n.exec(e||``);){let e=r[4];(e===void 0?1:parseFloat(e)/(e.endsWith(`%`)?100:1))>.05&&t.push([+r[1],+r[2],+r[3]])}return t},r=n(e);if(r.length||(r=n(t)),!r.length)return null;let i=[0,0,0];for(let[e,t,n]of r)i[0]+=e,i[1]+=t,i[2]+=n;return`rgb(${i.map(e=>Math.round(e/r.length)).join(`, `)})`}function _r(e){let t=e.getPropertyValue(`background-image`);if(t&&t!==`none`)return!0;let n=e.getPropertyValue(`background-color`);if(n&&n!==`rgba(0, 0, 0, 0)`&&n!==`transparent`)return!0;for(let t of tr){let n=e.getPropertyValue(t);if(n&&n!==`none`)return!0}let r=e.getPropertyValue(`background`);return!!(r&&/url\s*\(/i.test(r))}function vr(e){for(let t=e.firstChild;t;t=t.nextSibling){if(t.nodeType===3&&/\S/.test(t.nodeValue||``))return!0;if(t.nodeType===1){let e=B(t).position;if(e!==`absolute`&&e!==`fixed`)return!0}}return!1}function yr(e,t,n){try{if(typeof e.computedStyleMap==`function`){let t=e.computedStyleMap().get(`width`);if(t!=null)return!xr(String(t).trim().toLowerCase())}}catch{}let r=e.style&&(e.style.width||e.style.inlineSize);return r&&!xr(String(r).trim().toLowerCase())?!0:Sr(e,t)?n||Cr(e,t):!1}var br=/* @__PURE__ */ new Set([`auto`,`min-content`,`max-content`,`stretch`,`fill-available`,`-webkit-fill-available`]);function xr(e){return br.has(e)||e.startsWith(`fit-content`)}function Sr(e,t){let n=e.getBoundingClientRect().width-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)-(parseFloat(t.borderLeftWidth)||0)-(parseFloat(t.borderRightWidth)||0);if(!(n>0))return!1;let r=1/0,i=-1/0,a=null;for(let t=e.firstChild;t;t=t.nextSibling){let e;if(t.nodeType===3){if(!/\S/.test(t.nodeValue||``)||(a||=document.createRange(),a.selectNode(t),e=a.getBoundingClientRect(),!e.width&&!e.height))continue}else if(t.nodeType===1){let n=B(t);if(n.display===`none`||n.position===`absolute`||n.position===`fixed`)continue;e=t.getBoundingClientRect()}else continue;e.left<r&&(r=e.left),e.right>i&&(i=e.right)}return i!==-1/0&&i-r<n-.5}function Cr(e,t){let n=e.parentElement;if(!n)return!1;let r=B(n),i=n.getBoundingClientRect().width-(parseFloat(r.paddingLeft)||0)-(parseFloat(r.paddingRight)||0)-(parseFloat(r.borderLeftWidth)||0)-(parseFloat(r.borderRightWidth)||0)-(parseFloat(t.marginLeft)||0)-(parseFloat(t.marginRight)||0);return i>0&&Math.abs(e.getBoundingClientRect().width-i)>.5}var wr=/* @__PURE__ */ new WeakMap;function Tr(e,t){let n=wr.get(e);if(n)return n;let r=[t];for(let t in e)r.push(t,e[t]);return n=r.join(``),wr.set(e,n),n}function Er(e,t){return e.env===q&&e.stamp===In(t,e.hosts)}var Dr=/^(width|height|inline-size|block-size|top|right|bottom|left|transform-origin|perspective-origin)$|^inset-/,Or=/(margin|padding)[a-z-]*\s*:[^;]*(%|\bauto\b|calc\(|var\()/i,kr=/* @__PURE__ */ new Set([`INPUT`,`TEXTAREA`,`SELECT`,`OPTION`,`OPTGROUP`,`PROGRESS`,`METER`,`BUTTON`,`DATALIST`]);function Ar(e){let t=e.__styleShare;return t||=e.__styleShare={ids:/* @__PURE__ */ new WeakMap,intern:/* @__PURE__ */ new Map,snaps:/* @__PURE__ */ new Map,rootSeen:!1},t}function jr(e,t){let n=t.ids.get(e);if(n!==void 0)return n;let r=e.parentElement,i;if(!r)i=`R`;else if(i=t.ids.get(r),i===void 0){if(t.rootSeen)return t.ids.set(e,-1),-1;i=`R`}if(t.rootSeen=!0,i===-1)return t.ids.set(e,-1),-1;let a=``,o=e.attributes;if(o&&o.length){if(o.length===1)a=o[0].name+`=`+o[0].value;else{let e=[];for(let t=0;t<o.length;t++)e.push(o[t].name+`=`+o[t].value);e.sort(),a=e.join(``)}}let s=i+`|`+e.tagName+`|`+a;return n=t.intern.get(s),n===void 0&&(n=t.intern.size,t.intern.set(s,n)),t.ids.set(e,n),n}function Mr(e,t){let n=e.snap,r=e.snap={...n};Object.defineProperty(r,"__needsBgInline",{value:n.__needsBgInline,enumerable:!1}),n.__bgClipTextFix!==void 0&&Object.defineProperty(r,"__bgClipTextFix",{value:n.__bgClipTextFix,enumerable:!1});let i=ar(t.ownerDocument||document),a=t.getAttribute&&t.getAttribute(`style`)||``,o=a&&Or.test(a),s=!!i.marginUnstable||o&&/margin/i.test(a),c=!!i.paddingUnstable||o&&/padding/i.test(a),l=r.display!==void 0&&r.display.includes(`grid`),u=r.transform!==void 0&&r.transform!==`none`,d=[];for(let e in r)(Dr.test(e)||l&&(e===`grid-template-columns`||e===`grid-template-rows`)||u&&e===`transform`||s&&e.charCodeAt(0)===109&&e.startsWith(`margin-`)||c&&e.charCodeAt(0)===112&&e.startsWith(`padding-`))&&d.push(e);e.h&&!(`height`in r)&&d.push(`height`),e.b&&!(`block-size`in r)&&d.push(`block-size`);let f=new Set(d),p=[t.tagName.toLowerCase()];for(let e in r)f.has(e)||p.push(e,r[e]);return e.rr=d,e.sig=p.join(``)+``+d.join(``),d}function Nr(e,t,n,r,i){let a=i&&i.__styleShare?r&&r.__styleShare:null,o=a?a.ids.get(e):void 0;if(o===void 0||o===-1||e.shadowRoot||e.assignedSlot)return Re(n,dr(e));let s=o+t,c=a.pseudo||=/* @__PURE__ */ new Map,l=c.get(s);if(l){let t={...l.snap},r=l.rr||Mr(l,e);for(let e=0;e<r.length;e++){let i=n.getPropertyValue(r[e]);i?t[r[e]]=i:delete t[r[e]]}return t}let u=Re(n,dr(e));return c.set(s,{snap:u,rr:null,sig:null,h:`height`in u,b:`block-size`in u}),u}function Pr(e,t=null,n={},r=null,i=null){let a=hn.get(e),o=!!(n&&n.embedFonts),s=n&&n.excludeStyleProps||null;if(typeof s!=`function`&&a&&Er(a,e)&&a.embedFonts===o&&a.excludeStyleProps===s)return a.snapshot;let c=t||getComputedStyle(e),l,u=null,d=r&&r.st.snaps.get(r.id);if(d){l={...d.snap};let t=d.rr||Mr(d,e);u=[];for(let e=0;e<t.length;e++){let n=t[e],r=c.getPropertyValue(n);r?l[n]=r:delete l[n],u.push(r)}Object.defineProperty(l,"__needsBgInline",{value:d.snap.__needsBgInline,enumerable:!1}),d.snap.__bgClipTextFix!==void 0&&Object.defineProperty(l,"__bgClipTextFix",{value:d.snap.__bgClipTextFix,enumerable:!1})}else l=mr(c,n,e,cr(e,i)),r&&r.st.snaps.set(r.id,{snap:l,rr:null,sig:null,h:`height`in l,b:`block-size`in l});let f=!1;if(typeof e.computedStyleMap==`function`){let t;for(let n of gn)if(l[n]===`0px`)try{t||=e.computedStyleMap(),t.get(n)?.toString()===`auto`&&(l[n]=`auto`,f=!0)}catch{}}Xr(e,c,l);let p=Hr(e,c,l);u!==null&&(f&&u.push(``,...gn.map(e=>l[e])),p&&u.push(``+p),wr.set(l,d.sig+``+u.join(``)+(`height`in l?``:``)+(`block-size`in l?``:``)));let m=Ln(e);return hn.set(e,{env:q,stamp:In(e,m),hosts:m,snapshot:l,embedFonts:o,excludeStyleProps:s}),l}function Fr(e,t){if(e&&e.session&&e.persist)return e;if(e&&(e.styleMap||e.styleCache||e.nodeMap)){let n=e.__ctx;return(!n||e.__ctxOpts!==t)&&(n={session:e,persist:{snapshotKeyCache:_n,defaultStyle:s.defaultStyle,baseStyle:s.baseStyle,image:s.image,resource:s.resource,background:s.background},options:t||{}},e.__ctx=n,e.__ctxOpts=t),n}return{session:{styleMap:/* @__PURE__ */ new Map,styleCache:/* @__PURE__ */ new WeakMap,nodeMap:/* @__PURE__ */ new Map},persist:{snapshotKeyCache:_n,defaultStyle:s.defaultStyle,baseStyle:s.baseStyle,image:s.image,resource:s.resource,background:s.background},options:e||t||{}}}var Ir=/%|[\d.](?:em|rem|ex|ch|cap|ic|lh|rlh|v[whib]|vmin|vmax|cq[whbi]|cqmin|cqmax)\b|\b(?:calc|var|min|max|clamp|env|attr)\(|\b(?:auto|inherit|initial|unset|revert|currentcolor|-webkit-fill-available|fit-content|min-content|max-content)\b/i,Lr=e=>e.tagName===`INPUT`||e.tagName===`TEXTAREA`;function Rr(e,t,n){if(!e.style||e.style.length===0)return;let r=sr(e),i=r!=null&&!Ir.test(e.getAttribute(`style`)||``);for(let a=0;a<e.style.length;a++){let o=e.style[a];if(i&&!r.has(o)&&!(o.startsWith(`background`)&&Lr(e)))continue;let s=n.getPropertyValue(o);s&&t.style.setProperty(o,s,e.style.getPropertyPriority(o))}}function J(e,t,n,r){if(e.tagName===`STYLE`)return;let i=Fr(n,r),a=i.options&&i.options.cache||`soft`;a!==`disabled`&&Yn(e.ownerDocument),a===`disabled`&&!i.session.__bumpedForDisabled&&(K(),_n.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((e.ownerDocument||document).documentElement))}let c=o.styleCache.get(e);e.getAttribute?.(`style`)&&Rr(e,t,c);let l=c.getPropertyValue(`animation-name`);t&&t.style&&l&&l!==`none`&&t.style.setProperty(`animation`,`none`,`important`);let u=e.tagName?.toLowerCase()||`div`;if(Ve.has(u)){let n={};Object.defineProperty(n,"__needsBgInline",{value:_r(c),enumerable:!1});let r=Ln(e);hn.set(e,{env:q,stamp:In(e,r),hosts:r,snapshot:n,embedFonts:!!(i.options&&i.options.embedFonts),excludeStyleProps:i.options&&i.options.excludeStyleProps||null}),o.styleMap.set(t,``);return}let d=null;if(i.options&&i.options.__styleShare&&o.styleMap){let t=Ar(o),n=jr(e,t),r=e.ownerDocument||document,i=r.activeElement;n!==-1&&!kr.has(e.tagName)&&!(i&&i!==r.body&&i!==r.documentElement&&i===e)&&(!e.getRootNode||e.getRootNode()===r)&&!e.shadowRoot&&!e.assignedSlot&&(d={st:t,id:n})}let f=Pr(e,c,i.options,d,o);if(e.getAttribute?.(`style`))for(let e of[`top`,`right`,`bottom`,`left`]){let n=`margin-${e}`;f[n]===`auto`&&t.style.setProperty(n,`auto`,`important`)}f.__bgClipTextFix&&t&&t.style&&(t.style.setProperty(`background-image`,`none`,`important`),t.style.setProperty(`background-color`,`transparent`,`important`),t.style.setProperty(`color`,f.__bgClipTextFix,`important`),t.style.setProperty(`-webkit-text-fill-color`,f.__bgClipTextFix,`important`)),zr(e,c,f),t.style?.length&&f[`box-sizing`]===`border-box`&&c.getPropertyValue(`box-sizing`)!==`border-box`&&Gr(e,t,f);let p=qr(e);if(p){let e=c.getPropertyValue(`min-width`);(!e||e===`auto`||e===`0px`)&&(f[`min-width`]=`0px`)}let m=Tr(f,u),h=!0;if(je(u,(f.display||``).toLowerCase())){h=vr(e),h&&Me(u,f,p)&&yr(e,c,p)&&(h=!1),m=`${m}${h?`|c`:``}${p?`|f`:``}`;let t=f[`text-wrap-mode`]||f[`white-space`]||``;h&&t!==`nowrap`&&t!==`pre`&&(o.reconcileRisk=(o.reconcileRisk||0)+1)}let g=s.snapshotKeyCache.get(m);g===void 0&&(g=Ne(f,u,h,p),s.snapshotKeyCache.size>=vn&&s.snapshotKeyCache.delete(s.snapshotKeyCache.keys().next().value),s.snapshotKeyCache.set(m,g)),o.styleMap.set(t,g)}function zr(e,t,n){let r=t.getPropertyValue(`overflow-x`),i=t.getPropertyValue(`overflow-y`);if((r===`visible`||!r)&&(i===`visible`||!i)||t.getPropertyValue(`box-sizing`)===`border-box`||typeof e.clientWidth!=`number`||!e.offsetWidth)return;let a=e=>parseFloat(e)||0,o=e.offsetWidth-e.clientWidth-a(t.getPropertyValue(`border-left-width`))-a(t.getPropertyValue(`border-right-width`)),s=e.offsetHeight-e.clientHeight-a(t.getPropertyValue(`border-top-width`))-a(t.getPropertyValue(`border-bottom-width`)),c=(e,t)=>{let r=n[e];if(!r||!r.endsWith(`px`))return;let i=parseFloat(r);Number.isFinite(i)&&(n[e]=`${Math.round((i+t)*1e3)/1e3}px`)};o>=2&&(c(`width`,o),c(`inline-size`,o)),s>=2&&(c(`height`,s),c(`block-size`,s))}var Br=[`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`],Vr=[`width`,`inline-size`,`height`,`block-size`];function Hr(e,t,n){if(!Br.some(e=>n[e]?.includes(`.`))||t.getPropertyValue(`box-sizing`)===`border-box`||n.display===`inline`)return``;for(let e of[`width`,`height`]){let t=n[`min-${e}`],r=n[`max-${e}`];if(t&&t!==`0px`&&t!==`auto`||r&&r!==`none`)return``}let r=e=>parseFloat(n[e])||0,i=r(`padding-left`)+r(`padding-right`)+r(`border-left-width`)+r(`border-right-width`),a=r(`padding-top`)+r(`padding-bottom`)+r(`border-top-width`)+r(`border-bottom-width`),o=(n[`writing-mode`]||`horizontal-tb`)!==`horizontal-tb`;for(let e of Vr){let t=n[e];t&&t.endsWith(`px`)&&(n[e]=`${Math.round((parseFloat(t)+(e===`width`||e===`inline-size`&&!o||e===`block-size`&&o?i:a))*1e3)/1e3}px`)}n[`box-sizing`]=`border-box`;let s=``;if(t.getPropertyValue(`overflow-x`)===`auto`){let t=e.scrollWidth<=e.clientWidth;n[`overflow-x`]=t?`hidden`:`auto`,t&&(s+=`x`)}if(t.getPropertyValue(`overflow-y`)===`auto`){let t=e.scrollHeight<=e.clientHeight;n[`overflow-y`]=t?`hidden`:`auto`,t&&(s+=`y`)}return s}var Ur=[`box-sizing`,...Vr,`overflow-x`,`overflow-y`],Wr=/(?:box-sizing|width|height|inline-size|block-size|overflow(?:-[xy])?)\s*:/i;function Gr(e,t,n){if(Wr.test(e.getAttribute(`style`)))for(let e of Ur)t.style.getPropertyValue(e)&&n[e]&&t.style.setProperty(e,n[e],t.style.getPropertyPriority(e))}function Kr(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 qr(e){let t=e.parentElement;if(!t)return!1;let n=B(t).display||``;return n.includes(`flex`)||n.includes(`grid`)}function Jr(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType===3&&/\S/.test(t.nodeValue))return!0;let t=e.firstElementChild,n=e.lastElementChild;if(t&&t.tagName===`BR`||n&&n.tagName===`BR`)return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let e=B(t);if(e.display===`none`)continue;let n=e.position;if(n!==`absolute`&&n!==`fixed`)return!0}return!1}function Yr(e){let t=e.getBoundingClientRect().top,n=-1/0,r=null;for(let t=e.firstChild;t;t=t.nextSibling){if(t.nodeType===3){if(!/\S/.test(t.nodeValue||``))continue;r||=document.createRange(),r.selectNode(t);let e=r.getBoundingClientRect();(e.width||e.height)&&(n=Math.max(n,e.bottom));continue}if(t.nodeType!==1)continue;let e=B(t);if(e.display===`none`)continue;let i=e.position;i===`absolute`||i===`fixed`||e.float&&e.float!==`none`||(n=Math.max(n,t.getBoundingClientRect().bottom))}return n===-1/0?NaN:n-t}function Xr(e,t,n){if(v(e)&&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)||t.aspectRatio&&t.aspectRatio!==`none`&&t.aspectRatio!==`auto`)return;let i=t.display||``;if(i.includes(`flex`)||i.includes(`grid`))return;let a=t.position;if(a===`absolute`||a===`fixed`||a===`sticky`||t.transform!==`none`||Kr(t)||qr(e))return;let o=t.overflowX||t.overflow||`visible`,s=t.overflowY||t.overflow||`visible`;if(o!==`visible`||s!==`visible`)return;let c=t.clip;if(c&&c!==`auto`&&c!==`rect(auto, auto, auto, auto)`||t.visibility===`hidden`||t.opacity===`0`||!Jr(e))return;let l=parseFloat(t.height),u=Yr(e);Number.isFinite(l)&&Number.isFinite(u)&&Math.abs(l-u)>2||(delete n.height,delete n[`block-size`])}tt();var Zr=/* @__PURE__ */ new Set([`symbol`,`defs`,`pattern`,`marker`,`linearGradient`,`radialGradient`,`filter`]),Qr=/* @__PURE__ */ new WeakMap,$r=-1;function ei(e){let t=Dn();return t!==$r&&(Qr=/* @__PURE__ */ new WeakMap,$r=t),ti(e)}function ti(e){let t=Qr.get(e);if(t!==void 0)return t;let n;if(e.namespaceURI===`http://www.w3.org/2000/svg`&&(e.localName===`mask`||e.localName===`clipPath`?n=!1:Zr.has(e.localName)&&(n=!0)),n===void 0){let t=e.parentNode;n=!!(t&&t.nodeType===1)&&ti(t)}return Qr.set(e,n),n}function ni(e,t){if(e?.nodeType!==1||t?.nodeType!==1||ei(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.startsWith(`data:`)&&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=/* @__PURE__ */ 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.startsWith(`data:`)||!r.value.includes(`var(`))continue;let a=r.name,o=i&&i.getPropertyValue(a);if(o)try{t.style.setProperty(a,o.trim())}catch{}}}}W(),W(),c(),F(),Te(),E();function ri(e){return!!(!e||e.startsWith(`data:`)||e.startsWith(`blob:`))}function ii(e,t){if(!e)return null;let n=0;try{n=t?t.getBoundingClientRect().width||t.width:0}catch{}n||=window.innerWidth||1e3;let r=[];for(let t of e.split(`,`)){let e=t.trim().split(/\s+/);if(!e[0])continue;let i=e[1]||``,a=1;/^\d*\.?\d+x$/i.test(i)?a=parseFloat(i):/^\d+w$/i.test(i)&&(a=parseInt(i,10)/n),r.push({url:e[0],d:a})}if(!r.length)return null;r.sort((e,t)=>e.d-t.d);let i=window.devicePixelRatio||1;return(r.find(e=>e.d>=i)||r[r.length-1]).url}function ai(e,t){let n=e.currentSrc||``;if(n&&!ri(n))return n;let r=t.querySelectorAll(`source[srcset]`),i=null;for(let t of r){let n=t.getAttribute(`srcset`);if(!n||ri(n))continue;let r=t.getAttribute(`type`);if(r&&!S.test(r.trim()))continue;let a=t.getAttribute(`media`);if(a)try{if(window.matchMedia(a).matches)return ii(n,e)}catch{}i||=ii(n,e)}return i}function oi(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&&!ri(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&&!ri(e))return e}return null}z();function si(e,t){if(e=e.trim(),!e)return e;let n=t?`[data-sd-slotted~="${t}"]`:`[data-sd-slotted]`;return e.endsWith(`:not([data-sd-slotted])`)||e.endsWith(`:not(${n})`)?e:`${e}:not(${n})`}var ci=/::[a-zA-Z-]+(?:\([^)]*\))?$|:(?:before|after|first-letter|first-line)$/,li=/^::?(?:before|after|first-letter)$/;function ui(e,t,n=!0,r){return me(e,`,`).map(e=>e.trim()).filter(Boolean).map(e=>{if(e.startsWith(`:where(`)&&e.includes(`data-sd`)||e.startsWith(`@`))return e;let i=e.match(ci);if(i&&li.test(i[0]))return`:not(*)`;let a=i?e.slice(0,i.index).trim():e;return`:where(${t} ${n?si(a,r):a})${i?i[0]:``}`}).join(`, `)}function di(e,t,n){return e?(e=e.replace(/:host-context\(([^)]+)\)/g,(e,n)=>`:where(:where(${n.trim()}) ${t})`),e=e.replace(/:host\(([^)]+)\)/g,(e,n)=>`:where(${t}:is(${n.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(e,n)=>`:where(${t} ${n.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(e,r,i,a)=>`${r}${i}${ui(a,t,!0,n)}{`),e):``}function fi(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function pi(e){let t=``;for(let n of e)if(n.media&&n.cssRules){let e=!1;try{e=window.matchMedia(n.conditionText||n.media.mediaText).matches}catch{}e&&(t+=pi(n.cssRules))}else if(n.constructor?.name===`CSSSupportsRule`)t+=`@supports ${n.conditionText}{${pi(n.cssRules)}}`;else if(n.cssRules&&n.cssRules.length&&/@media/i.test(n.cssText)){let e=n.cssText.slice(0,n.cssText.indexOf(`{`)+1);t+=e+(n.style?n.style.cssText:``)+pi(n.cssRules)+`}`}else t+=n.cssText+`
4
4
  `;return t}function mi(e){let t=``;try{e.querySelectorAll(`style`).forEach(e=>{let n=null;try{n=e.sheet&&e.sheet.cssRules}catch{}t+=(n?pi(n):e.textContent||``)+`
@@ -0,0 +1 @@
1
+ import{_ as e,g as t,h as n,n as r,v as i}from"./overlay.mjs";import{A as a,I as o,N as s,P as c,d as l,f as u,l as d,n as f,x as p,y as m}from"./pka-overlay-channel-BZI-qbPH.mjs";import{t as h}from"./pka-overlay-store-eSg4Q7Sz.mjs";const g=s({id:m,prompt:c(),createdAt:p,elements:a().int().nonnegative()});function _(e){try{return sessionStorage.setItem(r,JSON.stringify(e)),null}catch(e){let t=`History could not be saved in this tab. Annotations are saved on the server; new History entries will be lost on reload. ${e instanceof Error?e.message:String(e)}`;return console.error(`[pk-annotator] ${t}`),t}}function v(){let e=sessionStorage.getItem(r);if(e===null)return{sent:[],discarded:null,persistenceError:null};let t=[],n=null,i;try{i=JSON.parse(e)}catch(e){n=`it is not JSON (${e instanceof Error?e.message:String(e)})`}if(n===null&&!Array.isArray(i)&&(n=`it is not a list`),Array.isArray(i))for(let[e,r]of i.entries()){let i=g.safeParse(r);i.success?t.push(i.data):n??=`entry ${e+1}: ${o(i.error)}`}if(n===null)return{sent:t,discarded:null,persistenceError:null};let a=`Discarded unreadable History entries in sessionStorage ${r}; ${n}`;return console.error(`[pk-annotator] ${a}`),{sent:t,discarded:a,persistenceError:_(t)}}function y(r){let a=h({...v(),states:/* @__PURE__ */ new Map,entries:/* @__PURE__ */ new Map,unread:!1}),o=e=>a.get().sent.some(t=>t.id===e),s=a.get().sent.map(e=>e.id),c=/* @__PURE__ */ new Set,p=()=>{c=new Set(s.splice(0,200)),c.size>0&&i(r,f.sync,{ids:[...c]})},m=[e(r,f.state,d,e=>{if(!o(e.id))return;let t=a.get().states.get(e.id)?.status;a.set({states:new Map(a.get().states).set(e.id,e.state)}),(e.state.status===`resolved`||e.state.status===`dismissed`)&&t!==e.state.status&&n()}),e(r,f.thread,u,({id:e,entry:t})=>{if(!o(e))return;let{entries:r,unread:i}=a.get();a.set({entries:new Map(r).set(e,[...r.get(e)??[],t]),unread:i||t.from===`agent`}),t.from===`agent`&&n()}),e(r,f.synced,l,e=>{let t=new Map(a.get().states),n=new Map(a.get().entries);for(let r of e.annotations)t.set(r.id,r.state),n.set(r.id,r.thread);let r=new Set(e.annotations.map(e=>e.id)),i=a.get().sent.filter(e=>!c.has(e.id)||r.has(e.id));a.set({sent:i,states:t,entries:n,persistenceError:_(i)}),p()})],g=a.subscribe(()=>{let{sent:e,states:n}=a.get();t(e.some(e=>n.get(e.id)?.status===`acknowledged`))});return p(),{...a,added(e){let t=[e,...a.get().sent.filter(t=>t.id!==e.id)];a.set({sent:t,persistenceError:_(t),states:new Map(a.get().states).set(e.id,{status:`pending`,history:[{status:`pending`,at:e.createdAt}]})})},disconnect(){for(let e of m)e();g(),t(!1)}}}export{y as connectThread};
@@ -0,0 +1 @@
1
+ import{y as e}from"./overlay.mjs";function t(t,n){return e().fetch(t,n)}export{t};
package/dist/pka.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { B as Id, F as readJsonLines, I as resolveInside, M as isErrno, O as PkaError, P as readJson, S as wait, W as Timestamp, _ as prune, a as ErrorsInput, c as ReplyInput, h as list, i as TimelineEntry, j as findStore, l as SetStatusInput, m as get, n as RecordingManifest, o as GetInput, p as errors, s as ListInput, u as attach, v as reply, x as validateAttachTarget, y as setStatus, z as ID_PATTERN } from "./recording-CpEDddkZ.mjs";
2
+ import { B as Id, F as readJsonLines, I as resolveInside, M as isErrno, O as PkaError, P as readJson, S as wait, W as Timestamp, _ as prune, a as ErrorsInput, c as ReplyInput, h as list, i as TimelineEntry, j as findStore, l as SetStatusInput, m as get, n as RecordingManifest, o as GetInput, p as errors, s as ListInput, u as attach, v as reply, x as validateAttachTarget, y as setStatus, z as ID_PATTERN } from "./recording-D_Qkyq0N.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createWriteStream } from "node:fs";
5
5
  import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
@@ -798,6 +798,7 @@ async function locate(page, target, step) {
798
798
  let notes = [];
799
799
  for (;;) {
800
800
  notes = [];
801
+ let ambiguous = false;
801
802
  for (const [strategy, locator] of strategies) {
802
803
  let count;
803
804
  try {
@@ -808,7 +809,25 @@ async function locate(page, target, step) {
808
809
  continue;
809
810
  }
810
811
  if (count === 1) return locator;
811
- if (count > 1) notes.push(`${strategy} matched ${count}`);
812
+ if (count > 1) {
813
+ ambiguous = true;
814
+ notes.push(`${strategy} matched ${count}`);
815
+ }
816
+ }
817
+ if (!ambiguous && target.label !== void 0) {
818
+ const fields = page.locator(target.tag);
819
+ const matches = await fields.evaluateAll((elements, { label, cap }) => elements.flatMap((element, index) => {
820
+ if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLTextAreaElement) && !(element instanceof HTMLSelectElement) && !(element instanceof HTMLFormElement) && !(element instanceof HTMLElement && element.isContentEditable)) return [];
821
+ const labels = element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement ? element.labels : null;
822
+ if (element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby") || labels !== null && labels.length > 0) return [];
823
+ return (element.getAttribute("name") ?? element.getAttribute("placeholder"))?.replace(/\s+/g, " ").trim().slice(0, cap) === label ? [index] : [];
824
+ }), {
825
+ label: target.label,
826
+ cap: TEXT_CAP
827
+ });
828
+ const index = matches[0];
829
+ if (matches.length === 1 && index !== void 0) return fields.nth(index);
830
+ if (matches.length > 1) notes.push(`name or placeholder matched ${matches.length}`);
812
831
  }
813
832
  if (Date.now() >= deadline) break;
814
833
  await setTimeout(100);
@@ -850,14 +869,14 @@ async function settle(page, tracker) {
850
869
  function samePage(current, target) {
851
870
  const a = new URL(current);
852
871
  const b = new URL(target);
853
- return a.origin === b.origin && a.pathname === b.pathname && a.search === b.search;
872
+ return a.origin === b.origin && a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
854
873
  }
855
874
  function producedByReplay(step, target, state) {
856
875
  const want = new URL(target);
857
876
  return state.changes.some(({ type, url, entered }) => {
858
877
  if (type === "reload" || type === "traverse" !== (step.type === "traverse")) return false;
859
878
  const got = new URL(url);
860
- if (got.origin !== want.origin || got.pathname !== want.pathname) return false;
879
+ if (got.origin !== want.origin || got.pathname !== want.pathname || got.hash !== want.hash) return false;
861
880
  return entered || got.search === want.search;
862
881
  });
863
882
  }
@@ -1423,6 +1442,7 @@ function printAnnotation(view) {
1423
1442
  line(` [${element.n}] ${element.source ?? "(no source)"}${element.usedAt === void 0 ? "" : ` usedAt ${element.usedAt}`} ${element.owners.join(" > ")} ${label || element.selector.css}`);
1424
1443
  }
1425
1444
  for (const attachment of view.attachments) line(` ${attachment.kind}: ${attachment.path}${attachment.summary ? ` ${attachment.summary}` : ""}`);
1445
+ for (const mark of view.marks ?? []) line(` mark ${mark.n}: ${mark.url}`);
1426
1446
  for (const entry of view.thread ?? []) line(` ${entry.at} ${entry.from}: ${entry.text}`);
1427
1447
  if (view.omitted !== void 0) line(view.omitted.note);
1428
1448
  }
@@ -28,8 +28,14 @@ const Selector = z.strictObject({
28
28
  testId: z.string().optional(),
29
29
  css: z.string()
30
30
  });
31
+ const Quote = z.strictObject({
32
+ exact: z.string().min(1),
33
+ prefix: z.string(),
34
+ suffix: z.string()
35
+ });
31
36
  const ElementRef = z.strictObject({
32
37
  n: z.number().int().positive(),
38
+ url: z.string().optional(),
33
39
  source: z.string().regex(/^.+:\d+:\d+$/, "source must be file:line:col").optional(),
34
40
  usedAt: z.string().regex(/^.+:\d+:\d+$/, "usedAt must be file:line:col").optional(),
35
41
  owners: z.array(z.string()),
@@ -38,7 +44,8 @@ const ElementRef = z.strictObject({
38
44
  box: Box,
39
45
  crop: RelativePath.optional(),
40
46
  text: z.string().optional(),
41
- nearbyText: z.string().optional()
47
+ nearbyText: z.string().optional(),
48
+ quote: Quote.optional()
42
49
  });
43
50
  const AttachmentKind = z.enum([
44
51
  "recording",
@@ -53,6 +60,11 @@ const Attachment = z.strictObject({
53
60
  path: RelativePath,
54
61
  summary: z.string()
55
62
  });
63
+ const MarkPage = z.strictObject({
64
+ n: z.number().int().positive(),
65
+ url: z.string(),
66
+ route: z.string()
67
+ });
56
68
  const Annotation = z.strictObject({
57
69
  id: Id,
58
70
  createdAt: Timestamp,
@@ -61,7 +73,8 @@ const Annotation = z.strictObject({
61
73
  viewport: Viewport,
62
74
  prompt: z.string(),
63
75
  elements: z.array(ElementRef),
64
- attachments: z.array(Attachment)
76
+ attachments: z.array(Attachment),
77
+ marks: z.array(MarkPage).optional()
65
78
  });
66
79
  const AnnotationDraft = Annotation.omit({
67
80
  id: true,
@@ -521,6 +534,11 @@ async function withAnnotationLock(store, id, act) {
521
534
  const files = await requireAnnotation(store, id);
522
535
  return withLock(store, resolveInside(files.dir, "state.lock"), Date.now() + LOCK_WAIT_MS, () => act(files));
523
536
  }
537
+ async function withLiveErrorsLock(store, act) {
538
+ const lock = resolveInside(store, "live", "errors.lock");
539
+ await refuseSymlinks(store, lock);
540
+ return withLock(store, lock, Date.now() + LOCK_WAIT_MS, act);
541
+ }
524
542
  async function readClaim(store, id) {
525
543
  const files = annotationFiles(store, id);
526
544
  try {
@@ -734,6 +752,7 @@ function optionalPageText(value, max) {
734
752
  }
735
753
  const ElementView = z.strictObject({
736
754
  n: z.number(),
755
+ url: z.string().optional().describe("The page the element was picked on"),
737
756
  source: z.string().optional(),
738
757
  usedAt: z.string().optional(),
739
758
  owners: z.array(z.string()),
@@ -745,10 +764,20 @@ const ElementView = z.strictObject({
745
764
  }),
746
765
  crop: z.string().optional(),
747
766
  text: z.string().optional(),
767
+ quote: z.strictObject({
768
+ exact: z.string(),
769
+ prefix: z.string(),
770
+ suffix: z.string()
771
+ }).optional().describe("Text the human selected inside the element, with the text just before and after it"),
748
772
  nearbyText: z.string().optional(),
749
773
  html: z.string().optional(),
750
774
  box: Box.optional()
751
775
  });
776
+ const MarkView = z.strictObject({
777
+ n: z.number().describe("Matches the \"## Mark n\" section of the prompt"),
778
+ url: z.string(),
779
+ route: z.string()
780
+ });
752
781
  const AnnotationView = z.strictObject({
753
782
  id: Id,
754
783
  createdAt: Timestamp,
@@ -765,13 +794,15 @@ const AnnotationView = z.strictObject({
765
794
  path: z.string(),
766
795
  summary: z.string().optional()
767
796
  })),
797
+ marks: z.array(MarkView).optional().describe("The page each saved mark of a batch was made on"),
768
798
  threadCount: z.number(),
769
799
  omitted: z.strictObject({
770
800
  elements: z.number(),
771
801
  attachments: z.number(),
802
+ marks: z.number(),
772
803
  promptCharacters: z.number(),
773
804
  note: z.string()
774
- }).optional().describe("Elements and attachments left out of a concise response"),
805
+ }).optional().describe("Elements, attachments, and mark pages left out of a concise response"),
775
806
  history: z.array(StatusEvent).optional(),
776
807
  thread: z.array(ThreadEntry).optional()
777
808
  });
@@ -801,6 +832,7 @@ function elementView(element, detail) {
801
832
  const full = detail === "full";
802
833
  const view = {
803
834
  n: element.n,
835
+ url: optionalPageText(element.url, CAP.label),
804
836
  source: optionalPageText(element.source, CAP.label),
805
837
  usedAt: optionalPageText(element.usedAt, CAP.label),
806
838
  owners: element.owners.slice(0, CAP.owners).map((owner) => pageText(owner, CAP.short)),
@@ -813,6 +845,11 @@ function elementView(element, detail) {
813
845
  crop: element.crop,
814
846
  text: optionalPageText(element.text, full ? CAP.text : CAP.short)
815
847
  };
848
+ if (element.quote !== void 0) view.quote = {
849
+ exact: pageText(element.quote.exact, full ? CAP.html : CAP.text),
850
+ prefix: pageText(element.quote.prefix, CAP.short),
851
+ suffix: pageText(element.quote.suffix, CAP.short)
852
+ };
816
853
  if (full) {
817
854
  view.nearbyText = optionalPageText(element.nearbyText, CAP.text);
818
855
  view.html = pageText(element.html, CAP.html);
@@ -840,6 +877,11 @@ function annotationView(record, detail) {
840
877
  })),
841
878
  threadCount: record.thread.length
842
879
  };
880
+ if (annotation.marks !== void 0) view.marks = annotation.marks.map((mark) => ({
881
+ n: mark.n,
882
+ url: pageText(mark.url, CAP.label),
883
+ route: pageText(mark.route, CAP.label)
884
+ }));
843
885
  if (full) {
844
886
  view.viewport = annotation.viewport;
845
887
  view.history = state.history;
@@ -861,16 +903,19 @@ function promptPrefix(prompt) {
861
903
  }
862
904
  }
863
905
  /**
864
- * Caps the prompt, then keeps the leading elements and attachments that fit CONCISE_BYTES, so
865
- * `[element n]` and `[attachment n]` keep their numbers, and says how much was left out.
906
+ * Caps the prompt, then keeps the leading elements, attachments, and mark pages that fit
907
+ * CONCISE_BYTES, so `[element n]`, `[attachment n]`, and `## Mark n` keep their numbers, and
908
+ * says how much was left out.
866
909
  */
867
910
  function withinBudget(view) {
868
911
  const { elements, attachments } = view;
912
+ const marks = view.marks ?? [];
869
913
  const prompt = promptPrefix(view.prompt);
870
914
  const promptCharacters = view.prompt.length - prompt.length;
871
- const omitted = (keptElements, keptAttachments) => ({
915
+ const omitted = (keptElements, keptAttachments, keptMarks) => ({
872
916
  elements: elements.length - keptElements,
873
917
  attachments: attachments.length - keptAttachments,
918
+ marks: marks.length - keptMarks,
874
919
  promptCharacters,
875
920
  note: OMITTED_NOTE
876
921
  });
@@ -879,7 +924,8 @@ function withinBudget(view) {
879
924
  prompt,
880
925
  elements: [],
881
926
  attachments: [],
882
- omitted: omitted(0, 0)
927
+ ...view.marks !== void 0 && { marks: [] },
928
+ omitted: omitted(0, 0, 0)
883
929
  });
884
930
  const fit = (items) => {
885
931
  const kept = [];
@@ -893,14 +939,16 @@ function withinBudget(view) {
893
939
  };
894
940
  const keptElements = fit(elements);
895
941
  const keptAttachments = fit(attachments);
896
- const result = promptCharacters === 0 && keptElements.length === elements.length && keptAttachments.length === attachments.length ? view : {
942
+ const keptMarks = fit(marks);
943
+ const result = promptCharacters === 0 && keptElements.length === elements.length && keptAttachments.length === attachments.length && keptMarks.length === marks.length ? view : {
897
944
  ...view,
898
945
  prompt,
899
946
  elements: keptElements,
900
947
  attachments: keptAttachments,
901
- omitted: omitted(keptElements.length, keptAttachments.length)
948
+ ...view.marks !== void 0 && { marks: keptMarks },
949
+ omitted: omitted(keptElements.length, keptAttachments.length, keptMarks.length)
902
950
  };
903
- if (jsonBytes(result) > 2e4) throw new PkaError(`The concise view of annotation ${view.id} is over ${CONCISE_BYTES} bytes without its elements and attachments; request detail full.`);
951
+ if (jsonBytes(result) > 2e4) throw new PkaError(`The concise view of annotation ${view.id} is over ${CONCISE_BYTES} bytes without its elements, attachments, and mark pages; request detail full.`);
904
952
  return result;
905
953
  }
906
954
  const OMITTED_NOTE = "Left out to keep this response small. get_annotation (pka get) with detail full returns all of them.";
@@ -1108,13 +1156,13 @@ function isOffered(state, claim) {
1108
1156
  if (claim === void 0) return state.status === "pending";
1109
1157
  return isOrphaned(state, claim, Date.now());
1110
1158
  }
1159
+ async function isOfferedId(store, id) {
1160
+ const state = await readListedState(store, id);
1161
+ return state !== void 0 && !isClosed(state.status) && isOffered(state, await readClaim(store, id));
1162
+ }
1111
1163
  async function oldestOffered(store, skip) {
1112
1164
  const ids = (await listIds(store)).filter((id) => !skip.has(id));
1113
- const offered = async (id) => {
1114
- const state = await readListedState(store, id);
1115
- return state !== void 0 && !isClosed(state.status) && isOffered(state, await readClaim(store, id));
1116
- };
1117
- for (let start = 0; start < ids.length; start += SCAN_BATCH) for (const id of await firstMatching(ids.slice(start, start + SCAN_BATCH), SCAN_BATCH, offered)) {
1165
+ for (let start = 0; start < ids.length; start += SCAN_BATCH) for (const id of await firstMatching(ids.slice(start, start + SCAN_BATCH), SCAN_BATCH, (id) => isOfferedId(store, id))) {
1118
1166
  const record = await loadListed(store, id);
1119
1167
  if (record !== void 0 && isOffered(record.state, record.claim)) return record;
1120
1168
  }
@@ -1297,14 +1345,16 @@ async function errors(store, input) {
1297
1345
  }
1298
1346
  /** Merges new or changed groups into live/errors.json by fingerprint. Used by the Vite plugin. */
1299
1347
  async function upsertErrorGroups(store, groups) {
1300
- const merged = new Map(((await readErrors(store))?.groups ?? []).map((group) => [group.fingerprint, group]));
1301
- for (const group of groups) merged.set(group.fingerprint, group);
1302
- const snapshot = {
1303
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1304
- groups: [...merged.values()].sort((a, b) => Date.parse(b.lastSeen) - Date.parse(a.lastSeen)).slice(0, MAX_ERROR_GROUPS)
1305
- };
1306
- await writeJsonAtomic(store, liveErrorsFile(store), snapshot);
1307
- return snapshot;
1348
+ return withLiveErrorsLock(store, async () => {
1349
+ const merged = new Map(((await readErrors(store))?.groups ?? []).map((group) => [group.fingerprint, group]));
1350
+ for (const group of groups) merged.set(group.fingerprint, group);
1351
+ const snapshot = {
1352
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1353
+ groups: [...merged.values()].sort((a, b) => Date.parse(b.lastSeen) - Date.parse(a.lastSeen)).slice(0, MAX_ERROR_GROUPS)
1354
+ };
1355
+ await writeJsonAtomic(store, liveErrorsFile(store), snapshot);
1356
+ return snapshot;
1357
+ });
1308
1358
  }
1309
1359
  /**
1310
1360
  * Checks the capture files an annotation declares: each under capture/, listed