vanilla-breeze 0.6.2 → 0.7.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 (239) hide show
  1. package/dist/cdn/components/accordion-wc.js +1 -1
  2. package/dist/cdn/components/activity-feed.js +1 -1
  3. package/dist/cdn/components/ai-chat.js +6 -6
  4. package/dist/cdn/components/ai-summary.js +2 -2
  5. package/dist/cdn/components/analytics-panel.js +2 -2
  6. package/dist/cdn/components/audio-player.js +4 -4
  7. package/dist/cdn/components/audio-visualizer.js +2 -2
  8. package/dist/cdn/components/author-index.js +2 -2
  9. package/dist/cdn/components/brand-mark.js +1 -1
  10. package/dist/cdn/components/bread-crumb.js +1 -1
  11. package/dist/cdn/components/calendar-wc.js +2 -2
  12. package/dist/cdn/components/card-list.js +1 -1
  13. package/dist/cdn/components/carousel-wc.js +1 -1
  14. package/dist/cdn/components/change-set.js +1 -1
  15. package/dist/cdn/components/chart-wc.js +13 -13
  16. package/dist/cdn/components/chat-input.js +1 -1
  17. package/dist/cdn/components/chat-window.js +1 -1
  18. package/dist/cdn/components/color-picker.js +1 -1
  19. package/dist/cdn/components/combo-box.js +1 -1
  20. package/dist/cdn/components/command-palette.js +1 -1
  21. package/dist/cdn/components/comment-box.js +35 -35
  22. package/dist/cdn/components/comment-thread.js +38 -38
  23. package/dist/cdn/components/comment-wc.js +1 -1
  24. package/dist/cdn/components/compare-surface.js +1 -1
  25. package/dist/cdn/components/consent-banner.js +1 -1
  26. package/dist/cdn/components/content-lens.js +1 -1
  27. package/dist/cdn/components/content-swap.js +1 -1
  28. package/dist/cdn/components/context-menu.js +1 -1
  29. package/dist/cdn/components/data-table.js +1 -1
  30. package/dist/cdn/components/date-picker.js +1 -1
  31. package/dist/cdn/components/day-view.js +1 -1
  32. package/dist/cdn/components/diagram-wc.js +2 -2
  33. package/dist/cdn/components/drag-surface.js +1 -1
  34. package/dist/cdn/components/drop-down.js +1 -1
  35. package/dist/cdn/components/emoji-picker.js +1 -1
  36. package/dist/cdn/components/flow-diagram.js +1 -1
  37. package/dist/cdn/components/foot-notes.js +1 -1
  38. package/dist/cdn/components/form-field.js +1 -1
  39. package/dist/cdn/components/geo-map.js +3 -3
  40. package/dist/cdn/components/glossary-index.js +1 -1
  41. package/dist/cdn/components/glossary-wc.js +1 -1
  42. package/dist/cdn/components/heading-links.js +1 -1
  43. package/dist/cdn/components/highlight-wc.js +2 -2
  44. package/dist/cdn/components/icon-wc.js +2 -2
  45. package/dist/cdn/components/image-gallery.js +1 -1
  46. package/dist/cdn/components/image-map.js +1 -1
  47. package/dist/cdn/components/include-file.js +1 -1
  48. package/dist/cdn/components/manifest.json +58 -54
  49. package/dist/cdn/components/markdown-editor.js +25 -25
  50. package/dist/cdn/components/markdown-viewer.js +27 -27
  51. package/dist/cdn/components/nav-bar.js +1 -1
  52. package/dist/cdn/components/note-wc.js +2 -2
  53. package/dist/cdn/components/notification-wc.js +23 -23
  54. package/dist/cdn/components/page-info.js +6 -6
  55. package/dist/cdn/components/page-stats.js +1 -1
  56. package/dist/cdn/components/page-toc.js +1 -1
  57. package/dist/cdn/components/page-tools.js +1 -1
  58. package/dist/cdn/components/page-tour.js +1 -1
  59. package/dist/cdn/components/pager-wc.js +1 -1
  60. package/dist/cdn/components/poll-wc.js +1 -1
  61. package/dist/cdn/components/pop-over.js +1 -1
  62. package/dist/cdn/components/popularity-index.js +1 -1
  63. package/dist/cdn/components/print-page.js +1 -1
  64. package/dist/cdn/components/progress-tracker.js +1 -1
  65. package/dist/cdn/components/qr-code.js +1 -1
  66. package/dist/cdn/components/reaction-bar.js +1 -1
  67. package/dist/cdn/components/reading-progress.js +1 -1
  68. package/dist/cdn/components/recently-visited.js +1 -1
  69. package/dist/cdn/components/score-card.js +2 -2
  70. package/dist/cdn/components/selection-menu.js +1 -1
  71. package/dist/cdn/components/settings-panel.js +6 -6
  72. package/dist/cdn/components/share-wc.js +2 -2
  73. package/dist/cdn/components/short-cuts.js +1 -1
  74. package/dist/cdn/components/site-index.js +1 -1
  75. package/dist/cdn/components/site-map.js +1 -1
  76. package/dist/cdn/components/site-search.js +1 -1
  77. package/dist/cdn/components/slide-accept.js +1 -1
  78. package/dist/cdn/components/social-embed.js +1 -1
  79. package/dist/cdn/components/social-links.js +2 -0
  80. package/dist/cdn/components/split-surface.js +1 -1
  81. package/dist/cdn/components/star-rating.js +1 -1
  82. package/dist/cdn/components/status-wc.js +1 -1
  83. package/dist/cdn/components/stepper-wc.js +1 -1
  84. package/dist/cdn/components/tab-set.js +1 -1
  85. package/dist/cdn/components/text-reader.js +2 -2
  86. package/dist/cdn/components/theme-picker.js +20 -20
  87. package/dist/cdn/components/time-index.js +1 -1
  88. package/dist/cdn/components/time-picker.js +1 -1
  89. package/dist/cdn/components/toast-msg.js +2 -2
  90. package/dist/cdn/components/tool-tip.js +1 -1
  91. package/dist/cdn/components/topic-map.js +4 -4
  92. package/dist/cdn/components/trust-filter.js +1 -1
  93. package/dist/cdn/components/version-switcher.js +6 -6
  94. package/dist/cdn/components/video-player.js +4 -4
  95. package/dist/cdn/components/watch-wc.js +2 -2
  96. package/dist/cdn/components/week-view.js +1 -1
  97. package/dist/cdn/components/youtube-player.js +1 -1
  98. package/dist/cdn/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
  99. package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
  100. package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
  101. package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
  103. package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
  105. package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
  107. package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
  109. package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
  110. package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
  111. package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
  112. package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
  113. package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
  114. package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
  115. package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
  116. package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
  117. package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
  118. package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  119. package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
  120. package/dist/cdn/packs/effects.full.js +1 -1
  121. package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  122. package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
  123. package/dist/cdn/packs/kawaii.full.css +1 -1
  124. package/dist/cdn/packs/kawaii.theme.css +1 -1
  125. package/dist/cdn/packs/manifest.json +4 -4
  126. package/dist/cdn/packs/prototype.full.js +1 -1
  127. package/dist/cdn/packs/ui.full.js +19 -19
  128. package/dist/cdn/themes/8bit.tokens.json +8 -37
  129. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  130. package/dist/cdn/themes/alpha1999.css +1 -1
  131. package/dist/cdn/themes/alpha1999.tokens.json +3 -6
  132. package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
  133. package/dist/cdn/themes/art-deco.css +1 -1
  134. package/dist/cdn/themes/art-deco.tokens.json +5 -11
  135. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  136. package/dist/cdn/themes/bauhaus.css +1 -1
  137. package/dist/cdn/themes/bauhaus.tokens.json +13 -7
  138. package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
  139. package/dist/cdn/themes/brutalist.tokens.json +5 -11
  140. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  141. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  142. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  143. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  144. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  145. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  146. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  147. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  148. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  149. package/dist/cdn/themes/classic-dark.tokens.json +41 -41
  150. package/dist/cdn/themes/classic.tokens.json +25 -31
  151. package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
  152. package/dist/cdn/themes/claymorphism.css +1 -1
  153. package/dist/cdn/themes/claymorphism.tokens.json +531 -135
  154. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  155. package/dist/cdn/themes/clinical.tokens.json +1 -1
  156. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  157. package/dist/cdn/themes/cottagecore.css +1 -1
  158. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  159. package/dist/cdn/themes/cyber.css +1 -1
  160. package/dist/cdn/themes/cyber.tokens.json +5 -11
  161. package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
  162. package/dist/cdn/themes/dawn.css +1 -1
  163. package/dist/cdn/themes/dawn.tokens.json +1 -1
  164. package/dist/cdn/themes/dracula.tokens.json +1 -1
  165. package/dist/cdn/themes/dusk.tokens.json +1 -1
  166. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  167. package/dist/cdn/themes/editorial.tokens.json +19 -16
  168. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  169. package/dist/cdn/themes/financial.css +1 -1
  170. package/dist/cdn/themes/financial.tokens.json +1 -1
  171. package/dist/cdn/themes/genai.css +1 -1
  172. package/dist/cdn/themes/genai.tokens.json +1 -1
  173. package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
  174. package/dist/cdn/themes/glassmorphism.css +1 -1
  175. package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
  176. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  177. package/dist/cdn/themes/government.tokens.json +1 -1
  178. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  179. package/dist/cdn/themes/gruvbox.css +1 -1
  180. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  181. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  182. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  183. package/dist/cdn/themes/journal-dark.tokens.json +3 -27
  184. package/dist/cdn/themes/journal.css +1 -1
  185. package/dist/cdn/themes/journal.tokens.json +21 -21
  186. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  187. package/dist/cdn/themes/kawaii.css +1 -1
  188. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  189. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  190. package/dist/cdn/themes/magna.css +1 -1
  191. package/dist/cdn/themes/magna.tokens.json +2 -14
  192. package/dist/cdn/themes/manifest.json +25 -25
  193. package/dist/cdn/themes/midnight.tokens.json +1 -1
  194. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  195. package/dist/cdn/themes/minimal.tokens.json +25 -27
  196. package/dist/cdn/themes/modern-dark.tokens.json +41 -41
  197. package/dist/cdn/themes/modern.css +1 -1
  198. package/dist/cdn/themes/modern.tokens.json +21 -21
  199. package/dist/cdn/themes/nes-dark.tokens.json +3 -27
  200. package/dist/cdn/themes/nes.tokens.json +10 -39
  201. package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
  202. package/dist/cdn/themes/neumorphism.css +1 -1
  203. package/dist/cdn/themes/neumorphism.tokens.json +266 -134
  204. package/dist/cdn/themes/nord-dark.tokens.json +3 -27
  205. package/dist/cdn/themes/nord.css +1 -1
  206. package/dist/cdn/themes/nord.tokens.json +1 -1
  207. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  208. package/dist/cdn/themes/organic.tokens.json +5 -14
  209. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  210. package/dist/cdn/themes/rose-pine.css +1 -1
  211. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  212. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  213. package/dist/cdn/themes/rough.tokens.json +1 -1
  214. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  215. package/dist/cdn/themes/solarized.tokens.json +1 -1
  216. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  217. package/dist/cdn/themes/startup.css +1 -1
  218. package/dist/cdn/themes/startup.tokens.json +1 -1
  219. package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
  220. package/dist/cdn/themes/super2026.css +1 -1
  221. package/dist/cdn/themes/super2026.tokens.json +1 -1
  222. package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
  223. package/dist/cdn/themes/swiss.tokens.json +34 -68
  224. package/dist/cdn/themes/terminal.tokens.json +286 -120
  225. package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
  226. package/dist/cdn/themes/tokyo-night.css +1 -1
  227. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  228. package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
  229. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  230. package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
  231. package/dist/cdn/themes/win9x.tokens.json +9 -9
  232. package/dist/cdn/vanilla-breeze-autoload.js +113 -108
  233. package/dist/cdn/vanilla-breeze-charts.js +13 -13
  234. package/dist/cdn/vanilla-breeze-core.css +1 -1
  235. package/dist/cdn/vanilla-breeze-core.js +80 -75
  236. package/dist/cdn/vanilla-breeze-extras.js +31 -31
  237. package/dist/cdn/vanilla-breeze.css +1 -1
  238. package/dist/cdn/vanilla-breeze.js +133 -133
  239. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- var T=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function v(i,t,e={}){let n=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=S.get(i);if(customElements.get(i)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(i,o),customElements.define(i,t)}var w=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,o){t.addEventListener(e,n,o),this.#t.push(()=>t.removeEventListener(e,n,o))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let o=`--${t}`;e?n.add(o):n.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#n(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var L={heading:"Topics",page:"{count} page",pages:"{count} pages",uncategorized:"Uncategorized","topic-link":"{label} topic page",error:"Topics could not be loaded."};function _(i){let t=String(i??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://topic-map.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function x(i,t){let e=Array.isArray(t?.concepts)?t.concepts:[],n=A(t?.["skos:hasTopConcept"]),o=new Map;for(let r of e)r&&typeof r["@id"]=="string"&&r["@id"]&&o.set(r["@id"],r);let s=new Map,l=new Map,u=(r,a)=>{!o.has(r)||!o.has(a)||r===a||(s.set(r,(s.get(r)??new Set).add(a)),l.set(a,(l.get(a)??new Set).add(r)))};for(let r of o.values()){let a=r["@id"];for(let c of A(r["skos:broader"]))u(c,a);for(let c of A(r["skos:narrower"]))u(a,c)}let p=new Map,m=[];for(let r of i){if(!r||typeof r!="object")continue;let a=Array.isArray(r.concepts)?r.concepts:[],c=!1;for(let d of new Set(a)){if(!o.has(d))continue;let h=p.get(d);h?h.push(r):p.set(d,[r]),c=!0}c||m.push(r)}let g=new Map,$=r=>{if(g.has(r))return g.get(r);let a=new Set,c=new Set,d=[r];for(;d.length;){let h=d.pop();if(!a.has(h)){a.add(h);for(let b of p.get(h)||[])c.add(C(b));for(let b of s.get(h)||[])d.push(b)}}return g.set(r,c.size),c.size},y=n.filter(r=>o.has(r));return y.length===0&&(y=[...o.keys()].filter(r=>!l.has(r))),{byId:o,childrenOf:s,directPages:p,uncategorized:m,roots:y,totalFor:$}}var k=class extends w{#t=0;setup(){let t=++this.#t;if(this.__data){this.#n(this.__data.pages,this.__data.vocabulary);return}let e=this.getAttribute("data-lens-src")||this.getAttribute("src"),n=this.getAttribute("data-vocabulary-src")||"/vocabulary.json";e&&this.#e(e,n,t)}teardown(){this.#t++}get data(){return this.__data||null}set data(t){if(!t||typeof t!="object")return;let e=Array.isArray(t.pages)?t.pages:[],n=t.vocabulary||{};this.__data={pages:e,vocabulary:n},this._reinit(),this.dispatchEvent(new CustomEvent("topic-map:data-changed",{detail:{pages:e,vocabulary:n,source:"property"},bubbles:!0}))}async#e(t,e,n){let[o,s]=await Promise.all([M(t),M(e)]);if(n!==this.#t)return;let l=o.error?[t,o.error]:s.error?[e,s.error]:null;if(l){console.warn(`[topic-map] could not load ${l[0]}: ${l[1]}`),this.#a();return}let u=o.data,p=Array.isArray(u)?u:Array.isArray(u?.pages)?u.pages:[];this.#n(p,s.data)}#n(t,e){try{this.#l(t,e)}catch(n){console.warn("[topic-map] could not render the topic tree:",n),this.#a()}}#l(t,e){let n=x(t,e),o=this.hasAttribute("expand-all"),s=[],l=this.#u(t.length);l&&s.push(l);for(let u of n.roots)s.push(this.#o(u,n,o,0,new Set));if(n.uncategorized.length){let u=o?" open":"";s.push(`<details${u} data-topic-node="__uncategorized">`),s.push(`<summary><span class="topic-name">${f(this.#r("uncategorized"))}</span> <span class="topic-count">${f(this.#s(new Set(n.uncategorized.map(C)).size))}</span></summary>`),s.push(this.#i(n.uncategorized)),s.push("</details>")}this.innerHTML=s.join(`
2
- `)}#o(t,e,n,o,s){let l=e.byId.get(t);if(!l||s.has(t))return"";let u=new Set(s).add(t),p=String(l["skos:prefLabel"]||t),m=e.directPages.get(t)||[],g=e.childrenOf.get(t),$=n||o<1?" open":"",y=this.#r("topic-link").replaceAll("{label}",p),r=[];if(r.push(`<details${$} data-topic-node="${E(t)}">`),r.push(`<summary><span class="topic-name">${f(p)}</span> <span class="topic-count">${f(this.#s(e.totalFor(t)))}</span></summary>`),r.push(`<p class="topic-link"><a href="/topics/${E(encodeURIComponent(t))}/">${f(y)}</a></p>`),m.length&&r.push(this.#i(m)),g&&g.size){let a=[...g].sort((c,d)=>{let h=String(e.byId.get(c)?.["skos:prefLabel"]||c),b=String(e.byId.get(d)?.["skos:prefLabel"]||d);return h.localeCompare(b,this.#c(),{sensitivity:"base"})});for(let c of a)r.push(this.#o(c,e,n,o+1,u))}return r.push("</details>"),r.join(`
1
+ var B=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function k(i,t,e={}){let r=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=S.get(i);if(customElements.get(i)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(i,o),customElements.define(i,t)}var w=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,o){t.addEventListener(e,r,o),this.#t.push(()=>t.removeEventListener(e,r,o))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{e?r.add(t):r.delete(t)}catch{let o=`--${t}`;e?r.add(o):r.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var T={heading:"Topics",page:"{count} page",pages:"{count} pages",uncategorized:"Uncategorized","topic-link":"{label} topic page",error:"Topics could not be loaded."};function x(i){let t=String(i??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://topic-map.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function _(i,t){let e=Array.isArray(t?.concepts)?t.concepts:[],r=E(t?.["skos:hasTopConcept"]),o=new Map;for(let n of e)n&&typeof n["@id"]=="string"&&n["@id"]&&o.set(n["@id"],n);let s=new Map,d=new Map,l=(n,a)=>{!o.has(n)||!o.has(a)||n===a||(s.set(n,(s.get(n)??new Set).add(a)),d.set(a,(d.get(a)??new Set).add(n)))};for(let n of o.values()){let a=n["@id"];for(let c of E(n["skos:broader"]))l(c,a);for(let c of E(n["skos:narrower"]))l(a,c)}let f=new Map,g=[];for(let n of i){if(!n||typeof n!="object")continue;let a=Array.isArray(n.concepts)?n.concepts:[],c=!1;for(let u of new Set(a)){if(!o.has(u))continue;let p=f.get(u);p?p.push(n):f.set(u,[n]),c=!0}c||g.push(n)}let b=new Map,$=n=>{if(b.has(n))return b.get(n);let a=new Set,c=new Set,u=[n];for(;u.length;){let p=u.pop();if(!a.has(p)){a.add(p);for(let m of f.get(p)||[])c.add(M(m));for(let m of s.get(p)||[])u.push(m)}}return b.set(n,c.size),c.size},y=r.filter(n=>o.has(n));return y.length===0&&(y=[...o.keys()].filter(n=>!d.has(n))),{byId:o,childrenOf:s,directPages:f,uncategorized:g,roots:y,totalFor:$}}var A=class extends w{#t=0;setup(){let t=++this.#t;if(this.__data){this.#r(this.__data.pages,this.__data.vocabulary);return}let e=this.getAttribute("data-lens-src")||this.getAttribute("src"),r=this.getAttribute("data-vocabulary-src")||"/vocabulary.json";e&&this.#e(e,r,t)}teardown(){this.#t++}get data(){return this.__data||null}set data(t){if(!t||typeof t!="object")return;let e=Array.isArray(t.pages)?t.pages:[],r=t.vocabulary||{};this.__data={pages:e,vocabulary:r},this._reinit(),this.dispatchEvent(new CustomEvent("topic-map:data-changed",{detail:{pages:e,vocabulary:r,source:"property"},bubbles:!0}))}async#e(t,e,r){let[o,s]=await Promise.all([C(t),C(e)]);if(r!==this.#t)return;let d=o.error?[t,o.error]:s.error?[e,s.error]:null;if(d){console.warn(`[topic-map] could not load ${d[0]}: ${d[1]}`),this.#a();return}let l=o.data,f=Array.isArray(l)?l:Array.isArray(l?.pages)?l.pages:[];this.#r(f,s.data)}#r(t,e){try{this.#d(t,e)}catch(r){console.warn("[topic-map] could not render the topic tree:",r),this.#a()}}#d(t,e){let r=_(t,e),o=this.hasAttribute("expand-all"),s=[],d=this.#l(t.length);d&&s.push(d);for(let l of r.roots)s.push(this.#o(l,r,o,0,new Set));if(r.uncategorized.length){let l=o?" open":"";s.push(`<details${l} data-topic-node="__uncategorized">`),s.push(`<summary><span class="topic-name">${h(this.#n("uncategorized"))}</span> <span class="topic-count">${h(this.#s(new Set(r.uncategorized.map(M)).size))}</span></summary>`),s.push(this.#i(r.uncategorized)),s.push("</details>")}this.innerHTML=s.join(`
2
+ `)}#o(t,e,r,o,s){let d=e.byId.get(t);if(!d||s.has(t))return"";let l=new Set(s).add(t),f=String(d["skos:prefLabel"]||t),g=e.directPages.get(t)||[],b=e.childrenOf.get(t),$=r||o<1?" open":"",y=this.#n("topic-link").replaceAll("{label}",f),n=[];if(n.push(`<details${$} data-topic-node="${v(t)}">`),n.push(`<summary><span class="topic-name">${h(f)}</span> <span class="topic-count">${h(this.#s(e.totalFor(t)))}</span></summary>`),n.push(`<p class="topic-link"><a href="/topics/${v(encodeURIComponent(t))}/">${h(y)}</a></p>`),g.length&&n.push(this.#i(g)),b&&b.size){let a=[...b].sort((c,u)=>{let p=String(e.byId.get(c)?.["skos:prefLabel"]||c),m=String(e.byId.get(u)?.["skos:prefLabel"]||u);return p.localeCompare(m,this.#c(),{sensitivity:"base"})});for(let c of a)n.push(this.#o(c,e,r,o+1,l))}return n.push("</details>"),n.join(`
3
3
  `)}#i(t){return`<ul class="topic-pages">
4
- ${t.map(n=>{let o=f(n.title||n.url||""),s=_(n.url);return s?`<li><a href="${E(s)}">${o}</a></li>`:`<li>${o}</li>`}).join(`
4
+ ${t.map(r=>{let o=h(r.title||r.url||""),s=x(r.url);return s?`<li><a href="${v(s)}">${o}</a></li>`:`<li>${o}</li>`}).join(`
5
5
  `)}
6
- </ul>`}#u(t){let e=this.getAttribute("data-heading-level"),n=e==null||e===""?2:Number.parseInt(e,10);if(n===0)return"";let o=Number.isFinite(n)?Math.min(6,Math.max(1,n)):2;return`<h${o} class="topic-map-heading">${f(this.#r("heading"))} <small>(${f(this.#s(t))})</small></h${o}>`}#s(t){let e=this.#c(),n=new Intl.PluralRules(e).select(t)==="one"?"page":"pages";return this.#r(n).replaceAll("{count}",new Intl.NumberFormat(e).format(t))}#a(){this.querySelector(":scope > [data-topic-map-error]")?.remove();let t=document.createElement("p");t.setAttribute("data-topic-map-error",""),t.textContent=this.#r("error"),this.prepend(t)}#r(t){return this.getAttribute(`data-label-${t}`)||L[t]}#c(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};async function M(i){try{let t=await fetch(i);if(!t.ok)throw new Error(`status ${t.status}`);return{data:await t.json()}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function C(i){return typeof i?.url=="string"&&i.url?i.url:i}function A(i){return i==null?[]:Array.isArray(i)?i:[i]}function f(i){return String(i??"").replace(/[&<>]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[t])}function E(i){return String(i??"").replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}v("topic-map",k);export{k as TopicMap,x as buildTopicGraph,_ as safeHref};
6
+ </ul>`}#l(t){let e=this.getAttribute("data-heading-level"),r=e==null||e===""?2:Number.parseInt(e,10);if(r===0)return"";let o=Number.isFinite(r)?Math.min(6,Math.max(1,r)):2;return`<h${o} class="topic-map-heading">${h(this.#n("heading"))} <small>(${h(this.#s(t))})</small></h${o}>`}#s(t){let e=this.#c(),r=new Intl.PluralRules(e).select(t)==="one"?"page":"pages";return this.#n(r).replaceAll("{count}",new Intl.NumberFormat(e).format(t))}#a(){this.querySelector(":scope > [data-topic-map-error]")?.remove();let t=document.createElement("p");t.setAttribute("data-topic-map-error",""),t.textContent=this.#n("error"),this.prepend(t)}#n(t){return this.getAttribute(`data-label-${t}`)||T[t]}#c(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};async function C(i){try{let t=await fetch(i);if(!t.ok)throw new Error(`status ${t.status}`);return{data:await t.json()}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function M(i){return typeof i?.url=="string"&&i.url?i.url:i}function E(i){return i==null?[]:Array.isArray(i)?i:[i]}function h(i){return String(i??"").replace(/[&<>]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[t])}function v(i){return String(i??"").replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}k("topic-map",A);export{A as TopicMap,_ as buildTopicGraph,x as safeHref};
7
7
  //# sourceMappingURL=topic-map.js.map
@@ -1,2 +1,2 @@
1
- var M=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function y(i,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=v.get(i);if(customElements.get(i)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(i,s),customElements.define(i,t)}var m=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,s){t.addEventListener(e,n,s),this.#e.push(()=>t.removeEventListener(e,n,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let s=`--${t}`;e?n.add(s):n.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var k={form:"Filter pages",provenance:"How was it made",review:"Review",status:"Status",signed:"Has signature",yes:"Yes",no:"No",clear:"Clear all",page:"{count} of {total} page",pages:"{count} of {total} pages","has-signature":"has signature",error:"Pages could not be loaded.","no-source":"No data source set."},w=["provenance","review","status","signed"];function x(i){let t=String(i??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://trust-filter.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function A(i){return String(i??"").split(/\s+/).filter(Boolean)}function E(i,t){if(t.provenance?.size&&!A(i.provenance).some(e=>t.provenance.has(e))||t.review?.size&&!t.review.has(i.review)||t.status?.size&&!t.status.has(i.status))return!1;if(t.signed?.size===1){let e=t.signed.has("yes");if(!!i.signed!==e)return!1}return!0}var b=class extends m{#e=[];#t=g();#n=0;setup(){let t=++this.#n;this.#t=g();let e=this.getAttribute("data-lens-src")||this.getAttribute("src");if(!e){this.#a(this.#r("no-source"));return}this.#c(e,t)}teardown(){this.#n++}async#c(t,e){let n;try{let r=await fetch(t);if(!r.ok)throw new Error(`status ${r.status}`);n=await r.json()}catch(r){if(e!==this.#n)return;console.warn(`[trust-filter] could not load ${t}:`,r),this.#a(this.#r("error"));return}if(e!==this.#n)return;let s=Array.isArray(n)?n:n?.pages;this.#e=Array.isArray(s)?s.filter(r=>r&&typeof r=="object"):[],this.#l(),this.#i()}#l(){let t={provenance:this.#s("provenance"),review:this.#s("review"),status:this.#s("status"),signed:["yes","no"]},e=document.createElement("form");e.setAttribute("data-trust-filter-controls",""),e.setAttribute("aria-label",this.#r("form"));for(let l of w){if(t[l].length===0)continue;let c=document.createElement("fieldset");c.dataset.dim=l;let u=document.createElement("legend");u.textContent=this.#r(l),c.append(u);for(let o of t[l]){let d=document.createElement("label"),f=document.createElement("input");f.type="checkbox",f.dataset.dim=l,f.value=o;let p=document.createElement("span");p.textContent=l==="signed"?this.#r(o):$(o),d.append(f," ",p),c.append(d)}e.append(c)}let n=document.createElement("button");n.type="reset",n.className="ghost",n.textContent=this.#r("clear"),e.append(n);let s=document.createElement("output");s.setAttribute("data-trust-filter-count",""),s.setAttribute("aria-live","polite");let r=document.createElement("ul");r.setAttribute("data-trust-filter-results",""),this.replaceChildren(e,s,r),e.addEventListener("change",l=>{let c=l.target;if(!c?.matches('input[type="checkbox"]'))return;let u=this.#t[c.dataset.dim||""];u&&(c.checked?u.add(c.value):u.delete(c.value),this.#i(),this.#o())}),e.addEventListener("reset",()=>{this.#t=g(),this.#i(),this.#o()})}#s(t){let e=new Set;for(let n of this.#e){let s=n[t];if(!(!s||typeof s!="string"))if(t==="provenance")for(let r of A(s))e.add(r);else e.add(s)}return[...e].sort()}#i(){let t=this.querySelector("[data-trust-filter-count]"),e=this.querySelector("[data-trust-filter-results]");if(!t||!e)return;let n=this.#e.filter(o=>E(o,this.#t)),s=this.#u(),r=this.#e.length,l=new Intl.NumberFormat(s),c=new Intl.PluralRules(s).select(r)==="one"?"page":"pages";t.textContent=this.#r(c).replaceAll("{count}",l.format(n.length)).replaceAll("{total}",l.format(r));let u=n.map(o=>{let d=document.createElement("li"),f=String(o.title||o.url||""),p=x(o.url);if(p){let a=document.createElement("a");a.href=p,a.textContent=f,d.append(a)}else d.append(f);let h=[];if(typeof o.provenance=="string"&&o.provenance){let a=document.createElement("span");a.className="trust-filter-prov",a.dataset.provenance=o.provenance,a.textContent=o.provenance,h.push(a)}if(o.review&&o.review!=="unreviewed"&&h.push(String(o.review)),o.status&&o.status!=="published"&&h.push(String(o.status)),o.signed){let a=document.createElement("span");a.className="trust-filter-signature",a.textContent=this.#r("has-signature"),h.push(a)}if(h.length){let a=document.createElement("small");h.forEach((S,C)=>{C&&a.append(" \xB7 "),a.append(S)}),d.append(a)}return d});e.replaceChildren(...u),e.hidden=u.length===0}#o(){let t={};for(let[n,s]of Object.entries(this.#t))t[n]=[...s];let e=this.#e.filter(n=>E(n,this.#t)).length;this.dispatchEvent(new CustomEvent("trust-filter:change",{detail:{selected:t,count:e},bubbles:!0}))}#a(t){let e=document.createElement("p");e.setAttribute("data-trust-filter-error",""),e.textContent=t,this.replaceChildren(e)}#r(t){return this.getAttribute(`data-label-${t}`)||k[t]}#u(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};function g(){return Object.fromEntries(w.map(i=>[i,new Set]))}function $(i){return String(i).replace(/-/g," ")}y("trust-filter",b);export{b as TrustFilter,E as matchesSelection,x as safeHref};
1
+ var P=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function y(o,t,e={}){let r=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=v.get(o);if(customElements.get(o)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(o,s),customElements.define(o,t)}var m=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,s){t.addEventListener(e,r,s),this.#e.push(()=>t.removeEventListener(e,r,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let s=`--${t}`;e?r.add(s):r.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var C={form:"Filter pages",provenance:"How was it made",review:"Review",status:"Status",signed:"Has signature",yes:"Yes",no:"No",clear:"Clear all",page:"{count} of {total} page",pages:"{count} of {total} pages","has-signature":"has signature",error:"Pages could not be loaded.","no-source":"No data source set."},w=["provenance","review","status","signed"];function x(o){let t=String(o??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://trust-filter.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function S(o){return String(o??"").split(/\s+/).filter(Boolean)}function E(o,t){if(t.provenance?.size&&!S(o.provenance).some(e=>t.provenance.has(e))||t.review?.size&&!t.review.has(o.review)||t.status?.size&&!t.status.has(o.status))return!1;if(t.signed?.size===1){let e=t.signed.has("yes");if(!!o.signed!==e)return!1}return!0}var g=class extends m{#e=[];#t=b();#r=0;setup(){let t=++this.#r;this.#t=b();let e=this.getAttribute("data-lens-src")||this.getAttribute("src");if(!e){this.#a(this.#n("no-source"));return}this.#c(e,t)}teardown(){this.#r++}async#c(t,e){let r;try{let n=await fetch(t);if(!n.ok)throw new Error(`status ${n.status}`);r=await n.json()}catch(n){if(e!==this.#r)return;console.warn(`[trust-filter] could not load ${t}:`,n),this.#a(this.#n("error"));return}if(e!==this.#r)return;let s=Array.isArray(r)?r:r?.pages;this.#e=Array.isArray(s)?s.filter(n=>n&&typeof n=="object"):[],this.#u(),this.#o()}#u(){let t={provenance:this.#s("provenance"),review:this.#s("review"),status:this.#s("status"),signed:["yes","no"]},e=document.createElement("form");e.setAttribute("data-trust-filter-controls",""),e.setAttribute("aria-label",this.#n("form"));for(let u of w){if(t[u].length===0)continue;let c=document.createElement("fieldset");c.dataset.dim=u;let l=document.createElement("legend");l.textContent=this.#n(u),c.append(l);for(let i of t[u]){let d=document.createElement("label"),f=document.createElement("input");f.type="checkbox",f.dataset.dim=u,f.value=i;let p=document.createElement("span");p.textContent=u==="signed"?this.#n(i):k(i),d.append(f," ",p),c.append(d)}e.append(c)}let r=document.createElement("button");r.type="reset",r.className="ghost",r.textContent=this.#n("clear"),e.append(r);let s=document.createElement("output");s.setAttribute("data-trust-filter-count",""),s.setAttribute("aria-live","polite");let n=document.createElement("ul");n.setAttribute("data-trust-filter-results",""),this.replaceChildren(e,s,n),e.addEventListener("change",u=>{let c=u.target;if(!c?.matches('input[type="checkbox"]'))return;let l=this.#t[c.dataset.dim||""];l&&(c.checked?l.add(c.value):l.delete(c.value),this.#o(),this.#i())}),e.addEventListener("reset",()=>{this.#t=b(),this.#o(),this.#i()})}#s(t){let e=new Set;for(let r of this.#e){let s=r[t];if(!(!s||typeof s!="string"))if(t==="provenance")for(let n of S(s))e.add(n);else e.add(s)}return[...e].sort()}#o(){let t=this.querySelector("[data-trust-filter-count]"),e=this.querySelector("[data-trust-filter-results]");if(!t||!e)return;let r=this.#e.filter(i=>E(i,this.#t)),s=this.#l(),n=this.#e.length,u=new Intl.NumberFormat(s),c=new Intl.PluralRules(s).select(n)==="one"?"page":"pages";t.textContent=this.#n(c).replaceAll("{count}",u.format(r.length)).replaceAll("{total}",u.format(n));let l=r.map(i=>{let d=document.createElement("li"),f=String(i.title||i.url||""),p=x(i.url);if(p){let a=document.createElement("a");a.href=p,a.textContent=f,d.append(a)}else d.append(f);let h=[];if(typeof i.provenance=="string"&&i.provenance){let a=document.createElement("span");a.className="trust-filter-prov",a.dataset.provenance=i.provenance,a.textContent=i.provenance,h.push(a)}if(i.review&&i.review!=="unreviewed"&&h.push(String(i.review)),i.status&&i.status!=="published"&&h.push(String(i.status)),i.signed){let a=document.createElement("span");a.className="trust-filter-signature",a.textContent=this.#n("has-signature"),h.push(a)}if(h.length){let a=document.createElement("small");h.forEach((A,$)=>{$&&a.append(" \xB7 "),a.append(A)}),d.append(a)}return d});e.replaceChildren(...l),e.hidden=l.length===0}#i(){let t={};for(let[r,s]of Object.entries(this.#t))t[r]=[...s];let e=this.#e.filter(r=>E(r,this.#t)).length;this.dispatchEvent(new CustomEvent("trust-filter:change",{detail:{selected:t,count:e},bubbles:!0}))}#a(t){let e=document.createElement("p");e.setAttribute("data-trust-filter-error",""),e.textContent=t,this.replaceChildren(e)}#n(t){return this.getAttribute(`data-label-${t}`)||C[t]}#l(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};function b(){return Object.fromEntries(w.map(o=>[o,new Set]))}function k(o){return String(o).replace(/-/g," ")}y("trust-filter",g);export{g as TrustFilter,E as matchesSelection,x as safeHref};
2
2
  //# sourceMappingURL=trust-filter.js.map
@@ -1,7 +1,7 @@
1
- var Tt=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function m(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=$.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(s,n),customElements.define(s,t)}var p=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#i||(this.#i=t)}#e(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function L(s){return B(s&&s.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function B(s,t="en-US"){try{if(s)return Intl.getCanonicalLocales(s),s}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var j="http://www.w3.org/1999/xhtml",y="http://www.w3.org/2000/svg",H="http://www.w3.org/1998/Math/MathML",W=new Set([j,y,H]),A="user-content-",z=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),M=new Set(["title","desc"]),G=new Set(["animate","set","animatemotion","animatetransform"]),J=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),Y=new Set(["src","poster","srcset"]),K=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),X=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),Z=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),Q={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},tt=new Set(["social-embed","youtube-player","geo-map"]),et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],it=new Set(["audio-player","video-player","image-map","brand-mark"]);function nt(s){return String(s).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function g(s,t=!1){let e=nt(s);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(n=>n.startsWith("data:")).some(n=>!/^data:(image|audio|video|font)\//.test(n)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function I(s){let t=String(s).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var st=s=>String(s.localName||s.tagName||"").toLowerCase(),rt=s=>s.startsWith(A)?s:A+s;function ot(s,t){if(z.has(t))return!0;let e=s.namespaceURI;return!!(e&&!W.has(e)||t==="title"&&e!==y||M.has(t)&&e===y&&s.children?.length||G.has(t)&&(s.getAttribute("attributeName")||s.getAttribute("attributename")||"").toLowerCase().includes("href"))}function at(s,t){for(let e of[...s.attributes]){let i=e.name.toLowerCase();if(i.startsWith("on")||K.has(i)||!t.keepIds&&X.has(i)){s.removeAttribute(e.name);continue}if(i==="style"){(!t.keepStyle||I(e.value))&&s.removeAttribute(e.name);continue}if((i==="id"||i==="name")&&!t.keepIds){let n=rt(e.value);i==="id"?t.ids.set(e.value,n):t.ids.set(`name:${e.value}`,n),s.setAttribute(e.name,n);continue}if(J.has(i)||i.endsWith(":href")){g(e.value,!1)&&s.removeAttribute(e.name);continue}Y.has(i)&&g(e.value,!0)&&s.removeAttribute(e.name)}}function ct(s,t){let e=(s.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&s.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&s.setAttribute("type","button")}function lt(s,t){for(let e of s)for(let i of[...e.attributes]){let n=i.name.toLowerCase(),r=i.value;if((n==="href"||n.endsWith(":href"))&&r.startsWith("#")){let o=ht(r.slice(1));t.has(o)&&e.setAttribute(i.name,`#${t.get(o)}`)}else if(n==="usemap"&&r.startsWith("#")){let o=t.get(`name:${r.slice(1)}`);o?e.setAttribute(i.name,`#${o}`):e.removeAttribute(i.name)}else if(Z.has(n)){let o=r.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(A)?a:null)).filter(Boolean);o.length?e.setAttribute(i.name,o.join(" ")):e.removeAttribute(i.name)}else r.includes("url(#")&&e.setAttribute(i.name,r.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function ht(s){try{return decodeURIComponent(s)}catch{return s}}function R(s){let t=s.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&R(e)}function O(s,t){R(s);let e=[...s.querySelectorAll("*")];t.includeRoot&&e.unshift(s);let i=new Map,n=[],r={...t,ids:i};for(let o of e){if(!dt(o,s))continue;let a=st(o);if(t.svgOnly&&(M.has(a)||a==="style")){if(a==="style"&&I(o.textContent||"")){o.remove();continue}}else if(ot(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&tt.has(a)){ut(o);continue}if(a==="template"){let h=o.content;h&&O(h,{...t,includeRoot:!1})}at(o,r),t.keepIds||ct(o,a);let c=Q[a];if(c)for(let h of c)o.removeAttribute(h);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!it.has(a))for(let h of et)o.removeAttribute(h);n.push(o)}!t.keepIds&&i.size&&lt(n,i)}function ut(s){let t=s.parentNode;if(t){for(let e of[...s.childNodes])t.insertBefore(e,s);s.remove()}}function dt(s,t){let e=s;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function P(s,t={}){let e=document.createElement("template");return s&&typeof s=="string"&&(e.innerHTML=s,O(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var v=CSS.supports("anchor-name","--x"),ft=CSS.supports("position-area","bottom"),pt=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),mt=["auto","manual","hint"];function bt(s){let t=mt.includes(s||"")?s:"auto";return t==="hint"&&!pt?"auto":t}var gt=["top","bottom","left","right","inset-inline-start","inset-inline-end"],vt=["position","top","left","right","bottom","margin"],D=8,wt=0,yt=0;function _(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var E=class extends p{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#i=null;#e=`--pop-over-anchor-${++yt}`;#n=!1;#c=!1;#s=!1;setup(){if(this.id||(this.id=`pop-over-${++wt}`),(!this.hasAttribute("popover")||this.#n)&&this.#a(),this.#u(),this.#l(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!v&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#r()})}),!v){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#r()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#c&&(gt.forEach(t=>this.style.removeProperty(t)),this.#c=!1),this.#s&&(vt.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#n=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=bt(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#n=!0}show(){this.matches(":popover-open")||(this.showPopover(),!v&&this.#t&&this.matches(":popover-open")&&this.#r())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#u(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#l(){if(!this.#t||!v)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=_(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#e)||i.push(this.#e),t.style.setProperty("anchor-name",i.join(", ")),this.#i=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),ft||this.#h(this.dataset.position||"bottom")}#d(){if(this.#t&&this.#i){let t=_(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#i);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#i=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([a,c])=>this.style.setProperty(a,c)),this.#c=!0}#r(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#b(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#s=!0;let o=this.offsetWidth,a=this.offsetHeight,c=e.split("-")[0];["top","bottom","left","right"].includes(c)||(c="bottom");let h={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},l={top:"bottom",bottom:"top",left:"right",right:"left"},u=c==="top"||c==="bottom"?a:o;h[c]<u&&h[l[c]]>h[c]&&(c=l[c]);let d,f;switch(c){case"top":d=t.top-a-i,f=t.left;break;case"left":d=t.top,f=t.left-o-i;break;case"right":d=t.top,f=t.right+i;break;default:d=t.bottom+i,f=t.left;break}if(c==="top"||c==="bottom"){let w=getComputedStyle(this).direction==="rtl";f=e.endsWith("-end")!==w?t.right-o:t.left}else e.endsWith("-end")&&(d=t.bottom-a);let T=(w,k,F)=>Math.max(D,Math.min(w,F-k-D));f=T(f,o,n),d=T(d,a,r),this.style.top=`${Math.round(d)}px`,this.style.left=`${Math.round(f)}px`}#b(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};m("pop-over",E);var S=["tracking","final","original"],At={tracking:"Tracking",final:"Final",original:"Original"},C=class extends p{static observedAttributes=["view","author","datetime","controls"];setup(){this.#t(),this.listen(this,"click",this.#s)}attributeChangedCallback(t,e,i){!this.hasAttribute("data-upgraded")||e===i||(t==="view"?this.#c():this.#t())}#t(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#i(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#e(t)),this.prepend(...e),this.#c()}#i(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let i=document.createElement("p");if(i.setAttribute("data-change-caption",""),i.append(t?`Changes by ${t}`:"Changes"),e){i.append(t?", ":" from ");let n=document.createElement("time");n.setAttribute("datetime",e),n.textContent=this.#n(e),i.append(n)}return i}#e(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let i=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${i}`);for(let n of S){let r=document.createElement("button");r.type="button",r.dataset.action=n,r.textContent=At[n],e.append(r)}return e}#n(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let i=this.closest("[lang]")?.lang||void 0,n=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(i,{dateStyle:"medium",...n?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#c(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#s=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let i=e.dataset.action;!i||!S.includes(i)||i!==this.view&&(this.#a(i),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:i},bubbles:!0})))};#a(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#c()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!S.includes(t)||this.view===t||(this.#a(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};m("change-set",C);function U(s,t){let e=String(s??"").split(`
2
- `),i=String(t??"").split(`
3
- `),n=e.length,r=i.length,o=Array.from({length:n+1},()=>new Array(r+1).fill(0));for(let l=1;l<=n;l++)for(let u=1;u<=r;u++)e[l-1]===i[u-1]?o[l][u]=o[l-1][u-1]+1:o[l][u]=Math.max(o[l-1][u],o[l][u-1]);let a=[],c=n,h=r;for(;c>0||h>0;)c>0&&h>0&&e[c-1]===i[h-1]?(a.unshift({type:"eq",text:e[c-1]}),c-=1,h-=1):h>0&&(c===0||o[c][h-1]>=o[c-1][h])?(a.unshift({type:"add",text:i[h-1]}),h-=1):(a.unshift({type:"del",text:e[c-1]}),c-=1);return a}function q(s){let t=document.createDocumentFragment(),e=document.createElement("pre");e.className="text-diff";for(let i of s)if(i.type==="eq")e.appendChild(document.createTextNode(`${i.text}
4
- `));else if(i.type==="add"){let n=document.createElement("ins");n.textContent=`${i.text}
5
- `,e.appendChild(n)}else if(i.type==="del"){let n=document.createElement("del");n.textContent=`${i.text}
6
- `,e.appendChild(n)}return t.appendChild(e),t}var Et={trigger:"Version",loading:"Loading\u2026","loading-versions":"Loading versions\u2026",empty:"No versions available.","heading-releases":"Versions","heading-history":"History",archived:"archived",draft:"draft",current:"current",by:"by {author}",changelog:"Changelog","changelog-for":"{version} changelog","banner-label":"Archived version notice",banner:"You\u2019re viewing {version} (archived).","banner-latest":"Latest: {version}",diff:"Diff: {from} \u2192 {to}"},St=/^\d{4}-\d{2}-\d{2}$/,x=0,N=class extends p{static observedAttributes=["data-versions","data-src","data-mode","aria-label"];#t=[];#i=null;#e;#n;#c;#s;#a=null;#u=null;#l=null;#d=null;#h=null;setup(){this.#w(),this.#D(),this.#_(),this.#U(),this.#f(),this.#T(),this.#C(),this.hasAttribute("data-page-info-target")&&this.#P(),this.#t.length===0&&(this.getAttribute("data-src")||this.#E())&&this.#S()}teardown(){this.#u?.disconnect(),this.#u=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null,this.#a?.remove(),this.#a=null,this.#h=null}attributeChangedCallback(t,e,i){!this.isConnected||e===i||!this.#e||(t==="data-versions"&&this.refresh(),t==="data-src"&&this.#S(),(t==="data-mode"||t==="aria-label")&&this.#p())}#r(t,e={}){let i=this.getAttribute(`data-label-${t}`)??Et[t]??t;for(let[n,r]of Object.entries(e))i=i.replaceAll(`{${n}}`,String(r));return i}#b(){return this.getAttribute("aria-label")||this.#r("trigger")}#v(){return this.#r(this.#O()==="history"?"heading-history":"heading-releases")}#w(){let t=null,e=this.getAttribute("data-versions");if(e)try{t=JSON.parse(e)}catch(i){this.#o("Failed to parse data-versions JSON",{error:i})}if(!t){let i=this.querySelector(':scope > script[type="application/json"][data-versions]');if(i?.textContent.trim())try{t=JSON.parse(i.textContent)}catch(n){this.#o("Failed to parse <script data-versions> JSON",{error:n})}}this.#t=this.#y(t),this.#i=this.#A()}#y(t){if(!Array.isArray(t))return[];let e=[];for(let i of t){if(!i||typeof i.id!="string")continue;let n={...i};if(n.url!=null&&!b(n.url)){this.#o(`Dropped version "${n.id}": unsafe url.`,{entry:n});continue}n.versionUrl!=null&&!b(n.versionUrl)&&delete n.versionUrl,e.push(n)}return e}#A(){if(this.#t.length===0)return null;let t=this.#t.find(i=>i.current===!0);if(t)return t.id;let e=document.querySelector('meta[itemprop="version"]')?.getAttribute("content");if(e){let i=this.#t.find(n=>n.id===e);if(i)return i.id}return this.#t[0].id}#O(){let t=this.getAttribute("data-mode");return t==="releases"||t==="history"?t:new Set(this.#t.map(i=>i.url).filter(Boolean)).size>1?"releases":"history"}#E(){return document.querySelector('meta[name="vb:versions-manifest"]')?.getAttribute("content")}async#S(){let t=this.getAttribute("data-src")||this.#E();if(!t)return;this.#h=t,this.#f();let e;try{let i=await fetch(t,{credentials:"same-origin"});if(!i.ok)throw new Error(`Fetch failed (${i.status}) for ${t}`);e=await i.json()}catch(i){if(this.#h!==t)return;this.#h=null,this.#o(`Failed to load versions manifest: ${i.message}`,{error:i}),this.#f();return}if(this.#h===t){if(this.#h=null,!Array.isArray(e)){this.#o(`Manifest is not a JSON array: ${t}`),this.#f();return}this.#t=this.#y(e),this.#i=this.#A(),this.#p()}}#p(){this.#f(),this.#T(),this.#C(),this.#a&&this.#N()}#C(){if(this.#d?.remove(),this.#d=null,!this.hasAttribute("data-banner"))return;let t=this.#t.find(o=>o.id===this.#i),e=this.#t.find(o=>!o.archived&&!o.draft);if(!t?.archived||!e||e.id===t.id)return;let i=document.createElement("aside");i.className="version-switcher-banner",i.setAttribute("aria-label",this.#r("banner-label"));let n=document.createElement("p");n.className="version-switcher-banner-text",n.setAttribute("role","status"),i.append(n),this.prepend(i),this.#d=i;let r=()=>{if(this.#d!==i)return;n.textContent=this.#r("banner",{version:t.label||t.id});let o=this.#r("banner-latest",{version:e.label||e.id});if(e.url&&b(e.url)){let a=document.createElement("a");a.className="version-switcher-banner-link",a.href=e.url,a.textContent=o,i.append(a)}else{let a=document.createElement("span");a.className="version-switcher-banner-latest",a.textContent=o,i.append(a)}};requestAnimationFrame(()=>requestAnimationFrame(r))}#P(){let t=this.getAttribute("data-page-info-target");if(!t)return;let e=document.getElementById(t);if(!e||e.localName!=="page-info"){this.#o(`data-page-info-target: no <page-info id="${t}"> found.`);return}this.#e.hidden=!0;let i=()=>{let r=e.querySelector(".page-info-panel");return r?(this.#N(r),!0):!1};if(i())return;let n=new MutationObserver(()=>{i()&&this.#x()});n.observe(e,{childList:!0,subtree:!0}),this.#u=n,this.#l=setTimeout(()=>{this.#l=null,!this.#a&&(this.#x(),this.#o(`<page-info id="${t}"> never rendered .page-info-panel within 5s.`))},5e3)}#x(){this.#u?.disconnect(),this.#u=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null}#N(t){let e=t||this.#a?.parentNode;if(!e)return;let i=this.#a;if(!i){i=document.createElement("section"),i.className="version-switcher-panel-section";let r=document.createElement("h3");r.className="version-switcher-panel-heading",r.id=`version-switcher-panel-${++x}`,i.setAttribute("aria-labelledby",r.id);let o=document.createElement("ul");o.className="version-switcher-panel-list",i.append(r,o),e.appendChild(i),this.#a=i,this.listen(o,"click",this.#$)}i.querySelector(".version-switcher-panel-heading").textContent=this.#v();let n=i.querySelector("ul.version-switcher-panel-list");this.#k(n,this.#h?"loading-versions":"empty")}#D(){this.#e?.parentNode!==this&&(this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="version-switcher-trigger",this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.appendChild(this.#e))}#_(){if(this.#n?.parentNode===this)return;let t=`version-switcher-${++x}`;this.#e.setAttribute("popovertarget",t),this.#n=document.createElement("pop-over"),this.#n.id=t,this.#n.className="version-switcher-popover",this.#n.dataset.position="bottom-end",this.#n.setAttribute("role","dialog"),this.#c=document.createElement("h3"),this.#c.className="version-switcher-heading",this.#s=document.createElement("ul"),this.#s.className="version-switcher-list",this.#s.setAttribute("role","list"),this.#n.append(this.#c,this.#s),this.appendChild(this.#n)}#U(){!this.#n||!this.#s||(this.listen(this.#n,"pop-over:show",()=>{this.#e.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("version-switcher:open",{bubbles:!0}));let t=this.#s.querySelector('[data-current="true"] button')||this.#s.querySelector("button");requestAnimationFrame(()=>t?.focus())}),this.listen(this.#n,"pop-over:hide",()=>{this.#e.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("version-switcher:close",{bubbles:!0}))}),this.listen(this.#s,"keydown",this.#V),this.listen(this.#s,"click",this.#$))}#f(){if(!this.#e)return;let t=this.#t.find(a=>a.id===this.#i),e=!!this.#h&&this.#t.length===0,i=e?this.#r("loading"):t?.label||t?.id||this.#r("trigger"),n=document.createElement("span");n.className="version-switcher-trigger-label",n.textContent=i;let r=document.createElement("span");r.className="version-switcher-trigger-chevron",r.setAttribute("aria-hidden","true"),r.textContent="\u25BE",this.#e.replaceChildren(n,r);let o=this.#b();this.#e.setAttribute("aria-label",i===o?o:`${o}: ${i}`),this.#n?.setAttribute("aria-label",o),this.#t.length===0?(this.#e.disabled=!0,this.#e.setAttribute("title",this.#r(e?"loading-versions":"empty"))):(this.#e.disabled=!1,this.#e.removeAttribute("title"))}#T(){this.#s&&(this.#c.textContent=this.#v(),this.#k(this.#s,"empty"))}#k(t,e){if(t.replaceChildren(),this.#t.length===0){let i=document.createElement("li");i.className="version-switcher-empty",i.textContent=this.#r(e),t.appendChild(i);return}for(let i of this.#t)t.appendChild(this.#q(i))}#q(t){let e=t.id===this.#i,i=t.label||t.id,n=document.createElement("li");n.setAttribute("role","listitem"),n.className="version-switcher-item",n.dataset.versionId=t.id,e&&(n.dataset.current="true"),t.archived&&(n.dataset.archived=""),t.draft&&(n.dataset.draft="");let r=document.createElement("button");r.type="button",r.className="version-switcher-entry",r.setAttribute("aria-current",e?"true":"false");let o=document.createElement("span");o.className="version-switcher-entry-label",o.append(i);let a=l=>{let u=document.createElement("span");u.className=`version-switcher-badge version-switcher-badge-${l}`,u.textContent=this.#r(l),o.append(" ",u)};if(t.archived&&a("archived"),t.draft&&a("draft"),e&&a("current"),r.appendChild(o),t.date){let l=document.createElement("time");l.className="version-switcher-entry-date",l.setAttribute("datetime",t.date);let u=L(this),d=xt(t.date,u);d&&(l.title=d),l.textContent=Nt(t.date,u)||d||t.date,r.append(" ",l)}n.appendChild(r);let c=[],h=`${this.#n?.id||"version-switcher"}-${Ct(t.id)}-${++x}`;if(t.author){let l=document.createElement("span");l.className="version-switcher-entry-author",l.id=`${h}-author`,l.textContent=this.#r("by",{author:t.author}),n.appendChild(l),c.push(l.id)}if(t.summary){let l=document.createElement("span");l.className="version-switcher-entry-summary",l.id=`${h}-summary`,l.textContent=t.summary,n.appendChild(l),c.push(l.id)}if(c.length&&r.setAttribute("aria-describedby",c.join(" ")),t.versionUrl&&b(t.versionUrl)){let l=document.createElement("a");l.className="version-switcher-entry-changelog",l.href=t.versionUrl,l.setAttribute("aria-label",this.#r("changelog-for",{version:i})),l.append(this.#r("changelog"));let u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.textContent=" \u2192",l.append(u),n.appendChild(l)}return n}#$=t=>{let e=t.target.closest?.("button.version-switcher-entry");if(!e)return;let i=e.closest("[data-version-id]")?.dataset.versionId,n=this.#t.find(r=>r.id===i);n&&this.#F(n)};#V=t=>{let e=[...this.#s.querySelectorAll("button.version-switcher-entry")],i=e.indexOf(document.activeElement);if(i===-1)return;let n=i;switch(t.key){case"ArrowDown":t.preventDefault(),n=Math.min(e.length-1,i+1);break;case"ArrowUp":t.preventDefault(),n=Math.max(0,i-1);break;case"Home":t.preventDefault(),n=0;break;case"End":t.preventDefault(),n=e.length-1;break;default:return}e[n]?.focus()};#F(t){this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:t}})),this.#L(t)}#L(t){let e=this.getAttribute("data-action")||"navigate";if(e==="navigate")return this.#M(t);if(e==="swap")return this.#B(t);if(e==="diff")return this.#j(t);this.#o(`Unknown action "${e}"; falling back to navigate.`),this.#M(t)}#M(t){if(!t?.url||!b(t.url)){this.#o("Cannot navigate: entry has no safe url.",{entry:t});return}let e=new URL(t.url,location.href);if(e.href===location.href){this.#o("Cannot navigate: entry url is the current page.",{entry:t});return}let i=new CustomEvent("version-switcher:before-navigate",{bubbles:!0,cancelable:!0,detail:{entry:t}});this.dispatchEvent(i)&&(this.closePicker(),location.href=e.href)}#m(){return this.getAttribute("data-versioned-region")||"[data-versioned], main"}#g(t){return t.querySelector(this.#m())}#I(t,e){if(!t?.url||!b(t.url))return this.#o(`Cannot ${e}: entry has no safe url.`,{entry:t}),null;let i=new URL(t.url,location.href);return i.origin!==location.origin?(this.#o(`Cannot ${e}: ${i.href} is not same-origin.`,{entry:t}),null):i}async#R(t){let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw new Error(`Fetch failed (${e.status}) for ${t.href}`);let i=await e.text(),n=new DOMParser().parseFromString(i,"text/html"),r=this.#g(n);if(!r)throw new Error(`No versioned region (${this.#m()}) found in ${t.href}`);return r}async#B(t){let e=this.#I(t,"swap");if(!e)return;let i=this.#g(document);if(!i){this.#o(`No versioned region (${this.#m()}) on this page to swap.`,{entry:t});return}let n=new CustomEvent("version-switcher:before-swap",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(n))return;this.closePicker();let r=this.#i,o=async()=>{try{let c=await this.#R(e);i.replaceChildren(P(c.innerHTML,{keepIds:!0,keepStyle:!0}))}catch(c){throw this.#o(c.message,{entry:t,error:c}),c}};try{if("startViewTransition"in document){let c;try{c=document.startViewTransition({update:o,types:["version-swap"]})}catch{c=document.startViewTransition(o)}await c.updateCallbackDone}else await o()}catch{return}let a=document.querySelector('meta[itemprop="version"]');a||(a=document.createElement("meta"),a.setAttribute("itemprop","version"),document.head.appendChild(a)),a.setAttribute("content",t.id),this.#i=t.id,this.#p(),this.dispatchEvent(new CustomEvent("version-switcher:swap",{bubbles:!0,detail:{entry:t,previousId:r}}))}async#j(t){let e=this.#I(t,"diff");if(!e)return;let i=this.#g(document);if(!i){this.#o(`No versioned region (${this.#m()}) on this page to diff against.`,{entry:t});return}if(t.id===this.#i){this.#o("Cannot diff against the current version.",{entry:t});return}let n=new CustomEvent("version-switcher:before-diff",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(n))return;this.closePicker();let r;try{r=await this.#R(e)}catch(h){this.#o(h.message,{entry:t,error:h});return}document.querySelectorAll(".version-switcher-diff-host").forEach(h=>h.remove());let o=U(i.textContent.trim(),r.textContent.trim()),a=document.createElement("change-set");a.classList.add("version-switcher-diff-host"),a.dataset.versionFrom=this.#i??"",a.dataset.versionTo=t.id,a.dataset.diffLabel=this.#r("diff",{from:this.#i??"",to:t.id}),a.appendChild(q(o)),(this.getAttribute("data-diff-position")||"before")==="after"?i.parentNode.insertBefore(a,i.nextSibling):i.parentNode.insertBefore(a,i),a.setAttribute("tabindex","-1"),a.focus({preventScroll:!1}),this.dispatchEvent(new CustomEvent("version-switcher:diff",{bubbles:!0,detail:{entry:t,previousId:this.#i,diffElement:a,opCount:o.length}}))}get versions(){return this.#t.slice()}get currentId(){return this.#i}openPicker(){this.#n?.show()}closePicker(){this.#n?.hide()}switchTo(t){let e=this.#t.find(i=>i.id===t);if(!e){this.#o(`switchTo: no entry with id "${t}"`);return}this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:e}})),this.#L(e)}refresh(){this.#w(),!(!this.#e||!this.#s)&&this.#p()}#o(t,e={}){this.dispatchEvent(new CustomEvent("version-switcher:error",{bubbles:!0,detail:{message:t,...e}}))}};function b(s){return typeof s=="string"&&s.trim()!==""&&!g(s,!1)}function Ct(s){return String(s).replace(/[^\w-]/g,"_")}function V(s){let t=new Date(s);return Number.isNaN(t.getTime())?null:t}function xt(s,t){let e=V(s);if(!e)return null;let i=St.test(s)?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"};try{return new Intl.DateTimeFormat(t,i).format(e)}catch{return e.toISOString()}}function Nt(s,t){let e=V(s);if(!e)return null;let i=(Date.now()-e.getTime())/1e3;if(i<0)return null;let n;try{n=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{n=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}let r=60,o=3600,a=86400,c=2592e3,h=31536e3;return i<r?n.format(0,"second"):i<o?n.format(-Math.floor(i/r),"minute"):i<a?n.format(-Math.floor(i/o),"hour"):i<c?n.format(-Math.floor(i/a),"day"):i<h?n.format(-Math.floor(i/c),"month"):n.format(-Math.floor(i/h),"year")}m("version-switcher",N);export{N as VersionSwitcher};
1
+ var Mt=window.matchMedia("(prefers-reduced-motion: reduce)");var L=new Map;function m(r,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=L.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}L.set(r,i),customElements.define(r,t)}var p=class extends HTMLElement{#t=[];#n;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#n||(this.#n=this.attachInternals());let n=this.#n.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#n||(this.#n=t)}#e(){return this.constructor.formAssociated&&this.#n?this.#n:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function M(r){return B(r&&r.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function B(r,t="en-US"){try{if(r)return Intl.getCanonicalLocales(r),r}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var H="http://www.w3.org/1999/xhtml",y="http://www.w3.org/2000/svg",j="http://www.w3.org/1998/Math/MathML",W=new Set([H,y,j]),E="user-content-",z=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),N=new Set(["title","desc"]),G=new Set(["animate","set","animatemotion","animatetransform"]),J=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),Y=new Set(["src","poster","srcset"]),K=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),X=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),Z=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),Q={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},tt=new Set(["social-embed","youtube-player","geo-map"]),et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],nt=new Set(["audio-player","video-player","image-map","brand-mark"]);function it(r){return String(r).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function g(r,t=!1){let e=it(r);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(i=>i.startsWith("data:")).some(i=>!/^data:(image|audio|video|font)\//.test(i)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function P(r){let t=String(r).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var rt=r=>String(r.localName||r.tagName||"").toLowerCase(),st=r=>r.startsWith(E)?r:E+r;function ot(r,t){if(z.has(t))return!0;let e=r.namespaceURI;return!!(e&&!W.has(e)||t==="title"&&e!==y||N.has(t)&&e===y&&r.children?.length||G.has(t)&&(r.getAttribute("attributeName")||r.getAttribute("attributename")||"").toLowerCase().includes("href"))}function at(r,t){for(let e of[...r.attributes]){let n=e.name.toLowerCase();if(n.startsWith("on")||K.has(n)||!t.keepIds&&X.has(n)){r.removeAttribute(e.name);continue}if(n==="style"){(!t.keepStyle||P(e.value))&&r.removeAttribute(e.name);continue}if((n==="id"||n==="name")&&!t.keepIds){let i=st(e.value);n==="id"?t.ids.set(e.value,i):t.ids.set(`name:${e.value}`,i),r.setAttribute(e.name,i);continue}if(J.has(n)||n.endsWith(":href")){g(e.value,!1)&&r.removeAttribute(e.name);continue}Y.has(n)&&g(e.value,!0)&&r.removeAttribute(e.name)}}function ct(r,t){let e=(r.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&r.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&r.setAttribute("type","button")}function lt(r,t){for(let e of r)for(let n of[...e.attributes]){let i=n.name.toLowerCase(),s=n.value;if((i==="href"||i.endsWith(":href"))&&s.startsWith("#")){let o=ut(s.slice(1));t.has(o)&&e.setAttribute(n.name,`#${t.get(o)}`)}else if(i==="usemap"&&s.startsWith("#")){let o=t.get(`name:${s.slice(1)}`);o?e.setAttribute(n.name,`#${o}`):e.removeAttribute(n.name)}else if(Z.has(i)){let o=s.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(E)?a:null)).filter(Boolean);o.length?e.setAttribute(n.name,o.join(" ")):e.removeAttribute(n.name)}else s.includes("url(#")&&e.setAttribute(n.name,s.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function ut(r){try{return decodeURIComponent(r)}catch{return r}}function I(r){let t=r.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&I(e)}function _(r,t){I(r);let e=[...r.querySelectorAll("*")];t.includeRoot&&e.unshift(r);let n=new Map,i=[],s={...t,ids:n};for(let o of e){if(!dt(o,r))continue;let a=rt(o);if(t.svgOnly&&(N.has(a)||a==="style")){if(a==="style"&&P(o.textContent||"")){o.remove();continue}}else if(ot(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&tt.has(a)){ht(o);continue}if(a==="template"){let u=o.content;u&&_(u,{...t,includeRoot:!1})}at(o,s),t.keepIds||ct(o,a);let c=Q[a];if(c)for(let u of c)o.removeAttribute(u);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!nt.has(a))for(let u of et)o.removeAttribute(u);i.push(o)}!t.keepIds&&n.size&&lt(i,n)}function ht(r){let t=r.parentNode;if(t){for(let e of[...r.childNodes])t.insertBefore(e,r);r.remove()}}function dt(r,t){let e=r;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function R(r,t={}){let e=document.createElement("template");return r&&typeof r=="string"&&(e.innerHTML=r,_(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var v=CSS.supports("anchor-name","--x"),ft=CSS.supports("position-area","bottom"),pt=(()=>{let r=document.createElement("span");return r.setAttribute("popover","hint"),r.popover==="hint"})(),mt=["auto","manual","hint"];function bt(r){let t=mt.includes(r||"")?r:"auto";return t==="hint"&&!pt?"auto":t}var gt=["top","bottom","left","right","inset-inline-start","inset-inline-end"],vt=["position","top","left","right","bottom","margin"],O=8,wt=0,yt=0;function q(r){return!r||r==="none"?[]:r.split(",").map(t=>t.trim()).filter(Boolean)}var A=class extends p{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#n=null;#e=`--pop-over-anchor-${++yt}`;#i=!1;#c=!1;#r=!1;setup(){if(this.id||(this.id=`pop-over-${++wt}`),(!this.hasAttribute("popover")||this.#i)&&this.#a(),this.#h(),this.#l(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!v&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#s()})}),!v){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#s()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#c&&(gt.forEach(t=>this.style.removeProperty(t)),this.#c=!1),this.#r&&(vt.forEach(t=>this.style.removeProperty(t)),this.#r=!1),this.#t=null}attributeChangedCallback(t,e,n){if(e!==n){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#i=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=bt(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#i=!0}show(){this.matches(":popover-open")||(this.showPopover(),!v&&this.#t&&this.matches(":popover-open")&&this.#s())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#h(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#l(){if(!this.#t||!v)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),n=q(e||getComputedStyle(t).getPropertyValue("anchor-name"));n.includes(this.#e)||n.push(this.#e),t.style.setProperty("anchor-name",n.join(", ")),this.#n=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),ft||this.#u(this.dataset.position||"bottom")}#d(){if(this.#t&&this.#n){let t=q(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#n);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#n=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#u(t){let e="var(--_pop-over-offset, var(--size-xs))",n=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},i={top:{bottom:`calc(anchor(top) + ${e})`,...n},bottom:{top:`calc(anchor(bottom) + ${e})`,...n},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],o=i[s]||i.bottom;Object.entries(o).forEach(([a,c])=>this.style.setProperty(a,c)),this.#c=!0}#s(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",n=this.#m(),i=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#r=!0;let o=this.offsetWidth,a=this.offsetHeight,c=e.split("-")[0];["top","bottom","left","right"].includes(c)||(c="bottom");let u={top:t.top-n,bottom:s-t.bottom-n,left:t.left-n,right:i-t.right-n},l={top:"bottom",bottom:"top",left:"right",right:"left"},h=c==="top"||c==="bottom"?a:o;u[c]<h&&u[l[c]]>u[c]&&(c=l[c]);let d,f;switch(c){case"top":d=t.top-a-n,f=t.left;break;case"left":d=t.top,f=t.left-o-n;break;case"right":d=t.top,f=t.right+n;break;default:d=t.bottom+n,f=t.left;break}if(c==="top"||c==="bottom"){let w=getComputedStyle(this).direction==="rtl";f=e.endsWith("-end")!==w?t.right-o:t.left}else e.endsWith("-end")&&(d=t.bottom-a);let $=(w,k,V)=>Math.max(O,Math.min(w,V-k-O));f=$(f,o,i),d=$(d,a,s),this.style.top=`${Math.round(d)}px`,this.style.left=`${Math.round(f)}px`}#m(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};m("pop-over",A);var S=["tracking","final","original"],Et={tracking:"Tracking",final:"Final",original:"Original"},C=class extends p{static observedAttributes=["view","author","datetime","controls"];setup(){this.#t(),this.listen(this,"click",this.#r)}attributeChangedCallback(t,e,n){!this.hasAttribute("data-upgraded")||e===n||(t==="view"?this.#c():this.#t())}#t(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#n(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#e(t)),this.prepend(...e),this.#c()}#n(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let n=document.createElement("p");if(n.setAttribute("data-change-caption",""),n.append(t?`Changes by ${t}`:"Changes"),e){n.append(t?", ":" from ");let i=document.createElement("time");i.setAttribute("datetime",e),i.textContent=this.#i(e),n.append(i)}return n}#e(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let n=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${n}`);for(let i of S){let s=document.createElement("button");s.type="button",s.dataset.action=i,s.textContent=Et[i],e.append(s)}return e}#i(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let n=this.closest("[lang]")?.lang||void 0,i=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(n,{dateStyle:"medium",...i?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#c(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#r=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let n=e.dataset.action;!n||!S.includes(n)||n!==this.view&&(this.#a(n),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:n},bubbles:!0})))};#a(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#c()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!S.includes(t)||this.view===t||(this.#a(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};m("change-set",C);function D(r,t){let e=String(r??"").split(`
2
+ `),n=String(t??"").split(`
3
+ `),i=e.length,s=n.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let l=1;l<=i;l++)for(let h=1;h<=s;h++)e[l-1]===n[h-1]?o[l][h]=o[l-1][h-1]+1:o[l][h]=Math.max(o[l-1][h],o[l][h-1]);let a=[],c=i,u=s;for(;c>0||u>0;)c>0&&u>0&&e[c-1]===n[u-1]?(a.unshift({type:"eq",text:e[c-1]}),c-=1,u-=1):u>0&&(c===0||o[c][u-1]>=o[c-1][u])?(a.unshift({type:"add",text:n[u-1]}),u-=1):(a.unshift({type:"del",text:e[c-1]}),c-=1);return a}function F(r){let t=document.createDocumentFragment(),e=document.createElement("pre");e.className="text-diff";for(let n of r)if(n.type==="eq")e.appendChild(document.createTextNode(`${n.text}
4
+ `));else if(n.type==="add"){let i=document.createElement("ins");i.textContent=`${n.text}
5
+ `,e.appendChild(i)}else if(n.type==="del"){let i=document.createElement("del");i.textContent=`${n.text}
6
+ `,e.appendChild(i)}return t.appendChild(e),t}var At={trigger:"Version",loading:"Loading\u2026","loading-versions":"Loading versions\u2026",empty:"No versions available.","heading-releases":"Versions","heading-history":"History",archived:"archived",draft:"draft",current:"current",by:"by {author}",changelog:"Changelog","changelog-for":"{version} changelog","banner-label":"Archived version notice",banner:"You\u2019re viewing {version} (archived).","banner-latest":"Latest: {version}",diff:"Diff: {from} \u2192 {to}"},St=/^\d{4}-\d{2}-\d{2}$/,x=0,T=class extends p{static observedAttributes=["data-versions","data-src","data-mode","aria-label"];#t=[];#n=null;#e;#i;#c;#r;#a=null;#h=null;#l=null;#d=null;#u=null;setup(){this.#w(),this.#O(),this.#q(),this.#D(),this.#f(),this.#$(),this.#C(),this.hasAttribute("data-page-info-target")&&this.#R(),this.#t.length===0&&(this.getAttribute("data-src")||this.#A())&&this.#S()}teardown(){this.#h?.disconnect(),this.#h=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null,this.#a?.remove(),this.#a=null,this.#u=null}attributeChangedCallback(t,e,n){!this.isConnected||e===n||!this.#e||(t==="data-versions"&&this.refresh(),t==="data-src"&&this.#S(),(t==="data-mode"||t==="aria-label")&&this.#p())}#s(t,e={}){let n=this.getAttribute(`data-label-${t}`)??At[t]??t;for(let[i,s]of Object.entries(e))n=n.replaceAll(`{${i}}`,String(s));return n}#m(){return this.getAttribute("aria-label")||this.#s("trigger")}#v(){return this.#s(this.#_()==="history"?"heading-history":"heading-releases")}#w(){let t=null,e=this.getAttribute("data-versions");if(e)try{t=JSON.parse(e)}catch(n){this.#o("Failed to parse data-versions JSON",{error:n})}if(!t){let n=this.querySelector(':scope > script[type="application/json"][data-versions]');if(n?.textContent.trim())try{t=JSON.parse(n.textContent)}catch(i){this.#o("Failed to parse <script data-versions> JSON",{error:i})}}this.#t=this.#y(t),this.#n=this.#E()}#y(t){if(!Array.isArray(t))return[];let e=[];for(let n of t){if(!n||typeof n.id!="string")continue;let i={...n};if(i.url!=null&&!b(i.url)){this.#o(`Dropped version "${i.id}": unsafe url.`,{entry:i});continue}i.versionUrl!=null&&!b(i.versionUrl)&&delete i.versionUrl,e.push(i)}return e}#E(){if(this.#t.length===0)return null;let t=this.#t.find(n=>n.current===!0);if(t)return t.id;let e=document.querySelector('meta[itemprop="version"]')?.getAttribute("content");if(e){let n=this.#t.find(i=>i.id===e);if(n)return n.id}return this.#t[0].id}#_(){let t=this.getAttribute("data-mode");return t==="releases"||t==="history"?t:new Set(this.#t.map(n=>n.url).filter(Boolean)).size>1?"releases":"history"}#A(){return document.querySelector('meta[name="vb:versions-manifest"]')?.getAttribute("content")}async#S(){let t=this.getAttribute("data-src")||this.#A();if(!t)return;this.#u=t,this.#f();let e;try{let n=await fetch(t,{credentials:"same-origin"});if(!n.ok)throw new Error(`Fetch failed (${n.status}) for ${t}`);e=await n.json()}catch(n){if(this.#u!==t)return;this.#u=null,this.#o(`Failed to load versions manifest: ${n.message}`,{error:n}),this.#f();return}if(this.#u===t){if(this.#u=null,!Array.isArray(e)){this.#o(`Manifest is not a JSON array: ${t}`),this.#f();return}this.#t=this.#y(e),this.#n=this.#E(),this.#p()}}#p(){this.#f(),this.#$(),this.#C(),this.#a&&this.#T()}#C(){if(this.#d?.remove(),this.#d=null,!this.hasAttribute("data-banner"))return;let t=this.#t.find(o=>o.id===this.#n),e=this.#t.find(o=>!o.archived&&!o.draft);if(!t?.archived||!e||e.id===t.id)return;let n=document.createElement("aside");n.className="version-switcher-banner",n.setAttribute("aria-label",this.#s("banner-label"));let i=document.createElement("p");i.className="version-switcher-banner-text",i.setAttribute("role","status"),n.append(i),this.prepend(n),this.#d=n;let s=()=>{if(this.#d!==n)return;i.textContent=this.#s("banner",{version:t.label||t.id});let o=this.#s("banner-latest",{version:e.label||e.id});if(e.url&&b(e.url)){let a=document.createElement("a");a.className="version-switcher-banner-link",a.href=e.url,a.textContent=o,n.append(a)}else{let a=document.createElement("span");a.className="version-switcher-banner-latest",a.textContent=o,n.append(a)}};requestAnimationFrame(()=>requestAnimationFrame(s))}#R(){let t=this.getAttribute("data-page-info-target");if(!t)return;let e=document.getElementById(t);if(!e||e.localName!=="page-info"){this.#o(`data-page-info-target: no <page-info id="${t}"> found.`);return}this.#e.hidden=!0;let n=()=>{let s=e.querySelector(".page-info-panel");return s?(this.#T(s),!0):!1};if(n())return;let i=new MutationObserver(()=>{n()&&this.#x()});i.observe(e,{childList:!0,subtree:!0}),this.#h=i,this.#l=setTimeout(()=>{this.#l=null,!this.#a&&(this.#x(),this.#o(`<page-info id="${t}"> never rendered .page-info-panel within 5s.`))},5e3)}#x(){this.#h?.disconnect(),this.#h=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null}#T(t){let e=t||this.#a?.parentNode;if(!e)return;let n=this.#a;if(!n){n=document.createElement("section"),n.className="version-switcher-panel-section";let s=document.createElement("h3");s.className="version-switcher-panel-heading",s.id=`version-switcher-panel-${++x}`,n.setAttribute("aria-labelledby",s.id);let o=document.createElement("ul");o.className="version-switcher-panel-list",n.append(s,o),e.appendChild(n),this.#a=n,this.listen(o,"click",this.#L)}n.querySelector(".version-switcher-panel-heading").textContent=this.#v();let i=n.querySelector("ul.version-switcher-panel-list");this.#k(i,this.#u?"loading-versions":"empty")}#O(){this.#e?.parentNode!==this&&(this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="version-switcher-trigger",this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.appendChild(this.#e))}#q(){if(this.#i?.parentNode===this)return;let t=`version-switcher-${++x}`;this.#e.setAttribute("popovertarget",t),this.#i=document.createElement("pop-over"),this.#i.id=t,this.#i.className="version-switcher-popover",this.#i.dataset.position="bottom-end",this.#i.setAttribute("role","dialog"),this.#c=document.createElement("h3"),this.#c.className="version-switcher-heading",this.#r=document.createElement("ul"),this.#r.className="version-switcher-list",this.#r.setAttribute("role","list"),this.#i.append(this.#c,this.#r),this.appendChild(this.#i)}#D(){!this.#i||!this.#r||(this.listen(this.#i,"pop-over:show",()=>{this.#e.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("version-switcher:open",{bubbles:!0}));let t=this.#r.querySelector('[data-current="true"] button')||this.#r.querySelector("button");requestAnimationFrame(()=>t?.focus())}),this.listen(this.#i,"pop-over:hide",()=>{this.#e.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("version-switcher:close",{bubbles:!0}))}),this.listen(this.#r,"keydown",this.#U),this.listen(this.#r,"click",this.#L))}#f(){if(!this.#e)return;let t=this.#t.find(a=>a.id===this.#n),e=!!this.#u&&this.#t.length===0,n=e?this.#s("loading"):t?.label||t?.id||this.#s("trigger"),i=document.createElement("span");i.className="version-switcher-trigger-label",i.textContent=n;let s=document.createElement("span");s.className="version-switcher-trigger-chevron",s.setAttribute("aria-hidden","true"),s.textContent="\u25BE",this.#e.replaceChildren(i,s);let o=this.#m();this.#e.setAttribute("aria-label",n===o?o:`${o}: ${n}`),this.#i?.setAttribute("aria-label",o),this.#t.length===0?(this.#e.disabled=!0,this.#e.setAttribute("title",this.#s(e?"loading-versions":"empty"))):(this.#e.disabled=!1,this.#e.removeAttribute("title"))}#$(){this.#r&&(this.#c.textContent=this.#v(),this.#k(this.#r,"empty"))}#k(t,e){if(t.replaceChildren(),this.#t.length===0){let n=document.createElement("li");n.className="version-switcher-empty",n.textContent=this.#s(e),t.appendChild(n);return}for(let n of this.#t)t.appendChild(this.#F(n))}#F(t){let e=t.id===this.#n,n=t.label||t.id,i=document.createElement("li");i.setAttribute("role","listitem"),i.className="version-switcher-item",i.dataset.versionId=t.id,e&&(i.dataset.current="true"),t.archived&&(i.dataset.archived=""),t.draft&&(i.dataset.draft="");let s=document.createElement("button");s.type="button",s.className="version-switcher-entry",s.setAttribute("aria-current",e?"true":"false");let o=document.createElement("span");o.className="version-switcher-entry-label",o.append(n);let a=l=>{let h=document.createElement("span");h.className=`version-switcher-badge version-switcher-badge-${l}`,h.textContent=this.#s(l),o.append(" ",h)};if(t.archived&&a("archived"),t.draft&&a("draft"),e&&a("current"),s.appendChild(o),t.date){let l=document.createElement("time");l.className="version-switcher-entry-date",l.setAttribute("datetime",t.date);let h=M(this),d=xt(t.date,h);d&&(l.title=d),l.textContent=Tt(t.date,h)||d||t.date,s.append(" ",l)}i.appendChild(s);let c=[],u=`${this.#i?.id||"version-switcher"}-${Ct(t.id)}-${++x}`;if(t.author){let l=document.createElement("span");l.className="version-switcher-entry-author",l.id=`${u}-author`,l.textContent=this.#s("by",{author:t.author}),i.appendChild(l),c.push(l.id)}if(t.summary){let l=document.createElement("span");l.className="version-switcher-entry-summary",l.id=`${u}-summary`,l.textContent=t.summary,i.appendChild(l),c.push(l.id)}if(c.length&&s.setAttribute("aria-describedby",c.join(" ")),t.versionUrl&&b(t.versionUrl)){let l=document.createElement("a");l.className="version-switcher-entry-changelog",l.href=t.versionUrl,l.setAttribute("aria-label",this.#s("changelog-for",{version:n})),l.append(this.#s("changelog"));let h=document.createElement("span");h.setAttribute("aria-hidden","true"),h.textContent=" \u2192",l.append(h),i.appendChild(l)}return i}#L=t=>{let e=t.target.closest?.("button.version-switcher-entry");if(!e)return;let n=e.closest("[data-version-id]")?.dataset.versionId,i=this.#t.find(s=>s.id===n);i&&this.#V(i)};#U=t=>{let e=[...this.#r.querySelectorAll("button.version-switcher-entry")],n=e.indexOf(document.activeElement);if(n===-1)return;let i=n;switch(t.key){case"ArrowDown":t.preventDefault(),i=Math.min(e.length-1,n+1);break;case"ArrowUp":t.preventDefault(),i=Math.max(0,n-1);break;case"Home":t.preventDefault(),i=0;break;case"End":t.preventDefault(),i=e.length-1;break;default:return}e[i]?.focus()};#V(t){this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:t}})),this.#M(t)}#M(t){let e=this.getAttribute("data-action")||"navigate";if(e==="navigate")return this.#N(t);if(e==="swap")return this.#B(t);if(e==="diff")return this.#H(t);this.#o(`Unknown action "${e}"; falling back to navigate.`),this.#N(t)}#N(t){if(!t?.url||!b(t.url)){this.#o("Cannot navigate: entry has no safe url.",{entry:t});return}let e=new URL(t.url,location.href);if(e.href===location.href){this.#o("Cannot navigate: entry url is the current page.",{entry:t});return}let n=new CustomEvent("version-switcher:before-navigate",{bubbles:!0,cancelable:!0,detail:{entry:t}});this.dispatchEvent(n)&&(this.closePicker(),location.href=e.href)}#b(){return this.getAttribute("data-versioned-region")||"[data-versioned], else main"}#g(t){let e=this.getAttribute("data-versioned-region");return e?t.querySelector(e):t.querySelector("[data-versioned]")??t.querySelector("main")}#P(t,e){if(!t?.url||!b(t.url))return this.#o(`Cannot ${e}: entry has no safe url.`,{entry:t}),null;let n=new URL(t.url,location.href);return n.origin!==location.origin?(this.#o(`Cannot ${e}: ${n.href} is not same-origin.`,{entry:t}),null):n}async#I(t){let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw new Error(`Fetch failed (${e.status}) for ${t.href}`);let n=await e.text(),i=new DOMParser().parseFromString(n,"text/html"),s=this.#g(i);if(!s)throw new Error(`No versioned region (${this.#b()}) found in ${t.href}`);return s}async#B(t){let e=this.#P(t,"swap");if(!e)return;let n=this.#g(document);if(!n){this.#o(`No versioned region (${this.#b()}) on this page to swap.`,{entry:t});return}let i=new CustomEvent("version-switcher:before-swap",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(i))return;this.closePicker();let s=this.#n,o=async()=>{try{let c=await this.#I(e);n.replaceChildren(R(c.innerHTML,{keepIds:!0,keepStyle:!0}))}catch(c){throw this.#o(c.message,{entry:t,error:c}),c}};try{if("startViewTransition"in document){let c;try{c=document.startViewTransition({update:o,types:["version-swap"]})}catch{c=document.startViewTransition(o)}await c.updateCallbackDone}else await o()}catch{return}let a=document.querySelector('meta[itemprop="version"]');a||(a=document.createElement("meta"),a.setAttribute("itemprop","version"),document.head.appendChild(a)),a.setAttribute("content",t.id),this.#n=t.id,this.#p(),this.dispatchEvent(new CustomEvent("version-switcher:swap",{bubbles:!0,detail:{entry:t,previousId:s}}))}async#H(t){let e=this.#P(t,"diff");if(!e)return;let n=this.#g(document);if(!n){this.#o(`No versioned region (${this.#b()}) on this page to diff against.`,{entry:t});return}if(t.id===this.#n){this.#o("Cannot diff against the current version.",{entry:t});return}let i=new CustomEvent("version-switcher:before-diff",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(i))return;this.closePicker();let s;try{s=await this.#I(e)}catch(u){this.#o(u.message,{entry:t,error:u});return}document.querySelectorAll(".version-switcher-diff-host").forEach(u=>u.remove());let o=D(n.textContent.trim(),s.textContent.trim()),a=document.createElement("change-set");a.classList.add("version-switcher-diff-host"),a.dataset.versionFrom=this.#n??"",a.dataset.versionTo=t.id,a.dataset.diffLabel=this.#s("diff",{from:this.#n??"",to:t.id}),a.appendChild(F(o)),(this.getAttribute("data-diff-position")||"before")==="after"?n.parentNode.insertBefore(a,n.nextSibling):n.parentNode.insertBefore(a,n),a.setAttribute("tabindex","-1"),a.focus({preventScroll:!1}),this.dispatchEvent(new CustomEvent("version-switcher:diff",{bubbles:!0,detail:{entry:t,previousId:this.#n,diffElement:a,opCount:o.length}}))}get versions(){return this.#t.slice()}get currentId(){return this.#n}openPicker(){this.#i?.show()}closePicker(){this.#i?.hide()}switchTo(t){let e=this.#t.find(n=>n.id===t);if(!e){this.#o(`switchTo: no entry with id "${t}"`);return}this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:e}})),this.#M(e)}refresh(){this.#w(),!(!this.#e||!this.#r)&&this.#p()}#o(t,e={}){this.dispatchEvent(new CustomEvent("version-switcher:error",{bubbles:!0,detail:{message:t,...e}}))}};function b(r){return typeof r=="string"&&r.trim()!==""&&!g(r,!1)}function Ct(r){return String(r).replace(/[^\w-]/g,"_")}function U(r){let t=new Date(r);return Number.isNaN(t.getTime())?null:t}function xt(r,t){let e=U(r);if(!e)return null;let n=St.test(r)?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"};try{return new Intl.DateTimeFormat(t,n).format(e)}catch{return e.toISOString()}}function Tt(r,t){let e=U(r);if(!e)return null;let n=(Date.now()-e.getTime())/1e3;if(n<0)return null;let i;try{i=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{i=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}let s=60,o=3600,a=86400,c=2592e3,u=31536e3;return n<s?i.format(0,"second"):n<o?i.format(-Math.floor(n/s),"minute"):n<a?i.format(-Math.floor(n/o),"hour"):n<c?i.format(-Math.floor(n/a),"day"):n<u?i.format(-Math.floor(n/c),"month"):i.format(-Math.floor(n/u),"year")}m("version-switcher",T);export{T as VersionSwitcher};
7
7
  //# sourceMappingURL=version-switcher.js.map
@@ -1,4 +1,4 @@
1
- var A=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function m(o,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=v.get(o);if(customElements.get(o)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(o,s),customElements.define(o,t)}var l=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#t.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}#i(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};function b(o){return g(o&&o.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function g(o,t="en-US"){try{if(o)return Intl.getCanonicalLocales(o),o}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var d=[.5,.75,1,1.25,1.5,2],y=3e3,c=10,k=5,x='input, button, a[href], summary, select, textarea, video[controls], [contenteditable]:not([contenteditable="false"])',w={player:"Video player",controls:"Video controls","play-video":"Play video",play:"Play",pause:"Pause",seek:"Seek","skip-back":"Skip back 10 seconds","skip-forward":"Skip forward 10 seconds",mute:"Mute",volume:"Volume",speed:"Playback speed {rate}",captions:"Captions",fullscreen:"Fullscreen","exit-fullscreen":"Exit fullscreen",playing:"Playing",paused:"Paused",ended:"Ended",buffering:"Buffering","time-of":"{current} of {duration}"},p=class extends l{#t=null;#e=null;#i=!1;#p=null;#c=null;#v=null;#h=null;#V=null;#B=null;#u=null;#$=null;#F=null;#m=null;#n=null;#b=null;#U=null;#_=null;#r=null;#y=2;#N=null;#I=null;#g=null;#H=!1;#k="en";#x=null;#w=null;setup(){if(this.#t=this.querySelector("video"),!this.#t)return!1;this.#e=this.querySelector(".track-list"),this.#t.removeAttribute("controls"),this.#G(),this.#Y(),this.#Q(),this.#W(),this.#et(),this.#tt(),this.#J(),this.#P(),this.hasAttribute("muted")&&(this.#t.muted=!0),this.#l(),!this.#e&&this.hasAttribute("loop")&&(this.#t.loop=!0),this.#H||(this.#H=!0,globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches?this.#t.autoplay&&(this.#t.autoplay=!1,this.#t.pause()):this.hasAttribute("autoplay")&&this.#t.play().catch(()=>{})),this.#a(),this.#N=()=>{let e=this.shadowRoot?.querySelector(".player");e&&(e.style.display="none",e.offsetHeight,e.style.display="")},this.listen(window,"vb:theme-change",this.#N),this.#I=()=>{let e=this.#T();e!==this.hasAttribute("data-fullscreen")&&(this.#j(e),this.#b.setAttribute("aria-label",this.#s(e?"exit-fullscreen":"fullscreen")),this.#o("video-player:fullscreen",{active:e}))},this.listen(document,"fullscreenchange",this.#I),this.#j(this.#T());let t=this.#L();return t&&this.hasAttribute("captions")&&(t.mode="showing"),this.#O(),this.listen(this.#t.textTracks,"change",()=>this.#O()),this.#i=!this.#t.paused&&!this.#t.ended,this.#d(this.#t.ended?"ended":this.#i?"playing":this.#t.currentTime>0?"paused":"idle"),this.#c.setAttribute("aria-label",this.#s(this.#i?"pause":"play")),this.#q(),this.#S(),!0}teardown(){this.#t&&this.#t.setAttribute("controls",""),this.#r!=null&&clearTimeout(this.#r),this.#r=null}get src(){return this.#t?.getAttribute("src")||this.#t?.currentSrc||""}set src(t){if(!this.#t)return;let e=t==null?"":String(t);this.#t.getAttribute("src")!==e&&(this.#t.setAttribute("src",e),this.#t.load?.(),this.#o("video-player:src-changed",{src:e,source:"property"}))}get currentTime(){return this.#t?.currentTime??0}set currentTime(t){this.#t&&(this.#t.currentTime=Number(t)||0)}#G(){if(this.shadowRoot)return;let t=this.attachShadow({mode:"open"});t.innerHTML=`
1
+ var $=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function b(a,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(a);if(customElements.get(a)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(a,r),customElements.define(a,t)}var l=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#t.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}#i(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};function m(a){return k(a&&a.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function k(a,t="en-US"){try{if(a)return Intl.getCanonicalLocales(a),a}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var x=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),g=new WeakMap;function A(a,t){let e=g.get(t);e||g.set(t,e=new Map);let i=e.get(a);if(!i||!i.region.isConnected){let s=(t.ownerDocument||document).createElement("span");s.setAttribute("data-vb-announcer",a),s.setAttribute("role",a==="assertive"?"alert":"status"),s.setAttribute("aria-live",a),s.setAttribute("aria-atomic","true"),s.style.cssText=x,t.appendChild(s),i={region:s},e.set(a,i)}return i}function y(a,{politeness:t="polite",root:e}={}){let i=String(a??"").trim();if(!i||typeof document>"u")return null;let r=e||document.body;if(!r)return null;let n=A(t==="assertive"?"assertive":"polite",r);return clearTimeout(n.write),clearTimeout(n.clear),n.region.textContent="",n.write=setTimeout(()=>{n.region.textContent=i,n.clear=setTimeout(()=>{n.region.textContent=""},7e3)},50),n.region}var d=[.5,.75,1,1.25,1.5,2],w=3e3,c=10,S=5,E='input, button, a[href], summary, select, textarea, video[controls], [contenteditable]:not([contenteditable="false"])',T={player:"Video player",controls:"Video controls","play-video":"Play video",play:"Play",pause:"Pause",seek:"Seek","skip-back":"Skip back 10 seconds","skip-forward":"Skip forward 10 seconds",mute:"Mute",volume:"Volume",speed:"Playback speed {rate}",captions:"Captions",fullscreen:"Fullscreen","exit-fullscreen":"Exit fullscreen",playing:"Playing",paused:"Paused",ended:"Ended",buffering:"Buffering","time-of":"{current} of {duration}"},p=class extends l{#t=null;#e=null;#i=!1;#p=null;#c=null;#b=null;#u=null;#q=null;#B=null;#h=null;#V=null;#P=null;#f=null;#o=null;#m=null;#G=null;#_=null;#s=null;#g=2;#F=null;#H=null;#y=null;#I=!1;#w="en";#k=null;#x=null;setup(){if(this.#t=this.querySelector("video"),!this.#t)return!1;this.#e=this.querySelector(".track-list"),this.#t.removeAttribute("controls"),this.#Y(),this.#W(),this.#Q(),this.#Z(),this.#et(),this.#tt(),this.#J(),this.#R(),this.hasAttribute("muted")&&(this.#t.muted=!0),this.#l(),!this.#e&&this.hasAttribute("loop")&&(this.#t.loop=!0),this.#I||(this.#I=!0,globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches?this.#t.autoplay&&(this.#t.autoplay=!1,this.#t.pause()):this.hasAttribute("autoplay")&&this.#t.play().catch(()=>{})),this.#n(),this.#F=()=>{let e=this.shadowRoot?.querySelector(".player");e&&(e.style.display="none",e.offsetHeight,e.style.display="")},this.listen(window,"vb:theme-change",this.#F),this.#H=()=>{let e=this.#E();e!==this.hasAttribute("data-fullscreen")&&(this.#K(e),this.#m.setAttribute("aria-label",this.#r(e?"exit-fullscreen":"fullscreen")),this.#a("video-player:fullscreen",{active:e}))},this.listen(document,"fullscreenchange",this.#H),this.#K(this.#E());let t=this.#z();return t&&this.hasAttribute("captions")&&(t.mode="showing"),this.#U(),this.listen(this.#t.textTracks,"change",()=>this.#U()),this.#i=!this.#t.paused&&!this.#t.ended,this.#d(this.#t.ended?"ended":this.#i?"playing":this.#t.currentTime>0?"paused":"idle"),this.#c.setAttribute("aria-label",this.#r(this.#i?"pause":"play")),this.#L(),this.#S(),!0}teardown(){this.#t&&this.#t.setAttribute("controls",""),this.#s!=null&&clearTimeout(this.#s),this.#s=null}get src(){return this.#t?.getAttribute("src")||this.#t?.currentSrc||""}set src(t){if(!this.#t)return;let e=t==null?"":String(t);this.#t.getAttribute("src")!==e&&(this.#t.setAttribute("src",e),this.#t.load?.(),this.#a("video-player:src-changed",{src:e,source:"property"}))}get currentTime(){return this.#t?.currentTime??0}set currentTime(t){this.#t&&(this.#t.currentTime=Number(t)||0)}#Y(){if(this.shadowRoot)return;let t=this.attachShadow({mode:"open"});t.innerHTML=`
2
2
  <style>${this.#X()}</style>
3
3
  <div part="player" class="player">
4
4
  <slot></slot>
@@ -63,7 +63,7 @@ var A=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;functi
63
63
  </span>
64
64
  <span class="spacer"></span>
65
65
  <button part="speed-button" class="speed-btn" type="button" aria-label="Playback speed 1x">
66
- <span aria-live="polite">1x</span>
66
+ <span>1x</span>
67
67
  </button>
68
68
  <button part="captions-button" class="captions-btn" type="button" aria-label="Captions" aria-pressed="false">
69
69
  <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" width="20" height="20">
@@ -82,7 +82,7 @@ var A=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;functi
82
82
  </div>
83
83
  <div class="sr-status" role="status" aria-live="polite"></div>
84
84
  </div>
85
- `,this.#p=t.querySelector(".controls"),this.#c=t.querySelector(".play-btn"),this.#v=t.querySelector(".play-overlay"),this.#h=t.querySelector(".timeline"),this.#V=t.querySelector(".timeline-fill"),this.#B=t.querySelector(".timeline-buffer"),this.#u=t.querySelector(".volume"),this.#$=t.querySelector(".current-time"),this.#F=t.querySelector(".duration"),this.#m=t.querySelector(".speed-btn"),this.#n=t.querySelector(".captions-btn"),this.#b=t.querySelector(".fullscreen-btn"),this.#U=t.querySelector(".buffer-indicator"),this.#_=t.querySelector(".sr-status"),this.#g=t.querySelector(".mute-btn")}#P(){let t=this.#t.querySelector('track[kind="captions"], track[kind="subtitles"]');this.#n.hidden=!t}#s(t,e={}){let i=this.getAttribute(`data-label-${t}`)??w[t]??t;for(let[s,r]of Object.entries(e))i=i.replaceAll(`{${s}}`,r);return i}#Y(){this.#k=b(this);try{this.#x=new Intl.NumberFormat(this.#k,{useGrouping:!1})}catch{this.#x=new Intl.NumberFormat("en",{useGrouping:!1})}let t=Intl.DurationFormat;try{this.#w=t?new t(this.#k,{style:"digital",hoursDisplay:"auto"}):null}catch{this.#w=null}}#J(){let t=this.shadowRoot,e=(i,s)=>t.querySelector(i)?.setAttribute("aria-label",this.#s(s));e(".controls","controls"),e(".play-overlay","play-video"),e(".timeline","seek"),e(".skip-back-btn","skip-back"),e(".skip-forward-btn","skip-forward"),e(".mute-btn","mute"),e(".volume","volume"),e(".captions-btn","captions"),this.#b.setAttribute("aria-label",this.#s(this.#T()?"exit-fullscreen":"fullscreen")),this.#D(),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","group"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",this.#s("player")),this.hasAttribute("aria-keyshortcuts")||this.setAttribute("aria-keyshortcuts","Space K ArrowLeft ArrowRight ArrowUp ArrowDown M F C")}#D(){let t=d[this.#y],e=`${this.#x?.format(t)??t}x`,i=this.#m.querySelector("span");i.textContent=e,this.#m.setAttribute("aria-label",this.#s("speed",{rate:e}))}#X(){return`
85
+ `,this.#p=t.querySelector(".controls"),this.#c=t.querySelector(".play-btn"),this.#b=t.querySelector(".play-overlay"),this.#u=t.querySelector(".timeline"),this.#q=t.querySelector(".timeline-fill"),this.#B=t.querySelector(".timeline-buffer"),this.#h=t.querySelector(".volume"),this.#V=t.querySelector(".current-time"),this.#P=t.querySelector(".duration"),this.#f=t.querySelector(".speed-btn"),this.#o=t.querySelector(".captions-btn"),this.#m=t.querySelector(".fullscreen-btn"),this.#G=t.querySelector(".buffer-indicator"),this.#_=t.querySelector(".sr-status"),this.#y=t.querySelector(".mute-btn")}#R(){let t=this.#t.querySelector('track[kind="captions"], track[kind="subtitles"]');this.#o.hidden=!t}#r(t,e={}){let i=this.getAttribute(`data-label-${t}`)??T[t]??t;for(let[r,s]of Object.entries(e))i=i.replaceAll(`{${r}}`,s);return i}#W(){this.#w=m(this);try{this.#k=new Intl.NumberFormat(this.#w,{useGrouping:!1})}catch{this.#k=new Intl.NumberFormat("en",{useGrouping:!1})}let t=Intl.DurationFormat;try{this.#x=t?new t(this.#w,{style:"digital",hoursDisplay:"auto"}):null}catch{this.#x=null}}#J(){let t=this.shadowRoot,e=(i,r)=>t.querySelector(i)?.setAttribute("aria-label",this.#r(r));e(".controls","controls"),e(".play-overlay","play-video"),e(".timeline","seek"),e(".skip-back-btn","skip-back"),e(".skip-forward-btn","skip-forward"),e(".mute-btn","mute"),e(".volume","volume"),e(".captions-btn","captions"),this.#m.setAttribute("aria-label",this.#r(this.#E()?"exit-fullscreen":"fullscreen")),this.#D(),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("role")||this.setAttribute("role","group"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",this.#r("player")),this.hasAttribute("aria-keyshortcuts")||this.setAttribute("aria-keyshortcuts","Space k ArrowLeft ArrowRight ArrowUp ArrowDown m f c")}#D(){let t=d[this.#g],e=`${this.#k?.format(t)??t}x`,i=this.#f.querySelector("span");i.textContent=e,this.#f.setAttribute("aria-label",this.#r("speed",{rate:e}))}#X(){return`
86
86
  :host {
87
87
  display: block;
88
88
  --_accent: var(--video-player-accent, var(--color-primary, oklch(55% 0.2 260)));
@@ -566,5 +566,5 @@ var A=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;functi
566
566
  cursor: auto;
567
567
  }
568
568
  }
569
- `}#Q(){let t=this.#t;this.listen(t,"timeupdate",()=>this.#S()),this.listen(t,"loadedmetadata",()=>{this.#q(),this.#S()}),this.listen(t,"durationchange",()=>this.#q()),this.listen(t,"progress",()=>this.#rt()),this.listen(t,"volumechange",()=>this.#l()),this.listen(t,"play",()=>{this.#i=!0,this.#d("playing"),this.#c.setAttribute("aria-label",this.#s("pause")),this.#E(this.#s("playing")),this.#o("video-player:play",{currentTime:t.currentTime,src:t.currentSrc})}),this.listen(t,"pause",()=>{this.#i=!1,t.ended||this.#d("paused"),this.#c.setAttribute("aria-label",this.#s("play")),this.#a(),this.#E(this.#s("paused")),this.#o("video-player:pause",{currentTime:t.currentTime})}),this.listen(t,"ended",()=>{this.#i=!1,this.#d("ended"),this.#c.setAttribute("aria-label",this.#s("play")),this.#a();let e=this.#e?.querySelector("li[data-video-active]");e&&e.setAttribute("data-video-played",""),this.#e&&this.#st(),this.#E(this.#s("ended")),this.#o("video-player:ended",{src:t.currentSrc})}),this.listen(t,"waiting",()=>{this.#i&&(this.#d("buffering"),this.#E(this.#s("buffering")))}),this.listen(t,"playing",()=>{this.getAttribute("state")==="buffering"&&this.#d("playing")})}#d(t){this.setAttribute("state",t),this.#v&&(this.#v.inert=!(t==="idle"||t==="ended"))}#W(){let t=this.shadowRoot,e=()=>{this.#i?this.#t.pause():this.#t.play().catch(()=>{})};this.listen(this.#v,"click",s=>{s.stopPropagation(),this.#t.play().catch(()=>{})});let i=t.querySelector(".player");this.listen(i,"click",s=>{let r=s.target;r.closest(".controls")||r.closest(".play-overlay")||r!==this.#t&&r!==i||e()}),this.listen(this.#c,"click",e),this.listen(this.#h,"input",()=>{this.#t.duration&&(this.#t.currentTime=Number(this.#h.value)/100*this.#t.duration,this.#M())}),this.listen(this.#h,"keydown",s=>{let r=s;if(r.altKey||r.ctrlKey||r.metaKey)return;let a={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1}[r.key];a&&(r.preventDefault(),this.#f(a*k))}),this.listen(t.querySelector(".skip-back-btn"),"click",()=>this.#f(-c)),this.listen(t.querySelector(".skip-forward-btn"),"click",()=>this.#f(c)),this.listen(this.#u,"input",()=>{this.#t.volume=Number(this.#u.value),this.#t.muted=!1,this.#l()}),this.listen(this.#g,"click",()=>{this.#t.muted=!this.#t.muted,this.#l()}),this.listen(this.#m,"click",()=>{this.#y=(this.#y+1)%d.length;let s=d[this.#y];this.#t.playbackRate=s,this.#D(),this.#o("video-player:speed",{rate:s})}),this.listen(this.#n,"click",()=>{let s=this.#L();if(!s)return;let r=s.mode==="showing";s.mode=r?"hidden":"showing";let a=!r;this.toggleAttribute("captions",a),this.#n.setAttribute("aria-pressed",String(a)),this.#o("video-player:captions",{active:a,label:s.label})}),this.listen(this.#b,"click",()=>this.#K()),this.listen(this,"keydown",s=>this.#at(s))}#Z(t){for(let e of t.composedPath()){if(e===this)return!1;if(e instanceof Element&&e.matches(x))return!0}return!1}#f(t){let e=this.#t.duration||0;this.#t.currentTime=Math.min(e,Math.max(0,this.#t.currentTime+t)),this.#a(),this.#S()}#tt(){let t=this.shadowRoot?.querySelector(".player"),e=()=>{this.#a(),this.#z(y)};this.listen(t,"mousemove",e),this.listen(t,"mouseenter",e),this.listen(t,"mouseleave",()=>this.#z(500)),this.listen(t,"touchstart",()=>{this.hasAttribute("controls")?this.#R():e()},{passive:!0}),this.listen(this.#p,"mouseenter",()=>{this.#r!=null&&clearTimeout(this.#r),this.#a()}),this.listen(this.#p,"focusin",()=>{this.#r!=null&&clearTimeout(this.#r),this.#a()}),this.listen(this.#p,"focusout",()=>this.#z(y))}#z(t){this.#r!=null&&clearTimeout(this.#r),this.#r=null,this.#i&&(this.#r=setTimeout(()=>this.#R(),t))}#a(){this.setAttribute("controls","")}#R(){let t=this.shadowRoot?.activeElement;t&&this.#p?.contains(t)||this.removeAttribute("controls")}#et(){this.#e&&this.listen(this.#e,"click",t=>{let e=t.target.closest("a[href]");e&&(t.preventDefault(),this.#A(e.href,e.closest("li"),e))})}#A(t,e,i){this.#e.querySelectorAll("li").forEach(n=>n.removeAttribute("data-video-active")),e&&e.setAttribute("data-video-active",""),this.#t.src=t;let r=i?.getAttribute("data-poster");r&&(this.#t.poster=r);let a=i?.getAttribute("data-captions");this.#it(a),this.#t.play().catch(()=>{}),this.#o("video-player:track-change",{src:t,title:i?.textContent??""})}#it(t){if(this.#t.querySelectorAll("track[data-dynamic]").forEach(i=>i.remove()),t){let i=document.createElement("track");i.kind="captions",i.src=t,i.default=!0,i.setAttribute("data-dynamic",""),this.#t.appendChild(i),this.hasAttribute("captions")&&(i.track.mode="showing")}this.#P()}#st(){if(!this.#e)return;let t=[...this.#e.querySelectorAll("li")],e=t.findIndex(s=>s.hasAttribute("data-video-active"));if(this.hasAttribute("shuffle")){let s=t.filter((r,a)=>a!==e);if(s.length){let r=s[Math.floor(Math.random()*s.length)],a=r.querySelector("a[href]");a&&this.#A(a.href,r,a)}return}let i=e+1;if(i<t.length){let s=t[i].querySelector("a[href]");s&&this.#A(s.href,t[i],s)}else if(this.hasAttribute("loop")){let s=t[0]?.querySelector("a[href]");s&&this.#A(s.href,t[0],s)}}#S(){let t=this.#t.currentTime,e=this.#t.duration||0,i=e?t/e*100:0;this.#$.textContent=this.#C(t),this.#h.value=String(i),this.#M(),this.#V.style.width=`${i}%`}#M(){this.#h.setAttribute("aria-valuetext",this.#s("time-of",{current:this.#C(this.#t.currentTime),duration:this.#C(this.#t.duration||0)}))}#q(){let t=this.#t.duration||0;this.#F.textContent=this.#C(t),this.#M()}#rt(){let t=this.#t.buffered,e=this.#t.duration||0;if(t.length>0&&e){let i=t.end(t.length-1);this.#B.style.width=`${i/e*100}%`}}#T(){let t=document.fullscreenElement;return!!t&&(t===this||t===this.#t)}#j(t){t?this.setAttribute("data-fullscreen",""):this.removeAttribute("data-fullscreen")}#K(){this.#T()?document.exitFullscreen().catch(()=>{}):this.requestFullscreen().catch(()=>{this.#t.requestFullscreen?.().catch(()=>{})})}#O(){let t=this.#L();if(!t||!this.#n)return;let e=t.mode==="showing";this.toggleAttribute("captions",e),this.#n.setAttribute("aria-pressed",String(e))}#L(){let t=this.#t.textTracks;for(let e=0;e<t.length;e++)if(t[e].kind==="captions"||t[e].kind==="subtitles")return t[e];return null}#at(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)&&!this.#Z(t))switch(t.key){case" ":case"k":case"K":t.preventDefault(),this.#i?this.#t.pause():this.#t.play().catch(()=>{});break;case"ArrowLeft":t.preventDefault(),this.#f(-c);break;case"ArrowRight":t.preventDefault(),this.#f(c);break;case"ArrowUp":t.preventDefault(),this.#t.volume=Math.min(1,this.#t.volume+.05),this.#l(),this.#a();break;case"ArrowDown":t.preventDefault(),this.#t.volume=Math.max(0,this.#t.volume-.05),this.#l(),this.#a();break;case"m":case"M":this.#t.muted=!this.#t.muted,this.#l();break;case"f":case"F":this.#K();break;case"c":case"C":this.#n.click();break}}#l(){if(!this.#t||!this.#g)return;let t=this.#t.muted;this.toggleAttribute("muted",t),this.#g.setAttribute("aria-pressed",String(t));let e=this.#t.volume;this.#u.value=String(e),this.#u.style.setProperty("--_vol",t?"0":String(e));let i;try{i=new Intl.NumberFormat(this.#k,{style:"percent"}).format(e)}catch{i=`${Math.round(e*100)}%`}this.#u.setAttribute("aria-valuetext",i)}#C(t){let e=Number.isFinite(t)&&t>0?Math.floor(t):0,i=Math.floor(e/3600),s=Math.floor(e%3600/60),r=e%60,a=this.#x??new Intl.NumberFormat("en",{useGrouping:!1});if(this.#w)try{let h=this.#w.formatToParts({hours:i,minutes:s,seconds:r}),f=!0;return h.map(u=>f&&u.type==="integer"?(f=!1,a.format(u.unit==="hour"?i:s)):u.value).join("")}catch{}let n=h=>a.format(h).padStart(2,a.format(0));return i>0?`${a.format(i)}:${n(s)}:${n(r)}`:`${a.format(s)}:${n(r)}`}#E(t){this.#_&&(this.#_.textContent=t)}#o(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}};m("video-player",p);export{p as VideoPlayerElement};
569
+ `}#Q(){let t=this.#t;this.listen(t,"timeupdate",()=>this.#S()),this.listen(t,"loadedmetadata",()=>{this.#L(),this.#S()}),this.listen(t,"durationchange",()=>this.#L()),this.listen(t,"progress",()=>this.#st()),this.listen(t,"volumechange",()=>this.#l()),this.listen(t,"play",()=>{this.#i=!0,this.#d("playing"),this.#c.setAttribute("aria-label",this.#r("pause")),this.#C(this.#r("playing")),this.#a("video-player:play",{currentTime:t.currentTime,src:t.currentSrc})}),this.listen(t,"pause",()=>{this.#i=!1,t.ended||this.#d("paused"),this.#c.setAttribute("aria-label",this.#r("play")),this.#n(),this.#C(this.#r("paused")),this.#a("video-player:pause",{currentTime:t.currentTime})}),this.listen(t,"ended",()=>{this.#i=!1,this.#d("ended"),this.#c.setAttribute("aria-label",this.#r("play")),this.#n();let e=this.#e?.querySelector("li[data-video-active]");e&&e.setAttribute("data-video-played",""),this.#e&&this.#rt(),this.#C(this.#r("ended")),this.#a("video-player:ended",{src:t.currentSrc})}),this.listen(t,"waiting",()=>{this.#i&&(this.#d("buffering"),this.#C(this.#r("buffering")))}),this.listen(t,"playing",()=>{this.getAttribute("state")==="buffering"&&this.#d("playing")})}#d(t){this.setAttribute("state",t),this.#b&&(this.#b.inert=!(t==="idle"||t==="ended"))}#Z(){let t=this.shadowRoot,e=()=>{this.#i?this.#t.pause():this.#t.play().catch(()=>{})};this.listen(this.#b,"click",r=>{r.stopPropagation(),this.#t.play().catch(()=>{})});let i=t.querySelector(".player");this.listen(i,"click",r=>{let s=r.target;s.closest(".controls")||s.closest(".play-overlay")||s!==this.#t&&s!==i||e()}),this.listen(this.#c,"click",e),this.listen(this.#u,"input",()=>{this.#t.duration&&(this.#t.currentTime=Number(this.#u.value)/100*this.#t.duration,this.#$())}),this.listen(this.#u,"keydown",r=>{let s=r;if(s.altKey||s.ctrlKey||s.metaKey)return;let n={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1}[s.key];n&&(s.preventDefault(),this.#v(n*S))}),this.listen(t.querySelector(".skip-back-btn"),"click",()=>this.#v(-c)),this.listen(t.querySelector(".skip-forward-btn"),"click",()=>this.#v(c)),this.listen(this.#h,"input",()=>{this.#t.volume=Number(this.#h.value),this.#t.muted=!1,this.#l()}),this.listen(this.#y,"click",()=>{this.#t.muted=!this.#t.muted,this.#l()}),this.listen(this.#f,"click",()=>{this.#g=(this.#g+1)%d.length;let r=d[this.#g];this.#t.playbackRate=r,this.#D(),y(this.#f.getAttribute("aria-label")||""),this.#a("video-player:speed",{rate:r})}),this.listen(this.#o,"click",()=>{let r=this.#z();if(!r)return;let s=r.mode==="showing";r.mode=s?"hidden":"showing";let n=!s;this.toggleAttribute("captions",n),this.#o.setAttribute("aria-pressed",String(n)),this.#a("video-player:captions",{active:n,label:r.label})}),this.listen(this.#m,"click",()=>this.#O()),this.listen(this,"keydown",r=>this.#nt(r))}#N(t){for(let e of t.composedPath()){if(e===this)return!1;if(e instanceof Element&&e.matches(E))return!0}return!1}#v(t){let e=this.#t.duration||0;this.#t.currentTime=Math.min(e,Math.max(0,this.#t.currentTime+t)),this.#n(),this.#S()}#tt(){let t=this.shadowRoot?.querySelector(".player"),e=()=>{this.#n(),this.#M(w)};this.listen(t,"mousemove",e),this.listen(t,"mouseenter",e),this.listen(t,"mouseleave",()=>this.#M(500)),this.listen(t,"touchstart",()=>{this.hasAttribute("controls")?this.#j():e()},{passive:!0}),this.listen(this.#p,"mouseenter",()=>{this.#s!=null&&clearTimeout(this.#s),this.#n()}),this.listen(this.#p,"focusin",()=>{this.#s!=null&&clearTimeout(this.#s),this.#n()}),this.listen(this.#p,"focusout",()=>this.#M(w))}#M(t){this.#s!=null&&clearTimeout(this.#s),this.#s=null,this.#i&&(this.#s=setTimeout(()=>this.#j(),t))}#n(){this.setAttribute("controls","")}#j(){let t=this.shadowRoot?.activeElement;t&&this.#p?.contains(t)||this.removeAttribute("controls")}#et(){this.#e&&this.listen(this.#e,"click",t=>{let e=t.target.closest("a[href]");e&&(t.preventDefault(),this.#A(e.href,e.closest("li"),e))})}#A(t,e,i){this.#e.querySelectorAll("li").forEach(o=>o.removeAttribute("data-video-active")),e&&e.setAttribute("data-video-active",""),this.#t.src=t;let s=i?.getAttribute("data-poster");s&&(this.#t.poster=s);let n=i?.getAttribute("data-captions");this.#it(n),this.#t.play().catch(()=>{}),this.#a("video-player:track-change",{src:t,title:i?.textContent??""})}#it(t){if(this.#t.querySelectorAll("track[data-dynamic]").forEach(i=>i.remove()),t){let i=document.createElement("track");i.kind="captions",i.src=t,i.default=!0,i.setAttribute("data-dynamic",""),this.#t.appendChild(i),this.hasAttribute("captions")&&(i.track.mode="showing")}this.#R()}#rt(){if(!this.#e)return;let t=[...this.#e.querySelectorAll("li")],e=t.findIndex(r=>r.hasAttribute("data-video-active"));if(this.hasAttribute("shuffle")){let r=t.filter((s,n)=>n!==e);if(r.length){let s=r[Math.floor(Math.random()*r.length)],n=s.querySelector("a[href]");n&&this.#A(n.href,s,n)}return}let i=e+1;if(i<t.length){let r=t[i].querySelector("a[href]");r&&this.#A(r.href,t[i],r)}else if(this.hasAttribute("loop")){let r=t[0]?.querySelector("a[href]");r&&this.#A(r.href,t[0],r)}}#S(){let t=this.#t.currentTime,e=this.#t.duration||0,i=e?t/e*100:0;this.#V.textContent=this.#T(t),this.#u.value=String(i),this.#$(),this.#q.style.width=`${i}%`}#$(){this.#u.setAttribute("aria-valuetext",this.#r("time-of",{current:this.#T(this.#t.currentTime),duration:this.#T(this.#t.duration||0)}))}#L(){let t=this.#t.duration||0;this.#P.textContent=this.#T(t),this.#$()}#st(){let t=this.#t.buffered,e=this.#t.duration||0;if(t.length>0&&e){let i=t.end(t.length-1);this.#B.style.width=`${i/e*100}%`}}#E(){let t=document.fullscreenElement;return!!t&&(t===this||t===this.#t)}#K(t){t?this.setAttribute("data-fullscreen",""):this.removeAttribute("data-fullscreen")}#O(){this.#E()?document.exitFullscreen().catch(()=>{}):this.requestFullscreen().catch(()=>{this.#t.requestFullscreen?.().catch(()=>{})})}#U(){let t=this.#z();if(!t||!this.#o)return;let e=t.mode==="showing";this.toggleAttribute("captions",e),this.#o.setAttribute("aria-pressed",String(e))}#z(){let t=this.#t.textTracks;for(let e=0;e<t.length;e++)if(t[e].kind==="captions"||t[e].kind==="subtitles")return t[e];return null}#nt(t){if(!(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)&&!this.#N(t))switch(t.key){case" ":case"k":case"K":t.preventDefault(),this.#i?this.#t.pause():this.#t.play().catch(()=>{});break;case"ArrowLeft":t.preventDefault(),this.#v(-c);break;case"ArrowRight":t.preventDefault(),this.#v(c);break;case"ArrowUp":t.preventDefault(),this.#t.volume=Math.min(1,this.#t.volume+.05),this.#l(),this.#n();break;case"ArrowDown":t.preventDefault(),this.#t.volume=Math.max(0,this.#t.volume-.05),this.#l(),this.#n();break;case"m":case"M":this.#t.muted=!this.#t.muted,this.#l();break;case"f":case"F":this.#O();break;case"c":case"C":this.#o.click();break}}#l(){if(!this.#t||!this.#y)return;let t=this.#t.muted;this.toggleAttribute("muted",t),this.#y.setAttribute("aria-pressed",String(t));let e=this.#t.volume;this.#h.value=String(e),this.#h.style.setProperty("--_vol",t?"0":String(e));let i;try{i=new Intl.NumberFormat(this.#w,{style:"percent"}).format(e)}catch{i=`${Math.round(e*100)}%`}this.#h.setAttribute("aria-valuetext",i)}#T(t){let e=Number.isFinite(t)&&t>0?Math.floor(t):0,i=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60,n=this.#k??new Intl.NumberFormat("en",{useGrouping:!1});if(this.#x)try{let u=this.#x.formatToParts({hours:i,minutes:r,seconds:s}),f=!0;return u.map(h=>f&&h.type==="integer"?(f=!1,n.format(h.unit==="hour"?i:r)):h.value).join("")}catch{}let o=u=>n.format(u).padStart(2,n.format(0));return i>0?`${n.format(i)}:${o(r)}:${o(s)}`:`${n.format(r)}:${o(s)}`}#C(t){this.#_&&(this.#_.textContent=t)}#a(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}};b("video-player",p);export{p as VideoPlayerElement};
570
570
  //# sourceMappingURL=video-player.js.map
@@ -1,7 +1,7 @@
1
- var St=Object.defineProperty;var b=(n,t)=>()=>(n&&(t=n(n=0)),t);var Et=(n,t)=>{for(var e in t)St(n,e,{get:t[e],enumerable:!0})};function At(){let n=globalThis.localStorage;if(!n)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return n.getItem(t)},async setRaw(t,e){n.setItem(t,e)},async removeRaw(t){n.removeItem(t)},async keys(t){let e=[];for(let i=0;i<n.length;i++){let r=n.key(i);r&&r.startsWith(t)&&e.push(r)}return e}}}function d(){return O[$]||(O[$]=At()),O[$]}function _(n,t){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${n}:${t}`}function G(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function J(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var $,O,l,D=b(()=>{$="__vbStoreBackend",O=globalThis;l={configure(n={}){O[$]=n.backend??null},async set(n,t,e){let i={data:e,timestamp:Date.now()};await d().setRaw(_(n,t),JSON.stringify(i))},async get(n,t,e){let i=await d().getRaw(_(n,t));if(i==null)return null;let r=J(i);return!r||e?.maxAge!=null&&Date.now()-r.timestamp>e.maxAge?null:r.data},async remove(n,t){await d().removeRaw(_(n,t))},async list(n){let t=G(n),e=await d().keys(t),i=[];for(let r of e){let s=await d().getRaw(r);if(s==null)continue;let o=J(s);o&&i.push({key:r.slice(t.length),data:o.data,timestamp:o.timestamp})}return i},async clear(n){let t=G(n),e=await d().keys(t);for(let i of e)await d().removeRaw(i)},async clearAll(){let n=await d().keys("vb:");for(let t of n)await d().removeRaw(t)},async setMany(n,t){for(let[e,i]of t)await l.set(n,e,i)}};if(typeof window<"u"){let n=window.VB??(window.VB={});n.store??=l}});function Ct(n,t){if(!t)return n;let e=n??new URLSearchParams;for(let[i,r]of Object.entries(t))r!=null&&e.set(i,String(r));return e}async function kt(n){if((n.headers.get("content-type")??"").includes("application/json"))try{return await n.json()}catch{return null}try{return await n.text()}catch{return null}}function Q(n){return n.endsWith("/")?n.slice(0,-1):n}var v,S,Z,P,g,w,tt=b(()=>{v="__vbServiceConfig",S=globalThis,Z=()=>({baseUrl:"/go",headers:{},services:{}});S[v]||(S[v]=Z());P=()=>S[v],g=class extends Error{constructor(t,e,i,r){super(`VBService(${i}): ${t} ${r}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=r}};w=class n{static configure(t={}){let e=P();S[v]={baseUrl:t.baseUrl??e.baseUrl,headers:{...e.headers,...t.headers??{}},services:{...e.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");let e=P();return e.services[t]?Q(e.services[t]):e.baseUrl?`${Q(e.baseUrl)}/${t}`:`/go/${t}`}static _reset(){S[v]=Z()}constructor(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");this.role=t}async get(t,e){return this.#t("GET",t,{params:e})}async post(t,e){return this.#t("POST",t,{body:e})}async patch(t,e){return this.#t("PATCH",t,{body:e})}async delete(t){return this.#t("DELETE",t,{})}async#t(t,e,i){let r=n.resolve(this.role),s=e?e.startsWith("/")?e:`/${e}`:"",o=new URL(`${r}${s}`,globalThis.location?.origin??"http://localhost"),c=Ct(o.searchParams,i.params);c&&(o.search=c.toString());let a={method:t,headers:{...P().headers}};i.body!==void 0&&(a.body=JSON.stringify(i.body),a.headers["content-type"]="application/json");let h=o.toString(),f=await fetch(h,a),X=await kt(f);if(!f.ok)throw new g(f.status,X,this.role,`${s||"/"}`);return X}};if(typeof window<"u"){let n=window.VB??(window.VB={});n.service??=w,n.ServiceError??=g}});function $t(n,t){let e=et.get(t);e||et.set(t,e=new Map);let i=e.get(n);if(!i||!i.region.isConnected){let s=(t.ownerDocument||document).createElement("span");s.setAttribute("data-vb-announcer",n),s.setAttribute("role",n==="assertive"?"alert":"status"),s.setAttribute("aria-live",n),s.setAttribute("aria-atomic","true"),s.style.cssText=xt,t.appendChild(s),i={region:s},e.set(n,i)}return i}function T(n,{politeness:t="polite",root:e}={}){let i=String(n??"").trim();if(!i||typeof document>"u")return null;let r=e||document.body;if(!r)return null;let o=$t(t==="assertive"?"assertive":"polite",r);return clearTimeout(o.write),clearTimeout(o.clear),o.region.textContent="",o.write=setTimeout(()=>{o.region.textContent=i,o.clear=setTimeout(()=>{o.region.textContent=""},7e3)},50),o.region}var xt,et,nt=b(()=>{xt=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),et=new WeakMap});function M(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function ct(){return"hn-"+crypto.randomUUID().slice(0,8)}function N(n,t){let e="highlightsLabel"+t[0].toUpperCase()+t.slice(1);return n.dataset[e]||Lt[t]}function Rt(n,{textLength:t,colors:e}){if(!n||typeof n!="object")return null;let i=n,{startOffset:r,endOffset:s,color:o}=i;if(!Number.isInteger(r)||!Number.isInteger(s))return null;let c=r,a=s;return c<0||a<=c||a>t||!F(o)||!e.includes(o)||i.id!=null&&(typeof i.id!="string"||!/^[\w-]{1,64}$/.test(i.id))||i.text!=null&&typeof i.text!="string"||i.note!=null&&typeof i.note!="string"?null:{id:i.id||ct(),startOffset:c,endOffset:a,text:i.text??"",color:o,note:i.note??"",created:Number.isFinite(i.created)?i.created:Date.now()}}function F(n){return typeof n=="string"&&Nt.test(n)}function lt(){if(m.size===0){p&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(i=>i!==p),p=null);return}p||(p=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,p]);let n=[...m.keys()],t=n.map(i=>`::highlight(hn-${i}) { background-color: var(--highlight-${i}); color: var(--highlight-${i}-ink, var(--highlight-ink, CanvasText)); text-decoration-line: underline; text-decoration-color: var(--highlight-${i}); text-underline-offset: 2px; }`),e=n.map((i,r)=>`::highlight(hn-${i}) { background-color: Mark; color: MarkText; text-decoration-line: underline; text-decoration-color: MarkText; text-decoration-style: ${rt[r%rt.length]}; text-decoration-thickness: 2px; }`);p.replaceSync(`${t.join(`
1
+ var Mt=Object.defineProperty;var b=(n,t)=>()=>(n&&(t=n(n=0)),t);var Rt=(n,t)=>{for(var e in t)Mt(n,e,{get:t[e],enumerable:!0})};function Bt(){let n=globalThis.localStorage;if(!n)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return n.getItem(t)},async setRaw(t,e){n.setItem(t,e)},async removeRaw(t){n.removeItem(t)},async keys(t){let e=[];for(let i=0;i<n.length;i++){let r=n.key(i);r&&r.startsWith(t)&&e.push(r)}return e}}}function u(){return O[T]||(O[T]=Bt()),O[T]}function N(n,t){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${n}:${t}`}function nt(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function it(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var T,O,h,D=b(()=>{T="__vbStoreBackend",O=globalThis;h={configure(n={}){O[T]=n.backend??null},async set(n,t,e){let i={data:e,timestamp:Date.now()};await u().setRaw(N(n,t),JSON.stringify(i))},async get(n,t,e){let i=await u().getRaw(N(n,t));if(i==null)return null;let r=it(i);return!r||e?.maxAge!=null&&Date.now()-r.timestamp>e.maxAge?null:r.data},async remove(n,t){await u().removeRaw(N(n,t))},async list(n){let t=nt(n),e=await u().keys(t),i=[];for(let r of e){let s=await u().getRaw(r);if(s==null)continue;let o=it(s);o&&i.push({key:r.slice(t.length),data:o.data,timestamp:o.timestamp})}return i},async clear(n){let t=nt(n),e=await u().keys(t);for(let i of e)await u().removeRaw(i)},async clearAll(){let n=await u().keys("vb:");for(let t of n)await u().removeRaw(t)},async setMany(n,t){for(let[e,i]of t)await h.set(n,e,i)}};if(typeof window<"u"){let n=window.VB??(window.VB={});n.store??=h}});function _t(n,t){if(!t)return n;let e=n??new URLSearchParams;for(let[i,r]of Object.entries(t))r!=null&&e.set(i,String(r));return e}async function Pt(n){if((n.headers.get("content-type")??"").includes("application/json"))try{return await n.json()}catch{return null}try{return await n.text()}catch{return null}}function rt(n){return n.endsWith("/")?n.slice(0,-1):n}var E,S,st,q,g,w,ot=b(()=>{E="__vbServiceConfig",S=globalThis,st=()=>({baseUrl:"/go",headers:{},services:{}});S[E]||(S[E]=st());q=()=>S[E],g=class extends Error{constructor(t,e,i,r){super(`VBService(${i}): ${t} ${r}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=r}};w=class n{static configure(t={}){let e=q();S[E]={baseUrl:t.baseUrl??e.baseUrl,headers:{...e.headers,...t.headers??{}},services:{...e.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");let e=q();return e.services[t]?rt(e.services[t]):e.baseUrl?`${rt(e.baseUrl)}/${t}`:`/go/${t}`}static _reset(){S[E]=st()}constructor(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");this.role=t}async get(t,e){return this.#t("GET",t,{params:e})}async post(t,e){return this.#t("POST",t,{body:e})}async patch(t,e){return this.#t("PATCH",t,{body:e})}async delete(t){return this.#t("DELETE",t,{})}async#t(t,e,i){let r=n.resolve(this.role),s=e?e.startsWith("/")?e:`/${e}`:"",o=new URL(`${r}${s}`,globalThis.location?.origin??"http://localhost"),a=_t(o.searchParams,i.params);a&&(o.search=a.toString());let c={method:t,headers:{...q().headers}};i.body!==void 0&&(c.body=JSON.stringify(i.body),c.headers["content-type"]="application/json");let l=o.toString(),d=await fetch(l,c),v=await Pt(d);if(!d.ok)throw new g(d.status,v,this.role,`${s||"/"}`);return v}};if(typeof window<"u"){let n=window.VB??(window.VB={});n.service??=w,n.ServiceError??=g}});function Ht(n,t){let e=at.get(t);e||at.set(t,e=new Map);let i=e.get(n);if(!i||!i.region.isConnected){let s=(t.ownerDocument||document).createElement("span");s.setAttribute("data-vb-announcer",n),s.setAttribute("role",n==="assertive"?"alert":"status"),s.setAttribute("aria-live",n),s.setAttribute("aria-atomic","true"),s.style.cssText=It,t.appendChild(s),i={region:s},e.set(n,i)}return i}function L(n,{politeness:t="polite",root:e}={}){let i=String(n??"").trim();if(!i||typeof document>"u")return null;let r=e||document.body;if(!r)return null;let o=Ht(t==="assertive"?"assertive":"polite",r);return clearTimeout(o.write),clearTimeout(o.clear),o.region.textContent="",o.write=setTimeout(()=>{o.region.textContent=i,o.clear=setTimeout(()=>{o.region.textContent=""},7e3)},50),o.region}var It,at,ct=b(()=>{It=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),at=new WeakMap});function Nt(n,t){let e=0;for(;e<n.length&&e<t.length&&n[n.length-1-e]===t[t.length-1-e];)e++;return e}function Dt(n,t){let e=0;for(;e<n.length&&e<t.length&&n[e]===t[e];)e++;return e}function M(n,t,e){return{prefix:n.slice(Math.max(0,t-32),t),suffix:n.slice(e,e+32)}}function ht(n,t){let e=lt(t.text??"");if(!e)return null;if(t.endOffset<=n.length&&lt(n.slice(t.startOffset,t.endOffset))===e)return{start:t.startOffset,end:t.endOffset};let i=new RegExp(t.text.trim().split(/\s+/).map(Ft).join("\\s*"),"g"),r=t.prefix??"",s=t.suffix??"",o=null,a=-1,c=1/0;for(let l of n.matchAll(i)){let d=l.index,v=d+l[0].length,Q=M(n,d,v),F=Nt(Q.prefix,r)+Dt(Q.suffix,s),Z=Math.abs(d-t.startOffset);(F>a||F===a&&Z<c)&&(o={start:d,end:v},a=F,c=Z)}return o}var lt,Ft,dt=b(()=>{lt=n=>n.replace(/\s+/g,""),Ft=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});function P(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function wt(){return"hn-"+crypto.randomUUID().slice(0,8)}function R(n,t){let e="highlightsLabel"+t[0].toUpperCase()+t.slice(1);return n.dataset[e]||Ut[t]}function jt(n,{textLength:t,colors:e}){if(!n||typeof n!="object")return null;let i=n,{startOffset:r,endOffset:s,color:o}=i;if(!Number.isInteger(r)||!Number.isInteger(s))return null;let a=r,c=s;return a<0||c<=a||c>t||!U(o)||!e.includes(o)||i.id!=null&&(typeof i.id!="string"||!/^[\w-]{1,64}$/.test(i.id))||i.text!=null&&typeof i.text!="string"||i.note!=null&&typeof i.note!="string"||i.prefix!=null&&typeof i.prefix!="string"||i.suffix!=null&&typeof i.suffix!="string"?null:{id:i.id||wt(),startOffset:a,endOffset:c,text:i.text??"",prefix:(i.prefix??"").slice(-32),suffix:(i.suffix??"").slice(0,32),color:o,note:i.note??"",created:Number.isFinite(i.created)?i.created:Date.now()}}function U(n){return typeof n=="string"&&Wt.test(n)}function yt(){if(m.size===0){p&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(i=>i!==p),p=null);return}p||(p=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,p]);let n=[...m.keys()],t=n.map(i=>`::highlight(hn-${i}) { background-color: var(--highlight-${i}); color: var(--highlight-${i}-ink, var(--highlight-ink, CanvasText)); text-decoration-line: underline; text-decoration-color: var(--highlight-${i}); text-underline-offset: 2px; }`),e=n.map((i,r)=>`::highlight(hn-${i}) { background-color: Mark; color: MarkText; text-decoration-line: underline; text-decoration-color: MarkText; text-decoration-style: ${gt[r%gt.length]}; text-decoration-thickness: 2px; }`);p.replaceSync(`${t.join(`
2
2
  `)}
3
3
  @media (forced-colors: active) {
4
4
  ${e.join(`
5
5
  `)}
6
- }`)}function Mt(n){for(let t of n)m.set(t,(m.get(t)??0)+1);lt()}function Bt(n){for(let t of n){let e=(m.get(t)??0)-1;e>0?m.set(t,e):m.delete(t)}lt()}function It(n){let t=E.get(n),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${n}`),E.delete(n)):CSS.highlights.set(`hn-${n}`,new Highlight(...e))}function st(n,t){let e=new Set(t.keys());for(let[i,r]of E)r.has(n)&&e.add(i);for(let i of e){let r=t.get(i)??[],s=E.get(i);r.length?(s||E.set(i,s=new Map),s.set(n,r)):s?.delete(n),It(i)}}function ot(n,t,e){let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),r=0;for(;i.nextNode();){if(i.currentNode===t)return r+e;r+=(i.currentNode.textContent??"").length}return-1}function L(n,t,e){let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),r=0,s=null,o=0,c=null,a=0;for(;i.nextNode();){let h=i.currentNode,f=(h.textContent??"").length;if(!s&&r+f>t&&(s=h,o=t-r),r+f>=e){c=h,a=e-r;break}r+=f}if(!s||!c)return null;try{let h=document.createRange();return h.setStart(s,Math.min(o,(s.textContent??"").length)),h.setEnd(c,Math.min(a,(c.textContent??"").length)),h}catch{return null}}function q(n){let t=R.get(n);if(t&&!t.destroyed)return t;let e=new V(n);return R.set(n,e),e}function at(n=document){n.querySelectorAll(H).forEach(t=>{t.hasAttribute("data-highlights-init")||q(t)})}var H,it,Ot,Tt,R,Nt,rt,Lt,p,m,E,V,_t,ht=b(()=>{D();nt();H="[data-highlights]",it="highlights",Ot=["yellow","green","blue","pink"],Tt=typeof CSS<"u"&&"highlights"in CSS,R=new WeakMap;Nt=/^[a-z0-9_-]+$/i,rt=["solid","double","dotted","dashed","wavy"],Lt={annotation:"You highlighted",added:"Highlight added",removed:"Highlight removed",noteSaved:"Note saved"};p=null,m=new Map,E=new Map;V=class{#t;#i;#n;#h;#e=[];#s=!Tt;#d;#u;#l=!1;#f=[];#o=new Map;constructor(t){this.#t=t,this.#h=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#i=e&&e!==""?e:location.pathname;let i=t.dataset.highlightsColors,r=i?i.split(",").map(s=>s.trim()).filter(F):[...Ot];this.#n=[...new Set(r)],this.#s||Mt(this.#n),this.#c(),this.#h||(this.#d=this.#y.bind(this),this.#u=this.#b.bind(this),t.addEventListener("pointerup",this.#d),t.addEventListener("click",this.#u)),t.setAttribute("data-highlights-init",""),this.#E().then(()=>{this.#l||this.#c()})}get colors(){return[...this.#n]}get destroyed(){return this.#l}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(i=>i.id===t);e<0||(this.#e.splice(e,1),this.#a(),this.#c(),this.#r("highlights:removed",{id:t}),T(N(this.#t,"removed")))}clearAll(){this.#e=[],this.#a(),this.#c()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){let e;try{e=typeof t=="string"?JSON.parse(t):t}catch{return{imported:0,rejected:0}}if(!e||!Array.isArray(e.highlights))return{imported:0,rejected:0};let i=this.#g(e.highlights);return this.#e=i,this.#a(),this.#c(),{imported:i.length,rejected:e.highlights.length-i.length}}#g(t){let e={textLength:(this.#t.textContent??"").length,colors:this.#n},i=new Set,r=[];for(let s of t){let o=Rt(s,e);!o||i.has(o.id)||(i.add(o.id),r.push(o))}return r}destroy(){this.#l||(this.#l=!0,this.#d&&this.#t.removeEventListener("pointerup",this.#d),this.#u&&this.#t.removeEventListener("click",this.#u),this.#s?this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()}):(st(this,new Map),Bt(this.#n)),this.#m(),this.#o.clear(),this.#t.removeAttribute("data-highlights-init"),R.get(this.#t)===this&&R.delete(this.#t))}#y(){requestAnimationFrame(()=>{if(this.#l)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#r("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#b(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let r=e.dataset.hnId,s=this.#e.find(o=>o.id===r);if(s){this.#r("highlights:clicked",{id:r,highlight:{...s}}),this.#r("highlights:request-note",{id:r,highlight:{...s},controller:this});return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let r=i.dataset.hnId,s=this.#e.find(o=>o.id===r);if(s){this.#r("highlights:clicked",{id:r,highlight:{...s}});return}}if(!this.#s){let r=this.#S(t.clientX,t.clientY);r&&this.#r("highlights:clicked",{id:r.id,highlight:{...r}})}}findHighlightRect(t){let e=this.#e.find(s=>s.id===t);if(!e)return null;let i=this.#v(e);if(!i)return null;let r=i.getClientRects();return r.length?r[0]:null}#v(t){return this.#o.get(t.id)??L(this.#t,t.startOffset,t.endOffset)}#p(){this.#o.clear();for(let t of this.#e){let e=L(this.#t,t.startOffset,t.endOffset);e&&this.#o.set(t.id,e)}}#S(t,e){for(let i of this.#e){let r=this.#o.get(i.id);if(!r)continue;let s=r.getClientRects();for(let o of s)if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let i=e.getRangeAt(0);if(!this.#t.contains(i.commonAncestorContainer))return;let r=ot(this.#t,i.startContainer,i.startOffset),s=ot(this.#t,i.endContainer,i.endOffset);if(r<0||s<0||r>=s)return;let o=e.toString().trim(),c={id:ct(),startOffset:r,endOffset:s,text:o,color:t,note:"",created:Date.now()};this.#e.push(c),this.#a(),this.#c(),e.removeAllRanges(),this.#r("highlights:added",{id:c.id,text:o,color:t,note:""}),T(N(this.#t,"added"))}_changeColor(t,e){let i=this.#e.find(r=>r.id===t);i&&(i.color=e,this.#a(),this.#c())}_updateNote(t,e){let i=this.#e.find(r=>r.id===t);i&&(i.note=e,this.#a(),this.#w(),this.#r("highlights:note-changed",{id:t,note:e}),T(N(this.#t,"noteSaved")))}async#E(){let t=await l.get(it,this.#i);if(!t||!Array.isArray(t.highlights)||this.#l)return;let e=this.#g(t.highlights),i=M(this.#t.textContent);t.contentHash&&t.contentHash!==i?(this.#e=e.filter(r=>{let s=L(this.#t,r.startOffset,r.endOffset);return s?s.toString().trim()===r.text:!1}),this.#a()):this.#e=e}#a(){let t={version:1,contentHash:M(this.#t.textContent),highlights:this.#e};l.set(it,this.#i,t).catch(()=>{})}#c(){this.#s?(this.#C(),this.#p()):(this.#p(),this.#A()),this.#w()}#A(){let t=new Map;for(let e of this.#n)t.set(e,[]);for(let e of this.#e){let i=this.#o.get(e.id);i&&t.has(e.color)&&t.get(e.color).push(i)}st(this,t)}#C(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let i=e.parentNode;for(;e.firstChild;)i.insertBefore(e.firstChild,e);i.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,i)=>i.startOffset-e.startOffset);for(let e of t){let i=L(this.#t,e.startOffset,e.endOffset);if(!i)continue;let r=document.createElement("mark");r.dataset.hnId=e.id,F(e.color)&&(r.dataset.hnColor=e.color,r.style.setProperty("--_hn-color",`var(--highlight-${e.color})`),r.style.setProperty("--_hn-ink",`var(--highlight-${e.color}-ink, var(--highlight-ink))`));try{i.surroundContents(r)}catch{let s=i.extractContents();r.appendChild(s),i.insertNode(r)}}}#m(){for(let t of this.#f)t.remove();this.#f=[]}#w(){if(this.#m(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");let e=this.#t.getBoundingClientRect(),i=N(this.#t,"annotation");for(let r of this.#e){let s=this.#o.get(r.id);if(!s)continue;let o=s.getClientRects();if(o.length===0)continue;let c=o[0].top-e.top,a=document.createElement("span");if(a.className="hn-margin-annotation",a.dataset.hnId=r.id,a.setAttribute("aria-hidden","true"),a.style.insetBlockStart=`${c}px`,r.note){let h=document.createElement("span");h.className="hn-note-indicator",h.textContent="*",a.append(h,` ${i}`),a.classList.add("hn-has-note")}else a.textContent=i;this.#t.appendChild(a),this.#f.push(a)}}#r(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>at()):at();_t=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(H)&&q(i),i.querySelectorAll(H).forEach(r=>{r.hasAttribute("data-highlights-init")||q(r)})}});_t.observe(document.documentElement,{childList:!0,subtree:!0})});var bt={};Et(bt,{currentHash:()=>j,initPageWatch:()=>U,normalisePath:()=>wt,pageKey:()=>y,readWatch:()=>C,removeWatch:()=>yt,writeWatch:()=>k});function pt(){return typeof window<"u"&&window.vbPageWatch?.serverSync===!0?!0:document.querySelector('meta[name="vb-page-watch-server"]')?.getAttribute("content")==="true"}async function Dt(n){if(!pt())return null;try{let t=new w("notify"),e={url:n.url,type:"page-watch",notify:["panel"]},i=await t.post("/subscribe",e);return typeof i?.id=="string"?i.id:null}catch(t){let e=t instanceof g?`${t.status}`:String(t);return console.warn("[page-watch] server subscribe failed; client-only watch in effect.",e),null}}async function mt(n){if(!(!n||!pt()))try{await new w("notify").delete(`/subscribe/${encodeURIComponent(n)}`)}catch(t){let e=t instanceof g?`${t.status}`:String(t);console.warn("[page-watch] server unsubscribe failed; local state already cleared.",e)}}function Pt(){return document.querySelector("main")||document.querySelector("article")||document.body}function wt(n){let t=(n||"/").replace(/\/index\.html?$/i,"/");return t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function y(){return wt(location.pathname)}async function Ht(){let n=y(),t=location.pathname||"/",e=n==="/"?"":n,i=new Set([t,`${e}/`,`${e}/index.html`]);if(i.delete(n),await l.get(u,n)){for(let r of i)await l.remove(u,r);return}for(let r of i){let s=await l.get(u,r);if(s){await l.set(u,n,s),await l.remove(u,r);return}}}function j(){let n=Pt();return n?M(n.textContent||""):""}function Ft(){return document.title||y()}async function C(){return dt??=Ht().catch(()=>{}),await dt,await l.get(u,y())}async function k(n){await l.set(u,y(),n)}async function yt(){await l.remove(u,y())}function B(n,t,e){return n.getAttribute(`data-label-${t}`)??e}function I(n,t){n.setAttribute("aria-pressed",t?"true":"false"),n.dataset.watching="",t||delete n.dataset.watching;let e=n.querySelector("icon-wc");if(e&&e.setAttribute("name",t?"bookmark-check":"bookmark"),n.hasAttribute("data-watch-label-locked"))return;let i=[...n.childNodes].find(r=>r.nodeType===Node.TEXT_NODE&&(r.textContent||"").trim());i&&(i.textContent=t?B(n,"watching","Watching"):B(n,"watch","Watch for updates")),n.setAttribute("title",t?B(n,"stop","Stop watching this page"):B(n,"action","Watch this page for content updates"))}async function Vt(){let n=!!await C();for(let t of document.querySelectorAll(`${A}[data-watch-page-init]`))I(t,n)}async function W(n){if(n.hasAttribute("data-watch-page-init"))return;n.setAttribute("data-watch-page-init",""),n.setAttribute("type",n.getAttribute("type")||"button");let t=await C();I(n,!!t),n.addEventListener("click",async e=>{e.preventDefault();let i=await C();if(i)await yt(),I(n,!1),n.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:i.url,subscriptionId:i.subscriptionId}})),mt(i.subscriptionId);else{let r={url:location.pathname||"/",title:Ft(),contentHash:j(),watchedAt:new Date().toISOString(),lastChecked:new Date().toISOString(),lastChanged:null,subscriptionId:null};await k(r),I(n,!0),n.dispatchEvent(new CustomEvent("page-watch:add",{bubbles:!0,composed:!0,detail:{entry:r}}));let s=await Dt(r);s&&await k({...r,subscriptionId:s})}})}async function qt(){let n=await C();if(!n)return;let t=j(),e=new Date().toISOString(),i=n.contentHash,r={...n,lastChecked:e};if(t&&t!==i){r.contentHash=t,r.lastChanged=e,await k(r);let s={id:`page-watch:${n.url}:${t}`,type:"watch",title:`Updated: ${n.title}`,body:"Content changed since your last visit.",url:n.url,date:e,read:!1,dismissed:!1,priority:"normal"};document.querySelector("notification-wc")&&!customElements.get("notification-wc")&&await customElements.whenDefined("notification-wc"),document.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:s}}))}else await k(r)}function U(n=document){for(let t of n.querySelectorAll(A))W(t);qt()}function ut(n){if(Vt(),n.type!=="page-watch:remove")return;if(!(n.target instanceof Element&&n.target.matches(A))){let e=n.detail;mt(e?.subscriptionId??null)}}var A,u,dt,ft,gt,vt=b(()=>{D();tt();ht();A="[data-watch-page]",u="watches";dt=null;ft=Symbol.for("vb.page-watch-init"),gt=globalThis;gt[ft]||(gt[ft]=!0,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>U()):U(),document.addEventListener("page-watch:add",ut),document.addEventListener("page-watch:remove",ut),new MutationObserver(t=>{for(let e of t)for(let i of e.addedNodes){if(i.nodeType!==Node.ELEMENT_NODE)continue;let r=i;r.matches?.(A)&&W(r),r.querySelectorAll?.(A).forEach(s=>W(s))}}).observe(document.documentElement,{childList:!0,subtree:!0}))});var jt=window.matchMedia("(prefers-reduced-motion: reduce)");var K=new Map;function Y(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=K.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}K.set(n,r),customElements.define(n,t)}var x=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#t.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#i||(this.#i=t)}#n(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var Wt={watch:"Watch for updates",watching:"Watching",action:"Watch this page for updates",stop:"Stop watching this page"},z=class extends x{static observedAttributes=["variant","label","data-label-watch","data-label-watching","data-label-action","data-label-stop"];#t=null;#i=null;setup(){if(this.hasAttribute("server-sync")){let i=window;i.vbPageWatch={...i.vbPageWatch??{},serverSync:!0}}let t=this.#h();this.dataset.variant=t,this.querySelectorAll(":scope > [data-watch-wc]").forEach(i=>i.remove());let e=this.#e(t);this.#t=e,this.appendChild(e),this.#s(),this.#i=new MutationObserver(()=>this.#s()),this.#i.observe(e,{attributes:!0,attributeFilter:["aria-pressed"]}),Promise.resolve().then(()=>(vt(),bt)).catch(()=>{})}teardown(){this.#i?.disconnect(),this.#i=null,this.#t?.remove(),this.#t=null}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||this._reinit()}#n(t){return this.getAttribute(`data-label-${t}`)??Wt[t]}#h(){let t=this.getAttribute("variant");return t==="compact"||t==="button"?t:"icon"}#e(t){let e=document.createElement("button");e.type="button",e.className="ghost",e.setAttribute("data-watch-page",""),e.setAttribute("data-watch-wc",""),e.setAttribute("data-watch-label-locked",""),e.setAttribute("aria-pressed","false");let i=document.createElement("icon-wc");return i.setAttribute("name","bookmark"),i.setAttribute("size",t==="icon"?"sm":"xs"),i.setAttribute("aria-hidden","true"),e.appendChild(i),t==="icon"?e.setAttribute("aria-label",this.#n("action")):e.appendChild(document.createElement("span")),e}#s(){let t=this.#t;if(!t)return;let e=t.getAttribute("aria-pressed")==="true";t.querySelector("icon-wc")?.setAttribute("name",e?"bookmark-check":"bookmark");let i=t.querySelector(":scope > span");i?(i.textContent=this.getAttribute("label")??this.#n(e?"watching":"watch"),t.removeAttribute("title")):t.setAttribute("title",e?this.#n("stop"):this.#n("action"))}};Y("watch-wc",z);export{z as WatchWc};
6
+ }`)}function Xt(n){for(let t of n)m.set(t,(m.get(t)??0)+1);yt()}function zt(n){for(let t of n){let e=(m.get(t)??0)-1;e>0?m.set(t,e):m.delete(t)}yt()}function Gt(n){let t=A.get(n),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${n}`),A.delete(n)):CSS.highlights.set(`hn-${n}`,new Highlight(...e))}function pt(n,t){let e=new Set(t.keys());for(let[i,r]of A)r.has(n)&&e.add(i);for(let i of e){let r=t.get(i)??[],s=A.get(i);r.length?(s||A.set(i,s=new Map),s.set(n,r)):s?.delete(n),Gt(i)}}function z(n){return document.createTreeWalker(n,NodeFilter.SHOW_TEXT,t=>t.parentElement?.closest(".hn-margin-annotation")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT)}function B(n){let t=z(n),e="";for(;t.nextNode();)e+=t.currentNode.textContent??"";return e}function mt(n,t,e){let i=z(n),r=0;for(;i.nextNode();){if(i.currentNode===t)return r+e;r+=(i.currentNode.textContent??"").length}return-1}function V(n,t,e){let i=z(n),r=0,s=null,o=0,a=null,c=0;for(;i.nextNode();){let l=i.currentNode,d=(l.textContent??"").length;if(!s&&r+d>t&&(s=l,o=t-r),r+d>=e){a=l,c=e-r;break}r+=d}if(!s||!a)return null;try{let l=document.createRange();return l.setStart(s,Math.min(o,(s.textContent??"").length)),l.setEnd(a,Math.min(c,(a.textContent??"").length)),l}catch{return null}}function X(n){let t=_.get(n);if(t&&!t.destroyed)return t;let e=new j(n);return _.set(n,e),e}function bt(n=document){n.querySelectorAll(W).forEach(t=>{t.hasAttribute("data-highlights-init")||X(t)})}var W,ft,qt,Vt,_,Wt,gt,Ut,p,m,A,j,Kt,vt=b(()=>{D();ct();dt();W="[data-highlights]",ft="highlights",qt=["yellow","green","blue","pink"],Vt=typeof CSS<"u"&&"highlights"in CSS,_=new WeakMap;Wt=/^[a-z0-9_-]+$/i,gt=["solid","double","dotted","dashed","wavy"],Ut={annotation:"You highlighted",added:"Highlight added",removed:"Highlight removed",noteSaved:"Note saved"};p=null,m=new Map,A=new Map;j=class{#t;#i;#n;#h;#e=[];#r=[];#d=!Vt;#u;#f;#l=!1;#g=[];#o=new Map;constructor(t){this.#t=t,this.#h=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#i=e&&e!==""?e:location.pathname;let i=t.dataset.highlightsColors,r=i?i.split(",").map(s=>s.trim()).filter(U):[...qt];this.#n=[...new Set(r)],this.#d||Xt(this.#n),this.#c(),this.#h||(this.#u=this.#y.bind(this),this.#f=this.#v.bind(this),t.addEventListener("pointerup",this.#u),t.addEventListener("click",this.#f)),t.setAttribute("data-highlights-init",""),this.#A().then(()=>{this.#l||(this.#c(),this.#C())})}get colors(){return[...this.#n]}get destroyed(){return this.#l}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}getUnplaced(){return this.#r.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(r=>r.id===t),i=this.#r.findIndex(r=>r.id===t);e<0&&i<0||(e>=0?this.#e.splice(e,1):this.#r.splice(i,1),this.#a(),this.#c(),this.#s("highlights:removed",{id:t}),L(R(this.#t,"removed")))}clearAll(){this.#e=[],this.#r=[],this.#a(),this.#c()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){let e;try{e=typeof t=="string"?JSON.parse(t):t}catch{return{imported:0,rejected:0}}if(!e||!Array.isArray(e.highlights))return{imported:0,rejected:0};let i=this.#p(e.highlights);return this.#e=i,this.#r=[],this.#a(),this.#c(),{imported:i.length,rejected:e.highlights.length-i.length}}#p(t,e=B(this.#t).length){let i={textLength:e,colors:this.#n},r=new Set,s=[];for(let o of t){let a=jt(o,i);!a||r.has(a.id)||(r.add(a.id),s.push(a))}return s}destroy(){this.#l||(this.#l=!0,this.#u&&this.#t.removeEventListener("pointerup",this.#u),this.#f&&this.#t.removeEventListener("click",this.#f),this.#d?this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()}):(pt(this,new Map),zt(this.#n)),this.#b(),this.#o.clear(),this.#t.removeAttribute("data-highlights-init"),_.get(this.#t)===this&&_.delete(this.#t))}#y(){requestAnimationFrame(()=>{if(this.#l)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#s("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#v(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let r=e.dataset.hnId,s=this.#e.find(o=>o.id===r);if(s){this.#s("highlights:clicked",{id:r,highlight:{...s}}),this.#s("highlights:request-note",{id:r,highlight:{...s},controller:this});return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let r=i.dataset.hnId,s=this.#e.find(o=>o.id===r);if(s){this.#s("highlights:clicked",{id:r,highlight:{...s}});return}}if(!this.#d){let r=this.#S(t.clientX,t.clientY);r&&this.#s("highlights:clicked",{id:r.id,highlight:{...r}})}}findHighlightRect(t){let e=this.#e.find(s=>s.id===t);if(!e)return null;let i=this.#E(e);if(!i)return null;let r=i.getClientRects();return r.length?r[0]:null}#E(t){return this.#o.get(t.id)??V(this.#t,t.startOffset,t.endOffset)}#m(){this.#o.clear();for(let t of this.#e){let e=V(this.#t,t.startOffset,t.endOffset);e&&this.#o.set(t.id,e)}}#S(t,e){for(let i of this.#e){let r=this.#o.get(i.id);if(!r)continue;let s=r.getClientRects();for(let o of s)if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let i=e.getRangeAt(0);if(!this.#t.contains(i.commonAncestorContainer))return;let r=mt(this.#t,i.startContainer,i.startOffset),s=mt(this.#t,i.endContainer,i.endOffset);if(r<0||s<0||r>=s)return;let o=e.toString().trim(),a={id:wt(),startOffset:r,endOffset:s,text:o,...M(B(this.#t),r,s),color:t,note:"",created:Date.now()};this.#e.push(a),this.#a(),this.#c(),e.removeAllRanges(),this.#s("highlights:added",{id:a.id,text:o,color:t,note:""}),L(R(this.#t,"added"))}_changeColor(t,e){let i=this.#e.find(r=>r.id===t);i&&(i.color=e,this.#a(),this.#c())}_updateNote(t,e){let i=this.#e.find(r=>r.id===t);i&&(i.note=e,this.#a(),this.#w(),this.#s("highlights:note-changed",{id:t,note:e}),L(R(this.#t,"noteSaved")))}async#A(){let t=await h.get(ft,this.#i);if(!t||!Array.isArray(t.highlights)||this.#l)return;let e=Array.isArray(t.unplaced)?t.unplaced:[],i=this.#p([...t.highlights,...e],1/0),r=B(this.#t);if(e.length===0&&t.contentHash===P(r)){this.#e=i;return}this.#e=[],this.#r=[];for(let s of i){let o=ht(r,s);o?this.#e.push({...s,startOffset:o.start,endOffset:o.end,...M(r,o.start,o.end)}):this.#r.push(s)}this.#a()}#C(){this.#r.length!==0&&(console.warn(`[highlights] ${this.#r.length} stored highlight(s) could not be found in the current text. They are kept in storage.`,this.#t),this.#s("highlights:unplaced",{highlights:this.getUnplaced()}))}#a(){let t={version:1,contentHash:P(B(this.#t)),highlights:this.#e,...this.#r.length?{unplaced:this.#r}:{}};h.set(ft,this.#i,t).catch(()=>{})}#c(){this.#d?(this.#k(),this.#m()):(this.#m(),this.#x()),this.#w()}#x(){let t=new Map;for(let e of this.#n)t.set(e,[]);for(let e of this.#e){let i=this.#o.get(e.id);i&&t.has(e.color)&&t.get(e.color).push(i)}pt(this,t)}#k(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let i=e.parentNode;for(;e.firstChild;)i.insertBefore(e.firstChild,e);i.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,i)=>i.startOffset-e.startOffset);for(let e of t){let i=V(this.#t,e.startOffset,e.endOffset);if(!i)continue;let r=document.createElement("mark");r.dataset.hnId=e.id,U(e.color)&&(r.dataset.hnColor=e.color,r.style.setProperty("--_hn-color",`var(--highlight-${e.color})`),r.style.setProperty("--_hn-ink",`var(--highlight-${e.color}-ink, var(--highlight-ink))`));try{i.surroundContents(r)}catch{let s=i.extractContents();r.appendChild(s),i.insertNode(r)}}}#b(){for(let t of this.#g)t.remove();this.#g=[]}#w(){if(this.#b(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");let e=this.#t.getBoundingClientRect(),i=R(this.#t,"annotation");for(let r of this.#e){let s=this.#o.get(r.id);if(!s)continue;let o=s.getClientRects();if(o.length===0)continue;let a=o[0].top-e.top,c=document.createElement("span");if(c.className="hn-margin-annotation",c.dataset.hnId=r.id,c.setAttribute("aria-hidden","true"),c.style.insetBlockStart=`${a}px`,r.note){let l=document.createElement("span");l.className="hn-note-indicator",l.textContent="*",c.append(l,` ${i}`),c.classList.add("hn-has-note")}else c.textContent=i;this.#t.appendChild(c),this.#g.push(c)}}#s(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>bt()):bt();Kt=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(W)&&X(i),i.querySelectorAll(W).forEach(r=>{r.hasAttribute("data-highlights-init")||X(r)})}});Kt.observe(document.documentElement,{childList:!0,subtree:!0})});var Ot={};Rt(Ot,{currentHash:()=>Y,initPageWatch:()=>K,normalisePath:()=>$t,pageKey:()=>y,readWatch:()=>x,removeWatch:()=>Tt,writeWatch:()=>k});function xt(){return typeof window<"u"&&window.vbPageWatch?.serverSync===!0?!0:document.querySelector('meta[name="vb-page-watch-server"]')?.getAttribute("content")==="true"}async function Yt(n){if(!xt())return null;try{let t=new w("notify"),e={url:n.url,type:"page-watch",notify:["panel"]},i=await t.post("/subscribe",e);return typeof i?.id=="string"?i.id:null}catch(t){let e=t instanceof g?`${t.status}`:String(t);return console.warn("[page-watch] server subscribe failed; client-only watch in effect.",e),null}}async function kt(n){if(!(!n||!xt()))try{await new w("notify").delete(`/subscribe/${encodeURIComponent(n)}`)}catch(t){let e=t instanceof g?`${t.status}`:String(t);console.warn("[page-watch] server unsubscribe failed; local state already cleared.",e)}}function Jt(){return document.querySelector("main")||document.querySelector("article")||document.body}function $t(n){let t=(n||"/").replace(/\/index\.html?$/i,"/");return t.length>1&&(t=t.replace(/\/+$/,"")),t||"/"}function y(){return $t(location.pathname)}async function Qt(){let n=y(),t=location.pathname||"/",e=n==="/"?"":n,i=new Set([t,`${e}/`,`${e}/index.html`]);if(i.delete(n),await h.get(f,n)){for(let r of i)await h.remove(f,r);return}for(let r of i){let s=await h.get(f,r);if(s){await h.set(f,n,s),await h.remove(f,r);return}}}function Y(){let n=Jt();return n?P(n.textContent||""):""}function Zt(){return document.title||y()}async function x(){return Et??=Qt().catch(()=>{}),await Et,await h.get(f,y())}async function k(n){await h.set(f,y(),n)}async function Tt(){await h.remove(f,y())}function I(n,t,e){return n.getAttribute(`data-label-${t}`)??e}function H(n,t){n.setAttribute("aria-pressed",t?"true":"false"),n.dataset.watching="",t||delete n.dataset.watching;let e=n.querySelector("icon-wc");if(e&&e.setAttribute("name",t?"bookmark-check":"bookmark"),n.hasAttribute("data-watch-label-locked"))return;let i=[...n.childNodes].find(r=>r.nodeType===Node.TEXT_NODE&&(r.textContent||"").trim());i&&(i.textContent=t?I(n,"watching","Watching"):I(n,"watch","Watch for updates")),n.setAttribute("title",t?I(n,"stop","Stop watching this page"):I(n,"action","Watch this page for content updates"))}async function te(){let n=!!await x();for(let t of document.querySelectorAll(`${C}[data-watch-page-init]`))H(t,n)}async function G(n){if(n.hasAttribute("data-watch-page-init"))return;n.setAttribute("data-watch-page-init",""),n.setAttribute("type",n.getAttribute("type")||"button");let t=await x();H(n,!!t),n.addEventListener("click",async e=>{e.preventDefault();let i=await x();if(i)await Tt(),H(n,!1),n.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:i.url,subscriptionId:i.subscriptionId}})),kt(i.subscriptionId);else{let r={url:location.pathname||"/",title:Zt(),contentHash:Y(),watchedAt:new Date().toISOString(),lastChecked:new Date().toISOString(),lastChanged:null,subscriptionId:null};await k(r),H(n,!0),n.dispatchEvent(new CustomEvent("page-watch:add",{bubbles:!0,composed:!0,detail:{entry:r}}));let s=await Yt(r);s&&await k({...r,subscriptionId:s})}})}async function ee(){let n=await x();if(!n)return;let t=Y(),e=new Date().toISOString(),i=n.contentHash,r={...n,lastChecked:e};if(t&&t!==i){r.contentHash=t,r.lastChanged=e,await k(r);let s={id:`page-watch:${n.url}:${t}`,type:"watch",title:`Updated: ${n.title}`,body:"Content changed since your last visit.",url:n.url,date:e,read:!1,dismissed:!1,priority:"normal"};document.querySelector("notification-wc")&&!customElements.get("notification-wc")&&await customElements.whenDefined("notification-wc"),document.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:s}}))}else await k(r)}function K(n=document){for(let t of n.querySelectorAll(C))G(t);ee()}function St(n){if(te(),n.type!=="page-watch:remove")return;if(!(n.target instanceof Element&&n.target.matches(C))){let e=n.detail;kt(e?.subscriptionId??null)}}var C,f,Et,At,Ct,Lt=b(()=>{D();ot();vt();C="[data-watch-page]",f="watches";Et=null;At=Symbol.for("vb.page-watch-init"),Ct=globalThis;Ct[At]||(Ct[At]=!0,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>K()):K(),document.addEventListener("page-watch:add",St),document.addEventListener("page-watch:remove",St),new MutationObserver(t=>{for(let e of t)for(let i of e.addedNodes){if(i.nodeType!==Node.ELEMENT_NODE)continue;let r=i;r.matches?.(C)&&G(r),r.querySelectorAll?.(C).forEach(s=>G(s))}}).observe(document.documentElement,{childList:!0,subtree:!0}))});var ae=window.matchMedia("(prefers-reduced-motion: reduce)");var tt=new Map;function et(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=tt.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}tt.set(n,r),customElements.define(n,t)}var $=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#t.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#i||(this.#i=t)}#n(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var ne={watch:"Watch for updates",watching:"Watching",action:"Watch this page for updates",stop:"Stop watching this page"},J=class extends ${static observedAttributes=["variant","label","data-label-watch","data-label-watching","data-label-action","data-label-stop"];#t=null;#i=null;setup(){if(this.hasAttribute("server-sync")){let i=window;i.vbPageWatch={...i.vbPageWatch??{},serverSync:!0}}let t=this.#h();this.dataset.variant=t,this.querySelectorAll(":scope > [data-watch-wc]").forEach(i=>i.remove());let e=this.#e(t);this.#t=e,this.appendChild(e),this.#r(),this.#i=new MutationObserver(()=>this.#r()),this.#i.observe(e,{attributes:!0,attributeFilter:["aria-pressed"]}),Promise.resolve().then(()=>(Lt(),Ot)).catch(()=>{})}teardown(){this.#i?.disconnect(),this.#i=null,this.#t?.remove(),this.#t=null}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||this._reinit()}#n(t){return this.getAttribute(`data-label-${t}`)??ne[t]}#h(){let t=this.getAttribute("variant");return t==="compact"||t==="button"?t:"icon"}#e(t){let e=document.createElement("button");e.type="button",e.className="ghost",e.setAttribute("data-watch-page",""),e.setAttribute("data-watch-wc",""),e.setAttribute("data-watch-label-locked",""),e.setAttribute("aria-pressed","false");let i=document.createElement("icon-wc");return i.setAttribute("name","bookmark"),i.setAttribute("size",t==="icon"?"sm":"xs"),i.setAttribute("aria-hidden","true"),e.appendChild(i),t==="icon"?e.setAttribute("aria-label",this.#n("action")):e.appendChild(document.createElement("span")),e}#r(){let t=this.#t;if(!t)return;let e=t.getAttribute("aria-pressed")==="true";t.querySelector("icon-wc")?.setAttribute("name",e?"bookmark-check":"bookmark");let i=t.querySelector(":scope > span");i?(i.textContent=this.getAttribute("label")??this.#n(e?"watching":"watch"),t.removeAttribute("title")):t.setAttribute("title",e?this.#n("stop"):this.#n("action"))}};et("watch-wc",J);export{J as WatchWc};
7
7
  //# sourceMappingURL=watch-wc.js.map