vanilla-breeze 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -4
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/audio-player.js +2 -2
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/comment-box.js +16 -16
- package/dist/cdn/components/comment-thread.js +20 -20
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/diagram-wc.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/manifest.json +44 -20
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/score-card.js +2 -2
- package/dist/cdn/components/settings-panel.js +15 -15
- package/dist/cdn/components/site-search.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/theme-picker.js +45 -45
- package/dist/cdn/components/time-index.js +2 -2
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/version-switcher.js +1 -1
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/journal.effects.css +1 -1
- package/dist/cdn/packs/journal.full.css +1 -1
- package/dist/cdn/packs/kawaii.effects.css +1 -1
- package/dist/cdn/packs/kawaii.full.css +2 -2
- package/dist/cdn/packs/kawaii.full.js +4 -4
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +11 -11
- package/dist/cdn/packs/memphis.full.css +1 -1
- package/dist/cdn/packs/memphis.theme.css +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +52 -52
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +4 -4
- package/dist/cdn/themes/alpha1999-dark.tokens.json +4 -4
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +4 -4
- package/dist/cdn/themes/anthropic.css +1 -1
- package/dist/cdn/themes/anthropic.tokens.json +4 -4
- package/dist/cdn/themes/art-deco-dark.tokens.json +4 -4
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +4 -4
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +4 -4
- package/dist/cdn/themes/brutalist-dark.tokens.json +4 -4
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +4 -4
- package/dist/cdn/themes/catalog/atlassian.tokens.json +2 -2
- package/dist/cdn/themes/catalog/bootstrap.tokens.json +2 -2
- package/dist/cdn/themes/catalog/carbon.tokens.json +2 -2
- package/dist/cdn/themes/catalog/catppuccin-mocha.tokens.json +2 -2
- package/dist/cdn/themes/catalog/govuk.tokens.json +2 -2
- package/dist/cdn/themes/catalog/manifest.json +1 -1
- package/dist/cdn/themes/catalog/material.tokens.json +2 -2
- package/dist/cdn/themes/catalog/salesforce.tokens.json +2 -2
- package/dist/cdn/themes/catalog/tailwind.tokens.json +2 -2
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +4 -4
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +4 -4
- package/dist/cdn/themes/classic-dark.tokens.json +4 -4
- package/dist/cdn/themes/classic.css +1 -1
- package/dist/cdn/themes/classic.tokens.json +4 -4
- package/dist/cdn/themes/claymorphism-dark.tokens.json +10 -10
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +10 -10
- package/dist/cdn/themes/clinical-dark.tokens.json +4 -4
- package/dist/cdn/themes/clinical.css +1 -1
- package/dist/cdn/themes/clinical.tokens.json +4 -4
- package/dist/cdn/themes/cottagecore-dark.tokens.json +4 -4
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +4 -4
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +4 -5
- package/dist/cdn/themes/dawn-dark.tokens.json +4 -4
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +4 -4
- package/dist/cdn/themes/dracula.css +1 -1
- package/dist/cdn/themes/dracula.tokens.json +4 -4
- package/dist/cdn/themes/dusk.css +1 -1
- package/dist/cdn/themes/dusk.tokens.json +4 -4
- package/dist/cdn/themes/editorial-dark.tokens.json +3 -3
- package/dist/cdn/themes/editorial.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +4 -4
- package/dist/cdn/themes/financial-dark.tokens.json +4 -4
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +4 -4
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +4 -4
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +4 -4
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +4 -4
- package/dist/cdn/themes/government-dark.tokens.json +4 -4
- package/dist/cdn/themes/government.css +1 -1
- package/dist/cdn/themes/government.tokens.json +4 -4
- package/dist/cdn/themes/gruvbox-dark.tokens.json +4 -4
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +4 -4
- package/dist/cdn/themes/high-noon-dark.tokens.json +4 -4
- package/dist/cdn/themes/high-noon.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +4 -4
- package/dist/cdn/themes/ibm.css +1 -1
- package/dist/cdn/themes/ibm.tokens.json +6 -6
- package/dist/cdn/themes/journal-dark.tokens.json +4 -4
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +4 -4
- package/dist/cdn/themes/kawaii-dark.tokens.json +4 -4
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +4 -4
- package/dist/cdn/themes/magna-dark.tokens.json +4 -4
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +4 -4
- package/dist/cdn/themes/manifest.json +48 -48
- package/dist/cdn/themes/mcdonalds.css +1 -1
- package/dist/cdn/themes/mcdonalds.tokens.json +4 -4
- package/dist/cdn/themes/midnight.css +1 -1
- package/dist/cdn/themes/midnight.tokens.json +4 -4
- package/dist/cdn/themes/minimal-dark.tokens.json +4 -4
- package/dist/cdn/themes/minimal.css +1 -1
- package/dist/cdn/themes/minimal.tokens.json +4 -4
- package/dist/cdn/themes/modern-dark.tokens.json +4 -4
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +4 -4
- package/dist/cdn/themes/nes-dark.tokens.json +4 -4
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +4 -4
- package/dist/cdn/themes/neumorphism-dark.tokens.json +10 -10
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +10 -10
- package/dist/cdn/themes/nord-dark.tokens.json +4 -4
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +4 -4
- package/dist/cdn/themes/organic-dark.tokens.json +4 -4
- package/dist/cdn/themes/organic.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +4 -4
- package/dist/cdn/themes/rose-pine-dark.tokens.json +4 -4
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +4 -4
- package/dist/cdn/themes/rough-dark.tokens.json +4 -5
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +5 -6
- package/dist/cdn/themes/solarized-dark.tokens.json +4 -4
- package/dist/cdn/themes/solarized.css +1 -1
- package/dist/cdn/themes/solarized.tokens.json +4 -4
- package/dist/cdn/themes/starbucks.css +1 -1
- package/dist/cdn/themes/starbucks.tokens.json +4 -4
- package/dist/cdn/themes/startup-dark.tokens.json +4 -4
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +4 -4
- package/dist/cdn/themes/super2026-dark.tokens.json +4 -4
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +4 -4
- package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
- package/dist/cdn/themes/swiss.css +1 -1
- package/dist/cdn/themes/swiss.tokens.json +4 -4
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +4 -4
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +4 -4
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +4 -4
- package/dist/cdn/themes/vaporwave-dark.tokens.json +4 -4
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +4 -4
- package/dist/cdn/themes/win9x-dark.tokens.json +4 -4
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/themes/win9x.tokens.json +4 -4
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +62 -62
- package/dist/cdn/vanilla-breeze-dev.css +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +19 -19
- package/dist/cdn/vanilla-breeze-labs.css +1 -1
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +170 -170
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
A layered HTML component system extending HTML's native model. Build accessible, themeable interfaces with semantic HTML, CSS cascade layers, and progressive enhancement — no build step required.
|
|
4
4
|
|
|
5
|
+
Docs, interactive demos, and examples: **[vanilla-breeze.com](https://vanilla-breeze.com/)**
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- **Zero-class styling** — native HTML elements styled through cascade layers, not utility classes
|
|
8
10
|
- **Layout attributes** — responsive layouts via `data-layout="stack | cluster | sidebar | grid"` instead of wrapper divs
|
|
9
|
-
- **
|
|
11
|
+
- **90+ web components** — accordion, tabs, carousel, data-table, command-palette, combo-box, toast, tooltip, drag-surface, and more
|
|
10
12
|
- **Design tokens** — spacing, typography, colors, sizing, borders, shadows, motion
|
|
11
|
-
- **Theme engine** —
|
|
13
|
+
- **Theme engine** — 50+ themes as tiny à-la-carte token files (1–4 KB each), plus dark/light mode; only core themes ship in the main bundle
|
|
12
14
|
- **Progressive enhancement** — everything works without JavaScript; JS adds interactivity
|
|
13
15
|
|
|
14
16
|
## Quick Start
|
|
@@ -31,6 +33,19 @@ import 'vanilla-breeze';
|
|
|
31
33
|
import 'vanilla-breeze/css';
|
|
32
34
|
```
|
|
33
35
|
|
|
36
|
+
Smaller entry points are exported too: `vanilla-breeze/core-js` + `vanilla-breeze/core-css` for the foundation only, and `vanilla-breeze/ui-js`, `effects-js`, `icons-js`, and friends for individual packs. See the `exports` map in `package.json`.
|
|
37
|
+
|
|
38
|
+
### Themes
|
|
39
|
+
|
|
40
|
+
The main bundle includes only the core themes. Decorative themes are standalone token files — add one line and set `data-theme`:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<link rel="stylesheet" href="https://unpkg.com/vanilla-breeze/dist/cdn/themes/nord.css">
|
|
44
|
+
<html data-theme="nord">
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or via npm: `import 'vanilla-breeze/themes/nord';`. Runtime switching (`<theme-picker>`, `ThemeManager`) fetches theme CSS automatically on first use.
|
|
48
|
+
|
|
34
49
|
## Usage
|
|
35
50
|
|
|
36
51
|
```html
|
|
@@ -58,9 +73,23 @@ import 'vanilla-breeze/css';
|
|
|
58
73
|
|
|
59
74
|
No classes needed — elements are styled through cascade layers.
|
|
60
75
|
|
|
61
|
-
##
|
|
76
|
+
## Companion packs
|
|
77
|
+
|
|
78
|
+
Two component families ship as separate packages that read Vanilla Breeze tokens and adopt the active theme automatically:
|
|
79
|
+
|
|
80
|
+
- [`@profpowell/vb-design-system`](https://www.npmjs.com/package/@profpowell/vb-design-system) — specimens, palette and gradient builders, font pairing, theme catalog/import/export
|
|
81
|
+
- [`@profpowell/vb-project-planning`](https://www.npmjs.com/package/@profpowell/vb-project-planning) — kanban, gantt, roadmap, story map, personas, risk register, and other planning surfaces
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm install
|
|
87
|
+
npm run build # CDN bundles + doc site into site/dist/pages
|
|
88
|
+
npm test # unit tests
|
|
89
|
+
npm run conformance
|
|
90
|
+
```
|
|
62
91
|
|
|
63
|
-
|
|
92
|
+
The doc site is built with Cook SSG and deployed to Cloudflare Pages from this repo. See `admin/reference/build-and-deploy.md` for the full pipeline and [CHANGELOG.md](CHANGELOG.md) for release notes.
|
|
64
93
|
|
|
65
94
|
## License
|
|
66
95
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function p(r,t,i={}){let e=i.priority??10,a={impl:t,bundle:i.bundle,contract:i.contract,priority:e},n=m.get(r);if(customElements.get(r)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}m.set(r,a),customElements.define(r,t)}var d=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,a){t.addEventListener(i,e,a),this.#e.push(()=>t.removeEventListener(i,e,a))}setup(){}teardown(){}setState(t,i){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{i?e.add(t):e.delete(t)}catch{let a=`--${t}`;i?e.add(a):e.delete(a)}}_adoptInternals(t){this.#t||(this.#t=t)}};function l(r){let t=(Date.now()-r.getTime())/1e3;if(t<0)return null;if(t<60)return"just now";if(t<3600){let e=Math.floor(t/60);return`${e} minute${e!==1?"s":""} ago`}if(t<86400){let e=Math.floor(t/3600);return`${e} hour${e!==1?"s":""} ago`}if(t<2592e3){let e=Math.floor(t/86400);return`${e} day${e!==1?"s":""} ago`}if(t<31536e3){let e=Math.floor(t/2592e3);return`${e} month${e!==1?"s":""} ago`}let i=Math.floor(t/31536e3);return`${i} year${i!==1?"s":""} ago`}function b(r=document){for(let t of r.querySelectorAll("time[data-relative]")){let i=t.getAttribute("datetime");if(!i)continue;let e=l(new Date(i));e&&(t.textContent=e)}}var u=typeof document<"u"?document.documentElement:null,v;function y(){b(),v||(v=setInterval(()=>b(),6e4))}u&&!u.hasAttribute("data-vb-time-relative-init")&&(u.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y,{once:!0}):y());function h(r){let t=new Date(r);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function g(r){let t=new Date(r),i=(t.getDay()+6)%7,e=new Date(t);e.setDate(t.getDate()-i);let a=new Date(e);a.setDate(e.getDate()+3);let n=new Date(a.getFullYear(),0,1),s=Math.ceil(((a.getTime()-n.getTime())/864e5+1)/7);return`${a.getFullYear()}-W${String(s).padStart(2,"0")}`}function E(r){let t=h(new Date),i=h(new Date(Date.now()-864e5));if(r===t)return"Today";if(r===i)return"Yesterday";let[e,a,n]=r.split("-").map(Number);return new Date(e,a-1,n).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function w(r){return`Week of ${r.replace("-W",", week ")}`}var f=class extends d{#e=null;#t=null;#a=null;#r=null;#i=null;setup(){return this.hasAttribute("role")||this.setAttribute("role","feed"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Recent activity"),this.setAttribute("aria-busy","false"),this.#n().forEach(t=>this.#s(t)),this.#o(),this.#c(),this.#e=new MutationObserver(t=>{let i=!1;for(let e of t){for(let a of e.addedNodes){let n=a;a.nodeType===1&&n.matches?.("article[data-activity]")&&(this.#s(n),i=!0)}e.removedNodes.length&&(i=!0)}i&&(this.#o(),this.#c())}),this.#e.observe(this,{childList:!0}),this.#r=setInterval(()=>this.#d(),6e4),this.hasAttribute("data-infinite")&&this.#h(),this.listen(this,"keydown",this.#u),!0}teardown(){this.#r!==null&&clearInterval(this.#r),this.#e?.disconnect(),this.#a?.disconnect()}#n(){return[...this.querySelectorAll(":scope > article[data-activity]")]}#s(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.setAttribute("tabindex","-1");let i=document.createElement("div");for(i.className="activity-body";t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i);let e=t.dataset.activityAvatar,a=t.dataset.activityIcon;if(e||a){let s=document.createElement("div");if(s.className="activity-rail",s.setAttribute("aria-hidden","true"),e){let o=document.createElement("user-avatar");o.setAttribute("src",e);let c=i.querySelector("[data-activity-actor]")?.textContent||"";c&&o.setAttribute("name",c),s.appendChild(o)}else{let o=document.createElement("icon-wc");o.setAttribute("name",a),s.appendChild(o)}t.prepend(s)}let n=t.dataset.time;if(n){let s=document.createElement("time");s.className="activity-time",s.setAttribute("datetime",n),s.setAttribute("title",this.#l(n)),s.textContent=l(new Date(n))||n,t.appendChild(s)}}#d(){for(let t of this.querySelectorAll(":scope > article[data-activity] > time.activity-time")){let i=t.getAttribute("datetime");if(!i)continue;let e=l(new Date(i));e&&(t.textContent=e)}}#l(t){try{return new Date(t).toLocaleString()}catch{return t}}#o(){this.querySelectorAll(":scope > [data-activity-heading]").forEach(n=>n.remove());let t=this.#n(),i=t.length,e=this.getAttribute("data-group")||"none",a=null;t.forEach((n,s)=>{if(n.setAttribute("aria-posinset",String(s+1)),n.setAttribute("aria-setsize",String(i)),e!=="none"&&n.dataset.time){let o=e==="week"?g(n.dataset.time):h(n.dataset.time);if(o!==a){let c=document.createElement("h3");c.setAttribute("data-activity-heading",""),c.setAttribute("role","heading"),c.setAttribute("aria-level","3"),c.className="activity-heading",c.textContent=e==="week"?w(o):E(o),this.insertBefore(c,n),a=o}}})}#c(){this.#n().length===0?this.#i||(this.#i=document.createElement("p"),this.#i.className="activity-empty",this.#i.textContent=this.getAttribute("data-empty-text")||"No recent activity",this.appendChild(this.#i)):(this.#i?.remove(),this.#i=null)}#u=t=>{let i=this.#n(),e=document.activeElement,a=e?i.indexOf(e):-1;if(a===-1)return;let n=a;switch(t.key){case"ArrowDown":t.preventDefault(),n=Math.min(i.length-1,a+1);break;case"ArrowUp":t.preventDefault(),n=Math.max(0,a-1);break;case"PageDown":t.preventDefault(),n=Math.min(i.length-1,a+5);break;case"PageUp":t.preventDefault(),n=Math.max(0,a-5);break;case"Home":t.preventDefault(),n=0;break;case"End":t.preventDefault(),n=i.length-1;break;default:return}i[n]?.focus()};#h(){"IntersectionObserver"in window&&(this.#t=document.createElement("div"),this.#t.className="activity-sentinel",this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t),this.#a=new IntersectionObserver(t=>{for(let i of t)i.isIntersecting&&this.dispatchEvent(new CustomEvent("activity-feed:load-more",{bubbles:!0}))},{rootMargin:"200px"}),this.#a.observe(this.#t))}addEntry(t,i={}){let e=document.createElement("article");if(e.setAttribute("data-activity",""),e.dataset.time=t.time,t.avatar&&(e.dataset.activityAvatar=t.avatar),t.icon&&(e.dataset.activityIcon=t.icon),e.innerHTML=t.html,i.prepend){let a=this.#n()[0];a?this.insertBefore(e,a):this.appendChild(e)}else this.#t?this.insertBefore(e,this.#t):this.appendChild(e);return e}removeEntry(t){t?.matches?.("article[data-activity]")&&t.remove()}clear(){this.#n().forEach(t=>t.remove())}get entries(){return this.#n()}};p("activity-feed",f);export{f as ActivityFeed};
|
|
2
2
|
//# sourceMappingURL=activity-feed.js.map
|
|
@@ -189,7 +189,7 @@ var c=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;functi
|
|
|
189
189
|
border-radius: var(--radius-full, 50%);
|
|
190
190
|
background: var(--_accent);
|
|
191
191
|
border: var(--border-width-medium, 2px) solid var(--_bg);
|
|
192
|
-
box-shadow: var(--shadow-
|
|
192
|
+
box-shadow: var(--shadow-s, 0 1px 3px oklch(0% 0 0 / 0.2));
|
|
193
193
|
cursor: pointer;
|
|
194
194
|
margin-top: -4px;
|
|
195
195
|
transition: transform var(--duration-fast, 100ms) var(--ease-default, ease);
|
|
@@ -205,7 +205,7 @@ var c=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;functi
|
|
|
205
205
|
border-radius: var(--radius-full, 50%);
|
|
206
206
|
background: var(--_accent);
|
|
207
207
|
border: var(--border-width-medium, 2px) solid var(--_bg);
|
|
208
|
-
box-shadow: var(--shadow-
|
|
208
|
+
box-shadow: var(--shadow-s, 0 1px 3px oklch(0% 0 0 / 0.2));
|
|
209
209
|
cursor: pointer;
|
|
210
210
|
}
|
|
211
211
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var B=Object.defineProperty;var F=(t,e)=>()=>(t&&(e=t(t=0)),e);var X=(t,e)=>{for(var s in e)B(t,s,{get:e[s],enumerable:!0})};var N={};X(N,{addDialogDismiss:()=>S,addFlickListener:()=>T,addLongPress:()=>P,addPullToRefresh:()=>O,addSwipeListener:()=>D,haptic:()=>L,initGestures:()=>I,makeSwipeable:()=>$});function D(t,e={}){let s=e.threshold??50,r=e.restraint??100,n=e.timeout??300,i=e.velocity??.5,o=e.minFlickDistance??10,a,u,h;function f(l){l.isPrimary&&(a=l.clientX,u=l.clientY,h=Date.now())}function p(l){if(!l.isPrimary)return;let v=l.clientX-a,m=l.clientY-u,c=Date.now()-h;if(c>n)return;let d=Math.abs(v),b=Math.abs(m),E=Math.max(d,b),y=c>0?E/c:0,g=y>=i&&E>=o,w;if((d>=s||g&&d>b)&&b<=r?w=v<0?"left":"right":(b>=s||g&&b>d)&&d<=r&&(w=m<0?"up":"down"),w){let q=w==="left"||w==="right"?d:b;t.dispatchEvent(new CustomEvent(`swipe-${w}`,{bubbles:!0,detail:{distance:q,duration:c,velocity:y,flick:g}}))}}return t.addEventListener("pointerdown",f,{passive:!0}),t.addEventListener("pointerup",p,{passive:!0}),()=>{t.removeEventListener("pointerdown",f),t.removeEventListener("pointerup",p)}}function T(t,e={}){let s=e.minDistance??10,r=e.velocity??.6,n=e.timeout??250,i=e.restraint??80,o,a,u;function h(p){p.isPrimary&&(o=p.clientX,a=p.clientY,u=Date.now())}function f(p){if(!p.isPrimary)return;let l=p.clientX-o,v=p.clientY-a,m=Date.now()-u;if(m===0||m>n)return;let c=Math.abs(l),d=Math.abs(v),b=Math.max(c,d);if(b<s)return;let E=b/m;if(E<r)return;let y;if(c>d&&d<=i?y=l<0?"left":"right":d>c&&c<=i&&(y=v<0?"up":"down"),y){let g=y==="left"||y==="right"?c:d;t.dispatchEvent(new CustomEvent(`swipe-${y}`,{bubbles:!0,detail:{distance:g,duration:m,velocity:E,flick:!0}}))}}return t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointerup",f,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointerup",f)}}function $(t,e={}){let s=e.threshold??100,r=e.direction??"horizontal",n=e.removeOnDismiss??!0,i=r==="horizontal",o=0,a=0,u=!1;function h(c){!c.isPrimary||t.hasAttribute("data-dismissed")||(c.preventDefault(),u=!0,o=i?c.clientX:c.clientY,a=0,t.setPointerCapture(c.pointerId),t.setAttribute("data-swiping",""))}function f(c){if(!u||!c.isPrimary)return;a=(i?c.clientX:c.clientY)-o;let b=1-Math.min(Math.abs(a)/s,1)*.5;i?t.style.transform=`translateX(${a}px)`:t.style.transform=`translateY(${a}px)`,t.style.opacity=String(b)}function p(c){!u||!c.isPrimary||(u=!1,t.releasePointerCapture(c.pointerId),t.removeAttribute("data-swiping"),Math.abs(a)>=s?v(a>0?"right":"left"):m())}function l(c){!u||!c.isPrimary||(u=!1,t.releasePointerCapture(c.pointerId),t.removeAttribute("data-swiping"),m())}function v(c){let d=c==="right"?"100%":"-100%";t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform=i?`translateX(${d})`:`translateY(${d})`,t.style.opacity="0",t.setAttribute("data-dismissed",""),L.dismiss(),t.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:c,distance:Math.abs(a)}})),n&&t.addEventListener("transitionend",()=>t.remove(),{once:!0})}function m(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",h),t.addEventListener("pointermove",f),t.addEventListener("pointerup",p),t.addEventListener("pointercancel",l),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointermove",f),t.removeEventListener("pointerup",p),t.removeEventListener("pointercancel",l)}}function O(t,e,s={}){let r=s.threshold??70,n=s.maxPull??120,i=document.createElement("div");i.setAttribute("data-pull-indicator",""),i.setAttribute("aria-hidden","true");let o=document.createElement("div");o.setAttribute("data-pull-spinner",""),i.appendChild(o),t.prepend(i);let a=0,u=!1,h=!1;function f(d){!d.isPrimary||h||t.scrollTop<=0&&(a=d.clientY,u=!0)}function p(d){if(!u||!d.isPrimary||h)return;let b=d.clientY-a;if(b<=0){i.style.transform="",i.style.opacity="";return}let E=Math.min(b,n),y=E/r;i.style.transform=`translateY(${E}px)`,i.style.opacity=String(Math.min(y,1)),y>=1?i.setAttribute("data-pull-ready",""):i.removeAttribute("data-pull-ready")}function l(d){!u||!d.isPrimary||(u=!1,i.hasAttribute("data-pull-ready")&&!h?m():c())}function v(d){!u||!d.isPrimary||(u=!1,c())}async function m(){h=!0,i.removeAttribute("data-pull-ready"),i.setAttribute("data-pull-loading",""),i.style.transform=`translateY(${r}px)`,i.style.opacity="1";try{await e()}finally{h=!1,i.removeAttribute("data-pull-loading"),c()}}function c(){i.style.transition="transform 0.3s ease, opacity 0.3s ease",i.style.transform="",i.style.opacity="",i.removeAttribute("data-pull-ready"),i.addEventListener("transitionend",()=>{i.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",f,{passive:!0}),t.addEventListener("pointermove",p,{passive:!0}),t.addEventListener("pointerup",l,{passive:!0}),t.addEventListener("pointercancel",v,{passive:!0}),()=>{t.removeEventListener("pointerdown",f),t.removeEventListener("pointermove",p),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",v),i.remove()}}function P(t,e,s={}){let r=s.duration??500,n=s.hapticFeedback??!0,i=s.blockContextMenu??!0,o=null;function a(f){f.isPrimary&&(o=setTimeout(()=>{n&&L.tap(),e(f),o=null},r))}function u(){o&&(clearTimeout(o),o=null)}function h(f){i&&f.preventDefault()}return t.addEventListener("pointerdown",a,{passive:!0}),t.addEventListener("pointermove",u,{passive:!0}),t.addEventListener("pointerup",u,{passive:!0}),t.addEventListener("pointercancel",u,{passive:!0}),t.addEventListener("contextmenu",h),()=>{u(),t.removeEventListener("pointerdown",a),t.removeEventListener("pointermove",u),t.removeEventListener("pointerup",u),t.removeEventListener("pointercancel",u),t.removeEventListener("contextmenu",h)}}function S(t,e={}){let s=e.threshold??80,r=0,n=0,i=!1;function o(l){if(!l.isPrimary||!t.open)return;let v=l.target;v.closest("a, button, input, select, textarea, [contenteditable]")&&!v.closest("header")||(i=!0,r=l.clientY,n=0,t.setPointerCapture(l.pointerId),t.style.transition="none")}function a(l){if(!i||!l.isPrimary)return;if(n=l.clientY-r,n<=0){t.style.transform="",t.style.opacity="";return}let m=1-Math.min(n/s,1)*.4;t.style.transform=`translateY(${n}px)`,t.style.opacity=String(m)}function u(l){!i||!l.isPrimary||(i=!1,t.releasePointerCapture(l.pointerId),n>=s?f():p())}function h(l){!i||!l.isPrimary||(i=!1,t.releasePointerCapture(l.pointerId),p())}function f(){t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform="translateY(100%)",t.style.opacity="0",L.dismiss(),t.addEventListener("transitionend",()=>{t.style.transition="",t.style.transform="",t.style.opacity="",t.close("dismiss")},{once:!0})}function p(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",o),t.addEventListener("pointermove",a),t.addEventListener("pointerup",u),t.addEventListener("pointercancel",h),()=>{t.removeEventListener("pointerdown",o),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",u),t.removeEventListener("pointercancel",h)}}function I(t=document){let e=[];for(let s of t.querySelectorAll('[data-gesture="swipe"]'))e.push(D(s));for(let s of t.querySelectorAll('[data-gesture="flick"]'))e.push(T(s));for(let s of t.querySelectorAll('[data-gesture="dismiss"]'))e.push($(s));for(let s of t.querySelectorAll('[data-gesture="long-press"]'))e.push(P(s,()=>{s.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let s of t.querySelectorAll('dialog[data-gesture="dismiss-down"]'))e.push(S(s));return()=>e.forEach(s=>s())}var L,Y=F(()=>{L={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};I()});var V=window.matchMedia("(prefers-reduced-motion: reduce)");var k=new Map;function M(t,e,s={}){let r=s.priority??10,n={impl:e,bundle:s.bundle,contract:s.contract,priority:r},i=k.get(t);if(customElements.get(t)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}k.set(t,n),customElements.define(t,e)}var A=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,r,n){e.addEventListener(s,r,n),this.#e.push(()=>e.removeEventListener(s,r,n))}setup(){}teardown(){}setState(e,s){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{s?r.add(e):r.delete(e)}catch{let n=`--${e}`;s?r.add(n):r.delete(n)}}_adoptInternals(e){this.#t||(this.#t=e)}};function C(t){return document.startViewTransition?document.startViewTransition(t):t()}var H=0,x=class extends A{#e;#t=[];#s;#r;#n;#a;#u;#c=null;#i=0;#l=!1;#o=!1;#d=null;get currentIndex(){return this.#i}get slideCount(){return this.#t.length}get playing(){return this.#c!==null}setup(){let e=[...this.children];if(e.length===0)return!1;if(this.#l=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.#o=this.hasAttribute("transition")&&!!document.startViewTransition,this.hasAttribute("transition")&&!this.#o&&this.removeAttribute("transition"),this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Carousel"),this.#e=document.createElement("div"),this.#e.className="carousel-track",this.#e.setAttribute("tabindex","0"),this.#e.setAttribute("aria-label","Slides"),e.forEach((i,o)=>{i.setAttribute("role","group"),i.setAttribute("aria-roledescription","slide"),i.setAttribute("aria-label",`${o+1} of ${e.length}`),this.#e.appendChild(i)}),this.#t=[...this.#e.children],this.#s=document.createElement("button"),this.#s.className="carousel-prev",this.#s.setAttribute("aria-label","Previous slide"),this.#s.innerHTML='<icon-wc name="chevron-left" size="sm"></icon-wc>',this.#r=document.createElement("button"),this.#r.className="carousel-next",this.#r.setAttribute("aria-label","Next slide"),this.#r.innerHTML='<icon-wc name="chevron-right" size="sm"></icon-wc>',this.getAttribute("indicators")!=="false"&&(this.#n=document.createElement("div"),this.#n.className="carousel-indicators",this.#n.setAttribute("aria-label","Slide indicators"),this.#t.forEach((i,o)=>{let a=document.createElement("button");a.className="carousel-dot",a.setAttribute("aria-label",`Go to slide ${o+1}`),a.setAttribute("aria-current",o===0?"true":"false"),this.listen(a,"click",()=>this.goTo(o)),this.#n.appendChild(a)})),this.#a=document.createElement("div"),this.#a.className="carousel-live",this.#a.setAttribute("aria-live","polite"),this.#a.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.appendChild(this.#e),this.appendChild(this.#r),this.#n&&this.appendChild(this.#n),this.appendChild(this.#a),this.listen(this.#s,"click",()=>this.prev()),this.listen(this.#r,"click",()=>this.next()),this.listen(this.#e,"keydown",this.#m),this.#o){let i=++H,o=this.getAttribute("transition")||"fade",a=o==="slide"?"vt-carousel-slide":o==="scale"?"vt-carousel-scale":"vt-carousel";this.#e.style.viewTransitionName=`carousel-${i}`,this.#e.style.viewTransitionClass=a}this.#o&&Promise.resolve().then(()=>(Y(),N)).then(({addSwipeListener:i})=>{this.#d=i(this.#e,{threshold:40}),this.listen(this.#e,"swipe-left",()=>this.next()),this.listen(this.#e,"swipe-right",()=>this.prev())}),this.#o||(this.#u=new IntersectionObserver(this.#v,{root:this.#e,threshold:.5}),this.#t.forEach(i=>this.#u.observe(i)));let n=this.#y()??(Number(this.getAttribute("start"))||0);if(this.#o){let i=n>0&&n<this.#t.length?n:0;this.#t.forEach((o,a)=>{o.hidden=a!==i}),this.#h(i)}else n>0&&n<this.#t.length&&this.goTo(n,!1);return this.#f(),this.hasAttribute("autoplay")&&!this.#l&&this.#b(),!0}teardown(){this.pause(),this.#u&&(this.#u.disconnect(),this.#u=null),this.#d&&(this.#d(),this.#d=null),this.#t=[],this.#o=!1}get slides(){return this.#t.map((e,s)=>({id:e.id||void 0,html:e.innerHTML,label:e.getAttribute("aria-label")||`${s+1} of ${this.#t.length}`}))}set slides(e){let s=Array.isArray(e)?e:[];for(;this.firstChild;)this.firstChild.remove();for(let r of s){let n=document.createElement("div");r.id&&(n.id=r.id),r.label&&n.setAttribute("aria-label",r.label),n.innerHTML=r.html||"",this.appendChild(n)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("carousel-wc:slides-changed",{detail:{slides:s,source:"property"},bubbles:!0}))}next(){let e=this.hasAttribute("loop");this.#i<this.#t.length-1?this.goTo(this.#i+1):e&&this.goTo(0)}prev(){let e=this.hasAttribute("loop");this.#i>0?this.goTo(this.#i-1):e&&this.goTo(this.#t.length-1)}goTo(e,s=!0){if(!(e<0||e>=this.#t.length)){if(this.#o)if(s&&e!==this.#i){let r=e>this.#i?"forward":"backward";document.documentElement.dataset.vtDirection=r,C(()=>{this.#p(e)}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}else this.#p(e);else{let r=this.#t[e].offsetLeft-this.#e.offsetLeft,n=s&&!this.#l?"smooth":"instant";this.#e.scrollTo({left:r,behavior:n})}this.#h(e)}}#p(e){this.#t.forEach((s,r)=>{s.hidden=r!==e})}play(){if(this.#c||this.#l)return;let e=Number(this.getAttribute("autoplay-delay"))||5e3;this.#c=setInterval(()=>this.next(),e),this.dispatchEvent(new CustomEvent("carousel-wc:play",{bubbles:!0}))}pause(){this.#c&&(clearInterval(this.#c),this.#c=null,this.dispatchEvent(new CustomEvent("carousel-wc:pause",{bubbles:!0})))}reset(){let e=Number(this.getAttribute("start"))||0;this.goTo(e,!1),this.#w()}#h(e){this.#i=e,this.#f(),this.#E(),this.#a&&(this.#a.textContent=`Slide ${e+1} of ${this.#t.length}`),this.dispatchEvent(new CustomEvent("carousel-wc:change",{detail:{index:e,slide:this.#t[e]},bubbles:!0}))}#f(){let e=this.hasAttribute("loop"),s=this.#i===0,r=this.#i===this.#t.length-1;if(this.#s&&(this.#s.disabled=!e&&s),this.#r&&(this.#r.disabled=!e&&r),this.#n){let n=this.#n.children;for(let i=0;i<n.length;i++){let o=i===this.#i;n[i].setAttribute("aria-current",o?"true":"false"),o?n[i].setAttribute("data-active",""):n[i].removeAttribute("data-active")}}}#v=e=>{for(let s of e)if(s.isIntersecting){let r=this.#t.indexOf(s.target);r!==-1&&r!==this.#i&&this.#h(r)}};#m=e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.prev();break;case"ArrowRight":e.preventDefault(),this.next();break;case"Home":e.preventDefault(),this.goTo(0);break;case"End":e.preventDefault(),this.goTo(this.#t.length-1);break}};#b(){this.play(),this.listen(this,"mouseenter",()=>this.pause()),this.listen(this,"mouseleave",()=>{this.hasAttribute("autoplay")&&this.play()}),this.listen(this,"focusin",()=>this.pause()),this.listen(this,"focusout",e=>{!this.contains(e.relatedTarget)&&this.hasAttribute("autoplay")&&this.play()}),this.listen(this,"touchstart",()=>this.pause(),{passive:!0})}#y(){let e=this.getAttribute("persist");if(!e)return null;try{let s=localStorage.getItem(`carousel:${e}`);return s!==null?Number(s):null}catch{return null}}#E(){let e=this.getAttribute("persist");if(e)try{localStorage.setItem(`carousel:${e}`,String(this.#i))}catch{}}#w(){let e=this.getAttribute("persist");if(e)try{localStorage.removeItem(`carousel:${e}`)}catch{}}};M("carousel-wc",x);export{x as CarouselWc};
|
|
1
|
+
var F=Object.defineProperty;var X=(t,e)=>()=>(t&&(e=t(t=0)),e);var O=(t,e)=>{for(var s in e)F(t,s,{get:e[s],enumerable:!0})};var Y={};O(Y,{addDialogDismiss:()=>I,addFlickListener:()=>$,addLongPress:()=>S,addPullToRefresh:()=>H,addSwipeListener:()=>T,haptic:()=>L,initGestures:()=>N,makeSwipeable:()=>P});function T(t,e={}){let s=e.threshold??50,r=e.restraint??100,n=e.timeout??300,i=e.velocity??.5,o=e.minFlickDistance??10,a,l,d;function p(u){u.isPrimary&&(a=u.clientX,l=u.clientY,d=Date.now())}function f(u){if(!u.isPrimary)return;let v=u.clientX-a,m=u.clientY-l,c=Date.now()-d;if(c>n)return;let h=Math.abs(v),b=Math.abs(m),E=Math.max(h,b),y=c>0?E/c:0,g=y>=i&&E>=o,w;if((h>=s||g&&h>b)&&b<=r?w=v<0?"left":"right":(b>=s||g&&b>h)&&h<=r&&(w=m<0?"up":"down"),w){let B=w==="left"||w==="right"?h:b;t.dispatchEvent(new CustomEvent(`swipe-${w}`,{bubbles:!0,detail:{distance:B,duration:c,velocity:y,flick:g}}))}}return t.addEventListener("pointerdown",p,{passive:!0}),t.addEventListener("pointerup",f,{passive:!0}),()=>{t.removeEventListener("pointerdown",p),t.removeEventListener("pointerup",f)}}function $(t,e={}){let s=e.minDistance??10,r=e.velocity??.6,n=e.timeout??250,i=e.restraint??80,o,a,l;function d(f){f.isPrimary&&(o=f.clientX,a=f.clientY,l=Date.now())}function p(f){if(!f.isPrimary)return;let u=f.clientX-o,v=f.clientY-a,m=Date.now()-l;if(m===0||m>n)return;let c=Math.abs(u),h=Math.abs(v),b=Math.max(c,h);if(b<s)return;let E=b/m;if(E<r)return;let y;if(c>h&&h<=i?y=u<0?"left":"right":h>c&&c<=i&&(y=v<0?"up":"down"),y){let g=y==="left"||y==="right"?c:h;t.dispatchEvent(new CustomEvent(`swipe-${y}`,{bubbles:!0,detail:{distance:g,duration:m,velocity:E,flick:!0}}))}}return t.addEventListener("pointerdown",d,{passive:!0}),t.addEventListener("pointerup",p,{passive:!0}),()=>{t.removeEventListener("pointerdown",d),t.removeEventListener("pointerup",p)}}function P(t,e={}){let s=e.threshold??100,r=e.direction??"horizontal",n=e.removeOnDismiss??!0,i=r==="horizontal",o=0,a=0,l=!1;function d(c){!c.isPrimary||t.hasAttribute("data-dismissed")||(c.preventDefault(),l=!0,o=i?c.clientX:c.clientY,a=0,t.setPointerCapture(c.pointerId),t.setAttribute("data-swiping",""))}function p(c){if(!l||!c.isPrimary)return;a=(i?c.clientX:c.clientY)-o;let b=1-Math.min(Math.abs(a)/s,1)*.5;i?t.style.transform=`translateX(${a}px)`:t.style.transform=`translateY(${a}px)`,t.style.opacity=String(b)}function f(c){!l||!c.isPrimary||(l=!1,t.releasePointerCapture(c.pointerId),t.removeAttribute("data-swiping"),Math.abs(a)>=s?v(a>0?"right":"left"):m())}function u(c){!l||!c.isPrimary||(l=!1,t.releasePointerCapture(c.pointerId),t.removeAttribute("data-swiping"),m())}function v(c){let h=c==="right"?"100%":"-100%";t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform=i?`translateX(${h})`:`translateY(${h})`,t.style.opacity="0",t.setAttribute("data-dismissed",""),L.dismiss(),t.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:c,distance:Math.abs(a)}})),n&&t.addEventListener("transitionend",()=>t.remove(),{once:!0})}function m(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",d),t.addEventListener("pointermove",p),t.addEventListener("pointerup",f),t.addEventListener("pointercancel",u),()=>{t.removeEventListener("pointerdown",d),t.removeEventListener("pointermove",p),t.removeEventListener("pointerup",f),t.removeEventListener("pointercancel",u)}}function H(t,e,s={}){let r=s.threshold??70,n=s.maxPull??120,i=document.createElement("div");i.setAttribute("data-pull-indicator",""),i.setAttribute("aria-hidden","true");let o=document.createElement("div");o.setAttribute("data-pull-spinner",""),i.appendChild(o),t.prepend(i);let a=0,l=!1,d=!1;function p(h){!h.isPrimary||d||t.scrollTop<=0&&(a=h.clientY,l=!0)}function f(h){if(!l||!h.isPrimary||d)return;let b=h.clientY-a;if(b<=0){i.style.transform="",i.style.opacity="";return}let E=Math.min(b,n),y=E/r;i.style.transform=`translateY(${E}px)`,i.style.opacity=String(Math.min(y,1)),y>=1?i.setAttribute("data-pull-ready",""):i.removeAttribute("data-pull-ready")}function u(h){!l||!h.isPrimary||(l=!1,i.hasAttribute("data-pull-ready")&&!d?m():c())}function v(h){!l||!h.isPrimary||(l=!1,c())}async function m(){d=!0,i.removeAttribute("data-pull-ready"),i.setAttribute("data-pull-loading",""),i.style.transform=`translateY(${r}px)`,i.style.opacity="1";try{await e()}finally{d=!1,i.removeAttribute("data-pull-loading"),c()}}function c(){i.style.transition="transform 0.3s ease, opacity 0.3s ease",i.style.transform="",i.style.opacity="",i.removeAttribute("data-pull-ready"),i.addEventListener("transitionend",()=>{i.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",p,{passive:!0}),t.addEventListener("pointermove",f,{passive:!0}),t.addEventListener("pointerup",u,{passive:!0}),t.addEventListener("pointercancel",v,{passive:!0}),()=>{t.removeEventListener("pointerdown",p),t.removeEventListener("pointermove",f),t.removeEventListener("pointerup",u),t.removeEventListener("pointercancel",v),i.remove()}}function S(t,e,s={}){let r=s.duration??500,n=s.hapticFeedback??!0,i=s.blockContextMenu??!0,o=null;function a(p){p.isPrimary&&(o=setTimeout(()=>{n&&L.tap(),e(p),o=null},r))}function l(){o&&(clearTimeout(o),o=null)}function d(p){i&&p.preventDefault()}return t.addEventListener("pointerdown",a,{passive:!0}),t.addEventListener("pointermove",l,{passive:!0}),t.addEventListener("pointerup",l,{passive:!0}),t.addEventListener("pointercancel",l,{passive:!0}),t.addEventListener("contextmenu",d),()=>{l(),t.removeEventListener("pointerdown",a),t.removeEventListener("pointermove",l),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",l),t.removeEventListener("contextmenu",d)}}function I(t,e={}){let s=e.threshold??80,r=0,n=0,i=!1;function o(u){if(!u.isPrimary||!t.open)return;let v=u.target;v.closest("a, button, input, select, textarea, [contenteditable]")&&!v.closest("header")||(i=!0,r=u.clientY,n=0,t.setPointerCapture(u.pointerId),t.style.transition="none")}function a(u){if(!i||!u.isPrimary)return;if(n=u.clientY-r,n<=0){t.style.transform="",t.style.opacity="";return}let m=1-Math.min(n/s,1)*.4;t.style.transform=`translateY(${n}px)`,t.style.opacity=String(m)}function l(u){!i||!u.isPrimary||(i=!1,t.releasePointerCapture(u.pointerId),n>=s?p():f())}function d(u){!i||!u.isPrimary||(i=!1,t.releasePointerCapture(u.pointerId),f())}function p(){t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform="translateY(100%)",t.style.opacity="0",L.dismiss(),t.addEventListener("transitionend",()=>{t.style.transition="",t.style.transform="",t.style.opacity="",t.close("dismiss")},{once:!0})}function f(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",o),t.addEventListener("pointermove",a),t.addEventListener("pointerup",l),t.addEventListener("pointercancel",d),()=>{t.removeEventListener("pointerdown",o),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",d)}}function N(t=document){let e=[];for(let s of t.querySelectorAll('[data-gesture="swipe"]'))e.push(T(s));for(let s of t.querySelectorAll('[data-gesture="flick"]'))e.push($(s));for(let s of t.querySelectorAll('[data-gesture="dismiss"]'))e.push(P(s));for(let s of t.querySelectorAll('[data-gesture="long-press"]'))e.push(S(s,()=>{s.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let s of t.querySelectorAll('dialog[data-gesture="dismiss-down"]'))e.push(I(s));return()=>e.forEach(s=>s())}var L,x,q=X(()=>{L={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};x=typeof document<"u"?document.documentElement:null;(!x||!x.hasAttribute("data-vb-gestures-init"))&&(x?.setAttribute("data-vb-gestures-init",""),N())});var U=window.matchMedia("(prefers-reduced-motion: reduce)");var C=new Map;function M(t,e,s={}){let r=s.priority??10,n={impl:e,bundle:s.bundle,contract:s.contract,priority:r},i=C.get(t);if(customElements.get(t)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}C.set(t,n),customElements.define(t,e)}var A=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,r,n){e.addEventListener(s,r,n),this.#e.push(()=>e.removeEventListener(s,r,n))}setup(){}teardown(){}setState(e,s){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{s?r.add(e):r.delete(e)}catch{let n=`--${e}`;s?r.add(n):r.delete(n)}}_adoptInternals(e){this.#t||(this.#t=e)}};function D(t){return document.startViewTransition?document.startViewTransition(t):t()}var z=0,k=class extends A{#e;#t=[];#s;#r;#n;#o;#l;#c=null;#i=0;#f=0;#u=!1;#h=!1;#a=!1;#d=null;get currentIndex(){return this.#i}get slideCount(){return this.#t.length}get playing(){return this.#c!==null}setup(){let e=[...this.children];if(e.length===0)return!1;if(this.#h=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.#a=this.hasAttribute("transition")&&!!document.startViewTransition,this.hasAttribute("transition")&&!this.#a&&this.removeAttribute("transition"),this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Carousel"),this.#e=document.createElement("div"),this.#e.className="carousel-track",this.#e.setAttribute("tabindex","0"),this.#e.setAttribute("aria-label","Slides"),e.forEach((i,o)=>{i.setAttribute("role","group"),i.setAttribute("aria-roledescription","slide"),i.setAttribute("aria-label",`${o+1} of ${e.length}`),this.#e.appendChild(i)}),this.#t=[...this.#e.children],this.#s=document.createElement("button"),this.#s.className="carousel-prev",this.#s.setAttribute("aria-label","Previous slide"),this.#s.innerHTML='<icon-wc name="chevron-left" size="sm"></icon-wc>',this.#r=document.createElement("button"),this.#r.className="carousel-next",this.#r.setAttribute("aria-label","Next slide"),this.#r.innerHTML='<icon-wc name="chevron-right" size="sm"></icon-wc>',this.getAttribute("indicators")!=="false"&&(this.#n=document.createElement("div"),this.#n.className="carousel-indicators",this.#n.setAttribute("aria-label","Slide indicators"),this.#t.forEach((i,o)=>{let a=document.createElement("button");a.className="carousel-dot",a.setAttribute("aria-label",`Go to slide ${o+1}`),a.setAttribute("aria-current",o===0?"true":"false"),this.listen(a,"click",()=>this.goTo(o)),this.#n.appendChild(a)})),this.#o=document.createElement("div"),this.#o.className="carousel-live",this.#o.setAttribute("aria-live","polite"),this.#o.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.appendChild(this.#e),this.appendChild(this.#r),this.#n&&this.appendChild(this.#n),this.appendChild(this.#o),this.listen(this.#s,"click",()=>this.prev()),this.listen(this.#r,"click",()=>this.next()),this.listen(this.#e,"keydown",this.#E),this.#a){let i=++z,o=this.getAttribute("transition")||"fade",a=o==="slide"?"vt-carousel-slide":o==="scale"?"vt-carousel-scale":"vt-carousel";this.#e.style.viewTransitionName=`carousel-${i}`,this.#e.style.viewTransitionClass=a}this.#a&&Promise.resolve().then(()=>(q(),Y)).then(({addSwipeListener:i})=>{this.#d=i(this.#e,{threshold:40}),this.listen(this.#e,"swipe-left",()=>this.next()),this.listen(this.#e,"swipe-right",()=>this.prev())}),this.#a||(this.#l=new IntersectionObserver(this.#y,{root:this.#e,threshold:.5}),this.#t.forEach(i=>this.#l.observe(i)),"onscrollend"in window&&this.listen(this.#e,"scrollend",()=>{this.#u=!1,this.#m()}));let n=this.#g()??(Number(this.getAttribute("start"))||0);if(this.#a){let i=n>0&&n<this.#t.length?n:0;this.#t.forEach((o,a)=>{o.hidden=a!==i}),this.#p(i)}else n>0&&n<this.#t.length&&this.goTo(n,!1);return this.#b(),this.hasAttribute("autoplay")&&!this.#h&&this.#w(),!0}teardown(){this.pause(),this.#l&&(this.#l.disconnect(),this.#l=null),this.#d&&(this.#d(),this.#d=null),this.#e?.parentElement===this&&[...this.#e.children].forEach(e=>this.appendChild(e)),this.#e?.remove(),this.#s?.remove(),this.#r?.remove(),this.#n?.remove(),this.#o?.remove(),this.#e=this.#s=this.#r=this.#n=this.#o=null,this.#t=[],this.#a=!1,this.#i=0,this.#f=0,this.#u=!1}get slides(){return this.#t.map((e,s)=>({id:e.id||void 0,html:e.innerHTML,label:e.getAttribute("aria-label")||`${s+1} of ${this.#t.length}`}))}set slides(e){let s=Array.isArray(e)?e:[];for(;this.firstChild;)this.firstChild.remove();for(let r of s){let n=document.createElement("div");r.id&&(n.id=r.id),r.label&&n.setAttribute("aria-label",r.label),n.innerHTML=r.html||"",this.appendChild(n)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("carousel-wc:slides-changed",{detail:{slides:s,source:"property"},bubbles:!0}))}next(){let e=this.hasAttribute("loop");this.#i<this.#t.length-1?this.goTo(this.#i+1):e&&this.goTo(0)}prev(){let e=this.hasAttribute("loop");this.#i>0?this.goTo(this.#i-1):e&&this.goTo(this.#t.length-1)}goTo(e,s=!0){if(!(e<0||e>=this.#t.length)){if(this.#a)if(s&&e!==this.#i){let r=e>this.#i?"forward":"backward";document.documentElement.dataset.vtDirection=r,D(()=>{this.#v(e)}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}else this.#v(e);else{let r=this.#t[e].offsetLeft-this.#e.offsetLeft,n=s&&!this.#h?"smooth":"instant";this.#e.scrollTo({left:r,behavior:n})}this.#p(e)}}#v(e){this.#t.forEach((s,r)=>{s.hidden=r!==e})}play(){if(this.#c||this.#h)return;let e=Number(this.getAttribute("autoplay-delay"))||5e3;this.#c=setInterval(()=>this.next(),e),this.dispatchEvent(new CustomEvent("carousel-wc:play",{bubbles:!0}))}pause(){this.#c&&(clearInterval(this.#c),this.#c=null,this.dispatchEvent(new CustomEvent("carousel-wc:pause",{bubbles:!0})))}reset(){let e=Number(this.getAttribute("start"))||0;this.goTo(e,!1),this.#L()}#p(e){this.#i=e,this.#b(),this.#A(),this.#o&&(this.#o.textContent=`Slide ${e+1} of ${this.#t.length}`),!this.#u&&(this.#m(),!this.#a&&"onscrollend"in window&&(this.#u=!0))}#m(){this.#i!==this.#f&&(this.#f=this.#i,this.dispatchEvent(new CustomEvent("carousel-wc:change",{detail:{index:this.#i,slide:this.#t[this.#i]},bubbles:!0})))}#b(){let e=this.hasAttribute("loop"),s=this.#i===0,r=this.#i===this.#t.length-1;if(this.#s&&(this.#s.disabled=!e&&s),this.#r&&(this.#r.disabled=!e&&r),this.#n){let n=this.#n.children;for(let i=0;i<n.length;i++){let o=i===this.#i;n[i].setAttribute("aria-current",o?"true":"false"),o?n[i].setAttribute("data-active",""):n[i].removeAttribute("data-active")}}}#y=e=>{for(let s of e)if(s.isIntersecting){let r=this.#t.indexOf(s.target);r!==-1&&r!==this.#i&&this.#p(r)}};#E=e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.prev();break;case"ArrowRight":e.preventDefault(),this.next();break;case"Home":e.preventDefault(),this.goTo(0);break;case"End":e.preventDefault(),this.goTo(this.#t.length-1);break}};#w(){this.play(),this.listen(this,"mouseenter",()=>this.pause()),this.listen(this,"mouseleave",()=>{this.hasAttribute("autoplay")&&this.play()}),this.listen(this,"focusin",()=>this.pause()),this.listen(this,"focusout",e=>{!this.contains(e.relatedTarget)&&this.hasAttribute("autoplay")&&this.play()}),this.listen(this,"touchstart",()=>this.pause(),{passive:!0})}#g(){let e=this.getAttribute("persist");if(!e)return null;try{let s=localStorage.getItem(`carousel:${e}`);return s!==null?Number(s):null}catch{return null}}#A(){let e=this.getAttribute("persist");if(e)try{localStorage.setItem(`carousel:${e}`,String(this.#i))}catch{}}#L(){let e=this.getAttribute("persist");if(e)try{localStorage.removeItem(`carousel:${e}`)}catch{}}};M("carousel-wc",k);export{k as CarouselWc};
|
|
2
2
|
//# sourceMappingURL=carousel-wc.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
]`).replace("lheading",de).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Be=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Me=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ke=/^( {2,}|\\)\n(?!\s*$)/,Ne=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,N=/[\s\p{P}\p{S}]/u,W=/[^\s\p{P}\p{S}]/u,De=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,N).getRegex(),fe=/(?!~)[\p{P}\p{S}]/u,Ze=/(?!~)[\s\p{P}\p{S}]/u,Oe=/(?:[^\s\p{P}\p{S}]|~)/u,He=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Se?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),be=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Qe=u(be,"u").replace(/punct/g,T).getRegex(),je=u(be,"u").replace(/punct/g,fe).getRegex(),me="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ve=u(me,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,N).replace(/punct/g,T).getRegex(),Fe=u(me,"gu").replace(/notPunctSpace/g,Oe).replace(/punctSpace/g,Ze).replace(/punct/g,fe).getRegex(),Ge=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,N).replace(/punct/g,T).getRegex(),Ke=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),We="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Xe=u(We,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,N).replace(/punct/g,T).getRegex(),Ue=u(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Je=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(),Ye=u(G).replace("(?:-->|$)","-->").getRegex(),et=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",Ye).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),L=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,tt=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",L).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xe=u(/^!?\[(label)\]\[(ref)\]/).replace("label",L).replace("ref",F).getRegex(),we=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",F).getRegex(),rt=u("reflink|nolink(?!\\()","g").replace("reflink",xe).replace("nolink",we).getRegex(),le=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X={_backpedal:S,anyPunctuation:Ue,autolink:Je,blockSkip:He,br:ke,code:Me,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Qe,emStrongRDelimAst:Ve,emStrongRDelimUnd:Ge,escape:Be,link:tt,nolink:we,punctuation:De,reflink:xe,reflinkSearch:rt,tag:et,text:Ne,url:S},st={...X,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",L).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",L).getRegex()},Z={...X,emStrongRDelimAst:Fe,emStrongLDelim:je,delLDelim:Ke,delRDelim:Xe,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",le).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",le).getRegex()},nt={...Z,br:u(ke).replace("{2,}","*").getRegex(),text:u(Z.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},q={normal:K,gfm:Le,pedantic:Ie},C={normal:X,gfm:Z,breaks:nt,pedantic:st},it={"&":"&","<":"<",">":">",'"':""","'":"'"},ae=n=>it[n];function w(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,ae)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,ae);return n}function oe(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function he(n,e){let t=n.replace(b.findPipe,(i,l,o)=>{let a=!1,c=l;for(;--c>=0&&o[c]==="\\";)a=!a;return a?"|":" |"}),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 lt(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 at(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 ce(n,e,t,s,r){let i=e.href,l=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,a}function ot(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
1
|
+
var _e=Object.defineProperty;var C=(n,e)=>()=>(n&&(e=n(n=0)),e);var ae=(n,e)=>{for(var t in e)_e(n,t,{get:e[t],enumerable:!0})};function R(n,e,t={}){let s=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:s},i=oe.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}oe.set(n,r),customElements.define(n,e)}var yt,oe,L=C(()=>{yt=window.matchMedia("(prefers-reduced-motion: reduce)"),oe=new Map});var v,I=C(()=>{v=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 K(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function ke(n){A=n}function u(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(r,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(b.caret,"$1"),t=t.replace(r,l),s},getRegex:()=>new RegExp(t,e)};return s}function w(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,ue)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,ue);return n}function pe(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function de(n,e){let t=n.replace(b.findPipe,(i,l,o)=>{let a=!1,c=l;for(;--c>=0&&o[c]==="\\";)a=!a;return a?"|":" |"}),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 P(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 ft(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 bt(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 ge(n,e,t,s,r){let i=e.href,l=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,a}function mt(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
3
2
|
`).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[o]=l;return o.length>=r.length?i.slice(r.length):i}).join(`
|
|
4
|
-
`)}var
|
|
5
|
-
`)}}}
|
|
6
|
-
`)}}
|
|
3
|
+
`)}function g(n,e){return $.parse(n,e)}var A,S,qe,b,Le,Ie,Be,q,Me,W,fe,be,Ne,X,De,U,Ze,Oe,Z,J,He,me,Qe,Y,he,Ve,je,Fe,Ge,xe,Ke,T,O,ee,We,we,Xe,Ue,Je,ye,Ye,et,ve,tt,rt,st,nt,it,lt,at,ot,ht,ct,M,ut,Se,$e,pt,ce,te,dt,j,gt,B,z,kt,ue,N,m,D,re,x,_,xt,$,$t,At,Rt,Tt,Et,Ct,zt,Ae=C(()=>{A=K();S={exec:()=>null};qe=(()=>{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)}}>`)},Le=/^(?:[ \t]*(?:\n|$))+/,Ie=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Be=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,q=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Me=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,W=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,fe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,be=u(fe).replace(/bull/g,W).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(),Ne=u(fe).replace(/bull/g,W).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(),X=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,De=/^[^\n]+/,U=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ze=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",U).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Oe=u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,W).getRegex(),Z="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",J=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,He=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",J).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me=u(X).replace("hr",q).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",Z).getRegex(),Qe=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",me).getRegex(),Y={blockquote:Qe,code:Ie,def:Ze,fences:Be,heading:Me,hr:q,html:He,lheading:be,list:Oe,newline:Le,paragraph:me,table:S,text:De},he=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",q).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",Z).getRegex(),Ve={...Y,lheading:Ne,table:he,paragraph:u(X).replace("hr",q).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",Z).getRegex()},je={...Y,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",J).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(X).replace("hr",q).replace("heading",` *#{1,6} *[^
|
|
4
|
+
]`).replace("lheading",be).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Fe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ge=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xe=/^( {2,}|\\)\n(?!\s*$)/,Ke=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,O=/[\s\p{P}\p{S}]/u,ee=/[^\s\p{P}\p{S}]/u,We=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,O).getRegex(),we=/(?!~)[\p{P}\p{S}]/u,Xe=/(?!~)[\s\p{P}\p{S}]/u,Ue=/(?:[^\s\p{P}\p{S}]|~)/u,Je=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",qe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ye=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ye=u(ye,"u").replace(/punct/g,T).getRegex(),et=u(ye,"u").replace(/punct/g,we).getRegex(),ve="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tt=u(ve,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,O).replace(/punct/g,T).getRegex(),rt=u(ve,"gu").replace(/notPunctSpace/g,Ue).replace(/punctSpace/g,Xe).replace(/punct/g,we).getRegex(),st=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,O).replace(/punct/g,T).getRegex(),nt=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),it="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",lt=u(it,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,O).replace(/punct/g,T).getRegex(),at=u(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),ot=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(),ht=u(J).replace("(?:-->|$)","-->").getRegex(),ct=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",ht).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),M=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ut=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",M).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Se=u(/^!?\[(label)\]\[(ref)\]/).replace("label",M).replace("ref",U).getRegex(),$e=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",U).getRegex(),pt=u("reflink|nolink(?!\\()","g").replace("reflink",Se).replace("nolink",$e).getRegex(),ce=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,te={_backpedal:S,anyPunctuation:at,autolink:ot,blockSkip:Je,br:xe,code:Ge,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Ye,emStrongRDelimAst:tt,emStrongRDelimUnd:st,escape:Fe,link:ut,nolink:$e,punctuation:We,reflink:Se,reflinkSearch:pt,tag:ct,text:Ke,url:S},dt={...te,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",M).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",M).getRegex()},j={...te,emStrongRDelimAst:rt,emStrongLDelim:et,delLDelim:nt,delRDelim:lt,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ce).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",ce).getRegex()},gt={...j,br:u(xe).replace("{2,}","*").getRegex(),text:u(j.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},B={normal:Y,gfm:Ve,pedantic:je},z={normal:te,gfm:j,breaks:gt,pedantic:dt},kt={"&":"&","<":"<",">":">",'"':""","'":"'"},ue=n=>kt[n];N=class{options;rules;lexer;constructor(n){this.options=n||A}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:P(t,`
|
|
5
|
+
`)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=mt(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=P(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:P(e[0],`
|
|
6
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=P(e[0],`
|
|
7
7
|
`).split(`
|
|
8
8
|
`),s="",r="",i=[];for(;t.length>0;){let l=!1,o=[],a;for(a=0;a<t.length;a++)if(this.rules.other.blockquoteStart.test(t[a]))o.push(t[a]),l=!0;else if(!l)o.push(t[a]);else break;t=t.slice(a);let c=o.join(`
|
|
9
9
|
`),h=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -14,16 +14,16 @@ ${h}`:h;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
14
14
|
`),y=this.blockquote(k);i[i.length-1]=y,s=s.substring(0,s.length-f.raw.length)+y.raw,r=r.substring(0,r.length-f.text.length)+y.text;break}else if(p?.type==="list"){let f=p,k=f.raw+`
|
|
15
15
|
`+t.join(`
|
|
16
16
|
`),y=this.list(k);i[i.length-1]=y,s=s.substring(0,s.length-p.raw.length)+y.raw,r=r.substring(0,r.length-f.raw.length)+y.raw,t=k.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),l=!1;for(;n;){let a=!1,c="",h="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;c=e[0],n=n.substring(c.length);let d=
|
|
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),l=!1;for(;n;){let a=!1,c="",h="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;c=e[0],n=n.substring(c.length);let d=bt(e[2].split(`
|
|
18
18
|
`,1)[0],e[1].length),p=n.split(`
|
|
19
19
|
`,1)[0],f=!d.trim(),k=0;if(this.options.pedantic?(k=2,h=d.trimStart()):f?k=e[1].length+1:(k=d.search(this.rules.other.nonSpaceChar),k=k>4?1:k,h=d.slice(k),k+=e[1].length),f&&this.rules.other.blankLine.test(p)&&(c+=p+`
|
|
20
|
-
`,n=n.substring(p.length+1),a=!0),!a){let y=this.rules.other.nextBulletRegex(k),
|
|
21
|
-
`,1)[0],E;if(p=
|
|
22
|
-
`+E.slice(k);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||
|
|
23
|
-
`+p}f=!p.trim(),c+=
|
|
24
|
-
`,n=n.substring(
|
|
25
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of r)i.rows.push(
|
|
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=
|
|
20
|
+
`,n=n.substring(p.length+1),a=!0),!a){let y=this.rules.other.nextBulletRegex(k),ne=this.rules.other.hrRegex(k),ie=this.rules.other.fencesBeginRegex(k),le=this.rules.other.headingBeginRegex(k),ze=this.rules.other.htmlBeginRegex(k),Pe=this.rules.other.blockquoteBeginRegex(k);for(;n;){let V=n.split(`
|
|
21
|
+
`,1)[0],E;if(p=V,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),ie.test(p)||le.test(p)||ze.test(p)||Pe.test(p)||y.test(p)||ne.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=k||!p.trim())h+=`
|
|
22
|
+
`+E.slice(k);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ie.test(d)||le.test(d)||ne.test(d))break;h+=`
|
|
23
|
+
`+p}f=!p.trim(),c+=V+`
|
|
24
|
+
`,n=n.substring(V.length+1),d=E.slice(k)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(l=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),r.raw+=c}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 a of r.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let h={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=h.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=h.raw+a.tokens[0].raw,a.tokens[0].text=h.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(h)):a.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):a.tokens.unshift(h)}}if(!r.loose){let c=a.tokens.filter(d=>d.type==="space"),h=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=h}}if(r.loose)for(let a of r.items){a.loose=!0;for(let c of a.tokens)c.type==="text"&&(c.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=de(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 l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of r)i.rows.push(de(l,i.header.length).map((o,a)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[a]})));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=P(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=ft(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).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)),ge(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 ge(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,l,o=r,a=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+r);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){o+=l;continue}else if((s[5]||s[6])&&r%3&&!((r+l)%3)){a+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o+a);let h=[...s[0]][0].length,d=n.slice(0,r+s.index+h+l);if(Math.min(r,l)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}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,l,o=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+r);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==r))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let c=[...s[0]][0].length,h=n.slice(0,r+s.index+c+l),d=h.slice(r,-r);return{type:"del",raw:h,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}}}},m=class F{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new N,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:B.normal,inline:z.normal};this.options.pedantic?(t.block=B.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=B.gfm,this.options.breaks?t.inline=z.breaks:t.inline=z.gfm),this.tokenizer.rules=t}static get rules(){return{block:B,inline:z}}static lex(e,t){return new F(t).lex(e)}static lexInline(e,t){return new F(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
|
|
27
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(l=>(r=l.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 l=t.at(-1);r.raw.length===1&&l!==void 0?l.raw+=`
|
|
28
28
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
29
29
|
`)?"":`
|
|
@@ -37,7 +37,7 @@ ${h}`:h;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
37
37
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.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 l=t.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
38
38
|
`)?"":`
|
|
39
39
|
`)+r.raw,l.text+=`
|
|
40
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(r);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}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 a=Object.keys(this.tokens.links);if(a.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.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 l=!1,o="";for(;e;){l||(o=""),l=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let h=t.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let h=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(f=>{p=f.call({lexer:this},d),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(c=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}},
|
|
40
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(r);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}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 a=Object.keys(this.tokens.links);if(a.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.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 l=!1,o="";for(;e;){l||(o=""),l=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let h=t.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if(this.options.extensions?.startInline){let h=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(f=>{p=f.call({lexer:this},d),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(c=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(c)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}},D=class{options;parser;constructor(n){this.options=n||A}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(b.notSpaceStart)?.[0],r=n.replace(b.endingNewline,"")+`
|
|
41
41
|
`;return s?'<pre><code class="language-'+w(s)+'">'+(t?r:w(r,!0))+`</code></pre>
|
|
42
42
|
`:"<pre><code>"+(t?r:w(r,!0))+`</code></pre>
|
|
43
43
|
`}blockquote({tokens:n}){return`<blockquote>
|
|
@@ -55,6 +55,6 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
55
55
|
`}tablerow({text:n}){return`<tr>
|
|
56
56
|
${n}</tr>
|
|
57
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>${w(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=
|
|
59
|
-
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},$=new ht;function g(n,e){return $.parse(n,e)}g.options=g.setOptions=function(n){return $.setOptions(n),g.defaults=$.defaults,ue(g.defaults),g};g.getDefaults=Q;g.defaults=A;g.use=function(...n){return $.use(...n),g.defaults=$.defaults,ue(g.defaults),g};g.walkTokens=function(n,e){return $.walkTokens(n,e)};g.parseInline=$.parseInline;g.Parser=x;g.parser=x.parse;g.Renderer=B;g.TextRenderer=U;g.Lexer=m;g.lexer=m.lex;g.Tokenizer=I;g.Hooks=P;g.parse=g;var dt=g.options,gt=g.setOptions,kt=g.use,ft=g.walkTokens,bt=g.parseInline;var mt=x.parse,xt=m.lex;var J=class extends v{#e=null;#t=null;#s=null;#n=null;#i=null;static get observedAttributes(){return["src"]}setup(){this.#l()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){e==="src"&&s&&t!==s&&this.isConnected&&this.#l()}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.#l())}async render(){await this.#l()}async reload(){this.getAttribute("src")&&await this.#l()}#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#l(){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.#a("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.#a("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.#h())(t)}catch(i){this.setAttribute("data-error",""),this.#a("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.#a("markdown-viewer:rendered",{src:e,node:this.#s}),this.hasAttribute("highlight"))for(let i of this.#s.querySelectorAll('pre > code[class*="language-"]')){let l=i.className.match(/language-(\S+)/)?.[1]||"";this.#a("markdown-viewer:highlight",{node:i,language:l})}}async#h(){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)}#a(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};R("markdown-viewer",J);var Y=class extends v{#e=null;#t=null;#s=null;#n=null;#i="";#r=null;static get observedAttributes(){return["name","placeholder","rows"]}setup(){this.#l(),this.#h(),this.#a()}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.#a(),this.dispatchEvent(new CustomEvent("markdown-editor:change",{detail:{value:t,source:"api"},bubbles:!0})))}get textarea(){return this.#e}#l(){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}#h(){let e=this.#e;e&&(this.listen(e,"input",()=>{this.#c("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.#c("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.#a(),150)}#a(){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?.()}#c(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};R("markdown-editor",Y);var ee=class extends v{static formAssociated=!0;static observedAttributes=["value","disabled","placeholder","submit-label","cancel-label","data-show-cancel"];#e;#t;#s;#n;#i;#r;#l;#h=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.#l=document.createElement("span"),this.#l.className="comment-box-counter",this.#l.setAttribute("aria-live","polite"),this.#s.appendChild(this.#l)),this.replaceChildren(this.#t,this.#s),this.listen(this.#i,"click",this.#g),this.#r&&this.listen(this.#r,"click",this.#k),this.#a(),this.#t.hasAttribute("data-upgraded")||this.listen(this.#t,"markdown-editor:upgraded",()=>this.#a(),{once:!0}),this.#f(),this.#u(),this.#p(),this.#d()}get#o(){return this.#t?.textarea??this.#t?.querySelector("textarea")??null}#a(){let e=this.#o;!e||e===this.#h||(this.#h=e,this.listen(e,"input",this.#c),this.listen(e,"keydown",this.#b))}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.#f():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.#k)):!this.hasAttribute("data-show-cancel")&&this.#r&&(this.#r.remove(),this.#r=null))}#c=()=>{this.#u(),this.#p(),this.#d(),this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:this.value,length:this.value.length}}))};#b=e=>{e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#g())};#g=()=>{if(this.#m())return;let e=this.value,t=new CustomEvent("comment-box:submit",{bubbles:!0,cancelable:!0,detail:{value:e}});this.dispatchEvent(t)&&this.clear()};#k=()=>{let e=this.value;this.dispatchEvent(new CustomEvent("comment-box:cancel",{bubbles:!0,detail:{value:e}}))};#m(){return this.hasAttribute("disabled")?!0:!this.#e.checkValidity()}#f(){let e=this.hasAttribute("disabled"),t=this.#o;t&&(t.disabled=e),this.#i.disabled=e,this.#r&&(this.#r.disabled=e)}#u(){this.#e.setFormValue(this.value)}#p(){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({})}#d(){if(!this.#l)return;let e=Number(this.getAttribute("data-max-length"))||0,t=this.value.length;this.#l.textContent=e?`${t} / ${e}`:String(t),this.#l.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.#u(),this.#p(),this.#d())}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()}};R("comment-box",ee);export{ee as CommentBox};
|
|
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>${w(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=pe(n);if(r===null)return s;n=r;let i='<a href="'+n+'"';return e&&(i+=' title="'+w(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=pe(n);if(r===null)return w(t);n=r;let i=`<img src="${n}" alt="${w(t)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:w(n.text)}},re=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 G{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new D,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new re}static parse(e,t){return new G(t).parse(e)}static parseInline(e,t){return new G(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 l=r,o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.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 l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}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 l=i;switch(l.type){case"escape":{s+=t.text(l);break}case"html":{s+=t.html(l);break}case"link":{s+=t.link(l);break}case"image":{s+=t.image(l);break}case"checkbox":{s+=t.checkbox(l);break}case"strong":{s+=t.strong(l);break}case"em":{s+=t.em(l);break}case"codespan":{s+=t.codespan(l);break}case"br":{s+=t.br(l);break}case"del":{s+=t.del(l);break}case"text":{s+=t.text(l);break}default:{let o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},_=class{options;block;constructor(n){this.options=n||A}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?m.lex:m.lexInline}provideParser(n=this.block){return n?x.parse:x.parseInline}},xt=class{defaults=K();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=x;Renderer=D;TextRenderer=re;Lexer=m;Tokenizer=N;Hooks=_;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 l of i)t=t.concat(this.walkTokens(l.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 l=r[i].flat(1/0);t=t.concat(this.walkTokens(l,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(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),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 D(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 l=i,o=t.renderer[l],a=r[l];r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=a.apply(r,c)),h||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new N(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 l=i,o=t.tokenizer[l],a=r[l];r[l]=(...c)=>{let h=o.apply(r,c);return h===!1&&(h=a.apply(r,c)),h}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new _;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 l=i,o=t.hooks[l],a=r[l];_.passThroughHooks.has(i)?r[l]=c=>{if(this.defaults.async&&_.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await o.call(r,c);return a.call(r,d)})();let h=o.call(r,c);return a.call(r,h)}:r[l]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(r,c);return d===!1&&(d=await a.apply(r,c)),d})();let h=o.apply(r,c);return h===!1&&(h=a.apply(r,c)),h}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return m.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 l=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer(n):n?m.lex:m.lexInline)(l,r),a=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(a,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(n):n?x.parse:x.parseInline)(a,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let l=(r.hooks?r.hooks.provideLexer(n):n?m.lex:m.lexInline)(e,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(n):n?x.parse:x.parseInline)(l,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(l){return i(l)}}}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>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},$=new xt;g.options=g.setOptions=function(n){return $.setOptions(n),g.defaults=$.defaults,ke(g.defaults),g};g.getDefaults=K;g.defaults=A;g.use=function(...n){return $.use(...n),g.defaults=$.defaults,ke(g.defaults),g};g.walkTokens=function(n,e){return $.walkTokens(n,e)};g.parseInline=$.parseInline;g.Parser=x;g.parser=x.parse;g.Renderer=D;g.TextRenderer=re;g.Lexer=m;g.lexer=m.lex;g.Tokenizer=N;g.Hooks=_;g.parse=g;$t=g.options,At=g.setOptions,Rt=g.use,Tt=g.walkTokens,Et=g.parseInline,Ct=x.parse,zt=m.lex});var Re={};ae(Re,{MarkdownViewer:()=>H});var H,Te=C(()=>{L();I();Ae();H=class extends v{#e=null;#t=null;#s=null;#n=null;#i=null;static get observedAttributes(){return["src"]}setup(){this.#l()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){e==="src"&&s&&t!==s&&this.isConnected&&this.#l()}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.#l())}async render(){await this.#l()}async reload(){this.getAttribute("src")&&await this.#l()}#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#l(){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.#a("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.#a("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.#h())(t)}catch(i){this.setAttribute("data-error",""),this.#a("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.#a("markdown-viewer:rendered",{src:e,node:this.#s}),this.hasAttribute("highlight"))for(let i of this.#s.querySelectorAll('pre > code[class*="language-"]')){let l=i.className.match(/language-(\S+)/)?.[1]||"";this.#a("markdown-viewer:highlight",{node:i,language:l})}}async#h(){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)}#a(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};R("markdown-viewer",H)});var Ee={};ae(Ee,{MarkdownEditor:()=>Q});var Q,Ce=C(()=>{L();I();Q=class extends v{#e=null;#t=null;#s=null;#n=null;#i="";#r=null;static get observedAttributes(){return["name","placeholder","rows"]}setup(){this.#l(),this.#h(),this.#a()}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.#a(),this.dispatchEvent(new CustomEvent("markdown-editor:change",{detail:{value:t,source:"api"},bubbles:!0})))}get textarea(){return this.#e}#l(){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}#h(){let e=this.#e;e&&(this.listen(e,"input",()=>{this.#c("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.#c("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.#a(),150)}#a(){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?.()}#c(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};R("markdown-editor",Q)});L();I();var se=class extends v{static formAssociated=!0;static observedAttributes=["value","disabled","placeholder","submit-label","cancel-label","data-show-cancel"];#e;#t;#s;#n;#i;#r;#l;#h=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){Promise.resolve().then(()=>(Te(),Re)).catch(()=>console.warn('[VB] comment-box: markdown-viewer failed to load (missing importmap for "marked"?)')),Promise.resolve().then(()=>(Ce(),Ee)).catch(()=>console.warn("[VB] comment-box: markdown-editor failed to load"));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.#l=document.createElement("span"),this.#l.className="comment-box-counter",this.#l.setAttribute("aria-live","polite"),this.#s.appendChild(this.#l)),this.replaceChildren(this.#t,this.#s),this.listen(this.#i,"click",this.#g),this.#r&&this.listen(this.#r,"click",this.#k),this.#a(),this.#t.hasAttribute("data-upgraded")||this.listen(this.#t,"markdown-editor:upgraded",()=>this.#a(),{once:!0}),this.#f(),this.#u(),this.#p(),this.#d()}get#o(){return this.#t?.textarea??this.#t?.querySelector("textarea")??null}#a(){let e=this.#o;!e||e===this.#h||(this.#h=e,this.listen(e,"input",this.#c),this.listen(e,"keydown",this.#b))}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.#f():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.#k)):!this.hasAttribute("data-show-cancel")&&this.#r&&(this.#r.remove(),this.#r=null))}#c=()=>{this.#u(),this.#p(),this.#d(),this.dispatchEvent(new CustomEvent("comment-box:input",{bubbles:!0,detail:{value:this.value,length:this.value.length}}))};#b=e=>{e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#g())};#g=()=>{if(this.#m())return;let e=this.value,t=new CustomEvent("comment-box:submit",{bubbles:!0,cancelable:!0,detail:{value:e}});this.dispatchEvent(t)&&this.clear()};#k=()=>{let e=this.value;this.dispatchEvent(new CustomEvent("comment-box:cancel",{bubbles:!0,detail:{value:e}}))};#m(){return this.hasAttribute("disabled")?!0:!this.#e.checkValidity()}#f(){let e=this.hasAttribute("disabled"),t=this.#o;t&&(t.disabled=e),this.#i.disabled=e,this.#r&&(this.#r.disabled=e)}#u(){this.#e.setFormValue(this.value)}#p(){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({})}#d(){if(!this.#l)return;let e=Number(this.getAttribute("data-max-length"))||0,t=this.value.length;this.#l.textContent=e?`${t} / ${e}`:String(t),this.#l.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.#u(),this.#p(),this.#d())}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()}};R("comment-box",se);export{se as CommentBox};
|
|
60
60
|
//# sourceMappingURL=comment-box.js.map
|