vanilla-breeze 0.5.0 → 0.6.1

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 (263) hide show
  1. package/custom-elements.json +23071 -13897
  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 +5 -5
  5. package/dist/cdn/components/ai-summary.js +2 -2
  6. package/dist/cdn/components/analytics-panel.js +2 -2
  7. package/dist/cdn/components/audio-player.js +4 -4
  8. package/dist/cdn/components/audio-visualizer.js +2 -2
  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 -1
  16. package/dist/cdn/components/chart-wc.js +56 -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 +51 -50
  23. package/dist/cdn/components/comment-thread.js +50 -49
  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 +170 -54
  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 +6 -2
  45. package/dist/cdn/components/icon-wc.js +11 -10
  46. package/dist/cdn/components/image-gallery.js +1 -1
  47. package/dist/cdn/components/image-map.js +1 -1
  48. package/dist/cdn/components/include-file.js +1 -1
  49. package/dist/cdn/components/manifest.json +101 -101
  50. package/dist/cdn/components/markdown-editor.js +60 -1
  51. package/dist/cdn/components/markdown-viewer.js +50 -49
  52. package/dist/cdn/components/nav-bar.js +1 -1
  53. package/dist/cdn/components/note-wc.js +6 -2
  54. package/dist/cdn/components/notification-wc.js +33 -32
  55. package/dist/cdn/components/page-info.js +6 -72
  56. package/dist/cdn/components/page-stats.js +1 -1
  57. package/dist/cdn/components/page-toc.js +1 -1
  58. package/dist/cdn/components/page-tools.js +1 -1
  59. package/dist/cdn/components/page-tour.js +1 -38
  60. package/dist/cdn/components/pager-wc.js +1 -1
  61. package/dist/cdn/components/poll-wc.js +1 -1
  62. package/dist/cdn/components/pop-over.js +1 -1
  63. package/dist/cdn/components/popularity-index.js +1 -8
  64. package/dist/cdn/components/print-page.js +1 -1
  65. package/dist/cdn/components/progress-tracker.js +1 -1
  66. package/dist/cdn/components/qr-code.js +1 -1
  67. package/dist/cdn/components/reaction-bar.js +1 -1
  68. package/dist/cdn/components/reader-view.js +25 -25
  69. package/dist/cdn/components/reading-progress.js +1 -1
  70. package/dist/cdn/components/recently-visited.js +1 -26
  71. package/dist/cdn/components/score-card.js +21 -5
  72. package/dist/cdn/components/selection-menu.js +1 -1
  73. package/dist/cdn/components/settings-panel.js +88 -142
  74. package/dist/cdn/components/share-wc.js +2 -2
  75. package/dist/cdn/components/short-cuts.js +1 -1
  76. package/dist/cdn/components/site-index.js +1 -10
  77. package/dist/cdn/components/site-map.js +1 -1
  78. package/dist/cdn/components/site-search.js +1 -51
  79. package/dist/cdn/components/slide-accept.js +1 -1
  80. package/dist/cdn/components/social-embed.js +1 -1
  81. package/dist/cdn/components/split-surface.js +1 -1
  82. package/dist/cdn/components/star-rating.js +1 -1
  83. package/dist/cdn/components/status-wc.js +1 -1
  84. package/dist/cdn/components/stepper-wc.js +1 -1
  85. package/dist/cdn/components/tab-set.js +1 -1
  86. package/dist/cdn/components/text-reader.js +2 -2
  87. package/dist/cdn/components/theme-picker.js +86 -83
  88. package/dist/cdn/components/time-index.js +1 -11
  89. package/dist/cdn/components/time-picker.js +1 -1
  90. package/dist/cdn/components/toast-msg.js +6 -6
  91. package/dist/cdn/components/tool-tip.js +1 -1
  92. package/dist/cdn/components/topic-map.js +6 -3
  93. package/dist/cdn/components/trust-filter.js +1 -3
  94. package/dist/cdn/components/version-switcher.js +5 -5
  95. package/dist/cdn/components/video-player.js +67 -9
  96. package/dist/cdn/components/watch-wc.js +6 -2
  97. package/dist/cdn/components/week-view.js +1 -1
  98. package/dist/cdn/components/youtube-player.js +1 -1
  99. package/dist/cdn/emoji-extended.js +2 -0
  100. package/dist/cdn/fonts/atkinson-hyperlegible-OFL.txt +93 -0
  101. package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
  103. package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
  105. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2 +0 -0
  107. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2 +0 -0
  109. package/dist/cdn/fonts/latinmodern-math-GUST-LICENSE.txt +30 -0
  110. package/dist/cdn/fonts/latinmodern-math.woff2 +0 -0
  111. package/dist/cdn/fonts/math-fonts.css +14 -0
  112. package/dist/cdn/packs/effects.full.css +1 -1
  113. package/dist/cdn/packs/effects.full.js +1 -1
  114. package/dist/cdn/packs/fonts-display.full.css +1 -1
  115. package/dist/cdn/packs/fonts-display.theme.css +1 -1
  116. package/dist/cdn/packs/icons.bundle.js +1 -1
  117. package/dist/cdn/packs/icons.full.css +1 -1
  118. package/dist/cdn/packs/icons.theme.css +1 -1
  119. package/dist/cdn/packs/journal.effects.css +1 -1
  120. package/dist/cdn/packs/journal.full.css +1 -1
  121. package/dist/cdn/packs/kawaii.effects.css +1 -1
  122. package/dist/cdn/packs/kawaii.full.css +2 -2
  123. package/dist/cdn/packs/kawaii.full.js +4 -4
  124. package/dist/cdn/packs/kawaii.theme.css +1 -1
  125. package/dist/cdn/packs/manifest.json +17 -17
  126. package/dist/cdn/packs/memphis.full.css +1 -1
  127. package/dist/cdn/packs/memphis.theme.css +1 -1
  128. package/dist/cdn/packs/ui.full.css +1 -1
  129. package/dist/cdn/packs/ui.full.js +89 -86
  130. package/dist/cdn/themes/8bit.css +1 -1
  131. package/dist/cdn/themes/8bit.tokens.json +1 -1
  132. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  133. package/dist/cdn/themes/alpha1999.css +1 -1
  134. package/dist/cdn/themes/alpha1999.tokens.json +1 -1
  135. package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
  136. package/dist/cdn/themes/art-deco.css +1 -1
  137. package/dist/cdn/themes/art-deco.tokens.json +1 -1
  138. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  139. package/dist/cdn/themes/bauhaus.css +1 -1
  140. package/dist/cdn/themes/bauhaus.tokens.json +1 -1
  141. package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
  142. package/dist/cdn/themes/brutalist.css +1 -1
  143. package/dist/cdn/themes/brutalist.tokens.json +1 -1
  144. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  145. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  146. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  147. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  148. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  149. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  150. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  151. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  152. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  153. package/dist/cdn/themes/classic-dark.tokens.json +1 -1
  154. package/dist/cdn/themes/classic.css +1 -1
  155. package/dist/cdn/themes/classic.tokens.json +1 -1
  156. package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
  157. package/dist/cdn/themes/claymorphism.css +1 -1
  158. package/dist/cdn/themes/claymorphism.tokens.json +2 -1
  159. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  160. package/dist/cdn/themes/clinical.css +1 -1
  161. package/dist/cdn/themes/clinical.tokens.json +1 -1
  162. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  163. package/dist/cdn/themes/cottagecore.css +1 -1
  164. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  165. package/dist/cdn/themes/cyber.css +1 -1
  166. package/dist/cdn/themes/cyber.tokens.json +1 -1
  167. package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
  168. package/dist/cdn/themes/dawn.css +1 -1
  169. package/dist/cdn/themes/dawn.tokens.json +1 -1
  170. package/dist/cdn/themes/dracula.css +1 -1
  171. package/dist/cdn/themes/dracula.tokens.json +1 -1
  172. package/dist/cdn/themes/dusk.css +1 -1
  173. package/dist/cdn/themes/dusk.tokens.json +1 -1
  174. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  175. package/dist/cdn/themes/editorial.css +1 -1
  176. package/dist/cdn/themes/editorial.tokens.json +1 -1
  177. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  178. package/dist/cdn/themes/financial.css +1 -1
  179. package/dist/cdn/themes/financial.tokens.json +1 -1
  180. package/dist/cdn/themes/genai.css +1 -1
  181. package/dist/cdn/themes/genai.tokens.json +1 -1
  182. package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
  183. package/dist/cdn/themes/glassmorphism.css +1 -1
  184. package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
  185. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  186. package/dist/cdn/themes/government.css +1 -1
  187. package/dist/cdn/themes/government.tokens.json +1 -1
  188. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  189. package/dist/cdn/themes/gruvbox.css +1 -1
  190. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  191. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  192. package/dist/cdn/themes/high-noon.css +1 -1
  193. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  194. package/dist/cdn/themes/journal-dark.tokens.json +4 -2
  195. package/dist/cdn/themes/journal.css +1 -1
  196. package/dist/cdn/themes/journal.tokens.json +4 -2
  197. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  198. package/dist/cdn/themes/kawaii.css +1 -1
  199. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  200. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  201. package/dist/cdn/themes/magna.css +1 -1
  202. package/dist/cdn/themes/magna.tokens.json +1 -1
  203. package/dist/cdn/themes/manifest.json +44 -44
  204. package/dist/cdn/themes/midnight.css +1 -1
  205. package/dist/cdn/themes/midnight.tokens.json +1 -1
  206. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  207. package/dist/cdn/themes/minimal.css +1 -1
  208. package/dist/cdn/themes/minimal.tokens.json +1 -1
  209. package/dist/cdn/themes/modern-dark.tokens.json +1 -1
  210. package/dist/cdn/themes/modern.css +1 -1
  211. package/dist/cdn/themes/modern.tokens.json +1 -1
  212. package/dist/cdn/themes/nes-dark.tokens.json +7 -2
  213. package/dist/cdn/themes/nes.css +1 -1
  214. package/dist/cdn/themes/nes.tokens.json +1 -1
  215. package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
  216. package/dist/cdn/themes/neumorphism.css +1 -1
  217. package/dist/cdn/themes/neumorphism.tokens.json +1 -1
  218. package/dist/cdn/themes/nord-dark.tokens.json +1 -1
  219. package/dist/cdn/themes/nord.css +1 -1
  220. package/dist/cdn/themes/nord.tokens.json +1 -1
  221. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  222. package/dist/cdn/themes/organic.css +1 -1
  223. package/dist/cdn/themes/organic.tokens.json +1 -1
  224. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  225. package/dist/cdn/themes/rose-pine.css +1 -1
  226. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  227. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  228. package/dist/cdn/themes/rough.css +1 -1
  229. package/dist/cdn/themes/rough.tokens.json +1 -1
  230. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  231. package/dist/cdn/themes/solarized.css +1 -1
  232. package/dist/cdn/themes/solarized.tokens.json +1 -1
  233. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  234. package/dist/cdn/themes/startup.css +1 -1
  235. package/dist/cdn/themes/startup.tokens.json +1 -1
  236. package/dist/cdn/themes/super2026-dark.tokens.json +1 -1
  237. package/dist/cdn/themes/super2026.css +1 -1
  238. package/dist/cdn/themes/super2026.tokens.json +1 -1
  239. package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
  240. package/dist/cdn/themes/swiss.css +1 -1
  241. package/dist/cdn/themes/swiss.tokens.json +1 -1
  242. package/dist/cdn/themes/terminal.css +1 -1
  243. package/dist/cdn/themes/terminal.tokens.json +1 -1
  244. package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
  245. package/dist/cdn/themes/tokyo-night.css +1 -1
  246. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  247. package/dist/cdn/themes/vaporwave-dark.tokens.json +1 -1
  248. package/dist/cdn/themes/vaporwave.css +1 -1
  249. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  250. package/dist/cdn/themes/win9x-dark.tokens.json +6 -2
  251. package/dist/cdn/themes/win9x.css +1 -1
  252. package/dist/cdn/themes/win9x.tokens.json +3 -1
  253. package/dist/cdn/vanilla-breeze-autoload.js +187 -297
  254. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  255. package/dist/cdn/vanilla-breeze-charts.js +56 -32
  256. package/dist/cdn/vanilla-breeze-core.css +1 -1
  257. package/dist/cdn/vanilla-breeze-core.js +166 -262
  258. package/dist/cdn/vanilla-breeze-dev.js +1 -1
  259. package/dist/cdn/vanilla-breeze-extras.js +272 -130
  260. package/dist/cdn/vanilla-breeze.css +1 -1
  261. package/dist/cdn/vanilla-breeze.js +536 -621
  262. package/dist/cdn/view-transitions.css +2 -0
  263. package/package.json +15 -7
@@ -1,39 +1,2 @@
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
- <div class="page-tour-progress" aria-hidden="true">
3
- ${this.#e.map((c,a)=>`
4
- <span class="page-tour-pip" ${a===e?"data-active":""} ${a<e?"data-visited":""}></span>
5
- `).join("")}
6
- </div>
7
- <p class="page-tour-meta">
8
- <span class="page-tour-step-count">Step ${e+1} of ${s}</span>
9
- </p>
10
- <div class="page-tour-content">
11
- ${t.innerHTML}
12
- </div>
13
- ${o&&t.actionHint?`
14
- <p class="page-tour-action-hint">${t.actionHint}</p>
15
- `:""}
16
- <footer class="page-tour-footer">
17
- ${r?`
18
- <button type="button" class="page-tour-skip" data-action="skip">
19
- ${i?"Close":"Skip tour"}
20
- </button>
21
- `:""}
22
- <nav class="page-tour-nav" aria-label="Tour navigation">
23
- ${n?"":`
24
- <button type="button" class="page-tour-prev" data-action="prev">
25
- Previous
26
- </button>
27
- `}
28
- <button
29
- type="button"
30
- class="page-tour-next"
31
- data-action="next"
32
- ${o?"data-waiting":""}
33
- >
34
- ${i?"Finish":"Next"}
35
- </button>
36
- </nav>
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 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};
1
+ var q=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function A(a,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=E.get(a);if(customElements.get(a)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(a,s),customElements.define(a,t)}var m=class extends HTMLElement{#e=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#i||(this.#i=t)}#s(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var b=CSS.supports("anchor-name","--x")&&CSS.supports("position-area","bottom"),C=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,M="--tour-target",w='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',N='input, textarea, select, [contenteditable]:not([contenteditable="false"])',T={title:"Page Tour",step:"Step {n} of {total}",skip:"Skip tour",close:"Close",prev:"Previous",next:"Next",finish:"Finish",nav:"Tour navigation",ready:"Done. Next is available."},L=0,k=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"}};function $(a){if(!a?.target)return null;try{return document.querySelector(a.target)}catch{return null}}function h(a,t,e){let i=document.createElement(a);return t&&(i.className=t),e!=null&&(i.textContent=e),i}var S=class a extends m{#e=[];#i=0;#s=!1;#c=null;#r=null;#t=null;#n=null;#A=null;#u=null;#g="";#b=null;#m=null;#w=null;#d=null;#l=null;#v=null;#p=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="${CSS.escape(this.id)}"]`)&&(e.preventDefault(),this.start())}),this.dataset.trigger==="auto"){let e=this.#W();e?.complete||e?.skipped?this.setAttribute("data-complete",""):this.#p=setTimeout(()=>{this.#p=null,this.isConnected&&this.start(e?.step??0)},400)}return!0}teardown(){this.#p&&(clearTimeout(this.#p),this.#p=null),this.#s&&this.stop()}attributeChangedCallback(t,e,i){if(t==="data-step"&&this.#s&&e!==null){let s=parseInt(i,10);!Number.isNaN(s)&&s!==this.#i&&this.goto(s)}}start(t=0){let e=Math.min(Math.max(0,Number(t)||0),this.#e.length-1);if(this.#s){this.goto(e);return}let i=this.#a(e,1,!0);if(i===-1&&(i=this.#a(e-1,-1,!0)),i===-1){console.warn("[page-tour] No step target found on the page; tour not started");return}a.#h&&a.#h!==this&&a.#h.stop(),this.#A=document.activeElement,this.#s=!0,a.#h=this,this.#F(),this.setAttribute("data-active",""),this.removeAttribute("data-complete"),this.#f("tour:start",{step:i}),this.#y(i,"next")}stop(){this.#s&&(this.#U(),this.#s=!1,this.removeAttribute("data-active"),a.#h===this&&(a.#h=null))}next(){if(!this.#s||this.#q())return;let t=this.#a(this.#i+1,1,!0);t===-1?this.#J():this.#y(t,"next")}prev(){if(!this.#s)return;let t=this.#a(this.#i-1,-1,!0);t!==-1&&this.#y(t,"prev")}goto(t){if(!this.#s)return;let e=Number(t);if(!Number.isInteger(e)||e<0||e>=this.#e.length)return;let i=e>=this.#i?"next":"prev",s=i==="next"?1:-1,r=this.#a(e,s,!0);r===-1&&(r=this.#a(e-s,s===1?-1:1,!0)),!(r===-1||r===this.#i)&&this.#y(r,i)}skip(){this.#s&&this.#k(this.#e[this.#i])&&(this.#f("tour:skip",{step:this.#i}),this.#E({skipped:!0}),this.stop(),this.setAttribute("data-complete",""))}reset(){this.#G(),this.removeAttribute("data-complete"),this.dataset.step="0"}#o(t){return(t==="title"?this.dataset.title:this.getAttribute(`data-label-${t}`))??T[t]}#k(t){return(this.dataset.mode??"passive")!=="forced"&&(t?.skippable??!0)}#q(){return!!this.#t?.querySelector(".page-tour-next[data-waiting]")}#a(t,e,i=!1){for(let s=t;s>=0&&s<this.#e.length;s+=e){if($(this.#e[s]))return s;i&&console.warn(`[page-tour] Target "${this.#e[s].target}" not found, skipping step ${s}`)}return-1}#F(){this.#c=h("div","page-tour-backdrop"),this.#c.setAttribute("aria-hidden","true"),this.#c.addEventListener("click",()=>this.skip()),this.#r=h("div","page-tour-spotlight"),this.#r.setAttribute("aria-hidden","true"),this.#t=h("div","page-tour-card"),this.#t.setAttribute("popover","manual"),this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-label",this.#o("title")),this.#t.setAttribute("tabindex","-1"),this.#t.toggleAttribute("data-anchored",b),this.#t.addEventListener("click",e=>this.#K(e));let t=parseFloat(this.dataset.spotlightPadding??"");if(Number.isFinite(t)&&t>=0)for(let e of[this.#r,this.#t])e.style.setProperty("--tour-spotlight-padding",`${t}px`);this.#n=h("div","visually-hidden"),this.#n.setAttribute("aria-live","polite"),this.#n.setAttribute("aria-atomic","true"),this.#n.id=`page-tour-announcer-${++L}`,this.append(this.#c,this.#r,this.#t,this.#n),this.#t.showPopover(),this.#m=new AbortController,document.addEventListener("keydown",e=>this.#V(e),{signal:this.#m.signal}),requestAnimationFrame(()=>{this.#c?.setAttribute("data-state-visible","")})}#B(t){this.#u=t;let e=getComputedStyle(t).position==="static";t.setAttribute("data-tour-target",e?"raised":""),b&&(this.#g=t.style.getPropertyValue("anchor-name"),t.style.setProperty("anchor-name",M))}#C(){let t=this.#u;t&&(t.removeAttribute("data-tour-target"),b&&(this.#g?t.style.setProperty("anchor-name",this.#g):t.style.removeProperty("anchor-name"),t.getAttribute("style")||t.removeAttribute("style")),this.#g="",this.#u=null)}#$(t){if(!this.#r)return;let e=t.getBoundingClientRect();Object.assign(this.#r.style,{top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`})}#O(t,e){let i=getComputedStyle(this).direction==="rtl";switch(e){case"top":case"bottom":return e;case"inline-start":return i?"right":"left";case"inline-end":return i?"left":"right";default:return this.#D(t)}}#M(t,e){if(!this.#t)return;let i=this.#O(t,e);this.#t.dataset.side=i,b||this.#P(t,i)}#P(t,e){let i=this.#t;if(!i)return;let s=t.getBoundingClientRect(),r=12,c=8,n=this.#r&&parseFloat(getComputedStyle(this.#r).paddingTop)||0;i.style.visibility="hidden",i.style.top="0",i.style.left="0";let o=i.getBoundingClientRect();i.style.visibility="";let d=0,l=0;switch(e){case"bottom":d=s.bottom+n+r,l=s.left+(s.width-o.width)/2;break;case"top":d=s.top-n-r-o.height,l=s.left+(s.width-o.width)/2;break;case"right":d=s.top+(s.height-o.height)/2,l=s.right+n+r;break;case"left":d=s.top+(s.height-o.height)/2,l=s.left-n-r-o.width;break}l=Math.max(c,Math.min(l,window.innerWidth-o.width-c)),d=Math.max(c,Math.min(d,window.innerHeight-o.height-c)),i.style.top=`${d}px`,i.style.left=`${l}px`}#D(t){let e=t.getBoundingClientRect(),i=window.innerHeight-e.bottom,s=e.top,r=window.innerWidth-e.right,c=e.left,n=Math.max(i,s,r,c);return n===i?"bottom":n===s?"top":n===r?"right":"left"}#I(t,e){let i=this.#t;if(!i)return;let s=this.#e.length,r=this.#a(e+1,1)!==-1,c=this.#a(e-1,-1)!==-1,n=t.action!=="none",o=h("div","page-tour-progress");o.setAttribute("aria-hidden","true"),this.#e.forEach((u,x)=>{let y=h("span","page-tour-pip");x===e&&y.setAttribute("data-active",""),x<e&&y.setAttribute("data-visited",""),o.append(y)});let d=h("p","page-tour-meta");d.append(h("span","page-tour-step-count",this.#o("step").replace("{n}",String(e+1)).replace("{total}",String(s))));let l=h("div","page-tour-content");for(let u of t.childNodes)l.append(u.cloneNode(!0));let f=h("footer","page-tour-footer");if(this.#k(t)){let u=h("button","page-tour-skip",this.#o(r?"skip":"close"));u.type="button",u.dataset.action="skip",f.append(u)}let g=h("nav","page-tour-nav");if(g.setAttribute("aria-label",this.#o("nav")),c){let u=h("button","page-tour-prev",this.#o("prev"));u.type="button",u.dataset.action="prev",g.append(u)}let p=h("button","page-tour-next",this.#o(r?"next":"finish"));p.type="button",p.dataset.action="next",g.append(p),f.append(g);let v=[o,d,l];if(n&&(p.setAttribute("data-waiting",""),p.setAttribute("aria-disabled","true"),t.actionHint)){let u=h("p","page-tour-action-hint",t.actionHint);u.id=`${this.#n?.id??"page-tour"}-hint`,p.setAttribute("aria-describedby",u.id),v.push(u)}v.push(f),i.replaceChildren(...v),n?i.removeAttribute("aria-modal"):i.setAttribute("aria-modal","true")}#y(t,e="next"){let i=this.#e[t],s=$(i);if(!i||!s)return;if(this.#d?.abort(),this.#d=null,this.#T(),this.#C(),this.#i=t,this.#B(s),i.scrollBehavior!=="none"){let o=C()?"instant":i.scrollBehavior;s.scrollIntoView({block:"nearest",behavior:o})}this.#I(i,t),this.#$(s),this.#M(s,i.placement);let r=this.#t;r?.focus(),requestAnimationFrame(()=>{if(this.#t!==r||this.#i!==t)return;let o=r?.querySelector(".page-tour-content :is(h2, h3, h4)")??null;o?(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus()):(r?.querySelector(".page-tour-next")??null)?.focus()});let c=i.querySelector("h2, h3, h4"),n=this.#o("step").replace("{n}",String(t+1)).replace("{total}",String(this.#e.length));this.#L(c?.textContent?`${n}: ${c.textContent.trim()}`:n),this.dataset.step=String(t),i.action!=="none"&&this.#R(i,s),this.#j(s),this.#E({step:t}),this.#f("tour:step",{step:t,target:s,direction:e})}#R(t,e){let i=new AbortController;this.#d=i;let r={click:"click",focus:"focus",input:"input",change:"change"}[t.action];r?e.addEventListener(r,()=>{i.abort(),this.#N(),this.#f("tour:action",{step:this.#i,action:t.action})},{signal:i.signal}):t.action==="custom"&&this.addEventListener("tour:action",()=>{i.abort(),this.#N()},{signal:i.signal})}#N(){let t=this.#t?.querySelector(".page-tour-next");t&&(t.removeAttribute("data-waiting"),t.removeAttribute("aria-disabled"),t.removeAttribute("aria-describedby"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),this.#L(this.#o("ready")))}#V(t){if(!this.#s||t.defaultPrevented)return;let i=!!(t.target instanceof Element?t.target:null)?.closest(N),s=t.altKey||t.ctrlKey||t.metaKey;switch(t.key){case"Escape":this.#k(this.#e[this.#i])&&(t.preventDefault(),this.skip());break;case"ArrowRight":case"ArrowDown":if(i||s)return;t.preventDefault(),this.next();break;case"ArrowLeft":case"ArrowUp":if(i||s)return;t.preventDefault(),this.prev();break;case"Home":if(i||s)return;t.preventDefault(),this.goto(0);break;case"End":if(i||s)return;t.preventDefault(),this.goto(this.#e.length-1);break;case"Tab":this.#H(t);break}}#H(t){if(!this.#t)return;let e=p=>!p.disabled&&(p.checkVisibility?.()??!0),i=[...this.#t.querySelectorAll(w)].filter(e),s=[],r=this.#e[this.#i],c=this.#u;r&&r.action!=="none"&&c&&(s=(c.matches(w)?[c]:[...c.querySelectorAll(w)]).filter(e));let n=[...i,...s];if(n.length===0)return;let o=n[0],d=n[n.length-1],l=document.activeElement,f=!l||!n.includes(l),g=f?-1:n.indexOf(l);t.preventDefault(),t.shiftKey?(f||l===o?d:n[g-1]).focus():(f||l===d?o:n[g+1]).focus()}#K(t){let e=t.target.closest?.("[data-action]")??null;if(e)switch(e.dataset.action){case"next":this.next();break;case"prev":this.prev();break;case"skip":this.skip();break}}#j(t){let e=new AbortController;this.#w=e;let i=()=>this.#z();document.addEventListener("scroll",i,{capture:!0,passive:!0,signal:e.signal}),window.addEventListener("resize",i,{passive:!0,signal:e.signal}),this.#b=new ResizeObserver(i),this.#b.observe(t),this.#v=setTimeout(i,C()?0:300)}#T(){this.#w?.abort(),this.#w=null,this.#b?.disconnect(),this.#b=null,this.#v&&(clearTimeout(this.#v),this.#v=null),this.#l&&(cancelAnimationFrame(this.#l),this.#l=null)}#z(){this.#l||(this.#l=requestAnimationFrame(()=>{this.#l=null;let t=this.#u;!this.#s||!t||(this.#$(t),b||this.#M(t,this.#e[this.#i].placement))}))}#J(){this.#f("tour:complete",{steps:this.#e.length}),this.#E({complete:!0}),this.stop(),this.setAttribute("data-complete","")}#U(){this.#m?.abort(),this.#m=null,this.#d?.abort(),this.#d=null,this.#T(),this.#C();let t=document.activeElement,e=!t||t===document.body||!!this.#t?.contains(t);this.#c?.remove(),this.#r?.remove(),this.#t?.matches(":popover-open")&&this.#t.hidePopover(),this.#t?.remove(),this.#n?.remove(),this.#c=null,this.#r=null,this.#t=null,this.#n=null;let i=this.#A;this.#A=null,e&&i?.isConnected&&typeof i.focus=="function"&&i.focus()}#L(t){let e=this.#n;e&&(e.textContent="",requestAnimationFrame(()=>{this.#n===e&&(e.textContent=t)}))}#f(t,e){let i=t!=="tour:skip";this.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:i,detail:e}))}#S(){let t=this.dataset.persist??"session";return t==="session"?sessionStorage:t==="local"?localStorage:null}#x(){return`vb-tour-${this.dataset.persistKey??window.location.pathname}`}#E(t){let e=this.#S();if(!e)return;let i=this.#x(),s={};try{s=JSON.parse(e.getItem(i)??"null")??{}}catch{}e.setItem(i,JSON.stringify({...s,...t}))}#W(){let t=this.#S();if(!t)return null;try{return JSON.parse(t.getItem(this.#x())??"null")}catch{return null}}#G(){let t=this.#S();t&&t.removeItem(this.#x())}};A("page-tour",S);A("tour-step",k);export{S as PageTour,k as TourStep};
39
2
  //# sourceMappingURL=page-tour.js.map
@@ -1,2 +1,2 @@
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};
1
+ var q=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function g(a,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=b.get(a);if(customElements.get(a)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(a,i),customElements.define(a,t)}var p=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}#a(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#a()?.validity}get validationMessage(){return this.#a()?.validationMessage??""}get willValidate(){return this.#a()?.willValidate??!1}get form(){return this.#a()?.form??null}checkValidity(){return this.#a()?.checkValidity()??!0}reportValidity(){return this.#a()?.reportValidity()??!0}};function x(a,t){let e=Number(a);return!Number.isFinite(e)||t<=0?1:Math.min(Math.max(1,Math.floor(e)),t)}function C({page:a,size:t}){let e=(a-1)*t;return{start:e,end:e+t}}function S(a,t,e=2){if(t<=0)return[];if(t===1)return[1];let n=Math.max(2,a-e),i=Math.min(t-1,a+e),r=[1];n>2&&r.push("\u2026");for(let s=n;s<=i;s++)r.push(s);return i<t-1&&r.push("\u2026"),r.push(t),r}function v({total:a,size:t,page:e,window:n=2}){if(t<=0)return{page:(a>0,1),totalPages:a>0?1:0,start:0,end:a,pageNumbers:a>0?[1]:[]};let i=a>0?Math.ceil(a/t):0,r=x(e,i),s=C({page:r,size:t}),o=Math.min(s.end,a);return{page:r,totalPages:i,start:s.start,end:o,pageNumbers:S(r,i,n)}}function h(a,t){return a.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function y(a){switch(a.style){case"load-more":return N(a);case"prev-next":return w(a);default:return M(a)}}function f(a="Pagination"){let t=document.createElement("nav");return t.setAttribute("data-paged-nav",""),t.setAttribute("aria-label",a),t}function M({page:a,totalPages:t,pageNumbers:e,navLabel:n,prevLabel:i="Previous",nextLabel:r="Next",pageLabel:s=o=>`Page ${o}`}){let o=f(n),d=document.createElement("ol");d.setAttribute("role","list"),d.appendChild(u(i,a-1,a===1,!1,"prev"));for(let l of e)if(l==="\u2026"){let c=document.createElement("li");c.textContent="\u2026",c.setAttribute("aria-hidden","true"),c.setAttribute("data-paged-ellipsis",""),d.appendChild(c)}else{let c=u(String(l),l,!1,l===a,"page");c.firstElementChild?.setAttribute("aria-label",s(l)),d.appendChild(c)}return d.appendChild(u(r,a+1,a===t,!1,"next")),o.appendChild(d),o}function w({page:a,totalPages:t,navLabel:e,prevLabel:n="Previous",nextLabel:i="Next",statusLabel:r=(s,o)=>`Page ${s} of ${o}`}){let s=f(e),o=document.createElement("ol");o.setAttribute("role","list"),o.appendChild(u(n,a-1,a===1,!1,"prev"));let d=document.createElement("li");return d.setAttribute("data-paged-status",""),d.setAttribute("aria-live","polite"),d.textContent=r(a,t),o.appendChild(d),o.appendChild(u(i,a+1,a===t,!1,"next")),s.appendChild(o),s}function N({total:a,visible:t,navLabel:e,loadMoreLabel:n=r=>`Load more (${r})`,noMoreLabel:i="No more"}){let r=f(e),s=document.createElement("button");s.type="button",s.setAttribute("data-paged-loadmore","");let o=Math.max(0,a-t);return s.textContent=o>0?n(o):i,s.disabled=o<=0,r.appendChild(s),r}function u(a,t,e,n,i){let r=document.createElement("li"),s=document.createElement("button");return s.type="button",s.setAttribute("data-paged-action",i),s.dataset.pagedTarget=String(t),s.textContent=a,n&&s.setAttribute("aria-current","page"),e&&(s.disabled=!0),r.appendChild(s),r}function E(a,{onNavigate:t,onLoadMore:e}){t&&a.querySelectorAll("button[data-paged-target]").forEach(n=>{n.addEventListener("click",()=>t(parseInt(n.dataset.pagedTarget||"1",10)))}),e&&a.querySelectorAll("button[data-paged-loadmore]").forEach(n=>{n.addEventListener("click",()=>e())})}function A(a,t){if(!a||!a.parentNode)return;let e=document.activeElement,i=!!e&&a.contains(e)&&e?{action:e.getAttribute("data-paged-action"),target:e.getAttribute("data-paged-target"),loadMore:e.hasAttribute("data-paged-loadmore")}:null,r=a.querySelector("[data-paged-status]"),s=t.querySelector("[data-paged-status]");r&&s&&(r.textContent!==s.textContent&&(r.textContent=s.textContent),s.hasAttribute("aria-live")?r.setAttribute("aria-live",s.getAttribute("aria-live")||"polite"):r.removeAttribute("aria-live"),s.replaceWith(r)),a.replaceWith(t),i&&$(t,i)}function $(a,t){let e=i=>a.querySelector(`${i}:not([disabled])`),n=[];t.loadMore&&n.push("button[data-paged-loadmore]"),t.action&&(n.push(`button[data-paged-action="${t.action}"][data-paged-target="${t.target}"]`),t.action!=="page"&&n.push(`button[data-paged-action="${t.action}"]`)),n.push('button[aria-current="page"]',"button");for(let i of n){let r=e(i);if(r){r.focus();return}}a.tabIndex=-1,a.focus()}var L=["numbered","prev-next","load-more"],T=["data-label-nav","data-label-prev","data-label-next","data-label-page","data-label-status","data-label-load-more","data-label-no-more","data-label-missing"],m=class extends p{static observedAttributes=["target","for","data-style","aria-label",...T];#t=null;#e=null;#a=!1;setup(){this.listen(document,"paged:change",t=>this.#l(t)),this.#t=this.#r(),this.#i()}teardown(){this.#t=null,this.#e=null}attributeChangedCallback(t,e,n){e===n||!this.isConnected||!this.hasAttribute("data-upgraded")||(t==="target"||t==="for"?(this.#t=this.#r(),this.#e=null,this.#i()):this.#e?this.#s(this.#e):this.#i())}#l(t){(!this.#t||!this.#t.isConnected||t.target!==this.#t)&&(this.#t=this.#r()),t.target===this.#t&&this.#s(t.detail)}#r(){let t=null,e=this.getAttribute("target"),n=this.getAttribute("for");if(e)try{t=document.querySelector(e)}catch{t=null}else if(n)t=document.getElementById(n);else{let i=this.previousElementSibling;for(;i&&!i.hasAttribute("data-paged");)i=i.previousElementSibling;t=i}return t&&t.hasAttribute("data-paged")?t:null}#i(){let t=this.#t;if(!t){this.#o();return}let e=parseInt(t.dataset.pagedSize||"10",10)||0,n=parseInt(t.dataset.pagedPage||"1",10)||1,i=t.tagName==="TABLE"?Array.from(t.querySelector(":scope > tbody")?.children||[]):Array.from(t.children).filter(l=>!l.matches("nav[data-paged-nav], div[data-paged-sentinel]")),r=i.length,s=e>0?Math.max(1,Math.ceil(r/e)):1,d=i.some(l=>l.hidden)?i.filter(l=>!l.hidden).length:Math.min(e||r,r);this.#s({page:n,size:e,total:r,totalPages:s,visible:d,style:t.dataset.pagedStyle||"numbered"})}#c(){let t=this.getAttribute("data-style")||"numbered";return L.includes(t)?t:"numbered"}#n(t,e){return this.getAttribute(`data-label-${t}`)||e}#s(t){this.#e=t;let e=this.#c(),n=this.#t;if(!n){this.#o();return}e==="load-more"&&!this.#a&&!/^(load-more|infinite)$/.test(n.dataset.pagedStyle||"")&&(this.#a=!0,console.warn('[pager-wc] data-style="load-more" needs a progressive target: set data-paged-style="load-more" on',n));let i=v({total:t.total,size:t.size,page:t.page,window:parseInt(n.dataset.pagedWindow||"2",10)||2}),r=typeof t.visible=="number"?t.visible:Math.min(t.page*t.size,t.total),s=this.querySelector(":scope > nav[data-paged-nav]");if(this.querySelector(":scope > [data-pager-missing]")?.remove(),e!=="load-more"&&i.totalPages<=1){s?.remove();return}let o=y({style:e,page:i.page,totalPages:i.totalPages,pageNumbers:i.pageNumbers,total:t.total,visible:r,navLabel:this.#n("nav",this.getAttribute("aria-label")||"Pagination"),prevLabel:this.#n("prev","Previous"),nextLabel:this.#n("next","Next"),pageLabel:d=>h(this.#n("page","Page {page}"),{page:d}),statusLabel:(d,l)=>h(this.#n("status","Page {page} of {total}"),{page:d,total:l}),loadMoreLabel:d=>h(this.#n("load-more","Load more ({n})"),{n:d}),noMoreLabel:this.#n("no-more","No more")});E(o,{onNavigate:d=>this.#u(d),onLoadMore:()=>this.#p()}),s?A(s,o):this.appendChild(o)}#o(){this.querySelector(":scope > nav[data-paged-nav]")?.remove();let t=this.querySelector(":scope > [data-pager-missing]");t||(t=document.createElement("p"),t.setAttribute("data-pager-missing",""),this.appendChild(t)),t.textContent=this.#n("missing","No paginated target found")}#d(){return this.#t?.isConnected||(this.#t=this.#r()),this.#t}#u(t){let e=this.#d();e&&(this.dispatchEvent(new CustomEvent("pager-wc:navigate",{bubbles:!0,detail:{page:t}})),e.dispatchEvent(new CustomEvent("paged:goto",{detail:{page:t}})))}#p(){this.#d()?.dispatchEvent(new CustomEvent("paged:loadmore"))}};g("pager-wc",m);export{m 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 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};
1
+ var k=window.matchMedia("(prefers-reduced-motion: reduce)");var g=new Map;function v(c,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},o=g.get(c);if(customElements.get(c)){if(!o||o.priority>=i){o&&o.priority===i&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=i){o.priority===i&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}g.set(c,s),customElements.define(c,t)}var h=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#i(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var S={vote:"vote",votes:"votes","your-choice":"your choice",closed:"closed",poll:"Poll"},q=0,m=class extends h{static observedAttributes=["data-closed","data-multi","data-hide-counts","disabled"];#e=null;#t=null;#i=null;setup(){this.#t=this.querySelector(":scope > .poll-options"),this.#t?(this.#e=this.querySelector(":scope > .poll-question"),this.#i=this.querySelector(":scope > output.poll-total")):(this.#u(),this.#d());let t=this.#t;return t?(this.#r(),this.#s().forEach(e=>this.#h(e)),this.listen(t,"click",e=>{let i=e.target.closest?.("button[data-option]");i&&i.parentElement===this.#t&&this.#l(i)}),this.listen(t,"keydown",e=>{let i=e.target.closest?.("button[data-option]");i&&i.parentElement===this.#t&&this.#p(e,i)}),this.#n(),!0):!1}teardown(){this.#e=null,this.#t=null,this.#i=null}attributeChangedCallback(t,e,i){!this.#t||e===i||(t==="data-multi"&&this.#r(),this.#n(),t==="data-closed"&&this.dispatchEvent(new CustomEvent("poll-wc:closed-change",{bubbles:!0,detail:{closed:this.hasAttribute("data-closed")}})))}#u(){let t=this.querySelector(":scope > form");if(!t||this.querySelector(":scope > button[data-option]"))return;let e=[...t.querySelectorAll('input[type="radio"], input[type="checkbox"]')];if(!e.length)return;let i=t.querySelector("fieldset"),s=i?.querySelector(":scope > legend"),o=[];if(s&&!this.querySelector(':scope > [slot="question"]')){let n=document.createElement("span");n.slot="question",n.append(...s.childNodes),o.push(n)}e.some(n=>n.type==="checkbox")&&this.setAttribute("data-multi",""),i?.disabled&&this.setAttribute("data-closed","");for(let n of e){let a=document.createElement("button");a.type="button",a.dataset.option=n.value,a.dataset.count=n.dataset.count||"0",n.checked&&a.setAttribute("data-mine","");let l=n.closest("label")||(n.id?t.querySelector(`label[for="${CSS.escape(n.id)}"]`):null);l?(n.remove(),a.append(...l.childNodes),C(a)):a.textContent=n.value,o.push(a)}t.replaceWith(...o)}#d(){let t=this.querySelector(':scope > [slot="question"]'),e=[...this.querySelectorAll(":scope > button[data-option]")];t&&(this.#e=document.createElement("div"),this.#e.className="poll-question",this.#e.id=`poll-q-${++q}`,this.#e.appendChild(t)),this.#t=document.createElement("div"),this.#t.className="poll-options";let i=this.getAttribute("aria-label");i?(this.#t.setAttribute("aria-label",i),this.removeAttribute("aria-label")):this.#e?this.#t.setAttribute("aria-labelledby",this.#e.id):this.#t.setAttribute("aria-label",this.#o("poll")),this.#t.append(...e),this.#i=document.createElement("output"),this.#i.className="poll-total",this.#i.setAttribute("aria-live","polite");let s=[];this.#e&&s.push(this.#e),s.push(this.#t,this.#i),this.replaceChildren(...s)}#s(){return this.#t?[...this.#t.querySelectorAll(":scope > button[data-option]")]:[]}#r(){this.#t?.setAttribute("role",this.hasAttribute("data-multi")?"group":"radiogroup")}#h(t){if(t.type="button",t.classList.add("poll-option"),t.querySelector(":scope > .poll-option-label"))return;let e=document.createElement("span");e.className="poll-option-label",e.append(...t.childNodes);let i=document.createElement("span");i.className="poll-option-bar",i.setAttribute("aria-hidden","true");let s=document.createElement("span");s.className="poll-option-count",s.setAttribute("aria-hidden","true"),t.append(e,i,s)}#a(){return this.hasAttribute("data-closed")||this.hasAttribute("disabled")}#l(t){if(this.#a())return;let e=this.hasAttribute("data-multi"),i=this.#s();if(e?t.hasAttribute("data-pending"):i.some(a=>a.hasAttribute("data-pending")))return;let s=t.dataset.option,o=Number(t.dataset.count)||0,n=t.hasAttribute("data-mine");if(!e&&!n){let a=i.find(l=>l.hasAttribute("data-mine")&&l!==t);a&&(a.setAttribute("data-pending",""),this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:a.dataset.option,action:"remove",count:Number(a.dataset.count)||0,mine:!0}})))}t.setAttribute("data-pending",""),this.#c(),this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:s,action:n?"remove":"add",count:o,mine:n}}))}#p(t,e){if(this.hasAttribute("data-multi"))return;let i=this.#s(),s=i.indexOf(e),o=getComputedStyle(this).direction==="rtl",n=o?"ArrowLeft":"ArrowRight",a=o?"ArrowRight":"ArrowLeft",l;switch(t.key){case"ArrowDown":case n:l=(s+1)%i.length;break;case"ArrowUp":case a:l=(s-1+i.length)%i.length;break;case"Home":l=0;break;case"End":l=i.length-1;break;default:return}t.preventDefault();let u=i[l];this.#b(u),u.focus(),u.hasAttribute("data-mine")||this.#l(u)}#b(t){for(let e of this.#s())e.tabIndex=e===t?0:-1}#o(t){return this.getAttribute(`data-label-${t}`)||S[t]}#f(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}#c(){this.#s().some(e=>e.hasAttribute("data-pending"))?this.#t?.setAttribute("aria-busy","true"):this.#t?.removeAttribute("aria-busy")}#n(){let t=this.#s();if(!t.length)return;let e=t.reduce((r,d)=>r+(Number(d.dataset.count)||0),0),i=this.hasAttribute("data-closed"),s=this.#a(),o=this.hasAttribute("data-multi"),n=this.hasAttribute("data-hide-counts"),a=this.#f(),l=new Intl.NumberFormat(a),u=new Intl.NumberFormat(a,{style:"percent",maximumFractionDigits:0}),E=new Intl.PluralRules(a),p=r=>`${l.format(r)} ${E.select(r)==="one"?this.#o("vote"):this.#o("votes")}`,w=o?null:t.find(r=>r.hasAttribute("data-mine"))||t.find(r=>r.getAttribute("tabindex")==="0")||t[0];for(let r of t){let d=Number(r.dataset.count)||0,y=r.hasAttribute("data-mine"),b=e>0?d/e:0;r.style.setProperty("--option-pct",n?"0":String(Math.round(b*1e3)/10)),r.setAttribute("aria-checked",y?"true":"false"),r.setAttribute("role",o?"checkbox":"radio"),s?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),r.tabIndex=o||r===w?0:-1;let A=r.querySelector(":scope > .poll-option-count");A&&(A.textContent=n?"":`${l.format(d)} \xB7 ${u.format(b)}`);let f=[r.querySelector(":scope > .poll-option-label")?.textContent.replace(/\s+/g," ").trim()||r.dataset.option];n||f.push(p(d),u.format(b)),y&&f.push(this.#o("your-choice")),r.setAttribute("aria-label",f.join(", "))}this.#i&&(this.#i.textContent=i?`${p(e)} \xB7 ${this.#o("closed")}`:p(e)),this.#c()}#m(t){let e=this.hasAttribute("data-multi");for(let i of this.#s())(!e||i===t)&&i.removeAttribute("data-pending")}setCount(t,e,i={}){let s=this.#s().find(o=>o.dataset.option===t);s&&(s.dataset.count=String(Math.max(0,Number(e)||0)),i.mine===!0?s.setAttribute("data-mine",""):i.mine===!1&&s.removeAttribute("data-mine"),this.#m(s),this.#n())}setCounts(t,e={}){let i=Array.isArray(e.mine)?e.mine:e.mine?[e.mine]:null;for(let s of this.#s()){let o=s.dataset.option??"";t[o]!=null&&(s.dataset.count=String(Math.max(0,Number(t[o])||0))),i&&(i.includes(o)?s.setAttribute("data-mine",""):s.removeAttribute("data-mine")),s.removeAttribute("data-pending")}this.#n()}close(){this.setAttribute("data-closed","")}open(){this.removeAttribute("data-closed")}get totalVotes(){return this.#s().reduce((t,e)=>t+(Number(e.dataset.count)||0),0)}get myVotes(){return this.#s().filter(t=>t.hasAttribute("data-mine")).map(t=>t.dataset.option)}};function C(c){let t=c.firstChild;t?.nodeType===Node.TEXT_NODE&&(t.textContent=t.textContent.replace(/^\s+/,""));let e=c.lastChild;e?.nodeType===Node.TEXT_NODE&&(e.textContent=e.textContent.replace(/\s+$/,""))}v("poll-wc",m);export{m 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))}_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);
1
+ var B=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function E(i,t,e={}){let o=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:o},s=v.get(i);if(customElements.get(i)){if(!s||s.priority>=o){s&&s.priority===o&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=o){s.priority===o&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(i,r),customElements.define(i,t)}var d=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,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)}#o(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#o()?.validity}get validationMessage(){return this.#o()?.validationMessage??""}get willValidate(){return this.#o()?.willValidate??!1}get form(){return this.#o()?.form??null}checkValidity(){return this.#o()?.checkValidity()??!0}reportValidity(){return this.#o()?.reportValidity()??!0}};var u=CSS.supports("anchor-name","--x"),M=CSS.supports("position-area","bottom"),C=(()=>{let i=document.createElement("span");return i.setAttribute("popover","hint"),i.popover==="hint"})(),P=["auto","manual","hint"];function k(i){let t=P.includes(i||"")?i:"auto";return t==="hint"&&!C?"auto":t}var x=["top","bottom","left","right","inset-inline-start","inset-inline-end"],V=["position","top","left","right","bottom","margin"],w=8,N=0,T=0;function A(i){return!i||i==="none"?[]:i.split(",").map(t=>t.trim()).filter(Boolean)}var m=class extends d{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#o=`--pop-over-anchor-${++T}`;#i=!1;#s=!1;#n=!1;setup(){if(this.id||(this.id=`pop-over-${++N}`),(!this.hasAttribute("popover")||this.#i)&&this.#a(),this.#c(),this.#h(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!u&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#r()})}),!u){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#r()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#l(),this.#s&&(x.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#n&&(V.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#t=null}attributeChangedCallback(t,e,o){if(e!==o){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#i=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=k(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#i=!0}show(){this.matches(":popover-open")||(this.showPopover(),!u&&this.#t&&this.matches(":popover-open")&&this.#r())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#c(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#h(){if(!this.#t||!u)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),o=A(e||getComputedStyle(t).getPropertyValue("anchor-name"));o.includes(this.#o)||o.push(this.#o),t.style.setProperty("anchor-name",o.join(", ")),this.#e=this.#o,this.style.setProperty("position-anchor",this.#o),this.setAttribute("data-anchor-name",this.#o),M||this.#d(this.dataset.position||"bottom")}#l(){if(this.#t&&this.#e){let t=A(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#e);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#e=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#d(t){let e="var(--_pop-over-offset, var(--size-xs))",o=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},r={top:{bottom:`calc(anchor(top) + ${e})`,...o},bottom:{top:`calc(anchor(bottom) + ${e})`,...o},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],h=r[s]||r.bottom;Object.entries(h).forEach(([l,n])=>this.style.setProperty(l,n)),this.#s=!0}#r(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",o=this.#u(),r=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#n=!0;let h=this.offsetWidth,l=this.offsetHeight,n=e.split("-")[0];["top","bottom","left","right"].includes(n)||(n="bottom");let p={top:t.top-o,bottom:s-t.bottom-o,left:t.left-o,right:r-t.right-o},b={top:"bottom",bottom:"top",left:"right",right:"left"},S=n==="top"||n==="bottom"?l:h;p[n]<S&&p[b[n]]>p[n]&&(n=b[n]);let a,c;switch(n){case"top":a=t.top-l-o,c=t.left;break;case"left":a=t.top,c=t.left-h-o;break;case"right":a=t.top,c=t.right+o;break;default:a=t.bottom+o,c=t.left;break}if(n==="top"||n==="bottom"){let f=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==f?t.right-h:t.left}else e.endsWith("-end")&&(a=t.bottom-l);let y=(f,g,$)=>Math.max(w,Math.min(f,$-g-w));c=y(c,h,r),a=y(a,l,s),this.style.top=`${Math.round(a)}px`,this.style.left=`${Math.round(c)}px`}#u(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};E("pop-over",m);
2
2
  //# sourceMappingURL=pop-over.js.map
@@ -1,9 +1,2 @@
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
- <h2 class="popularity-heading">Most visited</h2>
4
- <p class="popularity-empty">Popularity data is unavailable right now${t?` (${p(t)})`:""}.</p>
5
- `}#n(){this.innerHTML=`
6
- <h2 class="popularity-heading">Most visited</h2>
7
- <p class="popularity-empty">Not enough data yet to surface most-visited pages.</p>
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};
1
+ var L=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function E(a,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},i=w.get(a);if(customElements.get(a)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> 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 <${a}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}w.set(a,s),customElements.define(a,t)}var g=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,s){t.addEventListener(e,n,s),this.#e.push(()=>t.removeEventListener(e,n,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let s=`--${t}`;e?n.add(s):n.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var M="/api/analytics/popular",$=10,N={heading:"Most visited",view:"view",views:"views",unavailable:"Popularity data is unavailable right now.",empty:"Not enough data yet to surface most-visited pages."},v=class extends g{static observedAttributes=["analytics-src","window","limit","data-meta-src","data-lens-src","data-heading-level"];#e=null;#t=0;setup(){this.#n()}teardown(){this.#t++,this.#e?.abort(),this.#e=null}attributeChangedCallback(t,e,n){e===n||!this.hasAttribute("data-upgraded")||this.#n()}#n(){let t=++this.#t;this.#e?.abort(),this.#e=null,queueMicrotask(()=>{t!==this.#t||!this.isConnected||this.#c(t).catch(()=>{})})}async#c(t){let e=new AbortController;this.#e=e;let{signal:n}=e,s=()=>t===this.#t&&!n.aborted;this.#s("loading"),this.#a(this.#o());let i=this.getAttribute("analytics-src")||M,u=new URL(i,document.baseURI),m=this.getAttribute("window");m&&u.searchParams.set("window",m);let o=this.getAttribute("data-meta-src")||this.getAttribute("data-lens-src"),p=fetch(u,{credentials:"omit",signal:n}).then(r=>{if(!r.ok)throw new Error(`status ${r.status}`);return r.json()}),h=o?fetch(new URL(o,document.baseURI),{credentials:"omit",signal:n}).then(r=>r.ok?r.json():null).catch(()=>null):Promise.resolve(null),l;try{l=await p}catch(r){if(!s())return;let f=r instanceof Error?r.message:String(r);this.setAttribute("data-error",f),console.warn("[popularity-index] endpoint unavailable:",f),this.#i("unavailable",this.#l("unavailable"));return}let c=await h;if(!s())return;let y=Array.isArray(l?.pages)?l.pages:Array.isArray(l)?l:[],d=Array.isArray(c)?c:Array.isArray(c?.pages)?c.pages:[],A=new Map(d.filter(r=>r&&typeof r.url=="string").map(r=>[r.url,r])),b=[];for(let r of y){if(!r||typeof r.url!="string")continue;let f=C(r.url);if(f&&(b.push({p:r,href:f,meta:A.get(r.url)||{}}),b.length>=this.#d()))break}if(!b.length){this.#i("empty",this.#l("empty"));return}this.#i("ready",this.#u(b))}#i(t,e){t!=="unavailable"&&this.removeAttribute("data-error"),this.#a(this.#o(),e),this.#s(t),this.dispatchEvent(new CustomEvent("popularity-index:state",{bubbles:!0,detail:{state:t}}))}#s(t){this.setAttribute("data-state",t),t==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy")}#a(...t){this.replaceChildren(...t.filter(e=>e!==null))}#o(){let t=this.getAttribute("data-heading-level"),e=t==null||t===""?2:Number.parseInt(t,10);if(e===0)return null;let n=Number.isFinite(e)?Math.min(6,Math.max(1,e)):2,s=document.createElement(`h${n}`);return s.className="popularity-heading",s.textContent=this.#r("heading"),s}#l(t){let e=document.createElement("p");return e.className="popularity-empty",e.textContent=this.#r(t),e}#u(t){let e=this.#h(),n=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),s=new Intl.PluralRules(e),i=document.createElement("ol");i.className="popularity-list";for(let{p:u,href:m,meta:o}of t){let p=document.createElement("li"),h=document.createElement("a");h.href=m,h.textContent=String(u.title||o.title||u.url);let l=Math.max(0,Number(u.views??u.count??0)||0),c=document.createElement("small"),y=s.select(l)==="one"?this.#r("view"):this.#r("views");if(c.append(`${n.format(l)} ${y}`),typeof o.provenance=="string"&&o.provenance){let d=document.createElement("span");d.className="popularity-prov",d.dataset.provenance=o.provenance,d.textContent=o.provenance,c.append(" \xB7 ",d)}p.append(h,c),i.append(p)}return i}#d(){let t=Number.parseInt(this.getAttribute("limit")??"",10);return Number.isFinite(t)?Math.max(1,t):$}#r(t){return this.getAttribute(`data-label-${t}`)||N[t]}#h(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};function C(a){let t=a.trim();if(!t)return null;let e;try{e=new URL(t,location.href)}catch{return null}if(e.protocol!=="http:"&&e.protocol!=="https:")return null;let n=/^[a-z][a-z0-9+.-]*:/i.test(t);return!n&&e.origin!==location.origin?null:n?e.href:t}E("popularity-index",v);export{v as PopularityIndex,C as safeHref};
9
2
  //# sourceMappingURL=popularity-index.js.map
@@ -1,2 +1,2 @@
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};
1
+ var h=window.matchMedia("(prefers-reduced-motion: reduce)");var d=new Map;function u(s,t,i={}){let e=i.priority??10,o={impl:t,bundle:i.bundle,contract:i.contract,priority:e},n=d.get(s);if(customElements.get(s)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}d.set(s,o),customElements.define(s,t)}var a=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,o){t.addEventListener(i,e,o),this.#t.push(()=>t.removeEventListener(i,e,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,i){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{i?e.add(t):e.delete(t)}catch{let o=`--${t}`;i?e.add(o):e.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#i(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var c=class extends a{#t;#e;#i=null;setup(){this.#i===null&&(this.#i=this.getAttribute("label")||this.textContent.trim()||"Print this page");let t=this.#i,i=this.hasAttribute("raw-toggle");this.innerHTML="",i&&(this.setAttribute("role","group"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",t));let e=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=e!=="label",n=e!=="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(n){let r=document.createElement("span");r.textContent=t,this.#t.appendChild(r)}if(this.listen(this.#t,"click",this.#n),this.append(this.#t),i){let r=document.createElement("label");this.#e=document.createElement("input"),this.#e.type="checkbox";let l=document.createElement("span");l.textContent=this.dataset.labelRaw||"Print without VB styles",r.append(this.#e,l),this.append(r)}}teardown(){this.#t=null,this.#e=null}#n=()=>{if(this.#e?.checked){document.documentElement.setAttribute("data-print-raw","");let i,e=()=>{document.documentElement.removeAttribute("data-print-raw"),window.removeEventListener("afterprint",e),clearTimeout(i)};window.addEventListener("afterprint",e,{once:!0}),i=setTimeout(e,5e3)}window.print()}};u("print-page",c);export{c as PrintPage};
2
2
  //# sourceMappingURL=print-page.js.map
@@ -1,2 +1,2 @@
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};
1
+ var E=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function m(a,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=b.get(a);if(customElements.get(a)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(a,i),customElements.define(a,t)}var l=class extends HTMLElement{#r=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#r)t();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,i){t.addEventListener(e,r,i),this.#r.push(()=>t.removeEventListener(e,r,i))}_reinit(){for(let t of this.#r)t();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var y={complete:"(completed)",current:"",upcoming:"(not started)",error:"(error)"},u=class extends l{static observedAttributes=["data-current","data-clickable","data-label-list","data-label-step","data-label-complete","data-label-current","data-label-upcoming","data-label-error"];#r=!1;#t=null;setup(){this.listen(this,"click",t=>this.#h(t)),this.#i(),this.#t=new MutationObserver(t=>{let e=this.#e();t.some(r=>r.type==="attributes"||r.target===this||r.target===e)&&this.#i()}),this.#t.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-step","data-error"]})}teardown(){this.#t?.disconnect(),this.#t=null}attributeChangedCallback(t,e,r){e===r||!this.hasAttribute("data-upgraded")||(this.#i(),!(t!=="data-current"||this.#r)&&this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:this.#c(),previousStep:this.#d(e),source:"attr"}})))}#e(){return this.querySelector(":scope > ol")}#s(){let t=this.#e();return t?[...t.children].filter(e=>e.localName==="li"):[]}#n(t,e){return t.dataset.step||String(e+1)}#l(t){if(t.querySelector(":scope > .pt-circle"))return;let e=document.createElement("span");e.className="pt-label",e.append(...t.childNodes);let r=document.createElement("span");r.className="pt-circle",r.setAttribute("aria-hidden","true");let i=document.createElement("span");i.className="pt-sr pt-position";let s=document.createElement("span");s.className="pt-sr pt-status";let n=document.createElement("span");n.className="pt-body",n.append(i,e,s),t.append(r,n),t.dataset.decorated=""}#u(t,e){let r=t.querySelector(":scope > .pt-body");if(!r)return;let i=!!r.querySelector(".pt-label :is(a[href], button, input, select, textarea, [tabindex])"),s=e&&!i?"button":"span";if(r.localName===s)return;let n=document.createElement(s);n.className="pt-body",s==="button"&&(n.type="button");let c=r.contains(document.activeElement);n.append(...r.childNodes),r.replaceWith(n),c&&s==="button"&&n.focus()}#i(){let t=this.#e();if(!t)return;!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-label",this.getAttribute("data-label-list")||"Progress");let e=this.#s(),r=this.#a(e),i=this.hasAttribute("data-clickable"),s=this.getAttribute("data-label-step")??"Step {n} of {total}:";e.forEach((n,c)=>{this.#l(n);let o;n.hasAttribute("data-error")?o="error":c<r?o="complete":c===r?o="current":o="upcoming",n.dataset.status=o,o==="current"?n.setAttribute("aria-current","step"):n.removeAttribute("aria-current"),n.removeAttribute("aria-label"),n.removeAttribute("tabindex");let d=n.querySelector(":scope > .pt-circle");d&&(d.textContent=o==="complete"?"\u2713":o==="error"?"!":String(c+1));let h=n.querySelector(".pt-position");h&&(h.textContent=s?`${g(s,c+1,e.length)} `:"");let p=n.querySelector(".pt-status");if(p){let f=this.getAttribute(`data-label-${o}`)??y[o];p.textContent=f?` ${f}`:""}this.#u(n,i&&c<r)})}#a(t){return this.#o(t,this.getAttribute("data-current"))??0}#o(t,e){if(e==null||!t.length)return null;let r=t.findIndex((s,n)=>this.#n(s,n)===e);if(r!==-1)return r;let i=Number(e);return Number.isInteger(i)&&i>0?Math.min(t.length-1,i-1):null}#c(){let t=this.#s(),e=this.#a(t);return t[e]?this.#n(t[e],e):null}#d(t){let e=this.#s(),r=this.#o(e,t);return r==null?null:this.#n(e[r],r)}#h(t){if(!this.hasAttribute("data-clickable"))return;let e=t.target.closest?.("li"),r=this.#s(),i=e?r.indexOf(e):-1;if(i===-1||t.target.closest(".pt-label a[href]"))return;let s=this.#a(r);if(i>=s)return;let n=this.#n(r[i],i),c=this.#c();this.#r=!0;try{this.setAttribute("data-current",n)}finally{this.#r=!1}this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:n,previousStep:c,source:"click"}}))}};function g(a,t,e){return a.replace(/\{n\}/g,String(t)).replace(/\{total\}/g,String(e))}m("progress-tracker",u);export{u 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))}_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};
1
+ var rt=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function B(a,e,r={}){let o=r.priority??10,u={impl:e,bundle:r.bundle,contract:r.contract,priority:o},c=S.get(a);if(customElements.get(a)){if(!c||c.priority>=o){c&&c.priority===o&&c.impl!==e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${c.bundle}" (priority ${c.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${c.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(c&&c.priority>=o){c.priority===o&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${c.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}S.set(a,u),customElements.define(a,e)}var N=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,o,u){e.addEventListener(r,o,u),this.#t.push(()=>e.removeEventListener(r,o,u))}_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,r){this.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{r?o.add(e):o.delete(e)}catch{let u=`--${e}`;r?o.add(u):o.delete(u)}}_adoptInternals(e){this.#e||(this.#e=e)}#n(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var X=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),k=new WeakMap;function j(a,e){let r=k.get(e);r||k.set(e,r=new Map);let o=r.get(a);if(!o||!o.region.isConnected){let c=(e.ownerDocument||document).createElement("span");c.setAttribute("data-vb-announcer",a),c.setAttribute("role",a==="assertive"?"alert":"status"),c.setAttribute("aria-live",a),c.setAttribute("aria-atomic","true"),c.style.cssText=X,e.appendChild(c),o={region:c},r.set(a,o)}return o}function D(a,{politeness:e="polite",root:r}={}){let o=String(a??"").trim();if(!o||typeof document>"u")return null;let u=r||document.body;if(!u)return null;let h=j(e==="assertive"?"assertive":"polite",u);return clearTimeout(h.write),clearTimeout(h.clear),h.region.textContent="",h.write=setTimeout(()=>{h.region.textContent=o,h.clear=setTimeout(()=>{h.region.textContent=""},7e3)},50),h.region}function y(a,e,r,o){let u=`data-label-${e}`,h=a?.closest?.(`[${u}]`)?.getAttribute(u)||r;return o?h.replace(/\{(\w+)\}/g,(t,n)=>n in o?String(o[n]):t):h}var L=1500,W="[data-copy], [data-copy-target], [data-paste-target]",M={copied:"Copied to clipboard",pasted:"Pasted from clipboard","copy-failed":"Copy failed","copy-failed-selected":"Copy failed. Text selected, press Ctrl+C to copy","paste-failed":"Paste failed"},T=new WeakMap;function K(a){if(typeof document.execCommand!="function"||!document.body)return!1;let e=document.activeElement,r=document.createElement("textarea");r.value=a,r.setAttribute("readonly",""),r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none",document.body.appendChild(r),r.select();let o=!1;try{o=document.execCommand("copy")}catch{o=!1}return r.remove(),e?.focus?.({preventScroll:!0}),o}function Z(a){if(!a)return!1;if(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)return a.focus(),a.select(),!0;let e=window.getSelection?.();if(!e)return!1;let r=document.createRange();return r.selectNodeContents(a),e.removeAllRanges(),e.addRange(r),!e.isCollapsed}async function F(a,e={}){if(a==null||a==="")return!1;let{button:r,duration:o=L}=e,u=!1,c=null;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(a),u=!0}catch(t){c=t,u=K(a)}if(u)return C({button:r,duration:o,state:"copied",eventName:"copy:done",eventDetail:{text:a},message:e.announceMessage??y(r,"copied",M.copied)}),!0;let h=Z(e.source);return C({button:r,duration:o,state:"failed",eventName:"copy:error",eventDetail:{text:a,error:c},message:e.failureMessage??y(r,"copy-failed",h?M["copy-failed-selected"]:M["copy-failed"])}),!1}async function O(a,e={}){let{text:r,html:o,blob:u}=a??{};if(!r&&!o&&!u)return!1;let{button:c,duration:h=L}=e;if(typeof ClipboardItem<"u"&&typeof navigator.clipboard?.write=="function"){let n={};r&&(n["text/plain"]=new Blob([r],{type:"text/plain"})),o&&(n["text/html"]=new Blob([o],{type:"text/html"})),u&&(n[u.type]=u);try{return await navigator.clipboard.write([new ClipboardItem(n)]),C({button:c,duration:h,state:"copied",eventName:"copy:done",eventDetail:{payload:a},message:e.announceMessage??y(c,"copied",M.copied)}),!0}catch{}}return r?F(r,e):(C({button:c,duration:h,state:"failed",eventName:"copy:error",eventDetail:{payload:a,error:null},message:e.failureMessage??y(c,"copy-failed",M["copy-failed"])}),!1)}function C({button:a,duration:e,message:r,eventDetail:o,state:u,eventName:c}){if(a){a.dataset.state=u;let h=T.get(a);h&&clearTimeout(h),T.set(a,setTimeout(()=>{a.dataset.state===u&&delete a.dataset.state,T.delete(a)},e)),a.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:o}))}D(r,{politeness:u==="failed"?"assertive":"polite"})}async function J(a,e={}){let{button:r,duration:o=L}=e,u;try{if(!navigator.clipboard?.readText)throw new Error("Clipboard API unavailable");u=await navigator.clipboard.readText()}catch(c){return C({button:r,duration:o,state:"failed",eventName:"paste:error",eventDetail:{target:a,error:c},message:e.failureMessage??y(r,"paste-failed",M["paste-failed"])}),null}return a&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement?a.value=u:a.textContent=u,a.dispatchEvent(new Event("input",{bubbles:!0}))),C({button:r,duration:o,state:"pasted",eventName:"paste:done",eventDetail:{text:u,target:a},message:e.announceMessage??y(r,"pasted",M.pasted)}),u}function z(a){let e=a.dataset.copyTarget;if(!e)return null;try{return document.querySelector(e)}catch{return null}}function _(a){if(a.dataset.copy)return a.dataset.copy;let e=z(a);if(!e)return"";let r=a.dataset.copyAttr;return r?e.getAttribute(r)??"":e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??""}function Q(a){let e=a.target?.closest?.(W);if(!e||e.matches(':disabled, [aria-disabled="true"]'))return;if(e.dataset.pasteTarget){let o=null;try{o=document.querySelector(e.dataset.pasteTarget)}catch{}if(!o)return;J(o,{button:e});return}let r=_(e);r&&F(r,{button:e,source:z(e)??void 0})}typeof document<"u"&&!document.__vbCopyDelegated&&(document.__vbCopyDelegated=!0,document.addEventListener("click",Q));var w;(a=>{class e{constructor(t,n,i,s){if(this.version=t,this.errorCorrectionLevel=n,t<e.MIN_VERSION||t>e.MAX_VERSION)throw new RangeError("Version value out of range");if(s<-1||s>7)throw new RangeError("Mask value out of range");this.size=t*4+17;let l=[];for(let d=0;d<this.size;d++)l.push(!1);for(let d=0;d<this.size;d++)this.modules.push(l.slice()),this.isFunction.push(l.slice());this.drawFunctionPatterns();let f=this.addEccAndInterleave(i);if(this.drawCodewords(f),s==-1){let d=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);let p=this.getPenaltyScore();p<d&&(s=m,d=p),this.applyMask(m)}}u(0<=s&&s<=7),this.mask=s,this.applyMask(s),this.drawFormatBits(s),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(t,n){let i=a.QrSegment.makeSegments(t);return e.encodeSegments(i,n)}static encodeBinary(t,n){let i=a.QrSegment.makeBytes(t);return e.encodeSegments([i],n)}static encodeSegments(t,n,i=1,s=40,l=-1,f=!0){if(!(e.MIN_VERSION<=i&&i<=s&&s<=e.MAX_VERSION)||l<-1||l>7)throw new RangeError("Invalid value");let d,m;for(d=i;;d++){let g=e.getNumDataCodewords(d,n)*8,E=c.getTotalBits(t,d);if(E<=g){m=E;break}if(d>=s)throw new RangeError("Data too long")}for(let g of[e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])f&&m<=e.getNumDataCodewords(d,g)*8&&(n=g);let p=[];for(let g of t){r(g.mode.modeBits,4,p),r(g.numChars,g.mode.numCharCountBits(d),p);for(let E of g.getData())p.push(E)}u(p.length==m);let R=e.getNumDataCodewords(d,n)*8;u(p.length<=R),r(0,Math.min(4,R-p.length),p),r(0,(8-p.length%8)%8,p),u(p.length%8==0);for(let g=236;p.length<R;g^=253)r(g,8,p);let b=[];for(;b.length*8<p.length;)b.push(0);return p.forEach((g,E)=>b[E>>>3]|=g<<7-(E&7)),new e(d,n,b,l)}size;mask;modules=[];isFunction=[];getModule(t,n){return 0<=t&&t<this.size&&0<=n&&n<this.size&&this.modules[n][t]}drawFunctionPatterns(){for(let i=0;i<this.size;i++)this.setFunctionModule(6,i,i%2==0),this.setFunctionModule(i,6,i%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let t=this.getAlignmentPatternPositions(),n=t.length;for(let i=0;i<n;i++)for(let s=0;s<n;s++)i==0&&s==0||i==0&&s==n-1||i==n-1&&s==0||this.drawAlignmentPattern(t[i],t[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){let n=this.errorCorrectionLevel.formatBits<<3|t,i=n;for(let l=0;l<10;l++)i=i<<1^(i>>>9)*1335;let s=(n<<10|i)^21522;u(s>>>15==0);for(let l=0;l<=5;l++)this.setFunctionModule(8,l,o(s,l));this.setFunctionModule(8,7,o(s,6)),this.setFunctionModule(8,8,o(s,7)),this.setFunctionModule(7,8,o(s,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,o(s,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,o(s,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,o(s,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let i=0;i<12;i++)t=t<<1^(t>>>11)*7973;let n=this.version<<12|t;u(n>>>18==0);for(let i=0;i<18;i++){let s=o(n,i),l=this.size-11+i%3,f=Math.floor(i/3);this.setFunctionModule(l,f,s),this.setFunctionModule(f,l,s)}}drawFinderPattern(t,n){for(let i=-4;i<=4;i++)for(let s=-4;s<=4;s++){let l=Math.max(Math.abs(s),Math.abs(i)),f=t+s,d=n+i;0<=f&&f<this.size&&0<=d&&d<this.size&&this.setFunctionModule(f,d,l!=2&&l!=4)}}drawAlignmentPattern(t,n){for(let i=-2;i<=2;i++)for(let s=-2;s<=2;s++)this.setFunctionModule(t+s,n+i,Math.max(Math.abs(s),Math.abs(i))!=1)}setFunctionModule(t,n,i){this.modules[n][t]=i,this.isFunction[n][t]=!0}addEccAndInterleave(t){let n=this.version,i=this.errorCorrectionLevel;if(t.length!=e.getNumDataCodewords(n,i))throw new RangeError("Invalid argument");let s=e.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][n],l=e.ECC_CODEWORDS_PER_BLOCK[i.ordinal][n],f=Math.floor(e.getNumRawDataModules(n)/8),d=s-f%s,m=Math.floor(f/s),p=[],R=e.reedSolomonComputeDivisor(l);for(let g=0,E=0;g<s;g++){let A=t.slice(E,E+m-l+(g<d?0:1));E+=A.length;let G=e.reedSolomonComputeRemainder(A,R);g<d&&A.push(0),p.push(A.concat(G))}let b=[];for(let g=0;g<p[0].length;g++)p.forEach((E,A)=>{(g!=m-l||A>=d)&&b.push(E[g])});return u(b.length==f),b}drawCodewords(t){if(t.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let i=this.size-1;i>=1;i-=2){i==6&&(i=5);for(let s=0;s<this.size;s++)for(let l=0;l<2;l++){let f=i-l,m=(i+1&2)==0?this.size-1-s:s;!this.isFunction[m][f]&&n<t.length*8&&(this.modules[m][f]=o(t[n>>>3],7-(n&7)),n++)}}u(n==t.length*8)}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let i=0;i<this.size;i++){let s;switch(t){case 0:s=(i+n)%2==0;break;case 1:s=n%2==0;break;case 2:s=i%3==0;break;case 3:s=(i+n)%3==0;break;case 4:s=(Math.floor(i/3)+Math.floor(n/2))%2==0;break;case 5:s=i*n%2+i*n%3==0;break;case 6:s=(i*n%2+i*n%3)%2==0;break;case 7:s=((i+n)%2+i*n%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[n][i]&&s&&(this.modules[n][i]=!this.modules[n][i])}}getPenaltyScore(){let t=0;for(let l=0;l<this.size;l++){let f=!1,d=0,m=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[l][p]==f?(d++,d==5?t+=e.PENALTY_N1:d>5&&t++):(this.finderPenaltyAddHistory(d,m),f||(t+=this.finderPenaltyCountPatterns(m)*e.PENALTY_N3),f=this.modules[l][p],d=1);t+=this.finderPenaltyTerminateAndCount(f,d,m)*e.PENALTY_N3}for(let l=0;l<this.size;l++){let f=!1,d=0,m=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][l]==f?(d++,d==5?t+=e.PENALTY_N1:d>5&&t++):(this.finderPenaltyAddHistory(d,m),f||(t+=this.finderPenaltyCountPatterns(m)*e.PENALTY_N3),f=this.modules[p][l],d=1);t+=this.finderPenaltyTerminateAndCount(f,d,m)*e.PENALTY_N3}for(let l=0;l<this.size-1;l++)for(let f=0;f<this.size-1;f++){let d=this.modules[l][f];d==this.modules[l][f+1]&&d==this.modules[l+1][f]&&d==this.modules[l+1][f+1]&&(t+=e.PENALTY_N2)}let n=0;for(let l of this.modules)n=l.reduce((f,d)=>f+(d?1:0),n);let i=this.size*this.size,s=Math.ceil(Math.abs(n*20-i*10)/i)-1;return u(0<=s&&s<=9),t+=s*e.PENALTY_N4,u(0<=t&&t<=2568888),t}getAlignmentPatternPositions(){if(this.version==1)return[];{let t=Math.floor(this.version/7)+2,n=Math.floor((this.version*8+t*3+5)/(t*4-4))*2,i=[6];for(let s=this.size-7;i.length<t;s-=n)i.splice(1,0,s);return i}}static getNumRawDataModules(t){if(t<e.MIN_VERSION||t>e.MAX_VERSION)throw new RangeError("Version number out of range");let n=(16*t+128)*t+64;if(t>=2){let i=Math.floor(t/7)+2;n-=(25*i-10)*i-55,t>=7&&(n-=36)}return u(208<=n&&n<=29648),n}static getNumDataCodewords(t,n){return Math.floor(e.getNumRawDataModules(t)/8)-e.ECC_CODEWORDS_PER_BLOCK[n.ordinal][t]*e.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][t]}static reedSolomonComputeDivisor(t){if(t<1||t>255)throw new RangeError("Degree out of range");let n=[];for(let s=0;s<t-1;s++)n.push(0);n.push(1);let i=1;for(let s=0;s<t;s++){for(let l=0;l<n.length;l++)n[l]=e.reedSolomonMultiply(n[l],i),l+1<n.length&&(n[l]^=n[l+1]);i=e.reedSolomonMultiply(i,2)}return n}static reedSolomonComputeRemainder(t,n){let i=n.map(s=>0);for(let s of t){let l=s^i.shift();i.push(0),n.forEach((f,d)=>i[d]^=e.reedSolomonMultiply(f,l))}return i}static reedSolomonMultiply(t,n){if(t>>>8||n>>>8)throw new RangeError("Byte out of range");let i=0;for(let s=7;s>=0;s--)i=i<<1^(i>>>7)*285,i^=(n>>>s&1)*t;return u(i>>>8==0),i}finderPenaltyCountPatterns(t){let n=t[1];u(n<=this.size*3);let i=n>0&&t[2]==n&&t[3]==n*3&&t[4]==n&&t[5]==n;return(i&&t[0]>=n*4&&t[6]>=n?1:0)+(i&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,i){return t&&(this.finderPenaltyAddHistory(n,i),n=0),n+=this.size,this.finderPenaltyAddHistory(n,i),this.finderPenaltyCountPatterns(i)}finderPenaltyAddHistory(t,n){n[0]==0&&(t+=this.size),n.pop(),n.unshift(t)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}a.QrCode=e;function r(h,t,n){if(t<0||t>31||h>>>t)throw new RangeError("Value out of range");for(let i=t-1;i>=0;i--)n.push(h>>>i&1)}function o(h,t){return(h>>>t&1)!=0}function u(h){if(!h)throw new Error("Assertion error")}class c{constructor(t,n,i){if(this.mode=t,this.numChars=n,this.bitData=i,n<0)throw new RangeError("Invalid argument");this.bitData=i.slice()}mode;numChars;bitData;static makeBytes(t){let n=[];for(let i of t)r(i,8,n);return new c(c.Mode.BYTE,t.length,n)}static makeNumeric(t){if(!c.isNumeric(t))throw new RangeError("String contains non-numeric characters");let n=[];for(let i=0;i<t.length;){let s=Math.min(t.length-i,3);r(parseInt(t.substring(i,i+s),10),s*3+1,n),i+=s}return new c(c.Mode.NUMERIC,t.length,n)}static makeAlphanumeric(t){if(!c.isAlphanumeric(t))throw new RangeError("String contains unencodable characters in alphanumeric mode");let n=[],i;for(i=0;i+2<=t.length;i+=2){let s=c.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;s+=c.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),r(s,11,n)}return i<t.length&&r(c.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,n),new c(c.Mode.ALPHANUMERIC,t.length,n)}static makeSegments(t){return t==""?[]:c.isNumeric(t)?[c.makeNumeric(t)]:c.isAlphanumeric(t)?[c.makeAlphanumeric(t)]:[c.makeBytes(c.toUtf8ByteArray(t))]}static makeEci(t){let n=[];if(t<0)throw new RangeError("ECI assignment value out of range");if(t<128)r(t,8,n);else if(t<16384)r(2,2,n),r(t,14,n);else if(t<1e6)r(6,3,n),r(t,21,n);else throw new RangeError("ECI assignment value out of range");return new c(c.Mode.ECI,0,n)}static isNumeric(t){return c.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return c.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(t,n){let i=0;for(let s of t){let l=s.mode.numCharCountBits(n);if(s.numChars>=1<<l)return 1/0;i+=4+l+s.bitData.length}return i}static toUtf8ByteArray(t){t=encodeURI(t);let n=[];for(let i=0;i<t.length;i++)t.charAt(i)!="%"?n.push(t.charCodeAt(i)):(n.push(parseInt(t.substring(i+1,i+3),16)),i+=2);return n}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}a.QrSegment=c})(w||(w={}));(a=>{let e;(r=>{class o{constructor(c,h){this.ordinal=c,this.formatBits=h}ordinal;formatBits;static LOW=new o(0,1);static MEDIUM=new o(1,0);static QUARTILE=new o(2,3);static HIGH=new o(3,2)}r.Ecc=o})(e=a.QrCode||(a.QrCode={}))})(w||(w={}));(a=>{let e;(r=>{class o{constructor(c,h){this.modeBits=c,this.numBitsCharCount=h}modeBits;numBitsCharCount;static NUMERIC=new o(1,[10,12,14]);static ALPHANUMERIC=new o(2,[9,11,13]);static BYTE=new o(4,[8,16,16]);static KANJI=new o(8,[8,10,12]);static ECI=new o(7,[0,0,0]);numCharCountBits(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}}r.Mode=o})(e=a.QrSegment||(a.QrSegment={}))})(w||(w={}));var v=w.QrCode,$=w.QrSegment;var tt=4,x=["L","M","Q","H"],P=[v.Ecc.LOW,v.Ecc.MEDIUM,v.Ecc.QUARTILE,v.Ecc.HIGH];function H(a){if(a==null||a.trim()==="")return 1;let e=a.trim().toUpperCase(),r=x.indexOf(e);return r!==-1?r:/^[0-3]$/.test(e)?Number(e):null}function Y(a,e=1){let r=P[e]??P[1],o;try{o=v.encodeSegments($.makeSegments(a),r,1,40,-1,!1)}catch(c){let h=new RangeError(c instanceof Error?c.message:String(c));throw h.reason=/too long/i.test(h.message)?"capacity":"encoding",h}let u=[];for(let c=0;c<o.size;c++){let h=[];for(let t=0;t<o.size;t++)h.push(o.getModule(t,c));u.push(h)}return{version:o.version,size:o.size,ecl:P.indexOf(r),modules:u}}function q(a,e){let r=a+tt*2,o=Math.max(1,Math.floor(e/r)),u=Math.max(e,o*r),c=Math.floor((u-o*a)/2);return{cell:o,offset:c,edge:u}}function U([a,e,r]){let o=u=>{let c=u/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4};return .2126*o(a)+.7152*o(e)+.0722*o(r)}function V(a,e){let r=[];(e[3]??1)<1&&r.push("the background is not opaque, so the code takes on whatever is behind it"),(a[3]??1)<1&&r.push("the module colour is not opaque");let o=U(a),u=U(e);o>u&&r.push("modules are lighter than the background (inverted codes are rejected by many scanners)");let c=(Math.max(o,u)+.05)/(Math.min(o,u)+.05);return c<4&&r.push(`contrast is ${c.toFixed(2)}:1 (aim for at least 4:1)`),r}var et=200,nt="#000",it="#fff",I=class extends N{#t=null;#e=null;#n="";#o=!1;#i="";#s="";static get observedAttributes(){return["value","size","color","background","error-correction","data-label-prefix"]}get value(){return this.getAttribute("value")||this.#n}set value(e){e==null||e===""?this.removeAttribute("value"):this.setAttribute("value",String(e))}setup(){if(!this.#e){this.#n=(this.textContent??"").trim();let e=document.createElement("span");e.setAttribute("data-qr-caption",""),e.append(...this.childNodes),!this.#n&&!e.children.length&&(e.textContent=this.value,this.#o=!0),this.#e=e}return this.#t||(this.#t=document.createElement("canvas"),this.#t.setAttribute("role","img")),this.#t.parentNode!==this&&this.prepend(this.#t),this.#e.parentNode!==this&&this.append(this.#e),this.#r(),this.#a(),!0}#a(){if(typeof window.matchMedia!="function")return;let e=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`);this.listen(e,"change",()=>{this.isConnected&&(this.#r(),this.#a())},{once:!0})}attributeChangedCallback(){!this.hasAttribute("data-upgraded")||!this.isConnected||this.#r()}#r(){let e=this.#t,r=this.value;if(e.setAttribute("aria-label",this.getAttribute("data-label-prefix")||"QR code"),this.#o&&this.#e&&this.#e.textContent!==r&&(this.#e.textContent=r),this.removeAttribute("data-error"),!r){this.#c();return}let o=this.getAttribute("error-correction"),u=H(o);u===null&&(console.warn(`<qr-code>: error-correction="${o}" is not L, M, Q, H or 0-3; using M.`),u=1);let c;try{c=Y(r,u)}catch(m){let p=m.reason||"encoding";this.#c(),this.setAttribute("data-error",p),this.dispatchEvent(new CustomEvent("qr-code:error",{bubbles:!0,detail:{reason:p,value:r,errorCorrection:x[u],message:m.message}}));return}let h=Math.max(1,parseInt(this.getAttribute("size")??"",10)||et),t=Math.max(1,window.devicePixelRatio||1),{cell:n,offset:i,edge:s}=q(c.size,Math.round(h*t));e.hidden=!1,e.width=s,e.height=s,e.style.inlineSize=`${h}px`;let l=this.#l(this.getAttribute("color"),nt),f=this.#l(this.getAttribute("background"),it);this.#u(l,f);let d=e.getContext("2d");if(d){d.clearRect(0,0,s,s),d.fillStyle=f.css,d.fillRect(0,0,s,s),d.fillStyle=l.css;for(let m=0;m<c.size;m++)for(let p=0;p<c.size;p++)c.modules[m][p]&&d.fillRect(i+p*n,i+m*n,n,n);this.#i=r}}#c(){let e=this.#t;e.hidden=!0,e.width=0,e.height=0,this.#i=""}#l(e,r){let o=this.#t,u=e?.trim()||r,c=o.style.color;o.style.color="",o.style.color=u,o.style.color||(console.warn(`<qr-code>: "${u}" is not a valid colour; using ${r}.`),o.style.color=r);let h=getComputedStyle(o).color;o.style.color=c;let t=(h.match(/[\d.]+/g)||[]).map(Number),n=[t[0]??0,t[1]??0,t[2]??0,t[3]??1];return{css:h,rgba:n}}#u(e,r){if(!this.hasAttribute("color")&&!this.hasAttribute("background"))return;let o=`${e.css}|${r.css}`;if(o===this.#s)return;this.#s=o;let u=V(e.rgba,r.rgba);u.length&&console.warn(`<qr-code>: color="${e.css}" on background="${r.css}" may not scan: ${u.join("; ")}.`,this)}toDataURL(e="image/png"){return!this.#t||!this.#i?"":this.#t.toDataURL(e)}async copy({button:e}={}){let r=this.#t;if(!r||!this.#i)return!1;let o=this.#i,u=await new Promise(c=>r.toBlob(c,"image/png"));return O({text:o,blob:u||void 0},{button:e,announceMessage:this.getAttribute("data-label-copied")||"QR code copied"})}};B("qr-code",I);export{I 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))}_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};
1
+ var O=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function f(r,t,e={}){let i=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=E.get(r);if(customElements.get(r)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(r,o),customElements.define(r,t)}var u=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,o){t.addEventListener(e,i,o),this.#i.push(()=>t.removeEventListener(e,i,o))}_reinit(){for(let t of this.#i)t();this.#i=[],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 o=`--${t}`;e?i.add(o):i.delete(o)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var b=CSS.supports("anchor-name","--x"),P=CSS.supports("position-area","bottom"),k=(()=>{let r=document.createElement("span");return r.setAttribute("popover","hint"),r.popover==="hint"})(),N=["auto","manual","hint"];function M(r){let t=N.includes(r||"")?r:"auto";return t==="hint"&&!k?"auto":t}var q=["top","bottom","left","right","inset-inline-start","inset-inline-end"],T=["position","top","left","right","bottom","margin"],w=8,L=0,V=0;function C(r){return!r||r==="none"?[]:r.split(",").map(t=>t.trim()).filter(Boolean)}var g=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#i=null;#t=null;#e=`--pop-over-anchor-${++V}`;#s=!1;#o=!1;#r=!1;setup(){if(this.id||(this.id=`pop-over-${++L}`),(!this.hasAttribute("popover")||this.#s)&&this.#n(),this.#u(),this.#h(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!b&&t.newState==="open"&&this.#i&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!b){let t=()=>{this.matches(":popover-open")&&this.#i&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#o&&(q.forEach(t=>this.style.removeProperty(t)),this.#o=!1),this.#r&&(T.forEach(t=>this.style.removeProperty(t)),this.#r=!1),this.#i=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#s=!0);return}if(t==="data-mode"){this.#n();return}this._reinit()}}#n(){let t=M(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#s=!0}show(){this.matches(":popover-open")||(this.showPopover(),!b&&this.#i&&this.matches(":popover-open")&&this.#a())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#u(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#i=e}else this.#i=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#h(){if(!this.#i||!b)return;let t=this.#i,e=t.style.getPropertyValue("anchor-name"),i=C(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#e)||i.push(this.#e),t.style.setProperty("anchor-name",i.join(", ")),this.#t=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),P||this.#d(this.dataset.position||"bottom")}#c(){if(this.#i&&this.#t){let t=C(this.#i.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#t);t.length?this.#i.style.setProperty("anchor-name",t.join(", ")):this.#i.style.removeProperty("anchor-name")}this.#t=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#d(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},o={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],a=o[s]||o.bottom;Object.entries(a).forEach(([l,n])=>this.style.setProperty(l,n)),this.#o=!0}#a(){if(!this.#i)return;let t=this.#i.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#p(),o=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#r=!0;let a=this.offsetWidth,l=this.offsetHeight,n=e.split("-")[0];["top","bottom","left","right"].includes(n)||(n="bottom");let d={top:t.top-i,bottom:s-t.bottom-i,left:t.left-i,right:o-t.right-i},p={top:"bottom",bottom:"top",left:"right",right:"left"},x=n==="top"||n==="bottom"?l:a;d[n]<x&&d[p[n]]>d[n]&&(n=p[n]);let h,c;switch(n){case"top":h=t.top-l-i,c=t.left;break;case"left":h=t.top,c=t.left-a-i;break;case"right":h=t.top,c=t.right+i;break;default:h=t.bottom+i,c=t.left;break}if(n==="top"||n==="bottom"){let m=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==m?t.right-a:t.left}else e.endsWith("-end")&&(h=t.bottom-l);let A=(m,v,$)=>Math.max(w,Math.min(m,$-v-w));c=A(c,a,o),h=A(h,l,s),this.style.top=`${Math.round(h)}px`,this.style.left=`${Math.round(c)}px`}#p(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};f("pop-over",g);var B=0,S={one:"{count} reaction",other:"{count} reactions"},y=class extends u{static get observedAttributes(){return["data-disabled"]}#i=null;#t=null;#e=null;#s=null;#o=new Set;setup(){this.setAttribute("role","toolbar"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("data-label-toolbar")||"Reactions"),this.#i=this.querySelector(":scope > template[data-palette]"),this.#h().forEach(t=>this.#c(t)),this.#C(),this.#S(),this.#m(),this.#l(),this.listen(this,"click",this.#a),this.listen(this,"keydown",this.#p),this.#e&&(this.listen(this.#e,"pop-over:show",this.#v),this.listen(this.#e,"pop-over:hide",this.#E),this.listen(this.#e,"toggle",this.#w))}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||t==="data-disabled"&&(this.#m(),this.#l())}#r(){return this.closest("[lang]")?.lang||void 0}#n(t){try{return new Intl.NumberFormat(this.#r()).format(t)}catch{return String(t)}}#u(t){let e="other";try{e=new Intl.PluralRules(this.#r()).select(t)}catch{}return(this.getAttribute(`data-label-count-${e}`)??this.getAttribute("data-label-count-other")??S[e]??S.other).replaceAll("{count}",this.#n(t))}#h(){return[...this.querySelectorAll(":scope > button[data-reaction]")]}#c(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.type="button";let e=t.dataset.label||t.getAttribute("aria-label");e&&(t.dataset.label=e);let i=t.textContent?.trim()??"";t.replaceChildren();let o=document.createElement("span");o.className="reaction-emoji",o.setAttribute("aria-hidden","true"),o.textContent=i;let s=document.createElement("span");s.className="reaction-count",s.setAttribute("aria-hidden","true"),t.append(o,s),this.#d(t)}#d(t){let e=Number(t.dataset.count)||0,i=t.hasAttribute("data-mine"),o=t.dataset.label||t.querySelector(".reaction-emoji")?.textContent||t.dataset.reaction||"",s=t.querySelector(".reaction-count");s&&(s.textContent=e>0?this.#n(e):""),t.setAttribute("aria-pressed",i?"true":"false"),t.setAttribute("aria-label",`${o}, ${this.#u(e)}`)}#a=t=>{let e=t.target?.closest?.("button[data-reaction]");e&&(e.parentElement===this?this.#b(e):this.#s?.contains(e)&&this.#A(e))};#p=t=>{let e=t.target;this.#s?.contains(e)?this.#x(t):this.#$(t)};#b(t){if(this.hasAttribute("data-disabled")||t.hasAttribute("data-pending"))return;let e=t.dataset.reaction??"",i=Number(t.dataset.count)||0,o=t.hasAttribute("data-mine");t.setAttribute("data-pending",""),t.setAttribute("aria-busy","true"),this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:e,action:o?"remove":"add",count:i,mine:o}}))}#A(t){if(this.hasAttribute("data-disabled"))return;let e=t.dataset.reaction??"",i=this.#y(e);i?this.#b(i):this.#o.has(e)||(this.#o.add(e),this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:e,action:"add",count:0,mine:!1}}))),this.#e?.hide(),this.#t?.focus()}#v=()=>{this.#t?.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-open",{bubbles:!0}))};#E=()=>{this.#t?.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-close",{bubbles:!0}))};#w=t=>{t.newState==="open"&&this.#s?.querySelector("button")?.focus()};#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.appendChild(this.#t))}#S(){if(!this.#i||!this.#t||this.#e?.parentNode===this)return;let t=`reaction-bar-palette-${++B}`;this.#t.setAttribute("popovertarget",t),this.#e=document.createElement("pop-over"),this.#e.id=t,this.#e.className="reaction-palette",this.#e.dataset.position="top",this.#e.setAttribute("role","dialog"),this.#e.setAttribute("aria-label",this.getAttribute("data-label-dialog")||"Choose a reaction"),this.#s=document.createElement("div"),this.#s.className="reaction-palette-list",this.#s.setAttribute("role","group"),this.#s.setAttribute("aria-label",this.getAttribute("aria-label")||"Reactions"),[...this.#i.content.cloneNode(!0).querySelectorAll("button[data-reaction]")].forEach(i=>{i.type="button",i.classList.add("reaction-palette-option"),!i.hasAttribute("aria-label")&&i.dataset.label&&i.setAttribute("aria-label",i.dataset.label),this.#s?.appendChild(i)}),this.#e.appendChild(this.#s),this.appendChild(this.#e)}#m(){let t=this.hasAttribute("data-disabled");this.#t&&(this.#t.disabled=t);for(let e of this.#h())t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled");t&&this.#e?.matches(":popover-open")&&this.#e.hide()}#x(t){if(!this.#s)return;let e=[...this.#s.querySelectorAll("button")],i=e.indexOf(document.activeElement);if(i===-1)return;let o=this.#g(t.key,!0),s;if(o)s=(i+o+e.length)%e.length;else if(t.key==="Home")s=0;else if(t.key==="End")s=e.length-1;else return;t.preventDefault(),e[s].focus()}#g(t,e){let i=getComputedStyle(this).direction==="rtl";return t==="ArrowRight"?i?-1:1:t==="ArrowLeft"?i?1:-1:e&&t==="ArrowDown"?1:e&&t==="ArrowUp"?-1:0}#f(){return[...this.querySelectorAll(":scope > button[data-reaction], :scope > .reaction-trigger")].filter(t=>!t.disabled)}#l(t=null){let e=this.#f(),i=t&&e.includes(t)?t:e.find(o=>o.getAttribute("tabindex")==="0")??e[0];e.forEach(o=>o.setAttribute("tabindex",o===i?"0":"-1")),this.#t?.disabled&&this.#t.removeAttribute("tabindex")}#$(t){let e=this.#f(),i=e.indexOf(document.activeElement);if(i===-1)return;let o=this.#g(t.key,!1),s;if(o)s=(i+o+e.length)%e.length;else if(t.key==="Home")s=0;else if(t.key==="End")s=e.length-1;else return;t.preventDefault(),this.#l(e[s]),e[s].focus()}#y(t){return this.querySelector(`:scope > button[data-reaction="${CSS.escape(t)}"]`)}setCount(t,e,i={}){let o=Number(e)||0;this.#o.delete(t);let s=this.#y(t);if(o<=0){if(s){let a=this.#f(),l=a.indexOf(s),n=a[l+1]??a[l-1]??null,d=s.contains(document.activeElement),p=s.getAttribute("tabindex")==="0";s.remove(),this.#l(p||d?n:null),d&&n?.focus()}return}if(!s){let a=this.#i?.content.querySelector(`button[data-reaction="${CSS.escape(t)}"]`);a?s=a.cloneNode(!0):(s=document.createElement("button"),s.dataset.reaction=t,s.textContent=t),this.insertBefore(s,this.#t?.parentNode===this?this.#t:null),this.#c(s),this.hasAttribute("data-disabled")&&s.setAttribute("aria-disabled","true")}s.dataset.count=String(o),i.mine===!0?s.setAttribute("data-mine",""):i.mine===!1&&s.removeAttribute("data-mine"),s.removeAttribute("data-pending"),s.removeAttribute("aria-busy"),this.#d(s),this.#l()}openPalette(){this.hasAttribute("data-disabled")||this.#e?.show()}closePalette(){this.#e?.hide()}};f("reaction-bar",y);export{y as ReactionBar};
2
2
  //# sourceMappingURL=reaction-bar.js.map