vanilla-breeze 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/custom-elements.json +25084 -6649
  2. package/dist/cdn/components/accessibility-specimen.js +11 -0
  3. package/dist/cdn/components/accordion-wc.js +1 -1
  4. package/dist/cdn/components/activity-feed.js +2 -0
  5. package/dist/cdn/components/adr-wc.js +17 -17
  6. package/dist/cdn/components/ai-chat.js +28 -0
  7. package/dist/cdn/components/ai-summary.js +10 -0
  8. package/dist/cdn/components/analytics-panel.js +5 -5
  9. package/dist/cdn/components/audio-player.js +3 -3
  10. package/dist/cdn/components/audio-visualizer.js +2 -2
  11. package/dist/cdn/components/author-index.js +2 -2
  12. package/dist/cdn/components/brand-mark.js +1 -1
  13. package/dist/cdn/components/bread-crumb.js +2 -0
  14. package/dist/cdn/components/breakpoint-specimen.js +26 -0
  15. package/dist/cdn/components/burndown-chart.js +2 -0
  16. package/dist/cdn/components/calendar-wc.js +2 -2
  17. package/dist/cdn/components/capacity-plan.js +25 -0
  18. package/dist/cdn/components/card-list.js +1 -1
  19. package/dist/cdn/components/carousel-wc.js +1 -1
  20. package/dist/cdn/components/change-set.js +2 -2
  21. package/dist/cdn/components/chart-wc.js +58 -36
  22. package/dist/cdn/components/chat-input.js +1 -1
  23. package/dist/cdn/components/chat-window.js +1 -1
  24. package/dist/cdn/components/color-palette.js +9 -9
  25. package/dist/cdn/components/color-picker.js +1 -1
  26. package/dist/cdn/components/combo-box.js +1 -1
  27. package/dist/cdn/components/command-palette.js +1 -1
  28. package/dist/cdn/components/comment-box.js +60 -0
  29. package/dist/cdn/components/comment-thread.js +60 -0
  30. package/dist/cdn/components/comment-wc.js +1 -1
  31. package/dist/cdn/components/compare-surface.js +1 -1
  32. package/dist/cdn/components/component-sampler.js +2 -2
  33. package/dist/cdn/components/consent-banner.js +1 -1
  34. package/dist/cdn/components/content-lens.js +1 -1
  35. package/dist/cdn/components/content-swap.js +1 -1
  36. package/dist/cdn/components/context-menu.js +1 -1
  37. package/dist/cdn/components/data-table.js +1 -1
  38. package/dist/cdn/components/date-picker.js +1 -1
  39. package/dist/cdn/components/day-view.js +1 -1
  40. package/dist/cdn/components/diagram-wc.js +3 -0
  41. package/dist/cdn/components/drag-surface.js +1 -1
  42. package/dist/cdn/components/drop-down.js +1 -1
  43. package/dist/cdn/components/emoji-picker.js +1 -1
  44. package/dist/cdn/components/empathy-map.js +41 -43
  45. package/dist/cdn/components/flow-diagram.js +1 -1
  46. package/dist/cdn/components/font-pairer.js +81 -81
  47. package/dist/cdn/components/foot-notes.js +1 -1
  48. package/dist/cdn/components/form-field.js +1 -1
  49. package/dist/cdn/components/gantt-chart.js +1 -1
  50. package/dist/cdn/components/geo-map.js +25 -23
  51. package/dist/cdn/components/glossary-index.js +1 -1
  52. package/dist/cdn/components/glossary-wc.js +1 -1
  53. package/dist/cdn/components/gradient-builder.js +29 -29
  54. package/dist/cdn/components/heading-links.js +1 -1
  55. package/dist/cdn/components/highlight-wc.js +2 -2
  56. package/dist/cdn/components/icon-wc.js +4 -4
  57. package/dist/cdn/components/image-gallery.js +1 -1
  58. package/dist/cdn/components/image-map.js +1 -1
  59. package/dist/cdn/components/impact-effort.js +1 -1
  60. package/dist/cdn/components/include-file.js +1 -1
  61. package/dist/cdn/components/iron-triangle.js +2 -0
  62. package/dist/cdn/components/kanban-board.js +1 -1
  63. package/dist/cdn/components/layout-specimen.js +35 -0
  64. package/dist/cdn/components/manifest.json +227 -103
  65. package/dist/cdn/components/markdown-editor.js +1 -1
  66. package/dist/cdn/components/markdown-viewer.js +12 -12
  67. package/dist/cdn/components/motion-specimen.js +12 -12
  68. package/dist/cdn/components/nav-bar.js +2 -0
  69. package/dist/cdn/components/note-wc.js +2 -2
  70. package/dist/cdn/components/notification-wc.js +4 -4
  71. package/dist/cdn/components/page-info.js +4 -4
  72. package/dist/cdn/components/page-stats.js +1 -1
  73. package/dist/cdn/components/page-toc.js +1 -1
  74. package/dist/cdn/components/page-tools.js +1 -1
  75. package/dist/cdn/components/page-tour.js +6 -6
  76. package/dist/cdn/components/pager-wc.js +2 -0
  77. package/dist/cdn/components/palette-generator.js +11 -11
  78. package/dist/cdn/components/poll-wc.js +2 -0
  79. package/dist/cdn/components/pop-over.js +2 -0
  80. package/dist/cdn/components/popularity-index.js +2 -2
  81. package/dist/cdn/components/print-page.js +1 -1
  82. package/dist/cdn/components/product-roadmap.js +3 -0
  83. package/dist/cdn/components/progress-tracker.js +2 -0
  84. package/dist/cdn/components/qr-code.js +1 -1
  85. package/dist/cdn/components/quadrant-grid.js +3 -0
  86. package/dist/cdn/components/quality-target.js +12 -0
  87. package/dist/cdn/components/reaction-bar.js +2 -0
  88. package/dist/cdn/components/reader-view.js +3 -3
  89. package/dist/cdn/components/reading-progress.js +2 -0
  90. package/dist/cdn/components/recently-visited.js +10 -10
  91. package/dist/cdn/components/requirement-card.js +122 -0
  92. package/dist/cdn/components/review-surface.js +34 -40
  93. package/dist/cdn/components/risk-register.js +25 -0
  94. package/dist/cdn/components/roadmap.js +3 -0
  95. package/dist/cdn/components/score-card.js +197 -0
  96. package/dist/cdn/components/selection-menu.js +1 -1
  97. package/dist/cdn/components/semantic-palette.js +15 -15
  98. package/dist/cdn/components/settings-panel.js +12 -12
  99. package/dist/cdn/components/share-wc.js +2 -2
  100. package/dist/cdn/components/short-cuts.js +1 -1
  101. package/dist/cdn/components/site-index.js +4 -4
  102. package/dist/cdn/components/site-map-wc.js +1 -1
  103. package/dist/cdn/components/site-map.js +1 -1
  104. package/dist/cdn/components/site-search.js +9 -9
  105. package/dist/cdn/components/slide-accept.js +1 -1
  106. package/dist/cdn/components/social-embed.js +1 -1
  107. package/dist/cdn/components/spacing-specimen.js +5 -5
  108. package/dist/cdn/components/split-surface.js +1 -1
  109. package/dist/cdn/components/star-rating.js +1 -1
  110. package/dist/cdn/components/status-wc.js +2 -0
  111. package/dist/cdn/components/stepper-wc.js +2 -0
  112. package/dist/cdn/components/story-map.js +1 -1
  113. package/dist/cdn/components/tab-set.js +1 -1
  114. package/dist/cdn/components/text-reader.js +2 -2
  115. package/dist/cdn/components/theme-catalog.js +28 -0
  116. package/dist/cdn/components/theme-export.js +20 -12
  117. package/dist/cdn/components/theme-import.js +44 -0
  118. package/dist/cdn/components/theme-picker.js +29 -26
  119. package/dist/cdn/components/time-index.js +2 -2
  120. package/dist/cdn/components/time-picker.js +1 -1
  121. package/dist/cdn/components/toast-msg.js +3 -3
  122. package/dist/cdn/components/token-specimen.js +14 -14
  123. package/dist/cdn/components/tool-tip.js +1 -1
  124. package/dist/cdn/components/topic-map.js +3 -3
  125. package/dist/cdn/components/traceability-matrix.js +3 -0
  126. package/dist/cdn/components/trust-filter.js +3 -3
  127. package/dist/cdn/components/type-specimen.js +15 -15
  128. package/dist/cdn/components/user-journey.js +63 -70
  129. package/dist/cdn/components/user-persona.js +75 -13
  130. package/dist/cdn/components/user-story.js +12 -11
  131. package/dist/cdn/components/version-switcher.js +17 -0
  132. package/dist/cdn/components/video-player.js +3 -3
  133. package/dist/cdn/components/watch-wc.js +2 -2
  134. package/dist/cdn/components/week-view.js +1 -1
  135. package/dist/cdn/components/work-item.js +29 -28
  136. package/dist/cdn/components/youtube-player.js +1 -1
  137. package/dist/cdn/icons/bold.css +17 -0
  138. package/dist/cdn/icons/bold.json +1 -0
  139. package/dist/cdn/icons/custom.css +6 -0
  140. package/dist/cdn/icons/custom.json +1 -0
  141. package/dist/cdn/icons/lucide.css +1914 -0
  142. package/dist/cdn/icons/lucide.json +1 -0
  143. package/dist/cdn/icons/mage.css +17 -0
  144. package/dist/cdn/icons/mage.json +1 -0
  145. package/dist/cdn/icons/phosphor.css +17 -0
  146. package/dist/cdn/icons/phosphor.json +1 -0
  147. package/dist/cdn/icons/tabler.css +17 -0
  148. package/dist/cdn/icons/tabler.json +1 -0
  149. package/dist/cdn/packs/design-system.full.js +59 -51
  150. package/dist/cdn/packs/effects.full.js +1 -1
  151. package/dist/cdn/packs/icons.effects.js +1 -1
  152. package/dist/cdn/packs/icons.full.js +1 -1
  153. package/dist/cdn/packs/kawaii.full.css +1 -1
  154. package/dist/cdn/packs/kawaii.full.js +6 -6
  155. package/dist/cdn/packs/kawaii.theme.css +1 -1
  156. package/dist/cdn/packs/manifest.json +11 -11
  157. package/dist/cdn/packs/ui.full.css +1 -1
  158. package/dist/cdn/packs/ui.full.js +54 -51
  159. package/dist/cdn/packs/ux-planning.full.css +1 -1
  160. package/dist/cdn/packs/ux-planning.full.js +318 -243
  161. package/dist/cdn/themes/8bit.css +1 -1
  162. package/dist/cdn/themes/8bit.tokens.json +662 -0
  163. package/dist/cdn/themes/alpha1999-dark.tokens.json +693 -0
  164. package/dist/cdn/themes/alpha1999.css +1 -1
  165. package/dist/cdn/themes/alpha1999.tokens.json +869 -0
  166. package/dist/cdn/themes/anthropic.css +2 -0
  167. package/dist/cdn/themes/anthropic.tokens.json +564 -0
  168. package/dist/cdn/themes/art-deco-dark.tokens.json +407 -0
  169. package/dist/cdn/themes/art-deco.css +1 -1
  170. package/dist/cdn/themes/art-deco.tokens.json +581 -0
  171. package/dist/cdn/themes/bauhaus-dark.tokens.json +260 -0
  172. package/dist/cdn/themes/bauhaus.css +1 -1
  173. package/dist/cdn/themes/bauhaus.tokens.json +589 -0
  174. package/dist/cdn/themes/brutalist-dark.tokens.json +503 -0
  175. package/dist/cdn/themes/brutalist.tokens.json +677 -0
  176. package/dist/cdn/themes/catalog/atlassian.tokens.json +303 -0
  177. package/dist/cdn/themes/catalog/bootstrap.tokens.json +304 -0
  178. package/dist/cdn/themes/catalog/carbon.tokens.json +301 -0
  179. package/dist/cdn/themes/catalog/catppuccin-mocha.tokens.json +301 -0
  180. package/dist/cdn/themes/catalog/govuk.tokens.json +301 -0
  181. package/dist/cdn/themes/catalog/manifest.json +132 -0
  182. package/dist/cdn/themes/catalog/material.tokens.json +289 -0
  183. package/dist/cdn/themes/catalog/salesforce.tokens.json +301 -0
  184. package/dist/cdn/themes/catalog/tailwind.tokens.json +302 -0
  185. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  186. package/dist/cdn/themes/catppuccin-frappe.tokens.json +608 -0
  187. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +472 -0
  188. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  189. package/dist/cdn/themes/catppuccin-latte.tokens.json +608 -0
  190. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  191. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +608 -0
  192. package/dist/cdn/themes/catppuccin-mocha.tokens.json +608 -0
  193. package/dist/cdn/themes/classic-dark.tokens.json +503 -0
  194. package/dist/cdn/themes/classic.tokens.json +640 -0
  195. package/dist/cdn/themes/claymorphism-dark.tokens.json +493 -0
  196. package/dist/cdn/themes/claymorphism.css +1 -1
  197. package/dist/cdn/themes/claymorphism.tokens.json +626 -0
  198. package/dist/cdn/themes/clinical-dark.tokens.json +472 -0
  199. package/dist/cdn/themes/clinical.tokens.json +608 -0
  200. package/dist/cdn/themes/cottagecore-dark.tokens.json +412 -0
  201. package/dist/cdn/themes/cottagecore.css +1 -1
  202. package/dist/cdn/themes/cottagecore.tokens.json +544 -0
  203. package/dist/cdn/themes/cyber.tokens.json +668 -0
  204. package/dist/cdn/themes/dawn-dark.tokens.json +472 -0
  205. package/dist/cdn/themes/dawn.css +1 -1
  206. package/dist/cdn/themes/dawn.tokens.json +608 -0
  207. package/dist/cdn/themes/dracula.tokens.json +534 -0
  208. package/dist/cdn/themes/dusk.tokens.json +533 -0
  209. package/dist/cdn/themes/editorial-dark.tokens.json +400 -0
  210. package/dist/cdn/themes/editorial.tokens.json +690 -0
  211. package/dist/cdn/themes/financial-dark.tokens.json +472 -0
  212. package/dist/cdn/themes/financial.css +1 -1
  213. package/dist/cdn/themes/financial.tokens.json +607 -0
  214. package/dist/cdn/themes/genai.tokens.json +534 -0
  215. package/dist/cdn/themes/glassmorphism-dark.tokens.json +489 -0
  216. package/dist/cdn/themes/glassmorphism.css +1 -1
  217. package/dist/cdn/themes/glassmorphism.tokens.json +632 -0
  218. package/dist/cdn/themes/government-dark.tokens.json +472 -0
  219. package/dist/cdn/themes/government.tokens.json +608 -0
  220. package/dist/cdn/themes/gruvbox-dark.tokens.json +472 -0
  221. package/dist/cdn/themes/gruvbox.tokens.json +608 -0
  222. package/dist/cdn/themes/high-noon-dark.tokens.json +397 -0
  223. package/dist/cdn/themes/high-noon.tokens.json +533 -0
  224. package/dist/cdn/themes/ibm.css +2 -0
  225. package/dist/cdn/themes/ibm.tokens.json +568 -0
  226. package/dist/cdn/themes/kawaii-dark.tokens.json +549 -0
  227. package/dist/cdn/themes/kawaii.css +1 -1
  228. package/dist/cdn/themes/kawaii.tokens.json +641 -0
  229. package/dist/cdn/themes/magna-dark.tokens.json +482 -0
  230. package/dist/cdn/themes/magna.css +1 -1
  231. package/dist/cdn/themes/magna.tokens.json +632 -0
  232. package/dist/cdn/themes/manifest.json +162 -62
  233. package/dist/cdn/themes/mcdonalds.css +2 -0
  234. package/dist/cdn/themes/mcdonalds.tokens.json +533 -0
  235. package/dist/cdn/themes/midnight.tokens.json +534 -0
  236. package/dist/cdn/themes/minimal-dark.tokens.json +294 -0
  237. package/dist/cdn/themes/minimal.tokens.json +494 -0
  238. package/dist/cdn/themes/modern-dark.tokens.json +490 -0
  239. package/dist/cdn/themes/modern.tokens.json +573 -0
  240. package/dist/cdn/themes/nes-dark.tokens.json +564 -0
  241. package/dist/cdn/themes/nes.css +1 -1
  242. package/dist/cdn/themes/nes.tokens.json +687 -0
  243. package/dist/cdn/themes/neumorphism-dark.tokens.json +471 -0
  244. package/dist/cdn/themes/neumorphism.css +1 -1
  245. package/dist/cdn/themes/neumorphism.tokens.json +589 -0
  246. package/dist/cdn/themes/nord-dark.tokens.json +484 -0
  247. package/dist/cdn/themes/nord.tokens.json +619 -0
  248. package/dist/cdn/themes/organic-dark.tokens.json +532 -0
  249. package/dist/cdn/themes/organic.tokens.json +685 -0
  250. package/dist/cdn/themes/rose-pine-dark.tokens.json +472 -0
  251. package/dist/cdn/themes/rose-pine.tokens.json +608 -0
  252. package/dist/cdn/themes/rough-dark.tokens.json +515 -0
  253. package/dist/cdn/themes/rough.css +1 -1
  254. package/dist/cdn/themes/rough.tokens.json +650 -0
  255. package/dist/cdn/themes/solarized-dark.tokens.json +397 -0
  256. package/dist/cdn/themes/solarized.tokens.json +532 -0
  257. package/dist/cdn/themes/starbucks.css +2 -0
  258. package/dist/cdn/themes/starbucks.tokens.json +593 -0
  259. package/dist/cdn/themes/startup-dark.tokens.json +522 -0
  260. package/dist/cdn/themes/startup.css +1 -1
  261. package/dist/cdn/themes/startup.tokens.json +607 -0
  262. package/dist/cdn/themes/super2026-dark.tokens.json +667 -0
  263. package/dist/cdn/themes/super2026.tokens.json +863 -0
  264. package/dist/cdn/themes/swiss-dark.tokens.json +390 -0
  265. package/dist/cdn/themes/swiss.tokens.json +750 -0
  266. package/dist/cdn/themes/terminal.css +1 -1
  267. package/dist/cdn/themes/terminal.tokens.json +689 -0
  268. package/dist/cdn/themes/tokyo-night-dark.tokens.json +472 -0
  269. package/dist/cdn/themes/tokyo-night.tokens.json +608 -0
  270. package/dist/cdn/themes/vaporwave-dark.tokens.json +413 -0
  271. package/dist/cdn/themes/vaporwave.tokens.json +549 -0
  272. package/dist/cdn/themes/win9x-dark.tokens.json +563 -0
  273. package/dist/cdn/themes/win9x.tokens.json +700 -0
  274. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  275. package/dist/cdn/vanilla-breeze-charts.js +58 -36
  276. package/dist/cdn/vanilla-breeze-core.css +1 -1
  277. package/dist/cdn/vanilla-breeze-core.js +246 -51
  278. package/dist/cdn/vanilla-breeze-dev.js +1 -1
  279. package/dist/cdn/vanilla-breeze-extras.js +90 -80
  280. package/dist/cdn/vanilla-breeze.css +1 -1
  281. package/dist/cdn/vanilla-breeze.js +1370 -405
  282. package/package.json +12 -4
@@ -0,0 +1,60 @@
1
+ var ft=window.matchMedia("(prefers-reduced-motion: reduce)");var ae=new Map;function A(n,e,t={}){let s=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:s},i=ae.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}ae.set(n,r),customElements.define(n,e)}var w=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,r){e.addEventListener(t,s,r),this.#e.push(()=>e.removeEventListener(t,s,r))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{t?s.add(e):s.delete(e)}catch{let r=`--${e}`;t?s.add(r):s.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};function L(n){let e=(Date.now()-n.getTime())/1e3;if(e<0)return null;if(e<60)return"just now";if(e<3600){let s=Math.floor(e/60);return`${s} minute${s!==1?"s":""} ago`}if(e<86400){let s=Math.floor(e/3600);return`${s} hour${s!==1?"s":""} ago`}if(e<2592e3){let s=Math.floor(e/86400);return`${s} day${s!==1?"s":""} ago`}if(e<31536e3){let s=Math.floor(e/2592e3);return`${s} month${s!==1?"s":""} ago`}let t=Math.floor(e/31536e3);return`${t} year${t!==1?"s":""} ago`}function le(n=document){for(let e of n.querySelectorAll("time[data-relative]")){let t=e.getAttribute("datetime");if(!t)continue;let s=L(new Date(t));s&&(e.textContent=s)}}var oe;function ce(){le(),oe||(oe=setInterval(()=>le(),6e4))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ce,{once:!0}):ce();function j(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var E=j();function me(n){E=n}var S={exec:()=>null};function u(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(b.caret,"$1"),t=t.replace(r,a),s},getRegex:()=>new RegExp(t,e)};return s}var Ce=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},Te=/^(?:[ \t]*(?:\n|$))+/,ze=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,I=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ie=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,F=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,be=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ke=u(be).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Le=u(be).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),V=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pe=/^[^\n]+/,U=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,_e=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",U).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Be=u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,F).getRegex(),M="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",G=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ne=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",G).replace("tag",M).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xe=u(V).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex(),Me=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xe).getRegex(),K={blockquote:Me,code:ze,def:_e,fences:qe,heading:Ie,hr:I,html:Ne,lheading:ke,list:Be,newline:Te,paragraph:xe,table:S,text:Pe},he=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex(),De={...K,lheading:Le,table:he,paragraph:u(V).replace("hr",I).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex()},He={...K,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",G).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(V).replace("hr",I).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",ke).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Oe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ze=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,we=/^( {2,}|\\)\n(?!\s*$)/,Qe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,R=/[\p{P}\p{S}]/u,D=/[\s\p{P}\p{S}]/u,W=/[^\s\p{P}\p{S}]/u,je=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,D).getRegex(),ye=/(?!~)[\p{P}\p{S}]/u,Fe=/(?!~)[\s\p{P}\p{S}]/u,Ve=/(?:[^\s\p{P}\p{S}]|~)/u,Ue=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ve=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ge=u(ve,"u").replace(/punct/g,R).getRegex(),Ke=u(ve,"u").replace(/punct/g,ye).getRegex(),Ae="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",We=u(Ae,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,D).replace(/punct/g,R).getRegex(),Xe=u(Ae,"gu").replace(/notPunctSpace/g,Ve).replace(/punctSpace/g,Fe).replace(/punct/g,ye).getRegex(),Ye=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,D).replace(/punct/g,R).getRegex(),Je=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,R).getRegex(),et="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",tt=u(et,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,D).replace(/punct/g,R).getRegex(),rt=u(/\\(punct)/,"gu").replace(/punct/g,R).getRegex(),st=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nt=u(G).replace("(?:-->|$)","-->").getRegex(),it=u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",nt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,at=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Se=u(/^!?\[(label)\]\[(ref)\]/).replace("label",_).replace("ref",U).getRegex(),$e=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",U).getRegex(),lt=u("reflink|nolink(?!\\()","g").replace("reflink",Se).replace("nolink",$e).getRegex(),ue=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X={_backpedal:S,anyPunctuation:rt,autolink:st,blockSkip:Ue,br:we,code:Ze,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Ge,emStrongRDelimAst:We,emStrongRDelimUnd:Ye,escape:Oe,link:at,nolink:$e,punctuation:je,reflink:Se,reflinkSearch:lt,tag:it,text:Qe,url:S},ot={...X,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",_).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_).getRegex()},O={...X,emStrongRDelimAst:Xe,emStrongLDelim:Ke,delLDelim:Je,delRDelim:tt,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ue).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ue).getRegex()},ct={...O,br:u(we).replace("{2,}","*").getRegex(),text:u(O.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},P={normal:K,gfm:De,pedantic:He},T={normal:X,gfm:O,breaks:ct,pedantic:ot},ht={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe=n=>ht[n];function y(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,pe)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,pe);return n}function de(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function ge(n,e){let t=n.replace(b.findPipe,(i,a,o)=>{let l=!1,h=a;for(;--h>=0&&o[h]==="\\";)l=!l;return l?"|":" |"}),s=t.split(b.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(b.slashPipe,"|");return s}function z(n,e,t){let s=n.length;if(s===0)return"";let r=0;for(;r<s;){let i=n.charAt(s-r-1);if(i===e&&!t)r++;else if(i!==e&&t)r++;else break}return n.slice(0,s-r)}function ut(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function pt(n,e=0){let t=e,s="";for(let r of n)if(r===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=r,t++;return s}function fe(n,e,t,s,r){let i=e.href,a=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function dt(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
3
+ `).map(i=>{let a=i.match(t.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=r.length?i.slice(r.length):i}).join(`
4
+ `)}var B=class{options;rules;lexer;constructor(n){this.options=n||E}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:z(t,`
5
+ `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=dt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=z(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:z(e[0],`
6
+ `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=z(e[0],`
7
+ `).split(`
8
+ `),s="",r="",i=[];for(;t.length>0;){let a=!1,o=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))o.push(t[l]),a=!0;else if(!a)o.push(t[l]);else break;t=t.slice(l);let h=o.join(`
9
+ `),c=h.replace(this.rules.other.blockquoteSetextReplace,`
10
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
11
+ ${h}`:h,r=r?`${r}
12
+ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=d,t.length===0)break;let p=i.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let m=p,f=m.raw+`
13
+ `+t.join(`
14
+ `),v=this.blockquote(f);i[i.length-1]=v,s=s.substring(0,s.length-m.raw.length)+v.raw,r=r.substring(0,r.length-m.text.length)+v.text;break}else if(p?.type==="list"){let m=p,f=m.raw+`
15
+ `+t.join(`
16
+ `),v=this.list(f);i[i.length-1]=v,s=s.substring(0,s.length-p.raw.length)+v.raw,r=r.substring(0,r.length-m.raw.length)+v.raw,t=f.substring(i.at(-1).raw.length).split(`
17
+ `);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),a=!1;for(;n;){let l=!1,h="",c="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let d=pt(e[2].split(`
18
+ `,1)[0],e[1].length),p=n.split(`
19
+ `,1)[0],m=!d.trim(),f=0;if(this.options.pedantic?(f=2,c=d.trimStart()):m?f=e[1].length+1:(f=d.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=d.slice(f),f+=e[1].length),m&&this.rules.other.blankLine.test(p)&&(h+=p+`
20
+ `,n=n.substring(p.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(f),se=this.rules.other.hrRegex(f),ne=this.rules.other.fencesBeginRegex(f),ie=this.rules.other.headingBeginRegex(f),Ee=this.rules.other.htmlBeginRegex(f),Re=this.rules.other.blockquoteBeginRegex(f);for(;n;){let H=n.split(`
21
+ `,1)[0],C;if(p=H,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),C=p):C=p.replace(this.rules.other.tabCharGlobal," "),ne.test(p)||ie.test(p)||Ee.test(p)||Re.test(p)||v.test(p)||se.test(p))break;if(C.search(this.rules.other.nonSpaceChar)>=f||!p.trim())c+=`
22
+ `+C.slice(f);else{if(m||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ne.test(d)||ie.test(d)||se.test(d))break;c+=`
23
+ `+p}m=!p.trim(),h+=H+`
24
+ `,n=n.substring(H.length+1),d=C.slice(f)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=c.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=c.raw+l.tokens[0].raw,l.tokens[0].text=c.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(c)):l.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):l.tokens.unshift(c)}}if(!r.loose){let h=l.tokens.filter(d=>d.type==="space"),c=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=c}}if(r.loose)for(let l of r.items){l.loose=!0;for(let h of l.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:r}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=ge(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(ge(a,i.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[l]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
26
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=z(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=ut(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),fe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return fe(t,r,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,a,o=r,l=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+r);(s=h.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){o+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let c=[...s[0]][0].length,d=n.slice(0,r+s.index+c+a);if(Math.min(r,a)%2){let m=d.slice(1,-1);return{type:"em",raw:d,text:m,tokens:this.lexer.inlineTokens(m)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+r);(s=l.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==r))continue;if(s[3]||s[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let h=[...s[0]][0].length,c=n.slice(0,r+s.index+h+a),d=c.slice(r,-r);return{type:"del",raw:c,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},k=class Z{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||E,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:b,block:P.normal,inline:T.normal};this.options.pedantic?(t.block=P.pedantic,t.inline=T.pedantic):this.options.gfm&&(t.block=P.gfm,this.options.breaks?t.inline=T.breaks:t.inline=T.gfm),this.tokenizer.rules=t}static get rules(){return{block:P,inline:T}}static lex(e,t){return new Z(t).lex(e)}static lexInline(e,t){return new Z(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
27
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
28
+ `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
29
+ `)?"":`
30
+ `)+r.raw,a.text+=`
31
+ `+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
32
+ `)?"":`
33
+ `)+r.raw,a.text+=`
34
+ `+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let a=1/0,o=e.slice(1),l;this.options.extensions.startBlock.forEach(h=>{l=h.call({lexer:this},o),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(i=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);s&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
35
+ `)?"":`
36
+ `)+r.raw,a.text+=`
37
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),s=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
38
+ `)?"":`
39
+ `)+r.raw,a.text+=`
40
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e,r=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)l.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,r.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=r[2]?r[2].length:0,s=s.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let a=!1,o="";for(;e;){a||(o=""),a=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=t.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(m=>{p=m.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(h)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),a=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},N=class{options;parser;constructor(n){this.options=n||E}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(b.notSpaceStart)?.[0],r=n.replace(b.endingNewline,"")+`
41
+ `;return s?'<pre><code class="language-'+y(s)+'">'+(t?r:y(r,!0))+`</code></pre>
42
+ `:"<pre><code>"+(t?r:y(r,!0))+`</code></pre>
43
+ `}blockquote({tokens:n}){return`<blockquote>
44
+ ${this.parser.parse(n)}</blockquote>
45
+ `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
46
+ `}hr(n){return`<hr>
47
+ `}list(n){let e=n.ordered,t=n.start,s="";for(let a=0;a<n.items.length;a++){let o=n.items[a];s+=this.listitem(o)}let r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
48
+ `+s+"</"+r+`>
49
+ `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
50
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
51
+ `}table(n){let e="",t="";for(let r=0;r<n.header.length;r++)t+=this.tablecell(n.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<n.rows.length;r++){let i=n.rows[r];t="";for(let a=0;a<i.length;a++)t+=this.tablecell(i[a]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
52
+ <thead>
53
+ `+e+`</thead>
54
+ `+s+`</table>
55
+ `}tablerow({text:n}){return`<tr>
56
+ ${n}</tr>
57
+ `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
58
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${y(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),r=de(n);if(r===null)return s;n=r;let i='<a href="'+n+'"';return e&&(i+=' title="'+y(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=de(n);if(r===null)return y(t);n=r;let i=`<img src="${n}" alt="${y(t)}"`;return e&&(i+=` title="${y(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:y(n.text)}},Y=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},x=class Q{options;renderer;textRenderer;constructor(e){this.options=e||E,this.options.renderer=this.options.renderer||new N,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Y}static parse(e,t){return new Q(t).parse(e)}static parseInline(e,t){return new Q(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let a=r,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){t+=o||"";continue}}let i=r;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=o||"";continue}}let a=i;switch(a.type){case"escape":{s+=t.text(a);break}case"html":{s+=t.html(a);break}case"link":{s+=t.link(a);break}case"image":{s+=t.image(a);break}case"checkbox":{s+=t.checkbox(a);break}case"strong":{s+=t.strong(a);break}case"em":{s+=t.em(a);break}case"codespan":{s+=t.codespan(a);break}case"br":{s+=t.br(a);break}case"del":{s+=t.del(a);break}case"text":{s+=t.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},q=class{options;block;constructor(n){this.options=n||E}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?k.lex:k.lexInline}provideParser(n=this.block){return n?x.parse:x.parseInline}},gt=class{defaults=j();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=x;Renderer=N;TextRenderer=Y;Lexer=k;Tokenizer=B;Hooks=q;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let i of r.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let a of i)t=t.concat(this.walkTokens(a.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let a=r[i].flat(1/0);t=t.concat(this.walkTokens(a,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=i.apply(this,a)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new N(this.defaults);for(let i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,o=t.renderer[a],l=r[a];r[a]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new B(this.defaults);for(let i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,o=t.tokenizer[a],l=r[a];r[a]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new q;for(let i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,o=t.hooks[a],l=r[a];q.passThroughHooks.has(i)?r[a]=h=>{if(this.defaults.async&&q.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await o.call(r,h);return l.call(r,d)})();let c=o.call(r,h);return l.call(r,c)}:r[a]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(r,h);return d===!1&&(d=await l.apply(r,h)),d})();let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(a){let o=[];return o.push(i.call(this,a)),r&&(o=o.concat(r.call(this,a))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return k.lex(n,e??this.defaults)}parser(n,e){return x.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=n),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer(n):n?k.lex:k.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(n):n?x.parse:x.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer(n):n?k.lex:k.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(n):n?x.parse:x.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return i(a)}}}onError(n,e){return t=>{if(t.message+=`
59
+ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+y(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},$=new gt;function g(n,e){return $.parse(n,e)}g.options=g.setOptions=function(n){return $.setOptions(n),g.defaults=$.defaults,me(g.defaults),g};g.getDefaults=j;g.defaults=E;g.use=function(...n){return $.use(...n),g.defaults=$.defaults,me(g.defaults),g};g.walkTokens=function(n,e){return $.walkTokens(n,e)};g.parseInline=$.parseInline;g.Parser=x;g.parser=x.parse;g.Renderer=N;g.TextRenderer=Y;g.Lexer=k;g.lexer=k.lex;g.Tokenizer=B;g.Hooks=q;g.parse=g;var xt=g.options,wt=g.setOptions,yt=g.use,vt=g.walkTokens,At=g.parseInline;var St=x.parse,$t=k.lex;var J=class extends w{#e=null;#t=null;#s=null;#n=null;#i=null;static get observedAttributes(){return["src"]}setup(){this.#a()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){e==="src"&&s&&t!==s&&this.isConnected&&this.#a()}get parser(){return this.#e}set parser(e){this.#e=typeof e=="function"?e:null}get markdown(){return this.#n??this.#i??""}set markdown(e){let t=e==null?null:String(e);this.#n!==t&&(this.#n=t,this.#a())}async render(){await this.#a()}async reload(){this.getAttribute("src")&&await this.#a()}#r(){if(this.getAttribute("src"))return null;let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let t=this.querySelector("template[data-md]");if(t)return t.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}async#a(){let e=this.getAttribute("src"),t;if(this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),e){this.#t?.abort(),this.#t=new AbortController,this.setAttribute("data-loading",""),this.#l("markdown-viewer:fetch",{src:e});try{let i=await fetch(e,{signal:this.#t.signal});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);t=await i.text()}catch(i){if(i.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#l("markdown-viewer:error",{error:i.message});return}this.removeAttribute("data-loading")}else this.#n!=null?t=this.#n:t=this.#r();if(t==null)return;this.#i=t;let s;try{s=await(await this.#c())(t)}catch(i){this.setAttribute("data-error",""),this.#l("markdown-viewer:error",{error:i.message});return}this.#s||(this.#s=document.createElement("div"),this.#s.className="md-content",this.#s.setAttribute("part","content"),this.appendChild(this.#s)),this.#s.innerHTML=s,this.#o(),this.setAttribute("data-rendered","");let r=this.getAttribute("ping");if(r&&navigator.sendBeacon?.(r,JSON.stringify({src:e||"inline"})),this.#l("markdown-viewer:rendered",{src:e,node:this.#s}),this.hasAttribute("highlight"))for(let i of this.#s.querySelectorAll('pre > code[class*="language-"]')){let a=i.className.match(/language-(\S+)/)?.[1]||"";this.#l("markdown-viewer:highlight",{node:i,language:a})}}async#c(){return this.#e?this.#e:e=>g.parse(e,{gfm:!0})}#o(){if(!this.#s)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#s.dataset.theme=e)}#l(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};A("markdown-viewer",J);var ee=class extends w{#e=null;#t=null;#s=null;#n=null;#i="";#r=null;static get observedAttributes(){return["name","placeholder","rows"]}setup(){this.#a(),this.#c(),this.#l()}teardown(){this.#r!==null&&clearTimeout(this.#r),this.removeAttribute("data-editing")}attributeChangedCallback(e,t,s){!this.#e||t===s||(e==="name"&&(this.#e.name=s||""),e==="placeholder"&&(this.#e.placeholder=s||""),e==="rows"&&(this.#e.rows=parseInt(s,10)||10))}get value(){return this.#e?.value??""}set value(e){if(!this.#e)return;let t=e==null?"":String(e);this.#e.value!==t&&(this.#e.value=t,this.#l(),this.dispatchEvent(new CustomEvent("markdown-editor:change",{detail:{value:t,source:"api"},bubbles:!0})))}get textarea(){return this.#e}#a(){let t=this.querySelector("textarea")?.value||"";this.#s=document.createElement("section"),this.#s.className="md-editor-pane",this.#s.setAttribute("aria-label","Markdown source"),this.#n=document.createElement("section"),this.#n.className="md-preview-pane",this.#n.setAttribute("aria-label","Rendered preview"),this.#n.setAttribute("aria-live","polite"),this.#e=document.createElement("textarea"),this.#e.className="md-editor-input",this.#e.value=t,this.#e.name=this.getAttribute("name")||"",this.#e.placeholder=this.getAttribute("placeholder")||"Write markdown here...",this.#e.rows=parseInt(this.getAttribute("rows")??"",10)||10,this.#e.setAttribute("spellcheck","true"),this.#t=document.createElement("markdown-viewer"),this.hasAttribute("highlight")&&this.#t.setAttribute("highlight","");let s=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;s&&(this.#t.dataset.theme=s),this.#s.appendChild(this.#e),this.#n.appendChild(this.#t),this.innerHTML="",this.appendChild(this.#s),this.appendChild(this.#n),this.#i=t}#c(){let e=this.#e;e&&(this.listen(e,"input",()=>{this.#h("markdown-editor:input",{value:e.value}),this.#o()}),this.listen(e,"focus",()=>{this.setAttribute("data-editing","")}),this.listen(e,"blur",()=>{this.removeAttribute("data-editing"),e.value!==this.#i&&(this.#i=e.value,this.#h("markdown-editor:change",{value:e.value}))}),this.hasAttribute("data-tab-indent")&&this.listen(e,"keydown",t=>{let s=t;if(s.key==="Tab"&&!s.shiftKey&&!s.ctrlKey&&!s.metaKey){s.preventDefault();let{selectionStart:r,selectionEnd:i}=e;e.setRangeText(" ",r,i,"end"),e.dispatchEvent(new Event("input",{bubbles:!0}))}}))}#o(){this.#r!==null&&clearTimeout(this.#r),this.#r=setTimeout(()=>this.#l(),150)}#l(){if(!this.#t)return;let e=this.#e?.value||"";if(!e.trim()){let s=this.#t.querySelector(".md-content");s&&(s.innerHTML="");return}let t=this.#t.querySelector('script[type="text/markdown"]');t||(t=document.createElement("script"),t.type="text/markdown",this.#t.prepend(t)),t.textContent=e,this.#t.removeAttribute("data-rendered"),this.#t.render?.()}#h(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};A("markdown-editor",ee);var te=class extends w{static formAssociated=!0;static observedAttributes=["value","disabled","placeholder","submit-label","cancel-label","data-show-cancel"];#e;#t;#s;#n;#i;#r;#a;#c=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){let e=[...this.querySelectorAll(':scope > [slot="toolbar"]')],t=this.querySelector(":scope > markdown-editor");if(!t){t=document.createElement("markdown-editor");let r=document.createElement("textarea");this.hasAttribute("placeholder")&&(r.placeholder=this.getAttribute("placeholder")||""),this.hasAttribute("value")&&(r.value=this.getAttribute("value")||""),t.appendChild(r)}this.#t=t,this.#s=document.createElement("div"),this.#s.className="comment-box-actions",this.#n=document.createElement("div"),this.#n.className="comment-box-toolbar",this.#n.setAttribute("role","toolbar"),e.forEach(r=>this.#n.appendChild(r)),this.#s.appendChild(this.#n);let s=document.createElement("div");s.className="comment-box-buttons",this.hasAttribute("data-show-cancel")&&(this.#r=document.createElement("button"),this.#r.type="button",this.#r.className="comment-box-cancel",this.#r.textContent=this.getAttribute("cancel-label")||"Cancel",s.appendChild(this.#r)),this.#i=document.createElement("button"),this.#i.type="button",this.#i.className="comment-box-submit",this.#i.textContent=this.getAttribute("submit-label")||"Comment",s.appendChild(this.#i),this.#s.appendChild(s),this.hasAttribute("data-max-length")&&(this.#a=document.createElement("span"),this.#a.className="comment-box-counter",this.#a.setAttribute("aria-live","polite"),this.#s.appendChild(this.#a)),this.replaceChildren(this.#t,this.#s),this.listen(this.#i,"click",this.#p),this.#r&&this.listen(this.#r,"click",this.#u),this.#l(),this.#t.hasAttribute("data-upgraded")||this.listen(this.#t,"markdown-editor:upgraded",()=>this.#l(),{once:!0}),this.#b(),this.#g(),this.#f(),this.#m()}get#o(){return this.#t?.textarea??this.#t?.querySelector("textarea")??null}#l(){let e=this.#o;!e||e===this.#c||(this.#c=e,this.listen(e,"input",this.#h),this.listen(e,"keydown",this.#d))}attributeChangedCallback(e,t,s){if(!(!this.isConnected||!this.#t))if(e==="value")this.value=s??"";else if(e==="placeholder"){let r=this.#o;r&&(r.placeholder=s??"")}else e==="disabled"?this.#b():e==="submit-label"?this.#i.textContent=s||"Comment":e==="cancel-label"?this.#r&&(this.#r.textContent=s||"Cancel"):e==="data-show-cancel"&&(this.hasAttribute("data-show-cancel")&&!this.#r?(this.#r=document.createElement("button"),this.#r.type="button",this.#r.className="comment-box-cancel",this.#r.textContent=this.getAttribute("cancel-label")||"Cancel",this.#i.parentNode.insertBefore(this.#r,this.#i),this.listen(this.#r,"click",this.#u)):!this.hasAttribute("data-show-cancel")&&this.#r&&(this.#r.remove(),this.#r=null))}#h=()=>{this.#g(),this.#f(),this.#m(),this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:this.value,length:this.value.length}}))};#d=e=>{e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#p())};#p=()=>{if(this.#k())return;let e=this.value,t=new CustomEvent("comment-box:submit",{bubbles:!0,cancelable:!0,detail:{value:e}});this.dispatchEvent(t)&&this.clear()};#u=()=>{let e=this.value;this.dispatchEvent(new CustomEvent("comment-box:cancel",{bubbles:!0,detail:{value:e}}))};#k(){return this.hasAttribute("disabled")?!0:!this.#e.checkValidity()}#b(){let e=this.hasAttribute("disabled"),t=this.#o;t&&(t.disabled=e),this.#i.disabled=e,this.#r&&(this.#r.disabled=e)}#g(){this.#e.setFormValue(this.value)}#f(){let e=this.value,t=Number(this.getAttribute("data-min-length"))||0,s=Number(this.getAttribute("data-max-length"))||1/0,r=this.hasAttribute("required"),i=this.#o&&this.contains(this.#o)?this.#o:null;if(r&&e.length===0){this.#e.setValidity({valueMissing:!0},"Please add a comment.",i||void 0);return}if(e.length<t){this.#e.setValidity({tooShort:!0},`At least ${t} characters required.`,i||void 0);return}if(e.length>s){this.#e.setValidity({tooLong:!0},`No more than ${s} characters.`,i||void 0);return}this.#e.setValidity({})}#m(){if(!this.#a)return;let e=Number(this.getAttribute("data-max-length"))||0,t=this.value.length;this.#a.textContent=e?`${t} / ${e}`:String(t),this.#a.classList.toggle("is-over",e>0&&t>e)}get value(){return this.#t?.value??""}set value(e){this.#t&&(this.#t.value=e==null?"":String(e),this.#g(),this.#f(),this.#m())}clear(){this.value="",this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:"",length:0}}))}focus(){this.#o?.focus()}formResetCallback(){this.value=this.getAttribute("value")??""}formStateRestoreCallback(e){e!=null&&(this.value=e)}get form(){return this.#e.form}get name(){return this.getAttribute("name")}get type(){return this.localName}get validity(){return this.#e.validity}get validationMessage(){return this.#e.validationMessage}checkValidity(){return this.#e.checkValidity()}reportValidity(){return this.#e.reportValidity()}};A("comment-box",te);var re=class extends w{#e=null;#t=null;#s=0;setup(){this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Comments"),this.#e=this.querySelector(":scope > template[data-reply-form]"),this.#n().forEach(e=>this.#i(e)),this.#s=setInterval(()=>this.#p(),6e4)}teardown(){clearInterval(this.#s)}#n(){return[...this.querySelectorAll(":scope > article[data-comment]")]}#i(e){if(e.dataset.decorated==="")return;e.dataset.decorated="";let t=this.#r(e);e.style.setProperty("--comment-depth",String(t)),t>0&&e.setAttribute("aria-level",String(t+1));let s=this.#a(e),r=e.querySelector(":scope > [data-comment-body]");r?e.insertBefore(s,r):e.prepend(s);let i=this.#c(e);e.appendChild(i)}#r(e){let t=0,s=e.dataset.parent,r=new Set;for(;s&&!r.has(s);){r.add(s);let i=this.querySelector(`:scope > article[data-comment][id="${CSS.escape(s)}"]`);if(!i)break;t+=1,s=i.dataset.parent}return t}#a(e){let t=document.createElement("header");t.className="comment-header";let s=e.dataset.author||"Unknown",r=e.dataset.authorHref,i=e.dataset.authorAvatar;if(i){let l=document.createElement("user-avatar");l.setAttribute("src",i),l.setAttribute("name",s),t.appendChild(l)}let a=document.createElement(r?"a":"span");a.className="comment-author",a.textContent=s,r&&(a.href=r),t.appendChild(a);let o=e.dataset.time;if(o){let l=document.createElement("time");l.className="comment-time",l.setAttribute("datetime",o),l.setAttribute("title",this.#u(o)),l.textContent=L(new Date(o))||o,t.appendChild(l)}if(e.dataset.edited){let l=document.createElement("span");l.className="comment-edited",l.title=`Edited ${this.#u(e.dataset.edited)}`,l.textContent="(edited)",t.appendChild(l)}return t}#c(e){let t=document.createElement("footer");if(t.className="comment-footer",t.setAttribute("role","toolbar"),this.hasAttribute("data-disabled"))return t;let s=document.createElement("button");if(s.type="button",s.className="comment-action comment-reply",s.textContent="Reply",s.setAttribute("aria-label",`Reply to ${e.dataset.author||"comment"}`),this.listen(s,"click",()=>this.#o(e)),t.appendChild(s),e.hasAttribute("data-mine")){let r=document.createElement("button");r.type="button",r.className="comment-action comment-edit",r.textContent="Edit",r.setAttribute("aria-label","Edit your comment"),this.listen(r,"click",()=>this.#h(e)),t.appendChild(r);let i=document.createElement("button");i.type="button",i.className="comment-action comment-delete",i.textContent="Delete",i.setAttribute("aria-label","Delete your comment"),this.listen(i,"click",()=>this.#d(e)),t.appendChild(i)}return t}#o(e){if(this.#t&&this.#l(),!this.#e)return;let t=this.#e.content.cloneNode(!0),s=t.firstElementChild?.cloneNode?t.firstElementChild:document.createElement("comment-box");s.hasAttribute("data-show-cancel")||s.setAttribute("data-show-cancel","");let r=document.createElement("div");r.className="comment-reply-form",r.setAttribute("data-parent",e.id||""),r.appendChild(s),e.appendChild(r),this.#t=r,requestAnimationFrame(()=>s.focus?.()),s.addEventListener("comment-box:submit",i=>{this.dispatchEvent(new CustomEvent("comment-thread:reply",{bubbles:!0,detail:{parentId:e.id,value:i.detail.value}})),this.#l()}),s.addEventListener("comment-box:cancel",()=>this.#l())}#l(){this.#t&&(this.#t.remove(),this.#t=null)}#h(e){let s=e.querySelector(":scope > [data-comment-body]")?.textContent.trim()??"";this.dispatchEvent(new CustomEvent("comment-thread:edit-request",{bubbles:!0,detail:{commentId:e.id,value:s}}))}#d(e){this.dispatchEvent(new CustomEvent("comment-thread:delete-request",{bubbles:!0,detail:{commentId:e.id}}))}#p(){for(let e of this.querySelectorAll(":scope > article[data-comment] > .comment-header > time")){let t=e.getAttribute("datetime");if(!t)continue;let s=L(new Date(t));s&&(e.textContent=s)}}#u(e){try{return new Date(e).toLocaleString()}catch{return e}}addComment(e){let t=document.createElement("article");t.setAttribute("data-comment",""),t.id=e.id,t.dataset.author=e.author,e.authorHref&&(t.dataset.authorHref=e.authorHref),e.authorAvatar&&(t.dataset.authorAvatar=e.authorAvatar),t.dataset.time=e.time,e.parentId&&(t.dataset.parent=e.parentId),e.mine&&t.setAttribute("data-mine",""),e.edited&&(t.dataset.edited=e.edited);let s=document.createElement("div");return s.setAttribute("data-comment-body",""),s.innerHTML=e.body,t.appendChild(s),this.#e?this.insertBefore(t,this.#e):this.appendChild(t),this.#i(t),t}updateComment(e,t={}){let s=this.querySelector(`:scope > article[data-comment][id="${CSS.escape(e)}"]`);if(!s)return;if(t.body!=null){let a=s.querySelector(":scope > [data-comment-body]");a&&(a.innerHTML=t.body)}t.author!=null&&(s.dataset.author=t.author),t.edited!=null&&(s.dataset.edited=t.edited),s.querySelector(":scope > .comment-header")?.remove();let r=s.querySelector(":scope > [data-comment-body]"),i=this.#a(s);r?s.insertBefore(i,r):s.prepend(i)}removeComment(e){let t=this.querySelector(`:scope > article[data-comment][id="${CSS.escape(e)}"]`);t&&t.remove()}};A("comment-thread",re);export{re as CommentThread};
60
+ //# sourceMappingURL=comment-thread.js.map
@@ -1,2 +1,2 @@
1
- var s=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,o,r){e.addEventListener(t,o,r),this.#e.push(()=>e.removeEventListener(t,o,r))}setup(){}teardown(){}};var m=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(i,e,t={}){let o=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:o},n=l.get(i);if(customElements.get(i)){if(!n||n.priority>=o){n&&n.priority===o&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=o){n.priority===o&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}l.set(i,r),customElements.define(i,e)}var c=class extends s{setup(){let e=document.createElement("button");e.type="button";let t=document.createElement("icon-wc");t.setAttribute("name","message-circle"),t.setAttribute("size","sm"),t.setAttribute("aria-hidden","true"),e.appendChild(t);let o=this.closest("selection-menu")?.getAttribute("for"),r=this.closest("review-surface")||(o?document.querySelector(`review-surface[for="${o}"]`):null);r?(e.setAttribute("aria-label","Add comment"),e.addEventListener("click",()=>this.#e(r))):(e.setAttribute("aria-label","Comments not available"),e.style.opacity="0.4",e.setAttribute("title","Wrap content in <review-surface> to enable comments")),this.appendChild(e)}#e(e){let t=this.closest("selection-menu");if(!t)return;let o=t.getSelection();if(!o)return;let r=o.range.getBoundingClientRect(),n=e.getBoundingClientRect(),d=(r.left+r.width/2-n.left)/n.width*100,a=(r.top-n.top)/n.height*100;typeof e.addPin=="function"&&e.addPin({x:d,y:a,text:o.text}),this.dispatchEvent(new CustomEvent("comment-wc:created",{detail:{text:o.text,x:d,y:a},bubbles:!0})),t.dismiss()}};u("comment-wc",c);
1
+ var s=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,i){e.addEventListener(t,n,i),this.#e.push(()=>e.removeEventListener(t,n,i))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let i=`--${e}`;t?n.add(i):n.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};var m=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(r,e,t={}){let n=t.priority??10,i={impl:e,bundle:t.bundle,contract:t.contract,priority:n},o=l.get(r);if(customElements.get(r)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}l.set(r,i),customElements.define(r,e)}var c=class extends s{setup(){let e=document.createElement("button");e.type="button";let t=document.createElement("icon-wc");t.setAttribute("name","message-circle"),t.setAttribute("size","sm"),t.setAttribute("aria-hidden","true"),e.appendChild(t);let n=this.closest("selection-menu")?.getAttribute("for"),i=this.closest("review-surface")||(n?document.querySelector(`review-surface[for="${n}"]`):null);i?(e.setAttribute("aria-label","Add comment"),e.addEventListener("click",()=>this.#e(i))):(e.setAttribute("aria-label","Comments not available"),e.style.opacity="0.4",e.setAttribute("title","Wrap content in <review-surface> to enable comments")),this.appendChild(e)}#e(e){let t=this.closest("selection-menu");if(!t)return;let n=t.getSelection();if(!n)return;let i=n.range.getBoundingClientRect(),o=e.getBoundingClientRect(),a=(i.left+i.width/2-o.left)/o.width*100,d=(i.top-o.top)/o.height*100;typeof e.addPin=="function"&&e.addPin({x:a,y:d,text:n.text}),this.dispatchEvent(new CustomEvent("comment-wc:created",{detail:{text:n.text,x:a,y:d},bubbles:!0})),t.dismiss()}};u("comment-wc",c);
2
2
  //# sourceMappingURL=comment-wc.js.map
@@ -1,2 +1,2 @@
1
- var l=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(r,e,t={}){let i=t.priority??10,o={impl:e,bundle:t.bundle,contract:t.contract,priority:i},n=c.get(r);if(customElements.get(r)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}c.set(r,o),customElements.define(r,e)}var s=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,i,o){e.addEventListener(t,i,o),this.#e.push(()=>e.removeEventListener(t,i,o))}setup(){}teardown(){}};var a=class extends s{#e;#i=!1;setup(){let e=[...this.children];if(e.length<2)return!1;e.length>2&&console.warn("[compare-surface] Expected exactly 2 children; extra children will be ignored.");let t=this.getAttribute("position"),i=t!==null?Number(t):50,o=Math.min(100,Math.max(0,isNaN(i)?50:i));this.#e=document.createElement("div"),this.#e.className="comparison-divider",this.#e.setAttribute("role","slider"),this.#e.setAttribute("aria-label","Comparison slider"),this.#e.setAttribute("aria-valuemin","0"),this.#e.setAttribute("aria-valuemax","100"),this.#e.setAttribute("aria-valuenow",String(Math.round(o))),this.#e.setAttribute("tabindex","0"),this.appendChild(this.#e),this.#t(o),this.listen(this.#e,"pointerdown",this.#o),this.listen(this.#e,"keydown",this.#s)}teardown(){this.#e&&(this.#e.remove(),this.#e=null),this.#i=!1}#o=e=>{e.preventDefault(),this.#i=!0,this.#e.setPointerCapture(e.pointerId),this.#e.addEventListener("pointermove",this.#n),this.#e.addEventListener("pointerup",this.#r)};#n=e=>{if(!this.#i)return;let t=this.getBoundingClientRect(),i=e.clientX-t.left,o=Math.min(100,Math.max(0,i/t.width*100));this.#t(o)};#r=e=>{this.#i=!1,this.#e.releasePointerCapture(e.pointerId),this.#e.removeEventListener("pointermove",this.#n),this.#e.removeEventListener("pointerup",this.#r)};#s=e=>{let t=e.shiftKey?10:1,i=Number(this.#e.getAttribute("aria-valuenow"));e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),this.#t(Math.max(0,i-t))):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),this.#t(Math.min(100,i+t)))};#t(e){let t=Math.round(e);this.style.setProperty("--_position",`${e}%`),this.#e&&(this.#e.setAttribute("aria-valuenow",String(t)),this.#e.style.left=`${e}%`),this.setAttribute("position",String(t)),this.dispatchEvent(new CustomEvent("compare-surface:change",{detail:{position:e},bubbles:!0}))}get position(){return Number(this.getAttribute("position"))||0}set position(e){let t=Math.min(100,Math.max(0,Number(e)||0));this.#t(t)}};d("compare-surface",a);export{a as CompareSurface};
1
+ var l=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=c.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}c.set(s,n),customElements.define(s,t)}var o=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let 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))}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)}};var a=class extends o{#t;#e=!1;setup(){let t=[...this.children];if(t.length<2)return!1;t.length>2&&console.warn("[compare-surface] Expected exactly 2 children; extra children will be ignored.");let e=this.getAttribute("position"),i=e!==null?Number(e):50,n=Math.min(100,Math.max(0,isNaN(i)?50:i));return this.#t=document.createElement("div"),this.#t.className="comparison-divider",this.#t.setAttribute("role","slider"),this.#t.setAttribute("aria-label","Comparison slider"),this.#t.setAttribute("aria-valuemin","0"),this.#t.setAttribute("aria-valuemax","100"),this.#t.setAttribute("aria-valuenow",String(Math.round(n))),this.#t.setAttribute("tabindex","0"),this.appendChild(this.#t),this.#i(n),this.listen(this.#t,"pointerdown",this.#s),this.listen(this.#t,"keydown",this.#o),!0}teardown(){this.#t&&(this.#t.remove(),this.#t=null),this.#e=!1}#s=t=>{t.preventDefault(),this.#e=!0,this.#t.setPointerCapture(t.pointerId),this.#t.addEventListener("pointermove",this.#n),this.#t.addEventListener("pointerup",this.#r)};#n=t=>{if(!this.#e)return;let e=this.getBoundingClientRect(),i=t.clientX-e.left,n=Math.min(100,Math.max(0,i/e.width*100));this.#i(n)};#r=t=>{this.#e=!1,this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#n),this.#t.removeEventListener("pointerup",this.#r)};#o=t=>{let e=t.shiftKey?10:1,i=Number(this.#t.getAttribute("aria-valuenow"));t.key==="ArrowLeft"||t.key==="ArrowDown"?(t.preventDefault(),this.#i(Math.max(0,i-e))):(t.key==="ArrowRight"||t.key==="ArrowUp")&&(t.preventDefault(),this.#i(Math.min(100,i+e)))};#i(t){let e=Math.round(t);this.style.setProperty("--_position",`${t}%`),this.#t&&(this.#t.setAttribute("aria-valuenow",String(e)),this.#t.style.left=`${t}%`),this.setAttribute("position",String(e)),this.dispatchEvent(new CustomEvent("compare-surface:change",{detail:{position:t},bubbles:!0}))}get position(){return Number(this.getAttribute("position"))||0}set position(t){let e=Math.min(100,Math.max(0,Number(t)||0));this.#i(e)}};d("compare-surface",a);export{a as CompareSurface};
2
2
  //# sourceMappingURL=compare-surface.js.map
@@ -1,4 +1,4 @@
1
- var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function p(r,a,t={}){let o=t.priority??10,n={impl:a,bundle:t.bundle,contract:t.contract,priority:o},e=u.get(r);if(customElements.get(r)){if(!e||e.priority>=o){e&&e.priority===o&&e.impl!==a&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${e.bundle}" (priority ${e.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${e.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(e&&e.priority>=o){e.priority===o&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${e.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(r,n),customElements.define(r,a)}var i=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let a of this.#e)a();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(a,t,o,n){a.addEventListener(t,o,n),this.#e.push(()=>a.removeEventListener(t,o,n))}setup(){}teardown(){}};var b={button:()=>`
1
+ var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function p(r,e,t={}){let a=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:a},o=u.get(r);if(customElements.get(r)){if(!o||o.priority>=a){o&&o.priority===a&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=a){o.priority===a&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(r,n),customElements.define(r,e)}var i=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,a,n){e.addEventListener(t,a,n),this.#e.push(()=>e.removeEventListener(t,a,n))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let a=this.#t.states;try{t?a.add(e):a.delete(e)}catch{let n=`--${e}`;t?a.add(n):a.delete(n)}}_adoptInternals(e){this.#t||(this.#t=e)}};var b={button:()=>`
2
2
  <layout-cluster data-layout-gap="s">
3
3
  <button>Primary</button>
4
4
  <button class="secondary">Secondary</button>
@@ -38,7 +38,7 @@ var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;functi
38
38
  <progress value="100" max="100">100%</progress>
39
39
  </layout-stack>`,range:()=>`
40
40
  <input type="range" min="0" max="100" value="50" aria-label="Sample range"/>`,textarea:()=>`
41
- <textarea rows="3" placeholder="Textarea sample" aria-label="Sample textarea" style="width:100%"></textarea>`},c=class extends i{static observedAttributes=["components","label","compact"];setup(){this.#e()}attributeChangedCallback(){this.isConnected&&this.#e()}#e(){let a=this.getAttribute("components")||"button,input,select,checkbox,radio,badge,progress",t=this.getAttribute("label")||"",o=this.hasAttribute("compact"),n=a.split(",").map(l=>l.trim()),e=o?"0.75rem":"1.25rem",s="";t&&(s+=`<p style="font-size:0.75rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--color-text-muted,#666);margin-block-end:0.75rem;font-family:var(--font-sans,system-ui)">${t}</p>`),s+=`<section style="display:grid;grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));gap:${e}">`;for(let l of n){let d=b[l];d&&(s+=`<article style="border:1px solid var(--color-border,#ddd);border-radius:var(--radius-m,0.5rem);padding:var(--size-m,1rem);background:var(--color-surface,#fff)">
41
+ <textarea rows="3" placeholder="Textarea sample" aria-label="Sample textarea" style="width:100%"></textarea>`},c=class extends i{static observedAttributes=["components","label","compact"];setup(){this.#e()}attributeChangedCallback(){this.isConnected&&this.#e()}#e(){let e=this.getAttribute("components")||"button,input,select,checkbox,radio,badge,progress",t=this.getAttribute("label")||"",a=this.hasAttribute("compact"),n=e.split(",").map(l=>l.trim()),o=a?"0.75rem":"1.25rem",s="";t&&(s+=`<p style="font-size:0.75rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--color-text-muted,#666);margin-block-end:0.75rem;font-family:var(--font-sans,system-ui)">${t}</p>`),s+=`<section style="display:grid;grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));gap:${o}">`;for(let l of n){let d=b[l];d&&(s+=`<article style="border:1px solid var(--color-border,#ddd);border-radius:var(--radius-m,0.5rem);padding:var(--size-m,1rem);background:var(--color-surface,#fff)">
42
42
  <p style="font-size:0.625rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--color-text-muted,#999);margin-block-end:var(--size-s,0.5rem);font-family:var(--font-sans,system-ui)">${l}</p>
43
43
  ${d()}
44
44
  </article>`)}s+="</section>",this.innerHTML=s}};p("component-sampler",c);
@@ -1,2 +1,2 @@
1
- var w=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function m(t,e,n={}){let r=n.priority??10,o={impl:e,bundle:n.bundle,contract:n.contract,priority:r},s=p.get(t);if(customElements.get(t)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}p.set(t,o),customElements.define(t,e)}var l=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,o){e.addEventListener(n,r,o),this.#e.push(()=>e.removeEventListener(n,r,o))}setup(){}teardown(){}};function g(){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,n){t.setItem(e,n)},async removeRaw(e){t.removeItem(e)},async keys(e){let n=[];for(let r=0;r<t.length;r++){let o=t.key(r);o&&o.startsWith(e)&&n.push(o)}return n}}}var u=null;function a(){return u||(u=g()),u}function f(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 y(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function b(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var c={configure(t={}){u=t.backend??null},async set(t,e,n){let r={data:n,timestamp:Date.now()};await a().setRaw(f(t,e),JSON.stringify(r))},async get(t,e,n){let r=await a().getRaw(f(t,e));if(r==null)return null;let o=b(r);return!o||n?.maxAge!=null&&Date.now()-o.timestamp>n.maxAge?null:o.data},async remove(t,e){await a().removeRaw(f(t,e))},async list(t){let e=y(t),n=await a().keys(e),r=[];for(let o of n){let s=await a().getRaw(o);if(s==null)continue;let i=b(s);i&&r.push({key:o.slice(e.length),data:i.data,timestamp:i.timestamp})}return r},async clear(t){let e=y(t),n=await a().keys(e);for(let r of n)await a().removeRaw(r)},async clearAll(){let t=await a().keys("vb:");for(let e of t)await a().removeRaw(e)},async setMany(t,e){for(let[n,r]of e)await c.set(t,n,r)}};var h=class extends l{#e=null;static get observedAttributes(){return["position"]}get#t(){return this.getAttribute("persist")||"banner"}get#i(){let e=this.getAttribute("expires");return e==="0"||e==="never"?0:e?parseInt(e,10):365}get#a(){let e=this.#i;return e>0?e*864e5:void 0}async setup(){if(this.#e=this.querySelector("dialog"),!this.#e)return!1;if(this.getAttribute("trigger")&&this.listen(document,"click",this.#l),await this.#o())return this.getAttribute("trigger")?this.hidden=!0:this.remove(),!1;this.#n()}#n(){(this.getAttribute("position")||"bottom")==="center"?(this.#e.showModal(),this.#e.addEventListener("cancel",this.#r)):this.#e.show(),this.addEventListener("click",this.#s)}#c(){this.#e.removeEventListener("cancel",this.#r),this.removeEventListener("click",this.#s),this.#e.close(),this.getAttribute("trigger")?this.hidden=!0:this.remove()}#r=e=>{e.preventDefault()};#s=async e=>{let n=e.target.closest("button[value]");if(!n)return;let r=n.value;if(!["accept","reject","save"].includes(r))return;let o=[...this.querySelectorAll('input[type="checkbox"]')],s={};r==="accept"?o.forEach(i=>{s[i.name]=!0}):r==="reject"?o.forEach(i=>{s[i.name]=!!i.disabled}):o.forEach(i=>{s[i.name]=i.checked}),await this.#u({preferences:s,action:r}),this.dispatchEvent(new CustomEvent("consent-banner:change",{bubbles:!0,detail:{preferences:s,action:r}})),this.#c()};#l=async e=>{let n=this.getAttribute("trigger");if(!n||!e.target.closest(n))return;e.preventDefault();let o=await this.#o();if(o?.preferences)for(let[s,i]of Object.entries(o.preferences)){let d=this.querySelector(`input[type="checkbox"][name="${CSS.escape(s)}"]`);d&&!d.disabled&&(d.checked=i)}this.hidden=!1,this.#n()};async#o(){let e=this.#a;return await c.get("consent",this.#t,e?{maxAge:e}:void 0)}async#u(e){await c.set("consent",this.#t,e)}static async reset(e="banner"){await c.remove("consent",e)}static async getConsent(e="banner"){return await c.get("consent",e)}};m("consent-banner",h);export{h as ConsentBanner};
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function m(t,e,r={}){let n=r.priority??10,s={impl:e,bundle:r.bundle,contract:r.contract,priority:n},i=p.get(t);if(customElements.get(t)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}p.set(t,s),customElements.define(t,e)}var l=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,n,s){e.addEventListener(r,n,s),this.#e.push(()=>e.removeEventListener(r,n,s))}setup(){}teardown(){}setState(e,r){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{r?n.add(e):n.delete(e)}catch{let s=`--${e}`;r?n.add(s):n.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}};function b(){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,r){t.setItem(e,r)},async removeRaw(e){t.removeItem(e)},async keys(e){let r=[];for(let n=0;n<t.length;n++){let s=t.key(n);s&&s.startsWith(e)&&r.push(s)}return r}}}var u=null;function a(){return u||(u=b()),u}function f(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 y(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function g(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var c={configure(t={}){u=t.backend??null},async set(t,e,r){let n={data:r,timestamp:Date.now()};await a().setRaw(f(t,e),JSON.stringify(n))},async get(t,e,r){let n=await a().getRaw(f(t,e));if(n==null)return null;let s=g(n);return!s||r?.maxAge!=null&&Date.now()-s.timestamp>r.maxAge?null:s.data},async remove(t,e){await a().removeRaw(f(t,e))},async list(t){let e=y(t),r=await a().keys(e),n=[];for(let s of r){let i=await a().getRaw(s);if(i==null)continue;let o=g(i);o&&n.push({key:s.slice(e.length),data:o.data,timestamp:o.timestamp})}return n},async clear(t){let e=y(t),r=await a().keys(e);for(let n of r)await a().removeRaw(n)},async clearAll(){let t=await a().keys("vb:");for(let e of t)await a().removeRaw(e)},async setMany(t,e){for(let[r,n]of e)await c.set(t,r,n)}};var h=class extends l{#e=null;static get observedAttributes(){return["position"]}get#t(){return this.getAttribute("persist")||"banner"}get#o(){let e=this.getAttribute("expires");return e==="0"||e==="never"?0:e?parseInt(e,10):365}get#a(){let e=this.#o;return e>0?e*864e5:void 0}setup(){return this.#e=this.querySelector("dialog"),this.#e?(this.getAttribute("trigger")&&this.listen(document,"click",this.#u),this.#c(),!0):!1}async#c(){if(await this.#i()){this.getAttribute("trigger")?this.hidden=!0:this.remove();return}this.#n()}#n(){(this.getAttribute("position")||"bottom")==="center"?(this.#e.showModal(),this.#e.addEventListener("cancel",this.#r)):this.#e.show(),this.addEventListener("click",this.#s)}#l(){this.#e.removeEventListener("cancel",this.#r),this.removeEventListener("click",this.#s),this.#e.close(),this.getAttribute("trigger")?this.hidden=!0:this.remove()}#r=e=>{e.preventDefault()};#s=async e=>{let r=e.target.closest("button[value]");if(!r)return;let n=r.value;if(!["accept","reject","save"].includes(n))return;let s=[...this.querySelectorAll('input[type="checkbox"]')],i={};n==="accept"?s.forEach(o=>{i[o.name]=!0}):n==="reject"?s.forEach(o=>{i[o.name]=!!o.disabled}):s.forEach(o=>{i[o.name]=o.checked}),await this.#d({preferences:i,action:n}),this.dispatchEvent(new CustomEvent("consent-banner:change",{bubbles:!0,detail:{preferences:i,action:n}})),this.#l()};#u=async e=>{let r=this.getAttribute("trigger");if(!r||!e.target.closest(r))return;e.preventDefault();let s=await this.#i();if(s?.preferences)for(let[i,o]of Object.entries(s.preferences)){let d=this.querySelector(`input[type="checkbox"][name="${CSS.escape(i)}"]`);d&&!d.disabled&&(d.checked=o)}this.hidden=!1,this.#n()};async#i(){let e=this.#a;return await c.get("consent",this.#t,e?{maxAge:e}:void 0)}async#d(e){await c.set("consent",this.#t,e)}static async reset(e="banner"){await c.remove("consent",e)}static async getConsent(e="banner"){return await c.get("consent",e)}};m("consent-banner",h);export{h as ConsentBanner};
2
2
  //# sourceMappingURL=consent-banner.js.map
@@ -1,2 +1,2 @@
1
- var p=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(r,e,t={}){let s=t.priority??10,i={impl:e,bundle:t.bundle,contract:t.contract,priority:s},n=u.get(r);if(customElements.get(r)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(r,i),customElements.define(r,e)}var c=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,i){e.addEventListener(t,s,i),this.#e.push(()=>e.removeEventListener(t,s,i))}setup(){}teardown(){}};var a=class extends c{#e=new Map;#s="";#t=null;setup(){if(this.#i(),this.#e.size===0)return!1;this.#o(),this.#c();let e=this.#l();this.#n(e,!1)}#i(){for(let e of this.children){let t=e.getAttribute("data-lens-name");t&&this.#e.set(t,e)}}#o(){let e=this.getAttribute("data-lens-src");if(e)for(let t of this.#e.values())!t.hasAttribute("data-lens-src")&&!t.hasAttribute("src")&&t.setAttribute("data-lens-src",e)}#c(){if(this.getAttribute("data-lens-controls")==="off")return;let e=document.createElement("nav");e.setAttribute("data-content-lens-controls",""),e.setAttribute("aria-label","Switch lens");let t=document.createElement("fieldset"),s=document.createElement("legend");s.textContent="View",t.append(s);let i=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[n,h]of this.#e){let l=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=i,o.value=n,o.addEventListener("change",()=>{o.checked&&this.#n(n,!0)});let d=document.createElement("span");d.textContent=h.getAttribute("data-lens-label")||this.#a(n),l.append(o,d),t.append(l)}e.append(t),this.prepend(e),this.#t=e}#a(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}#r(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#l(){let e=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#r()):null}catch{return null}})();if(e&&this.#e.has(e))return e;let t=this.getAttribute("data-lens-default");return t&&this.#e.has(t)?t:[...this.#e.keys()][0]}#n(e,t){if(this.#e.has(e)){for(let[s,i]of this.#e){let n=s===e;i.toggleAttribute("hidden",!n),i.setAttribute("aria-hidden",n?"false":"true")}if(this.#t){let s=this.#t.querySelector(`input[value="${e}"]`);s&&(s.checked=!0)}if(this.#s=e,this.setAttribute("data-active-lens",e),t)try{sessionStorage.setItem(this.#r(),e)}catch{}this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:e},bubbles:!0}))}}get activeLens(){return this.#s}setLens(e){this.#n(e,!0)}};f("content-lens",a);export{a as ContentLens};
1
+ var p=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(i,e,t={}){let n=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:n},s=u.get(i);if(customElements.get(i)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(i,r),customElements.define(i,e)}var c=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,r){e.addEventListener(t,n,r),this.#e.push(()=>e.removeEventListener(t,n,r))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let r=`--${e}`;t?n.add(r):n.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};var a=class extends c{#e=new Map;#t="";#n=null;setup(){if(this.#i(),this.#e.size===0)return!1;this.#o(),this.#c();let e=this.#l();return this.#s(e,!1),!0}#i(){for(let e of this.children){let t=e.getAttribute("data-lens-name");t&&this.#e.set(t,e)}}#o(){let e=this.getAttribute("data-lens-src");if(e)for(let t of this.#e.values())!t.hasAttribute("data-lens-src")&&!t.hasAttribute("src")&&t.setAttribute("data-lens-src",e)}#c(){if(this.getAttribute("data-lens-controls")==="off")return;let e=document.createElement("nav");e.setAttribute("data-content-lens-controls",""),e.setAttribute("aria-label","Switch lens");let t=document.createElement("fieldset"),n=document.createElement("legend");n.textContent="View",t.append(n);let r=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[s,h]of this.#e){let l=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=r,o.value=s,o.addEventListener("change",()=>{o.checked&&this.#s(s,!0)});let d=document.createElement("span");d.textContent=h.getAttribute("data-lens-label")||this.#a(s),l.append(o,d),t.append(l)}e.append(t),this.prepend(e),this.#n=e}#a(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}#r(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#l(){let e=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#r()):null}catch{return null}})();if(e&&this.#e.has(e))return e;let t=this.getAttribute("data-lens-default");return t&&this.#e.has(t)?t:[...this.#e.keys()][0]}#s(e,t){if(this.#e.has(e)){for(let[n,r]of this.#e){let s=n===e;r.toggleAttribute("hidden",!s),r.setAttribute("aria-hidden",s?"false":"true")}if(this.#n){let n=this.#n.querySelector(`input[value="${e}"]`);n&&(n.checked=!0)}if(this.#t=e,this.setAttribute("data-active-lens",e),t)try{sessionStorage.setItem(this.#r(),e)}catch{}this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:e},bubbles:!0}))}}get activeLens(){return this.#t}setLens(e){this.#s(e,!0)}};f("content-lens",a);export{a as ContentLens};
2
2
  //# sourceMappingURL=content-lens.js.map
@@ -1,2 +1,2 @@
1
- function w(t){return document.startViewTransition?document.startViewTransition(t):t()}var M=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(t,e,r={}){let n=r.priority??10,a={impl:e,bundle:r.bundle,contract:r.contract,priority:n},o=m.get(t);if(customElements.get(t)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${o.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}m.set(t,a),customElements.define(t,e)}var d=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,n,a){e.addEventListener(r,n,a),this.#t.push(()=>e.removeEventListener(r,n,a))}setup(){}teardown(){}};var k=0;function p(t,e){return t.matches("content-swap")?e:`data-${e}`}function f(t){t.style.viewTransitionName||(t.style.viewTransitionName=`content-swap-${++k}`);let e=t.querySelector(':scope > [data-face="front"]'),r=t.querySelector(':scope > [data-face="back"]');if(!e||!r)return;let n=[];function a(s,i,b,h){s.addEventListener(i,b,h),n.push(()=>s.removeEventListener(i,b,h))}let o=[...t.querySelectorAll("[data-swap]")].filter(s=>s!==t&&s.closest("content-swap, [data-swap]")===t);return o.length===0?(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.getAttribute("aria-label")||t.setAttribute("aria-label","Toggle content"),a(t,"click",()=>u(t,"pointer")),a(t,"keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),u(t,"keyboard"))})):o.forEach(s=>{a(s,"click",i=>{i.stopPropagation(),u(t,"pointer")}),a(s,"keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),u(t,"keyboard"))})}),v(t,e,r),()=>{for(let s of n)s();n.length=0}}function v(t,e,r){let n=t.hasAttribute(p(t,"swapped"));e.inert=n,r.inert=!n}function A(t){return{front:t.querySelector(':scope > [data-face="front"]'),back:t.querySelector(':scope > [data-face="back"]')}}function c(t,e,r="api"){let{front:n,back:a}=A(t);if(!n||!a)return;let o=p(t,"swapped");if(e&&t.hasAttribute(o)||!e&&!t.hasAttribute(o))return;w(()=>{e?t.setAttribute(o,""):t.removeAttribute(o),v(t,n,a),T(t);let s=e?a:n,i=s.querySelector("[autofocus]");i?i.focus():r==="keyboard"&&$(s)})}function u(t,e="api"){c(t,!t.hasAttribute(p(t,"swapped")),e)}function T(t){t.dispatchEvent(new CustomEvent("content-swap:swap",{detail:{swapped:t.hasAttribute(p(t,"swapped"))},bubbles:!0}))}function $(t){let e=t.querySelector("[data-swap], button, a, input, select, textarea");e&&e.focus()}var l=class extends d{#t=null;setup(){this.#t=f(this)??null}teardown(){this.#t?.(),this.#t=null}flip(){c(this,!0)}unflip(){c(this,!1)}toggle(){u(this)}get flipped(){return this.hasAttribute("swapped")}set flipped(e){c(this,!!e)}get swapped(){return this.hasAttribute("swapped")}set swapped(e){c(this,!!e)}};y("content-swap",l);function E(){document.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(t=>{t.querySelector(":scope > [data-face]")&&(f(t),t.setAttribute("data-swap-init",""))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E):E();var g=new MutationObserver(t=>{for(let e of t)for(let r of e.addedNodes){if(r.nodeType!==Node.ELEMENT_NODE)continue;let n=r;n.hasAttribute("data-swap")&&!n.matches("content-swap")&&!n.hasAttribute("data-swap-init")&&n.querySelector(":scope > [data-face]")&&(f(n),n.setAttribute("data-swap-init","")),n.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(a=>{a.querySelector(":scope > [data-face]")&&(f(a),a.setAttribute("data-swap-init",""))})}});document.body?g.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{g.observe(document.body,{childList:!0,subtree:!0})});export{l as ContentSwap};
1
+ function y(t){return document.startViewTransition?document.startViewTransition(t):t()}var M=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function E(t,e,o={}){let n=o.priority??10,r={impl:e,bundle:o.bundle,contract:o.contract,priority:n},s=m.get(t);if(customElements.get(t)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${o.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${o.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${o.bundle}" (first wins at equal priority).`);return}m.set(t,r),customElements.define(t,e)}var p=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,o,n,r){e.addEventListener(o,n,r),this.#t.push(()=>e.removeEventListener(o,n,r))}setup(){}teardown(){}setState(e,o){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{o?n.add(e):n.delete(e)}catch{let r=`--${e}`;o?n.add(r):n.delete(r)}}_adoptInternals(e){this.#e||(this.#e=e)}};var k=0;function b(t,e){return t.matches("content-swap")?e:`data-${e}`}function l(t){t.style.viewTransitionName||(t.style.viewTransitionName=`content-swap-${++k}`);let e=t.querySelector(':scope > [data-face="front"]'),o=t.querySelector(':scope > [data-face="back"]');if(!e||!o)return;let n=[];function r(i,a,u,c){i.addEventListener(a,u,c),n.push(()=>i.removeEventListener(a,u,c))}let s=[...t.querySelectorAll("[data-swap]")].filter(i=>i!==t&&i.closest("content-swap, [data-swap]")===t);return s.length===0?(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.getAttribute("aria-label")||t.setAttribute("aria-label","Toggle content"),r(t,"click",()=>d(t,"pointer")),r(t,"keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),d(t,"keyboard"))})):s.forEach(i=>{r(i,"click",a=>{a.stopPropagation(),d(t,"pointer")}),r(i,"keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),d(t,"keyboard"))})}),t.matches('[data-gesture="flick"], [data-gesture="swipe"]')&&(r(t,"swipe-left",()=>d(t,"pointer")),r(t,"swipe-right",()=>d(t,"pointer"))),v(t,e,o),()=>{for(let i of n)i();n.length=0}}function v(t,e,o){let n=t.hasAttribute(b(t,"swapped"));e.inert=n,o.inert=!n}function A(t){return{front:t.querySelector(':scope > [data-face="front"]'),back:t.querySelector(':scope > [data-face="back"]')}}function f(t,e,o="api"){let{front:n,back:r}=A(t);if(!n||!r)return;let s=b(t,"swapped");if(e&&t.hasAttribute(s)||!e&&!t.hasAttribute(s))return;let w=()=>{e?t.setAttribute(s,""):t.removeAttribute(s),v(t,n,r),T(t,o);let u=e?r:n,c=u.querySelector("[autofocus]");c?c.focus():o==="keyboard"&&$(u)},i=u=>{let c=t;typeof c.setState=="function"&&c.setState("transition-running",u)};i(!0);let a=y(w);a&&a.finished&&typeof a.finished.finally=="function"?a.finished.finally(()=>i(!1)):i(!1)}function d(t,e="api"){f(t,!t.hasAttribute(b(t,"swapped")),e)}function T(t,e="internal"){t.dispatchEvent(new CustomEvent("content-swap:swap",{detail:{swapped:t.hasAttribute(b(t,"swapped")),source:e},bubbles:!0}))}function $(t){let e=t.querySelector("[data-swap], button, a, input, select, textarea");e&&e.focus()}var h=class extends p{#t=null;setup(){this.#t=l(this)??null}teardown(){this.#t?.(),this.#t=null}flip(){f(this,!0)}unflip(){f(this,!1)}toggle(){d(this)}get flipped(){return this.hasAttribute("swapped")}set flipped(e){f(this,!!e)}get swapped(){return this.hasAttribute("swapped")}set swapped(e){f(this,!!e)}};E("content-swap",h);function g(){document.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(t=>{t.querySelector(":scope > [data-face]")&&(l(t),t.setAttribute("data-swap-init",""))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g();var S=new MutationObserver(t=>{for(let e of t)for(let o of e.addedNodes){if(o.nodeType!==Node.ELEMENT_NODE)continue;let n=o;n.hasAttribute("data-swap")&&!n.matches("content-swap")&&!n.hasAttribute("data-swap-init")&&n.querySelector(":scope > [data-face]")&&(l(n),n.setAttribute("data-swap-init","")),n.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(r=>{r.querySelector(":scope > [data-face]")&&(l(r),r.setAttribute("data-swap-init",""))})}});document.body?S.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{S.observe(document.body,{childList:!0,subtree:!0})});export{h as ContentSwap};
2
2
  //# sourceMappingURL=content-swap.js.map
@@ -1,2 +1,2 @@
1
- var c=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),d={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",shift:"\u21E7",ctrl:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",shift:"Shift",ctrl:"Ctrl"}};function f(s){let t=c?d.mac:d.other;return s.split("+").map(e=>{let i=e.trim().toLowerCase();return t[i]??i.toUpperCase()}).join(c?"":"+")}function p(s){let t=s.toLowerCase().split("+").map(i=>i.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function m(s,t){if(s.key.toLowerCase()!==t.key)return!1;let e,i;return c?(e=t.meta,i=t.ctrl):(e=!1,i=t.meta||t.ctrl),!(e!==s.metaKey||i!==s.ctrlKey||t.shift!==s.shiftKey||t.alt!==s.altKey)}var g=new Set(["INPUT","TEXTAREA","SELECT"]),o=[],b=!1;function x(s){let t=g.has(s.target.tagName)||s.target.isContentEditable;for(let e of o)if(!(t&&!e.global)&&m(s,e.descriptor)){s.preventDefault(),e.callback(s);return}}function v(){b||(document.addEventListener("keydown",x),b=!0)}function y(s,t,e={}){v();let i=p(s),r={combo:s,descriptor:i,callback:t,global:e.global===!0};return o.find(u=>u.combo===s)&&console.warn(`[hotkey-bind] Shortcut "${s}" already bound. Last-connected-wins.`),o.unshift(r),function(){let h=o.indexOf(r);h!==-1&&o.splice(h,1)}}var E="popover"in HTMLElement.prototype;var M=window.matchMedia("(prefers-reduced-motion: reduce)");var k=new Map;function w(s,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=k.get(s);if(customElements.get(s)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> 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 <${s}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}k.set(s,r),customElements.define(s,t)}var a=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),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,r){t.addEventListener(e,i,r),this.#e.push(()=>t.removeEventListener(e,i,r))}setup(){}teardown(){}};var l=class extends a{#e;#t;#i=[];#n=-1;#s=!1;#a=[];#r=!1;setup(){if(this.#e=this.querySelector(":scope > [data-trigger]"),this.#t=this.querySelector(':scope > menu, :scope > ul[role="menu"]'),!this.#e||!this.#t)return!1;this.#r=E,this.#r&&this.#t.setAttribute("popover","auto"),this.#e?.setAttribute("aria-expanded","false"),this.#t.setAttribute("role","menu"),this.#t.id||(this.#t.id=`ctx-menu-${crypto.randomUUID().slice(0,8)}`),this.#t.querySelectorAll(":scope > li[data-group]").forEach(t=>{t.setAttribute("role","presentation"),t.classList.add("ctx-group-label")}),this.#i=Array.from(this.#t.querySelectorAll('button, a, [role="menuitem"]')).filter(t=>!t.disabled&&!t.hasAttribute("data-disabled")),this.#i.forEach(t=>{t.setAttribute("role","menuitem"),t.setAttribute("tabindex","-1"),t.style.cssText+=";border:none;box-shadow:none;transform:none;border-radius:0;",this.listen(t,"click",this.#h);let e=t.getAttribute("data-shortcut");if(e){let i=document.createElement("kbd");i.className="ctx-kbd",i.textContent=f(e),t.appendChild(i);let r=y(e,()=>t.click());this.#a.push(r)}}),this.#t.querySelectorAll('li:empty:not([data-group]), [role="separator"], hr').forEach(t=>{t.setAttribute("role","separator")}),this.listen(this.#e,"contextmenu",this.#c),this.listen(this.#t,"keydown",this.#u),this.listen(window,"scroll",this.#b,{capture:!0}),this.#r?this.listen(this.#t,"toggle",this.#m):(this.listen(document,"click",this.#d),this.listen(document,"contextmenu",this.#f),this.listen(document,"keydown",this.#p))}teardown(){this.#a.forEach(t=>t()),this.#a=[]}#c=t=>{t.preventDefault(),this.#l(t.clientX,t.clientY)};#l(t,e){if(this.#s=!0,this.setAttribute("data-open",""),this.#e?.setAttribute("aria-expanded","true"),this.#t.style.setProperty("--ctx-top",`${e}px`),this.#t.style.setProperty("--ctx-left",`${t}px`),this.#r)try{this.#t.showPopover()}catch{}requestAnimationFrame(()=>{let i=this.#t.getBoundingClientRect(),r=t+i.width>window.innerWidth?t-i.width:t,n=e+i.height>window.innerHeight?e-i.height:e;this.#t.style.setProperty("--ctx-top",`${Math.max(0,n)}px`),this.#t.style.setProperty("--ctx-left",`${Math.max(0,r)}px`)}),this.#n=-1,this.#o(0),this.dispatchEvent(new CustomEvent("context-menu:open",{bubbles:!0}))}close(){if(this.#s){if(this.#s=!1,this.removeAttribute("data-open"),this.#e?.setAttribute("aria-expanded","false"),this.#n=-1,this.#r)try{this.#t.hidePopover()}catch{}this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0}))}}#u=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#o(this.#n+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#o(this.#n-1);break;case"Home":t.preventDefault(),this.#o(0);break;case"End":t.preventDefault(),this.#o(this.#i.length-1);break;case"Enter":case" ":t.preventDefault(),this.#n>=0&&this.#i[this.#n].click();break;case"Tab":this.close();break}};#h=()=>{this.close(),this.dispatchEvent(new CustomEvent("context-menu:select",{bubbles:!0,detail:{item:this.#i[this.#n]}}))};#d=t=>{this.#s&&!this.#t.contains(t.target)&&this.close()};#f=t=>{this.#s&&!this.#e.contains(t.target)&&this.close()};#p=t=>{t.key==="Escape"&&this.#s&&(t.preventDefault(),this.close())};#m=t=>{t.newState==="closed"&&this.#s&&(this.#s=!1,this.removeAttribute("data-open"),this.#n=-1,this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))};#b=()=>{this.#s&&this.close()};#o(t){this.#i.length!==0&&(t<0&&(t=this.#i.length-1),t>=this.#i.length&&(t=0),this.#n=t,this.#i[t].focus())}get isOpen(){return this.#s}};w("context-menu",l);export{l as ContextMenuWc};
1
+ var u=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),m={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",shift:"\u21E7",ctrl:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",shift:"Shift",ctrl:"Ctrl"}};function b(n){let t=u?m.mac:m.other;return n.split("+").map(s=>{let e=s.trim().toLowerCase();return t[e]??e.toUpperCase()}).join(u?"":"+")}function y(n){let t=n.toLowerCase().split("+").map(e=>e.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function g(n,t){if(n.key.toLowerCase()!==t.key)return!1;let s,e;return u?(s=t.meta,e=t.ctrl):(s=!1,e=t.meta||t.ctrl),!(s!==n.metaKey||e!==n.ctrlKey||t.shift!==n.shiftKey||t.alt!==n.altKey)}var x=new Set(["INPUT","TEXTAREA","SELECT"]),h=[],w=!1;function k(n){let t=x.has(n.target.tagName)||n.target.isContentEditable;for(let s of h)if(!(t&&!s.global)&&g(n,s.descriptor)){n.preventDefault(),s.callback(n);return}}function C(){w||(document.addEventListener("keydown",k),w=!0)}function E(n,t,s={}){C();let e=y(n),i={combo:n,descriptor:e,callback:t,global:s.global===!0};return h.find(r=>r.combo===n)&&console.warn(`[hotkey-bind] Shortcut "${n}" already bound. Last-connected-wins.`),h.unshift(i),function(){let a=h.indexOf(i);a!==-1&&h.splice(a,1)}}var L=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function l(n,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},o=v.get(n);if(customElements.get(n)){if(!o||o.priority>=e){o&&o.priority===e&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=e){o.priority===e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}v.set(n,i),customElements.define(n,t)}var c=class extends HTMLElement{#s=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#s)t();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,i){t.addEventListener(s,e,i),this.#s.push(()=>t.removeEventListener(s,e,i))}setup(){}teardown(){}setState(t,s){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}};var d=CSS.supports("anchor-name","--x"),S=CSS.supports("position-area","bottom"),$=0,p=class extends c{#s=null;#t=null;#e=null;#i=null;setup(){this.id||(this.id=`pop-over-${++$}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#o(),this.#n(),this.#e=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!d&&s.newState==="open"&&this.#s&&this.#c()},this.listen(this,"beforetoggle",this.#e),d||(this.#i=()=>{this.matches(":popover-open")&&this.#s&&this.#c()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#o(){let t=this.dataset.anchor;t?this.#s=document.getElementById(t)||document.querySelector(t):this.#s=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#n(){if(!(!this.#s||!d)&&(this.#t=`--pop-over-anchor-${this.id}`,this.#s.style.setProperty("anchor-name",this.#t),this.style.setProperty("position-anchor",this.#t),this.setAttribute("data-anchor-name",this.#t||""),!S)){let t=this.dataset.position||"bottom";this.#r(t)}}#r(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},i=t.split("-")[0],o=e[i]||e.bottom;Object.entries(o).forEach(([r,a])=>this.style.setProperty(r,a))}#c(){if(!this.#s)return;let t=this.#s.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#h(),i,o;switch(s.split("-")[0]){case"top":i=t.top-this.offsetHeight-e,o=t.left;break;case"left":i=t.top,o=t.left-this.offsetWidth-e;break;case"right":i=t.top,o=t.right+e;break;default:i=t.bottom+e,o=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?o=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(o)}px`,this.style.margin="0"}#h(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};l("pop-over",p);var A=0,f=class extends c{#s;#t;#e;#i=[];#o=-1;#n=!1;#r=[];setup(){let t=this.querySelector(":scope > [data-trigger]"),s=this.querySelector('menu, ul[role="menu"]');if(!t||!s)return!1;this.#s=t,this.#t=s;let e=this.querySelector(":scope > pop-over[data-context-menu-host]");return e?this.#e=e:(this.#e=document.createElement("pop-over"),this.#e.setAttribute("data-context-menu-host",""),this.#e.id=`ctx-menu-${++A}`,this.#e.dataset.mode="auto",this.#e.appendChild(this.#t),this.appendChild(this.#e)),this.#t.parentElement!==this.#e&&this.#e.appendChild(this.#t),this.#s?.setAttribute("aria-expanded","false"),this.#t.setAttribute("role","menu"),this.#t.id||(this.#t.id=`ctx-menu-list-${++A}`),this.#t.querySelectorAll(":scope > li[data-group]").forEach(i=>{i.setAttribute("role","presentation"),i.classList.add("ctx-group-label")}),this.#i=Array.from(this.#t.querySelectorAll('button, a, [role="menuitem"]')).filter(i=>!i.disabled&&!i.hasAttribute("data-disabled")),this.#i.forEach(i=>{i.setAttribute("role","menuitem"),i.setAttribute("tabindex","-1"),i.style.cssText+=";border:none;box-shadow:none;transform:none;border-radius:0;",this.listen(i,"click",this.#u);let o=i.getAttribute("data-shortcut");if(o){let r=document.createElement("kbd");r.className="ctx-kbd",r.textContent=b(o),i.appendChild(r);let a=E(o,()=>i.click());this.#r.push(a)}}),this.#t.querySelectorAll('li:empty:not([data-group]), [role="separator"], hr').forEach(i=>{i.setAttribute("role","separator")}),this.listen(this.#s,"contextmenu",this.#c),this.listen(this.#t,"keydown",this.#l),this.listen(window,"scroll",this.#p,{capture:!0}),this.listen(this.#e,"pop-over:hide",this.#d),!0}teardown(){this.#r.forEach(t=>t()),this.#r=[]}get items(){if(!this.#t)return[];let t=[];for(let s of this.#t.querySelectorAll(":scope > li")){if(s.hasAttribute("data-group")){t.push({group:s.textContent.trim()});continue}if(s.matches(':empty, [role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let e=s.querySelector('button, a, [role="menuitem"]');e&&t.push({label:e.textContent.trim().replace(/\s+/g," "),value:e.getAttribute("data-value")||void 0,href:e.tagName==="A"?e.getAttribute("href"):void 0,shortcut:e.getAttribute("data-shortcut")||void 0,disabled:e.disabled||e.hasAttribute("data-disabled")||void 0})}return t}set items(t){let s=Array.isArray(t)?t:[],e=this.querySelector('menu, ul[role="menu"]');for(e||(e=document.createElement("menu"),this.appendChild(e));e.firstChild;)e.firstChild.remove();for(let i of s){let o=document.createElement("li");if(i.separator)o.setAttribute("role","separator");else if(i.group!=null)o.setAttribute("data-group",""),o.textContent=i.group;else{let r=i.href?document.createElement("a"):document.createElement("button");i.href&&r.setAttribute("href",i.href),i.value&&r.setAttribute("data-value",i.value),i.shortcut&&r.setAttribute("data-shortcut",i.shortcut),i.disabled&&(r.tagName==="BUTTON"?r.disabled=!0:r.setAttribute("data-disabled","")),r.textContent=i.label||"",o.appendChild(r)}e.appendChild(o)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("context-menu:items-changed",{detail:{items:s,source:"property"},bubbles:!0}))}#c=t=>{t.preventDefault(),this.#h(t.clientX,t.clientY)};#h(t,s){this.#n=!0,this.setAttribute("data-open",""),this.#s?.setAttribute("aria-expanded","true"),this.#e.style.top=`${s}px`,this.#e.style.left=`${t}px`,this.#e.show(),requestAnimationFrame(()=>{let e=this.#e.getBoundingClientRect(),i=t+e.width>window.innerWidth?t-e.width:t,o=s+e.height>window.innerHeight?s-e.height:s;this.#e.style.top=`${Math.max(0,o)}px`,this.#e.style.left=`${Math.max(0,i)}px`}),this.#o=-1,this.#a(0),this.dispatchEvent(new CustomEvent("context-menu:open",{bubbles:!0}))}close(){this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.#e?.hide(),this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))}#l=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#a(this.#o+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#a(this.#o-1);break;case"Home":t.preventDefault(),this.#a(0);break;case"End":t.preventDefault(),this.#a(this.#i.length-1);break;case"Enter":case" ":t.preventDefault(),this.#o>=0&&this.#i[this.#o].click();break;case"Tab":this.close();break}};#u=()=>{this.close(),this.dispatchEvent(new CustomEvent("context-menu:select",{bubbles:!0,detail:{item:this.#i[this.#o]}}))};#d=()=>{this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))};#p=()=>{this.#n&&this.close()};#a(t){this.#i.length!==0&&(t<0&&(t=this.#i.length-1),t>=this.#i.length&&(t=0),this.#o=t,this.#i[t].focus())}get isOpen(){return this.#n}};l("context-menu",f);export{f as ContextMenuWc};
2
2
  //# sourceMappingURL=context-menu.js.map
@@ -1,2 +1,2 @@
1
- var m=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function b(o,e,t={}){let s=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:s},i=p.get(o);if(customElements.get(o)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}p.set(o,n),customElements.define(o,e)}var d=class extends HTMLElement{#i=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0})))}disconnectedCallback(){for(let e of this.#i)e();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,n){e.addEventListener(t,s,n),this.#i.push(()=>e.removeEventListener(t,s,n))}setup(){}teardown(){}};var f=class extends d{#i;#t;#l=[];#a=[];#e=[];#o=-1;#c=null;#s=1;#n=0;#f=null;#p=null;#d=null;#h="";#r=null;#m=null;setup(){if(this.#i=this.querySelector(":scope > table"),!this.#i||(this.#t=this.#i.querySelector("tbody"),!this.#t))return!1;this.#w()}teardown(){this.#S(),this.#l=[],this.#a=[],this.#e=[]}#w(){this.#a=[...this.#t.querySelectorAll(":scope > tr:not([data-expand-content])")],this.#e=[...this.#a],this.#k(),this.#i.hasAttribute("data-filterable")&&this.#$();let e=this.#i.getAttribute("data-paginate");e&&(this.#n=parseInt(e,10),this.#n>0&&this.#B()),this.#I(),this.#F(),this.#u()}#S(){this.#d&&clearTimeout(this.#d),this.#f?.parentElement?.remove(),this.#p?.remove()}#k(){this.#i.querySelectorAll("thead th[data-sort]").forEach((t,s)=>{let n=t.getAttribute("data-sort"),i=this.#M(t);this.#l.push({th:t,sortType:n,columnIndex:i}),t.setAttribute("tabindex","0"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t.dataset.columnIndex=i,this.listen(t,"click",this.#T),this.listen(t,"keydown",this.#q)})}#M(e){return[...e.parentElement.children].indexOf(e)}#T=e=>{let t=e.currentTarget,s=parseInt(t.dataset.columnIndex,10);this.#x(s)};#q=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();let t=e.currentTarget,s=parseInt(t.dataset.columnIndex,10);this.#x(s)}};#R(e,t,s){let n=this.#e;if(n.length<2)return!0;let i=s==="asc"?1:-1;for(let r=1;r<n.length;r++){let a=this.#b(n[r-1].children[e],t),l=this.#b(n[r].children[e],t);if((typeof a=="string"?a.localeCompare(l)*i:(a-l)*i)>0)return!1}return!0}#x(e){let t=this.#l.find(n=>n.columnIndex===e);if(!t)return;let s;this.#o===e?s=this.#c==="asc"?"desc":"asc":this.#R(e,t.sortType,"asc")?s="desc":s="asc",this.#l.forEach(({th:n})=>{n.setAttribute("aria-sort","none")}),t.th.setAttribute("aria-sort",s==="asc"?"ascending":"descending"),this.#o=e,this.#c=s,this.#g(e,s,t.sortType),this.#s=1,this.#u(),this.dispatchEvent(new CustomEvent("data-table:sort",{detail:{column:e,direction:s,columnName:t.th.textContent.trim()},bubbles:!0}))}#g(e,t,s){let n=t==="asc"?1:-1;this.#e.sort((i,r)=>{let a=i.children[e],l=r.children[e];if(!a||!l)return 0;let c=this.#b(a,s),u=this.#b(l,s),h=0;switch(s){case"number":h=c-u;break;case"date":h=c-u;break;default:h=c.localeCompare(u,void 0,{numeric:!0,sensitivity:"base"});break}return h*n})}#b(e,t){let n=e.getAttribute("data-sort-value")??e.textContent.trim();switch(t){case"number":return parseFloat(n)||0;case"date":return new Date(n).getTime()||0;default:return n.toLowerCase()}}#$(){let e=document.createElement("div");e.setAttribute("data-table-filter","");let t=document.createElement("input");t.type="search",t.setAttribute("data-filter-input",""),t.setAttribute("placeholder","Filter table..."),t.setAttribute("aria-label","Filter table rows"),e.appendChild(t),this.insertBefore(e,this.#i),this.#f=t,this.listen(t,"input",this.#L)}#L=e=>{let t=e.target.value;this.#d&&clearTimeout(this.#d),this.#d=setTimeout(()=>{this.#E(t)},150)};#E(e){if(this.#h=e.toLowerCase().trim(),this.#h===""?this.#e=[...this.#a]:this.#e=this.#a.filter(t=>[...t.children].some(n=>(n.getAttribute("data-filter-value")??n.textContent).toLowerCase().includes(this.#h))),this.#o>=0&&this.#c){let t=this.#l.find(s=>s.columnIndex===this.#o);t&&this.#g(this.#o,this.#c,t.sortType)}this.#s=1,this.#u(),this.dispatchEvent(new CustomEvent("data-table:filter",{detail:{query:this.#h,count:this.#e.length},bubbles:!0}))}#B(){let e=document.createElement("nav");e.setAttribute("data-pagination",""),e.setAttribute("aria-label","Table pagination"),this.appendChild(e),this.#p=e}#I(){this.listen(this.#i,"click",this.#P)}#P=e=>{let t=e.target.closest('[data-action="toggle-expand"]');if(!t)return;let s=t.closest("tr[data-expandable]");if(!s)return;let n=s.hasAttribute("data-state-expanded"),i=s.nextElementSibling;n?(s.removeAttribute("data-state-expanded"),t.setAttribute("aria-expanded","false"),i?.hasAttribute("data-expand-content")&&(i.hidden=!0,i.setAttribute("aria-hidden","true"))):(s.setAttribute("data-state-expanded",""),t.setAttribute("aria-expanded","true"),i?.hasAttribute("data-expand-content")&&(i.hidden=!1,i.removeAttribute("aria-hidden"))),this.dispatchEvent(new CustomEvent("data-table:expand",{detail:{row:s,expanded:!n},bubbles:!0}))};#F(){this.#r=this.#i.querySelector('thead [data-action="select-all"]'),this.#r&&this.listen(this.#r,"change",this.#N),this.listen(this.#t,"change",this.#V),this.#m=this.querySelector("[data-selected-count]"),this.#C()}#N=e=>{let t=e.target.checked;this.#t.querySelectorAll("tr[data-selectable]").forEach(n=>{let i=n.querySelector('[data-action="select-row"]');t?(n.setAttribute("data-state-selected",""),i&&(i.checked=!0)):(n.removeAttribute("data-state-selected"),i&&(i.checked=!1))}),e.target.indeterminate=!1,this.#A(),this.#v()};#V=e=>{let t=e.target.closest('[data-action="select-row"]');if(!t)return;let s=t.closest("tr[data-selectable]");s&&(t.checked?s.setAttribute("data-state-selected",""):s.removeAttribute("data-state-selected"),this.#C(),this.#v())};#C(){if(!this.#r){this.#A();return}let e=this.#t.querySelectorAll("tr[data-selectable]"),t=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]"),s=e.length,n=t.length;n===0?(this.#r.checked=!1,this.#r.indeterminate=!1):n===s?(this.#r.checked=!0,this.#r.indeterminate=!1):(this.#r.checked=!1,this.#r.indeterminate=!0),this.#A()}#A(){let t=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]").length;this.#m&&(this.#m.textContent=t)}#v(){let e=[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")];this.dispatchEvent(new CustomEvent("data-table:selection",{detail:{count:e.length,rows:e},bubbles:!0}))}#D(){if(!this.#p||this.#n<=0)return;let e=this.#p,t=Math.ceil(this.#e.length/this.#n);if(e.innerHTML="",t<=1)return;let s=document.createElement("button");s.type="button",s.textContent="Previous",s.setAttribute("data-pagination-prev",""),s.disabled=this.#s===1,s.addEventListener("click",()=>this.goToPage(this.#s-1)),e.appendChild(s),this.#H(t).forEach(r=>{if(r==="..."){let a=document.createElement("span");a.textContent="...",a.setAttribute("data-pagination-ellipsis",""),e.appendChild(a)}else{let a=document.createElement("button");a.type="button",a.textContent=r,a.setAttribute("data-pagination-page",""),r===this.#s&&(a.setAttribute("aria-current","page"),a.setAttribute("data-current","")),a.addEventListener("click",()=>this.goToPage(r)),e.appendChild(a)}});let i=document.createElement("button");i.type="button",i.textContent="Next",i.setAttribute("data-pagination-next",""),i.disabled=this.#s===t,i.addEventListener("click",()=>this.goToPage(this.#s+1)),e.appendChild(i)}#H(e){let t=this.#s,s=[];if(e<=7)for(let n=1;n<=e;n++)s.push(n);else{s.push(1),t>3&&s.push("...");let n=Math.max(2,t-1),i=Math.min(e-1,t+1);for(let r=n;r<=i;r++)s.push(r);t<e-2&&s.push("..."),s.push(e)}return s}#u(){this.#a.forEach(t=>{t.setAttribute("data-state-hidden","")});let e;if(this.#n>0){let t=(this.#s-1)*this.#n,s=t+this.#n;e=this.#e.slice(t,s)}else e=this.#e;e.forEach(t=>{t.removeAttribute("data-state-hidden"),this.#t.appendChild(t);let s=t.nextElementSibling?.hasAttribute?.("data-expand-content")?t.nextElementSibling:this.#y(t);s&&this.#t.appendChild(s)}),this.#e.forEach(t=>{if(t.hasAttribute("data-state-hidden")){this.#t.appendChild(t);let s=this.#y(t);s&&this.#t.appendChild(s)}}),this.#a.forEach(t=>{if(!this.#e.includes(t)){this.#t.appendChild(t);let s=this.#y(t);s&&this.#t.appendChild(s)}}),this.#D()}#y(e){if(!e.hasAttribute("data-expandable"))return null;let t=e.nextElementSibling;return t?.hasAttribute("data-expand-content")?t:null}goToPage(e){let t=Math.ceil(this.#e.length/this.#n),s=Math.max(1,Math.min(e,t));s!==this.#s&&(this.#s=s,this.#u(),this.dispatchEvent(new CustomEvent("data-table:page",{detail:{page:this.#s},bubbles:!0})))}setFilter(e){this.#f&&(this.#f.value=e),this.#E(e)}refresh(){if(this.#a=[...this.#t.querySelectorAll(":scope > tr")],this.#h?this.#E(this.#h):this.#e=[...this.#a],this.#o>=0&&this.#c){let t=this.#l.find(s=>s.columnIndex===this.#o);t&&this.#g(this.#o,this.#c,t.sortType)}let e=Math.max(1,Math.ceil(this.#e.length/this.#n));this.#s>e&&(this.#s=e),this.#u()}get currentPage(){return this.#s}get totalPages(){return this.#n<=0?1:Math.ceil(this.#e.length/this.#n)}get filteredCount(){return this.#e.length}get totalCount(){return this.#a.length}getSelectedRows(){return this.#t?[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")]:[]}};b("data-table",f);export{f as DataTable};
1
+ var E=window.matchMedia("(prefers-reduced-motion: reduce)");var A=new Map;function w(h,e,t={}){let s=t.priority??10,i={impl:e,bundle:t.bundle,contract:t.contract,priority:s},n=A.get(h);if(customElements.get(h)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${n.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}A.set(h,i),customElements.define(h,e)}var m=class extends HTMLElement{#i=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#i)e();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,i){e.addEventListener(t,s,i),this.#i.push(()=>e.removeEventListener(t,s,i))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{t?s.add(e):s.delete(e)}catch{let i=`--${e}`;t?s.add(i):s.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};function x({newItems:h,nodes:e,keyOf:t,renderItem:s,containerFor:i}){let n=[],r=[],a=[],d=new Set;for(let l of h)d.add(t(l));for(let[l,o]of[...e])d.has(l)||(o.remove(),e.delete(l),a.push(l));let c=new Map;for(let l of h){let o=t(l),u=e.get(o)||null,f=i(l,u);c.has(f)||c.set(f,[]),c.get(f)?.push({item:l,key:o,existing:u})}for(let[l,o]of c)for(let u=0;u<o.length;u++){let{item:f,key:p,existing:v}=o[u],b=v;b?(b.parentElement!==l||l.children[u]!==b)&&r.push(p):(b=s(f),e.set(p,b),n.push(p));let y=l.children[u];y!==b&&l.insertBefore(b,y||null)}return{added:n,moved:r,removed:a}}var g=class h extends m{#i;#t;#c=[];#s=[];#e=[];#o=-1;#d=null;#n=1;#r=0;#p=null;#b=null;#h=null;#l="";#a=null;#x=null;#m=[];#v=new Map;#g=[];setup(){return this.#i=this.querySelector(":scope > table"),!this.#i||(this.#t=this.#i.querySelector("tbody"),!this.#t)?!1:(this.#F(),!0)}teardown(){this.#L(),this.#c=[],this.#s=[],this.#e=[]}#F(){this.#s=[...this.#t.querySelectorAll(":scope > tr:not([data-expand-content])")],this.#e=[...this.#s],this.#g=[...this.#i.tHead?.rows[0]?.cells||[]].map(t=>({key:t.getAttribute("data-key")||t.textContent.trim().toLowerCase(),label:t.textContent.trim(),sort:t.getAttribute("data-sort")||void 0})),this.#v.clear(),this.#m=[];for(let t of this.#s){let s=t.getAttribute("data-id")||t.getAttribute("data-key");s&&(this.#v.set(s,t),this.#m.push({id:s}))}this.#B(),this.#M(),this.#R(),this.#P(),this.#i.hasAttribute("data-filterable")&&this.#K();let e=this.#i.getAttribute("data-paginate");e&&(this.#r=parseInt(e,10),this.#r>0&&this.#j()),this.#z(),this.#G(),this.#f()}get rows(){return this.#m}set rows(e){let t=e||[],s=x({newItems:t,nodes:this.#v,keyOf:i=>i.id,renderItem:i=>this._renderRow(i),containerFor:()=>this.#t});this.#m=t,this.#s=[...this.#t.querySelectorAll(":scope > tr:not([data-expand-content])")],this.#M(),this.#R(),this.#w(this.#l),this.dispatchEvent(new CustomEvent("data-table:rows-changed",{detail:{rows:t,added:s.added,moved:s.moved,removed:s.removed,source:"api"},bubbles:!0}))}get columns(){return this.#g}_renderRow(e){let t=this;if(typeof t.renderRow=="function"){let i=t.renderRow(e,this.#g);if(!(i instanceof Element))throw new Error("data-table: renderRow must return an Element");return i.hasAttribute("data-id")||i.setAttribute("data-id",String(e.id)),i}let s=document.createElement("tr");s.setAttribute("data-id",String(e.id));for(let i of this.#g){let n=document.createElement("td"),r=e[i.key];n.textContent=r==null?"":String(r),s.appendChild(n)}return s}#k=[];#u=[];#y=[];#B(){let e=[...this.#i.tHead?.rows[0]?.cells||[]];this.#k=e.map(t=>{let s=parseFloat(t.getAttribute("data-weight"));return Number.isFinite(s)?s:null}),this.#u=e.map(t=>t.getAttribute("data-rollup")||null),this.#y=e.map(t=>t.getAttribute("data-heatmap")||null)}#M(){if(this.#u.some(Boolean))for(let e=0;e<this.#u.length;e++){let t=this.#u[e];if(t)for(let s of this.#s){let i=s.children[e];if(!i)continue;let n=this.#$(s,e,t),r=h.#N(n);i.textContent=r,i.setAttribute("data-rollup-value",String(n)),i.hasAttribute("data-sort-value")||i.setAttribute("data-sort-value",String(n))}}}#$(e,t,s){let i=[...e.children],n=0,r=0,a=-1/0,d=0,c=1,l=!1;for(let o=0;o<i.length;o++){if(o===t||this.#u[o])continue;let u=i[o].getAttribute("data-sort-value")??i[o].textContent??"",f=parseFloat(u);if(!Number.isFinite(f))continue;n+=f,r++,f>a&&(a=f),c*=f,l=!0;let p=this.#k[o];p!==null&&(d+=f*p)}switch(s){case"sum":return n;case"avg":return r?n/r:0;case"max":return a===-1/0?0:a;case"weighted-sum":return d;case"product":return l?c:0;default:return n}}static#N(e){return Number.isFinite(e)?Number.isInteger(e)?String(e):(Math.round(e*100)/100).toString():""}#R(){if(this.#y.some(Boolean))for(let e=0;e<this.#y.length;e++){let t=this.#y[e];if(!t)continue;let s=this.#s.map(d=>{let c=d.children[e];if(!c)return null;let l=c.getAttribute("data-rollup-value")??c.getAttribute("data-sort-value")??c.textContent??"",o=parseFloat(l);return Number.isFinite(o)?o:null}),i=s.filter(d=>d!==null);if(!i.length)continue;let n=Math.min(...i),a=Math.max(...i)-n||1;for(let d=0;d<this.#s.length;d++){let c=this.#s[d].children[e];if(!c)continue;let l=s[d];if(l===null){c.removeAttribute("data-heat-level");continue}let o=(l-n)/a;t==="low-good"&&(o=1-o);let u=o<.34?"low":o<.67?"mid":"high";c.setAttribute("data-heat-level",u)}}}#L(){this.#h&&clearTimeout(this.#h),this.#p?.parentElement?.remove(),this.#b?.remove()}#P(){this.#i.querySelectorAll("thead th[data-sort]").forEach((t,s)=>{let i=t.getAttribute("data-sort"),n=this.#V(t);this.#c.push({th:t,sortType:i,columnIndex:n}),t.setAttribute("tabindex","0"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t.dataset.columnIndex=n,this.listen(t,"click",this.#H),this.listen(t,"keydown",this.#D)})}#V(e){return[...e.parentElement.children].indexOf(e)}#H=e=>{let t=e.currentTarget,s=parseInt(t.dataset.columnIndex,10);this.#q(s)};#D=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();let t=e.currentTarget,s=parseInt(t.dataset.columnIndex,10);this.#q(s)}};#O(e,t,s){let i=this.#e;if(i.length<2)return!0;let n=s==="asc"?1:-1;for(let r=1;r<i.length;r++){let a=this.#A(i[r-1].children[e],t),d=this.#A(i[r].children[e],t);if((typeof a=="string"?a.localeCompare(d)*n:(a-d)*n)>0)return!1}return!0}#q(e){let t=this.#c.find(i=>i.columnIndex===e);if(!t)return;let s;this.#o===e?s=this.#d==="asc"?"desc":"asc":this.#O(e,t.sortType,"asc")?s="desc":s="asc",this.#c.forEach(({th:i})=>{i.setAttribute("aria-sort","none")}),t.th.setAttribute("aria-sort",s==="asc"?"ascending":"descending"),this.#o=e,this.#d=s,this.#E(e,s,t.sortType),this.#n=1,this.#f(),this.dispatchEvent(new CustomEvent("data-table:sort",{detail:{column:e,direction:s,columnName:t.th.textContent.trim()},bubbles:!0}))}#E(e,t,s){let i=t==="asc"?1:-1;this.#e.sort((n,r)=>{let a=n.children[e],d=r.children[e];if(!a||!d)return 0;let c=this.#A(a,s),l=this.#A(d,s),o=0;switch(s){case"number":o=c-l;break;case"date":o=c-l;break;default:o=c.localeCompare(l,void 0,{numeric:!0,sensitivity:"base"});break}return o*i})}#A(e,t){let i=e.getAttribute("data-sort-value")??e.textContent.trim();switch(t){case"number":return parseFloat(i)||0;case"date":return new Date(i).getTime()||0;default:return i.toLowerCase()}}#K(){let e=document.createElement("div");e.setAttribute("data-table-filter","");let t=document.createElement("input");t.type="search",t.setAttribute("data-filter-input",""),t.setAttribute("placeholder","Filter table..."),t.setAttribute("aria-label","Filter table rows"),e.appendChild(t),this.insertBefore(e,this.#i),this.#p=t,this.listen(t,"input",this.#_)}#_=e=>{let t=e.target.value;this.#h&&clearTimeout(this.#h),this.#h=setTimeout(()=>{this.#w(t)},150)};#w(e){if(this.#l=e.toLowerCase().trim(),this.#l===""?this.#e=[...this.#s]:this.#e=this.#s.filter(t=>[...t.children].some(i=>(i.getAttribute("data-filter-value")??i.textContent).toLowerCase().includes(this.#l))),this.#o>=0&&this.#d){let t=this.#c.find(s=>s.columnIndex===this.#o);t&&this.#E(this.#o,this.#d,t.sortType)}this.#n=1,this.#f(),this.dispatchEvent(new CustomEvent("data-table:filter",{detail:{query:this.#l,count:this.#e.length},bubbles:!0}))}#j(){let e=document.createElement("nav");e.setAttribute("data-pagination",""),e.setAttribute("aria-label","Table pagination"),this.appendChild(e),this.#b=e}#z(){this.listen(this.#i,"click",this.#Q)}#Q=e=>{let t=e.target.closest('[data-action="toggle-expand"]');if(!t)return;let s=t.closest("tr[data-expandable]");if(!s)return;let i=s.hasAttribute("data-state-expanded"),n=s.nextElementSibling;i?(s.removeAttribute("data-state-expanded"),t.setAttribute("aria-expanded","false"),n?.hasAttribute("data-expand-content")&&(n.hidden=!0,n.setAttribute("aria-hidden","true"))):(s.setAttribute("data-state-expanded",""),t.setAttribute("aria-expanded","true"),n?.hasAttribute("data-expand-content")&&(n.hidden=!1,n.removeAttribute("aria-hidden"))),this.dispatchEvent(new CustomEvent("data-table:expand",{detail:{row:s,expanded:!i},bubbles:!0}))};#G(){this.#a=this.#i.querySelector('thead [data-action="select-all"]'),this.#a&&this.listen(this.#a,"change",this.#J),this.listen(this.#t,"change",this.#U),this.#x=this.querySelector("[data-selected-count]"),this.#T()}#J=e=>{let t=e.target.checked;this.#t.querySelectorAll("tr[data-selectable]").forEach(i=>{let n=i.querySelector('[data-action="select-row"]');t?(i.setAttribute("data-state-selected",""),n&&(n.checked=!0)):(i.removeAttribute("data-state-selected"),n&&(n.checked=!1))}),e.target.indeterminate=!1,this.#C(),this.#I()};#U=e=>{let t=e.target.closest('[data-action="select-row"]');if(!t)return;let s=t.closest("tr[data-selectable]");s&&(t.checked?s.setAttribute("data-state-selected",""):s.removeAttribute("data-state-selected"),this.#T(),this.#I())};#T(){if(!this.#a){this.#C();return}let e=this.#t.querySelectorAll("tr[data-selectable]"),t=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]"),s=e.length,i=t.length;i===0?(this.#a.checked=!1,this.#a.indeterminate=!1):i===s?(this.#a.checked=!0,this.#a.indeterminate=!1):(this.#a.checked=!1,this.#a.indeterminate=!0),this.#C()}#C(){let t=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]").length;this.#x&&(this.#x.textContent=t)}#I(){let e=[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")];this.dispatchEvent(new CustomEvent("data-table:selection",{detail:{count:e.length,rows:e},bubbles:!0}))}#W(){if(!this.#b||this.#r<=0)return;let e=this.#b,t=Math.ceil(this.#e.length/this.#r);if(e.innerHTML="",t<=1)return;let s=document.createElement("button");s.type="button",s.textContent="Previous",s.setAttribute("data-pagination-prev",""),s.disabled=this.#n===1,s.addEventListener("click",()=>this.goToPage(this.#n-1)),e.appendChild(s),this.#X(t).forEach(r=>{if(r==="..."){let a=document.createElement("span");a.textContent="...",a.setAttribute("data-pagination-ellipsis",""),e.appendChild(a)}else{let a=document.createElement("button");a.type="button",a.textContent=r,a.setAttribute("data-pagination-page",""),r===this.#n&&(a.setAttribute("aria-current","page"),a.setAttribute("data-current","")),a.addEventListener("click",()=>this.goToPage(r)),e.appendChild(a)}});let n=document.createElement("button");n.type="button",n.textContent="Next",n.setAttribute("data-pagination-next",""),n.disabled=this.#n===t,n.addEventListener("click",()=>this.goToPage(this.#n+1)),e.appendChild(n)}#X(e){let t=this.#n,s=[];if(e<=7)for(let i=1;i<=e;i++)s.push(i);else{s.push(1),t>3&&s.push("...");let i=Math.max(2,t-1),n=Math.min(e-1,t+1);for(let r=i;r<=n;r++)s.push(r);t<e-2&&s.push("..."),s.push(e)}return s}#f(){this.#s.forEach(t=>{t.setAttribute("data-state-hidden","")});let e;if(this.#r>0){let t=(this.#n-1)*this.#r,s=t+this.#r;e=this.#e.slice(t,s)}else e=this.#e;e.forEach(t=>{t.removeAttribute("data-state-hidden"),this.#t.appendChild(t);let s=t.nextElementSibling?.hasAttribute?.("data-expand-content")?t.nextElementSibling:this.#S(t);s&&this.#t.appendChild(s)}),this.#e.forEach(t=>{if(t.hasAttribute("data-state-hidden")){this.#t.appendChild(t);let s=this.#S(t);s&&this.#t.appendChild(s)}}),this.#s.forEach(t=>{if(!this.#e.includes(t)){this.#t.appendChild(t);let s=this.#S(t);s&&this.#t.appendChild(s)}}),this.#W()}#S(e){if(!e.hasAttribute("data-expandable"))return null;let t=e.nextElementSibling;return t?.hasAttribute("data-expand-content")?t:null}goToPage(e){let t=Math.ceil(this.#e.length/this.#r),s=Math.max(1,Math.min(e,t));s!==this.#n&&(this.#n=s,this.#f(),this.dispatchEvent(new CustomEvent("data-table:page",{detail:{page:this.#n},bubbles:!0})))}setFilter(e){this.#p&&(this.#p.value=e),this.#w(e)}refresh(){if(this.#s=[...this.#t.querySelectorAll(":scope > tr")],this.#l?this.#w(this.#l):this.#e=[...this.#s],this.#o>=0&&this.#d){let t=this.#c.find(s=>s.columnIndex===this.#o);t&&this.#E(this.#o,this.#d,t.sortType)}let e=Math.max(1,Math.ceil(this.#e.length/this.#r));this.#n>e&&(this.#n=e),this.#f()}get currentPage(){return this.#n}get totalPages(){return this.#r<=0?1:Math.ceil(this.#e.length/this.#r)}get filteredCount(){return this.#e.length}get totalCount(){return this.#s.length}getSelectedRows(){return this.#t?[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")]:[]}};w("data-table",g);export{g as DataTable};
2
2
  //# sourceMappingURL=data-table.js.map