vanilla-breeze 0.4.0 → 0.5.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 (238) hide show
  1. package/custom-elements.json +13966 -11505
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +1 -1
  4. package/dist/cdn/components/ai-chat.js +9 -6
  5. package/dist/cdn/components/ai-summary.js +4 -2
  6. package/dist/cdn/components/analytics-panel.js +19 -21
  7. package/dist/cdn/components/audio-player.js +17 -7
  8. package/dist/cdn/components/audio-visualizer.js +3 -3
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -11
  16. package/dist/cdn/components/chart-wc.js +32 -32
  17. package/dist/cdn/components/chat-input.js +1 -1
  18. package/dist/cdn/components/chat-window.js +1 -1
  19. package/dist/cdn/components/color-picker.js +1 -1
  20. package/dist/cdn/components/combo-box.js +1 -1
  21. package/dist/cdn/components/command-palette.js +1 -1
  22. package/dist/cdn/components/comment-box.js +49 -49
  23. package/dist/cdn/components/comment-thread.js +32 -32
  24. package/dist/cdn/components/comment-wc.js +1 -1
  25. package/dist/cdn/components/compare-surface.js +1 -1
  26. package/dist/cdn/components/consent-banner.js +1 -1
  27. package/dist/cdn/components/content-lens.js +1 -1
  28. package/dist/cdn/components/content-swap.js +1 -1
  29. package/dist/cdn/components/context-menu.js +1 -1
  30. package/dist/cdn/components/data-table.js +1 -1
  31. package/dist/cdn/components/date-picker.js +1 -1
  32. package/dist/cdn/components/day-view.js +1 -1
  33. package/dist/cdn/components/diagram-wc.js +2 -2
  34. package/dist/cdn/components/drag-surface.js +1 -1
  35. package/dist/cdn/components/drop-down.js +1 -1
  36. package/dist/cdn/components/emoji-picker.js +1 -1
  37. package/dist/cdn/components/flow-diagram.js +1 -1
  38. package/dist/cdn/components/foot-notes.js +1 -1
  39. package/dist/cdn/components/form-field.js +1 -1
  40. package/dist/cdn/components/geo-map.js +4 -4
  41. package/dist/cdn/components/glossary-index.js +1 -1
  42. package/dist/cdn/components/glossary-wc.js +1 -1
  43. package/dist/cdn/components/heading-links.js +1 -1
  44. package/dist/cdn/components/highlight-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 +100 -100
  49. package/dist/cdn/components/markdown-editor.js +1 -1
  50. package/dist/cdn/components/markdown-viewer.js +11 -11
  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 +4 -4
  54. package/dist/cdn/components/page-info.js +2 -2
  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 +5 -5
  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 +4 -4
  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/reader-view.js +3 -3
  68. package/dist/cdn/components/reading-progress.js +1 -1
  69. package/dist/cdn/components/recently-visited.js +7 -7
  70. package/dist/cdn/components/score-card.js +2 -2
  71. package/dist/cdn/components/selection-menu.js +1 -1
  72. package/dist/cdn/components/settings-panel.js +4 -4
  73. package/dist/cdn/components/share-wc.js +2 -2
  74. package/dist/cdn/components/short-cuts.js +1 -1
  75. package/dist/cdn/components/site-index.js +6 -6
  76. package/dist/cdn/components/site-map.js +1 -1
  77. package/dist/cdn/components/site-search.js +3 -3
  78. package/dist/cdn/components/slide-accept.js +1 -1
  79. package/dist/cdn/components/social-embed.js +1 -1
  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 +44 -44
  87. package/dist/cdn/components/time-index.js +2 -2
  88. package/dist/cdn/components/time-picker.js +1 -1
  89. package/dist/cdn/components/toast-msg.js +1 -1
  90. package/dist/cdn/components/tool-tip.js +1 -1
  91. package/dist/cdn/components/topic-map.js +3 -3
  92. package/dist/cdn/components/trust-filter.js +3 -3
  93. package/dist/cdn/components/version-switcher.js +3 -13
  94. package/dist/cdn/components/video-player.js +1 -1
  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/packs/effects.full.js +1 -1
  99. package/dist/cdn/packs/kawaii.effects.css +1 -1
  100. package/dist/cdn/packs/kawaii.full.css +1 -1
  101. package/dist/cdn/packs/kawaii.full.js +4 -4
  102. package/dist/cdn/packs/manifest.json +7 -7
  103. package/dist/cdn/packs/memphis.full.css +1 -1
  104. package/dist/cdn/packs/memphis.theme.css +1 -1
  105. package/dist/cdn/packs/ui.full.js +46 -46
  106. package/dist/cdn/themes/8bit.css +1 -1
  107. package/dist/cdn/themes/8bit.tokens.json +1 -1
  108. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  109. package/dist/cdn/themes/alpha1999.tokens.json +1 -1
  110. package/dist/cdn/themes/art-deco-dark.tokens.json +33 -1
  111. package/dist/cdn/themes/art-deco.css +1 -1
  112. package/dist/cdn/themes/art-deco.tokens.json +23 -1
  113. package/dist/cdn/themes/bauhaus-dark.tokens.json +23 -1
  114. package/dist/cdn/themes/bauhaus.css +1 -1
  115. package/dist/cdn/themes/bauhaus.tokens.json +1 -1
  116. package/dist/cdn/themes/brutalist-dark.tokens.json +33 -1
  117. package/dist/cdn/themes/brutalist.css +1 -1
  118. package/dist/cdn/themes/brutalist.tokens.json +23 -1
  119. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  120. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  121. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  122. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  123. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  124. package/dist/cdn/themes/classic-dark.tokens.json +1 -1
  125. package/dist/cdn/themes/classic.tokens.json +1 -1
  126. package/dist/cdn/themes/claymorphism-dark.tokens.json +33 -1
  127. package/dist/cdn/themes/claymorphism.css +1 -1
  128. package/dist/cdn/themes/claymorphism.tokens.json +23 -1
  129. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  130. package/dist/cdn/themes/clinical.tokens.json +1 -1
  131. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  132. package/dist/cdn/themes/cottagecore.css +1 -1
  133. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  134. package/dist/cdn/themes/cyber.css +1 -1
  135. package/dist/cdn/themes/cyber.tokens.json +1 -1
  136. package/dist/cdn/themes/dawn-dark.tokens.json +33 -1
  137. package/dist/cdn/themes/dawn.css +1 -1
  138. package/dist/cdn/themes/dawn.tokens.json +23 -1
  139. package/dist/cdn/themes/dracula.tokens.json +1 -1
  140. package/dist/cdn/themes/dusk.css +1 -1
  141. package/dist/cdn/themes/dusk.tokens.json +1 -1
  142. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  143. package/dist/cdn/themes/editorial.css +1 -1
  144. package/dist/cdn/themes/editorial.tokens.json +1 -1
  145. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  146. package/dist/cdn/themes/financial.tokens.json +1 -1
  147. package/dist/cdn/themes/genai.css +1 -1
  148. package/dist/cdn/themes/genai.tokens.json +1 -1
  149. package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
  150. package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
  151. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  152. package/dist/cdn/themes/government.tokens.json +1 -1
  153. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  154. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  155. package/dist/cdn/themes/high-noon-dark.tokens.json +23 -1
  156. package/dist/cdn/themes/high-noon.css +1 -1
  157. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  158. package/dist/cdn/themes/journal-dark.tokens.json +33 -1
  159. package/dist/cdn/themes/journal.css +1 -1
  160. package/dist/cdn/themes/journal.tokens.json +23 -1
  161. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  162. package/dist/cdn/themes/kawaii.css +1 -1
  163. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  164. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  165. package/dist/cdn/themes/magna.tokens.json +1 -1
  166. package/dist/cdn/themes/manifest.json +26 -50
  167. package/dist/cdn/themes/midnight.tokens.json +1 -1
  168. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  169. package/dist/cdn/themes/minimal.tokens.json +1 -1
  170. package/dist/cdn/themes/modern-dark.tokens.json +1 -1
  171. package/dist/cdn/themes/modern.tokens.json +1 -1
  172. package/dist/cdn/themes/nes-dark.tokens.json +1 -1
  173. package/dist/cdn/themes/nes.css +1 -1
  174. package/dist/cdn/themes/nes.tokens.json +1 -1
  175. package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
  176. package/dist/cdn/themes/neumorphism.css +1 -1
  177. package/dist/cdn/themes/neumorphism.tokens.json +1 -1
  178. package/dist/cdn/themes/nord-dark.tokens.json +33 -1
  179. package/dist/cdn/themes/nord.css +1 -1
  180. package/dist/cdn/themes/nord.tokens.json +23 -1
  181. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  182. package/dist/cdn/themes/organic.css +1 -1
  183. package/dist/cdn/themes/organic.tokens.json +1 -1
  184. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  185. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  186. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  187. package/dist/cdn/themes/rough.css +1 -1
  188. package/dist/cdn/themes/rough.tokens.json +1 -1
  189. package/dist/cdn/themes/solarized-dark.tokens.json +23 -1
  190. package/dist/cdn/themes/solarized.css +1 -1
  191. package/dist/cdn/themes/solarized.tokens.json +23 -1
  192. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  193. package/dist/cdn/themes/startup.tokens.json +1 -1
  194. package/dist/cdn/themes/super2026-dark.tokens.json +33 -1
  195. package/dist/cdn/themes/super2026.css +1 -1
  196. package/dist/cdn/themes/super2026.tokens.json +23 -1
  197. package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
  198. package/dist/cdn/themes/swiss.css +1 -1
  199. package/dist/cdn/themes/swiss.tokens.json +1 -1
  200. package/dist/cdn/themes/terminal.css +1 -1
  201. package/dist/cdn/themes/terminal.tokens.json +1 -1
  202. package/dist/cdn/themes/tokyo-night-dark.tokens.json +33 -1
  203. package/dist/cdn/themes/tokyo-night.css +1 -1
  204. package/dist/cdn/themes/tokyo-night.tokens.json +23 -1
  205. package/dist/cdn/themes/vaporwave-dark.tokens.json +33 -1
  206. package/dist/cdn/themes/vaporwave.css +1 -1
  207. package/dist/cdn/themes/vaporwave.tokens.json +23 -1
  208. package/dist/cdn/themes/win9x-dark.tokens.json +15 -4
  209. package/dist/cdn/themes/win9x.css +1 -1
  210. package/dist/cdn/themes/win9x.tokens.json +1 -1
  211. package/dist/cdn/vanilla-breeze-autoload.js +663 -0
  212. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  213. package/dist/cdn/vanilla-breeze-charts.js +32 -32
  214. package/dist/cdn/vanilla-breeze-core.css +1 -1
  215. package/dist/cdn/vanilla-breeze-core.js +78 -80
  216. package/dist/cdn/vanilla-breeze-dev.css +1 -1
  217. package/dist/cdn/vanilla-breeze-extras.js +47 -37
  218. package/dist/cdn/vanilla-breeze.css +1 -1
  219. package/dist/cdn/vanilla-breeze.js +180 -177
  220. package/package.json +12 -7
  221. package/dist/cdn/themes/amber.css +0 -2
  222. package/dist/cdn/themes/anthropic.css +0 -2
  223. package/dist/cdn/themes/anthropic.tokens.json +0 -564
  224. package/dist/cdn/themes/coral.css +0 -2
  225. package/dist/cdn/themes/emerald.css +0 -2
  226. package/dist/cdn/themes/forest.css +0 -2
  227. package/dist/cdn/themes/ibm.css +0 -2
  228. package/dist/cdn/themes/ibm.tokens.json +0 -568
  229. package/dist/cdn/themes/indigo.css +0 -2
  230. package/dist/cdn/themes/lavender.css +0 -2
  231. package/dist/cdn/themes/mcdonalds.css +0 -2
  232. package/dist/cdn/themes/mcdonalds.tokens.json +0 -533
  233. package/dist/cdn/themes/ocean.css +0 -2
  234. package/dist/cdn/themes/rose.css +0 -2
  235. package/dist/cdn/themes/slate.css +0 -2
  236. package/dist/cdn/themes/starbucks.css +0 -2
  237. package/dist/cdn/themes/starbucks.tokens.json +0 -593
  238. package/dist/cdn/themes/sunset.css +0 -2
@@ -1,2 +1,2 @@
1
- var w=window.matchMedia("(prefers-reduced-motion: reduce)");var g=new Map;function y(a,e,t={}){let i=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:i},s=g.get(a);if(customElements.get(a)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${t.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 "${t.bundle}" (first wins at equal priority).`);return}g.set(a,n),customElements.define(a,e)}var f=class extends HTMLElement{#i=[];#e;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 e of this.#i)e();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,i,n){e.addEventListener(t,i,n),this.#i.push(()=>e.removeEventListener(t,i,n))}setup(){}teardown(){}setState(e,t){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{t?i.add(e):i.delete(e)}catch{let n=`--${e}`;t?i.add(n):i.delete(n)}}_adoptInternals(e){this.#e||(this.#e=e)}};var p=class extends f{#i;#e=[];#s=new Map;#a;#t;#r;#o=!1;setup(){requestAnimationFrame(()=>this.#c())}get entries(){return this.#e.map(e=>({id:e.id||void 0,text:e.textContent?.trim()||"",level:parseInt(e.tagName.slice(1),10)||0}))}teardown(){this.#i?.disconnect(),clearTimeout(this.#r)}#c(){this.#o=this.#h(),this.#o?this.#u():this.#y(),this.#w(),this.#f(),this.#b()}#h(){return this.querySelector("nav, details")!==null}#u(){this.#t=this.querySelector("details");let e=this.querySelectorAll('a[href^="#"]');for(let t of e){let i=t.getAttribute("href");if(!i)continue;let n=i.slice(1);if(n){let s=document.getElementById(n);s&&(this.#e.push(s),this.#s.set(n,t),t.classList.contains("link")||t.classList.add("link"),t.addEventListener("click",c=>{c.preventDefault(),this.#d(s)}))}}}#f(){this.#a=window.matchMedia("(min-width: 64rem)"),this.listen(this.#a,"change",this.#m),this.listen(window,"resize",this.#p)}#m=e=>{e.matches&&this.#t&&(this.#t.open=!0)};#p=()=>{clearTimeout(this.#r),this.#r=setTimeout(()=>this.#n(),150)};#b(){this.listen(window,"hashchange",this.#g),this.#n()}#g=()=>{this.#n()};#n(){let e=window.location.hash.slice(1);e&&this.#s.has(e)&&this.#l(e)}#l(e){for(let i of this.#s.values())i.classList.remove("active"),i.removeAttribute("aria-current");let t=this.#s.get(e);t&&(t.classList.add("active"),t.setAttribute("aria-current","true"))}#y(){let e=(this.getAttribute("levels")||"h2,h3").split(",").map(r=>r.trim().toLowerCase()),t=this.getAttribute("scope")||"main",i=this.getAttribute("title")||"On this page",n=document.querySelector(t);if(!n||(this.#e=Array.from(n.querySelectorAll(e.join(","))).filter(r=>r.id).filter(r=>!r.hasAttribute("data-toc-ignore")&&!r.closest("[data-toc-ignore]")),this.#e.length===0))return;let s={depth:-1,children:[]},c=[s];for(let r of this.#e){let l=e.indexOf(r.tagName.toLowerCase());for(;c[c.length-1].depth>=l;)c.pop();let o={heading:r,depth:l,children:[]};c[c.length-1].children.push(o),c.push(o)}let b=r=>{let l=document.createElement("ul");l.className="list";for(let o of r){let h=document.createElement("li");h.className="item",h.dataset.level=String(o.depth);let d=document.createElement("a");d.href=`#${o.heading.id}`,d.className="link",d.textContent=this.#v(o.heading),d.addEventListener("click",v=>{v.preventDefault(),this.#d(o.heading)}),h.appendChild(d),o.children.length&&h.appendChild(b(o.children)),l.appendChild(h),this.#s.set(o.heading.id,d)}return l};this.#t=document.createElement("details"),this.#t.className="details",this.#t.open=!0;let m=document.createElement("summary");m.className="summary",m.textContent=i,this.#t.appendChild(m);let u=document.createElement("nav");u.className="nav",u.setAttribute("aria-label",i),u.appendChild(b(s.children)),this.#t.appendChild(u),this.appendChild(this.#t)}#v(e){let t=e.cloneNode(!0);return t.querySelectorAll(".heading-anchor").forEach(n=>n.remove()),t.textContent.trim()}#d(e){let t=new URL(window.location.href);t.hash=e.id,window.history.pushState(null,"",t),e.scrollIntoView({behavior:"smooth",block:"start"}),e.focus(),this.dispatchEvent(new CustomEvent("page-toc:navigate",{bubbles:!0,detail:{id:e.id}}))}#w(){if(this.#e.length===0)return;let e=new Set;this.#i=new IntersectionObserver(t=>{for(let i of t)i.isIntersecting?e.add(i.target.id):e.delete(i.target.id);this.#E(e)},{rootMargin:"-80px 0px -70% 0px",threshold:0});for(let t of this.#e)this.#i.observe(t)}#E(e){for(let t of this.#e)if(e.has(t.id)){this.#l(t.id);return}this.#n()}refresh(){this.#o||(this.innerHTML=""),this.#s.clear(),this.#e=[],this.#i?.disconnect(),this.#c()}};y("page-toc",p);export{p as PageToc};
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var g=new Map;function y(a,e,t={}){let i=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:i},s=g.get(a);if(customElements.get(a)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${t.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 "${t.bundle}" (first wins at equal priority).`);return}g.set(a,n),customElements.define(a,e)}var f=class extends HTMLElement{#t=[];#e;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 e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,i,n){e.addEventListener(t,i,n),this.#t.push(()=>e.removeEventListener(t,i,n))}_reinit(){for(let e of this.#t)e();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{t?i.add(e):i.delete(e)}catch{let n=`--${e}`;t?i.add(n):i.delete(n)}}_adoptInternals(e){this.#e||(this.#e=e)}};var p=class extends f{#t;#e=[];#s=new Map;#a;#i;#r;#o=!1;setup(){requestAnimationFrame(()=>this.#c())}get entries(){return this.#e.map(e=>({id:e.id||void 0,text:e.textContent?.trim()||"",level:parseInt(e.tagName.slice(1),10)||0}))}teardown(){this.#t?.disconnect(),clearTimeout(this.#r)}#c(){this.#o=this.#h(),this.#o?this.#u():this.#y(),this.#w(),this.#f(),this.#b()}#h(){return this.querySelector("nav, details")!==null}#u(){this.#i=this.querySelector("details");let e=this.querySelectorAll('a[href^="#"]');for(let t of e){let i=t.getAttribute("href");if(!i)continue;let n=i.slice(1);if(n){let s=document.getElementById(n);s&&(this.#e.push(s),this.#s.set(n,t),t.classList.contains("link")||t.classList.add("link"),t.addEventListener("click",c=>{c.preventDefault(),this.#d(s)}))}}}#f(){this.#a=window.matchMedia("(min-width: 64rem)"),this.listen(this.#a,"change",this.#m),this.listen(window,"resize",this.#p)}#m=e=>{e.matches&&this.#i&&(this.#i.open=!0)};#p=()=>{clearTimeout(this.#r),this.#r=setTimeout(()=>this.#n(),150)};#b(){this.listen(window,"hashchange",this.#g),this.#n()}#g=()=>{this.#n()};#n(){let e=window.location.hash.slice(1);e&&this.#s.has(e)&&this.#l(e)}#l(e){for(let i of this.#s.values())i.classList.remove("active"),i.removeAttribute("aria-current");let t=this.#s.get(e);t&&(t.classList.add("active"),t.setAttribute("aria-current","true"))}#y(){let e=(this.getAttribute("levels")||"h2,h3").split(",").map(r=>r.trim().toLowerCase()),t=this.getAttribute("scope")||"main",i=this.getAttribute("title")||"On this page",n=document.querySelector(t);if(!n||(this.#e=Array.from(n.querySelectorAll(e.join(","))).filter(r=>r.id).filter(r=>!r.hasAttribute("data-toc-ignore")&&!r.closest("[data-toc-ignore]")),this.#e.length===0))return;let s={depth:-1,children:[]},c=[s];for(let r of this.#e){let l=e.indexOf(r.tagName.toLowerCase());for(;c[c.length-1].depth>=l;)c.pop();let o={heading:r,depth:l,children:[]};c[c.length-1].children.push(o),c.push(o)}let b=r=>{let l=document.createElement("ul");l.className="list";for(let o of r){let h=document.createElement("li");h.className="item",h.dataset.level=String(o.depth);let d=document.createElement("a");d.href=`#${o.heading.id}`,d.className="link",d.textContent=this.#v(o.heading),d.addEventListener("click",v=>{v.preventDefault(),this.#d(o.heading)}),h.appendChild(d),o.children.length&&h.appendChild(b(o.children)),l.appendChild(h),this.#s.set(o.heading.id,d)}return l};this.#i=document.createElement("details"),this.#i.className="details",this.#i.open=!0;let m=document.createElement("summary");m.className="summary",m.textContent=i,this.#i.appendChild(m);let u=document.createElement("nav");u.className="nav",u.setAttribute("aria-label",i),u.appendChild(b(s.children)),this.#i.appendChild(u),this.appendChild(this.#i)}#v(e){let t=e.cloneNode(!0);return t.querySelectorAll(".heading-anchor").forEach(n=>n.remove()),t.textContent.trim()}#d(e){let t=new URL(window.location.href);t.hash=e.id,window.history.pushState(null,"",t),e.scrollIntoView({behavior:"smooth",block:"start"}),e.focus(),this.dispatchEvent(new CustomEvent("page-toc:navigate",{bubbles:!0,detail:{id:e.id}}))}#w(){if(this.#e.length===0)return;let e=new Set;this.#t=new IntersectionObserver(t=>{for(let i of t)i.isIntersecting?e.add(i.target.id):e.delete(i.target.id);this.#E(e)},{rootMargin:"-80px 0px -70% 0px",threshold:0});for(let t of this.#e)this.#t.observe(t)}#E(e){for(let t of this.#e)if(e.has(t.id)){this.#l(t.id);return}this.#n()}refresh(){this.#o||(this.innerHTML=""),this.#s.clear(),this.#e=[],this.#t?.disconnect(),this.#c()}};y("page-toc",p);export{p as PageToc};
2
2
  //# sourceMappingURL=page-toc.js.map
@@ -1,2 +1,2 @@
1
- var h=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function c(o,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=l.get(o);if(customElements.get(o)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> 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 <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(o,n),customElements.define(o,t)}var r=class extends HTMLElement{#e=[];#t;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,i,n){t.addEventListener(e,i,n),this.#e.push(()=>t.removeEventListener(e,i,n))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}};var d=0,a=class extends r{#e=null;#t=null;#o=null;#i=!1;#s=null;setup(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.getAttribute("aria-label")||this.setAttribute("aria-label","Page tools"),this.#a(),this.#l();let t=this.dataset.breakpoint||"48rem";this.#o=matchMedia(`(max-width: ${t})`),this.#n(this.#o),this.listen(this.#o,"change",e=>this.#n(e)),this.#s=new MutationObserver(e=>{for(let i of e)i.type==="childList"&&this.#i&&this.#d()}),this.#s.observe(this,{childList:!0})}teardown(){this.#s?.disconnect(),this.#s=null,this.#i&&this.#r(),this.#e?.remove(),this.#t?.remove(),this.#e=null,this.#t=null}get tools(){return Array.from(this.children).filter(t=>!t.hasAttribute("data-page-tools-internal"))}#a(){if((this.dataset.orientation||"auto")!=="auto")return;let i=(this.dataset.position||"sticky")==="inline"?"horizontal":"vertical";this.dataset.resolvedOrientation=i}#l(){let t=`pt-${++d}`,e=this.dataset.fabIcon||"ellipsis-vertical",i=this.dataset.fabLabel||"Page tools";this.#e=document.createElement("button"),this.#e.className="page-tools-fab",this.#e.setAttribute("data-page-tools-internal",""),this.#e.setAttribute("popovertarget",t),this.#e.setAttribute("aria-label",i),this.#e.hidden=!0,this.#e.innerHTML=`<icon-wc name="${e}" size="md"></icon-wc>`,this.#t=document.createElement("section"),this.#t.className="page-tools-popover",this.#t.setAttribute("data-page-tools-internal",""),this.#t.id=t,this.#t.setAttribute("popover",""),this.#t.setAttribute("aria-label",i),this.#t.hidden=!0,this.appendChild(this.#e),this.appendChild(this.#t),this.listen(this.#t,"toggle",n=>{n.newState==="closed"&&this.#e?.focus()})}#n(t){t.matches??t?this.#c():this.#r()}#c(){if(this.#i||!this.#e||!this.#t)return;this.#i=!0;let t=this.tools;for(let e of t)this.#t.appendChild(e);this.#e.hidden=!1,this.#t.hidden=!1,this.dataset.collapsed=""}#r(){if(!this.#i||!this.#e||!this.#t)return;this.#i=!1,this.#t.matches(":popover-open")&&this.#t.hidePopover?.();let t=Array.from(this.#t.children);for(let e of t)this.insertBefore(e,this.#e);this.#e.hidden=!0,this.#t.hidden=!0,delete this.dataset.collapsed}#d(){if(!this.#t)return;let t=this.tools;for(let e of t)this.#t.appendChild(e)}};c("page-tools",a);export{a as PageTools};
1
+ var h=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function c(o,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=l.get(o);if(customElements.get(o)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> 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 <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(o,n),customElements.define(o,t)}var r=class extends HTMLElement{#e=[];#t;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,i,n){t.addEventListener(e,i,n),this.#e.push(()=>t.removeEventListener(e,i,n))}_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 i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}};var d=0,a=class extends r{#e=null;#t=null;#o=null;#i=!1;#s=null;setup(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.getAttribute("aria-label")||this.setAttribute("aria-label","Page tools"),this.#a(),this.#l();let t=this.dataset.breakpoint||"48rem";this.#o=matchMedia(`(max-width: ${t})`),this.#n(this.#o),this.listen(this.#o,"change",e=>this.#n(e)),this.#s=new MutationObserver(e=>{for(let i of e)i.type==="childList"&&this.#i&&this.#d()}),this.#s.observe(this,{childList:!0})}teardown(){this.#s?.disconnect(),this.#s=null,this.#i&&this.#r(),this.#e?.remove(),this.#t?.remove(),this.#e=null,this.#t=null}get tools(){return Array.from(this.children).filter(t=>!t.hasAttribute("data-page-tools-internal"))}#a(){if((this.dataset.orientation||"auto")!=="auto")return;let i=(this.dataset.position||"sticky")==="inline"?"horizontal":"vertical";this.dataset.resolvedOrientation=i}#l(){let t=`pt-${++d}`,e=this.dataset.fabIcon||"ellipsis-vertical",i=this.dataset.fabLabel||"Page tools";this.#e=document.createElement("button"),this.#e.className="page-tools-fab",this.#e.setAttribute("data-page-tools-internal",""),this.#e.setAttribute("popovertarget",t),this.#e.setAttribute("aria-label",i),this.#e.hidden=!0,this.#e.innerHTML=`<icon-wc name="${e}" size="md"></icon-wc>`,this.#t=document.createElement("section"),this.#t.className="page-tools-popover",this.#t.setAttribute("data-page-tools-internal",""),this.#t.id=t,this.#t.setAttribute("popover",""),this.#t.setAttribute("aria-label",i),this.#t.hidden=!0,this.appendChild(this.#e),this.appendChild(this.#t),this.listen(this.#t,"toggle",n=>{n.newState==="closed"&&this.#e?.focus()})}#n(t){t.matches??t?this.#c():this.#r()}#c(){if(this.#i||!this.#e||!this.#t)return;this.#i=!0;let t=this.tools;for(let e of t)this.#t.appendChild(e);this.#e.hidden=!1,this.#t.hidden=!1,this.dataset.collapsed=""}#r(){if(!this.#i||!this.#e||!this.#t)return;this.#i=!1,this.#t.matches(":popover-open")&&this.#t.hidePopover?.();let t=Array.from(this.#t.children);for(let e of t)this.insertBefore(e,this.#e);this.#e.hidden=!0,this.#t.hidden=!0,delete this.dataset.collapsed}#d(){if(!this.#t)return;let t=this.tools;for(let e of t)this.#t.appendChild(e)}};c("page-tools",a);export{a as PageTools};
2
2
  //# sourceMappingURL=page-tools.js.map
@@ -1,4 +1,4 @@
1
- var w=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function f(l,t,e={}){let s=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=v.get(l);if(customElements.get(l)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(l,i),customElements.define(l,t)}var d=class extends HTMLElement{#e=[];#s;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,s,i){t.addEventListener(e,s,i),this.#e.push(()=>t.removeEventListener(e,s,i))}setup(){}teardown(){}setState(t,e){this.#s||(this.#s=this.attachInternals());let s=this.#s.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#s||(this.#s=t)}};var p=CSS.supports("anchor-name","--x"),y=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,g=class extends HTMLElement{get target(){return this.dataset.target??""}get placement(){return this.dataset.placement??"auto"}get action(){return this.dataset.action??"none"}get actionHint(){return this.dataset.actionHint??null}get skippable(){return this.dataset.skippable!=="false"}get scrollBehavior(){return this.dataset.scroll??"smooth"}},b=class l extends d{#e=[];#s=0;#n=!1;#o=null;#r=null;#t=null;#i=null;#p=null;#l=null;#u=null;#c=null;static#h=null;static observedAttributes=["data-step"];setup(){if(this.#e=[...this.querySelectorAll("tour-step")],this.#e.length===0)return!1;let t=this.querySelector(".page-tour-start-btn");if(t&&this.listen(t,"click",e=>{e.preventDefault(),this.start()}),this.id&&this.listen(document,"click",e=>{e.target?.closest?.(`[data-tour="${this.id}"]`)&&(e.preventDefault(),this.start())}),this.dataset.trigger==="auto"){let e=this.#F();e?.complete||e?.skipped?this.setAttribute("data-complete",""):setTimeout(()=>this.start(e?.step??0),400)}return!0}teardown(){this.#n&&this.stop()}attributeChangedCallback(t,e,s){if(t==="data-step"&&this.#n&&e!==null){let i=parseInt(s,10);!Number.isNaN(i)&&i!==this.#s&&this.#a(i)}}start(t=0){l.#h&&l.#h!==this&&l.#h.stop(),this.#p=document.activeElement,this.#n=!0,l.#h=this,this.#A(),this.setAttribute("data-active",""),this.removeAttribute("data-complete"),this.#d("tour:start",{step:t}),this.#a(t)}stop(){this.#L(),this.#n=!1,this.removeAttribute("data-active"),l.#h===this&&(l.#h=null)}next(){!this.#n||this.#t?.querySelector('[data-action="next"]')?.hasAttribute("data-waiting")||(this.#s<this.#e.length-1?this.#a(this.#s+1,"next"):this.#N())}prev(){this.#n&&this.#s>0&&this.#a(this.#s-1,"prev")}goto(t){this.#n&&t>=0&&t<this.#e.length&&this.#a(t)}skip(){!this.#n||(this.dataset.mode??"passive")==="forced"||(this.#d("tour:skip",{step:this.#s}),this.#b({skipped:!0}),this.stop(),this.setAttribute("data-complete",""))}reset(){this.#D(),this.removeAttribute("data-complete"),this.dataset.step="0"}#A(){this.#o=document.createElement("div"),this.#o.className="page-tour-backdrop",this.#o.setAttribute("aria-hidden","true"),this.#o.addEventListener("click",()=>{(this.dataset.mode??"passive")!=="forced"&&this.skip()}),this.#r=document.createElement("div"),this.#r.className="page-tour-spotlight",this.#r.setAttribute("aria-hidden","true"),this.#t=document.createElement("div"),this.#t.className="page-tour-card",this.#t.setAttribute("popover","manual"),this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-modal","true"),this.#t.setAttribute("aria-label",this.dataset.title??"Page Tour"),this.#t.addEventListener("keydown",t=>this.#q(t)),this.#t.addEventListener("click",t=>this.#M(t)),this.#i=document.createElement("div"),this.#i.setAttribute("aria-live","polite"),this.#i.setAttribute("aria-atomic","true"),this.#i.className="visually-hidden",this.#i.id=`page-tour-announcer-${crypto.randomUUID().slice(0,8)}`,this.append(this.#o,this.#r,this.#t,this.#i),this.#t.showPopover(),requestAnimationFrame(()=>{this.#o?.setAttribute("data-visible","")})}#m(t){if(!this.#r)return;let e=parseInt(this.dataset.spotlightPadding??"",10)||8,s=t.getBoundingClientRect();Object.assign(this.#r.style,{top:`${s.top-e}px`,left:`${s.left-e}px`,width:`${s.width+e*2}px`,height:`${s.height+e*2}px`})}#S(t,e){if(this.#t){if(p){this.#$(t,e);return}this.#v(t,e)}}#$(t,e){if(!this.#t)return;let s="--tour-target";t.style.anchorName=s,this.#t.style.positionAnchor=s,this.#t.style.position="fixed",this.#t.style.top="",this.#t.style.left="",this.#t.style.bottom="",this.#t.style.right="";let i="var(--tour-card-offset, 0.75rem)";switch(e==="auto"?this.#y(t):e){case"bottom":this.#t.style.top="anchor(bottom)",this.#t.style.left="anchor(center)",this.#t.style.translate="0 calc("+i+")";break;case"top":this.#t.style.bottom="anchor(top)",this.#t.style.left="anchor(center)",this.#t.style.translate="0 calc(-1 * "+i+")";break;case"right":this.#t.style.left="anchor(right)",this.#t.style.top="anchor(center)",this.#t.style.translate=i+" 0";break;case"left":this.#t.style.right="anchor(left)",this.#t.style.top="anchor(center)",this.#t.style.translate="calc(-1 * "+i+") 0";break}}#v(t,e){if(!this.#t)return;let s=t.getBoundingClientRect(),i=12,n=8,h=e==="auto"?this.#y(t):e;this.#t.style.position="fixed",this.#t.style.visibility="hidden",this.#t.style.top="0",this.#t.style.left="0",this.#t.style.translate="";let o=this.#t.getBoundingClientRect();this.#t.style.visibility="";let r=0,c=0,a=parseInt(this.dataset.spotlightPadding??"",10)||8;switch(h){case"bottom":r=s.bottom+a+i,c=s.left+(s.width-o.width)/2;break;case"top":r=s.top-a-i-o.height,c=s.left+(s.width-o.width)/2;break;case"right":r=s.top+(s.height-o.height)/2,c=s.right+a+i;break;case"left":r=s.top+(s.height-o.height)/2,c=s.left-a-i-o.width;break}c=Math.max(n,Math.min(c,window.innerWidth-o.width-n)),r=Math.max(n,Math.min(r,window.innerHeight-o.height-n)),Object.assign(this.#t.style,{top:`${r}px`,left:`${c}px`,translate:""})}#y(t){let e=t.getBoundingClientRect(),s=window.innerWidth,n=window.innerHeight-e.bottom,h=e.top,o=s-e.right,r=e.left,c=Math.max(n,h,o,r);return c===n?"bottom":c===h?"top":c===o?"right":"left"}#x(t,e){if(!this.#t)return;let s=this.#e.length,i=e===s-1,n=e===0,o=(this.dataset.mode??"passive")!=="forced",r=t.action!=="none";this.#t.innerHTML=`
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function f(l,t,e={}){let s=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=v.get(l);if(customElements.get(l)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(l,i),customElements.define(l,t)}var d=class extends HTMLElement{#e=[];#s;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,s,i){t.addEventListener(e,s,i),this.#e.push(()=>t.removeEventListener(e,s,i))}_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.#s||(this.#s=this.attachInternals());let s=this.#s.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#s||(this.#s=t)}};var p=CSS.supports("anchor-name","--x"),y=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,g=class extends HTMLElement{get target(){return this.dataset.target??""}get placement(){return this.dataset.placement??"auto"}get action(){return this.dataset.action??"none"}get actionHint(){return this.dataset.actionHint??null}get skippable(){return this.dataset.skippable!=="false"}get scrollBehavior(){return this.dataset.scroll??"smooth"}},b=class l extends d{#e=[];#s=0;#n=!1;#r=null;#o=null;#t=null;#i=null;#p=null;#l=null;#u=null;#c=null;static#h=null;static observedAttributes=["data-step"];setup(){if(this.#e=[...this.querySelectorAll("tour-step")],this.#e.length===0)return!1;let t=this.querySelector(".page-tour-start-btn");if(t&&this.listen(t,"click",e=>{e.preventDefault(),this.start()}),this.id&&this.listen(document,"click",e=>{e.target?.closest?.(`[data-tour="${this.id}"]`)&&(e.preventDefault(),this.start())}),this.dataset.trigger==="auto"){let e=this.#F();e?.complete||e?.skipped?this.setAttribute("data-complete",""):setTimeout(()=>this.start(e?.step??0),400)}return!0}teardown(){this.#n&&this.stop()}attributeChangedCallback(t,e,s){if(t==="data-step"&&this.#n&&e!==null){let i=parseInt(s,10);!Number.isNaN(i)&&i!==this.#s&&this.#a(i)}}start(t=0){l.#h&&l.#h!==this&&l.#h.stop(),this.#p=document.activeElement,this.#n=!0,l.#h=this,this.#A(),this.setAttribute("data-active",""),this.removeAttribute("data-complete"),this.#d("tour:start",{step:t}),this.#a(t)}stop(){this.#L(),this.#n=!1,this.removeAttribute("data-active"),l.#h===this&&(l.#h=null)}next(){!this.#n||this.#t?.querySelector('[data-action="next"]')?.hasAttribute("data-waiting")||(this.#s<this.#e.length-1?this.#a(this.#s+1,"next"):this.#N())}prev(){this.#n&&this.#s>0&&this.#a(this.#s-1,"prev")}goto(t){this.#n&&t>=0&&t<this.#e.length&&this.#a(t)}skip(){!this.#n||(this.dataset.mode??"passive")==="forced"||(this.#d("tour:skip",{step:this.#s}),this.#b({skipped:!0}),this.stop(),this.setAttribute("data-complete",""))}reset(){this.#D(),this.removeAttribute("data-complete"),this.dataset.step="0"}#A(){this.#r=document.createElement("div"),this.#r.className="page-tour-backdrop",this.#r.setAttribute("aria-hidden","true"),this.#r.addEventListener("click",()=>{(this.dataset.mode??"passive")!=="forced"&&this.skip()}),this.#o=document.createElement("div"),this.#o.className="page-tour-spotlight",this.#o.setAttribute("aria-hidden","true"),this.#t=document.createElement("div"),this.#t.className="page-tour-card",this.#t.setAttribute("popover","manual"),this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-modal","true"),this.#t.setAttribute("aria-label",this.dataset.title??"Page Tour"),this.#t.addEventListener("keydown",t=>this.#C(t)),this.#t.addEventListener("click",t=>this.#M(t)),this.#i=document.createElement("div"),this.#i.setAttribute("aria-live","polite"),this.#i.setAttribute("aria-atomic","true"),this.#i.className="visually-hidden",this.#i.id=`page-tour-announcer-${crypto.randomUUID().slice(0,8)}`,this.append(this.#r,this.#o,this.#t,this.#i),this.#t.showPopover(),requestAnimationFrame(()=>{this.#r?.setAttribute("data-visible","")})}#m(t){if(!this.#o)return;let e=parseInt(this.dataset.spotlightPadding??"",10)||8,s=t.getBoundingClientRect();Object.assign(this.#o.style,{top:`${s.top-e}px`,left:`${s.left-e}px`,width:`${s.width+e*2}px`,height:`${s.height+e*2}px`})}#S(t,e){if(this.#t){if(p){this.#$(t,e);return}this.#v(t,e)}}#$(t,e){if(!this.#t)return;let s="--tour-target";t.style.anchorName=s,this.#t.style.positionAnchor=s,this.#t.style.position="fixed",this.#t.style.top="",this.#t.style.left="",this.#t.style.bottom="",this.#t.style.right="";let i="var(--tour-card-offset, 0.75rem)";switch(e==="auto"?this.#y(t):e){case"bottom":this.#t.style.top="anchor(bottom)",this.#t.style.left="anchor(center)",this.#t.style.translate="0 calc("+i+")";break;case"top":this.#t.style.bottom="anchor(top)",this.#t.style.left="anchor(center)",this.#t.style.translate="0 calc(-1 * "+i+")";break;case"right":this.#t.style.left="anchor(right)",this.#t.style.top="anchor(center)",this.#t.style.translate=i+" 0";break;case"left":this.#t.style.right="anchor(left)",this.#t.style.top="anchor(center)",this.#t.style.translate="calc(-1 * "+i+") 0";break}}#v(t,e){if(!this.#t)return;let s=t.getBoundingClientRect(),i=12,n=8,h=e==="auto"?this.#y(t):e;this.#t.style.position="fixed",this.#t.style.visibility="hidden",this.#t.style.top="0",this.#t.style.left="0",this.#t.style.translate="";let r=this.#t.getBoundingClientRect();this.#t.style.visibility="";let o=0,c=0,a=parseInt(this.dataset.spotlightPadding??"",10)||8;switch(h){case"bottom":o=s.bottom+a+i,c=s.left+(s.width-r.width)/2;break;case"top":o=s.top-a-i-r.height,c=s.left+(s.width-r.width)/2;break;case"right":o=s.top+(s.height-r.height)/2,c=s.right+a+i;break;case"left":o=s.top+(s.height-r.height)/2,c=s.left-a-i-r.width;break}c=Math.max(n,Math.min(c,window.innerWidth-r.width-n)),o=Math.max(n,Math.min(o,window.innerHeight-r.height-n)),Object.assign(this.#t.style,{top:`${o}px`,left:`${c}px`,translate:""})}#y(t){let e=t.getBoundingClientRect(),s=window.innerWidth,n=window.innerHeight-e.bottom,h=e.top,r=s-e.right,o=e.left,c=Math.max(n,h,r,o);return c===n?"bottom":c===h?"top":c===r?"right":"left"}#x(t,e){if(!this.#t)return;let s=this.#e.length,i=e===s-1,n=e===0,r=(this.dataset.mode??"passive")!=="forced",o=t.action!=="none";this.#t.innerHTML=`
2
2
  <div class="page-tour-progress" aria-hidden="true">
3
3
  ${this.#e.map((c,a)=>`
4
4
  <span class="page-tour-pip" ${a===e?"data-active":""} ${a<e?"data-visited":""}></span>
@@ -10,11 +10,11 @@ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;functi
10
10
  <div class="page-tour-content">
11
11
  ${t.innerHTML}
12
12
  </div>
13
- ${r&&t.actionHint?`
13
+ ${o&&t.actionHint?`
14
14
  <p class="page-tour-action-hint">${t.actionHint}</p>
15
15
  `:""}
16
16
  <footer class="page-tour-footer">
17
- ${o?`
17
+ ${r?`
18
18
  <button type="button" class="page-tour-skip" data-action="skip">
19
19
  ${i?"Close":"Skip tour"}
20
20
  </button>
@@ -29,11 +29,11 @@ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;functi
29
29
  type="button"
30
30
  class="page-tour-next"
31
31
  data-action="next"
32
- ${r?"data-waiting":""}
32
+ ${o?"data-waiting":""}
33
33
  >
34
34
  ${i?"Finish":"Next"}
35
35
  </button>
36
36
  </nav>
37
37
  </footer>
38
- `}#a(t,e="next"){if(this.#u?.abort(),this.#u=null,this.#s!==t){let a=this.#e[this.#s],u=a?document.querySelector(a.target):null;u&&(p&&(u.style.anchorName=""),u.removeAttribute("data-tour-target"))}this.#w(),this.#s=t;let s=this.#e[t],i=document.querySelector(s.target);if(!i){console.warn(`[page-tour] Target "${s.target}" not found, skipping step ${t}`),e==="next"&&t<this.#e.length-1?this.#a(t+1,"next"):e==="prev"&&t>0&&this.#a(t-1,"prev");return}i.setAttribute("data-tour-target","");let n=y()?"instant":s.scrollBehavior;s.scrollBehavior!=="none"&&i.scrollIntoView({block:"nearest",behavior:n});let h=()=>{this.#m(i),this.#S(i,s.placement)};h(),setTimeout(h,y()?0:300),this.#x(s,t);let o=this.#t;o&&(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus()),requestAnimationFrame(()=>{let a=this.#t?.querySelector(".page-tour-content h3, .page-tour-content h2, .page-tour-content h4")??null;a?(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus()):(this.#t?.querySelector('[data-action="next"]')??null)?.focus()});let c=s.querySelector("h3, h2, h4")?.textContent??`Step ${t+1}`;this.#T(`Step ${t+1} of ${this.#e.length}: ${c}`),this.dataset.step=String(t),s.action!=="none"&&this.#E(s),this.#B(i),this.#b({step:t}),this.#n&&this.#d("tour:step",{step:t,target:i,direction:e})}#E(t){let e=document.querySelector(t.target);if(!e)return;let s=this.#t?.querySelector('[data-action="next"]')??null,i=new AbortController;this.#u=i;let h={click:"click",focus:"focus",input:"input",change:"change"}[t.action];h?e.addEventListener(h,()=>{s?.removeAttribute("data-waiting"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),s?.focus(),this.#d("tour:action",{step:this.#s,action:t.action}),i.abort()},{signal:i.signal,once:!0}):t.action==="custom"&&this.addEventListener("tour:action",()=>{s?.removeAttribute("data-waiting"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),s?.focus(),i.abort()},{signal:i.signal,once:!0})}#q(t){let e=this.dataset.mode??"passive",i=this.#e[this.#s]?.action!=="none",h=this.#t?.querySelector('[data-action="next"]')?.hasAttribute("data-waiting");switch(t.key){case"Escape":e!=="forced"&&(t.preventDefault(),this.skip());break;case"ArrowRight":case"ArrowDown":t.preventDefault(),i&&h||this.next();break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),this.prev();break;case"Home":t.preventDefault(),this.goto(0);break;case"End":t.preventDefault(),this.goto(this.#e.length-1);break;case"Tab":this.#C(t,i&&h);break}}#C(t,e){if(!this.#t)return;let s=[...this.#t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(c=>!c.disabled&&c.offsetParent!==null),i=[];if(e){let c=this.#e[this.#s],a=document.querySelector(c.target);a&&(i=(a.matches("input, select, textarea, button, [href], [tabindex]")?[a]:[...a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')]).filter(m=>!m.disabled&&m.offsetParent!==null))}let n=[...s,...i];if(n.length===0)return;let h=n[0],o=n[n.length-1],r=document.activeElement;t.shiftKey?(r===h||r&&!n.includes(r))&&(t.preventDefault(),o.focus()):(r===o||r&&!n.includes(r))&&(t.preventDefault(),h.focus())}#M(t){let e=t.target.closest("[data-action]");if(!e)return;switch(e.dataset.action){case"next":this.next();break;case"prev":this.prev();break;case"skip":this.skip();break}}#B(t){this.#l=new ResizeObserver(()=>{this.#k(t)}),this.#l.observe(t),this.listen(window,"scroll",()=>this.#k(t),{passive:!0})}#w(){this.#l&&(this.#l.disconnect(),this.#l=null),this.#c&&(cancelAnimationFrame(this.#c),this.#c=null)}#k(t){this.#c||(this.#c=requestAnimationFrame(()=>{if(this.#c=null,!this.#n)return;this.#m(t);let e=this.#e[this.#s];p||this.#v(t,e.placement)}))}#N(){this.#d("tour:complete",{steps:this.#e.length}),this.#b({complete:!0}),this.stop(),this.setAttribute("data-complete","")}#L(){this.#u?.abort(),this.#u=null,this.#w();let t=this.#e[this.#s],e=t?document.querySelector(t.target):null;e&&(p&&(e.style.anchorName=""),e.removeAttribute("data-tour-target")),this.#o?.remove(),this.#r?.remove(),this.#t?.hidePopover?.(),this.#t?.remove(),this.#i?.remove(),this.#o=null,this.#r=null,this.#t=null,this.#i=null;let s=this.#p;s&&typeof s.focus=="function"&&(s.focus(),this.#p=null)}#T(t){this.#i&&(this.#i.textContent="",requestAnimationFrame(()=>{this.#i&&(this.#i.textContent=t)}))}#d(t,e){let s=t!=="tour:skip";this.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:s,detail:e}))}#f(){let t=this.dataset.persist??"session";return t==="session"?sessionStorage:t==="local"?localStorage:null}#g(){return`vb-tour-${this.dataset.persistKey??window.location.pathname}`}#b(t){let e=this.#f();if(!e)return;let s=this.#g(),i={};try{i=JSON.parse(e.getItem(s)??"null")??{}}catch{}e.setItem(s,JSON.stringify({...i,...t}))}#F(){let t=this.#f();if(!t)return null;try{return JSON.parse(t.getItem(this.#g())??"null")}catch{return null}}#D(){let t=this.#f();t&&t.removeItem(this.#g())}};f("page-tour",b);f("tour-step",g);export{b as PageTour,g as TourStep};
38
+ `}#a(t,e="next"){if(this.#u?.abort(),this.#u=null,this.#s!==t){let a=this.#e[this.#s],u=a?document.querySelector(a.target):null;u&&(p&&(u.style.anchorName=""),u.removeAttribute("data-tour-target"))}this.#w(),this.#s=t;let s=this.#e[t],i=document.querySelector(s.target);if(!i){console.warn(`[page-tour] Target "${s.target}" not found, skipping step ${t}`),e==="next"&&t<this.#e.length-1?this.#a(t+1,"next"):e==="prev"&&t>0&&this.#a(t-1,"prev");return}i.setAttribute("data-tour-target","");let n=y()?"instant":s.scrollBehavior;s.scrollBehavior!=="none"&&i.scrollIntoView({block:"nearest",behavior:n});let h=()=>{this.#m(i),this.#S(i,s.placement)};h(),setTimeout(h,y()?0:300),this.#x(s,t);let r=this.#t;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus()),requestAnimationFrame(()=>{let a=this.#t?.querySelector(".page-tour-content h3, .page-tour-content h2, .page-tour-content h4")??null;a?(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus()):(this.#t?.querySelector('[data-action="next"]')??null)?.focus()});let c=s.querySelector("h3, h2, h4")?.textContent??`Step ${t+1}`;this.#T(`Step ${t+1} of ${this.#e.length}: ${c}`),this.dataset.step=String(t),s.action!=="none"&&this.#E(s),this.#B(i),this.#b({step:t}),this.#n&&this.#d("tour:step",{step:t,target:i,direction:e})}#E(t){let e=document.querySelector(t.target);if(!e)return;let s=this.#t?.querySelector('[data-action="next"]')??null,i=new AbortController;this.#u=i;let h={click:"click",focus:"focus",input:"input",change:"change"}[t.action];h?e.addEventListener(h,()=>{s?.removeAttribute("data-waiting"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),s?.focus(),this.#d("tour:action",{step:this.#s,action:t.action}),i.abort()},{signal:i.signal,once:!0}):t.action==="custom"&&this.addEventListener("tour:action",()=>{s?.removeAttribute("data-waiting"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),s?.focus(),i.abort()},{signal:i.signal,once:!0})}#C(t){let e=this.dataset.mode??"passive",i=this.#e[this.#s]?.action!=="none",h=this.#t?.querySelector('[data-action="next"]')?.hasAttribute("data-waiting");switch(t.key){case"Escape":e!=="forced"&&(t.preventDefault(),this.skip());break;case"ArrowRight":case"ArrowDown":t.preventDefault(),i&&h||this.next();break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),this.prev();break;case"Home":t.preventDefault(),this.goto(0);break;case"End":t.preventDefault(),this.goto(this.#e.length-1);break;case"Tab":this.#q(t,i&&h);break}}#q(t,e){if(!this.#t)return;let s=[...this.#t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(c=>!c.disabled&&c.offsetParent!==null),i=[];if(e){let c=this.#e[this.#s],a=document.querySelector(c.target);a&&(i=(a.matches("input, select, textarea, button, [href], [tabindex]")?[a]:[...a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')]).filter(m=>!m.disabled&&m.offsetParent!==null))}let n=[...s,...i];if(n.length===0)return;let h=n[0],r=n[n.length-1],o=document.activeElement;t.shiftKey?(o===h||o&&!n.includes(o))&&(t.preventDefault(),r.focus()):(o===r||o&&!n.includes(o))&&(t.preventDefault(),h.focus())}#M(t){let e=t.target.closest("[data-action]");if(!e)return;switch(e.dataset.action){case"next":this.next();break;case"prev":this.prev();break;case"skip":this.skip();break}}#B(t){this.#l=new ResizeObserver(()=>{this.#k(t)}),this.#l.observe(t),this.listen(window,"scroll",()=>this.#k(t),{passive:!0})}#w(){this.#l&&(this.#l.disconnect(),this.#l=null),this.#c&&(cancelAnimationFrame(this.#c),this.#c=null)}#k(t){this.#c||(this.#c=requestAnimationFrame(()=>{if(this.#c=null,!this.#n)return;this.#m(t);let e=this.#e[this.#s];p||this.#v(t,e.placement)}))}#N(){this.#d("tour:complete",{steps:this.#e.length}),this.#b({complete:!0}),this.stop(),this.setAttribute("data-complete","")}#L(){this.#u?.abort(),this.#u=null,this.#w();let t=this.#e[this.#s],e=t?document.querySelector(t.target):null;e&&(p&&(e.style.anchorName=""),e.removeAttribute("data-tour-target")),this.#r?.remove(),this.#o?.remove(),this.#t?.hidePopover?.(),this.#t?.remove(),this.#i?.remove(),this.#r=null,this.#o=null,this.#t=null,this.#i=null;let s=this.#p;s&&typeof s.focus=="function"&&(s.focus(),this.#p=null)}#T(t){this.#i&&(this.#i.textContent="",requestAnimationFrame(()=>{this.#i&&(this.#i.textContent=t)}))}#d(t,e){let s=t!=="tour:skip";this.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:s,detail:e}))}#f(){let t=this.dataset.persist??"session";return t==="session"?sessionStorage:t==="local"?localStorage:null}#g(){return`vb-tour-${this.dataset.persistKey??window.location.pathname}`}#b(t){let e=this.#f();if(!e)return;let s=this.#g(),i={};try{i=JSON.parse(e.getItem(s)??"null")??{}}catch{}e.setItem(s,JSON.stringify({...i,...t}))}#F(){let t=this.#f();if(!t)return null;try{return JSON.parse(t.getItem(this.#g())??"null")}catch{return null}}#D(){let t=this.#f();t&&t.removeItem(this.#g())}};f("page-tour",b);f("tour-step",g);export{b as PageTour,g as TourStep};
39
39
  //# sourceMappingURL=page-tour.js.map
@@ -1,2 +1,2 @@
1
- var x=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function f(t,e,n={}){let i=n.priority??10,s={impl:e,bundle:n.bundle,contract:n.contract,priority:i},r=h.get(t);if(customElements.get(t)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${r.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}h.set(t,s),customElements.define(t,e)}var u=class extends HTMLElement{#e=[];#t;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 e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,i,s){e.addEventListener(n,i,s),this.#e.push(()=>e.removeEventListener(n,i,s))}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{n?i.add(e):i.delete(e)}catch{let s=`--${e}`;n?i.add(s):i.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}};function v(t,e){let n=Number(t);return!Number.isFinite(n)||e<=0?1:Math.min(Math.max(1,Math.floor(n)),e)}function E({page:t,size:e}){let n=(t-1)*e;return{start:n,end:n+e}}function y(t,e,n=2){if(e<=0)return[];if(e===1)return[1];let i=Math.max(2,t-n),s=Math.min(e-1,t+n),r=[1];i>2&&r.push("\u2026");for(let a=i;a<=s;a++)r.push(a);return s<e-1&&r.push("\u2026"),r.push(e),r}function m({total:t,size:e,page:n,window:i=2}){if(e<=0)return{page:(t>0,1),totalPages:t>0?1:0,start:0,end:t,pageNumbers:t>0?[1]:[]};let s=t>0?Math.ceil(t/e):0,r=v(n,s),a=E({page:r,size:e}),o=Math.min(a.end,t);return{page:r,totalPages:s,start:a.start,end:o,pageNumbers:y(r,s,i)}}function b(t){switch(t.style){case"load-more":return N(t);case"prev-next":return A(t);default:return C(t)}}function l(){let t=document.createElement("nav");return t.setAttribute("data-paged-nav",""),t.setAttribute("aria-label","Pagination"),t}function C({page:t,totalPages:e,pageNumbers:n,prevLabel:i="Previous",nextLabel:s="Next"}){let r=l(),a=document.createElement("ol");a.setAttribute("role","list"),a.appendChild(d(i,t-1,t===1,!1,"prev"));for(let o of n)if(o==="\u2026"){let c=document.createElement("li");c.textContent="\u2026",c.setAttribute("aria-hidden","true"),c.setAttribute("data-paged-ellipsis",""),a.appendChild(c)}else a.appendChild(d(String(o),o,!1,o===t,"page"));return a.appendChild(d(s,t+1,t===e,!1,"next")),r.appendChild(a),r}function A({page:t,totalPages:e,prevLabel:n="Previous",nextLabel:i="Next"}){let s=l(),r=document.createElement("ol");r.setAttribute("role","list"),r.appendChild(d(n,t-1,t===1,!1,"prev"));let a=document.createElement("li");return a.setAttribute("data-paged-status",""),a.setAttribute("aria-live","polite"),a.textContent=`Page ${t} of ${e}`,r.appendChild(a),r.appendChild(d(i,t+1,t===e,!1,"next")),s.appendChild(r),s}function N({total:t,visible:e,loadMoreLabel:n=s=>`Load more (${s})`,noMoreLabel:i="No more"}){let s=l(),r=document.createElement("button");r.type="button",r.setAttribute("data-paged-loadmore","");let a=t-e;return r.textContent=a>0?n(a):i,r.disabled=a<=0,s.appendChild(r),s}function d(t,e,n,i,s){let r=document.createElement("li"),a=document.createElement("button");return a.type="button",a.setAttribute("data-paged-action",s),a.dataset.pagedTarget=String(e),a.textContent=t,i&&a.setAttribute("aria-current","page"),n&&(a.disabled=!0),r.appendChild(a),r}function g(t,{onNavigate:e,onLoadMore:n}){e&&t.querySelectorAll("button[data-paged-target]").forEach(i=>{i.addEventListener("click",()=>e(parseInt(i.dataset.pagedTarget||"1",10)))}),n&&t.querySelectorAll("button[data-paged-loadmore]").forEach(i=>{i.addEventListener("click",()=>n())})}var p=class extends u{static observedAttributes=["target","for","style"];#e=null;#t=null;setup(){this.#n()}teardown(){this.#t?.(),this.#t=null}attributeChangedCallback(){!this.isConnected||!this.hasAttribute("data-upgraded")||(this.#t?.(),this.#t=null,this.#n())}#n(){if(this.#e=this.#i(),!this.#e){this.#s();return}let e=n=>this.#r(n.detail);this.#e.addEventListener("paged:change",e),this.#t=()=>this.#e?.removeEventListener("paged:change",e),this.#a()}#i(){let e=this.getAttribute("target");if(e)try{return document.querySelector(e)}catch{return null}let n=this.getAttribute("for");if(n)return document.getElementById(n);let i=this.previousElementSibling;for(;i;){if(i.hasAttribute("data-paged"))return i;i=i.previousElementSibling}return null}#a(){if(!this.#e)return;let e=this.#e,n=parseInt(e.dataset.pagedSize||"10",10)||10,i=parseInt(e.dataset.pagedPage||"1",10)||1,r=(e.tagName==="TABLE"?Array.from(e.querySelector(":scope > tbody")?.children||[]):Array.from(e.children).filter(o=>!o.matches("nav[data-paged-nav], div[data-paged-sentinel]"))).length,a=Math.max(1,Math.ceil(r/n));this.#r({page:i,size:n,total:r,totalPages:a})}#r(e){let n=this.getAttribute("style")||"numbered",i=parseInt(this.#e?.dataset.pagedWindow||"2",10)||2,s=m({total:e.total,size:e.size,page:e.page,window:i}),r=Math.min(e.page*e.size,e.total);if(this.replaceChildren(),n!=="load-more"&&s.totalPages<=1)return;let a=b({style:n,page:s.page,totalPages:s.totalPages,pageNumbers:s.pageNumbers,total:e.total,visible:r});g(a,{onNavigate:o=>this.#o(o),onLoadMore:()=>this.#d()}),this.appendChild(a)}#s(){this.replaceChildren();let e=document.createElement("p");e.setAttribute("data-pager-missing",""),e.setAttribute("aria-live","polite"),e.textContent="No paginated target found",this.appendChild(e)}#o(e){this.#e&&(this.dispatchEvent(new CustomEvent("pager-wc:navigate",{bubbles:!0,detail:{page:e}})),this.#e.dispatchEvent(new CustomEvent("paged:goto",{detail:{page:e}})))}#d(){this.#e&&this.#e.dispatchEvent(new CustomEvent("paged:loadmore"))}};f("pager-wc",p);export{p as PagerWC};
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function f(e,t,n={}){let i=n.priority??10,a={impl:t,bundle:n.bundle,contract:n.contract,priority:i},r=h.get(e);if(customElements.get(e)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${r.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}h.set(e,a),customElements.define(e,t)}var u=class extends HTMLElement{#t=[];#e;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,n,i,a){t.addEventListener(n,i,a),this.#t.push(()=>t.removeEventListener(n,i,a))}_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,n){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{n?i.add(t):i.delete(t)}catch{let a=`--${t}`;n?i.add(a):i.delete(a)}}_adoptInternals(t){this.#e||(this.#e=t)}};function v(e,t){let n=Number(e);return!Number.isFinite(n)||t<=0?1:Math.min(Math.max(1,Math.floor(n)),t)}function E({page:e,size:t}){let n=(e-1)*t;return{start:n,end:n+t}}function y(e,t,n=2){if(t<=0)return[];if(t===1)return[1];let i=Math.max(2,e-n),a=Math.min(t-1,e+n),r=[1];i>2&&r.push("\u2026");for(let s=i;s<=a;s++)r.push(s);return a<t-1&&r.push("\u2026"),r.push(t),r}function m({total:e,size:t,page:n,window:i=2}){if(t<=0)return{page:(e>0,1),totalPages:e>0?1:0,start:0,end:e,pageNumbers:e>0?[1]:[]};let a=e>0?Math.ceil(e/t):0,r=v(n,a),s=E({page:r,size:t}),o=Math.min(s.end,e);return{page:r,totalPages:a,start:s.start,end:o,pageNumbers:y(r,a,i)}}function b(e){switch(e.style){case"load-more":return N(e);case"prev-next":return A(e);default:return C(e)}}function l(){let e=document.createElement("nav");return e.setAttribute("data-paged-nav",""),e.setAttribute("aria-label","Pagination"),e}function C({page:e,totalPages:t,pageNumbers:n,prevLabel:i="Previous",nextLabel:a="Next"}){let r=l(),s=document.createElement("ol");s.setAttribute("role","list"),s.appendChild(d(i,e-1,e===1,!1,"prev"));for(let o of n)if(o==="\u2026"){let c=document.createElement("li");c.textContent="\u2026",c.setAttribute("aria-hidden","true"),c.setAttribute("data-paged-ellipsis",""),s.appendChild(c)}else s.appendChild(d(String(o),o,!1,o===e,"page"));return s.appendChild(d(a,e+1,e===t,!1,"next")),r.appendChild(s),r}function A({page:e,totalPages:t,prevLabel:n="Previous",nextLabel:i="Next"}){let a=l(),r=document.createElement("ol");r.setAttribute("role","list"),r.appendChild(d(n,e-1,e===1,!1,"prev"));let s=document.createElement("li");return s.setAttribute("data-paged-status",""),s.setAttribute("aria-live","polite"),s.textContent=`Page ${e} of ${t}`,r.appendChild(s),r.appendChild(d(i,e+1,e===t,!1,"next")),a.appendChild(r),a}function N({total:e,visible:t,loadMoreLabel:n=a=>`Load more (${a})`,noMoreLabel:i="No more"}){let a=l(),r=document.createElement("button");r.type="button",r.setAttribute("data-paged-loadmore","");let s=e-t;return r.textContent=s>0?n(s):i,r.disabled=s<=0,a.appendChild(r),a}function d(e,t,n,i,a){let r=document.createElement("li"),s=document.createElement("button");return s.type="button",s.setAttribute("data-paged-action",a),s.dataset.pagedTarget=String(t),s.textContent=e,i&&s.setAttribute("aria-current","page"),n&&(s.disabled=!0),r.appendChild(s),r}function g(e,{onNavigate:t,onLoadMore:n}){t&&e.querySelectorAll("button[data-paged-target]").forEach(i=>{i.addEventListener("click",()=>t(parseInt(i.dataset.pagedTarget||"1",10)))}),n&&e.querySelectorAll("button[data-paged-loadmore]").forEach(i=>{i.addEventListener("click",()=>n())})}var p=class extends u{static observedAttributes=["target","for","style"];#t=null;#e=null;setup(){this.#n()}teardown(){this.#e?.(),this.#e=null}attributeChangedCallback(){!this.isConnected||!this.hasAttribute("data-upgraded")||(this.#e?.(),this.#e=null,this.#n())}#n(){if(this.#t=this.#i(),!this.#t){this.#a();return}let t=n=>this.#r(n.detail);this.#t.addEventListener("paged:change",t),this.#e=()=>this.#t?.removeEventListener("paged:change",t),this.#s()}#i(){let t=this.getAttribute("target");if(t)try{return document.querySelector(t)}catch{return null}let n=this.getAttribute("for");if(n)return document.getElementById(n);let i=this.previousElementSibling;for(;i;){if(i.hasAttribute("data-paged"))return i;i=i.previousElementSibling}return null}#s(){if(!this.#t)return;let t=this.#t,n=parseInt(t.dataset.pagedSize||"10",10)||10,i=parseInt(t.dataset.pagedPage||"1",10)||1,r=(t.tagName==="TABLE"?Array.from(t.querySelector(":scope > tbody")?.children||[]):Array.from(t.children).filter(o=>!o.matches("nav[data-paged-nav], div[data-paged-sentinel]"))).length,s=Math.max(1,Math.ceil(r/n));this.#r({page:i,size:n,total:r,totalPages:s})}#r(t){let n=this.getAttribute("style")||"numbered",i=parseInt(this.#t?.dataset.pagedWindow||"2",10)||2,a=m({total:t.total,size:t.size,page:t.page,window:i}),r=Math.min(t.page*t.size,t.total);if(this.replaceChildren(),n!=="load-more"&&a.totalPages<=1)return;let s=b({style:n,page:a.page,totalPages:a.totalPages,pageNumbers:a.pageNumbers,total:t.total,visible:r});g(s,{onNavigate:o=>this.#o(o),onLoadMore:()=>this.#d()}),this.appendChild(s)}#a(){this.replaceChildren();let t=document.createElement("p");t.setAttribute("data-pager-missing",""),t.setAttribute("aria-live","polite"),t.textContent="No paginated target found",this.appendChild(t)}#o(t){this.#t&&(this.dispatchEvent(new CustomEvent("pager-wc:navigate",{bubbles:!0,detail:{page:t}})),this.#t.dispatchEvent(new CustomEvent("paged:goto",{detail:{page:t}})))}#d(){this.#t&&this.#t.dispatchEvent(new CustomEvent("paged:loadmore"))}};f("pager-wc",p);export{p as PagerWC};
2
2
  //# sourceMappingURL=pager-wc.js.map
@@ -1,2 +1,2 @@
1
- var w=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function m(a,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},r=f.get(a);if(customElements.get(a)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}f.set(a,i),customElements.define(a,t)}var c=class extends HTMLElement{#t=[];#e;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,s,e,i){t.addEventListener(s,e,i),this.#t.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var d=class extends c{static observedAttributes=["data-closed","data-multi"];#t;#e;#s;#n;#a=new WeakSet;setup(){this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.#l()||"Poll"),this.#e=this.querySelector(':scope > [slot="question"]');let t=this.#i();this.#e&&(this.#t=document.createElement("div"),this.#t.className="poll-question",this.#t.id=`poll-q-${this.#c()}`,this.#t.appendChild(this.#e)),this.#s=document.createElement("div"),this.#s.className="poll-options",this.#o(),this.#t&&this.#s.setAttribute("aria-labelledby",this.#t.id),t.forEach(e=>this.#s.appendChild(e)),this.#n=document.createElement("output"),this.#n.className="poll-total",this.#n.setAttribute("aria-live","polite");let s=[];this.#t&&s.push(this.#t),s.push(this.#s,this.#n),this.replaceChildren(...s),t.forEach(e=>this.#d(e)),this.#r()}attributeChangedCallback(t,s,e){!this.isConnected||s===e||(t==="data-closed"?(this.#r(),this.dispatchEvent(new CustomEvent("poll-wc:closed-change",{bubbles:!0,detail:{closed:this.hasAttribute("data-closed")}}))):t==="data-multi"&&(this.#o(),this.#r()))}#i(){return this.#s?[...this.#s.querySelectorAll(":scope > button[data-option]")]:[...this.querySelectorAll(":scope > button[data-option]")]}#l(){return this.querySelector(':scope > [slot="question"]')?.textContent.trim()}#o(){this.#s&&this.#s.setAttribute("role",this.hasAttribute("data-multi")?"group":"radiogroup")}#c(){return Math.random().toString(36).slice(2,8)}#d(t){if(this.#a.has(t))return;this.#a.add(t),t.type="button",t.classList.add("poll-option");let s=t.textContent;t.replaceChildren();let e=document.createElement("span");e.className="poll-option-label",e.textContent=s;let i=document.createElement("span");i.className="poll-option-bar",i.setAttribute("aria-hidden","true");let r=document.createElement("span");r.className="poll-option-count",r.setAttribute("aria-hidden","true"),t.append(e,i,r),this.listen(t,"click",()=>this.#u(t)),this.listen(t,"keydown",n=>this.#h(n,t))}#u(t){if(this.hasAttribute("data-closed")||this.hasAttribute("disabled"))return;let s=t.dataset.option,e=Number(t.dataset.count)||0,i=t.hasAttribute("data-mine");if(!this.hasAttribute("data-multi")&&!i){let n=this.#i().find(o=>o.hasAttribute("data-mine")&&o!==t);n&&this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:n.dataset.option,action:"remove",count:Number(n.dataset.count)||0,mine:!0}}))}this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:s,action:i?"remove":"add",count:e,mine:i}}))}#h=(t,s)=>{let e=this.#i(),i=e.indexOf(s),r=this.hasAttribute("data-multi"),n=i;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),n=(i+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),n=(i-1+e.length)%e.length;break;case"Home":t.preventDefault(),n=0;break;case"End":t.preventDefault(),n=e.length-1;break;default:return}e[n].focus(),!r&&this.hasAttribute("data-closed")};#r(){let t=this.#i(),s=t.reduce((n,o)=>n+(Number(o.dataset.count)||0),0),e=this.hasAttribute("data-closed"),i=this.hasAttribute("data-multi"),r=this.hasAttribute("data-hide-counts");t.forEach((n,o)=>{let l=Number(n.dataset.count)||0,u=n.hasAttribute("data-mine"),h=s>0?Math.round(l/s*1e3)/10:0;if(n.style.setProperty("--option-pct",String(h)),n.setAttribute("aria-checked",u?"true":"false"),n.setAttribute("role",i?"checkbox":"radio"),e||this.hasAttribute("disabled")?n.setAttribute("aria-disabled","true"):n.removeAttribute("aria-disabled"),i)n.setAttribute("tabindex","0");else{let E=t.find(v=>v.hasAttribute("data-mine"))||t[0];n.setAttribute("tabindex",n===E?"0":"-1")}let b=n.querySelector(".poll-option-count");b&&(b.textContent=r?"":`${l}`);let p=l===1?"vote":"votes",A=u?", your choice":"",y=n.querySelector(".poll-option-label")?.textContent||n.dataset.option;n.setAttribute("aria-label",`${y}, ${l} ${p} (${h}%)${A}`)}),this.#n&&(this.#n.textContent=`${s} ${s===1?"vote":"votes"}`)}setCount(t,s,e={}){let i=this.#i().find(r=>r.dataset.option===t);i&&(i.dataset.count=String(Math.max(0,Number(s)||0)),e.mine===!0?i.setAttribute("data-mine",""):e.mine===!1&&i.removeAttribute("data-mine"),this.#r())}setCounts(t,s={}){let e=Array.isArray(s.mine)?s.mine:s.mine?[s.mine]:null;for(let i of this.#i()){let r=i.dataset.option;t[r]!=null&&(i.dataset.count=String(Math.max(0,Number(t[r])))),e&&(e.includes(r)?i.setAttribute("data-mine",""):i.removeAttribute("data-mine"))}this.#r()}close(){this.setAttribute("data-closed","")}open(){this.removeAttribute("data-closed")}get totalVotes(){return this.#i().reduce((t,s)=>t+(Number(s.dataset.count)||0),0)}get myVotes(){return this.#i().filter(t=>t.hasAttribute("data-mine")).map(t=>t.dataset.option)}};m("poll-wc",d);export{d as PollWc};
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function m(a,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},r=f.get(a);if(customElements.get(a)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}f.set(a,i),customElements.define(a,t)}var l=class extends HTMLElement{#t=[];#e;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,s,e,i){t.addEventListener(s,e,i),this.#t.push(()=>t.removeEventListener(s,e,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,s){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var d=class extends l{static observedAttributes=["data-closed","data-multi"];#t;#e;#s;#n;#a=new WeakSet;setup(){this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.#c()||"Poll"),this.#e=this.querySelector(':scope > [slot="question"]');let t=this.#i();this.#e&&(this.#t=document.createElement("div"),this.#t.className="poll-question",this.#t.id=`poll-q-${this.#l()}`,this.#t.appendChild(this.#e)),this.#s=document.createElement("div"),this.#s.className="poll-options",this.#o(),this.#t&&this.#s.setAttribute("aria-labelledby",this.#t.id),t.forEach(e=>this.#s.appendChild(e)),this.#n=document.createElement("output"),this.#n.className="poll-total",this.#n.setAttribute("aria-live","polite");let s=[];this.#t&&s.push(this.#t),s.push(this.#s,this.#n),this.replaceChildren(...s),t.forEach(e=>this.#d(e)),this.#r()}attributeChangedCallback(t,s,e){!this.isConnected||s===e||(t==="data-closed"?(this.#r(),this.dispatchEvent(new CustomEvent("poll-wc:closed-change",{bubbles:!0,detail:{closed:this.hasAttribute("data-closed")}}))):t==="data-multi"&&(this.#o(),this.#r()))}#i(){return this.#s?[...this.#s.querySelectorAll(":scope > button[data-option]")]:[...this.querySelectorAll(":scope > button[data-option]")]}#c(){return this.querySelector(':scope > [slot="question"]')?.textContent.trim()}#o(){this.#s&&this.#s.setAttribute("role",this.hasAttribute("data-multi")?"group":"radiogroup")}#l(){return Math.random().toString(36).slice(2,8)}#d(t){if(this.#a.has(t))return;this.#a.add(t),t.type="button",t.classList.add("poll-option");let s=t.textContent;t.replaceChildren();let e=document.createElement("span");e.className="poll-option-label",e.textContent=s;let i=document.createElement("span");i.className="poll-option-bar",i.setAttribute("aria-hidden","true");let r=document.createElement("span");r.className="poll-option-count",r.setAttribute("aria-hidden","true"),t.append(e,i,r),this.listen(t,"click",()=>this.#u(t)),this.listen(t,"keydown",n=>this.#h(n,t))}#u(t){if(this.hasAttribute("data-closed")||this.hasAttribute("disabled"))return;let s=t.dataset.option,e=Number(t.dataset.count)||0,i=t.hasAttribute("data-mine");if(!this.hasAttribute("data-multi")&&!i){let n=this.#i().find(o=>o.hasAttribute("data-mine")&&o!==t);n&&this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:n.dataset.option,action:"remove",count:Number(n.dataset.count)||0,mine:!0}}))}this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:s,action:i?"remove":"add",count:e,mine:i}}))}#h=(t,s)=>{let e=this.#i(),i=e.indexOf(s),r=this.hasAttribute("data-multi"),n=i;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),n=(i+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),n=(i-1+e.length)%e.length;break;case"Home":t.preventDefault(),n=0;break;case"End":t.preventDefault(),n=e.length-1;break;default:return}e[n].focus(),!r&&this.hasAttribute("data-closed")};#r(){let t=this.#i(),s=t.reduce((n,o)=>n+(Number(o.dataset.count)||0),0),e=this.hasAttribute("data-closed"),i=this.hasAttribute("data-multi"),r=this.hasAttribute("data-hide-counts");t.forEach((n,o)=>{let c=Number(n.dataset.count)||0,u=n.hasAttribute("data-mine"),h=s>0?Math.round(c/s*1e3)/10:0;if(n.style.setProperty("--option-pct",String(h)),n.setAttribute("aria-checked",u?"true":"false"),n.setAttribute("role",i?"checkbox":"radio"),e||this.hasAttribute("disabled")?n.setAttribute("aria-disabled","true"):n.removeAttribute("aria-disabled"),i)n.setAttribute("tabindex","0");else{let E=t.find(v=>v.hasAttribute("data-mine"))||t[0];n.setAttribute("tabindex",n===E?"0":"-1")}let b=n.querySelector(".poll-option-count");b&&(b.textContent=r?"":`${c}`);let p=c===1?"vote":"votes",A=u?", your choice":"",y=n.querySelector(".poll-option-label")?.textContent||n.dataset.option;n.setAttribute("aria-label",`${y}, ${c} ${p} (${h}%)${A}`)}),this.#n&&(this.#n.textContent=`${s} ${s===1?"vote":"votes"}`)}setCount(t,s,e={}){let i=this.#i().find(r=>r.dataset.option===t);i&&(i.dataset.count=String(Math.max(0,Number(s)||0)),e.mine===!0?i.setAttribute("data-mine",""):e.mine===!1&&i.removeAttribute("data-mine"),this.#r())}setCounts(t,s={}){let e=Array.isArray(s.mine)?s.mine:s.mine?[s.mine]:null;for(let i of this.#i()){let r=i.dataset.option;t[r]!=null&&(i.dataset.count=String(Math.max(0,Number(t[r])))),e&&(e.includes(r)?i.setAttribute("data-mine",""):i.removeAttribute("data-mine"))}this.#r()}close(){this.setAttribute("data-closed","")}open(){this.removeAttribute("data-closed")}get totalVotes(){return this.#i().reduce((t,s)=>t+(Number(s.dataset.count)||0),0)}get myVotes(){return this.#i().filter(t=>t.hasAttribute("data-mine")).map(t=>t.dataset.option)}};m("poll-wc",d);export{d as PollWc};
2
2
  //# sourceMappingURL=poll-wc.js.map
@@ -1,2 +1,2 @@
1
- var m=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function l(n,t,e={}){let o=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:o},s=h.get(n);if(customElements.get(n)){if(!s||s.priority>=o){s&&s.priority===o&&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>=o){s.priority===o&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}h.set(n,i),customElements.define(n,t)}var r=class extends HTMLElement{#t=[];#e;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,o,i){t.addEventListener(e,o,i),this.#t.push(()=>t.removeEventListener(e,o,i))}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{e?o.add(t):o.delete(t)}catch{let i=`--${t}`;e?o.add(i):o.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var a=CSS.supports("anchor-name","--x"),f=CSS.supports("position-area","bottom"),u=0,c=class extends r{#t=null;#e=null;#s=null;#o=null;setup(){this.id||(this.id=`pop-over-${++u}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#n(),this.#r(),this.#s=e=>{let o=e.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${o}`,{detail:{state:e.newState},bubbles:!0,composed:!0})),!a&&e.newState==="open"&&this.#t&&this.#i()},this.listen(this,"beforetoggle",this.#s),a||(this.#o=()=>{this.matches(":popover-open")&&this.#t&&this.#i()},this.listen(window,"resize",this.#o),this.listen(window,"scroll",this.#o,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#n(){let t=this.dataset.anchor;t?this.#t=document.getElementById(t)||document.querySelector(t):this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#r(){if(!(!this.#t||!a)&&(this.#e=`--pop-over-anchor-${this.id}`,this.#t.style.setProperty("anchor-name",this.#e),this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e||""),!f)){let t=this.dataset.position||"bottom";this.#a(t)}}#a(t){let e="var(--_pop-over-offset, var(--size-xs))",o={top:{bottom:`calc(anchor(top) + ${e})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${e})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},i=t.split("-")[0],s=o[i]||o.bottom;Object.entries(s).forEach(([d,p])=>this.style.setProperty(d,p))}#i(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",o=this.#c(),i,s;switch(e.split("-")[0]){case"top":i=t.top-this.offsetHeight-o,s=t.left;break;case"left":i=t.top,s=t.left-this.offsetWidth-o;break;case"right":i=t.top,s=t.right+o;break;default:i=t.bottom+o,s=t.left;break}e.endsWith("-end")&&(e.startsWith("top")||e.startsWith("bottom")?s=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(s)}px`,this.style.margin="0"}#c(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};l("pop-over",c);
1
+ var m=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function l(n,t,e={}){let o=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:o},s=h.get(n);if(customElements.get(n)){if(!s||s.priority>=o){s&&s.priority===o&&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>=o){s.priority===o&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}h.set(n,i),customElements.define(n,t)}var r=class extends HTMLElement{#t=[];#e;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,o,i){t.addEventListener(e,o,i),this.#t.push(()=>t.removeEventListener(e,o,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.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{e?o.add(t):o.delete(t)}catch{let i=`--${t}`;e?o.add(i):o.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var a=CSS.supports("anchor-name","--x"),f=CSS.supports("position-area","bottom"),u=0,c=class extends r{#t=null;#e=null;#s=null;#o=null;setup(){this.id||(this.id=`pop-over-${++u}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#n(),this.#r(),this.#s=e=>{let o=e.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${o}`,{detail:{state:e.newState},bubbles:!0,composed:!0})),!a&&e.newState==="open"&&this.#t&&this.#i()},this.listen(this,"beforetoggle",this.#s),a||(this.#o=()=>{this.matches(":popover-open")&&this.#t&&this.#i()},this.listen(window,"resize",this.#o),this.listen(window,"scroll",this.#o,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#n(){let t=this.dataset.anchor;t?this.#t=document.getElementById(t)||document.querySelector(t):this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#r(){if(!(!this.#t||!a)&&(this.#e=`--pop-over-anchor-${this.id}`,this.#t.style.setProperty("anchor-name",this.#e),this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e||""),!f)){let t=this.dataset.position||"bottom";this.#a(t)}}#a(t){let e="var(--_pop-over-offset, var(--size-xs))",o={top:{bottom:`calc(anchor(top) + ${e})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${e})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},i=t.split("-")[0],s=o[i]||o.bottom;Object.entries(s).forEach(([d,p])=>this.style.setProperty(d,p))}#i(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",o=this.#c(),i,s;switch(e.split("-")[0]){case"top":i=t.top-this.offsetHeight-o,s=t.left;break;case"left":i=t.top,s=t.left-this.offsetWidth-o;break;case"right":i=t.top,s=t.right+o;break;default:i=t.bottom+o,s=t.left;break}e.endsWith("-end")&&(e.startsWith("top")||e.startsWith("bottom")?s=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(s)}px`,this.style.margin="0"}#c(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};l("pop-over",c);
2
2
  //# sourceMappingURL=pop-over.js.map
@@ -1,9 +1,9 @@
1
- var w=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(s,e,n={}){let r=n.priority??10,i={impl:e,bundle:n.bundle,contract:n.contract,priority:r},t=m.get(s);if(customElements.get(s)){if(!t||t.priority>=r){t&&t.priority===r&&t.impl!==e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=r){t.priority===r&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${t.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(s,i),customElements.define(s,e)}var u=class extends HTMLElement{#t=[];#e;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 e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,i){e.addEventListener(n,r,i),this.#t.push(()=>e.removeEventListener(n,r,i))}setup(){}teardown(){}setState(e,n){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{n?r.add(e):r.delete(e)}catch{let i=`--${e}`;n?r.add(i):r.delete(i)}}_adoptInternals(e){this.#e||(this.#e=e)}};var f=class extends u{setup(){this.#t().catch(()=>{})}async#t(){let e=this.getAttribute("data-lens-src")||"/api/analytics/popular",n=this.getAttribute("window"),r=new URL(e,document.baseURI);n&&r.searchParams.set("window",n);let i=null;try{let o=await fetch(r,{credentials:"omit"});if(!o.ok)throw new Error(`status ${o.status}`);i=await o.json()}catch(o){this.#r(o.message);return}let t=Array.isArray(i?.pages)?i.pages:Array.isArray(i)?i:[];if(!t.length){this.#n();return}let a=this.getAttribute("data-meta-src"),c=null;if(a)try{let o=await fetch(a,{credentials:"omit"});if(o.ok){let l=await o.json(),d=Array.isArray(l)?l:l?.pages||[];c=new Map(d.map(h=>[h.url,h]))}}catch{}this.#e(t,c)}#e(e,n){let r=parseInt(this.getAttribute("limit")||"10",10)||10,i=e.slice(0,r),t=['<h2 class="popularity-heading">Most visited</h2>'];t.push('<ol class="popularity-list">');for(let a of i){let c=n?.get(a.url)||{},o=a.title||c.title||a.url,l=g(a.views??a.count??0),d=c.provenance?`<span class="popularity-prov" data-provenance="${b(c.provenance)}">${p(c.provenance)}</span>`:"";t.push(`<li><a href="${b(a.url)}">${p(o)}</a><small>${l} views${d?` \xB7 ${d}`:""}</small></li>`)}t.push("</ol>"),this.innerHTML=t.join(`
2
- `)}#r(e){this.innerHTML=`
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(s,t,n={}){let r=n.priority??10,i={impl:t,bundle:n.bundle,contract:n.contract,priority:r},e=m.get(s);if(customElements.get(s)){if(!e||e.priority>=r){e&&e.priority===r&&e.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${e.bundle}" (priority ${e.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${e.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(e&&e.priority>=r){e.priority===r&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${e.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(s,i),customElements.define(s,t)}var u=class extends HTMLElement{#t=[];#e;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,n,r,i){t.addEventListener(n,r,i),this.#t.push(()=>t.removeEventListener(n,r,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,n){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{n?r.add(t):r.delete(t)}catch{let i=`--${t}`;n?r.add(i):r.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var f=class extends u{setup(){this.#t().catch(()=>{})}async#t(){let t=this.getAttribute("analytics-src")||"/api/analytics/popular",n=this.getAttribute("window"),r=new URL(t,document.baseURI);n&&r.searchParams.set("window",n);let i=null;try{let o=await fetch(r,{credentials:"omit"});if(!o.ok)throw new Error(`status ${o.status}`);i=await o.json()}catch(o){this.#r(o.message);return}let e=Array.isArray(i?.pages)?i.pages:Array.isArray(i)?i:[];if(!e.length){this.#n();return}let a=this.getAttribute("data-meta-src")||this.getAttribute("data-lens-src"),c=null;if(a)try{let o=await fetch(a,{credentials:"omit"});if(o.ok){let l=await o.json(),d=Array.isArray(l)?l:l?.pages||[];c=new Map(d.map(h=>[h.url,h]))}}catch{}this.#e(e,c)}#e(t,n){let r=parseInt(this.getAttribute("limit")||"10",10)||10,i=t.slice(0,r),e=['<h2 class="popularity-heading">Most visited</h2>'];e.push('<ol class="popularity-list">');for(let a of i){let c=n?.get(a.url)||{},o=a.title||c.title||a.url,l=g(a.views??a.count??0),d=c.provenance?`<span class="popularity-prov" data-provenance="${b(c.provenance)}">${p(c.provenance)}</span>`:"";e.push(`<li><a href="${b(a.url)}">${p(o)}</a><small>${l} views${d?` \xB7 ${d}`:""}</small></li>`)}e.push("</ol>"),this.innerHTML=e.join(`
2
+ `)}#r(t){this.innerHTML=`
3
3
  <h2 class="popularity-heading">Most visited</h2>
4
- <p class="popularity-empty">Popularity data is unavailable right now${e?` (${p(e)})`:""}.</p>
4
+ <p class="popularity-empty">Popularity data is unavailable right now${t?` (${p(t)})`:""}.</p>
5
5
  `}#n(){this.innerHTML=`
6
6
  <h2 class="popularity-heading">Most visited</h2>
7
7
  <p class="popularity-empty">Not enough data yet to surface most-visited pages.</p>
8
- `}};function g(s){let e=Number(s)||0;return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function p(s){return String(s??"").replace(/[&<>]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[e])}function b(s){return String(s??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}y("popularity-index",f);export{f as PopularityIndex};
8
+ `}};function g(s){let t=Number(s)||0;return t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function p(s){return String(s??"").replace(/[&<>]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[t])}function b(s){return String(s??"").replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}y("popularity-index",f);export{f as PopularityIndex};
9
9
  //# sourceMappingURL=popularity-index.js.map
@@ -1,2 +1,2 @@
1
- var h=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(r,e,t={}){let n=t.priority??10,s={impl:e,bundle:t.bundle,contract:t.contract,priority:n},i=l.get(r);if(customElements.get(r)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}l.set(r,s),customElements.define(r,e)}var c=class extends HTMLElement{#e=[];#t;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 e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,s){e.addEventListener(t,n,s),this.#e.push(()=>e.removeEventListener(t,n,s))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let s=`--${e}`;t?n.add(s):n.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}};var a=class extends c{#e;#t;#n=null;setup(){this.#n===null&&(this.#n=this.getAttribute("label")||this.textContent.trim()||"Print this page");let e=this.#n,t=this.hasAttribute("raw-toggle");this.innerHTML="",t&&this.setAttribute("role","group");let n=this.getAttribute("variant")||"icon";this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="print-trigger",this.#e.setAttribute("aria-label",e);let s=n!=="label",i=n!=="icon";if(s){let o=document.createElement("icon-wc");o.setAttribute("name","printer"),o.setAttribute("size","sm"),o.setAttribute("aria-hidden","true"),this.#e.appendChild(o)}if(i){let o=document.createElement("span");o.textContent=e,this.#e.appendChild(o)}if(this.listen(this.#e,"click",this.#i),this.append(this.#e),t){let o=document.createElement("label");this.#t=document.createElement("input"),this.#t.type="checkbox";let d=document.createElement("span");d.textContent="Print without VB styles",o.append(this.#t,d),this.append(o)}}teardown(){this.#e=null,this.#t=null}#i=()=>{let e=this.#t?.checked;if(e&&document.documentElement.setAttribute("data-print-raw",""),window.print(),e){let t=()=>{document.documentElement.removeAttribute("data-print-raw"),window.removeEventListener("afterprint",t),clearTimeout(n)};window.addEventListener("afterprint",t,{once:!0});let n=setTimeout(t,5e3)}}};u("print-page",a);export{a as PrintPage};
1
+ var h=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(s,t,e={}){let n=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:n},i=l.get(s);if(customElements.get(s)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(s,o),customElements.define(s,t)}var c=class extends HTMLElement{#t=[];#e;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)}};var a=class extends c{#t;#e;#n=null;setup(){this.#n===null&&(this.#n=this.getAttribute("label")||this.textContent.trim()||"Print this page");let t=this.#n,e=this.hasAttribute("raw-toggle");this.innerHTML="",e&&this.setAttribute("role","group");let n=this.getAttribute("variant")||"icon";this.#t=document.createElement("button"),this.#t.type="button",this.#t.className="print-trigger",this.#t.setAttribute("aria-label",t);let o=n!=="label",i=n!=="icon";if(o){let r=document.createElement("icon-wc");r.setAttribute("name","printer"),r.setAttribute("size","sm"),r.setAttribute("aria-hidden","true"),this.#t.appendChild(r)}if(i){let r=document.createElement("span");r.textContent=t,this.#t.appendChild(r)}if(this.listen(this.#t,"click",this.#i),this.append(this.#t),e){let r=document.createElement("label");this.#e=document.createElement("input"),this.#e.type="checkbox";let d=document.createElement("span");d.textContent="Print without VB styles",r.append(this.#e,d),this.append(r)}}teardown(){this.#t=null,this.#e=null}#i=()=>{let t=this.#e?.checked;if(t&&document.documentElement.setAttribute("data-print-raw",""),window.print(),t){let e=()=>{document.documentElement.removeAttribute("data-print-raw"),window.removeEventListener("afterprint",e),clearTimeout(n)};window.addEventListener("afterprint",e,{once:!0});let n=setTimeout(e,5e3)}}};u("print-page",a);export{a as PrintPage};
2
2
  //# sourceMappingURL=print-page.js.map
@@ -1,2 +1,2 @@
1
- var p=window.matchMedia("(prefers-reduced-motion: reduce)");var d=new Map;function l(i,t,r={}){let e=r.priority??10,s={impl:t,bundle:r.bundle,contract:r.contract,priority:e},n=d.get(i);if(customElements.get(i)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}d.set(i,s),customElements.define(i,t)}var c=class extends HTMLElement{#r=[];#t;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.#r)t();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,r,e,s){t.addEventListener(r,e,s),this.#r.push(()=>t.removeEventListener(r,e,s))}setup(){}teardown(){}setState(t,r){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{r?e.add(t):e.delete(t)}catch{let s=`--${t}`;r?e.add(s):e.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}};var a=class extends c{static observedAttributes=["data-current"];#r=[];#t=!1;setup(){this.hasAttribute("role")||this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Progress"),this.#e().forEach(t=>this.#o(t)),this.#n()}attributeChangedCallback(t,r,e){if(!(!this.isConnected||r===e)&&t==="data-current"){if(this.#n(),this.#t){this.#t=!1;return}this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:this.#i(),previousStep:this.#c(r),source:"attr"}}))}}#e(){return[...this.querySelectorAll(":scope > li[data-step]")]}#o(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.setAttribute("role","listitem");let r=t.textContent;t.replaceChildren();let e=document.createElement("span");e.className="pt-circle",e.setAttribute("aria-hidden","true");let s=document.createElement("span");s.className="pt-label",s.textContent=r,t.append(e,s),this.hasAttribute("data-clickable")&&(t.addEventListener("click",()=>this.#a(t)),t.style.cursor="pointer")}#n(){let t=this.#e(),r=this.#s(t);t.forEach((e,s)=>{let n=e.hasAttribute("data-error"),o;n?o="error":s<r?o="complete":s===r?o="current":o="upcoming",e.dataset.status=o,e.setAttribute("aria-current",o==="current"?"step":"false");let u=e.querySelector(":scope > .pt-circle"),h=e.querySelector(":scope > .pt-label")?.textContent||"";u&&(u.textContent=o==="complete"?"\u2713":o==="error"?"!":String(s+1));let f=`Step ${s+1} of ${t.length}: ${h} (${o})`;e.setAttribute("aria-label",f),this.hasAttribute("data-clickable")?e.setAttribute("tabindex",s===r?"0":"-1"):e.removeAttribute("tabindex")})}#s(t){let r=this.getAttribute("data-current");if(r==null)return 0;let e=Number(r);if(Number.isFinite(e)&&e>0)return Math.min(t.length-1,e-1);let s=t.findIndex(n=>n.dataset.step===r);return s===-1?0:s}#i(){let t=this.#e();return t[this.#s(t)]?.dataset.step??null}#c(t){if(t==null)return null;let r=this.#e(),e=Number(t);return Number.isFinite(e)&&e>0?r[Math.min(r.length-1,e-1)]?.dataset.step??null:r.find(s=>s.dataset.step===t)?.dataset.step??null}#a(t){let r=t.dataset.step;if(!r)return;let e=this.#e().indexOf(t),s=this.#s(this.#e());if(e>s)return;let n=this.#i();this.#t=!0,this.setAttribute("data-current",r),this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:r,previousStep:n,source:"click"}}))}};l("progress-tracker",a);export{a as ProgressTracker};
1
+ var p=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function l(i,t,r={}){let e=r.priority??10,s={impl:t,bundle:r.bundle,contract:r.contract,priority:e},n=u.get(i);if(customElements.get(i)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}u.set(i,s),customElements.define(i,t)}var a=class extends HTMLElement{#e=[];#t;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,r,e,s){t.addEventListener(r,e,s),this.#e.push(()=>t.removeEventListener(r,e,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,r){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{r?e.add(t):e.delete(t)}catch{let s=`--${t}`;r?e.add(s):e.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}};var c=class extends a{static observedAttributes=["data-current"];#e=[];#t=!1;setup(){this.hasAttribute("role")||this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Progress"),this.#r().forEach(t=>this.#o(t)),this.#n()}attributeChangedCallback(t,r,e){if(!(!this.isConnected||r===e)&&t==="data-current"){if(this.#n(),this.#t){this.#t=!1;return}this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:this.#i(),previousStep:this.#a(r),source:"attr"}}))}}#r(){return[...this.querySelectorAll(":scope > li[data-step]")]}#o(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.setAttribute("role","listitem");let r=t.textContent;t.replaceChildren();let e=document.createElement("span");e.className="pt-circle",e.setAttribute("aria-hidden","true");let s=document.createElement("span");s.className="pt-label",s.textContent=r,t.append(e,s),this.hasAttribute("data-clickable")&&(t.addEventListener("click",()=>this.#c(t)),t.style.cursor="pointer")}#n(){let t=this.#r(),r=this.#s(t);t.forEach((e,s)=>{let n=e.hasAttribute("data-error"),o;n?o="error":s<r?o="complete":s===r?o="current":o="upcoming",e.dataset.status=o,e.setAttribute("aria-current",o==="current"?"step":"false");let d=e.querySelector(":scope > .pt-circle"),h=e.querySelector(":scope > .pt-label")?.textContent||"";d&&(d.textContent=o==="complete"?"\u2713":o==="error"?"!":String(s+1));let f=`Step ${s+1} of ${t.length}: ${h} (${o})`;e.setAttribute("aria-label",f),this.hasAttribute("data-clickable")?e.setAttribute("tabindex",s===r?"0":"-1"):e.removeAttribute("tabindex")})}#s(t){let r=this.getAttribute("data-current");if(r==null)return 0;let e=Number(r);if(Number.isFinite(e)&&e>0)return Math.min(t.length-1,e-1);let s=t.findIndex(n=>n.dataset.step===r);return s===-1?0:s}#i(){let t=this.#r();return t[this.#s(t)]?.dataset.step??null}#a(t){if(t==null)return null;let r=this.#r(),e=Number(t);return Number.isFinite(e)&&e>0?r[Math.min(r.length-1,e-1)]?.dataset.step??null:r.find(s=>s.dataset.step===t)?.dataset.step??null}#c(t){let r=t.dataset.step;if(!r)return;let e=this.#r().indexOf(t),s=this.#s(this.#r());if(e>s)return;let n=this.#i();this.#t=!0,this.setAttribute("data-current",r),this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:r,previousStep:n,source:"click"}}))}};l("progress-tracker",c);export{c as ProgressTracker};
2
2
  //# sourceMappingURL=progress-tracker.js.map
@@ -1,2 +1,2 @@
1
- var Z=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function C(n,t,e={}){let o=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:o},i=v.get(n);if(customElements.get(n)){if(!i||i.priority>=o){i&&i.priority===o&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=o){i.priority===o&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(n,r),customElements.define(n,t)}var m=class extends HTMLElement{#t=[];#e;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,o,r){t.addEventListener(e,o,r),this.#t.push(()=>t.removeEventListener(e,o,r))}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{e?o.add(t):o.delete(t)}catch{let r=`--${t}`;e?o.add(r):o.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}};var E="[data-copy], [data-copy-target], [data-paste-target]",T="Copied to clipboard",S="Pasted from clipboard",g=new WeakMap;async function N(n,t={}){if(n==null||n==="")return!1;let{button:e,announceMessage:o=T,duration:r=1500}=t;try{await navigator.clipboard.writeText(n)}catch{return!1}return A({button:e,duration:r,announceMessage:o,eventDetail:{text:n}}),!0}async function D(n,t={}){let{text:e,html:o,blob:r}=n??{};if(!e&&!o&&!r)return!1;let{button:i,announceMessage:s=T,duration:c=1500}=t;if(typeof ClipboardItem<"u"&&typeof navigator.clipboard?.write=="function"){let a={};e&&(a["text/plain"]=new Blob([e],{type:"text/plain"})),o&&(a["text/html"]=new Blob([o],{type:"text/html"})),r&&(a[r.type]=r);try{return await navigator.clipboard.write([new ClipboardItem(a)]),A({button:i,duration:c,announceMessage:s,eventDetail:{payload:n}}),!0}catch{}}return e?N(e,t):!1}function A({button:n,duration:t,announceMessage:e,eventDetail:o,state:r="copied",eventName:i="copy"}){if(n){n.dataset.state=r;let s=g.get(n);s&&clearTimeout(s),g.set(n,setTimeout(()=>{delete n.dataset.state,g.delete(n)},t)),n.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:o}))}L(e,n??document.body)}async function O(n,t={}){let{button:e,announceMessage:o=S,duration:r=1500}=t,i;try{i=await navigator.clipboard.readText()}catch{return null}return n&&("value"in n&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?n.value=i:n.textContent=i,n.dispatchEvent(new Event("input",{bubbles:!0}))),A({button:e,duration:r,announceMessage:o,eventDetail:{text:i},state:"pasted",eventName:"paste"}),i}function M(n=document){n.querySelectorAll(E).forEach(x)}function x(n){n.hasAttribute("data-copy-init")||(n.setAttribute("data-copy-init",""),n.addEventListener("click",()=>{if(n.dataset.pasteTarget){let e=document.querySelector(n.dataset.pasteTarget);if(!e)return;O(e,{button:n});return}let t=I(n);t&&N(t,{button:n})}))}function I(n){if(n.dataset.copy)return n.dataset.copy;if(n.dataset.copyTarget){let t=document.querySelector(n.dataset.copyTarget);if(!t)return"";let e=n.dataset.copyAttr;return e?t.getAttribute(e)??"":t.textContent??""}return""}function L(n,t){let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.className="visually-hidden",e.textContent=n,t.appendChild(e),setTimeout(()=>e.remove(),1e3)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>M()):M();var k=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let o=e;o.matches(E)&&x(o),o.querySelectorAll(E).forEach(r=>x(r))}});k.observe(document.documentElement,{childList:!0,subtree:!0});var w=class extends m{#t;#e=null;setup(){this.#e===null&&(this.#e=this.getAttribute("value")||this.textContent.trim());let t=this.#e;if(!t)return!1;let e=parseInt(this.getAttribute("size")??"200",10)||200,o=parseInt(this.getAttribute("error-correction")??"1",10)||1;return this.#t=document.createElement("canvas"),this.#t.width=e,this.#t.height=e,this.#t.setAttribute("role","img"),this.#t.setAttribute("aria-label",`QR code: ${t}`),this.#n(t,e,o),!0}static get observedAttributes(){return["value","size"]}attributeChangedCallback(t,e,o){if(!this.#t||!this.isConnected)return;t==="value"&&o&&(this.#e=o);let r=this.#e||this.getAttribute("value")||"";if(!r)return;let i=parseInt(this.getAttribute("size")??"200",10)||200,s=parseInt(this.getAttribute("error-correction")??"1",10)||1;this.#t.width=i,this.#t.height=i,this.#t.setAttribute("aria-label",`QR code: ${r}`),this.#n(r,i,s)}#n(t,e,o){let r=B(t,o),i=this.#t.getContext("2d"),s=r.length,c=e/s,l=getComputedStyle(this),a=this.getAttribute("color")||l.color||"#000",f=this.getAttribute("background")||"transparent";i.clearRect(0,0,e,e),f!=="transparent"&&(i.fillStyle=f,i.fillRect(0,0,e,e)),i.fillStyle=a;for(let h=0;h<s;h++)for(let d=0;d<s;d++)r[h][d]&&i.fillRect(Math.round(d*c),Math.round(h*c),Math.ceil(c),Math.ceil(c));this.textContent="",this.appendChild(this.#t);let u=document.createElement("span");u.className="visually-hidden",u.textContent=t,this.appendChild(u)}toDataURL(t="image/png"){return this.#t?.toDataURL(t)??""}async copy({button:t}={}){if(!this.#t)return!1;let e=this.#e||this.getAttribute("value")||"",o=await new Promise(r=>this.#t.toBlob(r,"image/png"));return D({text:e,blob:o||void 0},{button:t,announceMessage:"QR code copied"})}},y=[[[26,7],[44,10],[70,15],[100,20],[134,26],[172,18],[196,20],[242,24],[292,30],[346,18]],[[26,10],[44,16],[70,26],[100,18],[134,24],[172,16],[196,18],[242,22],[292,22],[346,26]],[[26,13],[44,22],[70,18],[100,26],[134,18],[172,24],[196,18],[242,22],[292,20],[346,28]],[[26,17],[44,28],[70,22],[100,16],[134,22],[172,28],[196,26],[242,26],[292,24],[346,28]]],F=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,52]];function B(n,t=1){let e=new TextEncoder().encode(n),o=R(e.length,t),r=y[t][o-1][0],i=y[t][o-1][1],s=r-i,c=U(e,o,s),l=_(c,s,i),a=o*4+17,f=Array.from({length:a},()=>new Uint8Array(a)),u=Array.from({length:a},()=>new Uint8Array(a));return P(f,u,a),q(f,u,o),j(f,u,a),G(u,a),H(f,u,l,a),Y(f,u,a,t)}function R(n,t){for(let e=1;e<=10;e++){let o=y[t][e-1][0],r=y[t][e-1][1],i=o-r,s=e<=9?8:16,c=Math.ceil((4+s)/8);if(n<=i-c)return e}return 10}function U(n,t,e){let o=[],r=(u,h)=>{for(let d=h-1;d>=0;d--)o.push(u>>d&1)};r(4,4);let i=t<=9?8:16;r(n.length,i);for(let u of n)r(u,8);let s=e*8,c=Math.min(4,s-o.length);for(r(0,c);o.length%8!==0;)o.push(0);let l=[236,17],a=0;for(;o.length<s;)r(l[a%2],8),a++;let f=[];for(let u=0;u<o.length;u+=8){let h=0;for(let d=0;d<8;d++)h=h<<1|(o[u+d]||0);f.push(h)}return f}function _(n,t,e){let o=$(e),r=new Uint8Array(t+e);for(let s=0;s<t;s++)r[s]=n[s];for(let s=0;s<t;s++){let c=r[s];if(c===0)continue;let l=b[c];for(let a=0;a<o.length;a++)r[s+a]^=p[(l+b[o[a]])%255]}let i=[...n.slice(0,t)];for(let s=0;s<e;s++)i.push(r[t+s]);return i}var p=new Uint8Array(512),b=new Uint8Array(256);(function(){let t=1;for(let e=0;e<255;e++)p[e]=t,b[t]=e,t<<=1,t>=256&&(t^=285);for(let e=255;e<512;e++)p[e]=p[e-255]})();function $(n){let t=new Uint8Array([1]);for(let e=0;e<n;e++){let o=new Uint8Array(t.length+1),r=e;for(let i=0;i<t.length;i++)o[i]^=t[i],o[i+1]^=p[(b[t[i]]+r)%255];t=o}return t}function P(n,t,e){let o=[[0,0],[e-7,0],[0,e-7]];for(let[r,i]of o){for(let s=0;s<7;s++)for(let c=0;c<7;c++){let l=s===0||s===6||c===0||c===6||s>=2&&s<=4&&c>=2&&c<=4;n[r+s][i+c]=l?1:0,t[r+s][i+c]=1}for(let s=-1;s<=7;s++)for(let[c,l]of[[s,-1],[s,7],[-1,s],[7,s]]){let a=r+c,f=i+l;a>=0&&a<e&&f>=0&&f<e&&(n[a][f]=0,t[a][f]=1)}}}function q(n,t,e){if(e<2)return;let o=F[e-1];for(let r of o)for(let i of o)if(!t[r][i])for(let s=-2;s<=2;s++)for(let c=-2;c<=2;c++){let l=Math.abs(s)===2||Math.abs(c)===2||s===0&&c===0;n[r+s][i+c]=l?1:0,t[r+s][i+c]=1}}function j(n,t,e){for(let o=8;o<e-8;o++){let r=o%2===0?1:0;t[6][o]||(n[6][o]=r,t[6][o]=1),t[o][6]||(n[o][6]=r,t[o][6]=1)}}function G(n,t){for(let e=0;e<=8;e++)e<t&&(n[8][e]=1),e<t&&(n[e][8]=1);for(let e=0;e<=7;e++)n[8][t-1-e]=1,n[t-1-e][8]=1;n[t-8][8]=1}function H(n,t,e,o){let r=[];for(let c of e)for(let l=7;l>=0;l--)r.push(c>>l&1);let i=0,s=!0;for(let c=o-1;c>=1;c-=2){c===6&&(c=5);let l=s?Array.from({length:o},(a,f)=>o-1-f):Array.from({length:o},(a,f)=>f);for(let a of l)for(let f of[c,c-1])f<0||f>=o||t[a][f]||(n[a][f]=i<r.length?r[i]:0,i++);s=!s}}var V=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107];function Q(n,t){let o=[1,0,3,2][n]*8+t;return V[o]}var K=[(n,t)=>(n+t)%2===0,n=>n%2===0,(n,t)=>t%3===0,(n,t)=>(n+t)%3===0,(n,t)=>(Math.floor(n/2)+Math.floor(t/3))%2===0,(n,t)=>n*t%2+n*t%3===0,(n,t)=>(n*t%2+n*t%3)%2===0,(n,t)=>((n+t)%2+n*t%3)%2===0];function W(n,t,e,o){let r=n.map(s=>new Uint8Array(s)),i=K[o];for(let s=0;s<e;s++)for(let c=0;c<e;c++)!t[s][c]&&i(s,c)&&(r[s][c]^=1);return r}function X(n,t,e,o){let r=Q(e,o),i=[[0,8],[1,8],[2,8],[3,8],[4,8],[5,8],[7,8],[8,8],[8,7],[8,5],[8,4],[8,3],[8,2],[8,1],[8,0]];for(let c=0;c<15;c++){let[l,a]=i[c];n[l][a]=r>>14-c&1}let s=[[8,t-1],[8,t-2],[8,t-3],[8,t-4],[8,t-5],[8,t-6],[8,t-7],[8,t-8],[t-7,8],[t-6,8],[t-5,8],[t-4,8],[t-3,8],[t-2,8],[t-1,8]];for(let c=0;c<15;c++){let[l,a]=s[c];n[l][a]=r>>14-c&1}n[t-8][8]=1}function J(n,t){let e=0;for(let o=0;o<t;o++){let r=1;for(let i=1;i<t;i++)n[o][i]===n[o][i-1]?(r++,r===5?e+=3:r>5&&(e+=1)):r=1}for(let o=0;o<t;o++){let r=1;for(let i=1;i<t;i++)n[i][o]===n[i-1][o]?(r++,r===5?e+=3:r>5&&(e+=1)):r=1}for(let o=0;o<t-1;o++)for(let r=0;r<t-1;r++){let i=n[o][r];i===n[o][r+1]&&i===n[o+1][r]&&i===n[o+1][r+1]&&(e+=3)}return e}function Y(n,t,e,o){let r=1/0,i=null;for(let s=0;s<8;s++){let c=W(n,t,e,s);X(c,e,o,s);let l=J(c,e);l<r&&(r=l,i=c)}return i}C("qr-code",w);export{w as QrCodeWc};
1
+ var Z=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function C(n,t,e={}){let o=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:o},i=v.get(n);if(customElements.get(n)){if(!i||i.priority>=o){i&&i.priority===o&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=o){i.priority===o&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(n,r),customElements.define(n,t)}var m=class extends HTMLElement{#t=[];#e;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,o,r){t.addEventListener(e,o,r),this.#t.push(()=>t.removeEventListener(e,o,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 o=this.#e.states;try{e?o.add(t):o.delete(t)}catch{let r=`--${t}`;e?o.add(r):o.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}};var E="[data-copy], [data-copy-target], [data-paste-target]",T="Copied to clipboard",S="Pasted from clipboard",g=new WeakMap;async function N(n,t={}){if(n==null||n==="")return!1;let{button:e,announceMessage:o=T,duration:r=1500}=t;try{await navigator.clipboard.writeText(n)}catch{return!1}return A({button:e,duration:r,announceMessage:o,eventDetail:{text:n}}),!0}async function D(n,t={}){let{text:e,html:o,blob:r}=n??{};if(!e&&!o&&!r)return!1;let{button:i,announceMessage:s=T,duration:c=1500}=t;if(typeof ClipboardItem<"u"&&typeof navigator.clipboard?.write=="function"){let a={};e&&(a["text/plain"]=new Blob([e],{type:"text/plain"})),o&&(a["text/html"]=new Blob([o],{type:"text/html"})),r&&(a[r.type]=r);try{return await navigator.clipboard.write([new ClipboardItem(a)]),A({button:i,duration:c,announceMessage:s,eventDetail:{payload:n}}),!0}catch{}}return e?N(e,t):!1}function A({button:n,duration:t,announceMessage:e,eventDetail:o,state:r="copied",eventName:i="copy"}){if(n){n.dataset.state=r;let s=g.get(n);s&&clearTimeout(s),g.set(n,setTimeout(()=>{delete n.dataset.state,g.delete(n)},t)),n.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:o}))}L(e,n??document.body)}async function O(n,t={}){let{button:e,announceMessage:o=S,duration:r=1500}=t,i;try{i=await navigator.clipboard.readText()}catch{return null}return n&&("value"in n&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?n.value=i:n.textContent=i,n.dispatchEvent(new Event("input",{bubbles:!0}))),A({button:e,duration:r,announceMessage:o,eventDetail:{text:i},state:"pasted",eventName:"paste"}),i}function M(n=document){n.querySelectorAll(E).forEach(x)}function x(n){n.hasAttribute("data-copy-init")||(n.setAttribute("data-copy-init",""),n.addEventListener("click",()=>{if(n.dataset.pasteTarget){let e=document.querySelector(n.dataset.pasteTarget);if(!e)return;O(e,{button:n});return}let t=I(n);t&&N(t,{button:n})}))}function I(n){if(n.dataset.copy)return n.dataset.copy;if(n.dataset.copyTarget){let t=document.querySelector(n.dataset.copyTarget);if(!t)return"";let e=n.dataset.copyAttr;return e?t.getAttribute(e)??"":t.textContent??""}return""}function L(n,t){let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.className="visually-hidden",e.textContent=n,t.appendChild(e),setTimeout(()=>e.remove(),1e3)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>M()):M();var k=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let o=e;o.matches(E)&&x(o),o.querySelectorAll(E).forEach(r=>x(r))}});k.observe(document.documentElement,{childList:!0,subtree:!0});var w=class extends m{#t;#e=null;setup(){this.#e===null&&(this.#e=this.getAttribute("value")||this.textContent.trim());let t=this.#e;if(!t)return!1;let e=parseInt(this.getAttribute("size")??"200",10)||200,o=parseInt(this.getAttribute("error-correction")??"1",10)||1;return this.#t=document.createElement("canvas"),this.#t.width=e,this.#t.height=e,this.#t.setAttribute("role","img"),this.#t.setAttribute("aria-label",`QR code: ${t}`),this.#n(t,e,o),!0}static get observedAttributes(){return["value","size"]}attributeChangedCallback(t,e,o){if(!this.#t||!this.isConnected)return;t==="value"&&o&&(this.#e=o);let r=this.#e||this.getAttribute("value")||"";if(!r)return;let i=parseInt(this.getAttribute("size")??"200",10)||200,s=parseInt(this.getAttribute("error-correction")??"1",10)||1;this.#t.width=i,this.#t.height=i,this.#t.setAttribute("aria-label",`QR code: ${r}`),this.#n(r,i,s)}#n(t,e,o){let r=_(t,o),i=this.#t.getContext("2d"),s=r.length,c=e/s,l=getComputedStyle(this),a=this.getAttribute("color")||l.color||"#000",f=this.getAttribute("background")||"transparent";i.clearRect(0,0,e,e),f!=="transparent"&&(i.fillStyle=f,i.fillRect(0,0,e,e)),i.fillStyle=a;for(let h=0;h<s;h++)for(let u=0;u<s;u++)r[h][u]&&i.fillRect(Math.round(u*c),Math.round(h*c),Math.ceil(c),Math.ceil(c));this.textContent="",this.appendChild(this.#t);let d=document.createElement("span");d.className="visually-hidden",d.textContent=t,this.appendChild(d)}toDataURL(t="image/png"){return this.#t?.toDataURL(t)??""}async copy({button:t}={}){if(!this.#t)return!1;let e=this.#e||this.getAttribute("value")||"",o=await new Promise(r=>this.#t.toBlob(r,"image/png"));return D({text:e,blob:o||void 0},{button:t,announceMessage:"QR code copied"})}},y=[[[26,7],[44,10],[70,15],[100,20],[134,26],[172,18],[196,20],[242,24],[292,30],[346,18]],[[26,10],[44,16],[70,26],[100,18],[134,24],[172,16],[196,18],[242,22],[292,22],[346,26]],[[26,13],[44,22],[70,18],[100,26],[134,18],[172,24],[196,18],[242,22],[292,20],[346,28]],[[26,17],[44,28],[70,22],[100,16],[134,22],[172,28],[196,26],[242,26],[292,24],[346,28]]],F=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,52]];function _(n,t=1){let e=new TextEncoder().encode(n),o=B(e.length,t),r=y[t][o-1][0],i=y[t][o-1][1],s=r-i,c=R(e,o,s),l=U(c,s,i),a=o*4+17,f=Array.from({length:a},()=>new Uint8Array(a)),d=Array.from({length:a},()=>new Uint8Array(a));return P(f,d,a),q(f,d,o),j(f,d,a),G(d,a),H(f,d,l,a),Y(f,d,a,t)}function B(n,t){for(let e=1;e<=10;e++){let o=y[t][e-1][0],r=y[t][e-1][1],i=o-r,s=e<=9?8:16,c=Math.ceil((4+s)/8);if(n<=i-c)return e}return 10}function R(n,t,e){let o=[],r=(d,h)=>{for(let u=h-1;u>=0;u--)o.push(d>>u&1)};r(4,4);let i=t<=9?8:16;r(n.length,i);for(let d of n)r(d,8);let s=e*8,c=Math.min(4,s-o.length);for(r(0,c);o.length%8!==0;)o.push(0);let l=[236,17],a=0;for(;o.length<s;)r(l[a%2],8),a++;let f=[];for(let d=0;d<o.length;d+=8){let h=0;for(let u=0;u<8;u++)h=h<<1|(o[d+u]||0);f.push(h)}return f}function U(n,t,e){let o=$(e),r=new Uint8Array(t+e);for(let s=0;s<t;s++)r[s]=n[s];for(let s=0;s<t;s++){let c=r[s];if(c===0)continue;let l=b[c];for(let a=0;a<o.length;a++)r[s+a]^=p[(l+b[o[a]])%255]}let i=[...n.slice(0,t)];for(let s=0;s<e;s++)i.push(r[t+s]);return i}var p=new Uint8Array(512),b=new Uint8Array(256);(function(){let t=1;for(let e=0;e<255;e++)p[e]=t,b[t]=e,t<<=1,t>=256&&(t^=285);for(let e=255;e<512;e++)p[e]=p[e-255]})();function $(n){let t=new Uint8Array([1]);for(let e=0;e<n;e++){let o=new Uint8Array(t.length+1),r=e;for(let i=0;i<t.length;i++)o[i]^=t[i],o[i+1]^=p[(b[t[i]]+r)%255];t=o}return t}function P(n,t,e){let o=[[0,0],[e-7,0],[0,e-7]];for(let[r,i]of o){for(let s=0;s<7;s++)for(let c=0;c<7;c++){let l=s===0||s===6||c===0||c===6||s>=2&&s<=4&&c>=2&&c<=4;n[r+s][i+c]=l?1:0,t[r+s][i+c]=1}for(let s=-1;s<=7;s++)for(let[c,l]of[[s,-1],[s,7],[-1,s],[7,s]]){let a=r+c,f=i+l;a>=0&&a<e&&f>=0&&f<e&&(n[a][f]=0,t[a][f]=1)}}}function q(n,t,e){if(e<2)return;let o=F[e-1];for(let r of o)for(let i of o)if(!t[r][i])for(let s=-2;s<=2;s++)for(let c=-2;c<=2;c++){let l=Math.abs(s)===2||Math.abs(c)===2||s===0&&c===0;n[r+s][i+c]=l?1:0,t[r+s][i+c]=1}}function j(n,t,e){for(let o=8;o<e-8;o++){let r=o%2===0?1:0;t[6][o]||(n[6][o]=r,t[6][o]=1),t[o][6]||(n[o][6]=r,t[o][6]=1)}}function G(n,t){for(let e=0;e<=8;e++)e<t&&(n[8][e]=1),e<t&&(n[e][8]=1);for(let e=0;e<=7;e++)n[8][t-1-e]=1,n[t-1-e][8]=1;n[t-8][8]=1}function H(n,t,e,o){let r=[];for(let c of e)for(let l=7;l>=0;l--)r.push(c>>l&1);let i=0,s=!0;for(let c=o-1;c>=1;c-=2){c===6&&(c=5);let l=s?Array.from({length:o},(a,f)=>o-1-f):Array.from({length:o},(a,f)=>f);for(let a of l)for(let f of[c,c-1])f<0||f>=o||t[a][f]||(n[a][f]=i<r.length?r[i]:0,i++);s=!s}}var V=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107];function Q(n,t){let o=[1,0,3,2][n]*8+t;return V[o]}var K=[(n,t)=>(n+t)%2===0,n=>n%2===0,(n,t)=>t%3===0,(n,t)=>(n+t)%3===0,(n,t)=>(Math.floor(n/2)+Math.floor(t/3))%2===0,(n,t)=>n*t%2+n*t%3===0,(n,t)=>(n*t%2+n*t%3)%2===0,(n,t)=>((n+t)%2+n*t%3)%2===0];function W(n,t,e,o){let r=n.map(s=>new Uint8Array(s)),i=K[o];for(let s=0;s<e;s++)for(let c=0;c<e;c++)!t[s][c]&&i(s,c)&&(r[s][c]^=1);return r}function X(n,t,e,o){let r=Q(e,o),i=[[0,8],[1,8],[2,8],[3,8],[4,8],[5,8],[7,8],[8,8],[8,7],[8,5],[8,4],[8,3],[8,2],[8,1],[8,0]];for(let c=0;c<15;c++){let[l,a]=i[c];n[l][a]=r>>14-c&1}let s=[[8,t-1],[8,t-2],[8,t-3],[8,t-4],[8,t-5],[8,t-6],[8,t-7],[8,t-8],[t-7,8],[t-6,8],[t-5,8],[t-4,8],[t-3,8],[t-2,8],[t-1,8]];for(let c=0;c<15;c++){let[l,a]=s[c];n[l][a]=r>>14-c&1}n[t-8][8]=1}function J(n,t){let e=0;for(let o=0;o<t;o++){let r=1;for(let i=1;i<t;i++)n[o][i]===n[o][i-1]?(r++,r===5?e+=3:r>5&&(e+=1)):r=1}for(let o=0;o<t;o++){let r=1;for(let i=1;i<t;i++)n[i][o]===n[i-1][o]?(r++,r===5?e+=3:r>5&&(e+=1)):r=1}for(let o=0;o<t-1;o++)for(let r=0;r<t-1;r++){let i=n[o][r];i===n[o][r+1]&&i===n[o+1][r]&&i===n[o+1][r+1]&&(e+=3)}return e}function Y(n,t,e,o){let r=1/0,i=null;for(let s=0;s<8;s++){let c=W(n,t,e,s);X(c,e,o,s);let l=J(c,e);l<r&&(r=l,i=c)}return i}C("qr-code",w);export{w as QrCodeWc};
2
2
  //# sourceMappingURL=qr-code.js.map
@@ -1,2 +1,2 @@
1
- var g=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function c(r,t,s={}){let e=s.priority??10,o={impl:t,bundle:s.bundle,contract:s.contract,priority:e},i=p.get(r);if(customElements.get(r)){if(!i||i.priority>=e){i&&i.priority===e&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=e){i.priority===e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}p.set(r,o),customElements.define(r,t)}var a=class extends HTMLElement{#e=[];#t;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,s,e,o){t.addEventListener(s,e,o),this.#e.push(()=>t.removeEventListener(s,e,o))}setup(){}teardown(){}setState(t,s){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{s?e.add(t):e.delete(t)}catch{let o=`--${t}`;s?e.add(o):e.delete(o)}}_adoptInternals(t){this.#t||(this.#t=t)}};var h=CSS.supports("anchor-name","--x"),f=CSS.supports("position-area","bottom"),b=0,d=class extends a{#e=null;#t=null;#s=null;#o=null;setup(){this.id||(this.id=`pop-over-${++b}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#a(),this.#r(),this.#s=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!h&&s.newState==="open"&&this.#e&&this.#i()},this.listen(this,"beforetoggle",this.#s),h||(this.#o=()=>{this.matches(":popover-open")&&this.#e&&this.#i()},this.listen(window,"resize",this.#o),this.listen(window,"scroll",this.#o,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#a(){let t=this.dataset.anchor;t?this.#e=document.getElementById(t)||document.querySelector(t):this.#e=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#r(){if(!(!this.#e||!h)&&(this.#t=`--pop-over-anchor-${this.id}`,this.#e.style.setProperty("anchor-name",this.#t),this.style.setProperty("position-anchor",this.#t),this.setAttribute("data-anchor-name",this.#t||""),!f)){let t=this.dataset.position||"bottom";this.#n(t)}}#n(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},o=t.split("-")[0],i=e[o]||e.bottom;Object.entries(i).forEach(([n,l])=>this.style.setProperty(n,l))}#i(){if(!this.#e)return;let t=this.#e.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#c(),o,i;switch(s.split("-")[0]){case"top":o=t.top-this.offsetHeight-e,i=t.left;break;case"left":o=t.top,i=t.left-this.offsetWidth-e;break;case"right":o=t.top,i=t.right+e;break;default:o=t.bottom+e,i=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?i=t.right-this.offsetWidth:o=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(o)}px`,this.style.left=`${Math.round(i)}px`,this.style.margin="0"}#c(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};c("pop-over",d);var m=0,u=class extends a{#e;#t;#s;#o;setup(){this.setAttribute("role","toolbar"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Reactions"),this.#e=this.querySelector(":scope > template[data-palette]"),this.#a().forEach(t=>this.#r(t)),this.#c(),this.#d(),this.#l(),this.listen(this,"keydown",this.#f)}#a(){return[...this.querySelectorAll(":scope > button[data-reaction]")]}#r(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.type="button",t.setAttribute("role","button");let s=t.textContent;t.replaceChildren();let e=document.createElement("span");e.className="reaction-emoji",e.setAttribute("aria-hidden","true"),e.textContent=s;let o=document.createElement("span");o.className="reaction-count",o.setAttribute("aria-hidden","true"),t.appendChild(e),t.appendChild(o),this.#n(t),this.listen(t,"click",()=>this.#i(t))}#n(t){let s=Number(t.dataset.count)||0,e=t.hasAttribute("data-mine"),o=t.querySelector(".reaction-emoji")?.textContent??"";t.querySelector(".reaction-count").textContent=s>0?String(s):"",t.setAttribute("aria-pressed",e?"true":"false");let i=s===1?"reaction":"reactions",n=e?", you reacted":"";t.setAttribute("aria-label",`${o}, ${s} ${i}${n}`)}#i(t){if(this.hasAttribute("data-disabled"))return;let s=t.dataset.reaction,e=Number(t.dataset.count)||0,o=t.hasAttribute("data-mine");this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:s,action:o?"remove":"add",count:e,mine:o}}))}#c(){this.#t?.parentNode!==this&&(this.#t=document.createElement("button"),this.#t.type="button",this.#t.className="reaction-trigger",this.#t.textContent=this.getAttribute("data-trigger-icon")||"\u{1F600}",this.#t.setAttribute("aria-label",this.getAttribute("data-trigger-label")||"Add reaction"),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false"),this.hasAttribute("data-disabled")&&(this.#t.disabled=!0),this.appendChild(this.#t))}#d(){if(!this.#e||this.#s?.parentNode===this)return;let t=`reaction-bar-palette-${++m}`;this.#t.setAttribute("popovertarget",t),this.#s=document.createElement("pop-over"),this.#s.id=t,this.#s.className="reaction-palette",this.#s.dataset.position="top",this.#s.setAttribute("role","dialog"),this.#s.setAttribute("aria-label","Choose a reaction"),this.#o=document.createElement("div"),this.#o.className="reaction-palette-list",this.#o.setAttribute("role","group"),[...this.#e.content.cloneNode(!0).querySelectorAll("button[data-reaction]")].forEach(e=>{e.type="button",e.classList.add("reaction-palette-option");let o=e.textContent;e.setAttribute("aria-label",o),this.listen(e,"click",()=>this.#u(e)),this.#o.appendChild(e)}),this.#s.appendChild(this.#o),this.appendChild(this.#s),this.listen(this.#s,"pop-over:show",()=>{this.#t.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-open",{bubbles:!0})),this.#o.querySelector("button")?.focus()}),this.listen(this.#s,"pop-over:hide",()=>{this.#t.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-close",{bubbles:!0}))}),this.listen(this.#o,"keydown",this.#p)}#u(t){if(this.hasAttribute("data-disabled"))return;let s=t.dataset.reaction,e=this.querySelector(`:scope > button[data-reaction="${CSS.escape(s)}"]`);e?this.#i(e):this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:s,action:"add",count:0,mine:!1}})),this.#s?.hide(),this.#t.focus()}#p=t=>{let s=[...this.#o.querySelectorAll("button")],e=s.indexOf(document.activeElement);if(e===-1)return;let o=e;switch(t.key){case"ArrowRight":case"ArrowDown":t.preventDefault(),o=(e+1)%s.length;break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),o=(e-1+s.length)%s.length;break;case"Home":t.preventDefault(),o=0;break;case"End":t.preventDefault(),o=s.length-1;break;default:return}s[o].focus()};#h(){return[...this.querySelectorAll(":scope > button[data-reaction], :scope > .reaction-trigger")]}#l(){this.#h().forEach((s,e)=>s.setAttribute("tabindex",e===0?"0":"-1"))}#f=t=>{let s=this.#h(),e=document.activeElement?s.indexOf(document.activeElement):-1;if(e===-1)return;let o=e;switch(t.key){case"ArrowRight":t.preventDefault(),o=(e+1)%s.length;break;case"ArrowLeft":t.preventDefault(),o=(e-1+s.length)%s.length;break;case"Home":t.preventDefault(),o=0;break;case"End":t.preventDefault(),o=s.length-1;break;default:return}s.forEach((i,n)=>i.setAttribute("tabindex",n===o?"0":"-1")),s[o].focus()};setCount(t,s,e={}){let o=Number(s)||0,i=this.querySelector(`:scope > button[data-reaction="${CSS.escape(t)}"]`);if(o<=0){i&&(i.remove(),this.#l());return}if(!i){let n=this.#e?.content.querySelector(`button[data-reaction="${CSS.escape(t)}"]`),l=n?n.textContent:t;i=document.createElement("button"),i.dataset.reaction=t,i.textContent=l,this.insertBefore(i,this.#t),this.#r(i)}i.dataset.count=String(o),e.mine===!0?i.setAttribute("data-mine",""):e.mine===!1&&i.removeAttribute("data-mine"),this.#n(i),this.#l()}openPalette(){this.#s?.show()}closePalette(){this.#s?.hide()}};c("reaction-bar",u);export{u as ReactionBar};
1
+ var g=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function c(r,t,s={}){let e=s.priority??10,o={impl:t,bundle:s.bundle,contract:s.contract,priority:e},i=p.get(r);if(customElements.get(r)){if(!i||i.priority>=e){i&&i.priority===e&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=e){i.priority===e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}p.set(r,o),customElements.define(r,t)}var a=class extends HTMLElement{#e=[];#t;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,s,e,o){t.addEventListener(s,e,o),this.#e.push(()=>t.removeEventListener(s,e,o))}_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,s){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{s?e.add(t):e.delete(t)}catch{let o=`--${t}`;s?e.add(o):e.delete(o)}}_adoptInternals(t){this.#t||(this.#t=t)}};var h=CSS.supports("anchor-name","--x"),f=CSS.supports("position-area","bottom"),b=0,d=class extends a{#e=null;#t=null;#s=null;#o=null;setup(){this.id||(this.id=`pop-over-${++b}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#a(),this.#r(),this.#s=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!h&&s.newState==="open"&&this.#e&&this.#i()},this.listen(this,"beforetoggle",this.#s),h||(this.#o=()=>{this.matches(":popover-open")&&this.#e&&this.#i()},this.listen(window,"resize",this.#o),this.listen(window,"scroll",this.#o,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#a(){let t=this.dataset.anchor;t?this.#e=document.getElementById(t)||document.querySelector(t):this.#e=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#r(){if(!(!this.#e||!h)&&(this.#t=`--pop-over-anchor-${this.id}`,this.#e.style.setProperty("anchor-name",this.#t),this.style.setProperty("position-anchor",this.#t),this.setAttribute("data-anchor-name",this.#t||""),!f)){let t=this.dataset.position||"bottom";this.#n(t)}}#n(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},o=t.split("-")[0],i=e[o]||e.bottom;Object.entries(i).forEach(([n,l])=>this.style.setProperty(n,l))}#i(){if(!this.#e)return;let t=this.#e.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#c(),o,i;switch(s.split("-")[0]){case"top":o=t.top-this.offsetHeight-e,i=t.left;break;case"left":o=t.top,i=t.left-this.offsetWidth-e;break;case"right":o=t.top,i=t.right+e;break;default:o=t.bottom+e,i=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?i=t.right-this.offsetWidth:o=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(o)}px`,this.style.left=`${Math.round(i)}px`,this.style.margin="0"}#c(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};c("pop-over",d);var m=0,u=class extends a{#e;#t;#s;#o;setup(){this.setAttribute("role","toolbar"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Reactions"),this.#e=this.querySelector(":scope > template[data-palette]"),this.#a().forEach(t=>this.#r(t)),this.#c(),this.#d(),this.#l(),this.listen(this,"keydown",this.#f)}#a(){return[...this.querySelectorAll(":scope > button[data-reaction]")]}#r(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.type="button",t.setAttribute("role","button");let s=t.textContent;t.replaceChildren();let e=document.createElement("span");e.className="reaction-emoji",e.setAttribute("aria-hidden","true"),e.textContent=s;let o=document.createElement("span");o.className="reaction-count",o.setAttribute("aria-hidden","true"),t.appendChild(e),t.appendChild(o),this.#n(t),this.listen(t,"click",()=>this.#i(t))}#n(t){let s=Number(t.dataset.count)||0,e=t.hasAttribute("data-mine"),o=t.querySelector(".reaction-emoji")?.textContent??"";t.querySelector(".reaction-count").textContent=s>0?String(s):"",t.setAttribute("aria-pressed",e?"true":"false");let i=s===1?"reaction":"reactions",n=e?", you reacted":"";t.setAttribute("aria-label",`${o}, ${s} ${i}${n}`)}#i(t){if(this.hasAttribute("data-disabled"))return;let s=t.dataset.reaction,e=Number(t.dataset.count)||0,o=t.hasAttribute("data-mine");this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:s,action:o?"remove":"add",count:e,mine:o}}))}#c(){this.#t?.parentNode!==this&&(this.#t=document.createElement("button"),this.#t.type="button",this.#t.className="reaction-trigger",this.#t.textContent=this.getAttribute("data-trigger-icon")||"\u{1F600}",this.#t.setAttribute("aria-label",this.getAttribute("data-trigger-label")||"Add reaction"),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false"),this.hasAttribute("data-disabled")&&(this.#t.disabled=!0),this.appendChild(this.#t))}#d(){if(!this.#e||this.#s?.parentNode===this)return;let t=`reaction-bar-palette-${++m}`;this.#t.setAttribute("popovertarget",t),this.#s=document.createElement("pop-over"),this.#s.id=t,this.#s.className="reaction-palette",this.#s.dataset.position="top",this.#s.setAttribute("role","dialog"),this.#s.setAttribute("aria-label","Choose a reaction"),this.#o=document.createElement("div"),this.#o.className="reaction-palette-list",this.#o.setAttribute("role","group"),[...this.#e.content.cloneNode(!0).querySelectorAll("button[data-reaction]")].forEach(e=>{e.type="button",e.classList.add("reaction-palette-option");let o=e.textContent;e.setAttribute("aria-label",o),this.listen(e,"click",()=>this.#u(e)),this.#o.appendChild(e)}),this.#s.appendChild(this.#o),this.appendChild(this.#s),this.listen(this.#s,"pop-over:show",()=>{this.#t.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-open",{bubbles:!0})),this.#o.querySelector("button")?.focus()}),this.listen(this.#s,"pop-over:hide",()=>{this.#t.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-close",{bubbles:!0}))}),this.listen(this.#o,"keydown",this.#p)}#u(t){if(this.hasAttribute("data-disabled"))return;let s=t.dataset.reaction,e=this.querySelector(`:scope > button[data-reaction="${CSS.escape(s)}"]`);e?this.#i(e):this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:s,action:"add",count:0,mine:!1}})),this.#s?.hide(),this.#t.focus()}#p=t=>{let s=[...this.#o.querySelectorAll("button")],e=s.indexOf(document.activeElement);if(e===-1)return;let o=e;switch(t.key){case"ArrowRight":case"ArrowDown":t.preventDefault(),o=(e+1)%s.length;break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),o=(e-1+s.length)%s.length;break;case"Home":t.preventDefault(),o=0;break;case"End":t.preventDefault(),o=s.length-1;break;default:return}s[o].focus()};#h(){return[...this.querySelectorAll(":scope > button[data-reaction], :scope > .reaction-trigger")]}#l(){this.#h().forEach((s,e)=>s.setAttribute("tabindex",e===0?"0":"-1"))}#f=t=>{let s=this.#h(),e=document.activeElement?s.indexOf(document.activeElement):-1;if(e===-1)return;let o=e;switch(t.key){case"ArrowRight":t.preventDefault(),o=(e+1)%s.length;break;case"ArrowLeft":t.preventDefault(),o=(e-1+s.length)%s.length;break;case"Home":t.preventDefault(),o=0;break;case"End":t.preventDefault(),o=s.length-1;break;default:return}s.forEach((i,n)=>i.setAttribute("tabindex",n===o?"0":"-1")),s[o].focus()};setCount(t,s,e={}){let o=Number(s)||0,i=this.querySelector(`:scope > button[data-reaction="${CSS.escape(t)}"]`);if(o<=0){i&&(i.remove(),this.#l());return}if(!i){let n=this.#e?.content.querySelector(`button[data-reaction="${CSS.escape(t)}"]`),l=n?n.textContent:t;i=document.createElement("button"),i.dataset.reaction=t,i.textContent=l,this.insertBefore(i,this.#t),this.#r(i)}i.dataset.count=String(o),e.mine===!0?i.setAttribute("data-mine",""):e.mine===!1&&i.removeAttribute("data-mine"),this.#n(i),this.#l()}openPalette(){this.#s?.show()}closePalette(){this.#s?.hide()}};c("reaction-bar",u);export{u as ReactionBar};
2
2
  //# sourceMappingURL=reaction-bar.js.map
@@ -1,11 +1,11 @@
1
- var c=class extends HTMLElement{#t=[];#e;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,s,i){t.addEventListener(e,s,i),this.#t.push(()=>t.removeEventListener(e,s,i))}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var d=new Set,u=class h extends c{#t="scroll";#e=0;#a=1;#r=2;#n="auto";#l=[0];#o=null;#s=null;#i=null;#E=null;#m=null;#g=!1;#c=null;#w=!1;#b=null;#f=null;static FONT_SIZES=["0.875rem","0.9375rem","1rem","1.0625rem","1.125rem","1.25rem"];static SNAP_DELAY=90;static STORAGE_KEY="vb-reader";setup(){this.#w||(this.#Z(),this.#I(),this.#q(),this.#z(),this.#O(),this.#w=!0),this.#D(),this.#W(),this.#d(this.#t,!1),this.setAttribute("upgraded","")}teardown(){this.#m?.disconnect(),this.#m=null,this.removeAttribute("upgraded"),this.#c!==null&&clearTimeout(this.#c),d.delete(this)}#I(){let t=this.getAttribute("mode");(t==="scroll"||t==="pages")&&(this.#t=t);let e=this.getAttribute("columns");e&&(this.#n=e)}#q(){let t=this.querySelector('[slot="chrome"]'),e=[...this.children].filter(l=>!l.matches('[slot="chrome"]')),s=document.createElement("header");s.className="reader-chrome",t?s.appendChild(t):s.innerHTML=this.#L();let i=document.createElement("div");i.className="reader-scroll";let a=document.createElement("div");a.className="reader-pager",a.setAttribute("role","region"),a.setAttribute("aria-label","Article pages");let n=document.createElement("div");n.className="reader-progress",n.setAttribute("aria-hidden","true");let o=document.createElement("nav");o.className="reader-page-nav",o.setAttribute("aria-label","Page navigation"),o.innerHTML=`
1
+ var c=class extends HTMLElement{#t=[];#e;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,s,i){t.addEventListener(e,s,i),this.#t.push(()=>t.removeEventListener(e,s,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.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var d=new Set,u=class h extends c{#t="scroll";#e=0;#a=1;#r=2;#n="auto";#l=[0];#o=null;#s=null;#i=null;#E=null;#m=null;#g=!1;#c=null;#w=!1;#b=null;#f=null;static FONT_SIZES=["0.875rem","0.9375rem","1rem","1.0625rem","1.125rem","1.25rem"];static SNAP_DELAY=90;static STORAGE_KEY="vb-reader";setup(){this.#w||(this.#Z(),this.#I(),this.#q(),this.#z(),this.#O(),this.#w=!0),this.#D(),this.#W(),this.#d(this.#t,!1),this.setAttribute("upgraded","")}teardown(){this.#m?.disconnect(),this.#m=null,this.removeAttribute("upgraded"),this.#c!==null&&clearTimeout(this.#c),d.delete(this)}#I(){let t=this.getAttribute("mode");(t==="scroll"||t==="pages")&&(this.#t=t);let e=this.getAttribute("columns");e&&(this.#n=e)}#q(){let t=this.querySelector('[slot="chrome"]'),e=[...this.children].filter(l=>!l.matches('[slot="chrome"]')),s=document.createElement("header");s.className="reader-chrome",t?s.appendChild(t):s.innerHTML=this.#L();let i=document.createElement("div");i.className="reader-scroll";let a=document.createElement("div");a.className="reader-pager",a.setAttribute("role","region"),a.setAttribute("aria-label","Article pages");let n=document.createElement("div");n.className="reader-progress",n.setAttribute("aria-hidden","true");let o=document.createElement("nav");o.className="reader-page-nav",o.setAttribute("aria-label","Page navigation"),o.innerHTML=`
2
2
  <button class="reader-nav-btn" data-reader-action="prev-page" type="button" aria-label="Previous page">\u2190</button>
3
3
  <output class="reader-page-indicator" data-reader-output="page-indicator" aria-live="polite">1 / 1</output>
4
4
  <button class="reader-nav-btn" data-reader-action="next-page" type="button" aria-label="Next page">\u2192</button>
5
5
  `,e.forEach(l=>i.appendChild(l)),this.textContent="",this.appendChild(s),this.appendChild(n);let r=document.createElement("main");r.className="reader-book",r.style.position="relative",r.style.minHeight="0",r.style.overflow="hidden",r.appendChild(i),r.appendChild(a),r.appendChild(o),this.appendChild(r),this.#i=i,this.#s=a,this.#E=o}#L(){let t=this.#F(),e=this.getAttribute("font-controls")!=="false",s=this.getAttribute("col-controls")!=="false",i=`
6
6
  <div class="reader-chrome-copy">
7
7
  <span class="reader-chrome-kicker">Reader</span>
8
- <span class="reader-chrome-title">${this.#V(t)}</span>
8
+ <span class="reader-chrome-title">${this.#K(t)}</span>
9
9
  </div>
10
10
  <div class="reader-controls" role="toolbar" aria-label="Reading controls">
11
11
  <div class="reader-control-group" aria-label="Reading mode">
@@ -24,5 +24,5 @@ var c=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("
24
24
  <button class="reader-seg-btn" data-reader-action="set-columns" data-reader-value="1" type="button">1</button>
25
25
  <button class="reader-seg-btn" data-reader-action="set-columns" data-reader-value="2" type="button">2</button>
26
26
  <button class="reader-seg-btn" data-reader-action="set-columns" data-reader-value="3" type="button">3</button>
27
- </div>`),i+="</div>",i}#F(){if(this.getAttribute("reader-title"))return this.getAttribute("reader-title");let t=this.querySelector("h1");return t?t.textContent.trim():document.title||"Reader"}#z(){let t=this.#i;if(!t||(this.#o=t.querySelector(":scope > layout-columns"),this.#o))return;let e=document.createElement("layout-columns");[...t.children].forEach(i=>e.appendChild(i)),t.appendChild(e),this.#o=e}#d(t,e=!0){let s=this.#p();this.#t=t,this.setAttribute("mode",t);let i=t==="pages",a=this.#i,n=this.#s,o=this.#o,r=this.#E;if(!(!a||!n||!o||!r)){if(i){for(let l of d)l!==this&&l.#d("scroll",!1);d.add(this),n.appendChild(o),n.style.display="block",a.style.display="none",r.style.display="flex",this.#v(),this.#k(),requestAnimationFrame(()=>{this.#u(s)})}else d.delete(this),a.appendChild(o),n.style.display="none",a.style.display="",r.style.display="none",o.style.removeProperty("column-count"),o.style.removeProperty("column-width"),requestAnimationFrame(()=>{let l=a.scrollHeight-a.clientHeight;a.scrollTop=l>0?s*l:0,this.#y()});this.#N(),this.#A(),this.#S("reader-view:mode",{mode:t})}}#H(){if(this.#n!=="auto")return Number(this.#n);let t=this.#s?.clientWidth||window.innerWidth;return t>=1680?3:t>=960?2:1}#v(){let t=this.#H();this.#o&&(this.#o.style.setProperty("column-count",String(t)),this.#o.style.setProperty("column-width","auto"),this.setAttribute("columns",this.#n))}#u(t=this.#p()){if(this.#t!=="pages")return;let e=this.#s;if(!e)return;let s=e.clientWidth||1,i=e.scrollWidth,a=Math.max(0,i-s),n=i/s,o=Math.max(1,Math.ceil(n-.01));this.#l=[];for(let r=0;r<o;r++){let l=r===o-1?a:Math.min(r*s,a);(!this.#l.length||l-this.#l[this.#l.length-1]>1)&&this.#l.push(l)}this.#a=Math.max(1,this.#l.length),this.#e=this.#a>1?Math.min(Math.round(t*(this.#a-1)),this.#a-1):0,this.#h(this.#e,!1)}#h(t,e=!0){this.#e=Math.max(0,Math.min(t,this.#a-1));let s=this.#l[this.#e]??0;this.#g=!0;let i=e&&!this.#K();this.#s?.scrollTo({left:s,behavior:i?"smooth":"instant"}),this.#x(),setTimeout(()=>{this.#g=!1},i?220:0)}#C(t){let e=0,s=1/0;return this.#l.forEach((i,a)=>{let n=Math.abs(i-t);n<s&&(s=n,e=a)}),e}#p(){if(this.#t==="scroll"){if(!this.#i)return 0;let e=this.#i.scrollHeight-this.#i.clientHeight;return e>0?this.#i.scrollTop/e:0}if(!this.#s)return 0;let t=this.#s.scrollWidth-this.#s.clientWidth;return t>0?this.#s.scrollLeft/t:0}#x(){let t=this.#a>1?this.#e/(this.#a-1):1;this.#T(t),this.querySelectorAll('[data-reader-output="page-indicator"]').forEach(e=>{e.textContent=`${this.#e+1} / ${this.#a}`}),this.querySelectorAll('[data-reader-action="prev-page"]').forEach(e=>{e.toggleAttribute("disabled",this.#e===0)}),this.querySelectorAll('[data-reader-action="next-page"]').forEach(e=>{e.toggleAttribute("disabled",this.#e===this.#a-1)}),this.#S("reader-view:page",{page:this.#e+1,total:this.#a})}#y(){if(this.#t!=="scroll"||!this.#i)return;let t=this.#i.scrollHeight-this.#i.clientHeight,e=t>0?this.#i.scrollTop/t:1;this.#T(e)}#T(t){this.style.setProperty("--_progress",String(t))}#k(){this.#o&&(this.#o.style.fontSize=h.FONT_SIZES[this.#r])}#P(t){let e=this.#r+t;if(e<0||e>=h.FONT_SIZES.length)return;this.#r=e;let s=this.#p();this.#k(),this.#M(),this.#t==="pages"&&requestAnimationFrame(()=>this.#u(s)),this.#A(),this.#S("reader-view:font",{size:h.FONT_SIZES[this.#r],index:this.#r})}#M(){this.querySelectorAll('[data-reader-action="font-decrease"]').forEach(t=>{t.toggleAttribute("disabled",this.#r===0)}),this.querySelectorAll('[data-reader-action="font-increase"]').forEach(t=>{t.toggleAttribute("disabled",this.#r===h.FONT_SIZES.length-1)})}#O(){this.addEventListener("click",t=>{let s=t.target?.closest("[data-reader-action]");if(!s)return;switch(s.dataset.readerAction){case"toggle-mode":this.#d(this.#t==="scroll"?"pages":"scroll");break;case"set-mode-scroll":this.#d("scroll");break;case"set-mode-pages":this.#d("pages");break;case"font-increase":this.#P(1);break;case"font-decrease":this.#P(-1);break;case"set-columns":{let a=this.#p();this.#n=s.dataset.readerValue??"auto",this.#v(),this.#N(),this.#t==="pages"&&requestAnimationFrame(()=>this.#u(a)),this.#A();break}case"prev-page":this.#h(this.#e-1);break;case"next-page":this.#h(this.#e+1);break}}),this.#i?.addEventListener("scroll",()=>this.#y(),{passive:!0}),this.#s?.addEventListener("scroll",()=>{if(this.#t!=="pages")return;let t=this.#s;if(!t)return;let e=this.#C(t.scrollLeft);e!==this.#e&&(this.#e=e,this.#x()),!this.#g&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#h(this.#C(t.scrollLeft),!1)},h.SNAP_DELAY))},{passive:!0}),this.#b=this.#R.bind(this)}#R(t){if(this.#t==="pages"&&!t.target?.matches?.("input, textarea, select, button, a, [contenteditable]"))switch(t.key){case"ArrowRight":case"PageDown":case" ":t.preventDefault(),this.#h(this.#e+1);break;case"ArrowLeft":case"PageUp":t.preventDefault(),this.#h(this.#e-1);break;case"Home":t.preventDefault(),this.#h(0,!1);break;case"End":t.preventDefault(),this.#h(this.#a-1,!1);break}}#D(){this.#m=new ResizeObserver(()=>{this.#t==="pages"?requestAnimationFrame(()=>{this.#v(),this.#u(this.#p())}):this.#y()}),this.#s&&this.#m.observe(this.#s)}#W(){this.#b&&this.listen(document,"keydown",this.#b),window.visualViewport&&(this.#f=()=>{this.#t==="pages"&&requestAnimationFrame(()=>this.#u())},this.listen(window.visualViewport,"resize",this.#f),this.listen(window.visualViewport,"scroll",this.#f))}#A(){if(this.getAttribute("persist")==="false")return;let t=this.getAttribute("storage-key")||h.STORAGE_KEY;try{localStorage.setItem(t,JSON.stringify({mode:this.#t,sizeIdx:this.#r,columns:this.#n}))}catch{}}#Z(){if(this.getAttribute("persist")==="false")return;let t=this.getAttribute("storage-key")||h.STORAGE_KEY;try{let e=JSON.parse(localStorage.getItem(t)??"null");if(!e)return;(e.mode==="scroll"||e.mode==="pages")&&(this.#t=e.mode),typeof e.sizeIdx=="number"&&e.sizeIdx>=0&&e.sizeIdx<h.FONT_SIZES.length&&(this.#r=e.sizeIdx),e.columns&&(this.#n=e.columns)}catch{}}#N(){this.querySelectorAll('[data-reader-action="set-mode-scroll"]').forEach(t=>{let e=this.#t==="scroll";t.setAttribute("data-reader-state",e?"active":""),t.setAttribute("aria-pressed",String(e))}),this.querySelectorAll('[data-reader-action="set-mode-pages"]').forEach(t=>{let e=this.#t==="pages";t.setAttribute("data-reader-state",e?"active":""),t.setAttribute("aria-pressed",String(e))}),this.querySelectorAll('[data-reader-action="set-columns"]').forEach(t=>{let e=t.dataset.readerValue===this.#n;t.setAttribute("data-reader-state",e?"active":"")}),this.#M(),this.querySelectorAll('[data-reader-output="mode-label"]').forEach(t=>{t.textContent=this.#t==="scroll"?"Scroll":"Pages"})}#S(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}#K(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}#V(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}};customElements.define("reader-view",u);
27
+ </div>`),i+="</div>",i}#F(){if(this.getAttribute("reader-title"))return this.getAttribute("reader-title");let t=this.querySelector("h1");return t?t.textContent.trim():document.title||"Reader"}#z(){let t=this.#i;if(!t||(this.#o=t.querySelector(":scope > layout-columns"),this.#o))return;let e=document.createElement("layout-columns");[...t.children].forEach(i=>e.appendChild(i)),t.appendChild(e),this.#o=e}#d(t,e=!0){let s=this.#p();this.#t=t,this.setAttribute("mode",t);let i=t==="pages",a=this.#i,n=this.#s,o=this.#o,r=this.#E;if(!(!a||!n||!o||!r)){if(i){for(let l of d)l!==this&&l.#d("scroll",!1);d.add(this),n.appendChild(o),n.style.display="block",a.style.display="none",r.style.display="flex",this.#v(),this.#k(),requestAnimationFrame(()=>{this.#u(s)})}else d.delete(this),a.appendChild(o),n.style.display="none",a.style.display="",r.style.display="none",o.style.removeProperty("column-count"),o.style.removeProperty("column-width"),requestAnimationFrame(()=>{let l=a.scrollHeight-a.clientHeight;a.scrollTop=l>0?s*l:0,this.#y()});this.#N(),this.#A(),this.#S("reader-view:mode",{mode:t})}}#H(){if(this.#n!=="auto")return Number(this.#n);let t=this.#s?.clientWidth||window.innerWidth;return t>=1680?3:t>=960?2:1}#v(){let t=this.#H();this.#o&&(this.#o.style.setProperty("column-count",String(t)),this.#o.style.setProperty("column-width","auto"),this.setAttribute("columns",this.#n))}#u(t=this.#p()){if(this.#t!=="pages")return;let e=this.#s;if(!e)return;let s=e.clientWidth||1,i=e.scrollWidth,a=Math.max(0,i-s),n=i/s,o=Math.max(1,Math.ceil(n-.01));this.#l=[];for(let r=0;r<o;r++){let l=r===o-1?a:Math.min(r*s,a);(!this.#l.length||l-this.#l[this.#l.length-1]>1)&&this.#l.push(l)}this.#a=Math.max(1,this.#l.length),this.#e=this.#a>1?Math.min(Math.round(t*(this.#a-1)),this.#a-1):0,this.#h(this.#e,!1)}#h(t,e=!0){this.#e=Math.max(0,Math.min(t,this.#a-1));let s=this.#l[this.#e]??0;this.#g=!0;let i=e&&!this.#_();this.#s?.scrollTo({left:s,behavior:i?"smooth":"instant"}),this.#x(),setTimeout(()=>{this.#g=!1},i?220:0)}#C(t){let e=0,s=1/0;return this.#l.forEach((i,a)=>{let n=Math.abs(i-t);n<s&&(s=n,e=a)}),e}#p(){if(this.#t==="scroll"){if(!this.#i)return 0;let e=this.#i.scrollHeight-this.#i.clientHeight;return e>0?this.#i.scrollTop/e:0}if(!this.#s)return 0;let t=this.#s.scrollWidth-this.#s.clientWidth;return t>0?this.#s.scrollLeft/t:0}#x(){let t=this.#a>1?this.#e/(this.#a-1):1;this.#T(t),this.querySelectorAll('[data-reader-output="page-indicator"]').forEach(e=>{e.textContent=`${this.#e+1} / ${this.#a}`}),this.querySelectorAll('[data-reader-action="prev-page"]').forEach(e=>{e.toggleAttribute("disabled",this.#e===0)}),this.querySelectorAll('[data-reader-action="next-page"]').forEach(e=>{e.toggleAttribute("disabled",this.#e===this.#a-1)}),this.#S("reader-view:page",{page:this.#e+1,total:this.#a})}#y(){if(this.#t!=="scroll"||!this.#i)return;let t=this.#i.scrollHeight-this.#i.clientHeight,e=t>0?this.#i.scrollTop/t:1;this.#T(e)}#T(t){this.style.setProperty("--_progress",String(t))}#k(){this.#o&&(this.#o.style.fontSize=h.FONT_SIZES[this.#r])}#P(t){let e=this.#r+t;if(e<0||e>=h.FONT_SIZES.length)return;this.#r=e;let s=this.#p();this.#k(),this.#M(),this.#t==="pages"&&requestAnimationFrame(()=>this.#u(s)),this.#A(),this.#S("reader-view:font",{size:h.FONT_SIZES[this.#r],index:this.#r})}#M(){this.querySelectorAll('[data-reader-action="font-decrease"]').forEach(t=>{t.toggleAttribute("disabled",this.#r===0)}),this.querySelectorAll('[data-reader-action="font-increase"]').forEach(t=>{t.toggleAttribute("disabled",this.#r===h.FONT_SIZES.length-1)})}#O(){this.addEventListener("click",t=>{let s=t.target?.closest("[data-reader-action]");if(!s)return;switch(s.dataset.readerAction){case"toggle-mode":this.#d(this.#t==="scroll"?"pages":"scroll");break;case"set-mode-scroll":this.#d("scroll");break;case"set-mode-pages":this.#d("pages");break;case"font-increase":this.#P(1);break;case"font-decrease":this.#P(-1);break;case"set-columns":{let a=this.#p();this.#n=s.dataset.readerValue??"auto",this.#v(),this.#N(),this.#t==="pages"&&requestAnimationFrame(()=>this.#u(a)),this.#A();break}case"prev-page":this.#h(this.#e-1);break;case"next-page":this.#h(this.#e+1);break}}),this.#i?.addEventListener("scroll",()=>this.#y(),{passive:!0}),this.#s?.addEventListener("scroll",()=>{if(this.#t!=="pages")return;let t=this.#s;if(!t)return;let e=this.#C(t.scrollLeft);e!==this.#e&&(this.#e=e,this.#x()),!this.#g&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#h(this.#C(t.scrollLeft),!1)},h.SNAP_DELAY))},{passive:!0}),this.#b=this.#R.bind(this)}#R(t){if(this.#t==="pages"&&!t.target?.matches?.("input, textarea, select, button, a, [contenteditable]"))switch(t.key){case"ArrowRight":case"PageDown":case" ":t.preventDefault(),this.#h(this.#e+1);break;case"ArrowLeft":case"PageUp":t.preventDefault(),this.#h(this.#e-1);break;case"Home":t.preventDefault(),this.#h(0,!1);break;case"End":t.preventDefault(),this.#h(this.#a-1,!1);break}}#D(){this.#m=new ResizeObserver(()=>{this.#t==="pages"?requestAnimationFrame(()=>{this.#v(),this.#u(this.#p())}):this.#y()}),this.#s&&this.#m.observe(this.#s)}#W(){this.#b&&this.listen(document,"keydown",this.#b),window.visualViewport&&(this.#f=()=>{this.#t==="pages"&&requestAnimationFrame(()=>this.#u())},this.listen(window.visualViewport,"resize",this.#f),this.listen(window.visualViewport,"scroll",this.#f))}#A(){if(this.getAttribute("persist")==="false")return;let t=this.getAttribute("storage-key")||h.STORAGE_KEY;try{localStorage.setItem(t,JSON.stringify({mode:this.#t,sizeIdx:this.#r,columns:this.#n}))}catch{}}#Z(){if(this.getAttribute("persist")==="false")return;let t=this.getAttribute("storage-key")||h.STORAGE_KEY;try{let e=JSON.parse(localStorage.getItem(t)??"null");if(!e)return;(e.mode==="scroll"||e.mode==="pages")&&(this.#t=e.mode),typeof e.sizeIdx=="number"&&e.sizeIdx>=0&&e.sizeIdx<h.FONT_SIZES.length&&(this.#r=e.sizeIdx),e.columns&&(this.#n=e.columns)}catch{}}#N(){this.querySelectorAll('[data-reader-action="set-mode-scroll"]').forEach(t=>{let e=this.#t==="scroll";t.setAttribute("data-reader-state",e?"active":""),t.setAttribute("aria-pressed",String(e))}),this.querySelectorAll('[data-reader-action="set-mode-pages"]').forEach(t=>{let e=this.#t==="pages";t.setAttribute("data-reader-state",e?"active":""),t.setAttribute("aria-pressed",String(e))}),this.querySelectorAll('[data-reader-action="set-columns"]').forEach(t=>{let e=t.dataset.readerValue===this.#n;t.setAttribute("data-reader-state",e?"active":"")}),this.#M(),this.querySelectorAll('[data-reader-output="mode-label"]').forEach(t=>{t.textContent=this.#t==="scroll"?"Scroll":"Pages"})}#S(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}#_(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}#K(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}};customElements.define("reader-view",u);
28
28
  //# sourceMappingURL=reader-view.js.map
@@ -1,2 +1,2 @@
1
- var l=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(i,e,t={}){let r=t.priority??10,s={impl:e,bundle:t.bundle,contract:t.contract,priority:r},n=c.get(i);if(customElements.get(i)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}c.set(i,s),customElements.define(i,e)}var o=class extends HTMLElement{#t=[];#e;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 e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,r,s){e.addEventListener(t,r,s),this.#t.push(()=>e.removeEventListener(t,r,s))}setup(){}teardown(){}setState(e,t){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{t?r.add(e):r.delete(e)}catch{let s=`--${e}`;t?r.add(s):r.delete(s)}}_adoptInternals(e){this.#e||(this.#e=e)}};var a=class extends o{setup(){this.bar=this.querySelector("progress"),this.bar||(this.bar=document.createElement("progress"),this.bar.max=100,this.bar.value=0,this.bar.setAttribute("aria-label","Reading progress"),this.appendChild(this.bar));let e=this.dataset.for;if(this.target=e?document.getElementById(e):null,!this.target&&CSS.supports("animation-timeline","scroll(root block)"))return;this.#e();let r=()=>{this.#t||(this.#t=requestAnimationFrame(()=>{this.#t=0,this.#e()}))};this.listen(window,"scroll",r,{passive:!0}),this.listen(window,"resize",r,{passive:!0})}#t=0;#e(){let e=this.target?this.#n():this.#r(),t=Math.min(1,Math.max(0,e));this.style.setProperty("--vb-reading-progress",t.toFixed(4)),this.bar&&(this.bar.value=Math.round(t*100))}#r(){let e=document.documentElement.scrollHeight-window.innerHeight;return e>0?window.scrollY/e:0}#n(){if(!this.target)return 0;let e=this.target.getBoundingClientRect(),t=e.height-window.innerHeight;return t<=0?e.bottom<=window.innerHeight?1:0:-e.top/t}};d("reading-progress",a);export{a as ReadingProgress};
1
+ var l=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(n,e,t={}){let r=t.priority??10,s={impl:e,bundle:t.bundle,contract:t.contract,priority:r},i=c.get(n);if(customElements.get(n)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}c.set(n,s),customElements.define(n,e)}var o=class extends HTMLElement{#e=[];#t;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 e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,r,s){e.addEventListener(t,r,s),this.#e.push(()=>e.removeEventListener(t,r,s))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{t?r.add(e):r.delete(e)}catch{let s=`--${e}`;t?r.add(s):r.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}};var a=class extends o{setup(){this.bar=this.querySelector("progress"),this.bar||(this.bar=document.createElement("progress"),this.bar.max=100,this.bar.value=0,this.bar.setAttribute("aria-label","Reading progress"),this.appendChild(this.bar));let e=this.dataset.for;if(this.target=e?document.getElementById(e):null,!this.target&&CSS.supports("animation-timeline","scroll(root block)"))return;this.#t();let r=()=>{this.#e||(this.#e=requestAnimationFrame(()=>{this.#e=0,this.#t()}))};this.listen(window,"scroll",r,{passive:!0}),this.listen(window,"resize",r,{passive:!0})}#e=0;#t(){let e=this.target?this.#i():this.#r(),t=Math.min(1,Math.max(0,e));this.style.setProperty("--vb-reading-progress",t.toFixed(4)),this.bar&&(this.bar.value=Math.round(t*100))}#r(){let e=document.documentElement.scrollHeight-window.innerHeight;return e>0?window.scrollY/e:0}#i(){if(!this.target)return 0;let e=this.target.getBoundingClientRect(),t=e.height-window.innerHeight;return t<=0?e.bottom<=window.innerHeight?1:0:-e.top/t}};d("reading-progress",a);export{a as ReadingProgress};
2
2
  //# sourceMappingURL=reading-progress.js.map