vanilla-breeze 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/ai-chat.js +6 -6
- package/dist/cdn/components/ai-summary.js +2 -2
- package/dist/cdn/components/analytics-panel.js +2 -2
- package/dist/cdn/components/audio-player.js +4 -4
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +1 -1
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +1 -1
- package/dist/cdn/components/chart-wc.js +13 -13
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +35 -35
- package/dist/cdn/components/comment-thread.js +38 -38
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +2 -2
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/geo-map.js +3 -3
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/icon-wc.js +2 -2
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/manifest.json +58 -54
- package/dist/cdn/components/markdown-editor.js +25 -25
- package/dist/cdn/components/markdown-viewer.js +27 -27
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +2 -2
- package/dist/cdn/components/notification-wc.js +23 -23
- package/dist/cdn/components/page-info.js +6 -6
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +1 -1
- package/dist/cdn/components/pager-wc.js +1 -1
- package/dist/cdn/components/poll-wc.js +1 -1
- package/dist/cdn/components/pop-over.js +1 -1
- package/dist/cdn/components/popularity-index.js +1 -1
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/progress-tracker.js +1 -1
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/reaction-bar.js +1 -1
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +1 -1
- package/dist/cdn/components/score-card.js +2 -2
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +6 -6
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +1 -1
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/social-links.js +2 -0
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +1 -1
- package/dist/cdn/components/stepper-wc.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-picker.js +20 -20
- package/dist/cdn/components/time-index.js +1 -1
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +2 -2
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +4 -4
- package/dist/cdn/components/trust-filter.js +1 -1
- package/dist/cdn/components/version-switcher.js +6 -6
- package/dist/cdn/components/video-player.js +4 -4
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
- package/dist/cdn/packs/kawaii.full.css +1 -1
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +4 -4
- package/dist/cdn/packs/prototype.full.js +1 -1
- package/dist/cdn/packs/ui.full.js +19 -19
- package/dist/cdn/themes/8bit.tokens.json +8 -37
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +3 -6
- package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +5 -11
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +13 -7
- package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
- package/dist/cdn/themes/brutalist.tokens.json +5 -11
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.css +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +41 -41
- package/dist/cdn/themes/classic.tokens.json +25 -31
- package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +531 -135
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.css +1 -1
- package/dist/cdn/themes/cyber.tokens.json +5 -11
- package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.tokens.json +1 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.tokens.json +19 -16
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.css +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.css +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +1 -1
- package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +3 -27
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +21 -21
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +2 -14
- package/dist/cdn/themes/manifest.json +25 -25
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.tokens.json +25 -27
- package/dist/cdn/themes/modern-dark.tokens.json +41 -41
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +21 -21
- package/dist/cdn/themes/nes-dark.tokens.json +3 -27
- package/dist/cdn/themes/nes.tokens.json +10 -39
- package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +266 -134
- package/dist/cdn/themes/nord-dark.tokens.json +3 -27
- package/dist/cdn/themes/nord.css +1 -1
- package/dist/cdn/themes/nord.tokens.json +1 -1
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.tokens.json +5 -14
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.css +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +1 -1
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
- package/dist/cdn/themes/solarized.tokens.json +1 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
- package/dist/cdn/themes/super2026.css +1 -1
- package/dist/cdn/themes/super2026.tokens.json +1 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
- package/dist/cdn/themes/swiss.tokens.json +34 -68
- package/dist/cdn/themes/terminal.tokens.json +286 -120
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
- package/dist/cdn/themes/tokyo-night.css +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
- package/dist/cdn/themes/vaporwave.tokens.json +1 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
- package/dist/cdn/themes/win9x.tokens.json +9 -9
- package/dist/cdn/vanilla-breeze-autoload.js +113 -108
- package/dist/cdn/vanilla-breeze-charts.js +13 -13
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +80 -75
- package/dist/cdn/vanilla-breeze-extras.js +31 -31
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +133 -133
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var F=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function g(r,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},a=m.get(r);if(customElements.get(r)){if(!a||a.priority>=n){a&&a.priority===n&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=n){a.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(r,i),customElements.define(r,t)}var h=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function S(r,t){let e=Number(r);return!Number.isFinite(e)||t<=0?1:Math.min(Math.max(1,Math.floor(e)),t)}function w({page:r,size:t}){let e=(r-1)*t;return{start:e,end:e+t}}function C(r,t,e=2){if(t<=0)return[];if(t===1)return[1];let n=Math.max(2,r-e),i=Math.min(t-1,r+e),a=[1];n>2&&a.push("\u2026");for(let s=n;s<=i;s++)a.push(s);return i<t-1&&a.push("\u2026"),a.push(t),a}function v({total:r,size:t,page:e,window:n=2}){if(t<=0)return{page:(r>0,1),totalPages:r>0?1:0,start:0,end:r,pageNumbers:r>0?[1]:[]};let i=r>0?Math.ceil(r/t):0,a=S(e,i),s=w({page:a,size:t}),o=Math.min(s.end,r);return{page:a,totalPages:i,start:s.start,end:o,pageNumbers:C(a,i,n)}}function f(r,t){return r.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function y(r){switch(r.style){case"load-more":return M(r);case"prev-next":return $(r);default:return x(r)}}function p(r="Pagination"){let t=document.createElement("nav");return t.setAttribute("data-paged-nav",""),t.setAttribute("aria-label",r),t}function x({page:r,totalPages:t,pageNumbers:e,navLabel:n,prevLabel:i="Previous",nextLabel:a="Next",pageLabel:s=o=>`Page ${o}`}){let o=p(n),d=document.createElement("ol");d.setAttribute("role","list"),d.appendChild(u(i,r-1,r===1,!1,"prev"));for(let c of e)if(c==="\u2026"){let l=document.createElement("li");l.textContent="\u2026",l.setAttribute("aria-hidden","true"),l.setAttribute("data-paged-ellipsis",""),d.appendChild(l)}else{let l=u(String(c),c,!1,c===r,"page");l.firstElementChild?.setAttribute("aria-label",s(c)),d.appendChild(l)}return d.appendChild(u(a,r+1,r===t,!1,"next")),o.appendChild(d),o}function $({page:r,totalPages:t,navLabel:e,prevLabel:n="Previous",nextLabel:i="Next",statusLabel:a=(s,o)=>`Page ${s} of ${o}`}){let s=p(e),o=document.createElement("ol");o.setAttribute("role","list"),o.appendChild(u(n,r-1,r===1,!1,"prev"));let d=document.createElement("li");return d.setAttribute("data-paged-status",""),d.setAttribute("aria-live","polite"),d.textContent=a(r,t),o.appendChild(d),o.appendChild(u(i,r+1,r===t,!1,"next")),s.appendChild(o),s}function M({total:r,visible:t,navLabel:e,loadMoreLabel:n=a=>`Load more (${a})`,noMoreLabel:i="No more"}){let a=p(e),s=document.createElement("button");s.type="button",s.setAttribute("data-paged-loadmore","");let o=Math.max(0,r-t);return s.textContent=o>0?n(o):i,s.disabled=o<=0,a.appendChild(s),a}function u(r,t,e,n,i){let a=document.createElement("li"),s=document.createElement("button");return s.type="button",s.setAttribute("data-paged-action",i),s.dataset.pagedTarget=String(t),s.textContent=r,n&&s.setAttribute("aria-current","page"),e&&(s.disabled=!0),a.appendChild(s),a}function E(r,{onNavigate:t,onLoadMore:e}){t&&r.querySelectorAll("button[data-paged-target]").forEach(n=>{n.addEventListener("click",()=>t(parseInt(n.dataset.pagedTarget||"1",10)))}),e&&r.querySelectorAll("button[data-paged-loadmore]").forEach(n=>{n.addEventListener("click",()=>e())})}function A(r,t){if(!r||!r.parentNode)return;let e=document.activeElement,i=!!e&&r.contains(e)&&e?{action:e.getAttribute("data-paged-action"),target:e.getAttribute("data-paged-target"),loadMore:e.hasAttribute("data-paged-loadmore")}:null,a=r.querySelector("[data-paged-status]"),s=t.querySelector("[data-paged-status]");a&&s&&(a.textContent!==s.textContent&&(a.textContent=s.textContent),s.hasAttribute("aria-live")?a.setAttribute("aria-live",s.getAttribute("aria-live")||"polite"):a.removeAttribute("aria-live"),s.replaceWith(a)),r.replaceWith(t),i&&T(t,i)}function T(r,t){let e=i=>r.querySelector(`${i}:not([disabled])`),n=[];t.loadMore&&n.push("button[data-paged-loadmore]"),t.action&&(n.push(`button[data-paged-action="${t.action}"][data-paged-target="${t.target}"]`),t.action!=="page"&&n.push(`button[data-paged-action="${t.action}"]`)),n.push('button[aria-current="page"]',"button");for(let i of n){let a=e(i);if(a){a.focus();return}}r.tabIndex=-1,r.focus()}var L=["numbered","prev-next","load-more"],P=["data-label-nav","data-label-prev","data-label-next","data-label-page","data-label-status","data-label-load-more","data-label-no-more","data-label-missing"],b=class extends h{static observedAttributes=["target","for","data-style","aria-label",...P];#t=null;#e=null;#r=!1;setup(){this.listen(document,"paged:change",t=>this.#c(t)),this.#t=this.#a(),this.#i()}teardown(){this.#t=null,this.#e=null}attributeChangedCallback(t,e,n){e===n||!this.isConnected||!this.hasAttribute("data-upgraded")||(t==="target"||t==="for"?(this.#t=this.#a(),this.#e=null,this.#i()):this.#e?this.#s(this.#e):this.#i())}#c(t){(!this.#t||!this.#t.isConnected||t.target!==this.#t)&&(this.#t=this.#a()),t.target===this.#t&&this.#s(t.detail)}#a(){let t=null,e=this.getAttribute("target"),n=this.getAttribute("for");if(e)try{t=document.querySelector(e)}catch{t=null}else if(n)t=document.getElementById(n);else{let i=this.previousElementSibling;for(;i&&!i.hasAttribute("data-paged");)i=i.previousElementSibling;t=i}return t&&t.hasAttribute("data-paged")?t:null}#i(){let t=this.#t;if(!t){this.#o();return}let e=parseInt(t.dataset.pagedSize||"10",10)||0,n=parseInt(t.dataset.pagedPage||"1",10)||1,i=t.tagName==="TABLE"?Array.from(t.querySelector(":scope > tbody")?.children||[]):Array.from(t.children).filter(c=>!c.matches("nav[data-paged-nav], div[data-paged-sentinel]")),a=i.length,s=e>0?Math.max(1,Math.ceil(a/e)):1,d=i.some(c=>c.hidden)?i.filter(c=>!c.hidden).length:Math.min(e||a,a);this.#s({page:n,size:e,total:a,totalPages:s,visible:d,style:t.dataset.pagedStyle||"numbered"})}#l(){let t=this.getAttribute("data-style")||"numbered";return L.includes(t)?t:"numbered"}#n(t,e){return this.getAttribute(`data-label-${t}`)||e}#s(t){this.#e=t;let e=this.#l(),n=this.#t;if(!n){this.#o();return}e==="load-more"&&!this.#r&&!/^(load-more|infinite)$/.test(n.dataset.pagedStyle||"")&&(this.#r=!0,console.warn('[pager-wc] data-style="load-more" needs a progressive target: set data-paged-style="load-more" on',n));let i=v({total:t.total,size:t.size,page:t.page,window:parseInt(n.dataset.pagedWindow||"2",10)||2}),a=typeof t.visible=="number"?t.visible:Math.min(t.page*t.size,t.total),s=this.querySelector(":scope > nav[data-paged-nav]");if(this.querySelector(":scope > [data-pager-missing]")?.remove(),e!=="load-more"&&i.totalPages<=1){s?.remove();return}let o=y({style:e,page:i.page,totalPages:i.totalPages,pageNumbers:i.pageNumbers,total:t.total,visible:a,navLabel:this.#n("nav",this.getAttribute("aria-label")||"Pagination"),prevLabel:this.#n("prev","Previous"),nextLabel:this.#n("next","Next"),pageLabel:d=>f(this.#n("page","Page {page}"),{page:d}),statusLabel:(d,c)=>f(this.#n("status","Page {page} of {total}"),{page:d,total:c}),loadMoreLabel:d=>f(this.#n("load-more","Load more ({n})"),{n:d}),noMoreLabel:this.#n("no-more","No more")});E(o,{onNavigate:d=>this.#u(d),onLoadMore:()=>this.#h()}),s?A(s,o):this.appendChild(o)}#o(){this.querySelector(":scope > nav[data-paged-nav]")?.remove();let t=this.querySelector(":scope > [data-pager-missing]");t||(t=document.createElement("p"),t.setAttribute("data-pager-missing",""),this.appendChild(t)),t.textContent=this.#n("missing","No paginated target found")}#d(){return this.#t?.isConnected||(this.#t=this.#a()),this.#t}#u(t){let e=this.#d();e&&(this.dispatchEvent(new CustomEvent("pager-wc:navigate",{bubbles:!0,detail:{page:t}})),e.dispatchEvent(new CustomEvent("paged:goto",{detail:{page:t}})))}#h(){this.#d()?.dispatchEvent(new CustomEvent("paged:loadmore"))}};g("pager-wc",b);export{b as PagerWC};
|
|
2
2
|
//# sourceMappingURL=pager-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function g(l,t,e={}){let s=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=v.get(l);if(customElements.get(l)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(l,n),customElements.define(l,t)}var h=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,n){t.addEventListener(e,s,n),this.#e.push(()=>t.removeEventListener(e,s,n))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{e?s.add(t):s.delete(t)}catch{let n=`--${t}`;e?s.add(n):s.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}#s(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var S={vote:"vote",votes:"votes","your-choice":"your choice",closed:"closed",poll:"Poll"},$=0,m=class extends h{static observedAttributes=["data-closed","data-multi","data-hide-counts","disabled"];#e=null;#t=null;#s=null;setup(){this.#t=this.querySelector(":scope > .poll-options"),this.#t?(this.#e=this.querySelector(":scope > .poll-question"),this.#s=this.querySelector(":scope > output.poll-total")):(this.#l(),this.#u());let t=this.#t;return t?(this.#o(),this.#n().forEach(e=>this.#d(e)),this.listen(t,"click",e=>{let s=e.target.closest?.("button[data-option]");s&&s.parentElement===this.#t&&this.#h(s)}),this.listen(t,"keydown",e=>{let s=e.target.closest?.("button[data-option]");s&&s.parentElement===this.#t&&this.#f(e,s)}),this.#r(),!0):!1}teardown(){this.#e=null,this.#t=null,this.#s=null}attributeChangedCallback(t,e,s){!this.#t||e===s||(t==="data-multi"&&this.#o(),this.#r(),t==="data-closed"&&this.dispatchEvent(new CustomEvent("poll-wc:closed-change",{bubbles:!0,detail:{closed:this.hasAttribute("data-closed")}})))}#l(){let t=this.querySelector(":scope > form");if(!t||this.querySelector(":scope > button[data-option]"))return;let e=[...t.querySelectorAll('input[type="radio"], input[type="checkbox"]')];if(!e.length)return;let s=t.querySelector("fieldset"),n=s?.querySelector(":scope > legend"),i=[];if(n&&!this.querySelector(':scope > [slot="question"]')){let r=document.createElement("span");r.slot="question",r.append(...n.childNodes),i.push(r)}e.some(r=>r.type==="checkbox")&&this.setAttribute("data-multi",""),s?.disabled&&this.setAttribute("data-closed","");for(let r of e){let a=document.createElement("button");a.type="button",a.dataset.option=r.value,a.dataset.count=r.dataset.count||"0",r.checked&&a.setAttribute("data-mine","");let c=r.closest("label")||(r.id?t.querySelector(`label[for="${CSS.escape(r.id)}"]`):null);c?(r.remove(),a.append(...c.childNodes),C(a)):a.textContent=r.value,i.push(a)}t.replaceWith(...i)}#u(){let t=this.querySelector(':scope > [slot="question"]'),e=[...this.querySelectorAll(":scope > button[data-option]")];t&&(this.#e=document.createElement("div"),this.#e.className="poll-question",this.#e.id=`poll-q-${++$}`,this.#e.appendChild(t)),this.#t=document.createElement("div"),this.#t.className="poll-options";let s=this.getAttribute("aria-label");s?(this.#t.setAttribute("aria-label",s),this.removeAttribute("aria-label")):this.#e?this.#t.setAttribute("aria-labelledby",this.#e.id):this.#t.setAttribute("aria-label",this.#i("poll")),this.#t.append(...e),this.#s=document.createElement("output"),this.#s.className="poll-total",this.#s.setAttribute("aria-live","polite");let n=[];this.#e&&n.push(this.#e),n.push(this.#t,this.#s),this.replaceChildren(...n)}#n(){return this.#t?[...this.#t.querySelectorAll(":scope > button[data-option]")]:[]}#o(){this.#t?.setAttribute("role",this.hasAttribute("data-multi")?"group":"radiogroup")}#d(t){if(t.type="button",t.classList.add("poll-option"),t.querySelector(":scope > .poll-option-label"))return;let e=document.createElement("span");e.className="poll-option-label",e.append(...t.childNodes);let s=document.createElement("span");s.className="poll-option-bar",s.setAttribute("aria-hidden","true");let n=document.createElement("span");n.className="poll-option-count",n.setAttribute("aria-hidden","true"),t.append(e,s,n)}#a(){return this.hasAttribute("data-closed")||this.hasAttribute("disabled")}#h(t){if(this.#a())return;let e=this.hasAttribute("data-multi"),s=this.#n();if(e?t.hasAttribute("data-pending"):s.some(a=>a.hasAttribute("data-pending")))return;let n=t.dataset.option,i=Number(t.dataset.count)||0,r=t.hasAttribute("data-mine");if(!e&&!r){let a=s.find(c=>c.hasAttribute("data-mine")&&c!==t);a&&(a.setAttribute("data-pending",""),this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:a.dataset.option,action:"remove",count:Number(a.dataset.count)||0,mine:!0}})))}t.setAttribute("data-pending",""),this.#c(),this.dispatchEvent(new CustomEvent("poll-wc:vote",{bubbles:!0,detail:{option:n,action:r?"remove":"add",count:i,mine:r}}))}#f(t,e){if(this.hasAttribute("data-multi"))return;let s=this.#n(),n=s.indexOf(e),i=getComputedStyle(this).direction==="rtl",r=i?"ArrowLeft":"ArrowRight",a=i?"ArrowRight":"ArrowLeft",c;switch(t.key){case"ArrowDown":case r:c=(n+1)%s.length;break;case"ArrowUp":case a:c=(n-1+s.length)%s.length;break;case"Home":c=0;break;case"End":c=s.length-1;break;default:return}t.preventDefault();let u=s[c];this.#p(u),u.focus()}#p(t){for(let e of this.#n())e.tabIndex=e===t?0:-1}#i(t){return this.getAttribute(`data-label-${t}`)||S[t]}#b(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}#c(){this.#n().some(e=>e.hasAttribute("data-pending"))?this.#t?.setAttribute("aria-busy","true"):this.#t?.removeAttribute("aria-busy")}#r(){let t=this.#n();if(!t.length)return;let e=t.reduce((o,d)=>o+(Number(d.dataset.count)||0),0),s=this.hasAttribute("data-closed"),n=this.#a(),i=this.hasAttribute("data-multi"),r=this.hasAttribute("data-hide-counts"),a=this.#b(),c=new Intl.NumberFormat(a),u=new Intl.NumberFormat(a,{style:"percent",maximumFractionDigits:0}),E=new Intl.PluralRules(a),f=o=>`${c.format(o)} ${E.select(o)==="one"?this.#i("vote"):this.#i("votes")}`,w=i?null:t.find(o=>o===document.activeElement)||t.find(o=>o.hasAttribute("data-mine"))||t.find(o=>o.getAttribute("tabindex")==="0")||t[0];for(let o of t){let d=Number(o.dataset.count)||0,y=o.hasAttribute("data-mine"),p=e>0?d/e:0;o.style.setProperty("--option-pct",r?"0":String(Math.round(p*1e3)/10)),o.setAttribute("aria-checked",y?"true":"false"),o.setAttribute("role",i?"checkbox":"radio"),n?o.setAttribute("aria-disabled","true"):o.removeAttribute("aria-disabled"),o.tabIndex=i||o===w?0:-1;let A=o.querySelector(":scope > .poll-option-count");A&&(A.textContent=r?"":`${c.format(d)} \xB7 ${u.format(p)}`);let b=[o.querySelector(":scope > .poll-option-label")?.textContent.replace(/\s+/g," ").trim()||o.dataset.option];r||b.push(f(d),u.format(p)),y&&b.push(this.#i("your-choice")),o.setAttribute("aria-label",b.join(", "))}this.#s&&(this.#s.textContent=s?`${f(e)} \xB7 ${this.#i("closed")}`:f(e)),this.#c()}#m(t){let e=this.hasAttribute("data-multi");for(let s of this.#n())(!e||s===t)&&s.removeAttribute("data-pending")}setCount(t,e,s={}){let n=this.#n().find(i=>i.dataset.option===t);n&&(n.dataset.count=String(Math.max(0,Number(e)||0)),s.mine===!0?n.setAttribute("data-mine",""):s.mine===!1&&n.removeAttribute("data-mine"),this.#m(n),this.#r())}setCounts(t,e={}){let s=Array.isArray(e.mine)?e.mine:e.mine?[e.mine]:null;for(let n of this.#n()){let i=n.dataset.option??"";t[i]!=null&&(n.dataset.count=String(Math.max(0,Number(t[i])||0))),s&&(s.includes(i)?n.setAttribute("data-mine",""):n.removeAttribute("data-mine")),n.removeAttribute("data-pending")}this.#r()}close(){this.setAttribute("data-closed","")}open(){this.removeAttribute("data-closed")}get totalVotes(){return this.#n().reduce((t,e)=>t+(Number(e.dataset.count)||0),0)}get myVotes(){return this.#n().filter(t=>t.hasAttribute("data-mine")).map(t=>t.dataset.option)}};function C(l){let t=l.firstChild;t?.nodeType===Node.TEXT_NODE&&(t.textContent=t.textContent.replace(/^\s+/,""));let e=l.lastChild;e?.nodeType===Node.TEXT_NODE&&(e.textContent=e.textContent.replace(/\s+$/,""))}g("poll-wc",m);export{m as PollWc};
|
|
2
2
|
//# sourceMappingURL=poll-wc.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var q=window.matchMedia("(prefers-reduced-motion: reduce)");var g=new Map;function E(r,t,e={}){let o=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:o},n=g.get(r);if(customElements.get(r)){if(!n||n.priority>=o){n&&n.priority===o&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=o){n.priority===o&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}g.set(r,i),customElements.define(r,t)}var h=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,o,i){t.addEventListener(e,o,i),this.#t.push(()=>t.removeEventListener(e,o,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{e?o.add(t):o.delete(t)}catch{let i=`--${t}`;e?o.add(i):o.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}#o(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#o()?.validity}get validationMessage(){return this.#o()?.validationMessage??""}get willValidate(){return this.#o()?.willValidate??!1}get form(){return this.#o()?.form??null}checkValidity(){return this.#o()?.checkValidity()??!0}reportValidity(){return this.#o()?.reportValidity()??!0}};var u=CSS.supports("anchor-name","--x"),C=CSS.supports("position-area","bottom"),P=(()=>{let r=document.createElement("span");return r.setAttribute("popover","hint"),r.popover==="hint"})(),M=["auto","manual","hint"];function k(r){let t=M.includes(r||"")?r:"auto";return t==="hint"&&!P?"auto":t}var x=["top","bottom","left","right","inset-inline-start","inset-inline-end"],T=["position","top","left","right","bottom","margin"],w=8,_=0,B=0;function A(r){return!r||r==="none"?[]:r.split(",").map(t=>t.trim()).filter(Boolean)}var m=class extends h{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#o=`--pop-over-anchor-${++B}`;#r=!1;#n=!1;#s=!1;setup(){if(this.id||(this.id=`pop-over-${++_}`),(!this.hasAttribute("popover")||this.#r)&&this.#a(),this.#c(),this.#d(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!u&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#i()})}),!u){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#i()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#l(),this.#n&&(x.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#s&&(T.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#t=null}attributeChangedCallback(t,e,o){if(e!==o){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#r=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=k(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#r=!0}show(){this.matches(":popover-open")||(this.showPopover(),!u&&this.#t&&this.matches(":popover-open")&&this.#i())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#c(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#d(){if(!this.#t||!u)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),o=A(e||getComputedStyle(t).getPropertyValue("anchor-name"));o.includes(this.#o)||o.push(this.#o),t.style.setProperty("anchor-name",o.join(", ")),this.#e=this.#o,this.style.setProperty("position-anchor",this.#o),this.setAttribute("data-anchor-name",this.#o),C||this.#h(this.dataset.position||"bottom")}#l(){if(this.#t&&this.#e){let t=A(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#e);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#e=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",o=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},i={top:{bottom:`calc(anchor(top) + ${e})`,...o},bottom:{top:`calc(anchor(bottom) + ${e})`,...o},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},n=t.split("-")[0],d=i[n]||i.bottom;Object.entries(d).forEach(([l,s])=>this.style.setProperty(l,s)),this.#n=!0}#i(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",o=this.#u(),i=document.documentElement.clientWidth,n=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#s=!0;let d=this.offsetWidth,l=this.offsetHeight,s=e.split("-")[0];["top","bottom","left","right"].includes(s)||(s="bottom");let f={top:t.top-o,bottom:n-t.bottom-o,left:t.left-o,right:i-t.right-o},b={top:"bottom",bottom:"top",left:"right",right:"left"},S=s==="top"||s==="bottom"?l:d;f[s]<S&&f[b[s]]>f[s]&&(s=b[s]);let a,c;switch(s){case"top":a=t.top-l-o,c=t.left;break;case"left":a=t.top,c=t.left-d-o;break;case"right":a=t.top,c=t.right+o;break;default:a=t.bottom+o,c=t.left;break}if(s==="top"||s==="bottom"){let p=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==p?t.right-d:t.left}else e.endsWith("-end")&&(a=t.bottom-l);let y=(p,v,$)=>Math.max(w,Math.min(p,$-v-w));c=y(c,d,i),a=y(a,l,n),this.style.top=`${Math.round(a)}px`,this.style.left=`${Math.round(c)}px`}#u(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};E("pop-over",m);
|
|
2
2
|
//# sourceMappingURL=pop-over.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var k=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function E(o,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=w.get(o);if(customElements.get(o)){if(!s||s.priority>=r){s&&s.priority===r&&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>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}w.set(o,i),customElements.define(o,t)}var y=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,i){t.addEventListener(e,r,i),this.#e.push(()=>t.removeEventListener(e,r,i))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var $="/api/analytics/popular",S=10,C={heading:"Most visited",view:"view",views:"views",unavailable:"Popularity data is unavailable right now.",empty:"Not enough data yet to surface most-visited pages."},v=class extends y{static observedAttributes=["analytics-src","window","limit","data-meta-src","data-lens-src","data-heading-level"];#e=null;#t=0;setup(){this.#r()}teardown(){this.#t++,this.#e?.abort(),this.#e=null}attributeChangedCallback(t,e,r){e===r||!this.hasAttribute("data-upgraded")||this.#r()}#r(){let t=++this.#t;this.#e?.abort(),this.#e=null,queueMicrotask(()=>{t!==this.#t||!this.isConnected||this.#l(t).catch(()=>{})})}async#l(t){let e=new AbortController;this.#e=e;let{signal:r}=e,i=()=>t===this.#t&&!r.aborted;this.#i("loading"),this.#o(this.#a());let s=this.getAttribute("analytics-src")||$,u=new URL(s,document.baseURI),p=this.getAttribute("window");p&&u.searchParams.set("window",p);let a=this.getAttribute("data-meta-src")||this.getAttribute("data-lens-src"),m=fetch(u,{credentials:"omit",signal:r}).then(n=>{if(!n.ok)throw new Error(`status ${n.status}`);return n.json()}),h=a?fetch(new URL(a,document.baseURI),{credentials:"omit",signal:r}).then(n=>n.ok?n.json():null).catch(()=>null):Promise.resolve(null),c;try{c=await m}catch(n){if(!i())return;let f=n instanceof Error?n.message:String(n);this.setAttribute("data-error",f),console.warn("[popularity-index] endpoint unavailable:",f),this.#s("unavailable",this.#c("unavailable"));return}let l=await h;if(!i())return;let g=Array.isArray(c?.pages)?c.pages:Array.isArray(c)?c:[],d=Array.isArray(l)?l:Array.isArray(l?.pages)?l.pages:[],A=new Map(d.filter(n=>n&&typeof n.url=="string").map(n=>[n.url,n])),b=[];for(let n of g){if(!n||typeof n.url!="string")continue;let f=M(n.url);if(f&&(b.push({p:n,href:f,meta:A.get(n.url)||{}}),b.length>=this.#d()))break}if(!b.length){this.#s("empty",this.#c("empty"));return}this.#s("ready",this.#u(b))}#s(t,e){t!=="unavailable"&&this.removeAttribute("data-error"),this.#o(this.#a(),e),this.#i(t),this.dispatchEvent(new CustomEvent("popularity-index:state",{bubbles:!0,detail:{state:t}}))}#i(t){this.setAttribute("data-state",t),t==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy")}#o(...t){this.replaceChildren(...t.filter(e=>e!==null))}#a(){let t=this.getAttribute("data-heading-level"),e=t==null||t===""?2:Number.parseInt(t,10);if(e===0)return null;let r=Number.isFinite(e)?Math.min(6,Math.max(1,e)):2,i=document.createElement(`h${r}`);return i.className="popularity-heading",i.textContent=this.#n("heading"),i}#c(t){let e=document.createElement("p");return e.className="popularity-empty",e.textContent=this.#n(t),e}#u(t){let e=this.#h(),r=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),i=new Intl.PluralRules(e),s=document.createElement("ol");s.className="popularity-list";for(let{p:u,href:p,meta:a}of t){let m=document.createElement("li"),h=document.createElement("a");h.href=p,h.textContent=String(u.title||a.title||u.url);let c=Math.max(0,Number(u.views??u.count??0)||0),l=document.createElement("small"),g=i.select(c)==="one"?this.#n("view"):this.#n("views");if(l.append(`${r.format(c)} ${g}`),typeof a.provenance=="string"&&a.provenance){let d=document.createElement("span");d.className="popularity-prov",d.dataset.provenance=a.provenance,d.textContent=a.provenance,l.append(" \xB7 ",d)}m.append(h,l),s.append(m)}return s}#d(){let t=Number.parseInt(this.getAttribute("limit")??"",10);return Number.isFinite(t)?Math.max(1,t):S}#n(t){return this.getAttribute(`data-label-${t}`)||C[t]}#h(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};function M(o){let t=o.trim();if(!t)return null;let e;try{e=new URL(t,location.href)}catch{return null}if(e.protocol!=="http:"&&e.protocol!=="https:")return null;let r=/^[a-z][a-z0-9+.-]*:/i.test(t);return!r&&e.origin!==location.origin?null:r?e.href:t}E("popularity-index",v);export{v as PopularityIndex,M as safeHref};
|
|
2
2
|
//# sourceMappingURL=popularity-index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function l(s,t,r={}){let e=r.priority??10,o={impl:t,bundle:r.bundle,contract:r.contract,priority:e},n=u.get(s);if(customElements.get(s)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}u.set(s,o),customElements.define(s,t)}var a=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,r,e,o){t.addEventListener(r,e,o),this.#t.push(()=>t.removeEventListener(r,e,o))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,r){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{r?e.add(t):e.delete(t)}catch{let o=`--${t}`;r?e.add(o):e.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var c=class extends a{#t;#e;#r=null;setup(){this.#r===null&&(this.#r=this.getAttribute("label")||this.textContent.trim()||"Print this page");let t=this.#r,r=this.hasAttribute("raw-toggle");this.innerHTML="",r&&(this.setAttribute("role","group"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",t));let e=this.getAttribute("variant")||"icon";this.#t=document.createElement("button"),this.#t.type="button",this.#t.className="print-trigger",this.#t.setAttribute("aria-label",t);let o=e!=="label",n=e!=="icon";if(o){let i=document.createElement("icon-wc");i.setAttribute("name","printer"),i.setAttribute("size","sm"),i.setAttribute("aria-hidden","true"),this.#t.appendChild(i)}if(n){let i=document.createElement("span");i.textContent=t,this.#t.appendChild(i)}if(this.listen(this.#t,"click",this.#n),this.append(this.#t),r){let i=document.createElement("label");this.#e=document.createElement("input"),this.#e.type="checkbox";let d=document.createElement("span");d.textContent=this.dataset.labelRaw||"Print without VB styles",i.append(this.#e,d),this.append(i)}}teardown(){this.#t=null,this.#e=null}#n=()=>{if(this.#e?.checked){document.documentElement.setAttribute("data-print-raw","");let r,e=()=>{document.documentElement.removeAttribute("data-print-raw"),window.removeEventListener("afterprint",e),clearTimeout(r)};window.addEventListener("afterprint",e,{once:!0}),r=setTimeout(e,5e3)}window.print()}};l("print-page",c);export{c as PrintPage};
|
|
2
2
|
//# sourceMappingURL=print-page.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function m(o,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=b.get(o);if(customElements.get(o)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(o,i),customElements.define(o,t)}var u=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,i){t.addEventListener(e,r,i),this.#e.push(()=>t.removeEventListener(e,r,i))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var v=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),g=new WeakMap;function A(o,t){let e=g.get(t);e||g.set(t,e=new Map);let r=e.get(o);if(!r||!r.region.isConnected){let n=(t.ownerDocument||document).createElement("span");n.setAttribute("data-vb-announcer",o),n.setAttribute("role",o==="assertive"?"alert":"status"),n.setAttribute("aria-live",o),n.setAttribute("aria-atomic","true"),n.style.cssText=v,t.appendChild(n),r={region:n},e.set(o,r)}return r}function y(o,{politeness:t="polite",root:e}={}){let r=String(o??"").trim();if(!r||typeof document>"u")return null;let i=e||document.body;if(!i)return null;let s=A(t==="assertive"?"assertive":"polite",i);return clearTimeout(s.write),clearTimeout(s.clear),s.region.textContent="",s.write=setTimeout(()=>{s.region.textContent=r,s.clear=setTimeout(()=>{s.region.textContent=""},7e3)},50),s.region}var S={complete:"(completed)",current:"",upcoming:"(not started)",error:"(error)"},l=class extends u{static observedAttributes=["data-current","data-clickable","data-label-list","data-label-step","data-label-complete","data-label-current","data-label-upcoming","data-label-error"];#e=!1;#t=null;setup(){this.listen(this,"click",t=>this.#h(t)),this.#a(),this.#t=new MutationObserver(t=>{let e=this.#o();t.some(r=>r.type==="attributes"||r.target===this||r.target===e)&&this.#a()}),this.#t.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-step","data-error"]})}teardown(){this.#t?.disconnect(),this.#t=null}attributeChangedCallback(t,e,r){if(e===r||!this.hasAttribute("data-upgraded"))return;let i=t==="data-current"?this.#c(this.#n(),e)??0:-1;this.#a(),t==="data-current"&&(this.#r(i),!this.#e&&this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:this.#u(),previousStep:this.#f(e),source:"attr"}})))}#r(t){let e=this.#n(),r=this.#i(e);if(!e[r]||r===t)return;let i=(e[r].querySelector(".pt-label")?.textContent||"").trim(),n=this.getAttribute("data-label-announce")??"Step {n} of {total}: {label}";y(E(n,r+1,e.length).replace(/\{label\}/g,()=>i))}#o(){return this.querySelector(":scope > ol")}#n(){let t=this.#o();return t?[...t.children].filter(e=>e.localName==="li"):[]}#s(t,e){return t.dataset.step||String(e+1)}#l(t){if(t.querySelector(":scope > .pt-circle"))return;let e=document.createElement("span");e.className="pt-label",e.append(...t.childNodes);let r=document.createElement("span");r.className="pt-circle",r.setAttribute("aria-hidden","true");let i=document.createElement("span");i.className="pt-sr pt-position";let n=document.createElement("span");n.className="pt-sr pt-status";let s=document.createElement("span");s.className="pt-body",s.append(i,e,n),t.append(r,s),t.dataset.decorated=""}#d(t,e){let r=t.querySelector(":scope > .pt-body");if(!r)return;let i=!!r.querySelector(".pt-label :is(a[href], button, input, select, textarea, [tabindex])"),n=e&&!i?"button":"span";if(r.localName===n)return;let s=document.createElement(n);s.className="pt-body",n==="button"&&(s.type="button");let c=r.contains(document.activeElement);s.append(...r.childNodes),r.replaceWith(s),c&&n==="button"&&s.focus()}#a(){let t=this.#o();if(!t)return;!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-label",this.getAttribute("data-label-list")||"Progress");let e=this.#n(),r=this.#i(e),i=this.hasAttribute("data-clickable"),n=this.getAttribute("data-label-step")??"Step {n} of {total}:";e.forEach((s,c)=>{this.#l(s);let a;s.hasAttribute("data-error")?a="error":c<r?a="complete":c===r?a="current":a="upcoming",s.dataset.status=a,a==="current"?s.setAttribute("aria-current","step"):s.removeAttribute("aria-current"),s.removeAttribute("aria-label"),s.removeAttribute("tabindex");let d=s.querySelector(":scope > .pt-circle");d&&(d.textContent=a==="complete"?"\u2713":a==="error"?"!":String(c+1));let f=s.querySelector(".pt-position");f&&(f.textContent=n?`${E(n,c+1,e.length)} `:"");let h=s.querySelector(".pt-status");if(h){let p=this.getAttribute(`data-label-${a}`)??S[a];h.textContent=p?` ${p}`:""}this.#d(s,i&&c<r)})}#i(t){return this.#c(t,this.getAttribute("data-current"))??0}#c(t,e){if(e==null||!t.length)return null;let r=t.findIndex((n,s)=>this.#s(n,s)===e);if(r!==-1)return r;let i=Number(e);return Number.isInteger(i)&&i>0?Math.min(t.length-1,i-1):null}#u(){let t=this.#n(),e=this.#i(t);return t[e]?this.#s(t[e],e):null}#f(t){let e=this.#n(),r=this.#c(e,t);return r==null?null:this.#s(e[r],r)}#h(t){if(!this.hasAttribute("data-clickable"))return;let e=t.target.closest?.("li"),r=this.#n(),i=e?r.indexOf(e):-1;if(i===-1||t.target.closest(".pt-label a[href]"))return;let n=this.#i(r);if(i>=n)return;let s=this.#s(r[i],i),c=this.#u();this.#e=!0;try{this.setAttribute("data-current",s)}finally{this.#e=!1}this.dispatchEvent(new CustomEvent("progress-tracker:step",{bubbles:!0,detail:{step:s,previousStep:c,source:"click"}}))}};function E(o,t,e){return o.replace(/\{n\}/g,String(t)).replace(/\{total\}/g,String(e))}m("progress-tracker",l);export{l as ProgressTracker};
|
|
2
2
|
//# sourceMappingURL=progress-tracker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var rt=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function B(a,e,r={}){let o=r.priority??10,u={impl:e,bundle:r.bundle,contract:r.contract,priority:o},c=S.get(a);if(customElements.get(a)){if(!c||c.priority>=o){c&&c.priority===o&&c.impl!==e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${c.bundle}" (priority ${c.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${c.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(c&&c.priority>=o){c.priority===o&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${c.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}S.set(a,u),customElements.define(a,e)}var N=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,o,u){e.addEventListener(r,o,u),this.#t.push(()=>e.removeEventListener(r,o,u))}_reinit(){for(let e of this.#t)e();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,r){this.#e||(this.#e=this.attachInternals());let o=this.#e.states;try{r?o.add(e):o.delete(e)}catch{let u=`--${e}`;r?o.add(u):o.delete(u)}}_adoptInternals(e){this.#e||(this.#e=e)}#n(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var X=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),k=new WeakMap;function j(a,e){let r=k.get(e);r||k.set(e,r=new Map);let o=r.get(a);if(!o||!o.region.isConnected){let c=(e.ownerDocument||document).createElement("span");c.setAttribute("data-vb-announcer",a),c.setAttribute("role",a==="assertive"?"alert":"status"),c.setAttribute("aria-live",a),c.setAttribute("aria-atomic","true"),c.style.cssText=X,e.appendChild(c),o={region:c},r.set(a,o)}return o}function D(a,{politeness:e="polite",root:r}={}){let o=String(a??"").trim();if(!o||typeof document>"u")return null;let u=r||document.body;if(!u)return null;let h=j(e==="assertive"?"assertive":"polite",u);return clearTimeout(h.write),clearTimeout(h.clear),h.region.textContent="",h.write=setTimeout(()=>{h.region.textContent=o,h.clear=setTimeout(()=>{h.region.textContent=""},7e3)},50),h.region}function y(a,e,r,o){let u=`data-label-${e}`,h=a?.closest?.(`[${u}]`)?.getAttribute(u)||r;return o?h.replace(/\{(\w+)\}/g,(t,n)=>n in o?String(o[n]):t):h}var L=1500,W="[data-copy], [data-copy-target], [data-paste-target]",M={copied:"Copied to clipboard",pasted:"Pasted from clipboard","copy-failed":"Copy failed","copy-failed-selected":"Copy failed. Text selected, press Ctrl+C to copy","paste-failed":"Paste failed"},T=new WeakMap;function K(a){if(typeof document.execCommand!="function"||!document.body)return!1;let e=document.activeElement,r=document.createElement("textarea");r.value=a,r.setAttribute("readonly",""),r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none",document.body.appendChild(r),r.select();let o=!1;try{o=document.execCommand("copy")}catch{o=!1}return r.remove(),e?.focus?.({preventScroll:!0}),o}function Z(a){if(!a)return!1;if(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)return a.focus(),a.select(),!0;let e=window.getSelection?.();if(!e)return!1;let r=document.createRange();return r.selectNodeContents(a),e.removeAllRanges(),e.addRange(r),!e.isCollapsed}async function F(a,e={}){if(a==null||a==="")return!1;let{button:r,duration:o=L}=e,u=!1,c=null;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(a),u=!0}catch(t){c=t,u=K(a)}if(u)return C({button:r,duration:o,state:"copied",eventName:"copy:done",eventDetail:{text:a},message:e.announceMessage??y(r,"copied",M.copied)}),!0;let h=Z(e.source);return C({button:r,duration:o,state:"failed",eventName:"copy:error",eventDetail:{text:a,error:c},message:e.failureMessage??y(r,"copy-failed",h?M["copy-failed-selected"]:M["copy-failed"])}),!1}async function O(a,e={}){let{text:r,html:o,blob:u}=a??{};if(!r&&!o&&!u)return!1;let{button:c,duration:h=L}=e;if(typeof ClipboardItem<"u"&&typeof navigator.clipboard?.write=="function"){let n={};r&&(n["text/plain"]=new Blob([r],{type:"text/plain"})),o&&(n["text/html"]=new Blob([o],{type:"text/html"})),u&&(n[u.type]=u);try{return await navigator.clipboard.write([new ClipboardItem(n)]),C({button:c,duration:h,state:"copied",eventName:"copy:done",eventDetail:{payload:a},message:e.announceMessage??y(c,"copied",M.copied)}),!0}catch{}}return r?F(r,e):(C({button:c,duration:h,state:"failed",eventName:"copy:error",eventDetail:{payload:a,error:null},message:e.failureMessage??y(c,"copy-failed",M["copy-failed"])}),!1)}function C({button:a,duration:e,message:r,eventDetail:o,state:u,eventName:c}){if(a){a.dataset.state=u;let h=T.get(a);h&&clearTimeout(h),T.set(a,setTimeout(()=>{a.dataset.state===u&&delete a.dataset.state,T.delete(a)},e)),a.dispatchEvent(new CustomEvent(c,{bubbles:!0,detail:o}))}D(r,{politeness:u==="failed"?"assertive":"polite"})}async function J(a,e={}){let{button:r,duration:o=L}=e,u;try{if(!navigator.clipboard?.readText)throw new Error("Clipboard API unavailable");u=await navigator.clipboard.readText()}catch(c){return C({button:r,duration:o,state:"failed",eventName:"paste:error",eventDetail:{target:a,error:c},message:e.failureMessage??y(r,"paste-failed",M["paste-failed"])}),null}return a&&(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement?a.value=u:a.textContent=u,a.dispatchEvent(new Event("input",{bubbles:!0}))),C({button:r,duration:o,state:"pasted",eventName:"paste:done",eventDetail:{text:u,target:a},message:e.announceMessage??y(r,"pasted",M.pasted)}),u}function z(a){let e=a.dataset.copyTarget;if(!e)return null;try{return document.querySelector(e)}catch{return null}}function _(a){if(a.dataset.copy)return a.dataset.copy;let e=z(a);if(!e)return"";let r=a.dataset.copyAttr;return r?e.getAttribute(r)??"":e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??""}function Q(a){let e=a.target?.closest?.(W);if(!e||e.matches(':disabled, [aria-disabled="true"]'))return;if(e.dataset.pasteTarget){let o=null;try{o=document.querySelector(e.dataset.pasteTarget)}catch{}if(!o)return;J(o,{button:e});return}let r=_(e);r&&F(r,{button:e,source:z(e)??void 0})}typeof document<"u"&&!document.__vbCopyDelegated&&(document.__vbCopyDelegated=!0,document.addEventListener("click",Q));var w;(a=>{class e{constructor(t,n,i,s){if(this.version=t,this.errorCorrectionLevel=n,t<e.MIN_VERSION||t>e.MAX_VERSION)throw new RangeError("Version value out of range");if(s<-1||s>7)throw new RangeError("Mask value out of range");this.size=t*4+17;let l=[];for(let d=0;d<this.size;d++)l.push(!1);for(let d=0;d<this.size;d++)this.modules.push(l.slice()),this.isFunction.push(l.slice());this.drawFunctionPatterns();let f=this.addEccAndInterleave(i);if(this.drawCodewords(f),s==-1){let d=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);let p=this.getPenaltyScore();p<d&&(s=m,d=p),this.applyMask(m)}}u(0<=s&&s<=7),this.mask=s,this.applyMask(s),this.drawFormatBits(s),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(t,n){let i=a.QrSegment.makeSegments(t);return e.encodeSegments(i,n)}static encodeBinary(t,n){let i=a.QrSegment.makeBytes(t);return e.encodeSegments([i],n)}static encodeSegments(t,n,i=1,s=40,l=-1,f=!0){if(!(e.MIN_VERSION<=i&&i<=s&&s<=e.MAX_VERSION)||l<-1||l>7)throw new RangeError("Invalid value");let d,m;for(d=i;;d++){let g=e.getNumDataCodewords(d,n)*8,E=c.getTotalBits(t,d);if(E<=g){m=E;break}if(d>=s)throw new RangeError("Data too long")}for(let g of[e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])f&&m<=e.getNumDataCodewords(d,g)*8&&(n=g);let p=[];for(let g of t){r(g.mode.modeBits,4,p),r(g.numChars,g.mode.numCharCountBits(d),p);for(let E of g.getData())p.push(E)}u(p.length==m);let R=e.getNumDataCodewords(d,n)*8;u(p.length<=R),r(0,Math.min(4,R-p.length),p),r(0,(8-p.length%8)%8,p),u(p.length%8==0);for(let g=236;p.length<R;g^=253)r(g,8,p);let b=[];for(;b.length*8<p.length;)b.push(0);return p.forEach((g,E)=>b[E>>>3]|=g<<7-(E&7)),new e(d,n,b,l)}size;mask;modules=[];isFunction=[];getModule(t,n){return 0<=t&&t<this.size&&0<=n&&n<this.size&&this.modules[n][t]}drawFunctionPatterns(){for(let i=0;i<this.size;i++)this.setFunctionModule(6,i,i%2==0),this.setFunctionModule(i,6,i%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let t=this.getAlignmentPatternPositions(),n=t.length;for(let i=0;i<n;i++)for(let s=0;s<n;s++)i==0&&s==0||i==0&&s==n-1||i==n-1&&s==0||this.drawAlignmentPattern(t[i],t[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){let n=this.errorCorrectionLevel.formatBits<<3|t,i=n;for(let l=0;l<10;l++)i=i<<1^(i>>>9)*1335;let s=(n<<10|i)^21522;u(s>>>15==0);for(let l=0;l<=5;l++)this.setFunctionModule(8,l,o(s,l));this.setFunctionModule(8,7,o(s,6)),this.setFunctionModule(8,8,o(s,7)),this.setFunctionModule(7,8,o(s,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,o(s,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,o(s,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,o(s,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let i=0;i<12;i++)t=t<<1^(t>>>11)*7973;let n=this.version<<12|t;u(n>>>18==0);for(let i=0;i<18;i++){let s=o(n,i),l=this.size-11+i%3,f=Math.floor(i/3);this.setFunctionModule(l,f,s),this.setFunctionModule(f,l,s)}}drawFinderPattern(t,n){for(let i=-4;i<=4;i++)for(let s=-4;s<=4;s++){let l=Math.max(Math.abs(s),Math.abs(i)),f=t+s,d=n+i;0<=f&&f<this.size&&0<=d&&d<this.size&&this.setFunctionModule(f,d,l!=2&&l!=4)}}drawAlignmentPattern(t,n){for(let i=-2;i<=2;i++)for(let s=-2;s<=2;s++)this.setFunctionModule(t+s,n+i,Math.max(Math.abs(s),Math.abs(i))!=1)}setFunctionModule(t,n,i){this.modules[n][t]=i,this.isFunction[n][t]=!0}addEccAndInterleave(t){let n=this.version,i=this.errorCorrectionLevel;if(t.length!=e.getNumDataCodewords(n,i))throw new RangeError("Invalid argument");let s=e.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][n],l=e.ECC_CODEWORDS_PER_BLOCK[i.ordinal][n],f=Math.floor(e.getNumRawDataModules(n)/8),d=s-f%s,m=Math.floor(f/s),p=[],R=e.reedSolomonComputeDivisor(l);for(let g=0,E=0;g<s;g++){let A=t.slice(E,E+m-l+(g<d?0:1));E+=A.length;let G=e.reedSolomonComputeRemainder(A,R);g<d&&A.push(0),p.push(A.concat(G))}let b=[];for(let g=0;g<p[0].length;g++)p.forEach((E,A)=>{(g!=m-l||A>=d)&&b.push(E[g])});return u(b.length==f),b}drawCodewords(t){if(t.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let i=this.size-1;i>=1;i-=2){i==6&&(i=5);for(let s=0;s<this.size;s++)for(let l=0;l<2;l++){let f=i-l,m=(i+1&2)==0?this.size-1-s:s;!this.isFunction[m][f]&&n<t.length*8&&(this.modules[m][f]=o(t[n>>>3],7-(n&7)),n++)}}u(n==t.length*8)}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let i=0;i<this.size;i++){let s;switch(t){case 0:s=(i+n)%2==0;break;case 1:s=n%2==0;break;case 2:s=i%3==0;break;case 3:s=(i+n)%3==0;break;case 4:s=(Math.floor(i/3)+Math.floor(n/2))%2==0;break;case 5:s=i*n%2+i*n%3==0;break;case 6:s=(i*n%2+i*n%3)%2==0;break;case 7:s=((i+n)%2+i*n%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[n][i]&&s&&(this.modules[n][i]=!this.modules[n][i])}}getPenaltyScore(){let t=0;for(let l=0;l<this.size;l++){let f=!1,d=0,m=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[l][p]==f?(d++,d==5?t+=e.PENALTY_N1:d>5&&t++):(this.finderPenaltyAddHistory(d,m),f||(t+=this.finderPenaltyCountPatterns(m)*e.PENALTY_N3),f=this.modules[l][p],d=1);t+=this.finderPenaltyTerminateAndCount(f,d,m)*e.PENALTY_N3}for(let l=0;l<this.size;l++){let f=!1,d=0,m=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][l]==f?(d++,d==5?t+=e.PENALTY_N1:d>5&&t++):(this.finderPenaltyAddHistory(d,m),f||(t+=this.finderPenaltyCountPatterns(m)*e.PENALTY_N3),f=this.modules[p][l],d=1);t+=this.finderPenaltyTerminateAndCount(f,d,m)*e.PENALTY_N3}for(let l=0;l<this.size-1;l++)for(let f=0;f<this.size-1;f++){let d=this.modules[l][f];d==this.modules[l][f+1]&&d==this.modules[l+1][f]&&d==this.modules[l+1][f+1]&&(t+=e.PENALTY_N2)}let n=0;for(let l of this.modules)n=l.reduce((f,d)=>f+(d?1:0),n);let i=this.size*this.size,s=Math.ceil(Math.abs(n*20-i*10)/i)-1;return u(0<=s&&s<=9),t+=s*e.PENALTY_N4,u(0<=t&&t<=2568888),t}getAlignmentPatternPositions(){if(this.version==1)return[];{let t=Math.floor(this.version/7)+2,n=Math.floor((this.version*8+t*3+5)/(t*4-4))*2,i=[6];for(let s=this.size-7;i.length<t;s-=n)i.splice(1,0,s);return i}}static getNumRawDataModules(t){if(t<e.MIN_VERSION||t>e.MAX_VERSION)throw new RangeError("Version number out of range");let n=(16*t+128)*t+64;if(t>=2){let i=Math.floor(t/7)+2;n-=(25*i-10)*i-55,t>=7&&(n-=36)}return u(208<=n&&n<=29648),n}static getNumDataCodewords(t,n){return Math.floor(e.getNumRawDataModules(t)/8)-e.ECC_CODEWORDS_PER_BLOCK[n.ordinal][t]*e.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][t]}static reedSolomonComputeDivisor(t){if(t<1||t>255)throw new RangeError("Degree out of range");let n=[];for(let s=0;s<t-1;s++)n.push(0);n.push(1);let i=1;for(let s=0;s<t;s++){for(let l=0;l<n.length;l++)n[l]=e.reedSolomonMultiply(n[l],i),l+1<n.length&&(n[l]^=n[l+1]);i=e.reedSolomonMultiply(i,2)}return n}static reedSolomonComputeRemainder(t,n){let i=n.map(s=>0);for(let s of t){let l=s^i.shift();i.push(0),n.forEach((f,d)=>i[d]^=e.reedSolomonMultiply(f,l))}return i}static reedSolomonMultiply(t,n){if(t>>>8||n>>>8)throw new RangeError("Byte out of range");let i=0;for(let s=7;s>=0;s--)i=i<<1^(i>>>7)*285,i^=(n>>>s&1)*t;return u(i>>>8==0),i}finderPenaltyCountPatterns(t){let n=t[1];u(n<=this.size*3);let i=n>0&&t[2]==n&&t[3]==n*3&&t[4]==n&&t[5]==n;return(i&&t[0]>=n*4&&t[6]>=n?1:0)+(i&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,i){return t&&(this.finderPenaltyAddHistory(n,i),n=0),n+=this.size,this.finderPenaltyAddHistory(n,i),this.finderPenaltyCountPatterns(i)}finderPenaltyAddHistory(t,n){n[0]==0&&(t+=this.size),n.pop(),n.unshift(t)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}a.QrCode=e;function r(h,t,n){if(t<0||t>31||h>>>t)throw new RangeError("Value out of range");for(let i=t-1;i>=0;i--)n.push(h>>>i&1)}function o(h,t){return(h>>>t&1)!=0}function u(h){if(!h)throw new Error("Assertion error")}class c{constructor(t,n,i){if(this.mode=t,this.numChars=n,this.bitData=i,n<0)throw new RangeError("Invalid argument");this.bitData=i.slice()}mode;numChars;bitData;static makeBytes(t){let n=[];for(let i of t)r(i,8,n);return new c(c.Mode.BYTE,t.length,n)}static makeNumeric(t){if(!c.isNumeric(t))throw new RangeError("String contains non-numeric characters");let n=[];for(let i=0;i<t.length;){let s=Math.min(t.length-i,3);r(parseInt(t.substring(i,i+s),10),s*3+1,n),i+=s}return new c(c.Mode.NUMERIC,t.length,n)}static makeAlphanumeric(t){if(!c.isAlphanumeric(t))throw new RangeError("String contains unencodable characters in alphanumeric mode");let n=[],i;for(i=0;i+2<=t.length;i+=2){let s=c.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;s+=c.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),r(s,11,n)}return i<t.length&&r(c.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,n),new c(c.Mode.ALPHANUMERIC,t.length,n)}static makeSegments(t){return t==""?[]:c.isNumeric(t)?[c.makeNumeric(t)]:c.isAlphanumeric(t)?[c.makeAlphanumeric(t)]:[c.makeBytes(c.toUtf8ByteArray(t))]}static makeEci(t){let n=[];if(t<0)throw new RangeError("ECI assignment value out of range");if(t<128)r(t,8,n);else if(t<16384)r(2,2,n),r(t,14,n);else if(t<1e6)r(6,3,n),r(t,21,n);else throw new RangeError("ECI assignment value out of range");return new c(c.Mode.ECI,0,n)}static isNumeric(t){return c.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return c.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(t,n){let i=0;for(let s of t){let l=s.mode.numCharCountBits(n);if(s.numChars>=1<<l)return 1/0;i+=4+l+s.bitData.length}return i}static toUtf8ByteArray(t){t=encodeURI(t);let n=[];for(let i=0;i<t.length;i++)t.charAt(i)!="%"?n.push(t.charCodeAt(i)):(n.push(parseInt(t.substring(i+1,i+3),16)),i+=2);return n}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}a.QrSegment=c})(w||(w={}));(a=>{let e;(r=>{class o{constructor(c,h){this.ordinal=c,this.formatBits=h}ordinal;formatBits;static LOW=new o(0,1);static MEDIUM=new o(1,0);static QUARTILE=new o(2,3);static HIGH=new o(3,2)}r.Ecc=o})(e=a.QrCode||(a.QrCode={}))})(w||(w={}));(a=>{let e;(r=>{class o{constructor(c,h){this.modeBits=c,this.numBitsCharCount=h}modeBits;numBitsCharCount;static NUMERIC=new o(1,[10,12,14]);static ALPHANUMERIC=new o(2,[9,11,13]);static BYTE=new o(4,[8,16,16]);static KANJI=new o(8,[8,10,12]);static ECI=new o(7,[0,0,0]);numCharCountBits(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}}r.Mode=o})(e=a.QrSegment||(a.QrSegment={}))})(w||(w={}));var v=w.QrCode,$=w.QrSegment;var tt=4,x=["L","M","Q","H"],P=[v.Ecc.LOW,v.Ecc.MEDIUM,v.Ecc.QUARTILE,v.Ecc.HIGH];function H(a){if(a==null||a.trim()==="")return 1;let e=a.trim().toUpperCase(),r=x.indexOf(e);return r!==-1?r:/^[0-3]$/.test(e)?Number(e):null}function Y(a,e=1){let r=P[e]??P[1],o;try{o=v.encodeSegments($.makeSegments(a),r,1,40,-1,!1)}catch(c){let h=new RangeError(c instanceof Error?c.message:String(c));throw h.reason=/too long/i.test(h.message)?"capacity":"encoding",h}let u=[];for(let c=0;c<o.size;c++){let h=[];for(let t=0;t<o.size;t++)h.push(o.getModule(t,c));u.push(h)}return{version:o.version,size:o.size,ecl:P.indexOf(r),modules:u}}function q(a,e){let r=a+tt*2,o=Math.max(1,Math.floor(e/r)),u=Math.max(e,o*r),c=Math.floor((u-o*a)/2);return{cell:o,offset:c,edge:u}}function U([a,e,r]){let o=u=>{let c=u/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4};return .2126*o(a)+.7152*o(e)+.0722*o(r)}function V(a,e){let r=[];(e[3]??1)<1&&r.push("the background is not opaque, so the code takes on whatever is behind it"),(a[3]??1)<1&&r.push("the module colour is not opaque");let o=U(a),u=U(e);o>u&&r.push("modules are lighter than the background (inverted codes are rejected by many scanners)");let c=(Math.max(o,u)+.05)/(Math.min(o,u)+.05);return c<4&&r.push(`contrast is ${c.toFixed(2)}:1 (aim for at least 4:1)`),r}var et=200,nt="#000",it="#fff",I=class extends N{#t=null;#e=null;#n="";#o=!1;#i="";#s="";static get observedAttributes(){return["value","size","color","background","error-correction","data-label-prefix"]}get value(){return this.getAttribute("value")||this.#n}set value(e){e==null||e===""?this.removeAttribute("value"):this.setAttribute("value",String(e))}setup(){if(!this.#e){this.#n=(this.textContent??"").trim();let e=document.createElement("span");e.setAttribute("data-qr-caption",""),e.append(...this.childNodes),!this.#n&&!e.children.length&&(e.textContent=this.value,this.#o=!0),this.#e=e}return this.#t||(this.#t=document.createElement("canvas"),this.#t.setAttribute("role","img")),this.#t.parentNode!==this&&this.prepend(this.#t),this.#e.parentNode!==this&&this.append(this.#e),this.#r(),this.#a(),!0}#a(){if(typeof window.matchMedia!="function")return;let e=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`);this.listen(e,"change",()=>{this.isConnected&&(this.#r(),this.#a())},{once:!0})}attributeChangedCallback(){!this.hasAttribute("data-upgraded")||!this.isConnected||this.#r()}#r(){let e=this.#t,r=this.value;if(e.setAttribute("aria-label",this.getAttribute("data-label-prefix")||"QR code"),this.#o&&this.#e&&this.#e.textContent!==r&&(this.#e.textContent=r),this.removeAttribute("data-error"),!r){this.#c();return}let o=this.getAttribute("error-correction"),u=H(o);u===null&&(console.warn(`<qr-code>: error-correction="${o}" is not L, M, Q, H or 0-3; using M.`),u=1);let c;try{c=Y(r,u)}catch(m){let p=m.reason||"encoding";this.#c(),this.setAttribute("data-error",p),this.dispatchEvent(new CustomEvent("qr-code:error",{bubbles:!0,detail:{reason:p,value:r,errorCorrection:x[u],message:m.message}}));return}let h=Math.max(1,parseInt(this.getAttribute("size")??"",10)||et),t=Math.max(1,window.devicePixelRatio||1),{cell:n,offset:i,edge:s}=q(c.size,Math.round(h*t));e.hidden=!1,e.width=s,e.height=s,e.style.inlineSize=`${h}px`;let l=this.#l(this.getAttribute("color"),nt),f=this.#l(this.getAttribute("background"),it);this.#u(l,f);let d=e.getContext("2d");if(d){d.clearRect(0,0,s,s),d.fillStyle=f.css,d.fillRect(0,0,s,s),d.fillStyle=l.css;for(let m=0;m<c.size;m++)for(let p=0;p<c.size;p++)c.modules[m][p]&&d.fillRect(i+p*n,i+m*n,n,n);this.#i=r}}#c(){let e=this.#t;e.hidden=!0,e.width=0,e.height=0,this.#i=""}#l(e,r){let o=this.#t,u=e?.trim()||r,c=o.style.color;o.style.color="",o.style.color=u,o.style.color||(console.warn(`<qr-code>: "${u}" is not a valid colour; using ${r}.`),o.style.color=r);let h=getComputedStyle(o).color;o.style.color=c;let t=(h.match(/[\d.]+/g)||[]).map(Number),n=[t[0]??0,t[1]??0,t[2]??0,t[3]??1];return{css:h,rgba:n}}#u(e,r){if(!this.hasAttribute("color")&&!this.hasAttribute("background"))return;let o=`${e.css}|${r.css}`;if(o===this.#s)return;this.#s=o;let u=V(e.rgba,r.rgba);u.length&&console.warn(`<qr-code>: color="${e.css}" on background="${r.css}" may not scan: ${u.join("; ")}.`,this)}toDataURL(e="image/png"){return!this.#t||!this.#i?"":this.#t.toDataURL(e)}async copy({button:e}={}){let r=this.#t;if(!r||!this.#i)return!1;let o=this.#i,u=await new Promise(c=>r.toBlob(c,"image/png"));return O({text:o,blob:u||void 0},{button:e,announceMessage:this.getAttribute("data-label-copied")||"QR code copied"})}};B("qr-code",I);export{I as QrCodeWc};
|
|
1
|
+
var ct=window.matchMedia("(prefers-reduced-motion: reduce)");var B=new Map;function k(c,e,o={}){let s=o.priority??10,l={impl:e,bundle:o.bundle,contract:o.contract,priority:s},a=B.get(c);if(customElements.get(c)){if(!a||a.priority>=s){a&&a.priority===s&&a.impl!==e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${o.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${o.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=s){a.priority===s&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${a.bundle}". Skipping "${o.bundle}" (first wins at equal priority).`);return}B.set(c,l),customElements.define(c,e)}var T=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,o,s,l){e.addEventListener(o,s,l),this.#t.push(()=>e.removeEventListener(o,s,l))}_reinit(){for(let e of this.#t)e();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,o){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{o?s.add(e):s.delete(e)}catch{let l=`--${e}`;o?s.add(l):s.delete(l)}}_adoptInternals(e){this.#e||(this.#e=e)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var X=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),$=new WeakMap;function G(c,e){let o=$.get(e);o||$.set(e,o=new Map);let s=o.get(c);if(!s||!s.region.isConnected){let a=(e.ownerDocument||document).createElement("span");a.setAttribute("data-vb-announcer",c),a.setAttribute("role",c==="assertive"?"alert":"status"),a.setAttribute("aria-live",c),a.setAttribute("aria-atomic","true"),a.style.cssText=X,e.appendChild(a),s={region:a},o.set(c,s)}return s}function N(c,{politeness:e="polite",root:o}={}){let s=String(c??"").trim();if(!s||typeof document>"u")return null;let l=o||document.body;if(!l)return null;let h=G(e==="assertive"?"assertive":"polite",l);return clearTimeout(h.write),clearTimeout(h.clear),h.region.textContent="",h.write=setTimeout(()=>{h.region.textContent=s,h.clear=setTimeout(()=>{h.region.textContent=""},7e3)},50),h.region}function y(c,e,o,s){let l=`data-label-${e}`,h=c?.closest?.(`[${l}]`)?.getAttribute(l)||o;return s?h.replace(/\{(\w+)\}/g,(t,r)=>r in s?String(s[r]):t):h}var S=1500,K="[data-copy], [data-copy-target], [data-paste-target]",A={copied:"Copied to clipboard",pasted:"Pasted from clipboard","copy-failed":"Copy failed","copy-failed-selected":"Copy failed. Text selected, press Ctrl+C to copy","paste-failed":"Paste failed"},P=new WeakMap;function W(c){if(typeof document.execCommand!="function"||!document.body)return!1;let e=document.activeElement,o=document.createElement("textarea");o.value=c,o.setAttribute("readonly",""),o.setAttribute("aria-hidden","true"),o.style.cssText="position:fixed;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none",document.body.appendChild(o),o.select();let s=!1;try{s=document.execCommand("copy")}catch{s=!1}return o.remove(),e?.focus?.({preventScroll:!0}),s}function Z(c){if(!c)return!1;if(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement)return c.focus(),c.select(),!0;let e=window.getSelection?.();if(!e)return!1;let o=document.createRange();return o.selectNodeContents(c),e.removeAllRanges(),e.addRange(o),!e.isCollapsed}async function D(c,e={}){if(c==null||c==="")return!1;let{button:o,duration:s=S}=e,l=!1,a=null;try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(c),l=!0}catch(t){a=t,l=W(c)}if(l)return M({button:o,duration:s,state:"copied",eventName:"copy:done",eventDetail:{text:c},message:e.announceMessage??y(o,"copied",A.copied)}),!0;let h=Z(e.source);return M({button:o,duration:s,state:"failed",eventName:"copy:error",eventDetail:{text:c,error:a},message:e.failureMessage??y(o,"copy-failed",h?A["copy-failed-selected"]:A["copy-failed"])}),!1}async function F(c,e={}){let{text:o,html:s,blob:l}=c??{};if(!o&&!s&&!l)return!1;let{button:a,duration:h=S}=e;if(typeof ClipboardItem<"u"&&typeof navigator.clipboard?.write=="function"){let r={};o&&(r["text/plain"]=new Blob([o],{type:"text/plain"})),s&&(r["text/html"]=new Blob([s],{type:"text/html"})),l&&(r[l.type]=l);try{return await navigator.clipboard.write([new ClipboardItem(r)]),M({button:a,duration:h,state:"copied",eventName:"copy:done",eventDetail:{payload:c},message:e.announceMessage??y(a,"copied",A.copied)}),!0}catch{}}return o?D(o,e):(M({button:a,duration:h,state:"failed",eventName:"copy:error",eventDetail:{payload:c,error:null},message:e.failureMessage??y(a,"copy-failed",A["copy-failed"])}),!1)}function M({button:c,duration:e,message:o,eventDetail:s,state:l,eventName:a}){if(c){c.dataset.state=l;let h=P.get(c);h&&clearTimeout(h),P.set(c,setTimeout(()=>{c.dataset.state===l&&delete c.dataset.state,P.delete(c)},e)),c.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:s}))}N(o,{politeness:l==="failed"?"assertive":"polite"})}async function J(c,e={}){let{button:o,duration:s=S}=e,l;try{if(!navigator.clipboard?.readText)throw new Error("Clipboard API unavailable");l=await navigator.clipboard.readText()}catch(a){return M({button:o,duration:s,state:"failed",eventName:"paste:error",eventDetail:{target:c,error:a},message:e.failureMessage??y(o,"paste-failed",A["paste-failed"])}),null}return c&&(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement||c instanceof HTMLSelectElement?c.value=l:c.textContent=l,c.dispatchEvent(new Event("input",{bubbles:!0}))),M({button:o,duration:s,state:"pasted",eventName:"paste:done",eventDetail:{text:l,target:c},message:e.announceMessage??y(o,"pasted",A.pasted)}),l}function O(c){let e=c.dataset.copyTarget;if(!e)return null;try{return document.querySelector(e)}catch{return null}}function Q(c){if(c.dataset.copy)return c.dataset.copy;let e=O(c);if(!e)return"";let o=c.dataset.copyAttr;return o?e.getAttribute(o)??"":e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e.value:e.textContent??""}function tt(c){let e=c.target?.closest?.(K);if(!e||e.matches(':disabled, [aria-disabled="true"]'))return;if(e.dataset.pasteTarget){let s=null;try{s=document.querySelector(e.dataset.pasteTarget)}catch{}if(!s)return;J(s,{button:e});return}let o=Q(e);o&&D(o,{button:e,source:O(e)??void 0})}typeof document<"u"&&!document.__vbCopyDelegated&&(document.__vbCopyDelegated=!0,document.addEventListener("click",tt));var w;(c=>{class e{constructor(t,r,n,i){if(this.version=t,this.errorCorrectionLevel=r,t<e.MIN_VERSION||t>e.MAX_VERSION)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;let u=[];for(let d=0;d<this.size;d++)u.push(!1);for(let d=0;d<this.size;d++)this.modules.push(u.slice()),this.isFunction.push(u.slice());this.drawFunctionPatterns();let f=this.addEccAndInterleave(n);if(this.drawCodewords(f),i==-1){let d=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);let p=this.getPenaltyScore();p<d&&(i=m,d=p),this.applyMask(m)}}l(0<=i&&i<=7),this.mask=i,this.applyMask(i),this.drawFormatBits(i),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(t,r){let n=c.QrSegment.makeSegments(t);return e.encodeSegments(n,r)}static encodeBinary(t,r){let n=c.QrSegment.makeBytes(t);return e.encodeSegments([n],r)}static encodeSegments(t,r,n=1,i=40,u=-1,f=!0){if(!(e.MIN_VERSION<=n&&n<=i&&i<=e.MAX_VERSION)||u<-1||u>7)throw new RangeError("Invalid value");let d,m;for(d=n;;d++){let b=e.getNumDataCodewords(d,r)*8,E=a.getTotalBits(t,d);if(E<=b){m=E;break}if(d>=i)throw new RangeError("Data too long")}for(let b of[e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])f&&m<=e.getNumDataCodewords(d,b)*8&&(r=b);let p=[];for(let b of t){o(b.mode.modeBits,4,p),o(b.numChars,b.mode.numCharCountBits(d),p);for(let E of b.getData())p.push(E)}l(p.length==m);let R=e.getNumDataCodewords(d,r)*8;l(p.length<=R),o(0,Math.min(4,R-p.length),p),o(0,(8-p.length%8)%8,p),l(p.length%8==0);for(let b=236;p.length<R;b^=253)o(b,8,p);let g=[];for(;g.length*8<p.length;)g.push(0);return p.forEach((b,E)=>g[E>>>3]|=b<<7-(E&7)),new e(d,r,g,u)}size;mask;modules=[];isFunction=[];getModule(t,r){return 0<=t&&t<this.size&&0<=r&&r<this.size&&this.modules[r][t]}drawFunctionPatterns(){for(let n=0;n<this.size;n++)this.setFunctionModule(6,n,n%2==0),this.setFunctionModule(n,6,n%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let t=this.getAlignmentPatternPositions(),r=t.length;for(let n=0;n<r;n++)for(let i=0;i<r;i++)n==0&&i==0||n==0&&i==r-1||n==r-1&&i==0||this.drawAlignmentPattern(t[n],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){let r=this.errorCorrectionLevel.formatBits<<3|t,n=r;for(let u=0;u<10;u++)n=n<<1^(n>>>9)*1335;let i=(r<<10|n)^21522;l(i>>>15==0);for(let u=0;u<=5;u++)this.setFunctionModule(8,u,s(i,u));this.setFunctionModule(8,7,s(i,6)),this.setFunctionModule(8,8,s(i,7)),this.setFunctionModule(7,8,s(i,8));for(let u=9;u<15;u++)this.setFunctionModule(14-u,8,s(i,u));for(let u=0;u<8;u++)this.setFunctionModule(this.size-1-u,8,s(i,u));for(let u=8;u<15;u++)this.setFunctionModule(8,this.size-15+u,s(i,u));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let n=0;n<12;n++)t=t<<1^(t>>>11)*7973;let r=this.version<<12|t;l(r>>>18==0);for(let n=0;n<18;n++){let i=s(r,n),u=this.size-11+n%3,f=Math.floor(n/3);this.setFunctionModule(u,f,i),this.setFunctionModule(f,u,i)}}drawFinderPattern(t,r){for(let n=-4;n<=4;n++)for(let i=-4;i<=4;i++){let u=Math.max(Math.abs(i),Math.abs(n)),f=t+i,d=r+n;0<=f&&f<this.size&&0<=d&&d<this.size&&this.setFunctionModule(f,d,u!=2&&u!=4)}}drawAlignmentPattern(t,r){for(let n=-2;n<=2;n++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,r+n,Math.max(Math.abs(i),Math.abs(n))!=1)}setFunctionModule(t,r,n){this.modules[r][t]=n,this.isFunction[r][t]=!0}addEccAndInterleave(t){let r=this.version,n=this.errorCorrectionLevel;if(t.length!=e.getNumDataCodewords(r,n))throw new RangeError("Invalid argument");let i=e.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][r],u=e.ECC_CODEWORDS_PER_BLOCK[n.ordinal][r],f=Math.floor(e.getNumRawDataModules(r)/8),d=i-f%i,m=Math.floor(f/i),p=[],R=e.reedSolomonComputeDivisor(u);for(let b=0,E=0;b<i;b++){let v=t.slice(E,E+m-u+(b<d?0:1));E+=v.length;let _=e.reedSolomonComputeRemainder(v,R);b<d&&v.push(0),p.push(v.concat(_))}let g=[];for(let b=0;b<p[0].length;b++)p.forEach((E,v)=>{(b!=m-u||v>=d)&&g.push(E[b])});return l(g.length==f),g}drawCodewords(t){if(t.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let n=this.size-1;n>=1;n-=2){n==6&&(n=5);for(let i=0;i<this.size;i++)for(let u=0;u<2;u++){let f=n-u,m=(n+1&2)==0?this.size-1-i:i;!this.isFunction[m][f]&&r<t.length*8&&(this.modules[m][f]=s(t[r>>>3],7-(r&7)),r++)}}l(r==t.length*8)}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let n=0;n<this.size;n++){let i;switch(t){case 0:i=(n+r)%2==0;break;case 1:i=r%2==0;break;case 2:i=n%3==0;break;case 3:i=(n+r)%3==0;break;case 4:i=(Math.floor(n/3)+Math.floor(r/2))%2==0;break;case 5:i=n*r%2+n*r%3==0;break;case 6:i=(n*r%2+n*r%3)%2==0;break;case 7:i=((n+r)%2+n*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][n]&&i&&(this.modules[r][n]=!this.modules[r][n])}}getPenaltyScore(){let t=0;for(let u=0;u<this.size;u++){let f=!1,d=0,m=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[u][p]==f?(d++,d==5?t+=e.PENALTY_N1:d>5&&t++):(this.finderPenaltyAddHistory(d,m),f||(t+=this.finderPenaltyCountPatterns(m)*e.PENALTY_N3),f=this.modules[u][p],d=1);t+=this.finderPenaltyTerminateAndCount(f,d,m)*e.PENALTY_N3}for(let u=0;u<this.size;u++){let f=!1,d=0,m=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][u]==f?(d++,d==5?t+=e.PENALTY_N1:d>5&&t++):(this.finderPenaltyAddHistory(d,m),f||(t+=this.finderPenaltyCountPatterns(m)*e.PENALTY_N3),f=this.modules[p][u],d=1);t+=this.finderPenaltyTerminateAndCount(f,d,m)*e.PENALTY_N3}for(let u=0;u<this.size-1;u++)for(let f=0;f<this.size-1;f++){let d=this.modules[u][f];d==this.modules[u][f+1]&&d==this.modules[u+1][f]&&d==this.modules[u+1][f+1]&&(t+=e.PENALTY_N2)}let r=0;for(let u of this.modules)r=u.reduce((f,d)=>f+(d?1:0),r);let n=this.size*this.size,i=Math.ceil(Math.abs(r*20-n*10)/n)-1;return l(0<=i&&i<=9),t+=i*e.PENALTY_N4,l(0<=t&&t<=2568888),t}getAlignmentPatternPositions(){if(this.version==1)return[];{let t=Math.floor(this.version/7)+2,r=Math.floor((this.version*8+t*3+5)/(t*4-4))*2,n=[6];for(let i=this.size-7;n.length<t;i-=r)n.splice(1,0,i);return n}}static getNumRawDataModules(t){if(t<e.MIN_VERSION||t>e.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*t+128)*t+64;if(t>=2){let n=Math.floor(t/7)+2;r-=(25*n-10)*n-55,t>=7&&(r-=36)}return l(208<=r&&r<=29648),r}static getNumDataCodewords(t,r){return Math.floor(e.getNumRawDataModules(t)/8)-e.ECC_CODEWORDS_PER_BLOCK[r.ordinal][t]*e.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][t]}static reedSolomonComputeDivisor(t){if(t<1||t>255)throw new RangeError("Degree out of range");let r=[];for(let i=0;i<t-1;i++)r.push(0);r.push(1);let n=1;for(let i=0;i<t;i++){for(let u=0;u<r.length;u++)r[u]=e.reedSolomonMultiply(r[u],n),u+1<r.length&&(r[u]^=r[u+1]);n=e.reedSolomonMultiply(n,2)}return r}static reedSolomonComputeRemainder(t,r){let n=r.map(i=>0);for(let i of t){let u=i^n.shift();n.push(0),r.forEach((f,d)=>n[d]^=e.reedSolomonMultiply(f,u))}return n}static reedSolomonMultiply(t,r){if(t>>>8||r>>>8)throw new RangeError("Byte out of range");let n=0;for(let i=7;i>=0;i--)n=n<<1^(n>>>7)*285,n^=(r>>>i&1)*t;return l(n>>>8==0),n}finderPenaltyCountPatterns(t){let r=t[1];l(r<=this.size*3);let n=r>0&&t[2]==r&&t[3]==r*3&&t[4]==r&&t[5]==r;return(n&&t[0]>=r*4&&t[6]>=r?1:0)+(n&&t[6]>=r*4&&t[0]>=r?1:0)}finderPenaltyTerminateAndCount(t,r,n){return t&&(this.finderPenaltyAddHistory(r,n),r=0),r+=this.size,this.finderPenaltyAddHistory(r,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(t,r){r[0]==0&&(t+=this.size),r.pop(),r.unshift(t)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}c.QrCode=e;function o(h,t,r){if(t<0||t>31||h>>>t)throw new RangeError("Value out of range");for(let n=t-1;n>=0;n--)r.push(h>>>n&1)}function s(h,t){return(h>>>t&1)!=0}function l(h){if(!h)throw new Error("Assertion error")}class a{constructor(t,r,n){if(this.mode=t,this.numChars=r,this.bitData=n,r<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}mode;numChars;bitData;static makeBytes(t){let r=[];for(let n of t)o(n,8,r);return new a(a.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!a.isNumeric(t))throw new RangeError("String contains non-numeric characters");let r=[];for(let n=0;n<t.length;){let i=Math.min(t.length-n,3);o(parseInt(t.substring(n,n+i),10),i*3+1,r),n+=i}return new a(a.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!a.isAlphanumeric(t))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],n;for(n=0;n+2<=t.length;n+=2){let i=a.ALPHANUMERIC_CHARSET.indexOf(t.charAt(n))*45;i+=a.ALPHANUMERIC_CHARSET.indexOf(t.charAt(n+1)),o(i,11,r)}return n<t.length&&o(a.ALPHANUMERIC_CHARSET.indexOf(t.charAt(n)),6,r),new a(a.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==""?[]:a.isNumeric(t)?[a.makeNumeric(t)]:a.isAlphanumeric(t)?[a.makeAlphanumeric(t)]:[a.makeBytes(a.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw new RangeError("ECI assignment value out of range");if(t<128)o(t,8,r);else if(t<16384)o(2,2,r),o(t,14,r);else if(t<1e6)o(6,3,r),o(t,21,r);else throw new RangeError("ECI assignment value out of range");return new a(a.Mode.ECI,0,r)}static isNumeric(t){return a.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return a.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(t,r){let n=0;for(let i of t){let u=i.mode.numCharCountBits(r);if(i.numChars>=1<<u)return 1/0;n+=4+u+i.bitData.length}return n}static toUtf8ByteArray(t){t=encodeURI(t);let r=[];for(let n=0;n<t.length;n++)t.charAt(n)!="%"?r.push(t.charCodeAt(n)):(r.push(parseInt(t.substring(n+1,n+3),16)),n+=2);return r}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}c.QrSegment=a})(w||(w={}));(c=>{let e;(o=>{class s{constructor(a,h){this.ordinal=a,this.formatBits=h}ordinal;formatBits;static LOW=new s(0,1);static MEDIUM=new s(1,0);static QUARTILE=new s(2,3);static HIGH=new s(3,2)}o.Ecc=s})(e=c.QrCode||(c.QrCode={}))})(w||(w={}));(c=>{let e;(o=>{class s{constructor(a,h){this.modeBits=a,this.numBitsCharCount=h}modeBits;numBitsCharCount;static NUMERIC=new s(1,[10,12,14]);static ALPHANUMERIC=new s(2,[9,11,13]);static BYTE=new s(4,[8,16,16]);static KANJI=new s(8,[8,10,12]);static ECI=new s(7,[0,0,0]);numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}}o.Mode=s})(e=c.QrSegment||(c.QrSegment={}))})(w||(w={}));var C=w.QrCode,z=w.QrSegment;var et=4,L=["L","M","Q","H"],x=[C.Ecc.LOW,C.Ecc.MEDIUM,C.Ecc.QUARTILE,C.Ecc.HIGH];function U(c){if(c==null||c.trim()==="")return 1;let e=c.trim().toUpperCase(),o=L.indexOf(e);return o!==-1?o:/^[0-3]$/.test(e)?Number(e):null}function q(c,e=1){let o=x[e]??x[1],s;try{s=C.encodeSegments(z.makeSegments(c),o,1,40,-1,!1)}catch(a){let h=new RangeError(a instanceof Error?a.message:String(a));throw h.reason=/too long/i.test(h.message)?"capacity":"encoding",h}let l=[];for(let a=0;a<s.size;a++){let h=[];for(let t=0;t<s.size;t++)h.push(s.getModule(t,a));l.push(h)}return{version:s.version,size:s.size,ecl:x.indexOf(o),modules:l}}function Y(c,e){let o=c+et*2,s=Math.max(1,Math.floor(e/o)),l=Math.max(e,s*o),a=Math.floor((l-s*c)/2);return{cell:s,offset:a,edge:l}}function H([c,e,o]){let s=l=>{let a=l/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4};return .2126*s(c)+.7152*s(e)+.0722*s(o)}function V(c,e){let o=[];(e[3]??1)<1&&o.push("the background is not opaque, so the code takes on whatever is behind it"),(c[3]??1)<1&&o.push("the module colour is not opaque");let s=H(c),l=H(e);s>l&&o.push("modules are lighter than the background (inverted codes are rejected by many scanners)");let a=(Math.max(s,l)+.05)/(Math.min(s,l)+.05);return a<4&&o.push(`contrast is ${a.toFixed(2)}:1 (aim for at least 4:1)`),o}var rt=200,nt="#000",ot="#fff",j=200,I=class extends T{#t=null;#e=null;#r="";#s=!1;#n="";#i="";static get observedAttributes(){return["value","size","color","background","error-correction","data-label-prefix"]}get value(){return this.getAttribute("value")||this.#r}set value(e){e==null||e===""?this.removeAttribute("value"):this.setAttribute("value",String(e))}setup(){if(!this.#e){this.#r=(this.textContent??"").trim();let e=document.createElement("span");e.setAttribute("data-qr-caption",""),e.append(...this.childNodes),!this.#r&&!e.children.length&&(e.textContent=this.value,this.#s=!0),this.#e=e}return this.#t||(this.#t=document.createElement("canvas"),this.#t.setAttribute("role","img")),this.#t.parentNode!==this&&this.prepend(this.#t),this.#e.parentNode!==this&&this.append(this.#e),this.#o(),this.#a(),!0}#a(){if(typeof window.matchMedia!="function")return;let e=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`);this.listen(e,"change",()=>{this.isConnected&&(this.#o(),this.#a())},{once:!0})}attributeChangedCallback(){!this.hasAttribute("data-upgraded")||!this.isConnected||this.#o()}#o(){this.#u(this.#d())}#u(e){let o=this.#t,s=this.#e,l=e?this.value:"",a=this.getAttribute("data-label-prefix"),h=l.length>j?`${l.slice(0,j)}\u2026`:l;o.setAttribute("aria-label",a||(l?`QR code: ${h}`:"QR code")),a&&l?o.setAttribute("aria-description",l):o.removeAttribute("aria-description"),!a&&!!l&&h===l&&!s.children.length&&(s.textContent??"").trim()===l?s.setAttribute("aria-hidden","true"):s.removeAttribute("aria-hidden")}#d(){let e=this.#t,o=this.value;if(this.#s&&this.#e&&this.#e.textContent!==o&&(this.#e.textContent=o),this.removeAttribute("data-error"),!o)return this.#c(),!1;let s=this.getAttribute("error-correction"),l=U(s);l===null&&(console.warn(`<qr-code>: error-correction="${s}" is not L, M, Q, H or 0-3; using M.`),l=1);let a;try{a=q(o,l)}catch(m){let p=m.reason||"encoding";return this.#c(),this.setAttribute("data-error",p),this.dispatchEvent(new CustomEvent("qr-code:error",{bubbles:!0,detail:{reason:p,value:o,errorCorrection:L[l],message:m.message}})),!1}let h=Math.max(1,parseInt(this.getAttribute("size")??"",10)||rt),t=Math.max(1,window.devicePixelRatio||1),{cell:r,offset:n,edge:i}=Y(a.size,Math.round(h*t));e.hidden=!1,e.width=i,e.height=i,e.style.inlineSize=`${h}px`;let u=this.#l(this.getAttribute("color"),nt),f=this.#l(this.getAttribute("background"),ot);this.#h(u,f);let d=e.getContext("2d");if(!d)return!1;d.clearRect(0,0,i,i),d.fillStyle=f.css,d.fillRect(0,0,i,i),d.fillStyle=u.css;for(let m=0;m<a.size;m++)for(let p=0;p<a.size;p++)a.modules[m][p]&&d.fillRect(n+p*r,n+m*r,r,r);return this.#n=o,!0}#c(){let e=this.#t;e.hidden=!0,e.width=0,e.height=0,this.#n=""}#l(e,o){let s=this.#t,l=e?.trim()||o,a=s.style.color;s.style.color="",s.style.color=l,s.style.color||(console.warn(`<qr-code>: "${l}" is not a valid colour; using ${o}.`),s.style.color=o);let h=getComputedStyle(s).color;s.style.color=a;let t=(h.match(/[\d.]+/g)||[]).map(Number),r=[t[0]??0,t[1]??0,t[2]??0,t[3]??1];return{css:h,rgba:r}}#h(e,o){if(!this.hasAttribute("color")&&!this.hasAttribute("background"))return;let s=`${e.css}|${o.css}`;if(s===this.#i)return;this.#i=s;let l=V(e.rgba,o.rgba);l.length&&console.warn(`<qr-code>: color="${e.css}" on background="${o.css}" may not scan: ${l.join("; ")}.`,this)}toDataURL(e="image/png"){return!this.#t||!this.#n?"":this.#t.toDataURL(e)}async copy({button:e}={}){let o=this.#t;if(!o||!this.#n)return!1;let s=this.#n,l=await new Promise(a=>o.toBlob(a,"image/png"));return F({text:s,blob:l||void 0},{button:e,announceMessage:this.getAttribute("data-label-copied")||"QR code copied"})}};k("qr-code",I);export{I as QrCodeWc};
|
|
2
2
|
//# sourceMappingURL=qr-code.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var O=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function f(r,t,e={}){let i=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=E.get(r);if(customElements.get(r)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(r,o),customElements.define(r,t)}var u=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,o){t.addEventListener(e,i,o),this.#i.push(()=>t.removeEventListener(e,i,o))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let o=`--${t}`;e?i.add(o):i.delete(o)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var b=CSS.supports("anchor-name","--x"),P=CSS.supports("position-area","bottom"),k=(()=>{let r=document.createElement("span");return r.setAttribute("popover","hint"),r.popover==="hint"})(),N=["auto","manual","hint"];function M(r){let t=N.includes(r||"")?r:"auto";return t==="hint"&&!k?"auto":t}var q=["top","bottom","left","right","inset-inline-start","inset-inline-end"],T=["position","top","left","right","bottom","margin"],w=8,L=0,V=0;function C(r){return!r||r==="none"?[]:r.split(",").map(t=>t.trim()).filter(Boolean)}var g=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#i=null;#t=null;#e=`--pop-over-anchor-${++V}`;#s=!1;#o=!1;#r=!1;setup(){if(this.id||(this.id=`pop-over-${++L}`),(!this.hasAttribute("popover")||this.#s)&&this.#n(),this.#u(),this.#h(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!b&&t.newState==="open"&&this.#i&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!b){let t=()=>{this.matches(":popover-open")&&this.#i&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#o&&(q.forEach(t=>this.style.removeProperty(t)),this.#o=!1),this.#r&&(T.forEach(t=>this.style.removeProperty(t)),this.#r=!1),this.#i=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#s=!0);return}if(t==="data-mode"){this.#n();return}this._reinit()}}#n(){let t=M(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#s=!0}show(){this.matches(":popover-open")||(this.showPopover(),!b&&this.#i&&this.matches(":popover-open")&&this.#a())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#u(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#i=e}else this.#i=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#h(){if(!this.#i||!b)return;let t=this.#i,e=t.style.getPropertyValue("anchor-name"),i=C(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#e)||i.push(this.#e),t.style.setProperty("anchor-name",i.join(", ")),this.#t=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),P||this.#d(this.dataset.position||"bottom")}#c(){if(this.#i&&this.#t){let t=C(this.#i.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#t);t.length?this.#i.style.setProperty("anchor-name",t.join(", ")):this.#i.style.removeProperty("anchor-name")}this.#t=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#d(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},o={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],a=o[s]||o.bottom;Object.entries(a).forEach(([l,n])=>this.style.setProperty(l,n)),this.#o=!0}#a(){if(!this.#i)return;let t=this.#i.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#p(),o=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#r=!0;let a=this.offsetWidth,l=this.offsetHeight,n=e.split("-")[0];["top","bottom","left","right"].includes(n)||(n="bottom");let d={top:t.top-i,bottom:s-t.bottom-i,left:t.left-i,right:o-t.right-i},p={top:"bottom",bottom:"top",left:"right",right:"left"},x=n==="top"||n==="bottom"?l:a;d[n]<x&&d[p[n]]>d[n]&&(n=p[n]);let h,c;switch(n){case"top":h=t.top-l-i,c=t.left;break;case"left":h=t.top,c=t.left-a-i;break;case"right":h=t.top,c=t.right+i;break;default:h=t.bottom+i,c=t.left;break}if(n==="top"||n==="bottom"){let m=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==m?t.right-a:t.left}else e.endsWith("-end")&&(h=t.bottom-l);let A=(m,v,$)=>Math.max(w,Math.min(m,$-v-w));c=A(c,a,o),h=A(h,l,s),this.style.top=`${Math.round(h)}px`,this.style.left=`${Math.round(c)}px`}#p(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};f("pop-over",g);var B=0,S={one:"{count} reaction",other:"{count} reactions"},y=class extends u{static get observedAttributes(){return["data-disabled"]}#i=null;#t=null;#e=null;#s=null;#o=new Set;setup(){this.setAttribute("role","toolbar"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("data-label-toolbar")||"Reactions"),this.#i=this.querySelector(":scope > template[data-palette]"),this.#h().forEach(t=>this.#c(t)),this.#C(),this.#S(),this.#m(),this.#l(),this.listen(this,"click",this.#a),this.listen(this,"keydown",this.#p),this.#e&&(this.listen(this.#e,"pop-over:show",this.#v),this.listen(this.#e,"pop-over:hide",this.#E),this.listen(this.#e,"toggle",this.#w))}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||t==="data-disabled"&&(this.#m(),this.#l())}#r(){return this.closest("[lang]")?.lang||void 0}#n(t){try{return new Intl.NumberFormat(this.#r()).format(t)}catch{return String(t)}}#u(t){let e="other";try{e=new Intl.PluralRules(this.#r()).select(t)}catch{}return(this.getAttribute(`data-label-count-${e}`)??this.getAttribute("data-label-count-other")??S[e]??S.other).replaceAll("{count}",this.#n(t))}#h(){return[...this.querySelectorAll(":scope > button[data-reaction]")]}#c(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.type="button";let e=t.dataset.label||t.getAttribute("aria-label");e&&(t.dataset.label=e);let i=t.textContent?.trim()??"";t.replaceChildren();let o=document.createElement("span");o.className="reaction-emoji",o.setAttribute("aria-hidden","true"),o.textContent=i;let s=document.createElement("span");s.className="reaction-count",s.setAttribute("aria-hidden","true"),t.append(o,s),this.#d(t)}#d(t){let e=Number(t.dataset.count)||0,i=t.hasAttribute("data-mine"),o=t.dataset.label||t.querySelector(".reaction-emoji")?.textContent||t.dataset.reaction||"",s=t.querySelector(".reaction-count");s&&(s.textContent=e>0?this.#n(e):""),t.setAttribute("aria-pressed",i?"true":"false"),t.setAttribute("aria-label",`${o}, ${this.#u(e)}`)}#a=t=>{let e=t.target?.closest?.("button[data-reaction]");e&&(e.parentElement===this?this.#b(e):this.#s?.contains(e)&&this.#A(e))};#p=t=>{let e=t.target;this.#s?.contains(e)?this.#x(t):this.#$(t)};#b(t){if(this.hasAttribute("data-disabled")||t.hasAttribute("data-pending"))return;let e=t.dataset.reaction??"",i=Number(t.dataset.count)||0,o=t.hasAttribute("data-mine");t.setAttribute("data-pending",""),t.setAttribute("aria-busy","true"),this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:e,action:o?"remove":"add",count:i,mine:o}}))}#A(t){if(this.hasAttribute("data-disabled"))return;let e=t.dataset.reaction??"",i=this.#y(e);i?this.#b(i):this.#o.has(e)||(this.#o.add(e),this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:e,action:"add",count:0,mine:!1}}))),this.#e?.hide(),this.#t?.focus()}#v=()=>{this.#t?.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-open",{bubbles:!0}))};#E=()=>{this.#t?.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-close",{bubbles:!0}))};#w=t=>{t.newState==="open"&&this.#s?.querySelector("button")?.focus()};#C(){this.#t?.parentNode!==this&&(this.#t=document.createElement("button"),this.#t.type="button",this.#t.className="reaction-trigger",this.#t.textContent=this.getAttribute("data-trigger-icon")||"\u{1F600}",this.#t.setAttribute("aria-label",this.getAttribute("data-trigger-label")||"Add reaction"),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false"),this.appendChild(this.#t))}#S(){if(!this.#i||!this.#t||this.#e?.parentNode===this)return;let t=`reaction-bar-palette-${++B}`;this.#t.setAttribute("popovertarget",t),this.#e=document.createElement("pop-over"),this.#e.id=t,this.#e.className="reaction-palette",this.#e.dataset.position="top",this.#e.setAttribute("role","dialog"),this.#e.setAttribute("aria-label",this.getAttribute("data-label-dialog")||"Choose a reaction"),this.#s=document.createElement("div"),this.#s.className="reaction-palette-list",this.#s.setAttribute("role","group"),this.#s.setAttribute("aria-label",this.getAttribute("aria-label")||"Reactions"),[...this.#i.content.cloneNode(!0).querySelectorAll("button[data-reaction]")].forEach(i=>{i.type="button",i.classList.add("reaction-palette-option"),!i.hasAttribute("aria-label")&&i.dataset.label&&i.setAttribute("aria-label",i.dataset.label),this.#s?.appendChild(i)}),this.#e.appendChild(this.#s),this.appendChild(this.#e)}#m(){let t=this.hasAttribute("data-disabled");this.#t&&(this.#t.disabled=t);for(let e of this.#h())t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled");t&&this.#e?.matches(":popover-open")&&this.#e.hide()}#x(t){if(!this.#s)return;let e=[...this.#s.querySelectorAll("button")],i=e.indexOf(document.activeElement);if(i===-1)return;let o=this.#g(t.key,!0),s;if(o)s=(i+o+e.length)%e.length;else if(t.key==="Home")s=0;else if(t.key==="End")s=e.length-1;else return;t.preventDefault(),e[s].focus()}#g(t,e){let i=getComputedStyle(this).direction==="rtl";return t==="ArrowRight"?i?-1:1:t==="ArrowLeft"?i?1:-1:e&&t==="ArrowDown"?1:e&&t==="ArrowUp"?-1:0}#f(){return[...this.querySelectorAll(":scope > button[data-reaction], :scope > .reaction-trigger")].filter(t=>!t.disabled)}#l(t=null){let e=this.#f(),i=t&&e.includes(t)?t:e.find(o=>o.getAttribute("tabindex")==="0")??e[0];e.forEach(o=>o.setAttribute("tabindex",o===i?"0":"-1")),this.#t?.disabled&&this.#t.removeAttribute("tabindex")}#$(t){let e=this.#f(),i=e.indexOf(document.activeElement);if(i===-1)return;let o=this.#g(t.key,!1),s;if(o)s=(i+o+e.length)%e.length;else if(t.key==="Home")s=0;else if(t.key==="End")s=e.length-1;else return;t.preventDefault(),this.#l(e[s]),e[s].focus()}#y(t){return this.querySelector(`:scope > button[data-reaction="${CSS.escape(t)}"]`)}setCount(t,e,i={}){let o=Number(e)||0;this.#o.delete(t);let s=this.#y(t);if(o<=0){if(s){let a=this.#f(),l=a.indexOf(s),n=a[l+1]??a[l-1]??null,d=s.contains(document.activeElement),p=s.getAttribute("tabindex")==="0";s.remove(),this.#l(p||d?n:null),d&&n?.focus()}return}if(!s){let a=this.#i?.content.querySelector(`button[data-reaction="${CSS.escape(t)}"]`);a?s=a.cloneNode(!0):(s=document.createElement("button"),s.dataset.reaction=t,s.textContent=t),this.insertBefore(s,this.#t?.parentNode===this?this.#t:null),this.#c(s),this.hasAttribute("data-disabled")&&s.setAttribute("aria-disabled","true")}s.dataset.count=String(o),i.mine===!0?s.setAttribute("data-mine",""):i.mine===!1&&s.removeAttribute("data-mine"),s.removeAttribute("data-pending"),s.removeAttribute("aria-busy"),this.#d(s),this.#l()}openPalette(){this.hasAttribute("data-disabled")||this.#e?.show()}closePalette(){this.#e?.hide()}};f("reaction-bar",y);export{y as ReactionBar};
|
|
1
|
+
var j=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function p(o,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=E.get(o);if(customElements.get(o)){if(!s||s.priority>=i){s&&s.priority===i&&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>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(o,r),customElements.define(o,t)}var h=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#i.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var b=CSS.supports("anchor-name","--x"),P=CSS.supports("position-area","bottom"),k=(()=>{let o=document.createElement("span");return o.setAttribute("popover","hint"),o.popover==="hint"})(),T=["auto","manual","hint"];function M(o){let t=T.includes(o||"")?o:"auto";return t==="hint"&&!k?"auto":t}var L=["top","bottom","left","right","inset-inline-start","inset-inline-end"],q=["position","top","left","right","bottom","margin"],w=8,B=0,_=0;function S(o){return!o||o==="none"?[]:o.split(",").map(t=>t.trim()).filter(Boolean)}var g=class extends h{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#i=null;#t=null;#e=`--pop-over-anchor-${++_}`;#s=!1;#r=!1;#o=!1;setup(){if(this.id||(this.id=`pop-over-${++B}`),(!this.hasAttribute("popover")||this.#s)&&this.#n(),this.#h(),this.#l(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!b&&t.newState==="open"&&this.#i&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!b){let t=()=>{this.matches(":popover-open")&&this.#i&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#r&&(L.forEach(t=>this.style.removeProperty(t)),this.#r=!1),this.#o&&(q.forEach(t=>this.style.removeProperty(t)),this.#o=!1),this.#i=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#s=!0);return}if(t==="data-mode"){this.#n();return}this._reinit()}}#n(){let t=M(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#s=!0}show(){this.matches(":popover-open")||(this.showPopover(),!b&&this.#i&&this.matches(":popover-open")&&this.#a())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#h(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#i=e}else this.#i=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#l(){if(!this.#i||!b)return;let t=this.#i,e=t.style.getPropertyValue("anchor-name"),i=S(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#e)||i.push(this.#e),t.style.setProperty("anchor-name",i.join(", ")),this.#t=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),P||this.#u(this.dataset.position||"bottom")}#d(){if(this.#i&&this.#t){let t=S(this.#i.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#t);t.length?this.#i.style.setProperty("anchor-name",t.join(", ")):this.#i.style.removeProperty("anchor-name")}this.#t=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#u(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},r={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],a=r[s]||r.bottom;Object.entries(a).forEach(([c,n])=>this.style.setProperty(c,n)),this.#r=!0}#a(){if(!this.#i)return;let t=this.#i.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#f(),r=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#o=!0;let a=this.offsetWidth,c=this.offsetHeight,n=e.split("-")[0];["top","bottom","left","right"].includes(n)||(n="bottom");let u={top:t.top-i,bottom:s-t.bottom-i,left:t.left-i,right:r-t.right-i},f={top:"bottom",bottom:"top",left:"right",right:"left"},$=n==="top"||n==="bottom"?c:a;u[n]<$&&u[f[n]]>u[n]&&(n=f[n]);let l,d;switch(n){case"top":l=t.top-c-i,d=t.left;break;case"left":l=t.top,d=t.left-a-i;break;case"right":l=t.top,d=t.right+i;break;default:l=t.bottom+i,d=t.left;break}if(n==="top"||n==="bottom"){let m=getComputedStyle(this).direction==="rtl";d=e.endsWith("-end")!==m?t.right-a:t.left}else e.endsWith("-end")&&(l=t.bottom-c);let v=(m,A,x)=>Math.max(w,Math.min(m,x-A-w));d=v(d,a,r),l=v(l,c,s),this.style.top=`${Math.round(l)}px`,this.style.left=`${Math.round(d)}px`}#f(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};p("pop-over",g);var H=0,C={one:"{count} reaction",other:"{count} reactions"},y=class extends h{static get observedAttributes(){return["data-disabled"]}#i=null;#t=null;#e=null;#s=null;#r=new Set;setup(){this.setAttribute("role","toolbar"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("data-label-toolbar")||"Reactions"),this.#i=this.querySelector(":scope > template[data-palette]"),this.#l().forEach(t=>this.#d(t)),this.#S(),this.#C(),this.#m(),this.#c(),this.listen(this,"click",this.#a),this.listen(this,"keydown",this.#f),this.#e&&(this.listen(this.#e,"pop-over:show",this.#A),this.listen(this.#e,"pop-over:hide",this.#E),this.listen(this.#e,"toggle",this.#w))}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||t==="data-disabled"&&(this.#m(),this.#c())}#o(){return this.closest("[lang]")?.lang||void 0}#n(t){try{return new Intl.NumberFormat(this.#o()).format(t)}catch{return String(t)}}#h(t){let e="other";try{e=new Intl.PluralRules(this.#o()).select(t)}catch{}return(this.getAttribute(`data-label-count-${e}`)??this.getAttribute("data-label-count-other")??C[e]??C.other).replaceAll("{count}",this.#n(t))}#l(){return[...this.querySelectorAll(":scope > button[data-reaction]")]}#d(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.type="button";let e=t.dataset.label||t.getAttribute("aria-label");e&&(t.dataset.label=e);let i=t.textContent?.trim()??"";t.replaceChildren();let r=document.createElement("span");r.className="reaction-emoji",r.setAttribute("aria-hidden","true"),r.textContent=i;let s=document.createElement("span");s.className="reaction-count",s.setAttribute("aria-hidden","true"),t.append(r,s),this.#u(t)}#u(t){let e=Number(t.dataset.count)||0,i=t.hasAttribute("data-mine"),r=t.dataset.label||t.querySelector(".reaction-emoji")?.textContent||t.dataset.reaction||"",s=t.querySelector(".reaction-count");s&&(s.textContent=e>0?this.#n(e):""),t.setAttribute("aria-pressed",i?"true":"false"),t.setAttribute("aria-label",`${r}, ${this.#h(e)}`)}#a=t=>{let e=t.target?.closest?.("button[data-reaction]");e&&(e.parentElement===this?this.#b(e):this.#s?.contains(e)&&this.#v(e))};#f=t=>{let e=t.target;this.#s?.contains(e)?this.#$(t):this.#x(t)};#b(t){if(this.hasAttribute("data-disabled")||t.hasAttribute("data-pending"))return;let e=t.dataset.reaction??"",i=Number(t.dataset.count)||0,r=t.hasAttribute("data-mine");t.setAttribute("data-pending",""),t.setAttribute("aria-busy","true"),this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:e,action:r?"remove":"add",count:i,mine:r}}))}#v(t){if(this.hasAttribute("data-disabled"))return;let e=t.dataset.reaction??"",i=this.#y(e);i?this.#b(i):this.#r.has(e)||(this.#r.add(e),this.dispatchEvent(new CustomEvent("reaction-bar:toggle",{bubbles:!0,detail:{reaction:e,action:"add",count:0,mine:!1}}))),this.#e?.hide(),this.#t?.focus()}#A=()=>{this.#t?.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-open",{bubbles:!0}))};#E=()=>{this.#t?.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("reaction-bar:palette-close",{bubbles:!0}))};#w=t=>{t.newState==="open"&&this.#s?.querySelector("button")?.focus()};#S(){this.#t?.parentNode!==this&&(this.#t=document.createElement("button"),this.#t.type="button",this.#t.className="reaction-trigger",this.#t.textContent=this.getAttribute("data-trigger-icon")||"\u{1F600}",this.#t.setAttribute("aria-label",this.getAttribute("data-trigger-label")||"Add reaction"),this.#i&&(this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false")),this.appendChild(this.#t))}#C(){if(!this.#i||!this.#t||this.#e?.parentNode===this)return;let t=`reaction-bar-palette-${++H}`;this.#t.setAttribute("popovertarget",t),this.#e=document.createElement("pop-over"),this.#e.id=t,this.#e.className="reaction-palette",this.#e.dataset.position="top",this.#e.setAttribute("role","dialog"),this.#e.setAttribute("aria-label",this.getAttribute("data-label-dialog")||"Choose a reaction"),this.#s=document.createElement("div"),this.#s.className="reaction-palette-list",this.#s.setAttribute("role","group"),this.#s.setAttribute("aria-label",this.getAttribute("aria-label")||"Reactions"),[...this.#i.content.cloneNode(!0).querySelectorAll("button[data-reaction]")].forEach(i=>{i.type="button",i.classList.add("reaction-palette-option"),!i.hasAttribute("aria-label")&&i.dataset.label&&i.setAttribute("aria-label",i.dataset.label),this.#s?.appendChild(i)}),this.#e.appendChild(this.#s),this.appendChild(this.#e)}#m(){let t=this.hasAttribute("data-disabled");this.#t&&(this.#t.disabled=t);for(let e of this.#l())t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled");t&&this.#e?.matches(":popover-open")&&this.#e.hide()}#$(t){if(!this.#s)return;let e=[...this.#s.querySelectorAll("button")],i=e.indexOf(document.activeElement);if(i===-1)return;let r=this.#g(t.key,!0),s;if(r)s=(i+r+e.length)%e.length;else if(t.key==="Home")s=0;else if(t.key==="End")s=e.length-1;else return;t.preventDefault(),e[s].focus()}#g(t,e){let i=getComputedStyle(this).direction==="rtl";return t==="ArrowRight"?i?-1:1:t==="ArrowLeft"?i?1:-1:e&&t==="ArrowDown"?1:e&&t==="ArrowUp"?-1:0}#p(){return[...this.querySelectorAll(":scope > button[data-reaction], :scope > .reaction-trigger")].filter(t=>!t.disabled)}#c(t=null){let e=this.#p(),i=t&&e.includes(t)?t:e.find(r=>r.getAttribute("tabindex")==="0")??e[0];e.forEach(r=>r.setAttribute("tabindex",r===i?"0":"-1")),this.#t?.disabled&&this.#t.removeAttribute("tabindex")}#x(t){let e=this.#p(),i=e.indexOf(document.activeElement);if(i===-1)return;let r=this.#g(t.key,!1),s;if(r)s=(i+r+e.length)%e.length;else if(t.key==="Home")s=0;else if(t.key==="End")s=e.length-1;else return;t.preventDefault(),this.#c(e[s]),e[s].focus()}#y(t){return this.querySelector(`:scope > button[data-reaction="${CSS.escape(t)}"]`)}setCount(t,e,i={}){let r=Number(e)||0;this.#r.delete(t);let s=this.#y(t);if(r<=0){if(s){let a=this.#p(),c=a.indexOf(s),n=a[c+1]??a[c-1]??null,u=s.contains(document.activeElement),f=s.getAttribute("tabindex")==="0";s.remove(),this.#c(f||u?n:null),u&&n?.focus()}return}if(!s){let a=this.#i?.content.querySelector(`button[data-reaction="${CSS.escape(t)}"]`);a?s=a.cloneNode(!0):(s=document.createElement("button"),s.dataset.reaction=t,s.textContent=t),this.insertBefore(s,this.#t?.parentNode===this?this.#t:null),this.#d(s),this.hasAttribute("data-disabled")&&s.setAttribute("aria-disabled","true")}s.dataset.count=String(r),i.mine===!0?s.setAttribute("data-mine",""):i.mine===!1&&s.removeAttribute("data-mine"),s.removeAttribute("data-pending"),s.removeAttribute("aria-busy"),this.#u(s),this.#c()}openPalette(){this.hasAttribute("data-disabled")||this.#e?.show()}closePalette(){this.#e?.hide()}};p("reaction-bar",y);export{y as ReactionBar};
|
|
2
2
|
//# sourceMappingURL=reaction-bar.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(i,t,e={}){let r=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:r},n=c.get(i);if(customElements.get(i)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}c.set(i,s),customElements.define(i,t)}var o=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,s){t.addEventListener(e,r,s),this.#e.push(()=>t.removeEventListener(e,r,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let s=`--${t}`;e?r.add(s):r.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var a=class extends o{static get observedAttributes(){return["data-for"]}bar=null;target=null;#e=0;#t=null;setup(){this.bar=this.querySelector("progress"),this.bar||(this.bar=document.createElement("progress"),this.bar.max=100,this.bar.value=0,this.appendChild(this.bar)),this.bar.setAttribute("aria-hidden","true");let t=this.dataset.for;if(this.target=t?document.getElementById(t):null,!t&&CSS.supports("animation-timeline","scroll(root block)"))return;t&&!this.target&&this.#r(t),this.#n();let r=()=>{this.#e||(this.#e=requestAnimationFrame(()=>{this.#e=0,this.#n()}))};this.listen(window,"scroll",r,{passive:!0}),this.listen(window,"resize",r,{passive:!0})}teardown(){this.#e&&cancelAnimationFrame(this.#e),this.#e=0,this.#t?.disconnect(),this.#t=null}attributeChangedCallback(t,e,r){e===r||!this.hasAttribute("data-upgraded")||this._reinit()}#r(t){this.#t=new MutationObserver(()=>{let e=document.getElementById(t);e&&(this.#t?.disconnect(),this.#t=null,this.target=e,this.#n())}),this.#t.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id"]})}#n(){let t=this.target?this.#s():this.#i(),e=Math.min(1,Math.max(0,t));this.style.setProperty("--vb-reading-progress",e.toFixed(4)),this.bar&&(this.bar.value=Math.round(e*100))}#i(){let t=document.documentElement.scrollHeight-window.innerHeight;return t>0?window.scrollY/t:0}#s(){if(!this.target)return 0;let t=this.target.getBoundingClientRect(),e=t.height-window.innerHeight;return e<=0?t.bottom<=window.innerHeight?1:0:-t.top/e}};d("reading-progress",a);export{a as ReadingProgress};
|
|
2
2
|
//# sourceMappingURL=reading-progress.js.map
|