vanilla-breeze 0.6.2 → 0.7.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 (240) hide show
  1. package/custom-elements.json +6768 -6425
  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 +6 -6
  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 +13 -13
  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 +35 -35
  23. package/dist/cdn/components/comment-thread.js +38 -38
  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 +3 -3
  41. package/dist/cdn/components/glossary-index.js +1 -1
  42. package/dist/cdn/components/glossary-wc.js +1 -1
  43. package/dist/cdn/components/heading-links.js +1 -1
  44. package/dist/cdn/components/highlight-wc.js +2 -2
  45. package/dist/cdn/components/icon-wc.js +2 -2
  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 +58 -54
  50. package/dist/cdn/components/markdown-editor.js +25 -25
  51. package/dist/cdn/components/markdown-viewer.js +27 -27
  52. package/dist/cdn/components/nav-bar.js +1 -1
  53. package/dist/cdn/components/note-wc.js +2 -2
  54. package/dist/cdn/components/notification-wc.js +23 -23
  55. package/dist/cdn/components/page-info.js +6 -6
  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 -1
  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 -1
  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/reading-progress.js +1 -1
  69. package/dist/cdn/components/recently-visited.js +1 -1
  70. package/dist/cdn/components/score-card.js +2 -2
  71. package/dist/cdn/components/selection-menu.js +1 -1
  72. package/dist/cdn/components/settings-panel.js +6 -6
  73. package/dist/cdn/components/share-wc.js +2 -2
  74. package/dist/cdn/components/short-cuts.js +1 -1
  75. package/dist/cdn/components/site-index.js +1 -1
  76. package/dist/cdn/components/site-map.js +1 -1
  77. package/dist/cdn/components/site-search.js +1 -1
  78. package/dist/cdn/components/slide-accept.js +1 -1
  79. package/dist/cdn/components/social-embed.js +1 -1
  80. package/dist/cdn/components/social-links.js +2 -0
  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 +20 -20
  88. package/dist/cdn/components/time-index.js +1 -1
  89. package/dist/cdn/components/time-picker.js +1 -1
  90. package/dist/cdn/components/toast-msg.js +2 -2
  91. package/dist/cdn/components/tool-tip.js +1 -1
  92. package/dist/cdn/components/topic-map.js +4 -4
  93. package/dist/cdn/components/trust-filter.js +1 -1
  94. package/dist/cdn/components/version-switcher.js +6 -6
  95. package/dist/cdn/components/video-player.js +4 -4
  96. package/dist/cdn/components/watch-wc.js +2 -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/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
  100. package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
  101. package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
  103. package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
  105. package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
  107. package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
  109. package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
  110. package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
  111. package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
  112. package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
  113. package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
  114. package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
  115. package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
  116. package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
  117. package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
  118. package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
  119. package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  120. package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
  121. package/dist/cdn/packs/effects.full.js +1 -1
  122. package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  123. package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
  124. package/dist/cdn/packs/kawaii.full.css +1 -1
  125. package/dist/cdn/packs/kawaii.theme.css +1 -1
  126. package/dist/cdn/packs/manifest.json +4 -4
  127. package/dist/cdn/packs/prototype.full.js +1 -1
  128. package/dist/cdn/packs/ui.full.js +19 -19
  129. package/dist/cdn/themes/8bit.tokens.json +8 -37
  130. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  131. package/dist/cdn/themes/alpha1999.css +1 -1
  132. package/dist/cdn/themes/alpha1999.tokens.json +3 -6
  133. package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
  134. package/dist/cdn/themes/art-deco.css +1 -1
  135. package/dist/cdn/themes/art-deco.tokens.json +5 -11
  136. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  137. package/dist/cdn/themes/bauhaus.css +1 -1
  138. package/dist/cdn/themes/bauhaus.tokens.json +13 -7
  139. package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
  140. package/dist/cdn/themes/brutalist.tokens.json +5 -11
  141. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  142. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  143. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  144. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  145. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  146. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  147. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  148. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  149. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  150. package/dist/cdn/themes/classic-dark.tokens.json +41 -41
  151. package/dist/cdn/themes/classic.tokens.json +25 -31
  152. package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
  153. package/dist/cdn/themes/claymorphism.css +1 -1
  154. package/dist/cdn/themes/claymorphism.tokens.json +531 -135
  155. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  156. package/dist/cdn/themes/clinical.tokens.json +1 -1
  157. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  158. package/dist/cdn/themes/cottagecore.css +1 -1
  159. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  160. package/dist/cdn/themes/cyber.css +1 -1
  161. package/dist/cdn/themes/cyber.tokens.json +5 -11
  162. package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
  163. package/dist/cdn/themes/dawn.css +1 -1
  164. package/dist/cdn/themes/dawn.tokens.json +1 -1
  165. package/dist/cdn/themes/dracula.tokens.json +1 -1
  166. package/dist/cdn/themes/dusk.tokens.json +1 -1
  167. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  168. package/dist/cdn/themes/editorial.tokens.json +19 -16
  169. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  170. package/dist/cdn/themes/financial.css +1 -1
  171. package/dist/cdn/themes/financial.tokens.json +1 -1
  172. package/dist/cdn/themes/genai.css +1 -1
  173. package/dist/cdn/themes/genai.tokens.json +1 -1
  174. package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
  175. package/dist/cdn/themes/glassmorphism.css +1 -1
  176. package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
  177. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  178. package/dist/cdn/themes/government.tokens.json +1 -1
  179. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  180. package/dist/cdn/themes/gruvbox.css +1 -1
  181. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  182. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  183. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  184. package/dist/cdn/themes/journal-dark.tokens.json +3 -27
  185. package/dist/cdn/themes/journal.css +1 -1
  186. package/dist/cdn/themes/journal.tokens.json +21 -21
  187. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  188. package/dist/cdn/themes/kawaii.css +1 -1
  189. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  190. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  191. package/dist/cdn/themes/magna.css +1 -1
  192. package/dist/cdn/themes/magna.tokens.json +2 -14
  193. package/dist/cdn/themes/manifest.json +25 -25
  194. package/dist/cdn/themes/midnight.tokens.json +1 -1
  195. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  196. package/dist/cdn/themes/minimal.tokens.json +25 -27
  197. package/dist/cdn/themes/modern-dark.tokens.json +41 -41
  198. package/dist/cdn/themes/modern.css +1 -1
  199. package/dist/cdn/themes/modern.tokens.json +21 -21
  200. package/dist/cdn/themes/nes-dark.tokens.json +3 -27
  201. package/dist/cdn/themes/nes.tokens.json +10 -39
  202. package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
  203. package/dist/cdn/themes/neumorphism.css +1 -1
  204. package/dist/cdn/themes/neumorphism.tokens.json +266 -134
  205. package/dist/cdn/themes/nord-dark.tokens.json +3 -27
  206. package/dist/cdn/themes/nord.css +1 -1
  207. package/dist/cdn/themes/nord.tokens.json +1 -1
  208. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  209. package/dist/cdn/themes/organic.tokens.json +5 -14
  210. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  211. package/dist/cdn/themes/rose-pine.css +1 -1
  212. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  213. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  214. package/dist/cdn/themes/rough.tokens.json +1 -1
  215. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  216. package/dist/cdn/themes/solarized.tokens.json +1 -1
  217. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  218. package/dist/cdn/themes/startup.css +1 -1
  219. package/dist/cdn/themes/startup.tokens.json +1 -1
  220. package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
  221. package/dist/cdn/themes/super2026.css +1 -1
  222. package/dist/cdn/themes/super2026.tokens.json +1 -1
  223. package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
  224. package/dist/cdn/themes/swiss.tokens.json +34 -68
  225. package/dist/cdn/themes/terminal.tokens.json +286 -120
  226. package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
  227. package/dist/cdn/themes/tokyo-night.css +1 -1
  228. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  229. package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
  230. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  231. package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
  232. package/dist/cdn/themes/win9x.tokens.json +9 -9
  233. package/dist/cdn/vanilla-breeze-autoload.js +113 -108
  234. package/dist/cdn/vanilla-breeze-charts.js +13 -13
  235. package/dist/cdn/vanilla-breeze-core.css +1 -1
  236. package/dist/cdn/vanilla-breeze-core.js +80 -75
  237. package/dist/cdn/vanilla-breeze-extras.js +31 -31
  238. package/dist/cdn/vanilla-breeze.css +1 -1
  239. package/dist/cdn/vanilla-breeze.js +133 -133
  240. package/package.json +3 -3
@@ -1,12 +1,12 @@
1
- var _e=window.matchMedia("(prefers-reduced-motion: reduce)");var te=new Map;function ae(t,e,a={}){let r=a.priority??10,s={impl:e,bundle:a.bundle,contract:a.contract,priority:r},n=te.get(t);if(customElements.get(t)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${a.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${a.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}". Skipping "${a.bundle}" (first wins at equal priority).`);return}te.set(t,s),customElements.define(t,e)}var R=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 e of this.#r)e();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,a,r,s){e.addEventListener(a,r,s),this.#r.push(()=>e.removeEventListener(a,r,s))}_reinit(){for(let e of this.#r)e();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,a){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{a?r.add(e):r.delete(e)}catch{let s=`--${e}`;a?r.add(s):r.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}#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 w=new Map,z=new Map;var re=null;function U(){if(typeof window<"u"&&window.__VB_THEME_BASE)return String(window.__VB_THEME_BASE).replace(/\/$/,"");if(re)return re;if(typeof document<"u"){let t=document.querySelectorAll('script[src*="vanilla-breeze"]');for(let e of t){let a=e.getAttribute("src");if(a){let r=a.lastIndexOf("/");if(r!==-1)return a.slice(0,r)}}}return"/cdn"}var se=new Set(["default","a11y-high-contrast","a11y-large-text","a11y-dyslexia","modern","minimal","classic"]),ke=new Set(["kawaii","memphis"]);function W(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):String(t).replace(/["\\]/g,"\\$&")}function ne(t){document.querySelectorAll(`link[data-vb-theme-preload="${W(t)}"]`).forEach(e=>e.remove())}function O(t){return ke.has(t)}function ie(t,e){return`${e}/themes/${t}.css`}function oe(t,e){if(!O(t))return Promise.resolve();if(z.has(t))return z.get(t);let a=import(`${e}/packs/${t}.full.js`).catch(()=>{});return z.set(t,a),a}function Be(t,e){let a=U(),r=()=>{(O(e)||t.hasAttribute("data-vb-pack"))&&oe(e,a)};return t.getAttribute("data-vb-theme-state")==="error"?Promise.reject(new Error(`Failed to load theme: ${e}`)):t.getAttribute("data-vb-theme-state")==="ready"||t.sheet?(r(),Promise.resolve()):new Promise((s,n)=>{let i=()=>{t.setAttribute("data-vb-theme-state","ready"),m(),r(),s(void 0)},c=()=>{t.setAttribute("data-vb-theme-state","error"),w.delete(e),m(),n(new Error(`Failed to load theme: ${e}`))},m=()=>{t.removeEventListener("load",i),t.removeEventListener("error",c)};t.addEventListener("load",i,{once:!0}),t.addEventListener("error",c,{once:!0})})}async function M(t){if(!t||se.has(t))return;if(w.has(t))return w.get(t);if(typeof document<"u"){let r=document.querySelector(`link[data-vb-theme="${W(t)}"]`);if(r){let s=Be(r,t);return w.set(t,s),s}}let e=U(),a=O(t)?Ce(t,e):Ae(t,e);return w.set(t,a),a}function ce(t){if(!t||se.has(t)||O(t)||w.has(t)||typeof document>"u")return;let e=W(t);if(document.querySelector(`link[data-vb-theme="${e}"], link[data-vb-theme-preload="${e}"]`))return;let r=U(),s=ie(t,r),n=document.createElement("link");n.rel="preload",n.as="style",n.href=s,n.setAttribute("data-vb-theme-preload",t),document.head.appendChild(n)}async function Ae(t,e){let a=ie(t,e);return new Promise((r,s)=>{ne(t);let n=document.createElement("link");n.rel="stylesheet",n.href=a,n.setAttribute("data-vb-theme",t),n.setAttribute("data-vb-theme-state","loading"),n.onload=()=>{n.setAttribute("data-vb-theme-state","ready"),r()},n.onerror=()=>{n.setAttribute("data-vb-theme-state","error"),n.remove(),w.delete(t),s(new Error(`Failed to load theme: ${t}`))},document.head.appendChild(n)})}function Ce(t,e){let a=`${e}/packs/${t}.theme.css`,r=`${e}/packs/${t}.effects.css`;return new Promise((s,n)=>{ne(t);let i=document.createElement("link");i.rel="stylesheet",i.href=a,i.setAttribute("data-vb-theme",t),i.setAttribute("data-vb-pack",t),i.setAttribute("data-vb-theme-state","loading"),i.onload=()=>{i.setAttribute("data-vb-theme-state","ready");let c=document.createElement("link");c.rel="stylesheet",c.href=r,c.setAttribute("data-vb-pack-effects",t),document.head.appendChild(c),oe(t,e),s()},i.onerror=()=>{i.setAttribute("data-vb-theme-state","error"),i.remove(),w.delete(t),n(new Error(`Failed to load pack: ${t}`))},document.head.appendChild(i)})}var de=[{id:"auto",name:"Auto",icon:"monitor"},{id:"light",name:"Light",icon:"sun"},{id:"dark",name:"Dark",icon:"moon"}],he=[{id:"default",name:"Default",swatchBg:"#3b82f6",seeds:{}},{id:"ocean",name:"Ocean",swatchBg:"#0891b2",seeds:{"--hue-primary":200,"--hue-secondary":180,"--hue-accent":45,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"45%","--chroma-secondary":.1,"--lightness-accent":"70%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"forest",name:"Forest",swatchBg:"#059669",seeds:{"--hue-primary":145,"--hue-secondary":90,"--hue-accent":30,"--lightness-primary":"45%","--chroma-primary":.15,"--lightness-secondary":"55%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"58%","--chroma-primary":.12}},{id:"sunset",name:"Sunset",swatchBg:"#ea580c",seeds:{"--hue-primary":25,"--hue-secondary":0,"--hue-accent":280,"--lightness-primary":"57%","--chroma-primary":.2,"--lightness-secondary":"55%","--chroma-secondary":.18,"--lightness-accent":"55%","--chroma-accent":.18},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.16}},{id:"rose",name:"Rose",swatchBg:"#e11d48",seeds:{"--hue-primary":350,"--hue-secondary":330,"--hue-accent":200,"--lightness-primary":"55%","--chroma-primary":.18,"--lightness-secondary":"50%","--chroma-secondary":.14,"--lightness-accent":"60%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.14}},{id:"lavender",name:"Lavender",swatchBg:"#a855f7",seeds:{"--hue-primary":280,"--hue-secondary":300,"--hue-accent":60,"--lightness-primary":"55%","--chroma-primary":.14,"--lightness-secondary":"50%","--chroma-secondary":.12,"--lightness-accent":"70%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.12}},{id:"coral",name:"Coral",swatchBg:"#f97316",seeds:{"--hue-primary":15,"--hue-secondary":25,"--hue-accent":180,"--lightness-primary":"57%","--chroma-primary":.18,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"55%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.15}},{id:"slate",name:"Slate",swatchBg:"#64748b",seeds:{"--hue-primary":220,"--hue-secondary":210,"--hue-accent":45,"--lightness-primary":"48%","--chroma-primary":.1,"--lightness-secondary":"45%","--chroma-secondary":.06,"--lightness-accent":"68%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.08}},{id:"emerald",name:"Emerald",swatchBg:"#10b981",seeds:{"--hue-primary":160,"--hue-secondary":140,"--hue-accent":30,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"48%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"amber",name:"Amber",swatchBg:"#f59e0b",seeds:{"--hue-primary":45,"--hue-secondary":30,"--hue-accent":240,"--lightness-primary":"56%","--chroma-primary":.16,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"52%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"68%","--chroma-primary":.14}},{id:"indigo",name:"Indigo",swatchBg:"#6366f1",seeds:{"--hue-primary":250,"--hue-secondary":270,"--hue-accent":35,"--lightness-primary":"48%","--chroma-primary":.18,"--lightness-secondary":"45%","--chroma-secondary":.14,"--lightness-accent":"68%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"62%","--chroma-primary":.14}}],le=[{id:"default",name:"Default",hue:210,shape:"balanced",character:"The default",swatchBg:"#3b82f6",tier:"core"},{id:"modern",name:"Modern",hue:270,shape:"rounded",character:"Vibrant & elevated",swatchBg:"#6366f1",tier:"core"},{id:"minimal",name:"Minimal",hue:240,shape:"sharp",character:"Clean & flat",swatchBg:"#71717a",tier:"core"},{id:"classic",name:"Classic",hue:220,shape:"subtle",character:"Serif & elegant",swatchBg:"#92400e",tier:"core"}],K=[{id:"swiss",name:"Swiss",icon:"grid-3x3",character:"Precision grid",swatchBg:"#ff3e00",swatchFg:"white",tier:"showcase",category:"Design"},{id:"brutalist",name:"Brutalist",icon:"square",character:"Raw, industrial",swatchBg:"#1a1a1a",swatchFg:"#f5f5f5",tier:"showcase",category:"Design"},{id:"art-deco",name:"Art Deco",icon:"crown",character:"1920s luxury",swatchBg:"#1A1A1A",swatchFg:"#C9A84C",tier:"showcase",category:"Design"},{id:"editorial",name:"Editorial",icon:"newspaper",character:"Magazine elegance",swatchBg:"#1a1a1a",swatchFg:"#c9a227",tier:"showcase",category:"Content"},{id:"genai",name:"GenAI",icon:"sparkles",character:"AI aesthetic",swatchBg:"#1a0a2e",swatchFg:"#a855f7",tier:"showcase",category:"Modern"},{id:"glassmorphism",name:"Glass",icon:"glass-water",character:"Frosted surfaces",swatchBg:"#667eea",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"startup",name:"Startup",icon:"rocket",character:"SaaS energy",swatchBg:"#4f46e5",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"organic",name:"Organic",icon:"leaf",character:"Natural, handcrafted",swatchBg:"#2d5016",swatchFg:"#faf5e6",tier:"showcase",category:"Creative"},{id:"rough",name:"Rough",icon:"pencil",character:"Hand-drawn sketch",swatchBg:"#f5f0e8",swatchFg:"#3a3a3a",tier:"showcase",category:"Creative"},{id:"cyber",name:"Cyber",icon:"zap",character:"Neon futuristic",swatchBg:"#0a0a1a",swatchFg:"#00ff88",tier:"showcase",category:"Creative"},{id:"journal",name:"Journal",icon:"notebook-pen",character:"Dot-grid bullet journal",swatchBg:"#f3ecdc",swatchFg:"#27313f",tier:"showcase",category:"Creative"},{id:"vaporwave",name:"Vaporwave",icon:"radio",character:"Neon dreamy",swatchBg:"#2b0040",swatchFg:"#ff6ad5",tier:"showcase",category:"Aesthetic"},{id:"neumorphism",name:"Neumorph",icon:"circle",character:"Soft embossed",swatchBg:"#e0e0e0",swatchFg:"#a0a0a0",tier:"showcase",category:"Aesthetic"},{id:"bauhaus",name:"Bauhaus",icon:"shapes",character:"Geometric",swatchBg:"#F1FAEE",swatchFg:"#E63946",tier:"showcase",category:"Aesthetic"},{id:"claymorphism",name:"Clay",icon:"circle-dot",character:"Puffy 3D",swatchBg:"#f0f0f5",swatchFg:"#FF6B9D",tier:"showcase",category:"Aesthetic"},{id:"alpha1999",name:"Alpha1999",icon:"orbit",character:"Space retro-fi",swatchBg:"#0a0a14",swatchFg:"#d4880f",tier:"showcase",category:"Signature"},{id:"super2026",name:"Super2026",icon:"triangle",character:"Supergraphic bold",swatchBg:"#f5f0e6",swatchFg:"#c23616",tier:"showcase",category:"Signature"},{id:"magna",name:"Magna",icon:"orbit",character:"Odyssey 2 retro",swatchBg:"#0d0b14",swatchFg:"#f97316",tier:"showcase",category:"Signature"},{id:"win9x",name:"Win9x",icon:"monitor",character:"Classic desktop",swatchBg:"#008080",swatchFg:"#c0c0c0",tier:"showcase",category:"OS Styles"},{id:"nes",name:"NES",icon:"joystick",character:"Console pixels",swatchBg:"#bcbcbc",swatchFg:"#e40521",tier:"showcase",category:"OS Styles"},{id:"8bit",name:"8-Bit",icon:"gamepad-2",character:"Retro pixel art",swatchBg:"#000080",swatchFg:"#ffff00",tier:"showcase",category:"OS Styles"}],X=[{id:"nord",name:"Nord",icon:"snowflake",character:"Arctic calm",swatchBg:"#2E3440",swatchFg:"#81A1C1",tier:"community",category:"Editor Palettes"},{id:"solarized",name:"Solarized",icon:"sun-dim",character:"Engineered precision",swatchBg:"#002B36",swatchFg:"#268BD2",tier:"community",category:"Editor Palettes"},{id:"dracula",name:"Dracula",icon:"moon-star",character:"Dark elegance",swatchBg:"#282A36",swatchFg:"#BD93F9",tier:"community",category:"Editor Palettes"},{id:"catppuccin-mocha",name:"Catppuccin",icon:"coffee",character:"Warm pastels",swatchBg:"#1E1E2E",swatchFg:"#CBA6F7",tier:"community",category:"Editor Palettes"},{id:"catppuccin-latte",name:"Ctp Latte",icon:"coffee",character:"Cozy daytime",swatchBg:"#eff1f5",swatchFg:"#8839ef",tier:"community",category:"Editor Palettes"},{id:"catppuccin-frappe",name:"Ctp Frapp\xE9",icon:"coffee",character:"Cool twilight",swatchBg:"#303446",swatchFg:"#ca9ee6",tier:"community",category:"Editor Palettes"},{id:"catppuccin-macchiato",name:"Ctp Macchiato",icon:"coffee",character:"Deep blue",swatchBg:"#24273a",swatchFg:"#c6a0f6",tier:"community",category:"Editor Palettes"},{id:"gruvbox",name:"Gruvbox",icon:"palette",character:"Retro warmth",swatchBg:"#282828",swatchFg:"#ebdbb2",tier:"community",category:"Editor Palettes"},{id:"tokyo-night",name:"Tokyo Night",icon:"moon",character:"Night-owl vibes",swatchBg:"#1a1b26",swatchFg:"#7aa2f7",tier:"community",category:"Editor Palettes"},{id:"rose-pine",name:"Ros\xE9 Pine",icon:"flower-2",character:"Muted elegance",swatchBg:"#191724",swatchFg:"#ebbcba",tier:"community",category:"Editor Palettes"},{id:"cottagecore",name:"Cottagecore",icon:"flower-2",character:"Pastoral",swatchBg:"#fdf8f0",swatchFg:"#7d8c6d",tier:"community",category:"Niche"},{id:"terminal",name:"Terminal",icon:"terminal",character:"Retro CRT",swatchBg:"#0d1117",swatchFg:"#00ff00",tier:"community",category:"Niche"},{id:"clinical",name:"Clinical",icon:"heart-pulse",character:"Sterile precision",swatchBg:"#ffffff",swatchFg:"#0077b6",tier:"community",category:"Industry"},{id:"financial",name:"Financial",icon:"landmark",character:"Navy + gold",swatchBg:"#1b2a4a",swatchFg:"#c9a84c",tier:"community",category:"Industry"},{id:"government",name:"Government",icon:"shield",character:"Official",swatchBg:"#002868",swatchFg:"#bf0a30",tier:"community",category:"Industry"},{id:"dawn",name:"Dawn",icon:"sunrise",character:"Golden morning",swatchBg:"#fef3e2",swatchFg:"#d4a574",tier:"community",category:"Mood/Time"},{id:"dusk",name:"Dusk",icon:"sunset",character:"Twilight",swatchBg:"#1a1b2e",swatchFg:"#e5a858",tier:"community",category:"Mood/Time"},{id:"midnight",name:"Midnight",icon:"moon",character:"Deep night",swatchBg:"#0d1117",swatchFg:"#58a6ff",tier:"community",category:"Mood/Time"},{id:"high-noon",name:"High Noon",icon:"sun",character:"Maximum bright",swatchBg:"#ffffff",swatchFg:"#e63946",tier:"community",category:"Mood/Time"}],ue=[{id:"kawaii",name:"Kawaii",icon:"heart",character:"Cute aesthetic",swatchBg:"#ffb7c5",swatchFg:"#ff69b4",tier:"showcase",category:"Packs"},{id:"memphis",name:"Memphis",icon:"star",character:"Bold patterns",swatchBg:"#FFF8F0",swatchFg:"#d03040",tier:"showcase",category:"Packs"}];var Re=[...K,...X],Oe=[...le,...K,...X,...ue],E=t=>K.filter(e=>e.category===t),F=[{label:"Style",themes:le,tier:"core"},{label:"Design",themes:E("Design"),tier:"showcase"},{label:"Content",themes:E("Content"),tier:"showcase"},{label:"Modern",themes:E("Modern"),tier:"showcase"},{label:"Creative",themes:E("Creative"),tier:"showcase"},{label:"Aesthetic",themes:E("Aesthetic"),tier:"showcase"},{label:"Signature",themes:E("Signature"),tier:"showcase"},{label:"OS Styles",themes:E("OS Styles"),tier:"showcase"},{label:"Packs",themes:ue,tier:"showcase"},{label:"More Themes",themes:X,tier:"community"}];function Te(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,a){t.setItem(e,a)},async removeRaw(e){t.removeItem(e)},async keys(e){let a=[];for(let r=0;r<t.length;r++){let s=t.key(r);s&&s.startsWith(e)&&a.push(s)}return a}}}var I="__vbStoreBackend",H=globalThis;function p(){return H[I]||(H[I]=Te()),H[I]}function Y(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function me(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function fe(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var A={configure(t={}){H[I]=t.backend??null},async set(t,e,a){let r={data:a,timestamp:Date.now()};await p().setRaw(Y(t,e),JSON.stringify(r))},async get(t,e,a){let r=await p().getRaw(Y(t,e));if(r==null)return null;let s=fe(r);return!s||a?.maxAge!=null&&Date.now()-s.timestamp>a.maxAge?null:s.data},async remove(t,e){await p().removeRaw(Y(t,e))},async list(t){let e=me(t),a=await p().keys(e),r=[];for(let s of a){let n=await p().getRaw(s);if(n==null)continue;let i=fe(n);i&&r.push({key:s.slice(e.length),data:i.data,timestamp:i.timestamp})}return r},async clear(t){let e=me(t),a=await p().keys(e);for(let r of a)await p().removeRaw(r)},async clearAll(){let t=await p().keys("vb:");for(let e of t)await p().removeRaw(e)},async setMany(t,e){for(let[a,r]of e)await A.set(t,a,r)}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.store??=A}var V="theme",q="current",ve=2,G={accent:"data-accent",borderStyle:"data-border-style",iconSet:"data-icon-set",fluid:"data-fluid",backdrop:"data-backdrop",backdropChrome:"data-backdrop-chrome"},u={mode:"auto",brand:"default",accent:null,borderStyle:null,iconSet:null,fluid:null,backdrop:null,backdropChrome:null,pageBgType:"",pageBgColor:"",pageBgGradStart:"",pageBgGradEnd:"",pageBgGradDir:""};function pe(t){if(!t||typeof t!="object")return null;let e={...t};if(!(Number(e.v)>=ve))for(let a of Object.keys(G))(e[a]===""||a==="accent"&&e[a]==="default")&&(e[a]=null);return e}function b(t,e){return t??e??""}var J=null;function f(){if(J)return J;let t=document.documentElement,e=window.__vbAuthoredRoot,a=s=>{if(e&&typeof e=="object"){if(s in e)return e[s]??null;if(s==="data-mode")return null}return t.getAttribute(s)},r={theme:a("data-theme"),mode:a("data-mode"),themeSource:a("data-theme-source")};for(let[s,n]of Object.entries(G))r[s]=a(n);return J=r,r}function $e(t){try{let e=document.createElement("canvas");e.width=e.height=1;let a=e.getContext("2d",{willReadFrequently:!0});if(!a)return t;a.fillStyle=t,a.fillRect(0,0,1,1);let[r,s,n]=a.getImageData(0,0,1,1).data;return"#"+[r,s,n].map(i=>i.toString(16).padStart(2,"0")).join("")}catch{return t}}function j(t,e){let a=(t||"").split(/\s+/).filter(Boolean);return e==="site"?a[0]&&!a[0].startsWith("a11y-")?a[0]:"":a.find(r=>!r.startsWith("a11y-"))||""}function Me(t,e,a,r=!1){let s=(t||"").split(/\s+/).filter(n=>n&&n!==e&&n!==a);return a!=="default"?[a,...s].join(" "):(r&&s.length?["default",...s]:s).join(" ")}function ge(t){return t==="light"||t==="dark"?t:null}function ye(t,e,a){return e||(t==="light"||t==="dark"?t:a?"dark":"light")}function we(t,e,a){let r=j(e,a);return a==="site"&&r?r:t?.brand&&t.brand!==u.brand?t.brand:r||u.brand}var be=["--hue-primary","--hue-secondary","--hue-accent","--lightness-primary","--chroma-primary","--lightness-secondary","--chroma-secondary","--lightness-accent","--chroma-accent"],o=null,x="",N="",C=null,S=null,g={_initPromise:null,async init(){return this._initPromise?this._initPromise:(this._initPromise=(async()=>{let t=pe(await A.get(V,q));o=t?{...u,...t}:{...u},S=f().themeSource??null,x=j(f().theme??"",S),N=j(document.documentElement.dataset.theme||"",S),C=ge(f().mode),o.brand=we(t,f().theme??"",S);try{await M(o.brand)}catch{o.brand!==x&&(o.brand=x||u.brand)}return this.apply(o),this._watchSystemPreference(),this._watchRootAttributes(),this._watchCrossDocumentStorage(),o})(),this._initPromise)},_watchCrossDocumentStorage(){typeof window>"u"||window.addEventListener("storage",async t=>{if(t.key!==`vb:${V}:${q}`||!t.newValue)return;let e;try{let r=JSON.parse(t.newValue);e=pe(r?.data)}catch{return}if(!e)return;let a={...u,...o,...e};if(a.brand=we(e,f().theme??"",S),a.brand&&a.brand!==o?.brand)try{await M(a.brand)}catch{a.brand=x||u.brand}o=a,this.apply(o||{})})},load(){return o?{...o}:{...u}},save(t){let e={...o??u,...t,v:ve};return o=e,A.set(V,q,e).catch(()=>{}),e},apply({mode:t="auto",brand:e="default",borderStyle:a=null,iconSet:r=null,fluid:s=null,backdrop:n=null,backdropChrome:i=null,pageBgType:c="",pageBgColor:m="",pageBgGradStart:k="",pageBgGradEnd:v="",pageBgGradDir:$=""}={}){let h=document.documentElement,d=f(),y=ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches);h.dataset.mode=y;let _=S==="site",B=Me(h.dataset.theme||"",N,e,_);B?h.dataset.theme=B:delete h.dataset.theme,N=e==="default"&&!B.startsWith("default")?"":e;let P=a||d.borderStyle||this._readCSSHint("--theme-border-style");this._setRootAttr("data-border-style",P&&P!=="clean"?P:"");let D=r||d.iconSet||this._readCSSHint("--theme-icon-set");this._setRootAttr("data-icon-set",D&&D!=="lucide"?D:"");let Z=b(s,d.fluid);this._setRootAttr("data-fluid",Z,!0);let ee=b(n,d.backdrop);this._setRootAttr("data-backdrop",ee,!0);let L=b(i,d.backdropChrome);if(this._setRootAttr("data-backdrop-chrome",L&&L!=="card"?L:""),c==="color"&&m)h.style.setProperty("--page-bg-color",m),h.style.removeProperty("--page-bg-gradient");else if(c==="gradient"&&k&&v){let Se=$||"to bottom";h.style.setProperty("--page-bg-gradient",`linear-gradient(${Se}, ${k}, ${v})`),h.style.removeProperty("--page-bg-color")}else h.style.removeProperty("--page-bg-color"),h.style.removeProperty("--page-bg-gradient");this._applyAccent(this.load().accent);let Ee=this.getState().accent;this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{mode:t,brand:e,accent:Ee,borderStyle:P,iconSet:D,fluid:Z,backdrop:ee,backdropChrome:L,pageBgType:c,effectiveMode:y}}))},_setRootAttr(t,e,a=!1){let r=document.documentElement;e?r.setAttribute(t,e):a&&this._authoredHas(t)?r.setAttribute(t,""):r.removeAttribute(t)},_authoredHas(t){let e=Object.keys(G).find(r=>G[r]===t);return e?this.load()[e]==null&&f()[e]!=null:!1},_syncThemeColor(){let t=document.querySelectorAll('meta[name="theme-color"]');if(!t.length)return;let e=s=>!s||s==="transparent"||/^rgba\(.*,\s*0\)$/.test(s),a=getComputedStyle(document.documentElement).backgroundColor;if(e(a)){let s=document.createElement("span");s.style.setProperty("position","absolute"),s.style.setProperty("background-color","var(--color-background)"),(document.body||document.documentElement).append(s),a=getComputedStyle(s).backgroundColor,s.remove()}if(e(a))return;let r=$e(a);t.forEach(s=>{s.removeAttribute("media"),s.setAttribute("content",r)})},setMode(t){C=null;let e=this.save({mode:t});this.apply(e)},async setBrand(t){try{await M(t)}catch(a){console.warn(`[VB] Theme "${t}" failed to load, using default`,a),t="default"}let e=this.save({brand:t});this.apply(e)},setAccent(t){this.save({accent:t}),this._applyAccent(t),this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}}))},setBorderStyle(t){let e=this.save({borderStyle:t});this.apply(e)},setIconSet(t){let e=this.save({iconSet:t});this.apply(e)},setFluid(t){let e=this.save({fluid:t});this.apply(e)},setBackdrop(t){let e=this.save({backdrop:t});this.apply(e)},setBackdropChrome(t){let e=this.save({backdropChrome:t});this.apply(e)},setPageBg({type:t="",color:e="",gradStart:a="",gradEnd:r="",gradDir:s=""}={}){let n=this.save({pageBgType:t,pageBgColor:e,pageBgGradStart:a,pageBgGradEnd:r,pageBgGradDir:s});this.apply(n)},getEffectiveMode(){let{mode:t}=this.load();return ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches)},getState(){let{mode:t,brand:e,accent:a,borderStyle:r,iconSet:s,fluid:n,backdrop:i,backdropChrome:c,pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:$,pageBgGradDir:h}=this.load(),d=typeof document>"u"?{}:f(),y=(_,B)=>B==null&&d[_]===""?"default":b(B,d[_]);return{mode:t,brand:e,accent:b(a,d.accent)||"default",borderStyle:b(r,d.borderStyle),iconSet:b(s,d.iconSet),fluid:y("fluid",n),backdrop:y("backdrop",i),backdropChrome:b(c,d.backdropChrome),pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:$,pageBgGradDir:h,effectiveMode:this.getEffectiveMode()}},toggleMode(){let e=this.getEffectiveMode()==="dark"?"light":"dark";this.setMode(e)},reset(){o={...u,brand:x||u.brand},C=ge(f().mode),A.remove(V,q).catch(()=>{});let t=document.documentElement;t.style.removeProperty("--page-bg-color"),t.style.removeProperty("--page-bg-gradient");for(let e of be)t.style.removeProperty(e);this.apply(o)},_readCSSHint(t){return getComputedStyle(document.documentElement).getPropertyValue(t).trim()},_applyAccent(t){let e=document.documentElement;for(let r of be)e.style.removeProperty(r);if(t==null){let r=f().accent;r?e.dataset.accent=r:delete e.dataset.accent;return}let a=he.find(r=>r.id===t);if(!a||!a.seeds||Object.keys(a.seeds).length===0){delete e.dataset.accent;return}e.dataset.accent=a.id},_watchRootAttributes(){this._rootObserver||(this._rootObserver=new MutationObserver(t=>{for(let e of t)e.attributeName==="data-theme"?this._syncFromDataTheme():e.attributeName==="data-mode"&&this._syncFromDataMode()}),this._rootObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-mode"]}))},_syncFromDataTheme(){if(!o)return;let t=document.documentElement.dataset.theme||"",e=t.split(/\s+/).filter(Boolean),a=j(t,S)||"default";a!==o.brand&&(o.brand=a,M(a).catch(()=>{}),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_syncFromDataMode(){if(!o)return;let t=document.documentElement.dataset.mode||"auto",e=this.getEffectiveMode();t!==e&&(C=null,o.mode=t,this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_watchSystemPreference(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{let e=this.load();e.mode==="auto"&&this.apply(e)})}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.themeManager??=g}var T=new Map;for(let t of F)for(let e of t.themes)T.set(e.id,e);var Fe={panel:"Theme settings",trigger:"Theme settings",mode:"Color Mode",theme:"Theme"},l=t=>String(t??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e]),xe=0,Q=class t extends R{static#r=200;#t;#e;#a=!1;#s=!1;#h=!1;#f=F;#c=null;#v=++xe;#l=0;#i=!1;#n=()=>this.#b();setup(){return this.#s=this.getAttribute("variant")==="inline",this.#h=this.hasAttribute("swatches"),this.#f=this.#E(),this.#S(++this.#l),!0}#E(){let e=(this.getAttribute("themes")||"").split(/\s+/).filter(Boolean);if(!e.length)return F;let a=[...new Set(e)].map(r=>T.get(r)).filter(Boolean);return a.length?[{label:this.#o("theme"),themes:a,tier:"core"}]:F}async#S(e){await g.init(),!(!this.isConnected||e!==this.#l||this.#e)&&(this.#k(),this.#$(),this.#w(),this.listen(window,"vb:theme-change",this.#R))}teardown(){this.#l++,window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.#m(),this.#a=!1,this.#i=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),this.#e?.remove(),this.#e=null}#k(){this.#s||(this.#t=this.querySelector(":scope > [data-trigger]"),this.#t||(this.#t=this.querySelector(":scope > button")),this.#t||(this.#t=document.createElement("button"),this.#t.type="button",this.#t.setAttribute("data-trigger",""),this.#t.innerHTML=`
2
- <icon-wc name="palette" label="${l(this.#o("trigger"))}"></icon-wc>
3
- `,this.prepend(this.#t)),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false")),this.#e=document.createElement("div"),this.#e.className="panel",this.#e.setAttribute("role","dialog"),this.#e.setAttribute("aria-label",this.#o("panel")),this.#s||(this.#e.id=`theme-panel-${crypto.randomUUID().slice(0,8)}`,this.#t.setAttribute("aria-controls",this.#e.id)),this.#e.innerHTML=this.#B(),this.appendChild(this.#e)}#o(e){return this.getAttribute(`data-label-${e}`)||Fe[e]}#p(e){return`theme-${e}-${this.#v}`}#B(){let{mode:e,brand:a}=g.getState(),r=l(this.#o("mode")),s=l(this.#o("theme"));return`
4
- <fieldset class="section">
1
+ var w=new Map,z=new Map;var te=null;function U(){if(typeof window<"u"&&window.__VB_THEME_BASE)return String(window.__VB_THEME_BASE).replace(/\/$/,"");if(te)return te;if(typeof document<"u"){let t=document.querySelectorAll('script[src*="vanilla-breeze"]');for(let e of t){let a=e.getAttribute("src");if(a){let r=a.lastIndexOf("/");if(r!==-1)return a.slice(0,r)}}}return"/cdn"}var ae=new Set(["default","a11y-high-contrast","a11y-large-text","a11y-dyslexia","modern","minimal","classic"]),ke=new Set(["kawaii","memphis"]);function W(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):String(t).replace(/["\\]/g,"\\$&")}function re(t){document.querySelectorAll(`link[data-vb-theme-preload="${W(t)}"]`).forEach(e=>e.remove())}function R(t){return ke.has(t)}function se(t,e){return`${e}/themes/${t}.css`}function ne(t,e){if(!R(t))return Promise.resolve();if(z.has(t))return z.get(t);let a=import(`${e}/packs/${t}.full.js`).catch(()=>{});return z.set(t,a),a}function Be(t,e){let a=U(),r=()=>{(R(e)||t.hasAttribute("data-vb-pack"))&&ne(e,a)};return t.getAttribute("data-vb-theme-state")==="error"?Promise.reject(new Error(`Failed to load theme: ${e}`)):t.getAttribute("data-vb-theme-state")==="ready"||t.sheet?(r(),Promise.resolve()):new Promise((s,n)=>{let i=()=>{t.setAttribute("data-vb-theme-state","ready"),m(),r(),s(void 0)},c=()=>{t.setAttribute("data-vb-theme-state","error"),w.delete(e),m(),n(new Error(`Failed to load theme: ${e}`))},m=()=>{t.removeEventListener("load",i),t.removeEventListener("error",c)};t.addEventListener("load",i,{once:!0}),t.addEventListener("error",c,{once:!0})})}async function M(t){if(!t||ae.has(t))return;if(w.has(t))return w.get(t);if(typeof document<"u"){let r=document.querySelector(`link[data-vb-theme="${W(t)}"]`);if(r){let s=Be(r,t);return w.set(t,s),s}}let e=U(),a=R(t)?Ce(t,e):Ae(t,e);return w.set(t,a),a}function ie(t){if(!t||ae.has(t)||R(t)||w.has(t)||typeof document>"u")return;let e=W(t);if(document.querySelector(`link[data-vb-theme="${e}"], link[data-vb-theme-preload="${e}"]`))return;let r=U(),s=se(t,r),n=document.createElement("link");n.rel="preload",n.as="style",n.href=s,n.setAttribute("data-vb-theme-preload",t),document.head.appendChild(n)}async function Ae(t,e){let a=se(t,e);return new Promise((r,s)=>{re(t);let n=document.createElement("link");n.rel="stylesheet",n.href=a,n.setAttribute("data-vb-theme",t),n.setAttribute("data-vb-theme-state","loading"),n.onload=()=>{n.setAttribute("data-vb-theme-state","ready"),r()},n.onerror=()=>{n.setAttribute("data-vb-theme-state","error"),n.remove(),w.delete(t),s(new Error(`Failed to load theme: ${t}`))},document.head.appendChild(n)})}function Ce(t,e){let a=`${e}/packs/${t}.theme.css`,r=`${e}/packs/${t}.effects.css`;return new Promise((s,n)=>{re(t);let i=document.createElement("link");i.rel="stylesheet",i.href=a,i.setAttribute("data-vb-theme",t),i.setAttribute("data-vb-pack",t),i.setAttribute("data-vb-theme-state","loading"),i.onload=()=>{i.setAttribute("data-vb-theme-state","ready");let c=document.createElement("link");c.rel="stylesheet",c.href=r,c.setAttribute("data-vb-pack-effects",t),document.head.appendChild(c),ne(t,e),s()},i.onerror=()=>{i.setAttribute("data-vb-theme-state","error"),i.remove(),w.delete(t),n(new Error(`Failed to load pack: ${t}`))},document.head.appendChild(i)})}var Le=window.matchMedia("(prefers-reduced-motion: reduce)");var oe=new Map;function ce(t,e,a={}){let r=a.priority??10,s={impl:e,bundle:a.bundle,contract:a.contract,priority:r},n=oe.get(t);if(customElements.get(t)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${a.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${a.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}". Skipping "${a.bundle}" (first wins at equal priority).`);return}oe.set(t,s),customElements.define(t,e)}var O=class extends HTMLElement{#s=[];#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 e of this.#s)e();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,a,r,s){e.addEventListener(a,r,s),this.#s.push(()=>e.removeEventListener(a,r,s))}_reinit(){for(let e of this.#s)e();this.#s=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,a){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{a?r.add(e):r.delete(e)}catch{let s=`--${e}`;a?r.add(s):r.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}#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 de=[{id:"auto",name:"Auto",icon:"monitor"},{id:"light",name:"Light",icon:"sun"},{id:"dark",name:"Dark",icon:"moon"}],he=[{id:"default",name:"Default",swatchBg:"#3b82f6",seeds:{}},{id:"ocean",name:"Ocean",swatchBg:"#0891b2",seeds:{"--hue-primary":200,"--hue-secondary":180,"--hue-accent":45,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"45%","--chroma-secondary":.1,"--lightness-accent":"70%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"forest",name:"Forest",swatchBg:"#059669",seeds:{"--hue-primary":145,"--hue-secondary":90,"--hue-accent":30,"--lightness-primary":"45%","--chroma-primary":.15,"--lightness-secondary":"55%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"58%","--chroma-primary":.12}},{id:"sunset",name:"Sunset",swatchBg:"#ea580c",seeds:{"--hue-primary":25,"--hue-secondary":0,"--hue-accent":280,"--lightness-primary":"57%","--chroma-primary":.2,"--lightness-secondary":"55%","--chroma-secondary":.18,"--lightness-accent":"55%","--chroma-accent":.18},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.16}},{id:"rose",name:"Rose",swatchBg:"#e11d48",seeds:{"--hue-primary":350,"--hue-secondary":330,"--hue-accent":200,"--lightness-primary":"55%","--chroma-primary":.18,"--lightness-secondary":"50%","--chroma-secondary":.14,"--lightness-accent":"60%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.14}},{id:"lavender",name:"Lavender",swatchBg:"#a855f7",seeds:{"--hue-primary":280,"--hue-secondary":300,"--hue-accent":60,"--lightness-primary":"55%","--chroma-primary":.14,"--lightness-secondary":"50%","--chroma-secondary":.12,"--lightness-accent":"70%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.12}},{id:"coral",name:"Coral",swatchBg:"#f97316",seeds:{"--hue-primary":15,"--hue-secondary":25,"--hue-accent":180,"--lightness-primary":"57%","--chroma-primary":.18,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"55%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.15}},{id:"slate",name:"Slate",swatchBg:"#64748b",seeds:{"--hue-primary":220,"--hue-secondary":210,"--hue-accent":45,"--lightness-primary":"48%","--chroma-primary":.1,"--lightness-secondary":"45%","--chroma-secondary":.06,"--lightness-accent":"68%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.08}},{id:"emerald",name:"Emerald",swatchBg:"#10b981",seeds:{"--hue-primary":160,"--hue-secondary":140,"--hue-accent":30,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"48%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"amber",name:"Amber",swatchBg:"#f59e0b",seeds:{"--hue-primary":45,"--hue-secondary":30,"--hue-accent":240,"--lightness-primary":"56%","--chroma-primary":.16,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"52%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"68%","--chroma-primary":.14}},{id:"indigo",name:"Indigo",swatchBg:"#6366f1",seeds:{"--hue-primary":250,"--hue-secondary":270,"--hue-accent":35,"--lightness-primary":"48%","--chroma-primary":.18,"--lightness-secondary":"45%","--chroma-secondary":.14,"--lightness-accent":"68%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"62%","--chroma-primary":.14}}],le=[{id:"default",name:"Default",hue:210,shape:"balanced",character:"The default",swatchBg:"#3b82f6",tier:"core"},{id:"modern",name:"Modern",hue:270,shape:"rounded",character:"Vibrant & elevated",swatchBg:"#6366f1",tier:"core"},{id:"minimal",name:"Minimal",hue:240,shape:"sharp",character:"Clean & flat",swatchBg:"#71717a",tier:"core"},{id:"classic",name:"Classic",hue:220,shape:"subtle",character:"Serif & elegant",swatchBg:"#92400e",tier:"core"}],K=[{id:"swiss",name:"Swiss",icon:"grid-3x3",character:"Precision grid",swatchBg:"#ff3e00",swatchFg:"white",tier:"showcase",category:"Design"},{id:"brutalist",name:"Brutalist",icon:"square",character:"Raw, industrial",swatchBg:"#1a1a1a",swatchFg:"#f5f5f5",tier:"showcase",category:"Design"},{id:"art-deco",name:"Art Deco",icon:"crown",character:"1920s luxury",swatchBg:"#1A1A1A",swatchFg:"#C9A84C",tier:"showcase",category:"Design"},{id:"editorial",name:"Editorial",icon:"newspaper",character:"Magazine elegance",swatchBg:"#1a1a1a",swatchFg:"#c9a227",tier:"showcase",category:"Content"},{id:"genai",name:"GenAI",icon:"sparkles",character:"AI aesthetic",swatchBg:"#1a0a2e",swatchFg:"#a855f7",tier:"showcase",category:"Modern"},{id:"glassmorphism",name:"Glass",icon:"glass-water",character:"Frosted surfaces",swatchBg:"#667eea",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"startup",name:"Startup",icon:"rocket",character:"SaaS energy",swatchBg:"#4f46e5",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"organic",name:"Organic",icon:"leaf",character:"Natural, handcrafted",swatchBg:"#2d5016",swatchFg:"#faf5e6",tier:"showcase",category:"Creative"},{id:"rough",name:"Rough",icon:"pencil",character:"Hand-drawn sketch",swatchBg:"#f5f0e8",swatchFg:"#3a3a3a",tier:"showcase",category:"Creative"},{id:"cyber",name:"Cyber",icon:"zap",character:"Neon futuristic",swatchBg:"#0a0a1a",swatchFg:"#00ff88",tier:"showcase",category:"Creative"},{id:"journal",name:"Journal",icon:"notebook-pen",character:"Dot-grid bullet journal",swatchBg:"#f3ecdc",swatchFg:"#27313f",tier:"showcase",category:"Creative"},{id:"vaporwave",name:"Vaporwave",icon:"radio",character:"Neon dreamy",swatchBg:"#2b0040",swatchFg:"#ff6ad5",tier:"showcase",category:"Aesthetic"},{id:"neumorphism",name:"Neumorph",icon:"circle",character:"Soft embossed",swatchBg:"#e0e0e0",swatchFg:"#a0a0a0",tier:"showcase",category:"Aesthetic"},{id:"bauhaus",name:"Bauhaus",icon:"shapes",character:"Geometric",swatchBg:"#F1FAEE",swatchFg:"#E63946",tier:"showcase",category:"Aesthetic"},{id:"claymorphism",name:"Clay",icon:"circle-dot",character:"Puffy 3D",swatchBg:"#f0f0f5",swatchFg:"#FF6B9D",tier:"showcase",category:"Aesthetic"},{id:"alpha1999",name:"Alpha1999",icon:"orbit",character:"Space retro-fi",swatchBg:"#0a0a14",swatchFg:"#d4880f",tier:"showcase",category:"Signature"},{id:"super2026",name:"Super2026",icon:"triangle",character:"Supergraphic bold",swatchBg:"#f5f0e6",swatchFg:"#c23616",tier:"showcase",category:"Signature"},{id:"magna",name:"Magna",icon:"orbit",character:"Odyssey 2 retro",swatchBg:"#0d0b14",swatchFg:"#f97316",tier:"showcase",category:"Signature"},{id:"win9x",name:"Win9x",icon:"monitor",character:"Classic desktop",swatchBg:"#008080",swatchFg:"#c0c0c0",tier:"showcase",category:"OS Styles"},{id:"nes",name:"NES",icon:"joystick",character:"Console pixels",swatchBg:"#bcbcbc",swatchFg:"#e40521",tier:"showcase",category:"OS Styles"},{id:"8bit",name:"8-Bit",icon:"gamepad-2",character:"Retro pixel art",swatchBg:"#000080",swatchFg:"#ffff00",tier:"showcase",category:"OS Styles"}],X=[{id:"nord",name:"Nord",icon:"snowflake",character:"Arctic calm",swatchBg:"#2E3440",swatchFg:"#81A1C1",tier:"community",category:"Editor Palettes"},{id:"solarized",name:"Solarized",icon:"sun-dim",character:"Engineered precision",swatchBg:"#002B36",swatchFg:"#268BD2",tier:"community",category:"Editor Palettes"},{id:"dracula",name:"Dracula",icon:"moon-star",character:"Dark elegance",swatchBg:"#282A36",swatchFg:"#BD93F9",tier:"community",category:"Editor Palettes"},{id:"catppuccin-mocha",name:"Catppuccin",icon:"coffee",character:"Warm pastels",swatchBg:"#1E1E2E",swatchFg:"#CBA6F7",tier:"community",category:"Editor Palettes"},{id:"catppuccin-latte",name:"Ctp Latte",icon:"coffee",character:"Cozy daytime",swatchBg:"#eff1f5",swatchFg:"#8839ef",tier:"community",category:"Editor Palettes"},{id:"catppuccin-frappe",name:"Ctp Frapp\xE9",icon:"coffee",character:"Cool twilight",swatchBg:"#303446",swatchFg:"#ca9ee6",tier:"community",category:"Editor Palettes"},{id:"catppuccin-macchiato",name:"Ctp Macchiato",icon:"coffee",character:"Deep blue",swatchBg:"#24273a",swatchFg:"#c6a0f6",tier:"community",category:"Editor Palettes"},{id:"gruvbox",name:"Gruvbox",icon:"palette",character:"Retro warmth",swatchBg:"#282828",swatchFg:"#ebdbb2",tier:"community",category:"Editor Palettes"},{id:"tokyo-night",name:"Tokyo Night",icon:"moon",character:"Night-owl vibes",swatchBg:"#1a1b26",swatchFg:"#7aa2f7",tier:"community",category:"Editor Palettes"},{id:"rose-pine",name:"Ros\xE9 Pine",icon:"flower-2",character:"Muted elegance",swatchBg:"#191724",swatchFg:"#ebbcba",tier:"community",category:"Editor Palettes"},{id:"cottagecore",name:"Cottagecore",icon:"flower-2",character:"Pastoral",swatchBg:"#fdf8f0",swatchFg:"#7d8c6d",tier:"community",category:"Niche"},{id:"terminal",name:"Terminal",icon:"terminal",character:"Retro CRT",swatchBg:"#0d1117",swatchFg:"#00ff00",tier:"community",category:"Niche"},{id:"clinical",name:"Clinical",icon:"heart-pulse",character:"Sterile precision",swatchBg:"#ffffff",swatchFg:"#0077b6",tier:"community",category:"Industry"},{id:"financial",name:"Financial",icon:"landmark",character:"Navy + gold",swatchBg:"#1b2a4a",swatchFg:"#c9a84c",tier:"community",category:"Industry"},{id:"government",name:"Government",icon:"shield",character:"Official",swatchBg:"#002868",swatchFg:"#bf0a30",tier:"community",category:"Industry"},{id:"dawn",name:"Dawn",icon:"sunrise",character:"Golden morning",swatchBg:"#fef3e2",swatchFg:"#d4a574",tier:"community",category:"Mood/Time"},{id:"dusk",name:"Dusk",icon:"sunset",character:"Twilight",swatchBg:"#1a1b2e",swatchFg:"#e5a858",tier:"community",category:"Mood/Time"},{id:"midnight",name:"Midnight",icon:"moon",character:"Deep night",swatchBg:"#0d1117",swatchFg:"#58a6ff",tier:"community",category:"Mood/Time"},{id:"high-noon",name:"High Noon",icon:"sun",character:"Maximum bright",swatchBg:"#ffffff",swatchFg:"#e63946",tier:"community",category:"Mood/Time"}],ue=[{id:"kawaii",name:"Kawaii",icon:"heart",character:"Cute aesthetic",swatchBg:"#ffb7c5",swatchFg:"#ff69b4",tier:"showcase",category:"Packs"},{id:"memphis",name:"Memphis",icon:"star",character:"Bold patterns",swatchBg:"#FFF8F0",swatchFg:"#d03040",tier:"showcase",category:"Packs"}];var Ie=[...K,...X],He=[...le,...K,...X,...ue],E=t=>K.filter(e=>e.category===t),F=[{label:"Style",themes:le,tier:"core"},{label:"Design",themes:E("Design"),tier:"showcase"},{label:"Content",themes:E("Content"),tier:"showcase"},{label:"Modern",themes:E("Modern"),tier:"showcase"},{label:"Creative",themes:E("Creative"),tier:"showcase"},{label:"Aesthetic",themes:E("Aesthetic"),tier:"showcase"},{label:"Signature",themes:E("Signature"),tier:"showcase"},{label:"OS Styles",themes:E("OS Styles"),tier:"showcase"},{label:"Packs",themes:ue,tier:"showcase"},{label:"More Themes",themes:X,tier:"community"}];function $e(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,a){t.setItem(e,a)},async removeRaw(e){t.removeItem(e)},async keys(e){let a=[];for(let r=0;r<t.length;r++){let s=t.key(r);s&&s.startsWith(e)&&a.push(s)}return a}}}var I="__vbStoreBackend",H=globalThis;function p(){return H[I]||(H[I]=$e()),H[I]}function Y(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function me(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function fe(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var A={configure(t={}){H[I]=t.backend??null},async set(t,e,a){let r={data:a,timestamp:Date.now()};await p().setRaw(Y(t,e),JSON.stringify(r))},async get(t,e,a){let r=await p().getRaw(Y(t,e));if(r==null)return null;let s=fe(r);return!s||a?.maxAge!=null&&Date.now()-s.timestamp>a.maxAge?null:s.data},async remove(t,e){await p().removeRaw(Y(t,e))},async list(t){let e=me(t),a=await p().keys(e),r=[];for(let s of a){let n=await p().getRaw(s);if(n==null)continue;let i=fe(n);i&&r.push({key:s.slice(e.length),data:i.data,timestamp:i.timestamp})}return r},async clear(t){let e=me(t),a=await p().keys(e);for(let r of a)await p().removeRaw(r)},async clearAll(){let t=await p().keys("vb:");for(let e of t)await p().removeRaw(e)},async setMany(t,e){for(let[a,r]of e)await A.set(t,a,r)}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.store??=A}var V="theme",q="current",ve=2,G={accent:"data-accent",borderStyle:"data-border-style",iconSet:"data-icon-set",fluid:"data-fluid",backdrop:"data-backdrop",backdropChrome:"data-backdrop-chrome"},u={mode:"auto",brand:"default",accent:null,borderStyle:null,iconSet:null,fluid:null,backdrop:null,backdropChrome:null,pageBgType:"",pageBgColor:"",pageBgGradStart:"",pageBgGradEnd:"",pageBgGradDir:""};function pe(t){if(!t||typeof t!="object")return null;let e={...t};if(!(Number(e.v)>=ve))for(let a of Object.keys(G))(e[a]===""||a==="accent"&&e[a]==="default")&&(e[a]=null);return e}function b(t,e){return t??e??""}var J=null;function f(){if(J)return J;let t=document.documentElement,e=window.__vbAuthoredRoot,a=s=>{if(e&&typeof e=="object"){if(s in e)return e[s]??null;if(s==="data-mode")return null}return t.getAttribute(s)},r={theme:a("data-theme"),mode:a("data-mode"),themeSource:a("data-theme-source")};for(let[s,n]of Object.entries(G))r[s]=a(n);return J=r,r}function Te(t){try{let e=document.createElement("canvas");e.width=e.height=1;let a=e.getContext("2d",{willReadFrequently:!0});if(!a)return t;a.fillStyle=t,a.fillRect(0,0,1,1);let[r,s,n]=a.getImageData(0,0,1,1).data;return"#"+[r,s,n].map(i=>i.toString(16).padStart(2,"0")).join("")}catch{return t}}function j(t,e){let a=(t||"").split(/\s+/).filter(Boolean);return e==="site"?a[0]&&!a[0].startsWith("a11y-")?a[0]:"":a.find(r=>!r.startsWith("a11y-"))||""}function Me(t,e,a,r=!1){let s=(t||"").split(/\s+/).filter(n=>n&&n!==e&&n!==a);return a!=="default"?[a,...s].join(" "):(r&&s.length?["default",...s]:s).join(" ")}function ge(t){return t==="light"||t==="dark"?t:null}function ye(t,e,a){return e||(t==="light"||t==="dark"?t:a?"dark":"light")}function we(t,e,a){let r=j(e,a);return a==="site"&&r?r:t?.brand&&t.brand!==u.brand?t.brand:r||u.brand}var be=["--hue-primary","--hue-secondary","--hue-accent","--lightness-primary","--chroma-primary","--lightness-secondary","--chroma-secondary","--lightness-accent","--chroma-accent"],o=null,x="",N="",C=null,S=null,g={_initPromise:null,async init(){return this._initPromise?this._initPromise:(this._initPromise=(async()=>{let t=pe(await A.get(V,q));o=t?{...u,...t}:{...u},S=f().themeSource??null,x=j(f().theme??"",S),N=j(document.documentElement.dataset.theme||"",S),C=ge(f().mode),o.brand=we(t,f().theme??"",S);try{await M(o.brand)}catch{o.brand!==x&&(o.brand=x||u.brand)}return this.apply(o),this._watchSystemPreference(),this._watchRootAttributes(),this._watchCrossDocumentStorage(),o})(),this._initPromise)},_watchCrossDocumentStorage(){typeof window>"u"||window.addEventListener("storage",async t=>{if(t.key!==`vb:${V}:${q}`||!t.newValue)return;let e;try{let r=JSON.parse(t.newValue);e=pe(r?.data)}catch{return}if(!e)return;let a={...u,...o,...e};if(a.brand=we(e,f().theme??"",S),a.brand&&a.brand!==o?.brand)try{await M(a.brand)}catch{a.brand=x||u.brand}o=a,this.apply(o||{})})},load(){return o?{...o}:{...u}},save(t){let e={...o??u,...t,v:ve};return o=e,A.set(V,q,e).catch(()=>{}),e},apply({mode:t="auto",brand:e="default",borderStyle:a=null,iconSet:r=null,fluid:s=null,backdrop:n=null,backdropChrome:i=null,pageBgType:c="",pageBgColor:m="",pageBgGradStart:k="",pageBgGradEnd:v="",pageBgGradDir:T=""}={}){let h=document.documentElement,d=f(),y=ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches);h.dataset.mode=y;let _=S==="site",B=Me(h.dataset.theme||"",N,e,_);B?h.dataset.theme=B:delete h.dataset.theme,N=e==="default"&&!B.startsWith("default")?"":e;let P=a||d.borderStyle||this._readCSSHint("--theme-border-style");this._setRootAttr("data-border-style",P&&P!=="clean"?P:"");let D=r||d.iconSet||this._readCSSHint("--theme-icon-set");this._setRootAttr("data-icon-set",D&&D!=="lucide"?D:"");let Z=b(s,d.fluid);this._setRootAttr("data-fluid",Z,!0);let ee=b(n,d.backdrop);this._setRootAttr("data-backdrop",ee,!0);let L=b(i,d.backdropChrome);if(this._setRootAttr("data-backdrop-chrome",L&&L!=="card"?L:""),c==="color"&&m)h.style.setProperty("--page-bg-color",m),h.style.removeProperty("--page-bg-gradient");else if(c==="gradient"&&k&&v){let Se=T||"to bottom";h.style.setProperty("--page-bg-gradient",`linear-gradient(${Se}, ${k}, ${v})`),h.style.removeProperty("--page-bg-color")}else h.style.removeProperty("--page-bg-color"),h.style.removeProperty("--page-bg-gradient");this._applyAccent(this.load().accent);let Ee=this.getState().accent;this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{mode:t,brand:e,accent:Ee,borderStyle:P,iconSet:D,fluid:Z,backdrop:ee,backdropChrome:L,pageBgType:c,effectiveMode:y}}))},_setRootAttr(t,e,a=!1){let r=document.documentElement;e?r.setAttribute(t,e):a&&this._authoredHas(t)?r.setAttribute(t,""):r.removeAttribute(t)},_authoredHas(t){let e=Object.keys(G).find(r=>G[r]===t);return e?this.load()[e]==null&&f()[e]!=null:!1},_syncThemeColor(){let t=document.querySelectorAll('meta[name="theme-color"]');if(!t.length)return;let e=s=>!s||s==="transparent"||/^rgba\(.*,\s*0\)$/.test(s),a=getComputedStyle(document.documentElement).backgroundColor;if(e(a)){let s=document.createElement("span");s.style.setProperty("position","absolute"),s.style.setProperty("background-color","var(--color-background)"),(document.body||document.documentElement).append(s),a=getComputedStyle(s).backgroundColor,s.remove()}if(e(a))return;let r=Te(a);t.forEach(s=>{s.removeAttribute("media"),s.setAttribute("content",r)})},setMode(t){C=null;let e=this.save({mode:t});this.apply(e)},async setBrand(t){try{await M(t)}catch(a){console.warn(`[VB] Theme "${t}" failed to load, using default`,a),t="default"}let e=this.save({brand:t});this.apply(e)},setAccent(t){this.save({accent:t}),this._applyAccent(t),this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}}))},setBorderStyle(t){let e=this.save({borderStyle:t});this.apply(e)},setIconSet(t){let e=this.save({iconSet:t});this.apply(e)},setFluid(t){let e=this.save({fluid:t});this.apply(e)},setBackdrop(t){let e=this.save({backdrop:t});this.apply(e)},setBackdropChrome(t){let e=this.save({backdropChrome:t});this.apply(e)},setPageBg({type:t="",color:e="",gradStart:a="",gradEnd:r="",gradDir:s=""}={}){let n=this.save({pageBgType:t,pageBgColor:e,pageBgGradStart:a,pageBgGradEnd:r,pageBgGradDir:s});this.apply(n)},getEffectiveMode(){let{mode:t}=this.load();return ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches)},getState(){let{mode:t,brand:e,accent:a,borderStyle:r,iconSet:s,fluid:n,backdrop:i,backdropChrome:c,pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:T,pageBgGradDir:h}=this.load(),d=typeof document>"u"?{}:f(),y=(_,B)=>B==null&&d[_]===""?"default":b(B,d[_]);return{mode:t,brand:e,accent:b(a,d.accent)||"default",borderStyle:b(r,d.borderStyle),iconSet:b(s,d.iconSet),fluid:y("fluid",n),backdrop:y("backdrop",i),backdropChrome:b(c,d.backdropChrome),pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:T,pageBgGradDir:h,effectiveMode:this.getEffectiveMode()}},toggleMode(){let e=this.getEffectiveMode()==="dark"?"light":"dark";this.setMode(e)},reset(){o={...u,brand:x||u.brand},C=ge(f().mode),A.remove(V,q).catch(()=>{});let t=document.documentElement;t.style.removeProperty("--page-bg-color"),t.style.removeProperty("--page-bg-gradient");for(let e of be)t.style.removeProperty(e);this.apply(o)},_readCSSHint(t){return getComputedStyle(document.documentElement).getPropertyValue(t).trim()},_applyAccent(t){let e=document.documentElement;for(let r of be)e.style.removeProperty(r);if(t==null){let r=f().accent;r?e.dataset.accent=r:delete e.dataset.accent;return}let a=he.find(r=>r.id===t);if(!a||!a.seeds||Object.keys(a.seeds).length===0){delete e.dataset.accent;return}e.dataset.accent=a.id},_watchRootAttributes(){this._rootObserver||(this._rootObserver=new MutationObserver(t=>{for(let e of t)e.attributeName==="data-theme"?this._syncFromDataTheme():e.attributeName==="data-mode"&&this._syncFromDataMode()}),this._rootObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-mode"]}))},_syncFromDataTheme(){if(!o)return;let t=document.documentElement.dataset.theme||"",e=t.split(/\s+/).filter(Boolean),a=j(t,S)||"default";a!==o.brand&&(o.brand=a,M(a).catch(()=>{}),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_syncFromDataMode(){if(!o)return;let t=document.documentElement.dataset.mode||"auto",e=this.getEffectiveMode();t!==e&&(C=null,o.mode=t,this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_watchSystemPreference(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{let e=this.load();e.mode==="auto"&&this.apply(e)})}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.themeManager??=g}var $=new Map;for(let t of F)for(let e of t.themes)$.set(e.id,e);var Fe={panel:"Theme settings",trigger:"Theme settings",mode:"Color Mode",theme:"Theme"},l=t=>String(t??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e]),xe=0,Q=class t extends O{static#s=200;#t;#e;#a=!1;#r=!1;#l=!1;#p=F;#d=null;#v=++xe;#u=0;#o=!1;#n=()=>this.#b();setup(){return this.#r=this.getAttribute("variant")==="inline",this.#l=this.hasAttribute("swatches"),this.#p=this.#E(),this.#S(++this.#u),!0}#E(){let e=(this.getAttribute("themes")||"").split(/\s+/).filter(Boolean);if(!e.length)return F;let a=[...new Set(e)].map(r=>$.get(r)).filter(Boolean);return a.length?[{label:this.#c("theme"),themes:a,tier:"core"}]:F}async#S(e){await g.init(),!(!this.isConnected||e!==this.#u||this.#e)&&(this.#k(),this.#T(),this.#w(),this.listen(window,"vb:theme-change",this.#R))}teardown(){this.#u++,window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.#f(),this.#a=!1,this.#o=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),this.#e?.remove(),this.#e=null}#k(){this.#r||(this.#t=this.querySelector(":scope > [data-trigger]"),this.#t||(this.#t=this.querySelector(":scope > button")),this.#t||(this.#t=document.createElement("button"),this.#t.type="button",this.#t.setAttribute("data-trigger",""),this.#t.innerHTML=`
2
+ <icon-wc name="palette" label="${l(this.#c("trigger"))}"></icon-wc>
3
+ `,this.prepend(this.#t)),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false")),this.#e=document.createElement("div"),this.#e.className="panel",this.#e.setAttribute("role",this.#r?"group":"dialog"),this.#e.setAttribute("aria-label",this.#c("panel")),this.#r||(this.#e.id=`theme-panel-${crypto.randomUUID().slice(0,8)}`,this.#t.setAttribute("aria-controls",this.#e.id)),this.#e.innerHTML=this.#B(),this.appendChild(this.#e)}#c(e){return this.getAttribute(`data-label-${e}`)||Fe[e]}#i(e){return`theme-${e}-${this.#v}`}#B(){let{mode:e,brand:a}=g.getState(),r=l(this.#c("mode")),s=l(this.#c("theme"));return`
4
+ <fieldset class="section" role="radiogroup">
5
5
  <legend>${r}</legend>
6
- <div class="segmented" role="radiogroup" aria-label="${r}">
6
+ <div class="segmented">
7
7
  ${de.map(n=>`
8
8
  <label class="seg">
9
- <input type="radio" name="${this.#p("mode")}" data-field="mode" value="${n.id}" ${e===n.id?"checked":""} />
9
+ <input type="radio" name="${this.#i("mode")}" data-field="mode" value="${n.id}" ${e===n.id?"checked":""} />
10
10
  <span class="seg-visual">
11
11
  <icon-wc name="${n.icon}" size="xs"></icon-wc>
12
12
  <span class="seg-label">${n.name}</span>
@@ -17,33 +17,33 @@ var _e=window.matchMedia("(prefers-reduced-motion: reduce)");var te=new Map;func
17
17
  </fieldset>
18
18
 
19
19
  <fieldset class="section">
20
- <legend>${s}${this.#h?' <span class="theme-name" aria-hidden="true"></span>':""}</legend>
21
- ${this.#h?this.#C(a):this.#A(a,s)}
20
+ <legend id="${this.#i("legend")}">${s}${this.#l?' <span class="theme-name" aria-hidden="true"></span>':""}</legend>
21
+ ${this.#l?this.#C(a):this.#A(a)}
22
22
  </fieldset>
23
- `}#g(e){let a=this.#f.filter(n=>n.themes.length);if(a.some(n=>n.themes.some(i=>i.id===e)))return a;let r=T.get(e),s=a[a.length-1];return!r||!s?a:[...a.slice(0,-1),{label:s.label,tier:s.tier,themes:[...s.themes,r]}]}#A(e,a){let r=this.#g(e),s=n=>n.map(i=>`
24
- <option value="${l(i.id)}" ${e===i.id?"selected":""}>${l(i.name)}</option>
23
+ `}#g(e){let a=this.#p.filter(n=>n.themes.length);if(a.some(n=>n.themes.some(i=>i.id===e)))return a;let r=$.get(e),s=a[a.length-1];return!r||!s?a:[...a.slice(0,-1),{label:s.label,tier:s.tier,themes:[...s.themes,r]}]}#A(e){let a=this.#g(e),r=s=>s.map(n=>`
24
+ <option value="${l(n.id)}" ${e===n.id?"selected":""}>${l(n.name)}</option>
25
25
  `).join("");return`
26
- <select class="theme-select" name="theme-brand-select" aria-label="${a}">
27
- ${r.length===1?s(r[0].themes):r.map(n=>`
28
- <optgroup label="${l(n.label)}">${s(n.themes)}</optgroup>
26
+ <select class="theme-select" name="theme-brand-select" aria-labelledby="${this.#i("legend")}">
27
+ ${a.length===1?r(a[0].themes):a.map(s=>`
28
+ <optgroup label="${l(s.label)}">${r(s.themes)}</optgroup>
29
29
  `).join("")}
30
30
  </select>
31
31
  `}#C(e){return`
32
32
  <div class="themes">
33
- ${this.#g(e).map(a=>`
33
+ ${this.#g(e).map((a,r)=>`
34
34
  <div class="theme-category">
35
- <span class="category-label">${l(a.label)}</span>
36
- <div class="swatch-grid" role="radiogroup" aria-label="${l(a.label)}">
37
- ${a.themes.map(r=>this.#T(r,e)).join("")}
35
+ <span class="category-label" id="${this.#i(`group-${r}`)}">${l(a.label)}</span>
36
+ <div class="swatch-grid" role="radiogroup" aria-labelledby="${this.#i(`group-${r}`)}">
37
+ ${a.themes.map(s=>this.#$(s,e)).join("")}
38
38
  </div>
39
39
  </div>
40
40
  `).join("")}
41
41
  </div>
42
- `}#T(e,a){let r=e.swatchFg||"white",s=e.character?`${e.name} \u2014 ${e.character}`:e.name;return`
42
+ `}#$(e,a){let r=e.swatchFg||"white",s=e.character?`${e.name} \u2014 ${e.character}`:e.name;return`
43
43
  <label class="swatch-cell" title="${l(s)}">
44
44
  <input
45
45
  type="radio"
46
- name="${this.#p("brand")}"
46
+ name="${this.#i("brand")}"
47
47
  data-field="brand"
48
48
  value="${l(e.id)}"
49
49
  ${a===e.id?"checked":""}
@@ -53,5 +53,5 @@ var _e=window.matchMedia("(prefers-reduced-motion: reduce)");var te=new Map;func
53
53
  <span class="visually-hidden">${l(e.name)}</span>
54
54
  </span>
55
55
  </label>
56
- `}#$(){this.#e.querySelectorAll('input[data-field="mode"]').forEach(r=>{r.addEventListener("change",this.#P)}),this.#e.querySelectorAll('input[data-field="brand"]').forEach(r=>{r.addEventListener("change",this.#D),r.addEventListener("focus",this.#y),r.closest("label")?.addEventListener("pointerenter",this.#y)});let e=this.#e.querySelector(".themes");e?.addEventListener("pointerleave",()=>this.#d()),e?.addEventListener("focusout",()=>this.#d());let a=this.#e.querySelector('select[name="theme-brand-select"]');a&&a.addEventListener("change",this.#L),this.#e.addEventListener("pointerdown",()=>{this.#i=!0}),this.#e.addEventListener("keydown",()=>{this.#i=!1}),this.#s||(this.listen(this.#t,"click",this.#F),this.listen(document,"click",this.#x),this.listen(document,"keydown",this.#_),this.listen(this,"focusout",this.#M))}#M=e=>{let a=e.relatedTarget;this.#a&&a instanceof Node&&!this.contains(a)&&this.close()};#F=e=>{e.stopPropagation(),this.toggle()};#x=e=>{this.#a&&!this.contains(e.target)&&this.close()};#_=e=>{e.key==="Escape"&&this.#a&&(e.preventDefault(),this.close(),this.#t?.focus())};#P=e=>{g.setMode(e.target.value),this.#u()};#y=e=>{let a=e.currentTarget,r=a instanceof HTMLInputElement?a:a.querySelector('input[data-field="brand"]');r?.value&&(ce(r.value),this.#d(r.value))};#d(e=g.getState().brand){let a=this.#e?.querySelector(".theme-name");a&&(a.textContent=T.get(e)?.name??e)}#D=async e=>{let a=e.target.closest(".swatch-cell");a&&a.setAttribute("aria-busy","true");try{await g.setBrand(e.target.value)}catch{console.warn("[VB] Theme load failed, using default")}finally{a&&a.removeAttribute("aria-busy")}this.#u()};#L=async e=>{let a=e.target;a.disabled=!0;try{await g.setBrand(a.value)}catch{console.warn("[VB] Theme load failed, using default")}finally{a.disabled=!1}this.#u()};#u(){this.#s||!this.#i||(this.#m(),this.#c=setTimeout(()=>{this.close(),this.#t?.focus()},t.#r))}#m(){this.#c&&(clearTimeout(this.#c),this.#c=null)}#R=()=>{this.#w()};#w(){if(!this.#e)return;let{mode:e,brand:a}=g.getState(),r=this.#e.querySelector(`input[data-field="mode"][value="${e}"]`);r&&(r.checked=!0);let s=this.#e.querySelector(`input[data-field="brand"][value="${a}"]`);s&&(s.checked=!0),this.#d();let n=this.#e.querySelector('select[name="theme-brand-select"]');n&&(![...n.options].some(i=>i.value===a)&&T.has(a)&&n.add(new Option(T.get(a).name,a)),n.value=a),s&&this.#a&&s.closest(".swatch-cell")?.scrollIntoView({block:"nearest"})}open(){this.#s||this.#a||(this.#a=!0,this.setAttribute("open",""),this.#t?.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{if(this.#b(),window.addEventListener("scroll",this.#n,{capture:!0,passive:!0}),window.addEventListener("resize",this.#n,{passive:!0}),!this.#a||!this.#e)return;(this.#e.querySelector('input[type="radio"]:checked')||this.#e.querySelector("input, select, button, summary, a[href]"))?.focus(),this.#e.querySelector('input[data-field="brand"]:checked')?.closest(".swatch-cell")?.scrollIntoView({block:"nearest"})}),this.dispatchEvent(new CustomEvent("theme-picker:open",{bubbles:!0})))}#b(){if(!this.#t||!this.#e)return;let e=this.#t.getBoundingClientRect(),a=this.#e.getBoundingClientRect(),r=window.visualViewport||{width:window.innerWidth,height:window.innerHeight},s=r.height,n=r.width,i=8,c=16,m=s-e.bottom-c,k=e.top-c,v=e.height+i;m<a.height&&k>m?(v=-a.height-i,this.#e.dataset.position="top"):delete this.#e.dataset.position;let $=n-e.right,h=e.right-a.width;if(this.#e.style.setProperty("--panel-top",`${v}px`),h<c){let d=0,y=e.left+a.width+c;y>n&&(d=n-y),e.left+d<c&&(d=c-e.left),this.#e.style.setProperty("--panel-left",`${d}px`),this.#e.style.setProperty("--panel-right","auto")}else{let d=Math.max(0,c-$);this.#e.style.setProperty("--panel-left","auto"),this.#e.style.setProperty("--panel-right",`${d}px`)}}close(){this.#s||!this.#a||(this.#m(),this.#i=!1,this.#a=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.dispatchEvent(new CustomEvent("theme-picker:close",{bubbles:!0})))}toggle(){this.#a?this.close():this.open()}get isOpen(){return this.#a}};ae("theme-picker",Q);export{Q as ThemePicker};
56
+ `}#T(){this.#e.querySelectorAll('input[data-field="mode"]').forEach(r=>{r.addEventListener("change",this.#P)}),this.#e.querySelectorAll('input[data-field="brand"]').forEach(r=>{r.addEventListener("change",this.#D),r.addEventListener("focus",this.#y),r.closest("label")?.addEventListener("pointerenter",this.#y)});let e=this.#e.querySelector(".themes");e?.addEventListener("pointerleave",()=>this.#h()),e?.addEventListener("focusout",()=>this.#h());let a=this.#e.querySelector('select[name="theme-brand-select"]');a&&a.addEventListener("change",this.#L),this.#e.addEventListener("pointerdown",()=>{this.#o=!0}),this.#e.addEventListener("keydown",()=>{this.#o=!1}),this.#r||(this.listen(this.#t,"click",this.#F),this.listen(document,"click",this.#x),this.listen(document,"keydown",this.#_),this.listen(this,"focusout",this.#M))}#M=e=>{let a=e.relatedTarget;this.#a&&a instanceof Node&&!this.contains(a)&&this.close()};#F=e=>{e.stopPropagation(),this.toggle()};#x=e=>{this.#a&&!this.contains(e.target)&&this.close()};#_=e=>{e.key==="Escape"&&this.#a&&(e.preventDefault(),this.close(),this.#t?.focus())};#P=e=>{g.setMode(e.target.value),this.#m()};#y=e=>{let a=e.currentTarget,r=a instanceof HTMLInputElement?a:a.querySelector('input[data-field="brand"]');r?.value&&(ie(r.value),this.#h(r.value))};#h(e=g.getState().brand){let a=this.#e?.querySelector(".theme-name");a&&(a.textContent=$.get(e)?.name??e)}#D=async e=>{let a=e.target.closest(".swatch-cell");a&&a.setAttribute("aria-busy","true");try{await g.setBrand(e.target.value)}catch{console.warn("[VB] Theme load failed, using default")}finally{a&&a.removeAttribute("aria-busy")}this.#m()};#L=async e=>{let a=e.target;a.disabled=!0;try{await g.setBrand(a.value)}catch{console.warn("[VB] Theme load failed, using default")}finally{a.disabled=!1}this.#m()};#m(){this.#r||!this.#o||(this.#f(),this.#d=setTimeout(()=>{this.close(),this.#t?.focus()},t.#s))}#f(){this.#d&&(clearTimeout(this.#d),this.#d=null)}#R=()=>{this.#w()};#w(){if(!this.#e)return;let{mode:e,brand:a}=g.getState(),r=this.#e.querySelector(`input[data-field="mode"][value="${e}"]`);r&&(r.checked=!0);let s=this.#e.querySelector(`input[data-field="brand"][value="${a}"]`);s&&(s.checked=!0),this.#h();let n=this.#e.querySelector('select[name="theme-brand-select"]');n&&(![...n.options].some(i=>i.value===a)&&$.has(a)&&n.add(new Option($.get(a).name,a)),n.value=a),s&&this.#a&&s.closest(".swatch-cell")?.scrollIntoView({block:"nearest"})}open(){this.#r||this.#a||(this.#a=!0,this.setAttribute("open",""),this.#t?.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{if(this.#b(),window.addEventListener("scroll",this.#n,{capture:!0,passive:!0}),window.addEventListener("resize",this.#n,{passive:!0}),!this.#a||!this.#e)return;(this.#e.querySelector('input[type="radio"]:checked')||this.#e.querySelector("input, select, button, summary, a[href]"))?.focus(),this.#e.querySelector('input[data-field="brand"]:checked')?.closest(".swatch-cell")?.scrollIntoView({block:"nearest"})}),this.dispatchEvent(new CustomEvent("theme-picker:open",{bubbles:!0})))}#b(){if(!this.#t||!this.#e)return;let e=this.#t.getBoundingClientRect(),a=this.#e.getBoundingClientRect(),r=window.visualViewport||{width:window.innerWidth,height:window.innerHeight},s=r.height,n=r.width,i=8,c=16,m=s-e.bottom-c,k=e.top-c,v=e.height+i;m<a.height&&k>m?(v=-a.height-i,this.#e.dataset.position="top"):delete this.#e.dataset.position;let T=n-e.right,h=e.right-a.width;if(this.#e.style.setProperty("--panel-top",`${v}px`),h<c){let d=0,y=e.left+a.width+c;y>n&&(d=n-y),e.left+d<c&&(d=c-e.left),this.#e.style.setProperty("--panel-left",`${d}px`),this.#e.style.setProperty("--panel-right","auto")}else{let d=Math.max(0,c-T);this.#e.style.setProperty("--panel-left","auto"),this.#e.style.setProperty("--panel-right",`${d}px`)}}close(){this.#r||!this.#a||(this.#f(),this.#o=!1,this.#a=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.dispatchEvent(new CustomEvent("theme-picker:close",{bubbles:!0})))}toggle(){this.#a?this.close():this.open()}get isOpen(){return this.#a}};ce("theme-picker",Q);export{Q as ThemePicker};
57
57
  //# sourceMappingURL=theme-picker.js.map
@@ -1,2 +1,2 @@
1
- var O=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function v(o,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=E.get(o);if(customElements.get(o)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(o,i),customElements.define(o,t)}var f=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,n,i){t.addEventListener(e,n,i),this.#r.push(()=>t.removeEventListener(e,n,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 n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.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}};function M(o){let t=(Date.now()-o.getTime())/1e3;if(Number.isNaN(t)||t<0)return null;if(t<60)return"just now";if(t<3600){let n=Math.floor(t/60);return`${n} minute${n!==1?"s":""} ago`}if(t<86400){let n=Math.floor(t/3600);return`${n} hour${n!==1?"s":""} ago`}if(t<2592e3){let n=Math.floor(t/86400);return`${n} day${n!==1?"s":""} ago`}if(t<31536e3){let n=Math.floor(t/2592e3);return`${n} month${n!==1?"s":""} ago`}let e=Math.floor(t/31536e3);return`${e} year${e!==1?"s":""} ago`}function c(o=document){for(let t of o.querySelectorAll("time[data-relative]")){if(t.closest("page-info"))continue;let e=t.getAttribute("datetime");if(!e)continue;let n=new Date(e),i=t.closest("[lang]")?.getAttribute("lang")||"",r=i&&!/^en\b/i.test(i)?N(n,i):M(n);r&&(t.textContent=r)}}function N(o,t){let e=(Date.now()-o.getTime())/1e3;if(Number.isNaN(e)||e<0)return null;let n;try{n=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{return M(o)}return e<60?n.format(0,"second"):e<3600?n.format(-Math.floor(e/60),"minute"):e<86400?n.format(-Math.floor(e/3600),"hour"):e<2592e3?n.format(-Math.floor(e/86400),"day"):e<31536e3?n.format(-Math.floor(e/2592e3),"month"):n.format(-Math.floor(e/31536e3),"year")}var p=typeof document<"u"?document.documentElement:null,A;function w(){c(),A||(A=setInterval(()=>c(),6e4))}p&&!p.hasAttribute("data-vb-time-relative-init")&&(p.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",w,{once:!0}):w());var S=0;function $(o){if(typeof o!="string"||!o.trim())return null;try{let t=new URL(o,document.baseURI);return t.protocol==="http:"||t.protocol==="https:"?t.href:null}catch{return null}}function T(o,t){let e=new Date(o);if(Number.isNaN(e.getTime()))return"";let n=/^\d{4}-\d{2}-\d{2}$/.test(o);try{return new Intl.DateTimeFormat(t||void 0,n?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"}).format(e)}catch{return o}}var g=class extends f{#r=`ti${++S}`;#t=!1;#e=!1;setup(){this.#o(this),c(this),this.#d();let t=this.getAttribute("updates-src");t&&!this.#e&&!this.querySelector(":scope > section[data-recent-pages]")&&this.#m(t)}#n(t,e){return this.dataset[`label${t}`]||e}#o(t){for(let e of t.querySelectorAll("time[data-relative][datetime]")){if(e.hasAttribute("title")||e.closest("page-info"))continue;let n=e.closest("[lang]")?.getAttribute("lang")||"",i=T(e.getAttribute("datetime"),n);i&&e.setAttribute("title",i)}}#s(){return[...this.querySelectorAll(".changelog-entries")]}#a(t){return[...t.children].filter(e=>/^(LI|ARTICLE|SECTION)$/.test(e.tagName))}#i(){let t=this.#s();if(t.length===1)return this.#a(t[0]);let e=new Set;for(let n of t){let i=n;for(;i.parentElement&&i.parentElement!==this;)i=i.parentElement;i.parentElement===this&&e.add(i)}return[...e]}#l(t){if(t.dataset.version)return t.dataset.version.trim();let e=t.querySelector(".version-tag")?.textContent?.trim();if(e)return e;let n=/^v(\d+(?:-[0-9a-z]+)*)$/i.exec(t.id);return n?`v${n[1].replace(/-/g,".")}`:""}#d(){if(this.querySelector(":scope > [data-timeline-controls]"))return;let t=document.createElement("nav");t.setAttribute("data-timeline-controls",""),t.setAttribute("aria-label",this.#n("Controls","Timeline controls"));let e=document.createElement("select");if(e.setAttribute("data-timeline-order",""),e.append(new Option(this.#n("Newest","Newest first"),"newest"),new Option(this.#n("Oldest","Oldest first"),"oldest")),e.value=this.#t?"oldest":"newest",e.addEventListener("change",()=>{e.value==="oldest"!==this.#t&&this.#f()}),t.append(this.#c(this.#n("Order","Order"),e)),this.hasAttribute("versions")){let i=[...new Set(this.#i().map(r=>this.#l(r)).filter(Boolean))];if(i.length>0){let r=document.createElement("select");r.setAttribute("data-timeline-version",""),r.setAttribute("aria-label",this.#n("Filter","Filter by version")),r.append(new Option(this.#n("All","All versions"),""));for(let l of i)r.append(new Option(l,l));let s=document.createElement("output");s.className="visually-hidden",s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("data-timeline-status",""),r.addEventListener("change",()=>{s.textContent=this.#h(r.value)}),t.append(this.#c(this.#n("Version","Version"),r),s)}}let n=this.querySelector(".changelog-entries");for(;n&&n.parentElement!==this;)n=n.parentElement;n?n.before(t):this.prepend(t)}#c(t,e){let n=document.createElement("label"),i=document.createElement("span");return i.textContent=t,n.append(i,e),n}#u(t){if(t.length<2)return;let e=t.map(i=>{let r=document.createComment("");return i.before(r),r}),n=[...t].reverse();e.forEach((i,r)=>i.replaceWith(n[r]))}#f(){this.#t=!this.#t;let t=this.#s();t.length!==1&&this.#u(this.#i());for(let e of t)this.#u(this.#a(e))}#h(t){let e=this.#i(),n=0;for(let r of e)r.hidden=!!t&&this.#l(r)!==t,r.hidden||n++;let i=String(e.length);return t?this.#n("Status","Showing {count} of {total} entries for {version}").replaceAll("{count}",String(n)).replaceAll("{total}",i).replaceAll("{version}",t):this.#n("StatusAll","Showing all {total} entries").replaceAll("{total}",i)}async#m(t){this.#e=!0;try{let e=await fetch(t);if(!e.ok)return;let n=await e.json();if(!Array.isArray(n)||!n.length||this.querySelector(":scope > section[data-recent-pages]"))return;let i=`${this.#r}-recent-heading`,r=document.createElement("section");r.setAttribute("data-recent-pages",""),r.setAttribute("aria-labelledby",i);let s=document.createElement("h2");s.id=i,s.textContent=this.#n("Recent","Recently updated pages");let l=document.createElement("ul");l.className="recent-pages";for(let a of n.slice(0,10)){if(!a||typeof a!="object")continue;let b=$(a.href??a.url),y=typeof a.title=="string"?a.title.trim():"";if(!b||!y)continue;let h=document.createElement("li"),m=document.createElement("a");m.href=b,m.textContent=y,h.append(m);let u=a.modified??a.date;if(typeof u=="string"&&!Number.isNaN(new Date(u).getTime())){let d=document.createElement("time");d.dateTime=u,d.setAttribute("data-relative",""),d.textContent=u,h.append(d)}l.append(h)}if(!l.children.length)return;r.append(s,l),this.append(r),this.#o(r),c(r)}catch{}finally{this.#e=!1}}};v("time-index",g);export{g as TimeIndex};
1
+ var L=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function E(i,t,e={}){let n=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=v.get(i);if(customElements.get(i)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(i,o),customElements.define(i,t)}var f=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,n,o){t.addEventListener(e,n,o),this.#r.push(()=>t.removeEventListener(e,n,o))}_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 n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let o=`--${t}`;e?n.add(o):n.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}};function S(i){let t=(Date.now()-i.getTime())/1e3;if(Number.isNaN(t)||t<0)return null;if(t<60)return"just now";if(t<3600){let n=Math.floor(t/60);return`${n} minute${n!==1?"s":""} ago`}if(t<86400){let n=Math.floor(t/3600);return`${n} hour${n!==1?"s":""} ago`}if(t<2592e3){let n=Math.floor(t/86400);return`${n} day${n!==1?"s":""} ago`}if(t<31536e3){let n=Math.floor(t/2592e3);return`${n} month${n!==1?"s":""} ago`}let e=Math.floor(t/31536e3);return`${e} year${e!==1?"s":""} ago`}function l(i=document){for(let t of i.querySelectorAll("time[data-relative]")){if(t.closest("page-info"))continue;let e=t.getAttribute("datetime");if(!e)continue;let n=new Date(e),o=t.closest("[lang]")?.getAttribute("lang")||"",r=o&&!/^en\b/i.test(o)?$(n,o):S(n);r&&(t.textContent=r)}}function $(i,t){let e=(Date.now()-i.getTime())/1e3;if(Number.isNaN(e)||e<0)return null;let n;try{n=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{return S(i)}return e<60?n.format(0,"second"):e<3600?n.format(-Math.floor(e/60),"minute"):e<86400?n.format(-Math.floor(e/3600),"hour"):e<2592e3?n.format(-Math.floor(e/86400),"day"):e<31536e3?n.format(-Math.floor(e/2592e3),"month"):n.format(-Math.floor(e/31536e3),"year")}var p=typeof document<"u"?document.documentElement:null,A;function w(){l(),A||(A=setInterval(()=>l(),6e4))}p&&!p.hasAttribute("data-vb-time-relative-init")&&(p.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",w,{once:!0}):w());var M=0;function T(i){if(typeof i!="string"||!i.trim())return null;try{let t=new URL(i,document.baseURI);return t.protocol==="http:"||t.protocol==="https:"?t.href:null}catch{return null}}function C(i,t){let e=new Date(i);if(Number.isNaN(e.getTime()))return"";let n=/^\d{4}-\d{2}-\d{2}$/.test(i);try{return new Intl.DateTimeFormat(t||void 0,n?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"}).format(e)}catch{return i}}var b=class extends f{#r=`ti${++M}`;#t=!1;#e=!1;setup(){this.#i(this),l(this),this.#u();let t=this.getAttribute("updates-src");t&&!this.#e&&!this.querySelector(":scope > section[data-recent-pages]")&&this.#m(t)}#n(t,e){return this.dataset[`label${t}`]||e}#i(t){for(let e of t.querySelectorAll("time[data-relative][datetime]")){if(e.hasAttribute("title")||e.closest("page-info"))continue;let n=e.closest("[lang]")?.getAttribute("lang")||"",o=C(e.getAttribute("datetime"),n);o&&e.setAttribute("title",o)}}#s(){return[...this.querySelectorAll(".changelog-entries")]}#a(t){return[...t.children].filter(e=>/^(LI|ARTICLE|SECTION)$/.test(e.tagName))}#o(){let t=this.#s();if(t.length===1)return this.#a(t[0]);let e=new Set;for(let n of t){let o=n;for(;o.parentElement&&o.parentElement!==this;)o=o.parentElement;o.parentElement===this&&e.add(o)}return[...e]}#c(t){if(t.dataset.version)return t.dataset.version.trim();let e=t.querySelector(".version-tag")?.textContent?.trim();if(e)return e;let n=/^v(\d+(?:-[0-9a-z]+)*)$/i.exec(t.id);return n?`v${n[1].replace(/-/g,".")}`:""}#u(){if(this.querySelector(":scope > [data-timeline-controls]"))return;let t=document.createElement("nav");t.setAttribute("data-timeline-controls",""),t.setAttribute("aria-label",this.#n("Controls","Timeline controls"));let e=document.createElement("select");if(e.setAttribute("data-timeline-order",""),e.append(new Option(this.#n("Newest","Newest first"),"newest"),new Option(this.#n("Oldest","Oldest first"),"oldest")),e.value=this.#t?"oldest":"newest",e.addEventListener("change",()=>{e.value==="oldest"!==this.#t&&this.#f()}),t.append(this.#l(this.#n("Order","Order"),e)),this.hasAttribute("versions")){let o=[...new Set(this.#o().map(r=>this.#c(r)).filter(Boolean))];if(o.length>0){let r=document.createElement("select");r.setAttribute("data-timeline-version",""),r.setAttribute("aria-label",this.#n("Filter","Filter by version")),r.append(new Option(this.#n("All","All versions"),""));for(let c of o)r.append(new Option(c,c));let s=document.createElement("output");s.className="visually-hidden",s.setAttribute("role","status"),s.setAttribute("aria-live","polite"),s.setAttribute("data-timeline-status",""),r.addEventListener("change",()=>{s.textContent=this.#h(r.value)}),t.append(this.#l(this.#n("Version","Version"),r),s)}}let n=this.querySelector(".changelog-entries");for(;n&&n.parentElement!==this;)n=n.parentElement;n?n.before(t):this.prepend(t)}#l(t,e){let n=document.createElement("label"),o=document.createElement("span");return o.textContent=t,n.append(o,e),n}#d(t){if(t.length<2)return;let e=t.map(o=>{let r=document.createComment("");return o.before(r),r}),n=[...t].reverse();e.forEach((o,r)=>o.replaceWith(n[r]))}#f(){this.#t=!this.#t;let t=this.#s();t.length!==1&&this.#d(this.#o());for(let e of t)this.#d(this.#a(e))}#h(t){let e=this.#o(),n=0;for(let r of e)r.hidden=!!t&&this.#c(r)!==t,r.hidden||n++;let o=String(e.length);return t?this.#n("Status","Showing {count} of {total} entries for {version}").replaceAll("{count}",String(n)).replaceAll("{total}",o).replaceAll("{version}",t):this.#n("StatusAll","Showing all {total} entries").replaceAll("{total}",o)}async#m(t){this.#e=!0;try{let e=await fetch(t);if(!e.ok)return;let n=await e.json();if(!Array.isArray(n)||!n.length||this.querySelector(":scope > section[data-recent-pages]"))return;let o=`${this.#r}-recent-heading`,r=document.createElement("section");r.setAttribute("data-recent-pages",""),r.setAttribute("aria-labelledby",o);let s=document.createElement("h2");s.id=o,s.textContent=this.#n("Recent","Recently updated pages");let c=document.createElement("ul");c.className="recent-pages";for(let a of n.slice(0,10)){if(!a||typeof a!="object")continue;let g=T(a.href??a.url),y=typeof a.title=="string"?a.title.trim():"";if(!g||!y)continue;let h=document.createElement("li"),m=document.createElement("a");m.href=g,m.textContent=y,h.append(m);let d=a.modified??a.date;if(typeof d=="string"&&!Number.isNaN(new Date(d).getTime())){let u=document.createElement("time");u.dateTime=d,u.setAttribute("data-relative",""),u.textContent=d,h.append(u)}c.append(h)}if(!c.children.length)return;r.append(s,c),this.append(r),this.#i(r),l(r)}catch{}finally{this.#e=!1}}};E("time-index",b);export{b as TimeIndex};
2
2
  //# sourceMappingURL=time-index.js.map
@@ -1,2 +1,2 @@
1
- var $=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function A(h,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(h);if(customElements.get(h)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> 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 <${h}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(h,n),customElements.define(h,t)}var b=class extends HTMLElement{#t=[];#a;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#a||(this.#a=this.attachInternals());let i=this.#a.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#a||(this.#a=t)}#e(){return this.constructor.formAssociated&&this.#a?this.#a: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 p=86400,k=0;function m(h){return String(h).padStart(2,"0")}function f(h){if(!h)return null;let t=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/.exec(String(h).trim());if(!t)return null;let e=Number(t[1]),i=Number(t[2]),n=Number(t[3]||0);return e>23||i>59||n>59?null:e*3600+i*60+n}function w(h,t){let e=Math.floor(h/3600),i=Math.floor(h%3600/60),n=h%60;return t?`${m(e)}:${m(i)}:${m(n)}`:`${m(e)}:${m(i)}`}function c(h,t){return(h%t+t)%t}function x(h){try{let{hourCycle:t}=new Intl.DateTimeFormat(h||void 0,{hour:"numeric"}).resolvedOptions();return t==="h12"||t==="h11"?"12h":"24h"}catch{return"24h"}}function E(h){let t={am:"AM",pm:"PM",periodFirst:!1};try{let e=new Intl.DateTimeFormat(h||void 0,{hour:"numeric",minute:"2-digit",hourCycle:"h12"}),i=e.formatToParts(new Date(2e3,0,1,9,0)),n=e.formatToParts(new Date(2e3,0,1,21,0)),s=i.find(a=>a.type==="dayPeriod")?.value,r=n.find(a=>a.type==="dayPeriod")?.value;if(s&&r){t.am=s,t.pm=r;let a=i.map(o=>o.type);t.periodFirst=a.indexOf("dayPeriod")<a.indexOf("hour")}}catch{}return t}function C(h,t){let e=h.trim().toLowerCase();if(!e)return null;let i=null,n=[[t.am.toLowerCase(),"AM"],[t.pm.toLowerCase(),"PM"],["a.m.","AM"],["p.m.","PM"],["am","AM"],["pm","PM"],["a","AM"],["p","PM"]].sort((u,l)=>l[0].length-u[0].length);for(let[u,l]of n)if(u){if(e.endsWith(u)){i=l,e=e.slice(0,-u.length).trim();break}if(e.startsWith(u)){i=l,e=e.slice(u.length).trim();break}}if(!/^\d{1,2}(?:[:.]\d{1,2}){0,2}$/.test(e))return null;let s=e.split(/[:.]/).map(Number),r=s[0],a=s[1]??0,o=s[2]??0;if(a>59||o>59)return null;if(i){if(r<1||r>12)return null;i==="AM"?r=r===12?0:r:r=r===12?12:r+12}else if(r>23)return null;return r*3600+a*60+o}var g=class extends b{static formAssociated=!0;static get observedAttributes(){return["disabled","required"]}#t;#a=`tp${++k}`;#e=!1;#s;#i;#y;#h;#r;#f=[];#m=null;#x=[];#c="24h";#v="";#A={am:"AM",pm:"PM",periodFirst:!1};#b=!1;#n=null;#d=null;#w=null;#u=60;#P;#E;#o=!1;#U="";#T=!1;constructor(){super(),this.#t=this.attachInternals(),this._adoptInternals(this.#t)}setup(){let t=this.querySelector(':scope > input[type="time"]');if(!t)return!1;this.#s=t,this.#v=this.closest("[lang]")?.lang||navigator.language||"en-US",this.#A=E(this.#v);let e=this.getAttribute("data-format");this.#c=e==="12h"||e==="24h"?e:x(this.#v),this.#z();let i=t.getAttribute("name");i&&(this.hasAttribute("name")||this.setAttribute("name",i),t.removeAttribute("name")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),this.hasAttribute("disabled")||this.setAttribute("disabled",""));let n=`${this.#a}-no-form`,s=t.getAttribute("form");return s&&s!==n&&!this.hasAttribute("form")&&this.setAttribute("form",s),t.setAttribute("form",n),this.#P===void 0&&(this.#P=t.defaultValue),this.#E!==void 0&&(t.value=this.#E,this.#E=void 0),this.#n=f(t.value),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.listen(t,"click",this.#Y),this.listen(t,"focus",this.#F),this.#J(),this.#Q(),this.#e=!0,this.#G(),this.#D(),this.#L(!1),this.#S(),this.listen(document,"click",this.#X),this.listen(this,"focusout",this.#Z),this.listen(this,"invalid",this.#_),this.#V(this.matches(":disabled")),!0}teardown(){this.#o=!1,this.#y?.remove(),this.#r?.remove(),this.#f=[],this.#x=[],this.#m=null,this.#e=!1,clearTimeout(this.#B),this.#M=""}attributeChangedCallback(t){this.#e&&(t==="disabled"&&this.#V(this.matches(":disabled")),t==="required"&&this.#S())}formDisabledCallback(t){this.#e&&this.#V(t)}#V(t){this.#i.disabled=t,this.#h.disabled=t,t&&this.#p()}#z(){let t=this.#s.getAttribute("step");if(t&&t.trim().toLowerCase()==="any")this.#u=null;else{let i=Number(t);this.#u=Number.isFinite(i)&&i>0?Math.max(1,Math.round(i)):60}this.#d=f(this.#s.getAttribute("min")),this.#w=f(this.#s.getAttribute("max"));let e=f(this.#s.value);this.#b=this.#u!==null&&this.#u%60!==0||e!==null&&e%60!==0}#l(t,e){return this.dataset[`label${t}`]||e}#F=()=>{this.#e&&!this.#i.disabled&&this.#i.focus()};#Y=t=>{t.preventDefault(),this.#F()};#G(){let t=new Set([...Array.from(this.#s.labels||[]),...Array.from(this.#t.labels||[])]),e=[];for(let r of t)r.id||(r.id=`${this.#a}-label-${e.length}`),e.push(r.id),this.listen(r,"click",this.#F);let i=this.#i,n=e.join(" ")||this.#s.getAttribute("aria-labelledby")||this.getAttribute("aria-labelledby");n?i.setAttribute("aria-labelledby",n):i.setAttribute("aria-label",this.#s.getAttribute("aria-label")||this.getAttribute("aria-label")||this.#l("Input","Time"));let s=this.#s.getAttribute("aria-describedby");s&&i.setAttribute("aria-describedby",s)}#J(){this.#y=document.createElement("div"),this.#y.className="time-trigger";let t=document.createElement("input");t.type="text",t.className="time-input",t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("autocomplete","off"),t.setAttribute("placeholder",this.#l("Placeholder","Type a time\u2026")),this.#i=t,this.#y.appendChild(t),this.#h=document.createElement("button"),this.#h.type="button",this.#h.className="time-trigger-icon",this.#h.setAttribute("aria-label",this.#l("Toggle","Toggle time spinners")),this.#h.setAttribute("tabindex","-1");let e=document.createElement("icon-wc");e.setAttribute("name","clock"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),this.#h.appendChild(e),this.#y.appendChild(this.#h),this.appendChild(this.#y),this.listen(this.#h,"click",i=>{i.stopPropagation(),this.#o?this.#p():this.#j(),this.#i.focus()}),this.listen(t,"focus",()=>t.select()),this.listen(t,"keydown",this.#tt),this.listen(t,"blur",this.#et)}#Q(){let t=`${this.#a}-panel`;this.#r=document.createElement("div"),this.#r.className="time-panel",this.#r.id=t,this.#r.setAttribute("role","dialog"),this.#r.setAttribute("aria-modal","false"),this.#r.setAttribute("aria-label",this.#l("Dialog","Choose time")),this.#i.setAttribute("aria-controls",t);let e=this.#u??60,i=e>=3600&&e%3600===0?e/3600:1,n=e>=60&&e<3600&&e%60===0?e/60:1,s=e<60?e:1,r=e>=3600&&e%3600===0,a=this.#c==="12h",o=null;a&&(o=document.createElement("button"),o.type="button",o.className="period-toggle"),this.#m=o,o&&this.#A.periodFirst&&this.#r.appendChild(o);let u=!a&&this.#d!==null&&this.#w!==null&&this.#d<=this.#w;this.#f=[],this.#f.push(this.#q("hour",this.#l("Hours","Hours"),a?1:u?Math.floor(this.#d/3600):0,a?12:u?Math.floor(this.#w/3600):23,i,!1)),this.#r.appendChild(this.#R()),this.#f.push(this.#q("minute",this.#l("Minutes","Minutes"),0,59,n,r)),this.#b&&(this.#r.appendChild(this.#R()),this.#f.push(this.#q("second",this.#l("Seconds","Seconds"),0,59,s,!1))),o&&!this.#A.periodFirst&&this.#r.appendChild(o),this.#x=[...this.#r.querySelectorAll(".time-spinner, .period-toggle")],this.appendChild(this.#r);for(let l of this.#f)this.listen(l.incBtn,"click",()=>this.#k(l,l.delta,"pointer")),this.listen(l.decBtn,"click",()=>this.#k(l,-l.delta,"pointer")),this.listen(l.el,"keydown",d=>this.#it(d,l));if(this.#m){let l=this.#m;this.listen(l,"click",d=>{this.#rt(d.detail===0?"keyboard":"pointer")}),this.listen(l,"keydown",d=>this.#K(d,l))}}#q(t,e,i,n,s,r){let a=document.createElement("div");a.className="time-spinner",a.dataset.unit=t,a.setAttribute("role","spinbutton"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin",String(i)),a.setAttribute("aria-valuemax",String(n)),r&&a.setAttribute("aria-readonly","true"),a.setAttribute("tabindex","0");let o=document.createElement("button");o.type="button",o.className="time-inc",o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex","-1"),o.textContent="\u25B2",r&&(o.disabled=!0);let u=document.createElement("span");u.className="time-value";let l=document.createElement("button");return l.type="button",l.className="time-dec",l.setAttribute("aria-hidden","true"),l.setAttribute("tabindex","-1"),l.textContent="\u25BC",r&&(l.disabled=!0),a.append(o,u,l),this.#r.appendChild(a),{unit:t,el:a,valueEl:u,incBtn:o,decBtn:l,min:i,max:n,delta:s,readOnly:r}}#R(){let t=document.createElement("span");return t.className="time-sep",t.setAttribute("aria-hidden","true"),t.textContent=":",t}#j(){this.#o||this.#i.disabled||(this.#o=!0,this.#r.setAttribute("data-open",""),this.#i.setAttribute("aria-expanded","true"))}#p(){this.#o&&(this.#o=!1,this.#r.removeAttribute("data-open"),this.#i.setAttribute("aria-expanded","false"))}#X=t=>{this.#o&&!this.contains(t.target)&&this.#p()};#Z=t=>{let e=t.relatedTarget;e instanceof Node&&this.contains(e)||this.#p()};#C(t){try{let e=new Date(2e3,0,1,Math.floor(t/3600),Math.floor(t%3600/60),t%60),i={hour:this.#c==="12h"?"numeric":"2-digit",minute:"2-digit",hourCycle:this.#c==="12h"?"h12":"h23"};return this.#b&&(i.second="2-digit"),new Intl.DateTimeFormat(this.#v,i).format(e)}catch{return w(t,this.#b)}}#tt=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation(),this.#H(),this.#o&&this.#p();return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#o||this.#j(),this.#x[0]?.focus();return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#o&&this.#p(),this.#D();return}};#H(){let t=this.#i.value.trim();if(!t)this.#g(null,"keyboard");else{let e=C(t,this.#A);e!==null&&this.#g(e,"keyboard")}this.#D()}#et=t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#H(),this.#_())};#_=()=>{this.#e&&(this.#T||(this.#T=!0,this.#S()),this.#s.dispatchEvent(new Event("blur",{bubbles:!0})))};#K(t,e){let i=this.#x.indexOf(e),n=getComputedStyle(this).direction==="rtl",s=n?"ArrowLeft":"ArrowRight",r=n?"ArrowRight":"ArrowLeft";return t.key===s||t.key===r?(t.preventDefault(),this.#x[i+(t.key===s?1:-1)]?.focus(),!0):t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),this.#p(),this.#i.focus(),!0):!1}#it(t,e){if(this.#K(t,e.el))return;let i=e.unit==="hour"?e.delta:e.delta*10;switch(t.key){case"ArrowUp":t.preventDefault(),this.#k(e,e.delta,"keyboard");break;case"ArrowDown":t.preventDefault(),this.#k(e,-e.delta,"keyboard");break;case"PageUp":t.preventDefault(),this.#k(e,i,"keyboard");break;case"PageDown":t.preventDefault(),this.#k(e,-i,"keyboard");break;case"Home":t.preventDefault(),this.#O(e,e.min,1,"keyboard");break;case"End":t.preventDefault(),this.#O(e,e.max,-1,"keyboard");break;default:/^\d$/.test(t.key)&&(t.preventDefault(),this.#st(t.key,e))}}#M="";#B;#st(t,e){clearTimeout(this.#B),this.#M+=t;let i=()=>{let n=Math.min(Math.max(Number(this.#M),e.min),e.max);this.#M="",this.#O(e,n,0,"keyboard")};this.#M.length>=2||Number(this.#M)*10>e.max?i():this.#B=setTimeout(i,800)}#I(){return this.#$(this.#d??0,1)}#$(t,e){let i=c(t,p),n=this.#u;if(n){let a=this.#d??0,o=(i-a)/n,u=e>0?Math.floor(o):e<0?Math.ceil(o):Math.round(o);i=c(a+u*n,p)}let s=this.#d,r=this.#w;return s!==null&&r!==null&&s<=r?(i<s&&(i=s),i>r&&(i=n?s+Math.floor((r-s)/n)*n:r)):s!==null&&r===null&&i<s?i=s:r!==null&&s===null&&i>r&&(i=n?Math.floor(r/n)*n:r),i}#k(t,e,i){if(t.readOnly)return;if(this.#n===null){this.#g(this.#I(),i);return}let n=this.#n,s=Math.floor(n/3600),r=Math.floor(n%3600/60),a=n%60,o;t.unit==="hour"?o=(this.#c==="12h"?c(s%12+e,12)+(s>=12?12:0):c(s+e,24))*3600+r*60+a:t.unit==="minute"?o=s*3600+c(r+e,60)*60+a:o=s*3600+r*60+c(a+e,60),this.#g(this.#$(o,e),i)}#O(t,e,i,n){if(t.readOnly)return;let s=this.#n??this.#I(),r=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60,u;t.unit==="hour"?u=(this.#c==="12h"?e%12+(r>=12?12:0):e)*3600+a*60+o:t.unit==="minute"?u=r*3600+e*60+o:u=r*3600+a*60+e,this.#g(this.#$(u,i),n)}#rt(t){let e=this.#n??this.#I();this.#g(this.#$(c(e+12*3600,p),0),t)}#g(t,e){let i=this.value;return this.#n=t,t!==null&&t%60!==0&&!this.#b&&(this.#b=!0),this.#D(),this.value===i?!1:(this.#L(),this.#S(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{...this.#nt(),source:e}})),!0)}#nt(){let t=this.#n;return t===null?{value:"",hours:null,minutes:null,seconds:null}:{value:this.value,hours:Math.floor(t/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}#D(){if(!this.#e)return;let t=this.#n;this.#i.value=t===null?"":this.#C(t);let e=this.#l("Empty","Not set"),i=t===null?null:Math.floor(t/3600),n={hour:i===null?null:this.#c==="12h"?i%12||12:i,minute:t===null?null:Math.floor(t%3600/60),second:t===null?null:t%60},s=i===null?"":i>=12?this.#A.pm:this.#A.am;for(let r of this.#f){let a=n[r.unit];if(r.valueEl.textContent=a===null?"--":m(a),a===null){r.el.removeAttribute("aria-valuenow"),r.el.setAttribute("aria-valuetext",e);continue}r.el.setAttribute("aria-valuenow",String(a));let o;try{o=r.unit==="hour"&&this.#c==="12h"?new Intl.DateTimeFormat(this.#v,{hour:"numeric",hourCycle:"h12"}).format(new Date(2e3,0,1,i)):new Intl.NumberFormat(this.#v,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(a)}catch{o=r.unit==="hour"&&s?`${a} ${s}`:String(a)}r.el.setAttribute("aria-valuetext",o)}this.#m&&(this.#m.textContent=s||"--",this.#m.setAttribute("aria-label",`${this.#l("Period","AM/PM")}: ${s||e}`))}#L(t=!0){let e=this.value;this.#t.setFormValue(e||null),this.#s.value=e,t&&this.#s.dispatchEvent(new Event("input",{bubbles:!0}))}#N(t,e,i,n={}){let s=this.#s.getAttribute(`data-message-${t.toLowerCase()}`)??this.#l(e,i);for(let[r,a]of Object.entries(n))s=s.replaceAll(`{${r}}`,a);return s}#S(){if(!this.#e)return!1;let t=this.hasAttribute("required")||this.#s.hasAttribute("required");t?this.#i.setAttribute("aria-required","true"):this.#i.removeAttribute("aria-required");let e=this.#n,i=this.#d,n=this.#w,s={},r="";if(e===null)t&&(s={valueMissing:!0},r=this.#N("valueMissing","Required","Please select a time"));else{let u=i!==null&&n!==null&&i>n,l=i!==null&&e<i,d=n!==null&&e>n;if(u?l&&d:l)s=u?{rangeUnderflow:!0,rangeOverflow:!0}:{rangeUnderflow:!0},r=this.#N("rangeUnderflow","RangeUnderflow","Choose a time at or after {time}",{time:this.#C(i)});else if(!u&&d)s={rangeOverflow:!0},r=this.#N("rangeOverflow","RangeOverflow","Choose a time at or before {time}",{time:this.#C(n)});else if(this.#u&&c(e-(i??0),this.#u)!==0){let y=this.#$(e,1),M=c(y+this.#u,p);s={stepMismatch:!0},r=this.#N("stepMismatch","StepMismatch","Choose a valid time. The nearest are {lower} and {upper}",{lower:this.#C(y),upper:this.#C(M)})}}let a=this.#t.validationMessage;return r?this.#t.setValidity(s,r,this.#i):this.#t.setValidity({}),r&&(e!==null||this.#T)?this.#i.setAttribute("aria-invalid","true"):this.#i.removeAttribute("aria-invalid"),(this.#s.validationMessage===this.#U||!this.#s.validity.customError)&&(this.#s.setCustomValidity(r),this.#U=r),a!==r}#W(t){this.#n=t,this.#D(),this.#L(),this.#S()}formResetCallback(){this.#e&&(this.#T=!1,this.#W(f(this.#P)))}formStateRestoreCallback(t){!this.#e||typeof t!="string"||this.#W(f(t))}get form(){return this.#t.form}get validity(){return this.#t.validity}get validationMessage(){return this.#t.validationMessage}get willValidate(){return this.#t.willValidate}checkValidity(){return this.#t.checkValidity()}reportValidity(){return this.#t.reportValidity()}get value(){return this.#e?this.#n===null?"":w(this.#n,this.#b):this.#E??""}set value(t){let e=t==null?"":String(t).trim(),i=e?f(e):null;if(!(e&&i===null)){if(!this.#e){this.#E=e;return}this.#g(i,"api")}}};A("time-picker",g);export{g as TimePicker};
1
+ var P=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function A(u,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(u);if(customElements.get(u)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> 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 <${u}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(u,n),customElements.define(u,t)}var b=class extends HTMLElement{#t=[];#a;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#a||(this.#a=this.attachInternals());let i=this.#a.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#a||(this.#a=t)}#e(){return this.constructor.formAssociated&&this.#a?this.#a: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 p=86400,M=0;function m(u){return String(u).padStart(2,"0")}function f(u){if(!u)return null;let t=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/.exec(String(u).trim());if(!t)return null;let e=Number(t[1]),i=Number(t[2]),n=Number(t[3]||0);return e>23||i>59||n>59?null:e*3600+i*60+n}function w(u,t){let e=Math.floor(u/3600),i=Math.floor(u%3600/60),n=u%60;return t?`${m(e)}:${m(i)}:${m(n)}`:`${m(e)}:${m(i)}`}function c(u,t){return(u%t+t)%t}function k(u){try{let{hourCycle:t}=new Intl.DateTimeFormat(u||void 0,{hour:"numeric"}).resolvedOptions();return t==="h12"||t==="h11"?"12h":"24h"}catch{return"24h"}}function x(u){let t={am:"AM",pm:"PM",periodFirst:!1};try{let e=new Intl.DateTimeFormat(u||void 0,{hour:"numeric",minute:"2-digit",hourCycle:"h12"}),i=e.formatToParts(new Date(2e3,0,1,9,0)),n=e.formatToParts(new Date(2e3,0,1,21,0)),s=i.find(a=>a.type==="dayPeriod")?.value,r=n.find(a=>a.type==="dayPeriod")?.value;if(s&&r){t.am=s,t.pm=r;let a=i.map(o=>o.type);t.periodFirst=a.indexOf("dayPeriod")<a.indexOf("hour")}}catch{}return t}function C(u,t){let e=u.trim().toLowerCase();if(!e)return null;let i=null,n=[[t.am.toLowerCase(),"AM"],[t.pm.toLowerCase(),"PM"],["a.m.","AM"],["p.m.","PM"],["am","AM"],["pm","PM"],["a","AM"],["p","PM"]].sort((h,l)=>l[0].length-h[0].length);for(let[h,l]of n)if(h){if(e.endsWith(h)){i=l,e=e.slice(0,-h.length).trim();break}if(e.startsWith(h)){i=l,e=e.slice(h.length).trim();break}}if(!/^\d{1,2}(?:[:.]\d{1,2}){0,2}$/.test(e))return null;let s=e.split(/[:.]/).map(Number),r=s[0],a=s[1]??0,o=s[2]??0;if(a>59||o>59)return null;if(i){if(r<1||r>12)return null;i==="AM"?r=r===12?0:r:r=r===12?12:r+12}else if(r>23)return null;return r*3600+a*60+o}var g=class extends b{static formAssociated=!0;static get observedAttributes(){return["disabled","required"]}#t;#a=`tp${++M}`;#e=!1;#s;#i;#y;#u;#r;#f=[];#m=null;#k=[];#c="24h";#v="";#A={am:"AM",pm:"PM",periodFirst:!1};#b=!1;#n=null;#d=null;#w=null;#h=60;#F;#x;#o=!1;#H="";#P=!1;constructor(){super(),this.#t=this.attachInternals(),this._adoptInternals(this.#t)}setup(){let t=this.querySelector(':scope > input[type="time"]');if(!t)return!1;this.#s=t,this.#v=this.closest("[lang]")?.lang||navigator.language||"en-US",this.#A=x(this.#v);let e=this.getAttribute("data-format");this.#c=e==="12h"||e==="24h"?e:k(this.#v),this.#Y();let i=t.getAttribute("name");i&&(this.hasAttribute("name")||this.setAttribute("name",i),t.removeAttribute("name")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),this.hasAttribute("disabled")||this.setAttribute("disabled",""));let n=`${this.#a}-no-form`,s=t.getAttribute("form");return s&&s!==n&&!this.hasAttribute("form")&&this.setAttribute("form",s),t.setAttribute("form",n),this.#F===void 0&&(this.#F=t.defaultValue),this.#x!==void 0&&(t.value=this.#x,this.#x=void 0),this.#n=f(t.value),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.listen(t,"click",this.#G),this.listen(t,"focus",this.#V),this.#Q(),this.#X(),this.#e=!0,this.#J(),this.#S(),this.#_(!1),this.#T(),this.listen(document,"click",this.#Z),this.listen(this,"focusout",this.#N),this.listen(this,"invalid",this.#K),this.#B(this.matches(":disabled")),!0}teardown(){this.#o=!1,this.#y?.remove(),this.#r?.remove(),this.#f=[],this.#k=[],this.#m=null,this.#e=!1,clearTimeout(this.#q),this.#E=""}attributeChangedCallback(t){this.#e&&(t==="disabled"&&this.#B(this.matches(":disabled")),t==="required"&&this.#T())}formDisabledCallback(t){this.#e&&this.#B(t)}#B(t){this.#i.disabled=t,this.#u.disabled=t,t&&this.#p()}#Y(){let t=this.#s.getAttribute("step");if(t&&t.trim().toLowerCase()==="any")this.#h=null;else{let i=Number(t);this.#h=Number.isFinite(i)&&i>0?Math.max(1,Math.round(i)):60}this.#d=f(this.#s.getAttribute("min")),this.#w=f(this.#s.getAttribute("max"));let e=f(this.#s.value);this.#b=this.#h!==null&&this.#h%60!==0||e!==null&&e%60!==0}#l(t,e){return this.dataset[`label${t}`]||e}#V=()=>{this.#e&&!this.#i.disabled&&this.#i.focus()};#G=t=>{t.preventDefault(),this.#V()};#J(){let t=new Set([...Array.from(this.#s.labels||[]),...Array.from(this.#t.labels||[])]),e=[];for(let r of t)r.id||(r.id=`${this.#a}-label-${e.length}`),e.push(r.id),this.listen(r,"click",this.#V);let i=this.#i,n=e.join(" ")||this.#s.getAttribute("aria-labelledby")||this.getAttribute("aria-labelledby");n?i.setAttribute("aria-labelledby",n):i.setAttribute("aria-label",this.#s.getAttribute("aria-label")||this.getAttribute("aria-label")||this.#l("Input","Time"));let s=this.#s.getAttribute("aria-describedby");s&&i.setAttribute("aria-describedby",s)}#Q(){this.#y=document.createElement("div"),this.#y.className="time-trigger";let t=document.createElement("input");t.type="text",t.className="time-input",t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("autocomplete","off"),t.setAttribute("placeholder",this.#l("Placeholder","Type a time\u2026")),this.#i=t,this.#y.appendChild(t),this.#u=document.createElement("button"),this.#u.type="button",this.#u.className="time-trigger-icon",this.#u.setAttribute("aria-label",this.#l("Toggle","Toggle time spinners")),this.#u.setAttribute("tabindex","-1");let e=document.createElement("icon-wc");e.setAttribute("name","clock"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),this.#u.appendChild(e),this.#y.appendChild(this.#u),this.appendChild(this.#y),this.listen(this.#u,"click",i=>{i.stopPropagation(),this.#o?this.#p():this.#R(),this.#i.focus()}),this.listen(t,"focus",()=>t.select()),this.listen(t,"keydown",this.#tt),this.listen(t,"blur",this.#et)}#X(){let t=`${this.#a}-panel`;this.#r=document.createElement("div"),this.#r.className="time-panel",this.#r.id=t,this.#r.setAttribute("role","dialog"),this.#r.setAttribute("aria-modal","false"),this.#r.setAttribute("aria-label",this.#l("Dialog","Choose time")),this.#i.setAttribute("aria-controls",t);let e=this.#h??60,i=e>=3600&&e%3600===0?e/3600:1,n=e>=60&&e<3600&&e%60===0?e/60:1,s=e<60?e:1,r=e>=3600&&e%3600===0,a=this.#c==="12h",o=null;a&&(o=document.createElement("button"),o.type="button",o.className="period-toggle"),this.#m=o,o&&this.#A.periodFirst&&this.#r.appendChild(o);let h=!a&&this.#d!==null&&this.#w!==null&&this.#d<=this.#w;this.#f=[],this.#f.push(this.#L("hour",this.#l("Hours","Hours"),a?1:h?Math.floor(this.#d/3600):0,a?12:h?Math.floor(this.#w/3600):23,i,!1)),this.#r.appendChild(this.#j()),this.#f.push(this.#L("minute",this.#l("Minutes","Minutes"),0,59,n,r)),this.#b&&(this.#r.appendChild(this.#j()),this.#f.push(this.#L("second",this.#l("Seconds","Seconds"),0,59,s,!1))),o&&!this.#A.periodFirst&&this.#r.appendChild(o),this.#k=[...this.#r.querySelectorAll(".time-spinner, .period-toggle")],this.appendChild(this.#r);for(let l of this.#f)this.listen(l.incBtn,"click",()=>this.#M(l,l.delta,"pointer")),this.listen(l.decBtn,"click",()=>this.#M(l,-l.delta,"pointer")),this.listen(l.el,"keydown",d=>this.#it(d,l));if(this.#m){let l=this.#m;this.listen(l,"click",d=>{this.#rt(d.detail===0?"keyboard":"pointer")}),this.listen(l,"keydown",d=>this.#z(d,l))}}#L(t,e,i,n,s,r){let a=document.createElement("div");a.className="time-spinner",a.dataset.unit=t,a.setAttribute("role","spinbutton"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin",String(i)),a.setAttribute("aria-valuemax",String(n)),r&&a.setAttribute("aria-readonly","true"),a.setAttribute("tabindex","0");let o=document.createElement("button");o.type="button",o.className="time-inc",o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex","-1"),o.textContent="\u25B2",r&&(o.disabled=!0);let h=document.createElement("span");h.className="time-value";let l=document.createElement("button");return l.type="button",l.className="time-dec",l.setAttribute("aria-hidden","true"),l.setAttribute("tabindex","-1"),l.textContent="\u25BC",r&&(l.disabled=!0),a.append(o,h,l),this.#r.appendChild(a),{unit:t,el:a,valueEl:h,incBtn:o,decBtn:l,min:i,max:n,delta:s,readOnly:r}}#j(){let t=document.createElement("span");return t.className="time-sep",t.setAttribute("aria-hidden","true"),t.textContent=":",t}#R(){this.#o||this.#i.disabled||(this.#o=!0,this.#r.setAttribute("data-open",""),this.#i.setAttribute("aria-expanded","true"))}#p(){this.#o&&(this.#o=!1,this.#r.removeAttribute("data-open"),this.#i.setAttribute("aria-expanded","false"))}#Z=t=>{this.#o&&!this.contains(t.target)&&this.#p()};#N=t=>{let e=t.relatedTarget;e instanceof Node&&this.contains(e)||this.#p()};#C(t){try{let e=new Date(2e3,0,1,Math.floor(t/3600),Math.floor(t%3600/60),t%60),i={hour:this.#c==="12h"?"numeric":"2-digit",minute:"2-digit",hourCycle:this.#c==="12h"?"h12":"h23"};return this.#b&&(i.second="2-digit"),new Intl.DateTimeFormat(this.#v,i).format(e)}catch{return w(t,this.#b)}}#tt=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation(),this.#U(),this.#o&&this.#p();return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#o||this.#R(),this.#k[0]?.focus();return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#o&&this.#p(),this.#S();return}};#U(){let t=this.#i.value.trim();if(!t)this.#g(null,"keyboard");else{let e=C(t,this.#A);e!==null&&this.#g(e,"keyboard")}this.#S()}#et=t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#U(),this.#K())};#K=()=>{this.#e&&(this.#P||(this.#P=!0,this.#T()),this.#s.dispatchEvent(new Event("blur",{bubbles:!0})))};#z(t,e){let i=this.#k.indexOf(e),n=getComputedStyle(this).direction==="rtl",s=n?"ArrowLeft":"ArrowRight",r=n?"ArrowRight":"ArrowLeft";return t.key===s||t.key===r?(t.preventDefault(),this.#k[i+(t.key===s?1:-1)]?.focus(),!0):t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),this.#p(),this.#i.focus(),!0):!1}#it(t,e){if(this.#z(t,e.el))return;let i=e.unit==="hour"?e.delta:Math.ceil(10/e.delta)*e.delta;switch(t.key){case"ArrowUp":t.preventDefault(),this.#M(e,e.delta,"keyboard");break;case"ArrowDown":t.preventDefault(),this.#M(e,-e.delta,"keyboard");break;case"PageUp":t.preventDefault(),this.#M(e,i,"keyboard");break;case"PageDown":t.preventDefault(),this.#M(e,-i,"keyboard");break;case"Home":t.preventDefault(),this.#I(e,e.min,1,"keyboard");break;case"End":t.preventDefault(),this.#I(e,e.max,-1,"keyboard");break;default:/^\d$/.test(t.key)&&(t.preventDefault(),this.#st(t.key,e))}}#E="";#q;#st(t,e){clearTimeout(this.#q),this.#E+=t;let i=()=>{let n=Math.min(Math.max(Number(this.#E),e.min),e.max);this.#E="",this.#I(e,n,0,"keyboard")};this.#E.length>=2||Number(this.#E)*10>e.max?i():this.#q=setTimeout(i,800)}#O(){return this.#$(this.#d??0,1)}#$(t,e){let i=c(t,p),n=this.#h;if(n){let a=this.#d??0,o=(i-a)/n,h=e>0?Math.floor(o):e<0?Math.ceil(o):Math.round(o);i=c(a+h*n,p)}let s=this.#d,r=this.#w;return s!==null&&r!==null&&s<=r?(i<s&&(i=s),i>r&&(i=n?s+Math.floor((r-s)/n)*n:r)):s!==null&&r===null&&i<s?i=s:r!==null&&s===null&&i>r&&(i=n?Math.floor(r/n)*n:r),i}#M(t,e,i){if(t.readOnly)return;if(this.#n===null){this.#g(this.#O(),i);return}let n=this.#n,s=Math.floor(n/3600),r=Math.floor(n%3600/60),a=n%60,o;t.unit==="hour"?o=(this.#c==="12h"?c(s%12+e,12)+(s>=12?12:0):c(s+e,24))*3600+r*60+a:t.unit==="minute"?o=s*3600+c(r+e,60)*60+a:o=s*3600+r*60+c(a+e,60),this.#g(this.#$(o,e),i)}#I(t,e,i,n){if(t.readOnly)return;let s=this.#n??this.#O(),r=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60,h;t.unit==="hour"?h=(this.#c==="12h"?e%12+(r>=12?12:0):e)*3600+a*60+o:t.unit==="minute"?h=r*3600+e*60+o:h=r*3600+a*60+e,this.#g(this.#$(h,i),n)}#rt(t){let e=this.#n??this.#O();this.#g(this.#$(c(e+12*3600,p),0),t)}#g(t,e){let i=this.value;return this.#n=t,t!==null&&t%60!==0&&!this.#b&&(this.#b=!0),this.#S(),this.value===i?!1:(this.#_(),this.#T(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{...this.#nt(),source:e}})),!0)}#nt(){let t=this.#n;return t===null?{value:"",hours:null,minutes:null,seconds:null}:{value:this.value,hours:Math.floor(t/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}#S(){if(!this.#e)return;let t=this.#n;this.#i.value=t===null?"":this.#C(t);let e=this.#l("Empty","Not set"),i=t===null?null:Math.floor(t/3600),n={hour:i===null?null:this.#c==="12h"?i%12||12:i,minute:t===null?null:Math.floor(t%3600/60),second:t===null?null:t%60},s=i===null?"":i>=12?this.#A.pm:this.#A.am;for(let r of this.#f){let a=n[r.unit];if(r.valueEl.textContent=a===null?"--":m(a),a===null){r.el.removeAttribute("aria-valuenow"),r.el.setAttribute("aria-valuetext",e);continue}r.el.setAttribute("aria-valuenow",String(a));let o;try{o=r.unit==="hour"&&this.#c==="12h"?new Intl.DateTimeFormat(this.#v,{hour:"numeric",hourCycle:"h12"}).format(new Date(2e3,0,1,i)):new Intl.NumberFormat(this.#v,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(a)}catch{o=r.unit==="hour"&&s?`${a} ${s}`:String(a)}r.el.setAttribute("aria-valuetext",o)}this.#m&&(this.#m.textContent=s||"--",this.#m.setAttribute("aria-label",`${this.#l("Period","AM/PM")}: ${s||e}`))}#_(t=!0){let e=this.value;this.#t.setFormValue(e||null),this.#s.value=e,t&&this.#s.dispatchEvent(new Event("input",{bubbles:!0}))}#D(t,e,i,n={}){let s=this.#s.getAttribute(`data-message-${t.toLowerCase()}`)??this.#l(e,i);for(let[r,a]of Object.entries(n))s=s.replaceAll(`{${r}}`,a);return s}#T(){if(!this.#e)return!1;let t=this.hasAttribute("required")||this.#s.hasAttribute("required");t?this.#i.setAttribute("aria-required","true"):this.#i.removeAttribute("aria-required");let e=this.#n,i=this.#d,n=this.#w,s={},r="";if(e===null)t&&(s={valueMissing:!0},r=this.#D("valueMissing","Required","Please select a time"));else{let h=i!==null&&n!==null&&i>n,l=i!==null&&e<i,d=n!==null&&e>n;if(h?l&&d:l)s=h?{rangeUnderflow:!0,rangeOverflow:!0}:{rangeUnderflow:!0},r=this.#D("rangeUnderflow","RangeUnderflow","Choose a time at or after {time}",{time:this.#C(i)});else if(!h&&d)s={rangeOverflow:!0},r=this.#D("rangeOverflow","RangeOverflow","Choose a time at or before {time}",{time:this.#C(n)});else if(this.#h&&c(e-(i??0),this.#h)!==0){let y=this.#$(e,1),E=c(y+this.#h,p);s={stepMismatch:!0},r=this.#D("stepMismatch","StepMismatch","Choose a valid time. The nearest are {lower} and {upper}",{lower:this.#C(y),upper:this.#C(E)})}}let a=this.#t.validationMessage;return r?this.#t.setValidity(s,r,this.#i):this.#t.setValidity({}),r&&(e!==null||this.#P)?this.#i.setAttribute("aria-invalid","true"):this.#i.removeAttribute("aria-invalid"),(this.#s.validationMessage===this.#H||!this.#s.validity.customError)&&(this.#s.setCustomValidity(r),this.#H=r),a!==r}#W(t){this.#n=t,this.#S(),this.#_(),this.#T()}formResetCallback(){this.#e&&(this.#P=!1,this.#W(f(this.#F)))}formStateRestoreCallback(t){!this.#e||typeof t!="string"||this.#W(f(t))}get form(){return this.#t.form}get validity(){return this.#t.validity}get validationMessage(){return this.#t.validationMessage}get willValidate(){return this.#t.willValidate}checkValidity(){return this.#t.checkValidity()}reportValidity(){return this.#t.reportValidity()}get value(){return this.#e?this.#n===null?"":w(this.#n,this.#b):this.#x??""}set value(t){let e=t==null?"":String(t).trim(),i=e?f(e):null;if(!(e&&i===null)){if(!this.#e){this.#x=e;return}this.#g(i,"api")}}};A("time-picker",g);export{g as TimePicker};
2
2
  //# sourceMappingURL=time-picker.js.map
@@ -1,7 +1,7 @@
1
- var u=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 A=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function b(a,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=p.get(a);if(customElements.get(a)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}p.set(a,s),customElements.define(a,t)}var g={region:"Notifications",dismiss:"Dismiss",info:"Info",success:"Success",warning:"Warning",error:"Error"},v=["info","success","warning","error"],E={info:"&#9432;",success:"&#10003;",warning:"&#9888;",error:"&#10007;"},y=300,l=class extends u{#e=[];#t=[];#i=new WeakMap;#n=!1;#r=!1;#a=new Set;setup(){this.#c("role","log"),this.#c("aria-live","polite"),this.#c("aria-relevant","additions"),this.#c("aria-label",this.#d("region")),this.listen(this,"pointerover",()=>{this.#n||(this.#n=!0,this.#s())}),this.listen(this,"pointerout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#n=!1,this.#s())}),this.listen(this,"focusin",()=>{this.#r=!0,this.#s()}),this.listen(this,"focusout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#r=!1,this.#s())}),this.listen(this,"keydown",t=>{if(t.key!=="Escape")return;let e=t.target.closest?.(".toast");e&&this.#t.includes(e)&&(t.preventDefault(),this.dismiss(e))}),this.listen(document,"visibilitychange",()=>this.#s()),this.#t=this.#t.filter(t=>t.parentNode===this),this.#n=!!this.querySelector(".toast:hover"),this.#r=this.contains(document.activeElement),this.#h(),this.#s()}teardown(){for(let t of[...this.#t]){let e=this.#i.get(t);e&&(e.hiding?this.#f(t):this.#l(e))}for(let t of this.#a)this.removeAttribute(t);this.#a.clear()}show(t){let{message:e,variant:i="info",duration:s=this.#E(),dismissible:n=!0,action:r,onAction:o,source:c="api"}=t,f=v.includes(i)?i:"info",d=this.#p({message:e,variant:f,dismissible:n,action:r,onAction:o}),h=document.activeElement;this.#i.set(d,{message:String(e??""),duration:Math.max(0,Number(s)||0),remaining:Math.max(0,Number(s)||0),startedAt:0,timer:void 0,returnFocus:h&&!this.contains(h)?h:null,hiding:!1});let m=!this.isConnected||this.#t.length>=this.#m();return m?this.#e.push({toast:d,duration:s}):this.#u(d),this.dispatchEvent(new CustomEvent("toast-msg:enqueued",{detail:{message:e,variant:f,duration:s,source:c,toast:d,queued:m},bubbles:!0})),d}dismiss(t){let e=this.#e.findIndex(i=>i.toast===t);if(e>-1){this.#e.splice(e,1);return}this.#o(t)}dismissAll(){this.#e=[],[...this.#t].forEach(t=>this.#o(t))}get queue(){let t=(e,i)=>({message:this.#i.get(e)?.message??"",variant:e.getAttribute("data-variant")||"info",state:i});return[...this.#t.map(e=>t(e,"visible")),...this.#e.map(({toast:e})=>t(e,"queued"))]}#c(t,e){this.hasAttribute(t)&&!this.#a.has(t)||(this.setAttribute(t,e),this.#a.add(t))}#d(t){return this.getAttribute(`data-label-${t}`)??g[t]??t}#p({message:t,variant:e,dismissible:i,action:s,onAction:n}){let r=document.createElement("div");r.className="toast",r.setAttribute("data-variant",e);let o=c=>this.#y(c);return r.innerHTML=`
1
+ var u=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 T=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function p(a,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=b.get(a);if(customElements.get(a)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(a,s),customElements.define(a,t)}var g={region:"Notifications",dismiss:"Dismiss",info:"Info",success:"Success",warning:"Warning",error:"Error"},v=["info","success","warning","error"],E={info:"&#9432;",success:"&#10003;",warning:"&#9888;",error:"&#10007;"},y=300,h=class extends u{#e=[];#t=[];#i=new WeakMap;#n=!1;#r=!1;#a=new Set;setup(){this.#c("role","log"),this.#c("aria-live","polite"),this.#c("aria-relevant","additions"),this.#c("aria-label",this.#d("region")),this.listen(this,"pointerover",()=>{this.#n||(this.#n=!0,this.#s())}),this.listen(this,"pointerout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#n=!1,this.#s())}),this.listen(this,"focusin",()=>{this.#r=!0,this.#s()}),this.listen(this,"focusout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#r=!1,this.#s())}),this.listen(this,"keydown",t=>{if(t.key!=="Escape")return;let e=t.target.closest?.(".toast");e&&this.#t.includes(e)&&(t.preventDefault(),this.dismiss(e))}),this.listen(document,"visibilitychange",()=>this.#s()),this.#t=this.#t.filter(t=>t.parentNode===this),this.#n=!!this.querySelector(".toast:hover"),this.#r=this.contains(document.activeElement),this.#l(),this.#s()}teardown(){for(let t of[...this.#t]){let e=this.#i.get(t);e&&(e.hiding?this.#f(t):this.#h(e))}for(let t of this.#a)this.removeAttribute(t);this.#a.clear()}show(t){let{message:e,variant:i="info",duration:s=this.#E(),dismissible:n=!0,action:r,onAction:o,source:c="api"}=t,f=v.includes(i)?i:"info",d=this.#b({message:e,variant:f,dismissible:n,action:r,onAction:o}),l=document.activeElement;this.#i.set(d,{message:String(e??""),duration:Math.max(0,Number(s)||0),remaining:Math.max(0,Number(s)||0),startedAt:0,timer:void 0,returnFocus:l&&!this.contains(l)?l:null,hiding:!1});let m=!this.isConnected||this.#t.length>=this.#m();return m?this.#e.push({toast:d,duration:s}):this.#u(d),this.dispatchEvent(new CustomEvent("toast-msg:enqueued",{detail:{message:e,variant:f,duration:s,source:c,toast:d,queued:m},bubbles:!0})),d}dismiss(t){let e=this.#e.findIndex(i=>i.toast===t);if(e>-1){this.#e.splice(e,1);return}this.#o(t)}dismissAll(){this.#e=[],[...this.#t].forEach(t=>this.#o(t))}get queue(){let t=(e,i)=>({message:this.#i.get(e)?.message??"",variant:e.getAttribute("data-variant")||"info",state:i});return[...this.#t.map(e=>t(e,"visible")),...this.#e.map(({toast:e})=>t(e,"queued"))]}#c(t,e){this.hasAttribute(t)&&!this.#a.has(t)||(this.setAttribute(t,e),this.#a.add(t))}#d(t){return this.getAttribute(`data-label-${t}`)??g[t]??t}#b({message:t,variant:e,dismissible:i,action:s,onAction:n}){let r=document.createElement("div");r.className="toast",r.setAttribute("data-variant",e);let o=c=>this.#y(c);return r.innerHTML=`
2
2
  <span class="icon" aria-hidden="true">${E[e]}</span>
3
3
  <span class="message"><span class="variant-label">${o(this.#d(e))}: </span>${o(t)}</span>
4
4
  ${s?`<button type="button" class="action">${o(s)}</button>`:""}
5
5
  ${i?`<button type="button" class="close" aria-label="${o(this.#d("dismiss"))}">&#x2715;</button>`:""}
6
- `,r.querySelector(".close")?.addEventListener("click",()=>this.#o(r)),s&&r.querySelector(".action")?.addEventListener("click",()=>{n?.(),this.#o(r)}),r}#u(t){this.appendChild(t),this.#t.push(t),requestAnimationFrame(()=>{t.getAttribute("data-state")!=="hiding"&&t.setAttribute("data-state","visible")}),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:show",{bubbles:!0,detail:{toast:t}}))}#h(){for(;this.isConnected&&this.#e.length&&this.#t.length<this.#m();){let{toast:t}=this.#e.shift();this.#u(t)}}get#b(){return this.#n||this.#r||document.visibilityState==="hidden"}#s(){let t=this.#b||!this.isConnected;for(let e of this.#t){let i=this.#i.get(e);!i||i.hiding||i.duration<=0||(t?this.#l(i):i.timer===void 0&&this.#g(e,i))}}#g(t,e){e.startedAt=performance.now(),e.timer=setTimeout(()=>{e.timer=void 0,this.#o(t)},e.remaining)}#l(t){t.timer!==void 0&&(clearTimeout(t.timer),t.timer=void 0,t.remaining=Math.max(0,t.remaining-(performance.now()-t.startedAt)))}#o(t){let e=this.#i.get(t);if(!e||e.hiding||t.parentNode!==this)return;e.hiding=!0,e.timer!==void 0&&clearTimeout(e.timer),e.timer=void 0,this.#v(t,e),t.setAttribute("data-state","hiding");let i=()=>this.#f(t);t.addEventListener("animationend",i,{once:!0}),setTimeout(i,y)}#f(t){if(t.parentNode!==this&&!this.#t.includes(t))return;t.remove();let e=this.#t.indexOf(t);e>-1&&this.#t.splice(e,1),this.#r=this.contains(document.activeElement),this.#t.length||(this.#n=!1),this.#h(),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:hide",{bubbles:!0,detail:{toast:t}}))}#v(t,e){if(!t.contains(document.activeElement))return;let i=this.#t.filter(c=>c!==t&&!this.#i.get(c)?.hiding),s=this.#t.indexOf(t),r=(i.find(c=>this.#t.indexOf(c)>s)??i[i.length-1])?.querySelector("button");if(r){r.focus();return}let o=e.returnFocus;o instanceof HTMLElement&&o.isConnected&&o.focus()}#E(){let t=this.getAttribute("duration"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)?e:5e3}#m(){let t=this.getAttribute("max"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)&&e>0?e:5}#y(t){let e=document.createElement("div");return e.textContent=t??"",e.innerHTML}};b("toast-msg",l);export{l as ToastMsg};
6
+ `,r.querySelector(".close")?.addEventListener("click",()=>this.#o(r)),s&&r.querySelector(".action")?.addEventListener("click",()=>{n?.(),this.#o(r)}),r}#u(t){this.appendChild(t),this.#t.push(t),requestAnimationFrame(()=>{t.getAttribute("data-state")!=="hiding"&&t.setAttribute("data-state","visible")}),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:show",{bubbles:!0,detail:{toast:t}}))}#l(){for(;this.isConnected&&this.#e.length&&this.#t.length<this.#m();){let{toast:t}=this.#e.shift();this.#u(t)}}get#p(){return this.#n||this.#r||document.visibilityState==="hidden"}#s(){let t=this.#p||!this.isConnected;for(let e of this.#t){let i=this.#i.get(e);!i||i.hiding||i.duration<=0||(t?this.#h(i):i.timer===void 0&&this.#g(e,i))}}#g(t,e){e.startedAt=performance.now(),e.timer=setTimeout(()=>{e.timer=void 0,this.#o(t)},e.remaining)}#h(t){t.timer!==void 0&&(clearTimeout(t.timer),t.timer=void 0,t.remaining=Math.max(0,t.remaining-(performance.now()-t.startedAt)))}#o(t){let e=this.#i.get(t);if(!e||e.hiding||t.parentNode!==this)return;e.hiding=!0,e.timer!==void 0&&clearTimeout(e.timer),e.timer=void 0,this.#v(t,e),t.setAttribute("data-state","hiding");let i=()=>this.#f(t);t.addEventListener("animationend",i,{once:!0}),setTimeout(i,y)}#f(t){if(t.parentNode!==this&&!this.#t.includes(t))return;t.remove();let e=this.#t.indexOf(t);e>-1&&this.#t.splice(e,1),this.#r=this.contains(document.activeElement),this.#t.length||(this.#n=!1),this.#l(),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:hide",{bubbles:!0,detail:{toast:t}}))}#v(t,e){if(!t.contains(document.activeElement))return;let i=this.#t.filter(c=>c!==t&&!this.#i.get(c)?.hiding),s=this.#t.indexOf(t),r=(i.find(c=>this.#t.indexOf(c)>s)??i[i.length-1])?.querySelector("button");if(r){r.focus();return}let o=e.returnFocus;o instanceof HTMLElement&&o.isConnected&&o.focus()}#E(){let t=this.getAttribute("duration"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)?e:5e3}#m(){let t=this.getAttribute("max"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)&&e>0?e:5}#y(t){let e=document.createElement("div");return e.textContent=t??"",e.innerHTML}};p("toast-msg",h);export{h as ToastMsg};
7
7
  //# sourceMappingURL=toast-msg.js.map
@@ -1,2 +1,2 @@
1
- var u=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_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 D=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function f(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=S.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(s,n),customElements.define(s,t)}var m=CSS.supports("anchor-name","--x"),N=CSS.supports("position-area","bottom"),I=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),V=["auto","manual","hint"];function B(s){let t=V.includes(s||"")?s:"auto";return t==="hint"&&!I?"auto":t}var q=["top","bottom","left","right","inset-inline-start","inset-inline-end"],H=["position","top","left","right","bottom","margin"],C=8,R=0,L=0;function T(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var y=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#i=`--pop-over-anchor-${++L}`;#o=!1;#s=!1;#n=!1;setup(){if(this.id||(this.id=`pop-over-${++R}`),(!this.hasAttribute("popover")||this.#o)&&this.#r(),this.#l(),this.#u(),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})),!m&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!m){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#s&&(q.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#n&&(H.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#o=!0);return}if(t==="data-mode"){this.#r();return}this._reinit()}}#r(){let t=B(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#o=!0}show(){this.matches(":popover-open")||(this.showPopover(),!m&&this.#t&&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")}#l(){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)}"]`)}#u(){if(!this.#t||!m)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=T(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#i)||i.push(this.#i),t.style.setProperty("anchor-name",i.join(", ")),this.#e=this.#i,this.style.setProperty("position-anchor",this.#i),this.setAttribute("data-anchor-name",this.#i),N||this.#h(this.dataset.position||"bottom")}#c(){if(this.#t&&this.#e){let t=T(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")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([a,h])=>this.style.setProperty(a,h)),this.#s=!0}#a(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#p(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#n=!0;let o=this.offsetWidth,a=this.offsetHeight,h=e.split("-")[0];["top","bottom","left","right"].includes(h)||(h="bottom");let d={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},p={top:"bottom",bottom:"top",left:"right",right:"left"},P=h==="top"||h==="bottom"?a:o;d[h]<P&&d[p[h]]>d[h]&&(h=p[h]);let l,c;switch(h){case"top":l=t.top-a-i,c=t.left;break;case"left":l=t.top,c=t.left-o-i;break;case"right":l=t.top,c=t.right+i;break;default:l=t.bottom+i,c=t.left;break}if(h==="top"||h==="bottom"){let g=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==g?t.right-o:t.left}else e.endsWith("-end")&&(l=t.bottom-a);let A=(g,E,k)=>Math.max(C,Math.min(g,k-E-C));c=A(c,o,n),l=A(l,a,r),this.style.top=`${Math.round(l)}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",y);var F=new Set(["BUTTON","A","AREA"]),v=CSS.supports("anchor-name","--x"),$=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),x=8;function M(s){return document.documentElement.hasAttribute("data-interest-polyfill")?!0:"interestForElement"in HTMLButtonElement.prototype?F.has(s.tagName):!1}function O(s){return s.getAttribute("aria-label")?.trim()||s.hasAttribute("aria-labelledby")||s.labels?.length||s.textContent?.trim()||s instanceof HTMLInputElement&&["button","submit","reset"].includes(s.type)&&s.value?!0:!!s.querySelector('img[alt]:not([alt=""]), [aria-label]:not([aria-hidden="true"])')}function _(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(Boolean);return i.includes(e)?!1:(s.setAttribute(t,[...i,e].join(" ")),!0)}function W(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(n=>n&&n!==e);i.length?s.setAttribute(t,i.join(" ")):s.removeAttribute(t)}var b=0,w=class extends u{#t=null;#e=null;#i;#o;#s=!1;#n=!1;#r;#l;#u=[];#c=null;#h=!1;#a=!1;setup(){return this.#s=this.getAttribute("variant")==="card",this.#s?this.#S():this.#p()}#p(){if(this.#t=this.querySelector(":scope > :not(template):not(pop-over.tooltip)"),!this.#t)return!1;this.#n=M(this.#t);let t=this.querySelector(":scope > template[data-tooltip]"),e=this.getAttribute("content"),i=this.#t.getAttribute("title");if(!t&&!e&&!i)return!1;let n=!1;i&&(O(this.#t)||(this.#t.setAttribute("aria-label",i),this.#l=i,n=!t&&!e),this.#r=i,this.#t.removeAttribute("title"));let r=this.getAttribute("position")||"top";this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let o=document.createElement("pop-over");o.className="tooltip",o.setAttribute("role","tooltip"),o.dataset.mode=$?"hint":"manual",o.dataset.anchor=this.#t.id,o.dataset.tooltipPosition=r,v||(o.dataset.position=r),o.id=`tooltip-${++b}`,t?o.innerHTML=t.innerHTML:o.textContent=e||i;let a=document.createElement("span");if(a.className="tooltip-arrow",a.setAttribute("aria-hidden","true"),o.appendChild(a),this.appendChild(o),this.#e=o,n||this.#g("aria-describedby",o.id),this.#n?(this.#t.setAttribute("interestfor",o.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#C),this.listen(o,"mouseenter",this.#b),this.listen(o,"mouseleave",this.#d)),$||this.#v(),!v){this.listen(o,"toggle",d=>{d.newState==="open"&&this.#f()});let h=()=>{this.isVisible&&this.#f()};this.listen(window,"resize",h),this.listen(window,"scroll",h,{capture:!0,passive:!0})}return this.#y(o),!0}#S(){this.#t=this.querySelector(":scope > [data-trigger]");let t=this.querySelector(":scope > [data-content]");if(!this.#t||!t)return!1;this.#n=M(this.#t),this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let e=document.createElement("pop-over");return e.className="hover-card",e.dataset.mode="manual",e.dataset.anchor=this.#t.id,e.dataset.position=this.getAttribute("position")||"bottom",e.id=`hc-${++b}`,this.#c={node:t,next:t.nextSibling,hidden:t.hidden},e.appendChild(t),t.removeAttribute("data-content"),t.hidden=!1,this.appendChild(e),this.#e=e,this.#g("aria-controls",e.id),this.#t.hasAttribute("aria-expanded")||(this.#t.setAttribute("aria-expanded","false"),this.#h=!0),this.#n?(this.#t.setAttribute("interestfor",e.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#d),this.listen(e,"mouseenter",this.#b),this.listen(e,"mouseleave",this.#d),this.listen(e,"focusin",this.#b),this.listen(e,"focusout",i=>{i.relatedTarget instanceof Node&&this.contains(i.relatedTarget)||this.#d()})),this.#v(),this.listen(e,"pop-over:show",()=>{this.#h&&this.#t?.setAttribute("aria-expanded","true")}),this.listen(e,"pop-over:hide",()=>{this.#h&&this.#t?.setAttribute("aria-expanded","false")}),this.#y(e),!0}teardown(){clearTimeout(this.#i),clearTimeout(this.#o);let t=this.#t;if(t){this.#n&&(t.removeAttribute("interestfor"),this.#m&&(t.style.removeProperty("interest-delay-start"),t.style.removeProperty("--interest-delay-start"),this.#m=!1));for(let[e,i]of this.#u)W(t,e,i);this.#l!==void 0&&t.getAttribute("aria-label")===this.#l&&t.removeAttribute("aria-label"),this.#h&&t.removeAttribute("aria-expanded"),this.#r&&t.setAttribute("title",this.#r)}if(this.#u=[],this.#l=void 0,this.#r=void 0,this.#h=!1,this.#c){let{node:e,next:i,hidden:n}=this.#c;e.setAttribute("data-content",""),e.hidden=n,i&&i.parentNode===this?this.insertBefore(e,i):this.insertBefore(e,this.#e?.parentNode===this?this.#e:null),this.#c=null}this.#e&&(this.#e.remove(),this.#e=null),this.#t=null,this.setState("show-pending",!1)}#g(t,e){this.#t&&_(this.#t,t,e)&&this.#u.push([t,e])}#y(t){this.listen(t,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(t,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}#v(){this.listen(document,"keydown",this.#T),this.listen(document,"pointerdown",t=>{this.isVisible&&!(t.target instanceof Node&&this.contains(t.target))&&this.hide()})}#f(){let t=this.#e,e=this.#t;if(!t||!e||this.#s)return;let i=t.dataset.position||"top",n=e.getBoundingClientRect(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,a=(h,d,p)=>Math.max(x,Math.min(h,p-d-x));t.style.translate="none",i==="left"||i==="right"?t.style.top=`${Math.round(a(n.top+(n.height-t.offsetHeight)/2,t.offsetHeight,o))}px`:t.style.left=`${Math.round(a(n.left+(n.width-t.offsetWidth)/2,t.offsetWidth,r))}px`}#m=!1;#w(){let t=this.getAttribute("delay"),e=this.#t;if(t===null||!e)return;let i=parseInt(t,10);!Number.isFinite(i)||i<0||(e.style.setProperty("interest-delay-start",`${i}ms`),e.style.setProperty("--interest-delay-start",`${i}ms`),this.#m=!0)}#A=()=>{clearTimeout(this.#o);let t=this.#s?300:200,e=parseInt(this.getAttribute("delay")||String(t),10);this.setState("show-pending",!0),this.#i=setTimeout(()=>{this.setState("show-pending",!1),this.show()},e)};#d=()=>{clearTimeout(this.#i),this.setState("show-pending",!1);let t=this.#s?200:100;this.#o=setTimeout(()=>this.hide(),t)};#E=()=>{this.#a||(clearTimeout(this.#o),this.show())};#C=()=>{clearTimeout(this.#i),this.setState("show-pending",!1),this.hide()};#b=()=>{clearTimeout(this.#o)};#T=t=>{if(t.key!=="Escape"||!this.isVisible)return;clearTimeout(this.#i);let e=this.#s&&this.#e?.contains(document.activeElement);this.hide(),e&&(this.#a=!0,this.#t?.focus({preventScroll:!0}),this.#a=!1)};show(){!this.#e||this.isVisible||(typeof this.#e.show=="function"?this.#e.show():this.#e.showPopover(),v||this.#f())}hide(){!this.#e||!this.isVisible||(typeof this.#e.hide=="function"?this.#e.hide():this.#e.hidePopover())}get isVisible(){return this.#e?.matches(":popover-open")??!1}};f("tool-tip",w);export{w as ToolTip};
1
+ var u=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_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 K=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function p(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=S.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(s,n),customElements.define(s,t)}var m=CSS.supports("anchor-name","--x"),B=CSS.supports("position-area","bottom"),H=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),V=["auto","manual","hint"];function I(s){let t=V.includes(s||"")?s:"auto";return t==="hint"&&!H?"auto":t}var L=["top","bottom","left","right","inset-inline-start","inset-inline-end"],_=["position","top","left","right","bottom","margin"],$=8,q=0,F=0;function C(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var g=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#i=`--pop-over-anchor-${++F}`;#o=!1;#s=!1;#n=!1;setup(){if(this.id||(this.id=`pop-over-${++q}`),(!this.hasAttribute("popover")||this.#o)&&this.#r(),this.#l(),this.#u(),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})),!m&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#h()})}),!m){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#h()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#s&&(L.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#n&&(_.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#o=!0);return}if(t==="data-mode"){this.#r();return}this._reinit()}}#r(){let t=I(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#o=!0}show(){this.matches(":popover-open")||(this.showPopover(),!m&&this.#t&&this.matches(":popover-open")&&this.#h())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#l(){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)}"]`)}#u(){if(!this.#t||!m)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=C(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#i)||i.push(this.#i),t.style.setProperty("anchor-name",i.join(", ")),this.#e=this.#i,this.style.setProperty("position-anchor",this.#i),this.setAttribute("data-anchor-name",this.#i),B||this.#a(this.dataset.position||"bottom")}#c(){if(this.#t&&this.#e){let t=C(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")}#a(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([h,a])=>this.style.setProperty(h,a)),this.#s=!0}#h(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#f(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#n=!0;let o=this.offsetWidth,h=this.offsetHeight,a=e.split("-")[0];["top","bottom","left","right"].includes(a)||(a="bottom");let d={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},f={top:"bottom",bottom:"top",left:"right",right:"left"},M=a==="top"||a==="bottom"?h:o;d[a]<M&&d[f[a]]>d[a]&&(a=f[a]);let l,c;switch(a){case"top":l=t.top-h-i,c=t.left;break;case"left":l=t.top,c=t.left-o-i;break;case"right":l=t.top,c=t.right+i;break;default:l=t.bottom+i,c=t.left;break}if(a==="top"||a==="bottom"){let y=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==y?t.right-o:t.left}else e.endsWith("-end")&&(l=t.bottom-h);let A=(y,E,k)=>Math.max($,Math.min(y,k-E-$));c=A(c,o,n),l=A(l,h,r),this.style.top=`${Math.round(l)}px`,this.style.left=`${Math.round(c)}px`}#f(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};p("pop-over",g);var O=new Set(["BUTTON","A","AREA"]),v=CSS.supports("anchor-name","--x"),T=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),P=8;function x(s){return document.documentElement.hasAttribute("data-interest-polyfill")?!0:"interestForElement"in HTMLButtonElement.prototype?O.has(s.tagName):!1}function R(s){return s.getAttribute("aria-label")?.trim()||s.hasAttribute("aria-labelledby")||s.labels?.length||s.textContent?.trim()||s instanceof HTMLInputElement&&["button","submit","reset"].includes(s.type)&&s.value?!0:!!s.querySelector('img[alt]:not([alt=""]), [aria-label]:not([aria-hidden="true"])')}function j(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(Boolean);return i.includes(e)?!1:(s.setAttribute(t,[...i,e].join(" ")),!0)}function W(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(n=>n&&n!==e);i.length?s.setAttribute(t,i.join(" ")):s.removeAttribute(t)}var b=0,w=class extends u{#t=null;#e=null;#i;#o;#s=!1;#n=!1;#r;#l;#u=[];#c=null;#a=!1;#h=!1;setup(){return this.#s=this.getAttribute("variant")==="card",this.#s?this.#S():this.#f()}#f(){if(this.#t=this.querySelector(":scope > :not(template):not(pop-over.tooltip)"),!this.#t)return!1;this.#n=x(this.#t);let t=this.querySelector(":scope > template[data-tooltip]"),e=this.getAttribute("content"),i=this.#t.getAttribute("title");if(!t&&!e&&!i)return!1;let n=!1;i&&(R(this.#t)||(this.#t.setAttribute("aria-label",i),this.#l=i,n=!t&&!e),this.#r=i,this.#t.removeAttribute("title"));let r=this.getAttribute("position")||"top";this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let o=document.createElement("pop-over");o.className="tooltip",o.setAttribute("role","tooltip"),o.dataset.mode=T?"hint":"manual",o.dataset.anchor=this.#t.id,o.dataset.tooltipPosition=r,v||(o.dataset.position=r),o.id=`tooltip-${++b}`,t?o.innerHTML=t.innerHTML:o.textContent=e||i;let h=document.createElement("span");if(h.className="tooltip-arrow",h.setAttribute("aria-hidden","true"),o.appendChild(h),this.appendChild(o),this.#e=o,n||this.#y("aria-describedby",o.id),this.#n?(this.#t.setAttribute("interestfor",o.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#$),this.listen(o,"mouseenter",this.#b),this.listen(o,"mouseleave",this.#d)),T||this.#v(),!v){this.listen(o,"toggle",d=>{d.newState==="open"&&this.#p()});let a=()=>{this.isVisible&&this.#p()};this.listen(window,"resize",a),this.listen(window,"scroll",a,{capture:!0,passive:!0})}return this.#g(o),!0}#S(){this.#t=this.querySelector(":scope > [data-trigger]");let t=this.querySelector(":scope > [data-content]");if(!this.#t||!t)return!1;this.#n=x(this.#t),this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let e=document.createElement("pop-over");return e.className="hover-card",e.dataset.mode="manual",e.dataset.anchor=this.#t.id,e.dataset.position=this.getAttribute("position")||"bottom",e.id=`hc-${++b}`,this.#c={node:t,next:t.nextSibling,hidden:t.hidden},e.appendChild(t),t.removeAttribute("data-content"),t.hidden=!1,this.appendChild(e),this.#e=e,this.#y("aria-controls",e.id),this.#t.hasAttribute("aria-expanded")||(this.#t.setAttribute("aria-expanded","false"),this.#a=!0),this.#n?(this.#t.setAttribute("interestfor",e.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#d),this.listen(e,"mouseenter",this.#b),this.listen(e,"mouseleave",this.#d),this.listen(e,"focusin",this.#b),this.listen(e,"focusout",i=>{i.relatedTarget instanceof Node&&this.contains(i.relatedTarget)||this.#d()})),this.#v(),this.listen(e,"pop-over:show",()=>{this.#a&&this.#t?.setAttribute("aria-expanded","true")}),this.listen(e,"pop-over:hide",()=>{this.#a&&this.#t?.setAttribute("aria-expanded","false")}),this.#g(e),!0}teardown(){clearTimeout(this.#i),clearTimeout(this.#o);let t=this.#t;if(t){this.#n&&(t.removeAttribute("interestfor"),this.#m&&(t.style.removeProperty("interest-delay-start"),t.style.removeProperty("--interest-delay-start"),this.#m=!1));for(let[e,i]of this.#u)W(t,e,i);this.#l!==void 0&&t.getAttribute("aria-label")===this.#l&&t.removeAttribute("aria-label"),this.#a&&t.removeAttribute("aria-expanded"),this.#r&&t.setAttribute("title",this.#r)}if(this.#u=[],this.#l=void 0,this.#r=void 0,this.#a=!1,this.#c){let{node:e,next:i,hidden:n}=this.#c;e.setAttribute("data-content",""),e.hidden=n,i&&i.parentNode===this?this.insertBefore(e,i):this.insertBefore(e,this.#e?.parentNode===this?this.#e:null),this.#c=null}this.#e&&(this.#e.remove(),this.#e=null),this.#t=null,this.setState("show-pending",!1)}#y(t,e){this.#t&&j(this.#t,t,e)&&this.#u.push([t,e])}#g(t){this.listen(t,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(t,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}#v(){this.listen(document,"keydown",this.#C),this.listen(document,"pointerdown",t=>{this.isVisible&&!(t.target instanceof Node&&this.contains(t.target))&&this.hide()})}#p(){let t=this.#e,e=this.#t;if(!t||!e||this.#s)return;let i=t.dataset.position||"top",n=e.getBoundingClientRect(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,h=(a,d,f)=>Math.max(P,Math.min(a,f-d-P));t.style.translate="none",i==="left"||i==="right"?t.style.top=`${Math.round(h(n.top+(n.height-t.offsetHeight)/2,t.offsetHeight,o))}px`:t.style.left=`${Math.round(h(n.left+(n.width-t.offsetWidth)/2,t.offsetWidth,r))}px`}#m=!1;#w(){let t=this.getAttribute("delay"),e=this.#t;if(t===null||!e)return;let i=parseInt(t,10);!Number.isFinite(i)||i<0||(e.style.setProperty("interest-delay-start",`${i}ms`),e.style.setProperty("--interest-delay-start",`${i}ms`),this.#m=!0)}#A=()=>{clearTimeout(this.#o);let t=this.#s?300:200,e=parseInt(this.getAttribute("delay")||String(t),10);this.setState("show-pending",!0),this.#i=setTimeout(()=>{this.setState("show-pending",!1),this.show()},e)};#d=()=>{clearTimeout(this.#i),this.setState("show-pending",!1);let t=this.#s?200:100;this.#o=setTimeout(()=>this.hide(),t)};#E=()=>{this.#h||(clearTimeout(this.#o),this.show())};#$=()=>{clearTimeout(this.#i),this.setState("show-pending",!1),this.hide()};#b=()=>{clearTimeout(this.#o)};#C=t=>{if(t.key!=="Escape"||!this.isVisible)return;clearTimeout(this.#i);let e=this.#s&&this.#e?.contains(document.activeElement);this.hide(),e&&(this.#h=!0,this.#t?.focus({preventScroll:!0}),this.#h=!1)};show(){!this.#e||this.isVisible||(typeof this.#e.show=="function"?this.#e.show():this.#e.showPopover(),v||this.#p())}hide(){!this.#e||!this.isVisible||(typeof this.#e.hide=="function"?this.#e.hide():this.#e.hidePopover())}get isVisible(){return this.#e?.matches(":popover-open")??!1}};p("tool-tip",w);export{w as ToolTip};
2
2
  //# sourceMappingURL=tool-tip.js.map