vanilla-breeze 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/cdn/components/analytics-panel.js +34 -0
  2. package/dist/cdn/components/author-index.js +3 -0
  3. package/dist/cdn/components/brand-mark.js +2 -0
  4. package/dist/cdn/components/carousel-wc.js +1 -1
  5. package/dist/cdn/components/color-palette.js +13 -7
  6. package/dist/cdn/components/comment-wc.js +2 -0
  7. package/dist/cdn/components/consent-banner.js +1 -1
  8. package/dist/cdn/components/content-lens.js +2 -0
  9. package/dist/cdn/components/font-pairer.js +108 -0
  10. package/dist/cdn/components/geo-map.js +7 -7
  11. package/dist/cdn/components/gradient-builder.js +52 -0
  12. package/dist/cdn/components/highlight-wc.js +3 -0
  13. package/dist/cdn/components/manifest.json +93 -21
  14. package/dist/cdn/components/markdown-viewer.js +3 -3
  15. package/dist/cdn/components/motion-specimen.js +21 -0
  16. package/dist/cdn/components/note-wc.js +3 -0
  17. package/dist/cdn/components/notification-wc.js +37 -0
  18. package/dist/cdn/components/page-info.js +55 -24
  19. package/dist/cdn/components/page-toc.js +1 -1
  20. package/dist/cdn/components/popularity-index.js +9 -0
  21. package/dist/cdn/components/print-page.js +1 -1
  22. package/dist/cdn/components/recently-visited.js +3 -0
  23. package/dist/cdn/components/review-surface.js +11 -11
  24. package/dist/cdn/components/selection-menu.js +2 -0
  25. package/dist/cdn/components/semantic-palette.js +30 -0
  26. package/dist/cdn/components/settings-panel.js +55 -51
  27. package/dist/cdn/components/share-wc.js +2 -2
  28. package/dist/cdn/components/spacing-specimen.js +5 -5
  29. package/dist/cdn/components/split-surface.js +1 -1
  30. package/dist/cdn/components/text-reader.js +2 -2
  31. package/dist/cdn/components/theme-export.js +18 -0
  32. package/dist/cdn/components/theme-picker.js +58 -58
  33. package/dist/cdn/components/token-specimen.js +25 -20
  34. package/dist/cdn/components/topic-map.js +3 -0
  35. package/dist/cdn/components/trust-filter.js +4 -0
  36. package/dist/cdn/components/type-specimen.js +16 -13
  37. package/dist/cdn/components/watch-wc.js +3 -0
  38. package/dist/cdn/packs/design-system.full.js +124 -47
  39. package/dist/cdn/packs/effects.full.js +1 -1
  40. package/dist/cdn/packs/kawaii.full.css +1 -1
  41. package/dist/cdn/packs/kawaii.full.js +1 -1
  42. package/dist/cdn/packs/kawaii.theme.css +1 -1
  43. package/dist/cdn/packs/manifest.json +8 -38
  44. package/dist/cdn/packs/ui.full.css +1 -1
  45. package/dist/cdn/packs/ui.full.js +50 -50
  46. package/dist/cdn/packs/ux-planning.full.js +36 -36
  47. package/dist/cdn/themes/alpha1999.css +1 -1
  48. package/dist/cdn/themes/brutalist.css +1 -1
  49. package/dist/cdn/themes/claymorphism.css +1 -1
  50. package/dist/cdn/themes/genai.css +1 -1
  51. package/dist/cdn/themes/kawaii.css +1 -1
  52. package/dist/cdn/themes/magna.css +1 -1
  53. package/dist/cdn/themes/manifest.json +12 -12
  54. package/dist/cdn/themes/nes.css +1 -1
  55. package/dist/cdn/themes/neumorphism.css +1 -1
  56. package/dist/cdn/themes/rough.css +1 -1
  57. package/dist/cdn/themes/startup.css +1 -1
  58. package/dist/cdn/themes/super2026.css +1 -1
  59. package/dist/cdn/themes/win9x.css +1 -1
  60. package/dist/cdn/vanilla-breeze-core.css +1 -1
  61. package/dist/cdn/vanilla-breeze-core.js +119 -47
  62. package/dist/cdn/vanilla-breeze-extras.js +154 -74
  63. package/dist/cdn/vanilla-breeze.css +1 -1
  64. package/dist/cdn/vanilla-breeze.js +605 -249
  65. package/package.json +8 -6
  66. package/dist/cdn/packs/retro.bundle.js +0 -2
  67. package/dist/cdn/packs/retro.components.js +0 -1
  68. package/dist/cdn/packs/retro.effects.css +0 -2
  69. package/dist/cdn/packs/retro.effects.js +0 -16
  70. package/dist/cdn/packs/retro.full.css +0 -5
  71. package/dist/cdn/packs/retro.full.js +0 -16
  72. package/dist/cdn/packs/retro.theme.css +0 -2
@@ -0,0 +1,52 @@
1
+ var A=window.matchMedia("(prefers-reduced-motion: reduce)");var x=new Map;function w(r,o,s={}){let t=s.priority??10,i={impl:o,bundle:s.bundle,contract:s.contract,priority:t},e=x.get(r);if(customElements.get(r)){if(!e||e.priority>=t){e&&e.priority===t&&e.impl!==o&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${e.bundle}" (priority ${e.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${e.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(e&&e.priority>=t){e.priority===t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${e.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}x.set(r,i),customElements.define(r,o)}var u=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let o of this.#t)o();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(o,s,t,i){o.addEventListener(s,t,i),this.#t.push(()=>o.removeEventListener(s,t,i))}setup(){}teardown(){}};function E(r,{type:o="linear",angle:s=90,interpolation:t="oklab"}={}){if(r.length<2)return"transparent";let e=[...r].sort((a,d)=>a.position-d.position).map(a=>`${a.color} ${a.position}%`).join(", "),n=t!=="srgb"?` in ${t}`:"";return o==="radial"?`radial-gradient(circle${n}, ${e})`:`linear-gradient(${s}deg${n}, ${e})`}function g(r){if(!r)return k();let o=r.split(",").map(s=>s.trim()).filter(Boolean);return o.length<2?k():o.map((s,t)=>({color:s,position:Math.round(t/(o.length-1)*100)}))}function k(){return[{color:"#6366f1",position:0},{color:"#ec4899",position:100}]}var m=class extends u{static observedAttributes=["colors","type","angle","interpolation","show-export","show-controls"];#t=[];#e="linear";#o=90;#s="oklab";setup(){this.#t=g(this.getAttribute("colors")),this.#e=this.getAttribute("type")||"linear",this.#o=Number(this.getAttribute("angle"))||90,this.#s=this.getAttribute("interpolation")||"oklab",this.#r()}attributeChangedCallback(o,s,t){s===t||!this.isConnected||(o==="colors"&&(this.#t=g(t)),o==="type"&&(this.#e=t||"linear"),o==="angle"&&(this.#o=Number(t)||90),o==="interpolation"&&(this.#s=t||"oklab"),this.#r())}get css(){return E(this.#t,{type:this.#e,angle:this.#o,interpolation:this.#s})}#r(){let o=this.hasAttribute("show-export"),s=this.getAttribute("show-controls")!=="false",t=this.css,i="var(--size-m, 1rem)",e="var(--size-s, 0.75rem)",n="var(--size-xs, 0.5rem)",a="var(--radius-m, 0.5rem)",d="var(--color-border, #ddd)",y="var(--color-surface, #fff)",h="var(--color-text-muted, #666)",f="var(--font-mono, monospace)",b="var(--font-size-sm, 0.875rem)",p="var(--font-size-xs, 0.75rem)",S=`<div class="gb-preview" style="height:4rem;border-radius:${a};background:${t};border:1px solid ${d}"></div>`,$=`font:inherit;font-size:${b};padding:0.25rem 0.5rem;border:1px solid ${d};border-radius:4px;background:${y}`,v="";s&&(v=`<div style="display:flex;flex-direction:column;gap:${e};font-size:${b}">
2
+ <div style="display:flex;flex-wrap:wrap;gap:${i};align-items:center">
3
+ <label style="display:flex;align-items:center;gap:${n}">
4
+ Type
5
+ <select class="gb-type" style="${$}">
6
+ <option value="linear"${this.#e==="linear"?" selected":""}>Linear</option>
7
+ <option value="radial"${this.#e==="radial"?" selected":""}>Radial</option>
8
+ </select>
9
+ </label>
10
+ <label style="display:flex;align-items:center;gap:${n}${this.#e==="radial"?";opacity:0.4;pointer-events:none":""}">
11
+ Angle
12
+ <input type="range" class="gb-angle" min="0" max="360" value="${this.#o}" style="width:8rem;accent-color:var(--color-interactive,oklch(55% .2 260))">
13
+ <span class="gb-angle-value" style="min-width:2.5em;font-family:${f};font-size:${p}">${this.#o}\xB0</span>
14
+ </label>
15
+ </div>
16
+ <label style="display:inline-flex;align-items:center;gap:${n}">
17
+ Color Space
18
+ <select class="gb-space" style="${$}">
19
+ <option value="oklab"${this.#s==="oklab"?" selected":""}>oklab</option>
20
+ <option value="oklch"${this.#s==="oklch"?" selected":""}>oklch</option>
21
+ <option value="srgb"${this.#s==="srgb"?" selected":""}>sRGB</option>
22
+ </select>
23
+ </label>
24
+ </div>`);let C=[...this.#t].map((l,c)=>({...l,origIndex:c})).sort((l,c)=>l.position-c.position).map(l=>{let c=l.origIndex;return`<div style="display:flex;align-items:center;gap:0.375rem" data-stop="${c}">
25
+ <input type="color" value="${l.color}" class="gb-stop-color" data-i="${c}"
26
+ style="width:1.75rem;height:1.75rem;padding:0;border:1px solid ${d};border-radius:4px;cursor:pointer;flex-shrink:0">
27
+ <input type="range" min="0" max="100" value="${l.position}" class="gb-stop-pos-range" data-i="${c}"
28
+ style="flex:1;min-width:3rem;max-width:8rem;accent-color:${l.color}">
29
+ <span style="font-family:${f};font-size:${p};min-width:2.5em;text-align:right" class="gb-stop-pos-label" data-i="${c}">${l.position}%</span>
30
+ ${this.#t.length>2?`<button type="button" class="gb-remove" data-i="${c}"
31
+ style="all:unset;cursor:pointer;font-size:1rem;color:${h};padding:0 0.25rem" title="Remove stop">&times;</button>`:""}
32
+ </div>`}).join(""),q=`<button type="button" class="gb-add"
33
+ style="all:unset;cursor:pointer;font-size:${b};color:var(--color-interactive,oklch(55% .2 260));font-weight:600">+ Add Stop</button>`;this.innerHTML=`
34
+ <div style="display:flex;flex-direction:column;gap:${i}">
35
+ ${S}
36
+ ${v}
37
+ <div style="display:flex;flex-direction:column;gap:${n}">
38
+ <span style="font-size:${p};font-weight:600;color:${h};text-transform:uppercase;letter-spacing:0.05em">Color Stops</span>
39
+ ${C}
40
+ ${q}
41
+ </div>
42
+ <div style="display:flex;flex-direction:column;gap:${n}">
43
+ <span style="font-size:${p};font-weight:600;color:${h};text-transform:uppercase;letter-spacing:0.05em">Code</span>
44
+ <div style="display:flex;align-items:start;gap:${n}">
45
+ <div style="flex:1;font-family:${f};font-size:${p};padding:${e};background:var(--color-surface-raised,#f5f5f5);border-radius:${a};word-break:break-all;color:var(--color-text,#222)" class="gb-css-output">${t}</div>
46
+ ${o?`<button type="button" class="gb-copy"
47
+ style="all:unset;cursor:pointer;font-size:${p};padding:0.35rem 0.75rem;border:1px solid ${d};border-radius:4px;background:${y};white-space:nowrap;flex-shrink:0">Copy CSS</button>`:""}
48
+ </div>
49
+ </div>
50
+ </div>
51
+ `,this.#a()}#a(){this.querySelector(".gb-type")?.addEventListener("change",t=>{this.#e=t.target.value,this.#r(),this.#i()});let o=this.querySelector(".gb-angle"),s=this.querySelector(".gb-angle-value");o?.addEventListener("input",t=>{this.#o=Number(t.target.value),s&&(s.textContent=`${this.#o}\xB0`);let i=this.querySelector(".gb-preview");i&&(i.style.background=this.css),this.#i()}),this.querySelector(".gb-space")?.addEventListener("change",t=>{this.#s=t.target.value,this.#r(),this.#i()}),this.querySelectorAll(".gb-stop-color").forEach(t=>{t.addEventListener("input",i=>{let e=Number(i.target.dataset.i);this.#t[e].color=i.target.value,this.#n(),this.#i()})}),this.querySelectorAll(".gb-stop-pos-range").forEach(t=>{t.addEventListener("input",i=>{let e=Number(i.target.dataset.i),n=Math.max(0,Math.min(100,Number(i.target.value)||0));this.#t[e].position=n;let a=this.querySelector(`.gb-stop-pos-label[data-i="${e}"]`);a&&(a.textContent=`${n}%`),this.#n(),this.#i()})}),this.querySelectorAll(".gb-remove").forEach(t=>{t.addEventListener("click",i=>{let e=Number(i.target.dataset.i);this.#t.splice(e,1),this.#r(),this.#i()})}),this.querySelector(".gb-add")?.addEventListener("click",()=>{let t=this.#t[this.#t.length-1],i=this.#t[this.#t.length-2],e=Math.round((i.position+t.position)/2);this.#t.splice(this.#t.length-1,0,{color:"#888888",position:e}),this.#r(),this.#i()}),this.querySelector(".gb-copy")?.addEventListener("click",t=>{navigator.clipboard?.writeText(this.css);let i=t.target,e=i.textContent;i.textContent="Copied!",setTimeout(()=>{i.textContent=e},1500)})}#n(){let o=this.css,s=this.querySelector(".gb-preview");s&&(s.style.background=o);let t=this.querySelector(".gb-css-output");t&&(t.textContent=o)}#i(){this.dispatchEvent(new CustomEvent("gradient-builder:change",{bubbles:!0,detail:{css:this.css,stops:[...this.#t],type:this.#e,angle:this.#o,interpolation:this.#s}}))}};w("gradient-builder",m);export{m as GradientBuilder};
52
+ //# sourceMappingURL=gradient-builder.js.map
@@ -0,0 +1,3 @@
1
+ var C=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}setup(){}teardown(){}};var ot=window.matchMedia("(prefers-reduced-motion: reduce)");var M=new Map;function P(o,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=M.get(o);if(customElements.get(o)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}M.set(o,i),customElements.define(o,t)}function G(){let o=globalThis.localStorage;if(!o)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return o.getItem(t)},async setRaw(t,e){o.setItem(t,e)},async removeRaw(t){o.removeItem(t)},async keys(t){let e=[];for(let n=0;n<o.length;n++){let i=o.key(n);i&&i.startsWith(t)&&e.push(i)}return e}}}var S=null;function g(){return S||(S=G()),S}function N(o,t){if(typeof o!="string"||!o)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${o}:${t}`}function F(o){if(typeof o!="string"||!o)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${o}:`}function I(o){try{let t=JSON.parse(o);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var k={configure(o={}){S=o.backend??null},async set(o,t,e){let n={data:e,timestamp:Date.now()};await g().setRaw(N(o,t),JSON.stringify(n))},async get(o,t,e){let n=await g().getRaw(N(o,t));if(n==null)return null;let i=I(n);return!i||e?.maxAge!=null&&Date.now()-i.timestamp>e.maxAge?null:i.data},async remove(o,t){await g().removeRaw(N(o,t))},async list(o){let t=F(o),e=await g().keys(t),n=[];for(let i of e){let s=await g().getRaw(i);if(s==null)continue;let r=I(s);r&&n.push({key:i.slice(t.length),data:r.data,timestamp:r.timestamp})}return n},async clear(o){let t=F(o),e=await g().keys(t);for(let n of e)await g().removeRaw(n)},async clearAll(){let o=await g().keys("vb:");for(let t of o)await g().removeRaw(t)},async setMany(o,t){for(let[e,n]of t)await k.set(o,e,n)}};var $="[data-highlights]",q="highlights",j=["yellow","green","blue","pink"],D=8,O=8,J=typeof CSS<"u"&&"highlights"in CSS;function _(o){let t=2166136261;for(let e=0;e<o.length;e++)t^=o.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function z(){return"hn-"+crypto.randomUUID().slice(0,8)}function W(o,t){return getComputedStyle(o).getPropertyValue(`--highlight-${t}`).trim()}var v=null,w=0;function Y(o){if(v){w++;return}v=new CSSStyleSheet;let t=o.map(e=>`::highlight(hn-${e}) { background-color: var(--highlight-${e}); text-decoration-line: underline; text-decoration-color: var(--highlight-${e}); text-underline-offset: 2px; }`).join(`
2
+ `);v.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,v],w=1}function Q(){w--,w<=0&&v&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(o=>o!==v),v=null,w=0)}var d=null,x=null;function Z(){return d||(d=document.createElement("div"),d.className="hn-toolbar",d.setAttribute("role","toolbar"),d.setAttribute("aria-label","Highlight tools"),d.setAttribute("popover","auto"),d.hidden=!0,document.body.appendChild(d),d.addEventListener("toggle",o=>{o.newState==="closed"&&(d.hidden=!0,x=null)}),d)}function L(o,t,e){let n=Z();n.innerHTML="",x=t;let i=t.colors,s=t.element,r=e?.color,h=document.createElement("div");if(h.className="hn-swatches",h.setAttribute("role","group"),h.setAttribute("aria-label","Highlight colors"),i.forEach((a,l)=>{let c=document.createElement("button");c.type="button",c.className="hn-swatch",c.dataset.color=a,c.setAttribute("aria-label",`Highlight ${a}${r===a?" (current)":""}`),c.setAttribute("tabindex",l===0?"0":"-1");let f=W(s,a);f&&(c.style.backgroundColor=f),r===a&&c.setAttribute("aria-pressed","true"),c.addEventListener("click",()=>{e?t._changeColor(e.id,a):t._createFromSelection(a),E()}),h.appendChild(c)}),n.appendChild(h),e){let a=document.createElement("span");a.className="hn-separator",a.setAttribute("aria-hidden","true"),n.appendChild(a);let l=document.createElement("button");l.type="button",l.className="hn-action",l.textContent=e.note?"Edit Note":"Add Note",l.addEventListener("click",()=>{X(t,e),E()}),n.appendChild(l);let c=document.createElement("button");c.type="button",c.className="hn-action hn-action-remove",c.textContent="Remove",c.addEventListener("click",()=>{t.removeHighlight(e.id),E()}),n.appendChild(c)}h.addEventListener("keydown",a=>{let l=[...h.querySelectorAll("button")],c=l.indexOf(document.activeElement);if(c<0)return;let f=-1;if(a.key==="ArrowRight"||a.key==="ArrowDown")a.preventDefault(),f=(c+1)%l.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")a.preventDefault(),f=(c-1+l.length)%l.length;else if(a.key==="Escape"){E();return}f>=0&&(l[c].setAttribute("tabindex","-1"),l[f].setAttribute("tabindex","0"),l[f].focus())}),n.hidden=!1;try{n.showPopover()}catch{}tt(o),requestAnimationFrame(()=>{let a=n.querySelector(".hn-swatch");a&&a.focus()})}var u=null;function X(o,t){y();let e=o.element,n=b(e,t.startOffset,t.endOffset);if(!n)return;u=document.createElement("div"),u.className="hn-note-panel",u.setAttribute("role","dialog"),u.setAttribute("aria-label","Private note");let i=document.createElement("header");i.className="hn-note-header",i.innerHTML="<small>PRIVATE NOTE</small>",u.appendChild(i);let s=document.createElement("blockquote");s.className="hn-note-quote",s.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,u.appendChild(s);let r=document.createElement("textarea");r.className="hn-note-textarea",r.placeholder="Add a note\u2026",r.value=t.note||"",r.rows=3,r.setAttribute("aria-label","Note for highlighted text"),u.appendChild(r);let h=document.createElement("footer");h.className="hn-note-actions";let a=document.createElement("button");a.type="button",a.className="hn-action hn-action-save",a.textContent="Save",a.addEventListener("click",()=>{o._updateNote(t.id,r.value.trim()),y()});let l=document.createElement("button");l.type="button",l.className="hn-action",l.textContent="Cancel",l.addEventListener("click",()=>y()),h.append(a,l),u.appendChild(h),r.addEventListener("keydown",m=>{m.key==="Escape"&&(m.preventDefault(),y()),m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),o._updateNote(t.id,r.value.trim()),y())}),e.style.position="relative",e.appendChild(u);let c=n.getClientRects()[0],f=e.getBoundingClientRect();if(c){let m=c.top-f.top;u.style.top=`${m}px`}requestAnimationFrame(()=>{r.focus(),document.addEventListener("pointerdown",K)})}function K(o){u&&!u.contains(o.target)&&y()}function y(){u&&(document.removeEventListener("pointerdown",K),u.remove(),u=null)}function tt(o){d&&requestAnimationFrame(()=>{let t=d.getBoundingClientRect(),e=t.width||200,n=t.height||40,i=o.top-n-D,s=o.left+o.width/2-e/2;i<O&&(i=o.bottom+D);let r=window.innerWidth-e-O;s=Math.max(O,Math.min(s,r)),d.style.top=`${i}px`,d.style.left=`${s}px`})}function E(){if(d){try{d.hidePopover()}catch{}d.hidden=!0,x=null}}var p=null;function R(o){p||(p=document.createElement("div"),p.setAttribute("aria-live","polite"),p.setAttribute("aria-atomic","true"),p.className="hn-sr-only",document.body.appendChild(p)),p.textContent="",requestAnimationFrame(()=>{p.textContent=o})}function V(o,t,e){let n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT),i=0;for(;n.nextNode();){if(n.currentNode===t)return i+e;i+=(n.currentNode.textContent??"").length}return-1}function b(o,t,e){let n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT),i=0,s=null,r=0,h=null,a=0;for(;n.nextNode();){let l=n.currentNode,c=(l.textContent??"").length;if(!s&&i+c>t&&(s=l,r=t-i),i+c>=e){h=l,a=e-i;break}i+=c}if(!s||!h)return null;try{let l=document.createRange();return l.setStart(s,Math.min(r,(s.textContent??"").length)),l.setEnd(h,Math.min(a,(h.textContent??"").length)),l}catch{return null}}var B=class{#t;#o;#i;#n;#e=[];#a=!J;#l;#c;#h=!1;#d=[];constructor(t){this.#t=t,this.#n=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#o=e&&e!==""?e:location.pathname;let n=t.dataset.highlightsColors;this.#i=n?n.split(",").map(i=>i.trim()).filter(Boolean):[...j],this.#a||Y(this.#i),this.#r(),this.#n||(this.#l=this.#m.bind(this),this.#c=this.#p.bind(this),t.addEventListener("pointerup",this.#l),t.addEventListener("click",this.#c)),t.setAttribute("data-highlights-init",""),this.#y().then(()=>{this.#h||this.#r()})}get colors(){return[...this.#i]}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(n=>n.id===t);e<0||(this.#e.splice(e,1),this.#s(),this.#r(),this.#u("highlights:removed",{id:t}),R("Highlight removed"))}clearAll(){this.#e=[],this.#s(),this.#r()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#s(),this.#r()}catch{}}destroy(){if(!this.#h){if(this.#h=!0,this.#l&&this.#t.removeEventListener("pointerup",this.#l),this.#c&&this.#t.removeEventListener("click",this.#c),this.#a)this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()});else{for(let t of this.#i)CSS.highlights.delete(`hn-${t}`);Q()}this.#f(),this.#t.removeAttribute("data-highlights-init"),x===this&&E(),y()}}#m(){requestAnimationFrame(()=>{if(this.#h||this.#t.hasAttribute("data-selection-menu"))return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);if(!this.#t.contains(e.commonAncestorContainer))return;let n=e.getBoundingClientRect();L(n,this,null)})}#p(t){if(this.#t.hasAttribute("data-selection-menu"))return;let e=t.target.closest?.(".hn-margin-annotation");if(e){let i=e.dataset.hnId,s=this.#e.find(r=>r.id===i);if(s){X(this,s);return}}let n=t.target.closest?.("mark[data-hn-id]");if(n){let i=n.dataset.hnId,s=this.#e.find(r=>r.id===i);if(s){this.#u("highlights:clicked",{id:i});let r=n.getBoundingClientRect();L(r,this,s);return}}if(!this.#a){let i=this.#b(t.clientX,t.clientY);if(i){this.#u("highlights:clicked",{id:i.id});let s=b(this.#t,i.startOffset,i.endOffset);s&&L(s.getBoundingClientRect(),this,i)}}}#b(t,e){for(let n of this.#e){let i=b(this.#t,n.startOffset,n.endOffset);if(!i)continue;let s=i.getClientRects();for(let r of s)if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return n}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let n=e.getRangeAt(0);if(!this.#t.contains(n.commonAncestorContainer))return;let i=V(this.#t,n.startContainer,n.startOffset),s=V(this.#t,n.endContainer,n.endOffset);if(i<0||s<0||i>=s)return;let r=e.toString().trim(),h={id:z(),startOffset:i,endOffset:s,text:r,color:t,note:"",created:Date.now()};this.#e.push(h),this.#s(),this.#r(),e.removeAllRanges(),this.#u("highlights:added",{id:h.id,text:r,color:t,note:""}),R("Highlight added")}_changeColor(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.color=e,this.#s(),this.#r())}_updateNote(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.note=e,this.#s(),this.#g(),this.#u("highlights:note-changed",{id:t,note:e}),R("Note saved"))}async#y(){let t=await k.get(q,this.#o);if(!t||!Array.isArray(t.highlights))return;let e=_(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(n=>{let i=b(this.#t,n.startOffset,n.endOffset);return i?i.toString().trim()===n.text:!1}),this.#s()):this.#e=t.highlights}#s(){let t={version:1,contentHash:_(this.#t.textContent),highlights:this.#e};k.set(q,this.#o,t).catch(()=>{})}#r(){this.#a?this.#A():this.#v(),this.#g()}#v(){let t=new Map;for(let e of this.#i)t.set(e,[]);for(let e of this.#e){let n=b(this.#t,e.startOffset,e.endOffset);n&&t.has(e.color)&&t.get(e.color).push(n)}for(let[e,n]of t){let i=`hn-${e}`;n.length===0?CSS.highlights.delete(i):CSS.highlights.set(i,new Highlight(...n))}}#A(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let n=e.parentNode;for(;e.firstChild;)n.insertBefore(e.firstChild,e);n.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,n)=>n.startOffset-e.startOffset);for(let e of t){let n=b(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=W(this.#t,e.color),s=document.createElement("mark");s.dataset.hnId=e.id,s.dataset.hnColor=e.color,i&&(s.style.backgroundColor=i,s.style.textDecorationColor=i);try{n.surroundContents(s)}catch{let r=n.extractContents();s.appendChild(r),n.insertNode(s)}}}#f(){for(let t of this.#d)t.remove();this.#d=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let n=b(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=n.getClientRects();if(i.length===0)continue;let s=i[0],r=this.#t.getBoundingClientRect(),h=s.top-r.top,a=document.createElement("span");a.className="hn-margin-annotation",a.dataset.hnId=e.id,a.setAttribute("aria-hidden","true"),a.style.top=`${h}px`,e.note?(a.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',a.classList.add("hn-has-note")):a.textContent="You highlighted",this.#t.appendChild(a),this.#d.push(a)}}#u(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},T=new WeakMap;function A(o){if(T.has(o))return T.get(o);let t=new B(o);return T.set(o,t),t}function U(o=document){o.querySelectorAll($).forEach(t=>{t.hasAttribute("data-highlights-init")||A(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>U()):U();var et=new MutationObserver(o=>{for(let t of o)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=e;n.matches($)&&A(n),n.querySelectorAll($).forEach(i=>{i.hasAttribute("data-highlights-init")||A(i)})}});et.observe(document.documentElement,{childList:!0,subtree:!0});var nt=["yellow","green","blue","pink"],H=class extends C{#t=null;#o="yellow";#i=!1;#n=null;setup(){this.#i=!!this.closest("selection-menu"),this.#i?this.#e():this.#c()}teardown(){this.#t?.destroy(),this.#t=null,this.#n?.remove(),this.#n=null}#e(){let t=this.#d(),e=document.createElement("button");e.type="button",e.setAttribute("aria-label","Highlight selection");let n=document.createElement("icon-wc");n.setAttribute("name","highlighter"),n.setAttribute("size","sm"),n.setAttribute("aria-hidden","true"),e.appendChild(n),e.addEventListener("click",i=>{i.stopPropagation(),this.#a()}),this.appendChild(e),this.#n=document.createElement("div"),this.#n.className="highlight-color-dropdown",this.#n.setAttribute("role","group"),this.#n.setAttribute("aria-label","Highlight color"),this.#n.hidden=!0,t.forEach(i=>{let s=document.createElement("button");s.type="button",s.className="highlight-color-swatch",s.dataset.color=i,s.setAttribute("aria-label",`${i}`),s.setAttribute("aria-pressed",i===this.#o?"true":"false"),s.style.backgroundColor=`var(--highlight-${i})`,s.addEventListener("click",r=>{r.stopPropagation(),this.#o=i,this.#n.querySelectorAll(".highlight-color-swatch").forEach(h=>h.setAttribute("aria-pressed",h.dataset.color===i?"true":"false")),this.#n.hidden=!0,this.#l()}),this.#n.appendChild(s)}),this.appendChild(this.#n)}#a(){this.#n&&(this.#n.hidden=!this.#n.hidden)}#l(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection();if(!e)return;let n=e.target;if(n.hasAttribute("data-highlights-init"))this.#t||(this.#t=A(n));else{let i=this.getAttribute("storage-key")||"";n.setAttribute("data-highlights",i),this.hasAttribute("colors")&&n.setAttribute("data-highlights-colors",this.getAttribute("colors")),this.#t=A(n)}this.#t._createFromSelection(this.#o),t.dismiss()}#c(){let t=this.#h();if(!t)return!1;let e=this.getAttribute("storage-key")||"";t.setAttribute("data-highlights",e),this.hasAttribute("colors")&&t.setAttribute("data-highlights-colors",this.getAttribute("colors")),this.hasAttribute("readonly")&&t.setAttribute("data-highlights-readonly",""),this.#t=A(t)}#h(){let t=this.getAttribute("for");return t?document.getElementById(t):this.firstElementChild}#d(){let t=this.getAttribute("colors");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[...nt]}getHighlights(){return this.#t?.getHighlights()??[]}removeHighlight(t){this.#t?.removeHighlight(t)}clearAll(){this.#t?.clearAll()}exportHighlights(){return this.#t?.exportHighlights()??'{"version":1,"highlights":[]}'}importHighlights(t){this.#t?.importHighlights(t)}};P("highlight-wc",H);
3
+ //# sourceMappingURL=highlight-wc.js.map
@@ -7,6 +7,10 @@
7
7
  "file": "adr-wc.js",
8
8
  "size": 20859
9
9
  },
10
+ "analytics-panel": {
11
+ "file": "analytics-panel.js",
12
+ "size": 4731
13
+ },
10
14
  "audio-player": {
11
15
  "file": "audio-player.js",
12
16
  "size": 17509
@@ -15,6 +19,14 @@
15
19
  "file": "audio-visualizer.js",
16
20
  "size": 5143
17
21
  },
22
+ "author-index": {
23
+ "file": "author-index.js",
24
+ "size": 3649
25
+ },
26
+ "brand-mark": {
27
+ "file": "brand-mark.js",
28
+ "size": 3208
29
+ },
18
30
  "calendar-wc": {
19
31
  "file": "calendar-wc.js",
20
32
  "size": 16619
@@ -25,7 +37,7 @@
25
37
  },
26
38
  "carousel-wc": {
27
39
  "file": "carousel-wc.js",
28
- "size": 14193
40
+ "size": 14271
29
41
  },
30
42
  "change-set": {
31
43
  "file": "change-set.js",
@@ -45,7 +57,7 @@
45
57
  },
46
58
  "color-palette": {
47
59
  "file": "color-palette.js",
48
- "size": 4630
60
+ "size": 7335
49
61
  },
50
62
  "color-picker": {
51
63
  "file": "color-picker.js",
@@ -59,6 +71,10 @@
59
71
  "file": "command-palette.js",
60
72
  "size": 8226
61
73
  },
74
+ "comment-wc": {
75
+ "file": "comment-wc.js",
76
+ "size": 2292
77
+ },
62
78
  "compare-surface": {
63
79
  "file": "compare-surface.js",
64
80
  "size": 3245
@@ -69,7 +85,11 @@
69
85
  },
70
86
  "consent-banner": {
71
87
  "file": "consent-banner.js",
72
- "size": 3333
88
+ "size": 4827
89
+ },
90
+ "content-lens": {
91
+ "file": "content-lens.js",
92
+ "size": 3278
73
93
  },
74
94
  "content-swap": {
75
95
  "file": "content-swap.js",
@@ -111,6 +131,10 @@
111
131
  "file": "flow-diagram.js",
112
132
  "size": 6314
113
133
  },
134
+ "font-pairer": {
135
+ "file": "font-pairer.js",
136
+ "size": 20803
137
+ },
114
138
  "foot-notes": {
115
139
  "file": "foot-notes.js",
116
140
  "size": 3348
@@ -125,7 +149,7 @@
125
149
  },
126
150
  "geo-map": {
127
151
  "file": "geo-map.js",
128
- "size": 16571
152
+ "size": 17050
129
153
  },
130
154
  "glossary-index": {
131
155
  "file": "glossary-index.js",
@@ -135,10 +159,18 @@
135
159
  "file": "glossary-wc.js",
136
160
  "size": 9630
137
161
  },
162
+ "gradient-builder": {
163
+ "file": "gradient-builder.js",
164
+ "size": 8712
165
+ },
138
166
  "heading-links": {
139
167
  "file": "heading-links.js",
140
168
  "size": 3060
141
169
  },
170
+ "highlight-wc": {
171
+ "file": "highlight-wc.js",
172
+ "size": 17180
173
+ },
142
174
  "image-gallery": {
143
175
  "file": "image-gallery.js",
144
176
  "size": 14090
@@ -165,15 +197,23 @@
165
197
  },
166
198
  "markdown-viewer": {
167
199
  "file": "markdown-viewer.js",
168
- "size": 44627
200
+ "size": 44642
201
+ },
202
+ "motion-specimen": {
203
+ "file": "motion-specimen.js",
204
+ "size": 5400
205
+ },
206
+ "note-wc": {
207
+ "file": "note-wc.js",
208
+ "size": 15737
209
+ },
210
+ "notification-wc": {
211
+ "file": "notification-wc.js",
212
+ "size": 14814
169
213
  },
170
214
  "page-info": {
171
215
  "file": "page-info.js",
172
- "size": 4880
173
- },
174
- "page-meta": {
175
- "file": "page-meta.js",
176
- "size": 2255
216
+ "size": 11157
177
217
  },
178
218
  "page-stats": {
179
219
  "file": "page-stats.js",
@@ -181,7 +221,7 @@
181
221
  },
182
222
  "page-toc": {
183
223
  "file": "page-toc.js",
184
- "size": 4441
224
+ "size": 4674
185
225
  },
186
226
  "page-tools": {
187
227
  "file": "page-tools.js",
@@ -195,9 +235,13 @@
195
235
  "file": "palette-generator.js",
196
236
  "size": 8914
197
237
  },
238
+ "popularity-index": {
239
+ "file": "popularity-index.js",
240
+ "size": 3148
241
+ },
198
242
  "print-page": {
199
243
  "file": "print-page.js",
200
- "size": 2212
244
+ "size": 2584
201
245
  },
202
246
  "qr-code": {
203
247
  "file": "qr-code.js",
@@ -207,17 +251,29 @@
207
251
  "file": "reader-view.js",
208
252
  "size": 11161
209
253
  },
254
+ "recently-visited": {
255
+ "file": "recently-visited.js",
256
+ "size": 3755
257
+ },
210
258
  "review-surface": {
211
259
  "file": "review-surface.js",
212
- "size": 31077
260
+ "size": 32715
261
+ },
262
+ "selection-menu": {
263
+ "file": "selection-menu.js",
264
+ "size": 3000
265
+ },
266
+ "semantic-palette": {
267
+ "file": "semantic-palette.js",
268
+ "size": 14520
213
269
  },
214
270
  "settings-panel": {
215
271
  "file": "settings-panel.js",
216
- "size": 48817
272
+ "size": 51399
217
273
  },
218
274
  "share-wc": {
219
275
  "file": "share-wc.js",
220
- "size": 7656
276
+ "size": 8367
221
277
  },
222
278
  "short-cuts": {
223
279
  "file": "short-cuts.js",
@@ -249,11 +305,11 @@
249
305
  },
250
306
  "spacing-specimen": {
251
307
  "file": "spacing-specimen.js",
252
- "size": 2967
308
+ "size": 4269
253
309
  },
254
310
  "split-surface": {
255
311
  "file": "split-surface.js",
256
- "size": 4887
312
+ "size": 6467
257
313
  },
258
314
  "star-rating": {
259
315
  "file": "star-rating.js",
@@ -269,11 +325,15 @@
269
325
  },
270
326
  "text-reader": {
271
327
  "file": "text-reader.js",
272
- "size": 8886
328
+ "size": 11772
329
+ },
330
+ "theme-export": {
331
+ "file": "theme-export.js",
332
+ "size": 5108
273
333
  },
274
334
  "theme-picker": {
275
335
  "file": "theme-picker.js",
276
- "size": 36294
336
+ "size": 38944
277
337
  },
278
338
  "time-index": {
279
339
  "file": "time-index.js",
@@ -289,15 +349,23 @@
289
349
  },
290
350
  "token-specimen": {
291
351
  "file": "token-specimen.js",
292
- "size": 6550
352
+ "size": 9013
293
353
  },
294
354
  "tool-tip": {
295
355
  "file": "tool-tip.js",
296
356
  "size": 6004
297
357
  },
358
+ "topic-map": {
359
+ "file": "topic-map.js",
360
+ "size": 2990
361
+ },
362
+ "trust-filter": {
363
+ "file": "trust-filter.js",
364
+ "size": 4916
365
+ },
298
366
  "type-specimen": {
299
367
  "file": "type-specimen.js",
300
- "size": 3508
368
+ "size": 5320
301
369
  },
302
370
  "user-journey": {
303
371
  "file": "user-journey.js",
@@ -315,6 +383,10 @@
315
383
  "file": "video-player.js",
316
384
  "size": 31128
317
385
  },
386
+ "watch-wc": {
387
+ "file": "watch-wc.js",
388
+ "size": 21630
389
+ },
318
390
  "week-view": {
319
391
  "file": "week-view.js",
320
392
  "size": 6361
@@ -23,7 +23,7 @@ ${c}`:c;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
23
23
  `+u}f=!u.trim(),h+=D+`
24
24
  `,n=n.substring(D.length+1),g=A.slice(k)}}t.loose||(l?t.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(l=!0)),t.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),t.raw+=h}let o=t.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;t.raw=t.raw.trimEnd();for(let a of t.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 c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(a.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};a.checked=c.checked,t.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=c.raw+a.tokens[0].raw,a.tokens[0].text=c.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(c)):a.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):a.tokens.unshift(c)}}if(!t.loose){let h=a.tokens.filter(g=>g.type==="space"),c=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));t.loose=c}}if(t.loose)for(let a of t.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return t}}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 r=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"):"",t=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:s,title:t}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=ae(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),t=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
25
  `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.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<r.length;l++)i.header.push({text:r[l],tokens:this.lexer.inline(r[l]),header:!0,align:i.align[l]});for(let l of t)i.rows.push(ae(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 r=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let r=e[1].charAt(e[1].length-1)===`
26
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}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 r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let i=v(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{let i=st(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],t="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],t=i[3])}else t=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(r)?s=s.slice(1):s=s.slice(1,-1)),oe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:t&&t.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let r;if((r=this.rules.inline.reflink.exec(n))||(r=this.rules.inline.nolink.exec(n))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),t=e[s.toLowerCase()];if(!t){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return oe(r,t,r[0],this.lexer,this.rules)}}emStrong(n,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+t);(s=h.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])&&t%3&&!((t+l)%3)){a+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o+a);let c=[...s[0]][0].length,g=n.slice(0,t+s.index+c+l);if(Math.min(t,l)%2){let f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let u=g.slice(2,-2);return{type:"strong",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),t=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&t&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,r=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+t);(s=a.exec(e))!=null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==t))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let h=[...s[0]][0].length,c=n.slice(0,t+s.index+h+l),g=c.slice(t,-t);return{type:"del",raw:c,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let t;do t=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(t!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},x=class N{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new q,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 r={other:b,block:_.normal,inline:z.normal};this.options.pedantic?(r.block=_.pedantic,r.inline=z.pedantic):this.options.gfm&&(r.block=_.gfm,this.options.breaks?r.inline=z.breaks:r.inline=z.gfm),this.tokenizer.rules=r}static get rules(){return{block:_,inline:z}}static lex(e,r){return new N(r).lex(e)}static lexInline(e,r){return new N(r).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
26
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}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 r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let i=v(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{let i=st(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],t="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],t=i[3])}else t=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(r)?s=s.slice(1):s=s.slice(1,-1)),oe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:t&&t.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let r;if((r=this.rules.inline.reflink.exec(n))||(r=this.rules.inline.nolink.exec(n))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),t=e[s.toLowerCase()];if(!t){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return oe(r,t,r[0],this.lexer,this.rules)}}emStrong(n,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+t);(s=h.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])&&t%3&&!((t+l)%3)){a+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o+a);let c=[...s[0]][0].length,g=n.slice(0,t+s.index+c+l);if(Math.min(t,l)%2){let f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let u=g.slice(2,-2);return{type:"strong",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),t=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&t&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,r=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+t);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==t))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let h=[...s[0]][0].length,c=n.slice(0,t+s.index+h+l),g=c.slice(t,-t);return{type:"del",raw:c,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let t;do t=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(t!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},x=class N{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new q,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 r={other:b,block:_.normal,inline:z.normal};this.options.pedantic?(r.block=_.pedantic,r.inline=z.pedantic):this.options.gfm&&(r.block=_.gfm,this.options.breaks?r.inline=z.breaks:r.inline=z.gfm),this.tokenizer.rules=r}static get rules(){return{block:_,inline:z}}static lex(e,r){return new N(r).lex(e)}static lexInline(e,r){return new N(r).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
27
27
  `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let s=this.inlineQueue[r];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let t;if(this.options.extensions?.block?.some(l=>(t=l.call({lexer:this},e,r))?(e=e.substring(t.raw.length),r.push(t),!0):!1))continue;if(t=this.tokenizer.space(e)){e=e.substring(t.raw.length);let l=r.at(-1);t.raw.length===1&&l!==void 0?l.raw+=`
28
28
  `:r.push(t);continue}if(t=this.tokenizer.code(e)){e=e.substring(t.raw.length);let l=r.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
29
29
  `)?"":`
@@ -37,7 +37,7 @@ ${c}`:c;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
37
37
  `+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(t),s=i.length!==e.length,e=e.substring(t.raw.length);continue}if(t=this.tokenizer.text(e)){e=e.substring(t.raw.length);let l=r.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
38
38
  `)?"":`
39
39
  `)+t.raw,l.text+=`
40
- `+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(t);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,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let s=e,t=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(t=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(t[0].slice(t[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,t.index)+"["+"a".repeat(t[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(t=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,t.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(t=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)i=t[2]?t[2].length:0,s=s.slice(0,t.index+i)+"["+"a".repeat(t[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(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=r.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,g=e.slice(1),u;this.options.extensions.startInline.forEach(f=>{u=f.call({lexer:this},g),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(h)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}},I=class{options;parser;constructor(n){this.options=n||R}space(n){return""}code({text:n,lang:e,escaped:r}){let s=(e||"").match(b.notSpaceStart)?.[0],t=n.replace(b.endingNewline,"")+`
40
+ `+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(t);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,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let s=e,t=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(t=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.includes(t[0].slice(t[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,t.index)+"["+"a".repeat(t[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(t=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,t.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(t=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=t[2]?t[2].length:0,s=s.slice(0,t.index+i)+"["+"a".repeat(t[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(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=r.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,g=e.slice(1),u;this.options.extensions.startInline.forEach(f=>{u=f.call({lexer:this},g),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(h)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}},I=class{options;parser;constructor(n){this.options=n||R}space(n){return""}code({text:n,lang:e,escaped:r}){let s=(e||"").match(b.notSpaceStart)?.[0],t=n.replace(b.endingNewline,"")+`
41
41
  `;return s?'<pre><code class="language-'+w(s)+'">'+(r?t:w(t,!0))+`</code></pre>
42
42
  `:"<pre><code>"+(r?t:w(t,!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),r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+`</${r}>
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:r}){let s=this.parser.parseInline(r),t=le(n);if(t===null)return s;n=t;let i='<a href="'+n+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let t=le(n);if(t===null)return w(r);n=t;let i=`<img src="${n}" alt="${w(r)}"`;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)}},J=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}},m=class O{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new I,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J}static parse(e,r){return new O(r).parse(e)}static parseInline(e,r){return new O(r).parseInline(e)}parse(e){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let t=e[s];if(this.options.extensions?.renderers?.[t.type]){let l=t,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)){r+=o||"";continue}}let i=t;switch(i.type){case"space":{r+=this.renderer.space(i);break}case"hr":{r+=this.renderer.hr(i);break}case"heading":{r+=this.renderer.heading(i);break}case"code":{r+=this.renderer.code(i);break}case"table":{r+=this.renderer.table(i);break}case"blockquote":{r+=this.renderer.blockquote(i);break}case"list":{r+=this.renderer.list(i);break}case"checkbox":{r+=this.renderer.checkbox(i);break}case"html":{r+=this.renderer.html(i);break}case"def":{r+=this.renderer.def(i);break}case"paragraph":{r+=this.renderer.paragraph(i);break}case"text":{r+=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 r}parseInline(e,r=this.renderer){this.renderer.parser=this;let s="";for(let t=0;t<e.length;t++){let i=e[t];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+=r.text(l);break}case"html":{s+=r.html(l);break}case"link":{s+=r.link(l);break}case"image":{s+=r.image(l);break}case"checkbox":{s+=r.checkbox(l);break}case"strong":{s+=r.strong(l);break}case"em":{s+=r.em(l);break}case"codespan":{s+=r.codespan(l);break}case"br":{s+=r.br(l);break}case"del":{s+=r.del(l);break}case"text":{s+=r.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}},E=class{options;block;constructor(n){this.options=n||R}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(){return this.block?x.lex:x.lexInline}provideParser(){return this.block?m.parse:m.parseInline}},at=class{defaults=Q();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=m;Renderer=I;TextRenderer=J;Lexer=x;Tokenizer=q;Hooks=E;constructor(...n){this.use(...n)}walkTokens(n,e){let r=[];for(let s of n)switch(r=r.concat(e.call(this,s)),s.type){case"table":{let t=s;for(let i of t.header)r=r.concat(this.walkTokens(i.tokens,e));for(let i of t.rows)for(let l of i)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{let t=s;r=r.concat(this.walkTokens(t.items,e));break}default:{let t=s;this.defaults.extensions?.childTokens?.[t.type]?this.defaults.extensions.childTokens[t.type].forEach(i=>{let l=t[i].flat(1/0);r=r.concat(this.walkTokens(l,e))}):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){let i=e.renderers[t.name];i?e.renderers[t.name]=function(...l){let o=t.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[t.name]=t.renderer}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[t.level];i?i.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&(t.level==="block"?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:t.level==="inline"&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),s.extensions=e),r.renderer){let t=this.defaults.renderer||new I(this.defaults);for(let i in r.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=r.renderer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c||""}}s.renderer=t}if(r.tokenizer){let t=this.defaults.tokenizer||new q(this.defaults);for(let i in r.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=r.tokenizer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.tokenizer=t}if(r.hooks){let t=this.defaults.hooks||new E;for(let i in r.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=r.hooks[l],a=t[l];E.passThroughHooks.has(i)?t[l]=h=>{if(this.defaults.async&&E.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await o.call(t,h);return a.call(t,g)})();let c=o.call(t,h);return a.call(t,c)}:t[l]=(...h)=>{if(this.defaults.async)return(async()=>{let g=await o.apply(t,h);return g===!1&&(g=await a.apply(t,h)),g})();let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.hooks=t}if(r.walkTokens){let t=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),t&&(o=o.concat(t.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return x.lex(n,e??this.defaults)}parser(n,e){return m.parse(n,e??this.defaults)}parseMarkdown(n){return(e,r)=>{let s={...r},t={...this.defaults,...s},i=this.onError(!!t.silent,!!t.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(t.hooks&&(t.hooks.options=t,t.hooks.block=n),t.async)return(async()=>{let l=t.hooks?await t.hooks.preprocess(e):e,o=await(t.hooks?await t.hooks.provideLexer():n?x.lex:x.lexInline)(l,t),a=t.hooks?await t.hooks.processAllTokens(o):o;t.walkTokens&&await Promise.all(this.walkTokens(a,t.walkTokens));let h=await(t.hooks?await t.hooks.provideParser():n?m.parse:m.parseInline)(a,t);return t.hooks?await t.hooks.postprocess(h):h})().catch(i);try{t.hooks&&(e=t.hooks.preprocess(e));let l=(t.hooks?t.hooks.provideLexer():n?x.lex:x.lexInline)(e,t);t.hooks&&(l=t.hooks.processAllTokens(l)),t.walkTokens&&this.walkTokens(l,t.walkTokens);let o=(t.hooks?t.hooks.provideParser():n?m.parse:m.parseInline)(l,t);return t.hooks&&(o=t.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(n,e){return r=>{if(r.message+=`
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:r}){let s=this.parser.parseInline(r),t=le(n);if(t===null)return s;n=t;let i='<a href="'+n+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let t=le(n);if(t===null)return w(r);n=t;let i=`<img src="${n}" alt="${w(r)}"`;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)}},J=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}},m=class O{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new I,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J}static parse(e,r){return new O(r).parse(e)}static parseInline(e,r){return new O(r).parseInline(e)}parse(e){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let t=e[s];if(this.options.extensions?.renderers?.[t.type]){let l=t,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)){r+=o||"";continue}}let i=t;switch(i.type){case"space":{r+=this.renderer.space(i);break}case"hr":{r+=this.renderer.hr(i);break}case"heading":{r+=this.renderer.heading(i);break}case"code":{r+=this.renderer.code(i);break}case"table":{r+=this.renderer.table(i);break}case"blockquote":{r+=this.renderer.blockquote(i);break}case"list":{r+=this.renderer.list(i);break}case"checkbox":{r+=this.renderer.checkbox(i);break}case"html":{r+=this.renderer.html(i);break}case"def":{r+=this.renderer.def(i);break}case"paragraph":{r+=this.renderer.paragraph(i);break}case"text":{r+=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 r}parseInline(e,r=this.renderer){this.renderer.parser=this;let s="";for(let t=0;t<e.length;t++){let i=e[t];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+=r.text(l);break}case"html":{s+=r.html(l);break}case"link":{s+=r.link(l);break}case"image":{s+=r.image(l);break}case"checkbox":{s+=r.checkbox(l);break}case"strong":{s+=r.strong(l);break}case"em":{s+=r.em(l);break}case"codespan":{s+=r.codespan(l);break}case"br":{s+=r.br(l);break}case"del":{s+=r.del(l);break}case"text":{s+=r.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}},E=class{options;block;constructor(n){this.options=n||R}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?x.lex:x.lexInline}provideParser(n=this.block){return n?m.parse:m.parseInline}},at=class{defaults=Q();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=m;Renderer=I;TextRenderer=J;Lexer=x;Tokenizer=q;Hooks=E;constructor(...n){this.use(...n)}walkTokens(n,e){let r=[];for(let s of n)switch(r=r.concat(e.call(this,s)),s.type){case"table":{let t=s;for(let i of t.header)r=r.concat(this.walkTokens(i.tokens,e));for(let i of t.rows)for(let l of i)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{let t=s;r=r.concat(this.walkTokens(t.items,e));break}default:{let t=s;this.defaults.extensions?.childTokens?.[t.type]?this.defaults.extensions.childTokens[t.type].forEach(i=>{let l=t[i].flat(1/0);r=r.concat(this.walkTokens(l,e))}):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){let i=e.renderers[t.name];i?e.renderers[t.name]=function(...l){let o=t.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[t.name]=t.renderer}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[t.level];i?i.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&(t.level==="block"?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:t.level==="inline"&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),s.extensions=e),r.renderer){let t=this.defaults.renderer||new I(this.defaults);for(let i in r.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=r.renderer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c||""}}s.renderer=t}if(r.tokenizer){let t=this.defaults.tokenizer||new q(this.defaults);for(let i in r.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=r.tokenizer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.tokenizer=t}if(r.hooks){let t=this.defaults.hooks||new E;for(let i in r.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=r.hooks[l],a=t[l];E.passThroughHooks.has(i)?t[l]=h=>{if(this.defaults.async&&E.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await o.call(t,h);return a.call(t,g)})();let c=o.call(t,h);return a.call(t,c)}:t[l]=(...h)=>{if(this.defaults.async)return(async()=>{let g=await o.apply(t,h);return g===!1&&(g=await a.apply(t,h)),g})();let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.hooks=t}if(r.walkTokens){let t=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),t&&(o=o.concat(t.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return x.lex(n,e??this.defaults)}parser(n,e){return m.parse(n,e??this.defaults)}parseMarkdown(n){return(e,r)=>{let s={...r},t={...this.defaults,...s},i=this.onError(!!t.silent,!!t.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(t.hooks&&(t.hooks.options=t,t.hooks.block=n),t.async)return(async()=>{let l=t.hooks?await t.hooks.preprocess(e):e,o=await(t.hooks?await t.hooks.provideLexer(n):n?x.lex:x.lexInline)(l,t),a=t.hooks?await t.hooks.processAllTokens(o):o;t.walkTokens&&await Promise.all(this.walkTokens(a,t.walkTokens));let h=await(t.hooks?await t.hooks.provideParser(n):n?m.parse:m.parseInline)(a,t);return t.hooks?await t.hooks.postprocess(h):h})().catch(i);try{t.hooks&&(e=t.hooks.preprocess(e));let l=(t.hooks?t.hooks.provideLexer(n):n?x.lex:x.lexInline)(e,t);t.hooks&&(l=t.hooks.processAllTokens(l)),t.walkTokens&&this.walkTokens(l,t.walkTokens);let o=(t.hooks?t.hooks.provideParser(n):n?m.parse:m.parseInline)(l,t);return t.hooks&&(o=t.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(n,e){return r=>{if(r.message+=`
59
59
  Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+w(r.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(r);throw r}}},S=new at;function d(n,e){return S.parse(n,e)}d.options=d.setOptions=function(n){return S.setOptions(n),d.defaults=S.defaults,ce(d.defaults),d};d.getDefaults=Q;d.defaults=R;d.use=function(...n){return S.use(...n),d.defaults=S.defaults,ce(d.defaults),d};d.walkTokens=function(n,e){return S.walkTokens(n,e)};d.parseInline=S.parseInline;d.Parser=m;d.parser=m.parse;d.Renderer=I;d.TextRenderer=J;d.Lexer=x;d.lexer=x.lex;d.Tokenizer=q;d.Hooks=E;d.parse=d;var pt=d.options,ut=d.setOptions,gt=d.use,dt=d.walkTokens,kt=d.parseInline;var ft=m.parse,bt=x.lex;var K=class extends C{#t=null;#n=null;#e=null;static get observedAttributes(){return["src"]}setup(){this.#s()}teardown(){this.#n?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,r,s){e==="src"&&s&&r!==s&&this.isConnected&&this.#s()}get parser(){return this.#t}set parser(e){this.#t=typeof e=="function"?e:null}async render(){await this.#s()}async reload(){this.getAttribute("src")&&await this.#s()}#i(){if(this.getAttribute("src"))return null;let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let r=this.querySelector("template[data-md]");if(r)return r.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}async#s(){let e=this.getAttribute("src"),r;if(this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),e){this.#n?.abort(),this.#n=new AbortController,this.setAttribute("data-loading",""),this.#r("markdown-viewer:fetch",{src:e});try{let i=await fetch(e,{signal:this.#n.signal});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);r=await i.text()}catch(i){if(i.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#r("markdown-viewer:error",{error:i.message});return}this.removeAttribute("data-loading")}else r=this.#i();if(r==null)return;let s;try{s=await(await this.#l())(r)}catch(i){this.setAttribute("data-error",""),this.#r("markdown-viewer:error",{error:i.message});return}this.#e||(this.#e=document.createElement("div"),this.#e.className="md-content",this.#e.setAttribute("part","content"),this.appendChild(this.#e)),this.#e.innerHTML=s,this.#a(),this.setAttribute("data-rendered","");let t=this.getAttribute("ping");if(t&&navigator.sendBeacon?.(t,JSON.stringify({src:e||"inline"})),this.#r("markdown-viewer:rendered",{src:e,node:this.#e}),this.hasAttribute("highlight"))for(let i of this.#e.querySelectorAll('pre > code[class*="language-"]')){let l=i.className.match(/language-(\S+)/)?.[1]||"";this.#r("markdown-viewer:highlight",{node:i,language:l})}}async#l(){return this.#t?this.#t:e=>d.parse(e,{gfm:!0})}#a(){if(!this.#e)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#e.dataset.theme=e)}#r(e,r){this.dispatchEvent(new CustomEvent(e,{detail:r,bubbles:!0,composed:!0}))}};re("markdown-viewer",K);export{K as MarkdownViewer};
60
60
  //# sourceMappingURL=markdown-viewer.js.map
@@ -0,0 +1,21 @@
1
+ var w=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function f(i,t,n={}){let s=n.priority??10,r={impl:t,bundle:n.bundle,contract:n.contract,priority:s},e=m.get(i);if(customElements.get(i)){if(!e||e.priority>=s){e&&e.priority===s&&e.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${e.bundle}" (priority ${e.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${e.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(e&&e.priority>=s){e.priority===s&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${e.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(i,r),customElements.define(i,t)}var l=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,n,s,r){t.addEventListener(n,s,r),this.#e.push(()=>t.removeEventListener(n,s,r))}setup(){}teardown(){}};var g="1,2,3,4,5,in-1,in-2,in-3,out-1,out-2,out-3,out-4,out-5,elastic-1,elastic-2,squish-1,squish-2",v="instant,fast,normal,slow,slower",p="ms-keyframes",E=`
2
+ @keyframes ms-slide { from { inset-inline-start: 0 } to { inset-inline-start: calc(100% - 1rem) } }
3
+ @keyframes ms-fill { 0% { transform: scaleX(0) } 60% { transform: scaleX(1) } 100% { transform: scaleX(1); opacity: 0.3 } }
4
+ @media (prefers-reduced-motion: reduce) {
5
+ motion-specimen .ms-dot { animation: none !important; inset-inline-start: calc(50% - 0.5rem) !important }
6
+ motion-specimen .ms-bar-fill { animation: none !important; transform: scaleX(0.6) !important; opacity: 0.6 !important }
7
+ }
8
+ `;function k(){if(typeof document>"u"||document.getElementById(p))return;let i=document.createElement("style");i.id=p,i.textContent=E,document.head.append(i)}var b="var(--font-mono, monospace)",h="var(--color-text-muted, #666)",y="var(--color-interactive, oklch(55% 0.2 260))",$="var(--color-surface-sunken, #f1f1f1)",u=class extends l{static observedAttributes=["type","tokens","prefix","duration","show-values","label"];setup(){k(),this.#e()}attributeChangedCallback(){this.isConnected&&this.hasAttribute("data-upgraded")&&this.#e()}#e(){let t=this.getAttribute("type")||"easing",n=this.getAttribute("duration")||"1.2s",s=this.getAttribute("show-values")!=="false",r=this.getAttribute("label")||"",e="";r&&(e+=`<p style="font-weight:600;margin:0 0 var(--size-s,0.75rem)">${r}</p>`),(t==="easing"||t==="both")&&(e+=this.#r(n,s)),(t==="duration"||t==="both")&&(t==="both"&&(e+='<div aria-hidden="true" style="block-size:var(--size-m,1rem)"></div>'),e+=this.#o(s)),this.innerHTML=e,s&&requestAnimationFrame(()=>this.#a())}#t(){return"display:grid;grid-template-columns:5rem 1fr auto;align-items:center;gap:var(--size-s,0.75rem);min-block-size:1.75rem"}#n(){return`font-family:${b};font-size:var(--font-size-sm,0.875rem);color:${h};text-align:end`}#s(){return`font-family:${b};font-size:var(--font-size-xs,0.75rem);color:${h};font-variant-numeric:tabular-nums;white-space:nowrap`}#i(){return"list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--size-2xs,0.375rem)"}#r(t,n){let s=(this.getAttribute("tokens")||g).split(",").map(o=>o.trim()),r=this.getAttribute("prefix")||"--ease-",e=`position:relative;display:block;block-size:0.5rem;background:${$};border-radius:999px`,c=`position:absolute;inset-block-start:50%;inset-inline-start:0;inline-size:1rem;block-size:1rem;background:${y};border-radius:50%;transform:translateY(-50%)`,a=s.map(o=>{let d=`${r}${o}`;return`<li class="ms-row ms-row-ease" role="listitem" style="${this.#t()}">
9
+ <span style="${this.#n()}">${o}</span>
10
+ <span style="${e}" aria-hidden="true">
11
+ <span class="ms-dot" style="${c};animation: ms-slide ${t} var(${d}) infinite alternate"></span>
12
+ </span>
13
+ ${n?`<span class="ms-value" data-var="${d}" style="${this.#s()}"></span>`:""}
14
+ </li>`}).join("");return`<ul class="ms-list" role="list" aria-label="Easing scale" style="${this.#i()}">${a}</ul>`}#o(t){let n=(this.getAttribute("tokens")||v).split(",").map(a=>a.trim()),s=this.getAttribute("prefix")||"--duration-",r=`position:relative;display:block;block-size:0.5rem;background:${$};border-radius:999px;overflow:hidden`,e=`position:absolute;inset-block:0;inset-inline-start:0;inline-size:100%;background:${y};transform-origin:left center;animation-name:ms-fill;animation-iteration-count:infinite;animation-timing-function:linear`,c=n.map(a=>{let o=`${s}${a}`;return`<li class="ms-row ms-row-dur" role="listitem" style="${this.#t()}">
15
+ <span style="${this.#n()}">${a}</span>
16
+ <span style="${r}" aria-hidden="true">
17
+ <span class="ms-bar-fill" style="${e};animation-duration: var(${o})"></span>
18
+ </span>
19
+ ${t?`<span class="ms-value" data-var="${o}" style="${this.#s()}"></span>`:""}
20
+ </li>`}).join("");return`<ul class="ms-list" role="list" aria-label="Duration scale" style="${this.#i()}">${c}</ul>`}#a(){this.querySelectorAll(".ms-value").forEach(t=>{let n=t.getAttribute("data-var");if(!n)return;let s=getComputedStyle(this).getPropertyValue(n).trim();t.textContent=s||"\u2014"})}};f("motion-specimen",u);
21
+ //# sourceMappingURL=motion-specimen.js.map
@@ -0,0 +1,3 @@
1
+ var S=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}setup(){}teardown(){}};var it=window.matchMedia("(prefers-reduced-motion: reduce)");var P=new Map;function F(o,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=P.get(o);if(customElements.get(o)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}P.set(o,i),customElements.define(o,t)}function j(){let o=globalThis.localStorage;if(!o)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return o.getItem(t)},async setRaw(t,e){o.setItem(t,e)},async removeRaw(t){o.removeItem(t)},async keys(t){let e=[];for(let n=0;n<o.length;n++){let i=o.key(n);i&&i.startsWith(t)&&e.push(i)}return e}}}var k=null;function g(){return k||(k=j()),k}function O(o,t){if(typeof o!="string"||!o)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${o}:${t}`}function I(o){if(typeof o!="string"||!o)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${o}:`}function q(o){try{let t=JSON.parse(o);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var x={configure(o={}){k=o.backend??null},async set(o,t,e){let n={data:e,timestamp:Date.now()};await g().setRaw(O(o,t),JSON.stringify(n))},async get(o,t,e){let n=await g().getRaw(O(o,t));if(n==null)return null;let i=q(n);return!i||e?.maxAge!=null&&Date.now()-i.timestamp>e.maxAge?null:i.data},async remove(o,t){await g().removeRaw(O(o,t))},async list(o){let t=I(o),e=await g().keys(t),n=[];for(let i of e){let s=await g().getRaw(i);if(s==null)continue;let r=q(s);r&&n.push({key:i.slice(t.length),data:r.data,timestamp:r.timestamp})}return n},async clear(o){let t=I(o),e=await g().keys(t);for(let n of e)await g().removeRaw(n)},async clearAll(){let o=await g().keys("vb:");for(let t of o)await g().removeRaw(t)},async setMany(o,t){for(let[e,n]of t)await x.set(o,e,n)}};var M="[data-highlights]",D="highlights",J=["yellow","green","blue","pink"],_=8,L=8,K=typeof CSS<"u"&&"highlights"in CSS;function V(o){let t=2166136261;for(let e=0;e<o.length;e++)t^=o.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function z(){return"hn-"+crypto.randomUUID().slice(0,8)}function U(o,t){return getComputedStyle(o).getPropertyValue(`--highlight-${t}`).trim()}var v=null,A=0;function Y(o){if(v){A++;return}v=new CSSStyleSheet;let t=o.map(e=>`::highlight(hn-${e}) { background-color: var(--highlight-${e}); text-decoration-line: underline; text-decoration-color: var(--highlight-${e}); text-underline-offset: 2px; }`).join(`
2
+ `);v.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,v],A=1}function Q(){A--,A<=0&&v&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(o=>o!==v),v=null,A=0)}var d=null,N=null;function Z(){return d||(d=document.createElement("div"),d.className="hn-toolbar",d.setAttribute("role","toolbar"),d.setAttribute("aria-label","Highlight tools"),d.setAttribute("popover","auto"),d.hidden=!0,document.body.appendChild(d),d.addEventListener("toggle",o=>{o.newState==="closed"&&(d.hidden=!0,N=null)}),d)}function R(o,t,e){let n=Z();n.innerHTML="",N=t;let i=t.colors,s=t.element,r=e?.color,l=document.createElement("div");if(l.className="hn-swatches",l.setAttribute("role","group"),l.setAttribute("aria-label","Highlight colors"),i.forEach((a,c)=>{let h=document.createElement("button");h.type="button",h.className="hn-swatch",h.dataset.color=a,h.setAttribute("aria-label",`Highlight ${a}${r===a?" (current)":""}`),h.setAttribute("tabindex",c===0?"0":"-1");let f=U(s,a);f&&(h.style.backgroundColor=f),r===a&&h.setAttribute("aria-pressed","true"),h.addEventListener("click",()=>{e?t._changeColor(e.id,a):t._createFromSelection(a),C()}),l.appendChild(h)}),n.appendChild(l),e){let a=document.createElement("span");a.className="hn-separator",a.setAttribute("aria-hidden","true"),n.appendChild(a);let c=document.createElement("button");c.type="button",c.className="hn-action",c.textContent=e.note?"Edit Note":"Add Note",c.addEventListener("click",()=>{w(t,e),C()}),n.appendChild(c);let h=document.createElement("button");h.type="button",h.className="hn-action hn-action-remove",h.textContent="Remove",h.addEventListener("click",()=>{t.removeHighlight(e.id),C()}),n.appendChild(h)}l.addEventListener("keydown",a=>{let c=[...l.querySelectorAll("button")],h=c.indexOf(document.activeElement);if(h<0)return;let f=-1;if(a.key==="ArrowRight"||a.key==="ArrowDown")a.preventDefault(),f=(h+1)%c.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")a.preventDefault(),f=(h-1+c.length)%c.length;else if(a.key==="Escape"){C();return}f>=0&&(c[h].setAttribute("tabindex","-1"),c[f].setAttribute("tabindex","0"),c[f].focus())}),n.hidden=!1;try{n.showPopover()}catch{}tt(o),requestAnimationFrame(()=>{let a=n.querySelector(".hn-swatch");a&&a.focus()})}var u=null;function w(o,t){y();let e=o.element,n=b(e,t.startOffset,t.endOffset);if(!n)return;u=document.createElement("div"),u.className="hn-note-panel",u.setAttribute("role","dialog"),u.setAttribute("aria-label","Private note");let i=document.createElement("header");i.className="hn-note-header",i.innerHTML="<small>PRIVATE NOTE</small>",u.appendChild(i);let s=document.createElement("blockquote");s.className="hn-note-quote",s.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,u.appendChild(s);let r=document.createElement("textarea");r.className="hn-note-textarea",r.placeholder="Add a note\u2026",r.value=t.note||"",r.rows=3,r.setAttribute("aria-label","Note for highlighted text"),u.appendChild(r);let l=document.createElement("footer");l.className="hn-note-actions";let a=document.createElement("button");a.type="button",a.className="hn-action hn-action-save",a.textContent="Save",a.addEventListener("click",()=>{o._updateNote(t.id,r.value.trim()),y()});let c=document.createElement("button");c.type="button",c.className="hn-action",c.textContent="Cancel",c.addEventListener("click",()=>y()),l.append(a,c),u.appendChild(l),r.addEventListener("keydown",m=>{m.key==="Escape"&&(m.preventDefault(),y()),m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),o._updateNote(t.id,r.value.trim()),y())}),e.style.position="relative",e.appendChild(u);let h=n.getClientRects()[0],f=e.getBoundingClientRect();if(h){let m=h.top-f.top;u.style.top=`${m}px`}requestAnimationFrame(()=>{r.focus(),document.addEventListener("pointerdown",G)})}function G(o){u&&!u.contains(o.target)&&y()}function y(){u&&(document.removeEventListener("pointerdown",G),u.remove(),u=null)}function tt(o){d&&requestAnimationFrame(()=>{let t=d.getBoundingClientRect(),e=t.width||200,n=t.height||40,i=o.top-n-_,s=o.left+o.width/2-e/2;i<L&&(i=o.bottom+_);let r=window.innerWidth-e-L;s=Math.max(L,Math.min(s,r)),d.style.top=`${i}px`,d.style.left=`${s}px`})}function C(){if(d){try{d.hidePopover()}catch{}d.hidden=!0,N=null}}var p=null;function T(o){p||(p=document.createElement("div"),p.setAttribute("aria-live","polite"),p.setAttribute("aria-atomic","true"),p.className="hn-sr-only",document.body.appendChild(p)),p.textContent="",requestAnimationFrame(()=>{p.textContent=o})}function W(o,t,e){let n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT),i=0;for(;n.nextNode();){if(n.currentNode===t)return i+e;i+=(n.currentNode.textContent??"").length}return-1}function b(o,t,e){let n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT),i=0,s=null,r=0,l=null,a=0;for(;n.nextNode();){let c=n.currentNode,h=(c.textContent??"").length;if(!s&&i+h>t&&(s=c,r=t-i),i+h>=e){l=c,a=e-i;break}i+=h}if(!s||!l)return null;try{let c=document.createRange();return c.setStart(s,Math.min(r,(s.textContent??"").length)),c.setEnd(l,Math.min(a,(l.textContent??"").length)),c}catch{return null}}var B=class{#t;#s;#n;#u;#e=[];#a=!K;#c;#l;#h=!1;#d=[];constructor(t){this.#t=t,this.#u=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#s=e&&e!==""?e:location.pathname;let n=t.dataset.highlightsColors;this.#n=n?n.split(",").map(i=>i.trim()).filter(Boolean):[...J],this.#a||Y(this.#n),this.#o(),this.#u||(this.#c=this.#m.bind(this),this.#l=this.#p.bind(this),t.addEventListener("pointerup",this.#c),t.addEventListener("click",this.#l)),t.setAttribute("data-highlights-init",""),this.#y().then(()=>{this.#h||this.#o()})}get colors(){return[...this.#n]}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(n=>n.id===t);e<0||(this.#e.splice(e,1),this.#i(),this.#o(),this.#r("highlights:removed",{id:t}),T("Highlight removed"))}clearAll(){this.#e=[],this.#i(),this.#o()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#i(),this.#o()}catch{}}destroy(){if(!this.#h){if(this.#h=!0,this.#c&&this.#t.removeEventListener("pointerup",this.#c),this.#l&&this.#t.removeEventListener("click",this.#l),this.#a)this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()});else{for(let t of this.#n)CSS.highlights.delete(`hn-${t}`);Q()}this.#f(),this.#t.removeAttribute("data-highlights-init"),N===this&&C(),y()}}#m(){requestAnimationFrame(()=>{if(this.#h||this.#t.hasAttribute("data-selection-menu"))return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);if(!this.#t.contains(e.commonAncestorContainer))return;let n=e.getBoundingClientRect();R(n,this,null)})}#p(t){if(this.#t.hasAttribute("data-selection-menu"))return;let e=t.target.closest?.(".hn-margin-annotation");if(e){let i=e.dataset.hnId,s=this.#e.find(r=>r.id===i);if(s){w(this,s);return}}let n=t.target.closest?.("mark[data-hn-id]");if(n){let i=n.dataset.hnId,s=this.#e.find(r=>r.id===i);if(s){this.#r("highlights:clicked",{id:i});let r=n.getBoundingClientRect();R(r,this,s);return}}if(!this.#a){let i=this.#b(t.clientX,t.clientY);if(i){this.#r("highlights:clicked",{id:i.id});let s=b(this.#t,i.startOffset,i.endOffset);s&&R(s.getBoundingClientRect(),this,i)}}}#b(t,e){for(let n of this.#e){let i=b(this.#t,n.startOffset,n.endOffset);if(!i)continue;let s=i.getClientRects();for(let r of s)if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return n}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let n=e.getRangeAt(0);if(!this.#t.contains(n.commonAncestorContainer))return;let i=W(this.#t,n.startContainer,n.startOffset),s=W(this.#t,n.endContainer,n.endOffset);if(i<0||s<0||i>=s)return;let r=e.toString().trim(),l={id:z(),startOffset:i,endOffset:s,text:r,color:t,note:"",created:Date.now()};this.#e.push(l),this.#i(),this.#o(),e.removeAllRanges(),this.#r("highlights:added",{id:l.id,text:r,color:t,note:""}),T("Highlight added")}_changeColor(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.color=e,this.#i(),this.#o())}_updateNote(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.note=e,this.#i(),this.#g(),this.#r("highlights:note-changed",{id:t,note:e}),T("Note saved"))}async#y(){let t=await x.get(D,this.#s);if(!t||!Array.isArray(t.highlights))return;let e=V(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(n=>{let i=b(this.#t,n.startOffset,n.endOffset);return i?i.toString().trim()===n.text:!1}),this.#i()):this.#e=t.highlights}#i(){let t={version:1,contentHash:V(this.#t.textContent),highlights:this.#e};x.set(D,this.#s,t).catch(()=>{})}#o(){this.#a?this.#E():this.#v(),this.#g()}#v(){let t=new Map;for(let e of this.#n)t.set(e,[]);for(let e of this.#e){let n=b(this.#t,e.startOffset,e.endOffset);n&&t.has(e.color)&&t.get(e.color).push(n)}for(let[e,n]of t){let i=`hn-${e}`;n.length===0?CSS.highlights.delete(i):CSS.highlights.set(i,new Highlight(...n))}}#E(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let n=e.parentNode;for(;e.firstChild;)n.insertBefore(e.firstChild,e);n.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,n)=>n.startOffset-e.startOffset);for(let e of t){let n=b(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=U(this.#t,e.color),s=document.createElement("mark");s.dataset.hnId=e.id,s.dataset.hnColor=e.color,i&&(s.style.backgroundColor=i,s.style.textDecorationColor=i);try{n.surroundContents(s)}catch{let r=n.extractContents();s.appendChild(r),n.insertNode(s)}}}#f(){for(let t of this.#d)t.remove();this.#d=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let n=b(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=n.getClientRects();if(i.length===0)continue;let s=i[0],r=this.#t.getBoundingClientRect(),l=s.top-r.top,a=document.createElement("span");a.className="hn-margin-annotation",a.dataset.hnId=e.id,a.setAttribute("aria-hidden","true"),a.style.top=`${l}px`,e.note?(a.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',a.classList.add("hn-has-note")):a.textContent="You highlighted",this.#t.appendChild(a),this.#d.push(a)}}#r(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},$=new WeakMap;function E(o){if($.has(o))return $.get(o);let t=new B(o);return $.set(o,t),t}function X(o=document){o.querySelectorAll(M).forEach(t=>{t.hasAttribute("data-highlights-init")||E(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>X()):X();var et=new MutationObserver(o=>{for(let t of o)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=e;n.matches(M)&&E(n),n.querySelectorAll(M).forEach(i=>{i.hasAttribute("data-highlights-init")||E(i)})}});et.observe(document.documentElement,{childList:!0,subtree:!0});var H=class extends S{#t=!1;setup(){this.#t=!!this.closest("selection-menu");let t=document.createElement("button");t.type="button",t.setAttribute("aria-label",this.#t?"Add private note":"View notes");let e=document.createElement("icon-wc");e.setAttribute("name","sticky-note"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),t.appendChild(e),this.#t?t.addEventListener("click",()=>this.#s()):t.addEventListener("click",()=>this.#n()),this.appendChild(t)}#s(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection();if(!e)return;let n=e.target;n.hasAttribute("data-highlights-init")||n.setAttribute("data-highlights","");let i=E(n),s=i.getHighlights(),r=null;for(let l of s)if(e.text&&l.text&&e.text.includes(l.text.slice(0,20))){r=l;break}if(!r){i._createFromSelection("yellow");let l=i.getHighlights();r=l[l.length-1]}r&&w(i,r),t.dismiss()}#n(){let t=this.getAttribute("for"),e=t?document.getElementById(t):null;if(!e)return;e.hasAttribute("data-highlights-init")||e.setAttribute("data-highlights","");let n=E(e),i=n.getHighlights(),s=i.filter(r=>r.note);s.length>0?w(n,s[0]):i.length>0&&w(n,i[0])}};F("note-wc",H);
3
+ //# sourceMappingURL=note-wc.js.map