vanilla-breeze 0.5.0 → 0.6.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/custom-elements.json +22381 -13213
- 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 +5 -5
- 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 +6 -6
- 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 +51 -50
- package/dist/cdn/components/comment-thread.js +50 -49
- 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 +170 -54
- 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 +6 -2
- package/dist/cdn/components/icon-wc.js +11 -10
- 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 +101 -101
- package/dist/cdn/components/markdown-editor.js +60 -1
- package/dist/cdn/components/markdown-viewer.js +50 -49
- package/dist/cdn/components/nav-bar.js +1 -1
- package/dist/cdn/components/note-wc.js +6 -2
- package/dist/cdn/components/notification-wc.js +33 -32
- package/dist/cdn/components/page-info.js +6 -72
- 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 -38
- 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 -8
- 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/reader-view.js +25 -25
- package/dist/cdn/components/reading-progress.js +1 -1
- package/dist/cdn/components/recently-visited.js +1 -26
- package/dist/cdn/components/score-card.js +21 -5
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/settings-panel.js +88 -142
- 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 -10
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +1 -51
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- 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 +86 -83
- package/dist/cdn/components/time-index.js +1 -11
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +6 -6
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +6 -3
- package/dist/cdn/components/trust-filter.js +1 -3
- package/dist/cdn/components/version-switcher.js +5 -5
- package/dist/cdn/components/video-player.js +67 -9
- package/dist/cdn/components/watch-wc.js +6 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/emoji-extended.js +2 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-OFL.txt +93 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-italic.woff2 +0 -0
- package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2 +0 -0
- package/dist/cdn/fonts/latinmodern-math-GUST-LICENSE.txt +30 -0
- package/dist/cdn/fonts/latinmodern-math.woff2 +0 -0
- package/dist/cdn/fonts/math-fonts.css +14 -0
- package/dist/cdn/packs/effects.full.css +1 -1
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/fonts-display.full.css +1 -1
- package/dist/cdn/packs/fonts-display.theme.css +1 -1
- package/dist/cdn/packs/icons.bundle.js +1 -1
- package/dist/cdn/packs/icons.full.css +1 -1
- package/dist/cdn/packs/icons.theme.css +1 -1
- package/dist/cdn/packs/journal.effects.css +1 -1
- package/dist/cdn/packs/journal.full.css +1 -1
- package/dist/cdn/packs/kawaii.effects.css +1 -1
- package/dist/cdn/packs/kawaii.full.css +2 -2
- package/dist/cdn/packs/kawaii.full.js +4 -4
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +17 -17
- package/dist/cdn/packs/memphis.full.css +1 -1
- package/dist/cdn/packs/memphis.theme.css +1 -1
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +89 -86
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +1 -1
- 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 +1 -1
- package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +1 -1
- 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 +1 -1
- package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
- package/dist/cdn/themes/brutalist.css +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +1 -1
- 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 +1 -1
- package/dist/cdn/themes/classic.css +1 -1
- package/dist/cdn/themes/classic.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +2 -1
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.css +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 +1 -1
- package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.css +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.css +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.css +1 -1
- package/dist/cdn/themes/editorial.tokens.json +1 -1
- 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 +1 -1
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.css +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.css +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +4 -2
- package/dist/cdn/themes/journal.css +1 -1
- package/dist/cdn/themes/journal.tokens.json +4 -2
- 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 +1 -1
- package/dist/cdn/themes/manifest.json +44 -44
- package/dist/cdn/themes/midnight.css +1 -1
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.css +1 -1
- package/dist/cdn/themes/minimal.tokens.json +1 -1
- package/dist/cdn/themes/modern-dark.tokens.json +1 -1
- package/dist/cdn/themes/modern.css +1 -1
- package/dist/cdn/themes/modern.tokens.json +1 -1
- package/dist/cdn/themes/nes-dark.tokens.json +7 -2
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +1 -1
- package/dist/cdn/themes/nord-dark.tokens.json +1 -1
- 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.css +1 -1
- package/dist/cdn/themes/organic.tokens.json +1 -1
- 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.css +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.css +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 +1 -1
- 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 +1 -1
- package/dist/cdn/themes/swiss.css +1 -1
- package/dist/cdn/themes/swiss.tokens.json +1 -1
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
- 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 +1 -1
- package/dist/cdn/themes/vaporwave.css +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +1 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +6 -2
- package/dist/cdn/themes/win9x.css +1 -1
- package/dist/cdn/themes/win9x.tokens.json +3 -1
- package/dist/cdn/vanilla-breeze-autoload.js +187 -297
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +6 -6
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +166 -262
- package/dist/cdn/vanilla-breeze-dev.js +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +272 -130
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +536 -621
- package/dist/cdn/view-transitions.css +2 -0
- package/package.json +15 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var x=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function A(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=b.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> 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 <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(n,r),customElements.define(n,t)}var f=class extends HTMLElement{#l=[];#i;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.#l)t();this.#l=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#l.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#l)t();this.#l=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#i||(this.#i=t)}};function v(){try{let n=new Intl.DateTimeFormat(void 0,{hour:"numeric"}).resolvedOptions();return n.hourCycle==="h12"||n.hourCycle==="h11"?"12h":"24h"}catch{return"12h"}}function l(n){return String(n).padStart(2,"0")}function c(n){if(!n)return null;let t=n.split(":").map(Number);return{h:t[0]||0,m:t[1]||0,s:t[2]||0}}function d(n,t,e,i){return i?`${l(n)}:${l(t)}:${l(e)}`:`${l(n)}:${l(t)}`}function y(n,t,e,i,r){if(r==="12h"){let s=n>=12?"PM":"AM",h=n%12||12;return i?`${h}:${l(t)}:${l(e)} ${s}`:`${h}:${l(t)} ${s}`}return d(n,t,e,i)}function g(n){let t=n.trim();if(!t)return null;let e=t.match(/\s*(am|pm|a\.m\.|p\.m\.|a|p)\s*$/i),i=null,r=t;e&&(i=e[1].toLowerCase().replace(/\./g,"").startsWith("p")?"PM":"AM",r=t.slice(0,e.index).trim());let s=r.split(/[:.]/);if(s.length<1||s.length>3)return null;let h=Number(s[0]),o=s.length>1?Number(s[1]):0,u=s.length>2?Number(s[2]):0;if(isNaN(h)||isNaN(o)||isNaN(u)||o<0||o>59||u<0||u>59)return null;let a=h;if(i){if(a<1||a>12)return null;i==="AM"?a=a===12?0:a:a=a===12?12:a+12}else if(a<0||a>23)return null;return{h:a,m:o,s:u}}function E(n,t,e){return n>e?t:n<t?e:n}var p=class extends f{static formAssociated=!0;#l;#i;#e;#m;#d;#a;#r=[];#u;#h;#f;#t=0;#s=0;#n=0;#o="AM";#L=null;#q=null;#v=60;#N;#I=0;#c=!1;#M;constructor(){super(),this.#l=this.attachInternals(),this._adoptInternals(this.#l)}setup(){if(this.#i=this.querySelector(':scope > input[type="time"]'),!this.#i)return!1;this.#v=Number(this.#i.getAttribute("step"))||60,this.#f=this.#v<60,this.#L=c(this.#i.getAttribute("min")),this.#q=c(this.#i.getAttribute("max")),this.#h=this.getAttribute("data-format")||v();let t=c(this.#i.value);return t&&(this.#t=t.h,this.#s=t.m,this.#n=t.s),this.#N=this.#i.value,this.#h==="12h"&&(this.#o=this.#t>=12?"PM":"AM"),this.#i.setAttribute("tabindex","-1"),this.#i.setAttribute("aria-hidden","true"),this.#i.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.#F(),this.#O(),this.#P(),this.#E(),this.#k(),this.#C(),this.listen(document,"click",this.#V),(this.#i.disabled||this.hasAttribute("disabled"))&&(this.setAttribute("data-disabled",""),this.#e.disabled=!0),!0}#F(){if(this.#m?.parentNode===this)return;this.#m=document.createElement("div"),this.#m.className="time-trigger",this.#e=document.createElement("input"),this.#e.type="text",this.#e.className="time-input",this.#e.setAttribute("role","combobox"),this.#e.setAttribute("aria-haspopup","listbox"),this.#e.setAttribute("aria-expanded","false"),this.#e.setAttribute("autocomplete","off"),this.#e.setAttribute("placeholder","Type a time\u2026"),this.#m.appendChild(this.#e),this.#d=document.createElement("button"),this.#d.type="button",this.#d.className="time-trigger-icon",this.#d.setAttribute("aria-label","Toggle time spinner"),this.#d.setAttribute("tabindex","-1");let t=document.createElement("icon-wc");t.setAttribute("name","clock"),t.setAttribute("size","sm"),t.setAttribute("aria-hidden","true"),this.#d.appendChild(t),this.#m.appendChild(this.#d),this.appendChild(this.#m),this.listen(this.#d,"click",e=>{e.stopPropagation(),this.#c?this.#p():this.#T(),this.#e.focus()}),this.listen(this.#e,"focus",()=>this.#e.select()),this.listen(this.#e,"keydown",this.#H),this.listen(this.#e,"blur",this.#R)}#O(){if(this.#a?.parentNode===this)return;this.#M=`tp-${Math.random().toString(36).slice(2,8)}`,this.#a=document.createElement("div"),this.#a.className="time-panel",this.#a.id=this.#M,this.#a.setAttribute("role","group"),this.#a.setAttribute("aria-label","Time spinners"),this.#e.setAttribute("aria-controls",this.#M);let t=this.#h==="12h"?1:0,e=this.#h==="12h"?12:23,i=this.#w("Hours",t,e,1);this.#a.appendChild(i.el),this.#r.push(i),this.#a.appendChild(this.#S());let r=this.#v>=60?Math.max(1,Math.round(this.#v/60)):1,s=this.#w("Minutes",0,59,r);if(this.#a.appendChild(s.el),this.#r.push(s),this.#f){this.#a.appendChild(this.#S());let h=this.#w("Seconds",0,59,this.#v);this.#a.appendChild(h.el),this.#r.push(h)}this.#h==="12h"&&(this.#u=document.createElement("button"),this.#u.type="button",this.#u.className="period-toggle",this.#u.setAttribute("aria-label","Toggle AM/PM"),this.#u.textContent=this.#o,this.#a.appendChild(this.#u),this.listen(this.#u,"click",()=>{this.#o=this.#o==="AM"?"PM":"AM",this.#u.textContent=this.#o,this.#t=this.#B(this.#$(),this.#o),this.#g()}),this.listen(this.#u,"keydown",h=>{let o=h;o.key==="ArrowLeft"&&(o.preventDefault(),this.#x(this.#r.length-1)),o.key==="Escape"&&(o.preventDefault(),this.#p(),this.#e.focus())})),this.appendChild(this.#a)}#w(t,e,i,r){let s=document.createElement("div");s.className="time-spinner",s.setAttribute("role","spinbutton"),s.setAttribute("aria-label",t),s.setAttribute("aria-valuemin",String(e)),s.setAttribute("aria-valuemax",String(i)),s.setAttribute("tabindex","0");let h=document.createElement("button");h.type="button",h.className="time-inc",h.setAttribute("aria-hidden","true"),h.setAttribute("tabindex","-1"),h.innerHTML="▲";let o=document.createElement("span");o.className="time-value";let u=document.createElement("button");u.type="button",u.className="time-dec",u.setAttribute("aria-hidden","true"),u.setAttribute("tabindex","-1"),u.innerHTML="▼",s.appendChild(h),s.appendChild(o),s.appendChild(u);let a={el:s,valueEl:o,label:t,min:e,max:i,step:r};return this.listen(h,"click",()=>{this.#A(a,r)}),this.listen(u,"click",()=>{this.#A(a,-r)}),this.listen(s,"keydown",m=>{this.#_(m,a)}),this.listen(s,"focus",()=>{this.#I=this.#r.indexOf(a)}),a}#S(){let t=document.createElement("span");return t.className="time-sep",t.setAttribute("aria-hidden","true"),t.textContent=":",t}#T(){this.#c||(this.#c=!0,this.#a.setAttribute("data-open",""),this.#e.setAttribute("aria-expanded","true"))}#p(){this.#c&&(this.#c=!1,this.#a.removeAttribute("data-open"),this.#e.setAttribute("aria-expanded","false"))}#V=t=>{this.#c&&!this.contains(t.target)&&this.#p()};#H=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation();let e=g(this.#e.value);e&&(this.#t=e.h,this.#s=e.m,this.#n=e.s,this.#h==="12h"&&(this.#o=this.#t>=12?"PM":"AM"),this.#g()),this.#E(),this.#c&&this.#p();return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#c||this.#T(),requestAnimationFrame(()=>this.#x(0));return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#c&&this.#p(),this.#E();return;case"Tab":this.#c&&this.#p();return}};#R=t=>{if(t.relatedTarget&&this.contains(t.relatedTarget))return;let e=this.#e.value.trim();if(e){let i=g(e);i&&(this.#t=i.h,this.#s=i.m,this.#n=i.s,this.#h==="12h"&&(this.#o=this.#t>=12?"PM":"AM"),this.#k(),this.#C(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{value:d(this.#t,this.#s,this.#n,this.#f),hours:this.#t,minutes:this.#s,seconds:this.#n}})))}this.#E(),this.#c&&this.#p(),this.#i.dispatchEvent(new Event("blur",{bubbles:!0}))};#_=(t,e)=>{let i=this.#r.indexOf(e);switch(t.key){case"ArrowUp":t.preventDefault(),this.#A(e,e.step);break;case"ArrowDown":t.preventDefault(),this.#A(e,-e.step);break;case"ArrowRight":t.preventDefault(),i<this.#r.length-1?this.#x(i+1):this.#u&&this.#u.focus();break;case"ArrowLeft":t.preventDefault(),i>0&&this.#x(i-1);break;case"PageUp":t.preventDefault(),this.#A(e,e.step*(e.label==="Hours"?1:10));break;case"PageDown":t.preventDefault(),this.#A(e,-e.step*(e.label==="Hours"?1:10));break;case"Home":t.preventDefault(),this.#y(e,e.min);break;case"End":t.preventDefault(),this.#y(e,e.max);break;case"Escape":t.preventDefault(),this.#p(),this.#e.focus();break;default:/^\d$/.test(t.key)&&(t.preventDefault(),this.#j(t.key,e))}};#b="";#D=0;#j(t,e){clearTimeout(this.#D),this.#b+=t;let i=Number(this.#b);if(this.#b.length>=2||i*10>e.max){let r=Math.min(Math.max(i,e.min),e.max);this.#y(e,r),this.#b=""}else this.#D=setTimeout(()=>{let r=Number(this.#b),s=Math.min(Math.max(r,e.min),e.max);this.#y(e,s),this.#b=""},800)}#A(t,e){let i;t.label==="Hours"?i=this.#h==="12h"?this.#$():this.#t:t.label==="Minutes"?i=this.#s:i=this.#n;let r=E(i+e,t.min,t.max);this.#y(t,r)}#y(t,e){t.label==="Hours"?this.#h==="12h"?this.#t=this.#B(e,this.#o):this.#t=e:t.label==="Minutes"?this.#s=e:this.#n=e,this.#g()}#g(t="internal"){this.#P(),this.#E(),this.#k(),this.#C(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{value:d(this.#t,this.#s,this.#n,this.#f),hours:this.#t,minutes:this.#s,seconds:this.#n,source:t}}))}#P(){let t=this.#h==="12h"?this.#$():this.#t;this.#r[0].valueEl.textContent=l(t),this.#r[0].el.setAttribute("aria-valuenow",String(t)),this.#r[0].el.setAttribute("aria-valuetext",this.#h==="12h"?`${t} ${this.#o}`:String(t)),this.#r[1].valueEl.textContent=l(this.#s),this.#r[1].el.setAttribute("aria-valuenow",String(this.#s)),this.#f&&this.#r[2]&&(this.#r[2].valueEl.textContent=l(this.#n),this.#r[2].el.setAttribute("aria-valuenow",String(this.#n))),this.#u&&(this.#u.textContent=this.#o)}#E(){this.#t!==void 0&&(this.#e.value=y(this.#t,this.#s,this.#n,this.#f,this.#h))}#k(){let t=d(this.#t,this.#s,this.#n,this.#f);this.#l.setFormValue(t),this.#i.value=t,this.#i.dispatchEvent(new Event("input",{bubbles:!0}))}#C(){if((this.hasAttribute("required")||this.#i.hasAttribute("required"))&&!this.#i.value){this.#l.setValidity({valueMissing:!0},"Please select a time",this.#e||this);return}this.#l.setValidity({})}#B(t,e){return e==="AM"?t===12?0:t:t===12?12:t+12}#$(){if(this.#h==="24h")return this.#t;let t=this.#t%12;return t===0?12:t}#x(t){this.#r[t]?.el.focus()}formResetCallback(){let t=c(this.#N);t?(this.#t=t.h,this.#s=t.m,this.#n=t.s):(this.#t=0,this.#s=0,this.#n=0),this.#h==="12h"&&(this.#o=this.#t>=12?"PM":"AM"),this.#g()}formStateRestoreCallback(t){if(!t)return;let e=c(t);e&&(this.#t=e.h,this.#s=e.m,this.#n=e.s,this.#h==="12h"&&(this.#o=this.#t>=12?"PM":"AM"),this.#g())}get value(){return d(this.#t,this.#s,this.#n,this.#f)}set value(t){let e=c(t);e&&(e.h===this.#t&&e.m===this.#s&&e.s===this.#n||(this.#t=e.h,this.#s=e.m,this.#n=e.s,this.#h==="12h"&&(this.#o=this.#t>=12?"PM":"AM"),this.#g("api")))}};A("time-picker",p);export{p as TimePicker};
|
|
1
|
+
var $=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function A(h,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(h);if(customElements.get(h)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(h,n),customElements.define(h,t)}var b=class extends HTMLElement{#t=[];#a;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#a||(this.#a=this.attachInternals());let i=this.#a.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#a||(this.#a=t)}#e(){return this.constructor.formAssociated&&this.#a?this.#a:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var p=86400,k=0;function m(h){return String(h).padStart(2,"0")}function f(h){if(!h)return null;let t=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/.exec(String(h).trim());if(!t)return null;let e=Number(t[1]),i=Number(t[2]),n=Number(t[3]||0);return e>23||i>59||n>59?null:e*3600+i*60+n}function w(h,t){let e=Math.floor(h/3600),i=Math.floor(h%3600/60),n=h%60;return t?`${m(e)}:${m(i)}:${m(n)}`:`${m(e)}:${m(i)}`}function c(h,t){return(h%t+t)%t}function x(h){try{let{hourCycle:t}=new Intl.DateTimeFormat(h||void 0,{hour:"numeric"}).resolvedOptions();return t==="h12"||t==="h11"?"12h":"24h"}catch{return"24h"}}function E(h){let t={am:"AM",pm:"PM",periodFirst:!1};try{let e=new Intl.DateTimeFormat(h||void 0,{hour:"numeric",minute:"2-digit",hourCycle:"h12"}),i=e.formatToParts(new Date(2e3,0,1,9,0)),n=e.formatToParts(new Date(2e3,0,1,21,0)),s=i.find(a=>a.type==="dayPeriod")?.value,r=n.find(a=>a.type==="dayPeriod")?.value;if(s&&r){t.am=s,t.pm=r;let a=i.map(o=>o.type);t.periodFirst=a.indexOf("dayPeriod")<a.indexOf("hour")}}catch{}return t}function C(h,t){let e=h.trim().toLowerCase();if(!e)return null;let i=null,n=[[t.am.toLowerCase(),"AM"],[t.pm.toLowerCase(),"PM"],["a.m.","AM"],["p.m.","PM"],["am","AM"],["pm","PM"],["a","AM"],["p","PM"]].sort((u,l)=>l[0].length-u[0].length);for(let[u,l]of n)if(u){if(e.endsWith(u)){i=l,e=e.slice(0,-u.length).trim();break}if(e.startsWith(u)){i=l,e=e.slice(u.length).trim();break}}if(!/^\d{1,2}(?:[:.]\d{1,2}){0,2}$/.test(e))return null;let s=e.split(/[:.]/).map(Number),r=s[0],a=s[1]??0,o=s[2]??0;if(a>59||o>59)return null;if(i){if(r<1||r>12)return null;i==="AM"?r=r===12?0:r:r=r===12?12:r+12}else if(r>23)return null;return r*3600+a*60+o}var g=class extends b{static formAssociated=!0;static get observedAttributes(){return["disabled","required"]}#t;#a=`tp${++k}`;#e=!1;#s;#i;#y;#h;#r;#f=[];#m=null;#x=[];#c="24h";#v="";#A={am:"AM",pm:"PM",periodFirst:!1};#b=!1;#n=null;#d=null;#w=null;#u=60;#P;#E;#o=!1;#U="";#T=!1;constructor(){super(),this.#t=this.attachInternals(),this._adoptInternals(this.#t)}setup(){let t=this.querySelector(':scope > input[type="time"]');if(!t)return!1;this.#s=t,this.#v=this.closest("[lang]")?.lang||navigator.language||"en-US",this.#A=E(this.#v);let e=this.getAttribute("data-format");this.#c=e==="12h"||e==="24h"?e:x(this.#v),this.#z();let i=t.getAttribute("name");i&&(this.hasAttribute("name")||this.setAttribute("name",i),t.removeAttribute("name")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),this.hasAttribute("disabled")||this.setAttribute("disabled",""));let n=`${this.#a}-no-form`,s=t.getAttribute("form");return s&&s!==n&&!this.hasAttribute("form")&&this.setAttribute("form",s),t.setAttribute("form",n),this.#P===void 0&&(this.#P=t.defaultValue),this.#E!==void 0&&(t.value=this.#E,this.#E=void 0),this.#n=f(t.value),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.listen(t,"click",this.#Y),this.listen(t,"focus",this.#F),this.#J(),this.#Q(),this.#e=!0,this.#G(),this.#D(),this.#L(!1),this.#S(),this.listen(document,"click",this.#X),this.listen(this,"focusout",this.#Z),this.listen(this,"invalid",this.#_),this.#V(this.matches(":disabled")),!0}teardown(){this.#o=!1,this.#y?.remove(),this.#r?.remove(),this.#f=[],this.#x=[],this.#m=null,this.#e=!1,clearTimeout(this.#B),this.#M=""}attributeChangedCallback(t){this.#e&&(t==="disabled"&&this.#V(this.matches(":disabled")),t==="required"&&this.#S())}formDisabledCallback(t){this.#e&&this.#V(t)}#V(t){this.#i.disabled=t,this.#h.disabled=t,t&&this.#p()}#z(){let t=this.#s.getAttribute("step");if(t&&t.trim().toLowerCase()==="any")this.#u=null;else{let i=Number(t);this.#u=Number.isFinite(i)&&i>0?Math.max(1,Math.round(i)):60}this.#d=f(this.#s.getAttribute("min")),this.#w=f(this.#s.getAttribute("max"));let e=f(this.#s.value);this.#b=this.#u!==null&&this.#u%60!==0||e!==null&&e%60!==0}#l(t,e){return this.dataset[`label${t}`]||e}#F=()=>{this.#e&&!this.#i.disabled&&this.#i.focus()};#Y=t=>{t.preventDefault(),this.#F()};#G(){let t=new Set([...Array.from(this.#s.labels||[]),...Array.from(this.#t.labels||[])]),e=[];for(let r of t)r.id||(r.id=`${this.#a}-label-${e.length}`),e.push(r.id),this.listen(r,"click",this.#F);let i=this.#i,n=e.join(" ")||this.#s.getAttribute("aria-labelledby")||this.getAttribute("aria-labelledby");n?i.setAttribute("aria-labelledby",n):i.setAttribute("aria-label",this.#s.getAttribute("aria-label")||this.getAttribute("aria-label")||this.#l("Input","Time"));let s=this.#s.getAttribute("aria-describedby");s&&i.setAttribute("aria-describedby",s)}#J(){this.#y=document.createElement("div"),this.#y.className="time-trigger";let t=document.createElement("input");t.type="text",t.className="time-input",t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("autocomplete","off"),t.setAttribute("placeholder",this.#l("Placeholder","Type a time\u2026")),this.#i=t,this.#y.appendChild(t),this.#h=document.createElement("button"),this.#h.type="button",this.#h.className="time-trigger-icon",this.#h.setAttribute("aria-label",this.#l("Toggle","Toggle time spinners")),this.#h.setAttribute("tabindex","-1");let e=document.createElement("icon-wc");e.setAttribute("name","clock"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),this.#h.appendChild(e),this.#y.appendChild(this.#h),this.appendChild(this.#y),this.listen(this.#h,"click",i=>{i.stopPropagation(),this.#o?this.#p():this.#j(),this.#i.focus()}),this.listen(t,"focus",()=>t.select()),this.listen(t,"keydown",this.#tt),this.listen(t,"blur",this.#et)}#Q(){let t=`${this.#a}-panel`;this.#r=document.createElement("div"),this.#r.className="time-panel",this.#r.id=t,this.#r.setAttribute("role","dialog"),this.#r.setAttribute("aria-modal","false"),this.#r.setAttribute("aria-label",this.#l("Dialog","Choose time")),this.#i.setAttribute("aria-controls",t);let e=this.#u??60,i=e>=3600&&e%3600===0?e/3600:1,n=e>=60&&e<3600&&e%60===0?e/60:1,s=e<60?e:1,r=e>=3600&&e%3600===0,a=this.#c==="12h",o=null;a&&(o=document.createElement("button"),o.type="button",o.className="period-toggle"),this.#m=o,o&&this.#A.periodFirst&&this.#r.appendChild(o);let u=!a&&this.#d!==null&&this.#w!==null&&this.#d<=this.#w;this.#f=[],this.#f.push(this.#q("hour",this.#l("Hours","Hours"),a?1:u?Math.floor(this.#d/3600):0,a?12:u?Math.floor(this.#w/3600):23,i,!1)),this.#r.appendChild(this.#R()),this.#f.push(this.#q("minute",this.#l("Minutes","Minutes"),0,59,n,r)),this.#b&&(this.#r.appendChild(this.#R()),this.#f.push(this.#q("second",this.#l("Seconds","Seconds"),0,59,s,!1))),o&&!this.#A.periodFirst&&this.#r.appendChild(o),this.#x=[...this.#r.querySelectorAll(".time-spinner, .period-toggle")],this.appendChild(this.#r);for(let l of this.#f)this.listen(l.incBtn,"click",()=>this.#k(l,l.delta,"pointer")),this.listen(l.decBtn,"click",()=>this.#k(l,-l.delta,"pointer")),this.listen(l.el,"keydown",d=>this.#it(d,l));if(this.#m){let l=this.#m;this.listen(l,"click",d=>{this.#rt(d.detail===0?"keyboard":"pointer")}),this.listen(l,"keydown",d=>this.#K(d,l))}}#q(t,e,i,n,s,r){let a=document.createElement("div");a.className="time-spinner",a.dataset.unit=t,a.setAttribute("role","spinbutton"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin",String(i)),a.setAttribute("aria-valuemax",String(n)),r&&a.setAttribute("aria-readonly","true"),a.setAttribute("tabindex","0");let o=document.createElement("button");o.type="button",o.className="time-inc",o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex","-1"),o.textContent="\u25B2",r&&(o.disabled=!0);let u=document.createElement("span");u.className="time-value";let l=document.createElement("button");return l.type="button",l.className="time-dec",l.setAttribute("aria-hidden","true"),l.setAttribute("tabindex","-1"),l.textContent="\u25BC",r&&(l.disabled=!0),a.append(o,u,l),this.#r.appendChild(a),{unit:t,el:a,valueEl:u,incBtn:o,decBtn:l,min:i,max:n,delta:s,readOnly:r}}#R(){let t=document.createElement("span");return t.className="time-sep",t.setAttribute("aria-hidden","true"),t.textContent=":",t}#j(){this.#o||this.#i.disabled||(this.#o=!0,this.#r.setAttribute("data-open",""),this.#i.setAttribute("aria-expanded","true"))}#p(){this.#o&&(this.#o=!1,this.#r.removeAttribute("data-open"),this.#i.setAttribute("aria-expanded","false"))}#X=t=>{this.#o&&!this.contains(t.target)&&this.#p()};#Z=t=>{let e=t.relatedTarget;e instanceof Node&&this.contains(e)||this.#p()};#C(t){try{let e=new Date(2e3,0,1,Math.floor(t/3600),Math.floor(t%3600/60),t%60),i={hour:this.#c==="12h"?"numeric":"2-digit",minute:"2-digit",hourCycle:this.#c==="12h"?"h12":"h23"};return this.#b&&(i.second="2-digit"),new Intl.DateTimeFormat(this.#v,i).format(e)}catch{return w(t,this.#b)}}#tt=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation(),this.#H(),this.#o&&this.#p();return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#o||this.#j(),this.#x[0]?.focus();return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#o&&this.#p(),this.#D();return}};#H(){let t=this.#i.value.trim();if(!t)this.#g(null,"keyboard");else{let e=C(t,this.#A);e!==null&&this.#g(e,"keyboard")}this.#D()}#et=t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#H(),this.#_())};#_=()=>{this.#e&&(this.#T||(this.#T=!0,this.#S()),this.#s.dispatchEvent(new Event("blur",{bubbles:!0})))};#K(t,e){let i=this.#x.indexOf(e),n=getComputedStyle(this).direction==="rtl",s=n?"ArrowLeft":"ArrowRight",r=n?"ArrowRight":"ArrowLeft";return t.key===s||t.key===r?(t.preventDefault(),this.#x[i+(t.key===s?1:-1)]?.focus(),!0):t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),this.#p(),this.#i.focus(),!0):!1}#it(t,e){if(this.#K(t,e.el))return;let i=e.unit==="hour"?e.delta:e.delta*10;switch(t.key){case"ArrowUp":t.preventDefault(),this.#k(e,e.delta,"keyboard");break;case"ArrowDown":t.preventDefault(),this.#k(e,-e.delta,"keyboard");break;case"PageUp":t.preventDefault(),this.#k(e,i,"keyboard");break;case"PageDown":t.preventDefault(),this.#k(e,-i,"keyboard");break;case"Home":t.preventDefault(),this.#O(e,e.min,1,"keyboard");break;case"End":t.preventDefault(),this.#O(e,e.max,-1,"keyboard");break;default:/^\d$/.test(t.key)&&(t.preventDefault(),this.#st(t.key,e))}}#M="";#B;#st(t,e){clearTimeout(this.#B),this.#M+=t;let i=()=>{let n=Math.min(Math.max(Number(this.#M),e.min),e.max);this.#M="",this.#O(e,n,0,"keyboard")};this.#M.length>=2||Number(this.#M)*10>e.max?i():this.#B=setTimeout(i,800)}#I(){return this.#$(this.#d??0,1)}#$(t,e){let i=c(t,p),n=this.#u;if(n){let a=this.#d??0,o=(i-a)/n,u=e>0?Math.floor(o):e<0?Math.ceil(o):Math.round(o);i=c(a+u*n,p)}let s=this.#d,r=this.#w;return s!==null&&r!==null&&s<=r?(i<s&&(i=s),i>r&&(i=n?s+Math.floor((r-s)/n)*n:r)):s!==null&&r===null&&i<s?i=s:r!==null&&s===null&&i>r&&(i=n?Math.floor(r/n)*n:r),i}#k(t,e,i){if(t.readOnly)return;if(this.#n===null){this.#g(this.#I(),i);return}let n=this.#n,s=Math.floor(n/3600),r=Math.floor(n%3600/60),a=n%60,o;t.unit==="hour"?o=(this.#c==="12h"?c(s%12+e,12)+(s>=12?12:0):c(s+e,24))*3600+r*60+a:t.unit==="minute"?o=s*3600+c(r+e,60)*60+a:o=s*3600+r*60+c(a+e,60),this.#g(this.#$(o,e),i)}#O(t,e,i,n){if(t.readOnly)return;let s=this.#n??this.#I(),r=Math.floor(s/3600),a=Math.floor(s%3600/60),o=s%60,u;t.unit==="hour"?u=(this.#c==="12h"?e%12+(r>=12?12:0):e)*3600+a*60+o:t.unit==="minute"?u=r*3600+e*60+o:u=r*3600+a*60+e,this.#g(this.#$(u,i),n)}#rt(t){let e=this.#n??this.#I();this.#g(this.#$(c(e+12*3600,p),0),t)}#g(t,e){let i=this.value;return this.#n=t,t!==null&&t%60!==0&&!this.#b&&(this.#b=!0),this.#D(),this.value===i?!1:(this.#L(),this.#S(),this.dispatchEvent(new CustomEvent("time-picker:change",{bubbles:!0,detail:{...this.#nt(),source:e}})),!0)}#nt(){let t=this.#n;return t===null?{value:"",hours:null,minutes:null,seconds:null}:{value:this.value,hours:Math.floor(t/3600),minutes:Math.floor(t%3600/60),seconds:t%60}}#D(){if(!this.#e)return;let t=this.#n;this.#i.value=t===null?"":this.#C(t);let e=this.#l("Empty","Not set"),i=t===null?null:Math.floor(t/3600),n={hour:i===null?null:this.#c==="12h"?i%12||12:i,minute:t===null?null:Math.floor(t%3600/60),second:t===null?null:t%60},s=i===null?"":i>=12?this.#A.pm:this.#A.am;for(let r of this.#f){let a=n[r.unit];if(r.valueEl.textContent=a===null?"--":m(a),a===null){r.el.removeAttribute("aria-valuenow"),r.el.setAttribute("aria-valuetext",e);continue}r.el.setAttribute("aria-valuenow",String(a));let o;try{o=r.unit==="hour"&&this.#c==="12h"?new Intl.DateTimeFormat(this.#v,{hour:"numeric",hourCycle:"h12"}).format(new Date(2e3,0,1,i)):new Intl.NumberFormat(this.#v,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(a)}catch{o=r.unit==="hour"&&s?`${a} ${s}`:String(a)}r.el.setAttribute("aria-valuetext",o)}this.#m&&(this.#m.textContent=s||"--",this.#m.setAttribute("aria-label",`${this.#l("Period","AM/PM")}: ${s||e}`))}#L(t=!0){let e=this.value;this.#t.setFormValue(e||null),this.#s.value=e,t&&this.#s.dispatchEvent(new Event("input",{bubbles:!0}))}#N(t,e,i,n={}){let s=this.#s.getAttribute(`data-message-${t.toLowerCase()}`)??this.#l(e,i);for(let[r,a]of Object.entries(n))s=s.replaceAll(`{${r}}`,a);return s}#S(){if(!this.#e)return!1;let t=this.hasAttribute("required")||this.#s.hasAttribute("required");t?this.#i.setAttribute("aria-required","true"):this.#i.removeAttribute("aria-required");let e=this.#n,i=this.#d,n=this.#w,s={},r="";if(e===null)t&&(s={valueMissing:!0},r=this.#N("valueMissing","Required","Please select a time"));else{let u=i!==null&&n!==null&&i>n,l=i!==null&&e<i,d=n!==null&&e>n;if(u?l&&d:l)s=u?{rangeUnderflow:!0,rangeOverflow:!0}:{rangeUnderflow:!0},r=this.#N("rangeUnderflow","RangeUnderflow","Choose a time at or after {time}",{time:this.#C(i)});else if(!u&&d)s={rangeOverflow:!0},r=this.#N("rangeOverflow","RangeOverflow","Choose a time at or before {time}",{time:this.#C(n)});else if(this.#u&&c(e-(i??0),this.#u)!==0){let y=this.#$(e,1),M=c(y+this.#u,p);s={stepMismatch:!0},r=this.#N("stepMismatch","StepMismatch","Choose a valid time. The nearest are {lower} and {upper}",{lower:this.#C(y),upper:this.#C(M)})}}let a=this.#t.validationMessage;return r?this.#t.setValidity(s,r,this.#i):this.#t.setValidity({}),r&&(e!==null||this.#T)?this.#i.setAttribute("aria-invalid","true"):this.#i.removeAttribute("aria-invalid"),(this.#s.validationMessage===this.#U||!this.#s.validity.customError)&&(this.#s.setCustomValidity(r),this.#U=r),a!==r}#W(t){this.#n=t,this.#D(),this.#L(),this.#S()}formResetCallback(){this.#e&&(this.#T=!1,this.#W(f(this.#P)))}formStateRestoreCallback(t){!this.#e||typeof t!="string"||this.#W(f(t))}get form(){return this.#t.form}get validity(){return this.#t.validity}get validationMessage(){return this.#t.validationMessage}get willValidate(){return this.#t.willValidate}checkValidity(){return this.#t.checkValidity()}reportValidity(){return this.#t.reportValidity()}get value(){return this.#e?this.#n===null?"":w(this.#n,this.#b):this.#E??""}set value(t){let e=t==null?"":String(t).trim(),i=e?f(e):null;if(!(e&&i===null)){if(!this.#e){this.#E=e;return}this.#g(i,"api")}}};A("time-picker",g);export{g as TimePicker};
|
|
2
2
|
//# sourceMappingURL=time-picker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
<span class="icon" aria-hidden="true">${
|
|
3
|
-
<span class="message">${this.#
|
|
4
|
-
${
|
|
5
|
-
${i
|
|
6
|
-
`,
|
|
1
|
+
var u=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#i(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var A=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function b(a,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=p.get(a);if(customElements.get(a)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}p.set(a,s),customElements.define(a,t)}var g={region:"Notifications",dismiss:"Dismiss",info:"Info",success:"Success",warning:"Warning",error:"Error"},v=["info","success","warning","error"],E={info:"ⓘ",success:"✓",warning:"⚠",error:"✗"},y=300,l=class extends u{#e=[];#t=[];#i=new WeakMap;#n=!1;#r=!1;#a=new Set;setup(){this.#c("role","log"),this.#c("aria-live","polite"),this.#c("aria-relevant","additions"),this.#c("aria-label",this.#d("region")),this.listen(this,"pointerover",()=>{this.#n||(this.#n=!0,this.#s())}),this.listen(this,"pointerout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#n=!1,this.#s())}),this.listen(this,"focusin",()=>{this.#r=!0,this.#s()}),this.listen(this,"focusout",t=>{t.relatedTarget instanceof Node&&this.contains(t.relatedTarget)||(this.#r=!1,this.#s())}),this.listen(this,"keydown",t=>{if(t.key!=="Escape")return;let e=t.target.closest?.(".toast");e&&this.#t.includes(e)&&(t.preventDefault(),this.dismiss(e))}),this.listen(document,"visibilitychange",()=>this.#s()),this.#t=this.#t.filter(t=>t.parentNode===this),this.#n=!!this.querySelector(".toast:hover"),this.#r=this.contains(document.activeElement),this.#h(),this.#s()}teardown(){for(let t of[...this.#t]){let e=this.#i.get(t);e&&(e.hiding?this.#f(t):this.#l(e))}for(let t of this.#a)this.removeAttribute(t);this.#a.clear()}show(t){let{message:e,variant:i="info",duration:s=this.#E(),dismissible:n=!0,action:r,onAction:o,source:c="api"}=t,f=v.includes(i)?i:"info",d=this.#p({message:e,variant:f,dismissible:n,action:r,onAction:o}),h=document.activeElement;this.#i.set(d,{message:String(e??""),duration:Math.max(0,Number(s)||0),remaining:Math.max(0,Number(s)||0),startedAt:0,timer:void 0,returnFocus:h&&!this.contains(h)?h:null,hiding:!1});let m=!this.isConnected||this.#t.length>=this.#m();return m?this.#e.push({toast:d,duration:s}):this.#u(d),this.dispatchEvent(new CustomEvent("toast-msg:enqueued",{detail:{message:e,variant:f,duration:s,source:c,toast:d,queued:m},bubbles:!0})),d}dismiss(t){let e=this.#e.findIndex(i=>i.toast===t);if(e>-1){this.#e.splice(e,1);return}this.#o(t)}dismissAll(){this.#e=[],[...this.#t].forEach(t=>this.#o(t))}get queue(){let t=(e,i)=>({message:this.#i.get(e)?.message??"",variant:e.getAttribute("data-variant")||"info",state:i});return[...this.#t.map(e=>t(e,"visible")),...this.#e.map(({toast:e})=>t(e,"queued"))]}#c(t,e){this.hasAttribute(t)&&!this.#a.has(t)||(this.setAttribute(t,e),this.#a.add(t))}#d(t){return this.getAttribute(`data-label-${t}`)??g[t]??t}#p({message:t,variant:e,dismissible:i,action:s,onAction:n}){let r=document.createElement("div");r.className="toast",r.setAttribute("data-variant",e);let o=c=>this.#y(c);return r.innerHTML=`
|
|
2
|
+
<span class="icon" aria-hidden="true">${E[e]}</span>
|
|
3
|
+
<span class="message"><span class="variant-label">${o(this.#d(e))}: </span>${o(t)}</span>
|
|
4
|
+
${s?`<button type="button" class="action">${o(s)}</button>`:""}
|
|
5
|
+
${i?`<button type="button" class="close" aria-label="${o(this.#d("dismiss"))}">✕</button>`:""}
|
|
6
|
+
`,r.querySelector(".close")?.addEventListener("click",()=>this.#o(r)),s&&r.querySelector(".action")?.addEventListener("click",()=>{n?.(),this.#o(r)}),r}#u(t){this.appendChild(t),this.#t.push(t),requestAnimationFrame(()=>{t.getAttribute("data-state")!=="hiding"&&t.setAttribute("data-state","visible")}),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:show",{bubbles:!0,detail:{toast:t}}))}#h(){for(;this.isConnected&&this.#e.length&&this.#t.length<this.#m();){let{toast:t}=this.#e.shift();this.#u(t)}}get#b(){return this.#n||this.#r||document.visibilityState==="hidden"}#s(){let t=this.#b||!this.isConnected;for(let e of this.#t){let i=this.#i.get(e);!i||i.hiding||i.duration<=0||(t?this.#l(i):i.timer===void 0&&this.#g(e,i))}}#g(t,e){e.startedAt=performance.now(),e.timer=setTimeout(()=>{e.timer=void 0,this.#o(t)},e.remaining)}#l(t){t.timer!==void 0&&(clearTimeout(t.timer),t.timer=void 0,t.remaining=Math.max(0,t.remaining-(performance.now()-t.startedAt)))}#o(t){let e=this.#i.get(t);if(!e||e.hiding||t.parentNode!==this)return;e.hiding=!0,e.timer!==void 0&&clearTimeout(e.timer),e.timer=void 0,this.#v(t,e),t.setAttribute("data-state","hiding");let i=()=>this.#f(t);t.addEventListener("animationend",i,{once:!0}),setTimeout(i,y)}#f(t){if(t.parentNode!==this&&!this.#t.includes(t))return;t.remove();let e=this.#t.indexOf(t);e>-1&&this.#t.splice(e,1),this.#r=this.contains(document.activeElement),this.#t.length||(this.#n=!1),this.#h(),this.#s(),this.dispatchEvent(new CustomEvent("toast-msg:hide",{bubbles:!0,detail:{toast:t}}))}#v(t,e){if(!t.contains(document.activeElement))return;let i=this.#t.filter(c=>c!==t&&!this.#i.get(c)?.hiding),s=this.#t.indexOf(t),r=(i.find(c=>this.#t.indexOf(c)>s)??i[i.length-1])?.querySelector("button");if(r){r.focus();return}let o=e.returnFocus;o instanceof HTMLElement&&o.isConnected&&o.focus()}#E(){let t=this.getAttribute("duration"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)?e:5e3}#m(){let t=this.getAttribute("max"),e=t!==null?parseInt(t,10):NaN;return Number.isFinite(e)&&e>0?e:5}#y(t){let e=document.createElement("div");return e.textContent=t??"",e.innerHTML}};b("toast-msg",l);export{l as ToastMsg};
|
|
7
7
|
//# sourceMappingURL=toast-msg.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,o){t.addEventListener(e,s,o),this.#t.push(()=>t.removeEventListener(e,s,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,e){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let o=`--${t}`;e?s.add(o):s.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}};var w=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function a(n,t,e={}){let s=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=p.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> 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 <${n}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}p.set(n,o),customElements.define(n,t)}var c=CSS.supports("anchor-name","--x"),b=CSS.supports("position-area","bottom"),v=0,d=class extends r{#t=null;#e=null;#s=null;#i=null;setup(){this.id||(this.id=`pop-over-${++v}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#n(),this.#o(),this.#s=e=>{let s=e.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${s}`,{detail:{state:e.newState},bubbles:!0,composed:!0})),!c&&e.newState==="open"&&this.#t&&this.#a()},this.listen(this,"beforetoggle",this.#s),c||(this.#i=()=>{this.matches(":popover-open")&&this.#t&&this.#a()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#n(){let t=this.dataset.anchor;t?this.#t=document.getElementById(t)||document.querySelector(t):this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#o(){if(!(!this.#t||!c)&&(this.#e=`--pop-over-anchor-${this.id}`,this.#t.style.setProperty("anchor-name",this.#e),this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e||""),!b)){let t=this.dataset.position||"bottom";this.#r(t)}}#r(t){let e="var(--_pop-over-offset, var(--size-xs))",s={top:{bottom:`calc(anchor(top) + ${e})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${e})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},o=t.split("-")[0],i=s[o]||s.bottom;Object.entries(i).forEach(([h,m])=>this.style.setProperty(h,m))}#a(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",s=this.#l(),o,i;switch(e.split("-")[0]){case"top":o=t.top-this.offsetHeight-s,i=t.left;break;case"left":o=t.top,i=t.left-this.offsetWidth-s;break;case"right":o=t.top,i=t.right+s;break;default:o=t.bottom+s,i=t.left;break}e.endsWith("-end")&&(e.startsWith("top")||e.startsWith("bottom")?i=t.right-this.offsetWidth:o=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(o)}px`,this.style.left=`${Math.round(i)}px`,this.style.margin="0"}#l(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};a("pop-over",d);var y=new Set(["BUTTON","A","AREA"]);function f(n){return document.documentElement.hasAttribute("data-interest-polyfill")?!0:"interestForElement"in HTMLButtonElement.prototype?y.has(n.tagName):!1}var l=0,u=class extends r{#t=null;#e=null;#s;#i;#n=!1;#o=!1;#r;setup(){this.#n=this.getAttribute("variant")==="card",this.#n?this.#l():this.#a()}#a(){if(this.#t=this.querySelector(":scope > :not(template)"),!this.#t)return;this.#o=f(this.#t);let t=this.querySelector(":scope > template[data-tooltip]"),e=this.getAttribute("content"),s=this.#t.getAttribute("title");if(!t&&!e&&!s)return;s&&(this.#r=s,this.#t.removeAttribute("title"));let o=this.getAttribute("position")||"top";this.#t.id||(this.#t.id=`tooltip-trigger-${++l}`);let i=document.createElement("pop-over");i.className="tooltip",i.setAttribute("role","tooltip"),i.dataset.mode="hint",i.dataset.anchor=this.#t.id,i.dataset.tooltipPosition=o,i.id=`tooltip-${++l}`,t?i.innerHTML=t.innerHTML:i.textContent=e||s;let h=document.createElement("span");h.className="tooltip-arrow",h.setAttribute("aria-hidden","true"),i.appendChild(h),this.appendChild(i),this.#e=i,this.#o?(this.#t.setAttribute("interestfor",i.id),this.#t.hasAttribute("aria-describedby")||this.#t.setAttribute("aria-describedby",i.id)):(this.#t.setAttribute("aria-describedby",i.id),this.listen(this.#t,"mouseenter",this.#c),this.listen(this.#t,"mouseleave",this.#h),this.listen(this.#t,"focus",this.#d),this.listen(this.#t,"blur",this.#p),this.listen(i,"mouseenter",this.#u),this.listen(i,"mouseleave",this.#h)),this.listen(i,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(i,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}#l(){this.#t=this.querySelector(":scope > [data-trigger]");let t=this.querySelector(":scope > [data-content]");if(!this.#t||!t)return;this.#o=f(this.#t),this.#t.id||(this.#t.id=`tooltip-trigger-${++l}`);let e=document.createElement("pop-over");e.className="hover-card",e.dataset.mode="manual",e.dataset.anchor=this.#t.id,e.dataset.position=this.getAttribute("position")||"bottom",e.id=`hc-${++l}`,e.appendChild(t),t.removeAttribute("data-content"),t.hidden=!1,this.appendChild(e),this.#e=e,this.#o?this.#t.setAttribute("interestfor",e.id):(this.listen(this.#t,"mouseenter",this.#c),this.listen(this.#t,"mouseleave",this.#h),this.listen(this.#t,"focus",this.#d),this.listen(this.#t,"blur",this.#h),this.listen(e,"mouseenter",this.#u),this.listen(e,"mouseleave",this.#h),this.listen(document,"keydown",this.#f)),this.listen(e,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(e,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}teardown(){this.#t&&(this.#o&&this.#t.removeAttribute("interestfor"),this.#r&&(this.#t.setAttribute("title",this.#r),this.#r=void 0)),this.#e&&(this.#e.remove(),this.#e=null),clearTimeout(this.#s),clearTimeout(this.#i)}#c=()=>{clearTimeout(this.#i);let t=this.#n?300:200,e=parseInt(this.getAttribute("delay")||String(t),10);this.setState("show-pending",!0),this.#s=setTimeout(()=>{this.setState("show-pending",!1),this.show()},e)};#h=()=>{clearTimeout(this.#s),this.setState("show-pending",!1);let t=this.#n?200:100;this.#i=setTimeout(()=>this.hide(),t)};#d=()=>{clearTimeout(this.#i),this.show()};#p=()=>{clearTimeout(this.#s),this.setState("show-pending",!1),this.hide()};#u=()=>{clearTimeout(this.#i)};#f=t=>{t.key==="Escape"&&this.isVisible&&this.hide()};show(){!this.#e||this.isVisible||(typeof this.#e.show=="function"?this.#e.show():this.#e.showPopover())}hide(){!this.#e||!this.isVisible||(typeof this.#e.hide=="function"?this.#e.hide():this.#e.hidePopover())}get isVisible(){return this.#e?.matches(":popover-open")??!1}};a("tool-tip",u);export{u as ToolTip};
|
|
1
|
+
var u=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#e||(this.#e=t)}#i(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var D=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function f(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=S.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(s,n),customElements.define(s,t)}var m=CSS.supports("anchor-name","--x"),N=CSS.supports("position-area","bottom"),I=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),V=["auto","manual","hint"];function B(s){let t=V.includes(s||"")?s:"auto";return t==="hint"&&!I?"auto":t}var q=["top","bottom","left","right","inset-inline-start","inset-inline-end"],H=["position","top","left","right","bottom","margin"],C=8,R=0,L=0;function T(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var y=class extends u{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#i=`--pop-over-anchor-${++L}`;#o=!1;#s=!1;#n=!1;setup(){if(this.id||(this.id=`pop-over-${++R}`),(!this.hasAttribute("popover")||this.#o)&&this.#r(),this.#l(),this.#u(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!m&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!m){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#c(),this.#s&&(q.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#n&&(H.forEach(t=>this.style.removeProperty(t)),this.#n=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#o=!0);return}if(t==="data-mode"){this.#r();return}this._reinit()}}#r(){let t=B(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#o=!0}show(){this.matches(":popover-open")||(this.showPopover(),!m&&this.#t&&this.matches(":popover-open")&&this.#a())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#l(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#u(){if(!this.#t||!m)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=T(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#i)||i.push(this.#i),t.style.setProperty("anchor-name",i.join(", ")),this.#e=this.#i,this.style.setProperty("position-anchor",this.#i),this.setAttribute("data-anchor-name",this.#i),N||this.#h(this.dataset.position||"bottom")}#c(){if(this.#t&&this.#e){let t=T(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#e);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#e=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([a,h])=>this.style.setProperty(a,h)),this.#s=!0}#a(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#p(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#n=!0;let o=this.offsetWidth,a=this.offsetHeight,h=e.split("-")[0];["top","bottom","left","right"].includes(h)||(h="bottom");let d={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},p={top:"bottom",bottom:"top",left:"right",right:"left"},P=h==="top"||h==="bottom"?a:o;d[h]<P&&d[p[h]]>d[h]&&(h=p[h]);let l,c;switch(h){case"top":l=t.top-a-i,c=t.left;break;case"left":l=t.top,c=t.left-o-i;break;case"right":l=t.top,c=t.right+i;break;default:l=t.bottom+i,c=t.left;break}if(h==="top"||h==="bottom"){let g=getComputedStyle(this).direction==="rtl";c=e.endsWith("-end")!==g?t.right-o:t.left}else e.endsWith("-end")&&(l=t.bottom-a);let A=(g,E,k)=>Math.max(C,Math.min(g,k-E-C));c=A(c,o,n),l=A(l,a,r),this.style.top=`${Math.round(l)}px`,this.style.left=`${Math.round(c)}px`}#p(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};f("pop-over",y);var F=new Set(["BUTTON","A","AREA"]),v=CSS.supports("anchor-name","--x"),$=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),x=8;function M(s){return document.documentElement.hasAttribute("data-interest-polyfill")?!0:"interestForElement"in HTMLButtonElement.prototype?F.has(s.tagName):!1}function O(s){return s.getAttribute("aria-label")?.trim()||s.hasAttribute("aria-labelledby")||s.labels?.length||s.textContent?.trim()||s instanceof HTMLInputElement&&["button","submit","reset"].includes(s.type)&&s.value?!0:!!s.querySelector('img[alt]:not([alt=""]), [aria-label]:not([aria-hidden="true"])')}function _(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(Boolean);return i.includes(e)?!1:(s.setAttribute(t,[...i,e].join(" ")),!0)}function W(s,t,e){let i=(s.getAttribute(t)||"").split(/\s+/).filter(n=>n&&n!==e);i.length?s.setAttribute(t,i.join(" ")):s.removeAttribute(t)}var b=0,w=class extends u{#t=null;#e=null;#i;#o;#s=!1;#n=!1;#r;#l;#u=[];#c=null;#h=!1;#a=!1;setup(){return this.#s=this.getAttribute("variant")==="card",this.#s?this.#S():this.#p()}#p(){if(this.#t=this.querySelector(":scope > :not(template):not(pop-over.tooltip)"),!this.#t)return!1;this.#n=M(this.#t);let t=this.querySelector(":scope > template[data-tooltip]"),e=this.getAttribute("content"),i=this.#t.getAttribute("title");if(!t&&!e&&!i)return!1;let n=!1;i&&(O(this.#t)||(this.#t.setAttribute("aria-label",i),this.#l=i,n=!t&&!e),this.#r=i,this.#t.removeAttribute("title"));let r=this.getAttribute("position")||"top";this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let o=document.createElement("pop-over");o.className="tooltip",o.setAttribute("role","tooltip"),o.dataset.mode=$?"hint":"manual",o.dataset.anchor=this.#t.id,o.dataset.tooltipPosition=r,v||(o.dataset.position=r),o.id=`tooltip-${++b}`,t?o.innerHTML=t.innerHTML:o.textContent=e||i;let a=document.createElement("span");if(a.className="tooltip-arrow",a.setAttribute("aria-hidden","true"),o.appendChild(a),this.appendChild(o),this.#e=o,n||this.#g("aria-describedby",o.id),this.#n?(this.#t.setAttribute("interestfor",o.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#C),this.listen(o,"mouseenter",this.#b),this.listen(o,"mouseleave",this.#d)),$||this.#v(),!v){this.listen(o,"toggle",d=>{d.newState==="open"&&this.#f()});let h=()=>{this.isVisible&&this.#f()};this.listen(window,"resize",h),this.listen(window,"scroll",h,{capture:!0,passive:!0})}return this.#y(o),!0}#S(){this.#t=this.querySelector(":scope > [data-trigger]");let t=this.querySelector(":scope > [data-content]");if(!this.#t||!t)return!1;this.#n=M(this.#t),this.#t.id||(this.#t.id=`tooltip-trigger-${++b}`);let e=document.createElement("pop-over");return e.className="hover-card",e.dataset.mode="manual",e.dataset.anchor=this.#t.id,e.dataset.position=this.getAttribute("position")||"bottom",e.id=`hc-${++b}`,this.#c={node:t,next:t.nextSibling,hidden:t.hidden},e.appendChild(t),t.removeAttribute("data-content"),t.hidden=!1,this.appendChild(e),this.#e=e,this.#g("aria-controls",e.id),this.#t.hasAttribute("aria-expanded")||(this.#t.setAttribute("aria-expanded","false"),this.#h=!0),this.#n?(this.#t.setAttribute("interestfor",e.id),this.#w()):(this.listen(this.#t,"mouseenter",this.#A),this.listen(this.#t,"mouseleave",this.#d),this.listen(this.#t,"focus",this.#E),this.listen(this.#t,"blur",this.#d),this.listen(e,"mouseenter",this.#b),this.listen(e,"mouseleave",this.#d),this.listen(e,"focusin",this.#b),this.listen(e,"focusout",i=>{i.relatedTarget instanceof Node&&this.contains(i.relatedTarget)||this.#d()})),this.#v(),this.listen(e,"pop-over:show",()=>{this.#h&&this.#t?.setAttribute("aria-expanded","true")}),this.listen(e,"pop-over:hide",()=>{this.#h&&this.#t?.setAttribute("aria-expanded","false")}),this.#y(e),!0}teardown(){clearTimeout(this.#i),clearTimeout(this.#o);let t=this.#t;if(t){this.#n&&(t.removeAttribute("interestfor"),this.#m&&(t.style.removeProperty("interest-delay-start"),t.style.removeProperty("--interest-delay-start"),this.#m=!1));for(let[e,i]of this.#u)W(t,e,i);this.#l!==void 0&&t.getAttribute("aria-label")===this.#l&&t.removeAttribute("aria-label"),this.#h&&t.removeAttribute("aria-expanded"),this.#r&&t.setAttribute("title",this.#r)}if(this.#u=[],this.#l=void 0,this.#r=void 0,this.#h=!1,this.#c){let{node:e,next:i,hidden:n}=this.#c;e.setAttribute("data-content",""),e.hidden=n,i&&i.parentNode===this?this.insertBefore(e,i):this.insertBefore(e,this.#e?.parentNode===this?this.#e:null),this.#c=null}this.#e&&(this.#e.remove(),this.#e=null),this.#t=null,this.setState("show-pending",!1)}#g(t,e){this.#t&&_(this.#t,t,e)&&this.#u.push([t,e])}#y(t){this.listen(t,"pop-over:show",()=>{this.dispatchEvent(new CustomEvent("tool-tip:show",{bubbles:!0}))}),this.listen(t,"pop-over:hide",()=>{this.dispatchEvent(new CustomEvent("tool-tip:hide",{bubbles:!0}))})}#v(){this.listen(document,"keydown",this.#T),this.listen(document,"pointerdown",t=>{this.isVisible&&!(t.target instanceof Node&&this.contains(t.target))&&this.hide()})}#f(){let t=this.#e,e=this.#t;if(!t||!e||this.#s)return;let i=t.dataset.position||"top",n=e.getBoundingClientRect(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,a=(h,d,p)=>Math.max(x,Math.min(h,p-d-x));t.style.translate="none",i==="left"||i==="right"?t.style.top=`${Math.round(a(n.top+(n.height-t.offsetHeight)/2,t.offsetHeight,o))}px`:t.style.left=`${Math.round(a(n.left+(n.width-t.offsetWidth)/2,t.offsetWidth,r))}px`}#m=!1;#w(){let t=this.getAttribute("delay"),e=this.#t;if(t===null||!e)return;let i=parseInt(t,10);!Number.isFinite(i)||i<0||(e.style.setProperty("interest-delay-start",`${i}ms`),e.style.setProperty("--interest-delay-start",`${i}ms`),this.#m=!0)}#A=()=>{clearTimeout(this.#o);let t=this.#s?300:200,e=parseInt(this.getAttribute("delay")||String(t),10);this.setState("show-pending",!0),this.#i=setTimeout(()=>{this.setState("show-pending",!1),this.show()},e)};#d=()=>{clearTimeout(this.#i),this.setState("show-pending",!1);let t=this.#s?200:100;this.#o=setTimeout(()=>this.hide(),t)};#E=()=>{this.#a||(clearTimeout(this.#o),this.show())};#C=()=>{clearTimeout(this.#i),this.setState("show-pending",!1),this.hide()};#b=()=>{clearTimeout(this.#o)};#T=t=>{if(t.key!=="Escape"||!this.isVisible)return;clearTimeout(this.#i);let e=this.#s&&this.#e?.contains(document.activeElement);this.hide(),e&&(this.#a=!0,this.#t?.focus({preventScroll:!0}),this.#a=!1)};show(){!this.#e||this.isVisible||(typeof this.#e.show=="function"?this.#e.show():this.#e.showPopover(),v||this.#f())}hide(){!this.#e||!this.isVisible||(typeof this.#e.hide=="function"?this.#e.hide():this.#e.hidePopover())}get isVisible(){return this.#e?.matches(":popover-open")??!1}};f("tool-tip",w);export{w as ToolTip};
|
|
2
2
|
//# sourceMappingURL=tool-tip.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}#o(t,
|
|
3
|
-
`)}#
|
|
1
|
+
var T=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function v(i,t,e={}){let n=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=S.get(i);if(customElements.get(i)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}S.set(i,o),customElements.define(i,t)}var w=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,o){t.addEventListener(e,n,o),this.#t.push(()=>t.removeEventListener(e,n,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,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let o=`--${t}`;e?n.add(o):n.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#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 L={heading:"Topics",page:"{count} page",pages:"{count} pages",uncategorized:"Uncategorized","topic-link":"{label} topic page",error:"Topics could not be loaded."};function _(i){let t=String(i??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://topic-map.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function x(i,t){let e=Array.isArray(t?.concepts)?t.concepts:[],n=A(t?.["skos:hasTopConcept"]),o=new Map;for(let r of e)r&&typeof r["@id"]=="string"&&r["@id"]&&o.set(r["@id"],r);let s=new Map,l=new Map,u=(r,a)=>{!o.has(r)||!o.has(a)||r===a||(s.set(r,(s.get(r)??new Set).add(a)),l.set(a,(l.get(a)??new Set).add(r)))};for(let r of o.values()){let a=r["@id"];for(let c of A(r["skos:broader"]))u(c,a);for(let c of A(r["skos:narrower"]))u(a,c)}let p=new Map,m=[];for(let r of i){if(!r||typeof r!="object")continue;let a=Array.isArray(r.concepts)?r.concepts:[],c=!1;for(let d of new Set(a)){if(!o.has(d))continue;let h=p.get(d);h?h.push(r):p.set(d,[r]),c=!0}c||m.push(r)}let g=new Map,$=r=>{if(g.has(r))return g.get(r);let a=new Set,c=new Set,d=[r];for(;d.length;){let h=d.pop();if(!a.has(h)){a.add(h);for(let b of p.get(h)||[])c.add(C(b));for(let b of s.get(h)||[])d.push(b)}}return g.set(r,c.size),c.size},y=n.filter(r=>o.has(r));return y.length===0&&(y=[...o.keys()].filter(r=>!l.has(r))),{byId:o,childrenOf:s,directPages:p,uncategorized:m,roots:y,totalFor:$}}var k=class extends w{#t=0;setup(){let t=++this.#t;if(this.__data){this.#n(this.__data.pages,this.__data.vocabulary);return}let e=this.getAttribute("data-lens-src")||this.getAttribute("src"),n=this.getAttribute("data-vocabulary-src")||"/vocabulary.json";e&&this.#e(e,n,t)}teardown(){this.#t++}get data(){return this.__data||null}set data(t){if(!t||typeof t!="object")return;let e=Array.isArray(t.pages)?t.pages:[],n=t.vocabulary||{};this.__data={pages:e,vocabulary:n},this._reinit(),this.dispatchEvent(new CustomEvent("topic-map:data-changed",{detail:{pages:e,vocabulary:n,source:"property"},bubbles:!0}))}async#e(t,e,n){let[o,s]=await Promise.all([M(t),M(e)]);if(n!==this.#t)return;let l=o.error?[t,o.error]:s.error?[e,s.error]:null;if(l){console.warn(`[topic-map] could not load ${l[0]}: ${l[1]}`),this.#a();return}let u=o.data,p=Array.isArray(u)?u:Array.isArray(u?.pages)?u.pages:[];this.#n(p,s.data)}#n(t,e){try{this.#l(t,e)}catch(n){console.warn("[topic-map] could not render the topic tree:",n),this.#a()}}#l(t,e){let n=x(t,e),o=this.hasAttribute("expand-all"),s=[],l=this.#u(t.length);l&&s.push(l);for(let u of n.roots)s.push(this.#o(u,n,o,0,new Set));if(n.uncategorized.length){let u=o?" open":"";s.push(`<details${u} data-topic-node="__uncategorized">`),s.push(`<summary><span class="topic-name">${f(this.#r("uncategorized"))}</span> <span class="topic-count">${f(this.#s(new Set(n.uncategorized.map(C)).size))}</span></summary>`),s.push(this.#i(n.uncategorized)),s.push("</details>")}this.innerHTML=s.join(`
|
|
2
|
+
`)}#o(t,e,n,o,s){let l=e.byId.get(t);if(!l||s.has(t))return"";let u=new Set(s).add(t),p=String(l["skos:prefLabel"]||t),m=e.directPages.get(t)||[],g=e.childrenOf.get(t),$=n||o<1?" open":"",y=this.#r("topic-link").replaceAll("{label}",p),r=[];if(r.push(`<details${$} data-topic-node="${E(t)}">`),r.push(`<summary><span class="topic-name">${f(p)}</span> <span class="topic-count">${f(this.#s(e.totalFor(t)))}</span></summary>`),r.push(`<p class="topic-link"><a href="/topics/${E(encodeURIComponent(t))}/">${f(y)}</a></p>`),m.length&&r.push(this.#i(m)),g&&g.size){let a=[...g].sort((c,d)=>{let h=String(e.byId.get(c)?.["skos:prefLabel"]||c),b=String(e.byId.get(d)?.["skos:prefLabel"]||d);return h.localeCompare(b,this.#c(),{sensitivity:"base"})});for(let c of a)r.push(this.#o(c,e,n,o+1,u))}return r.push("</details>"),r.join(`
|
|
3
|
+
`)}#i(t){return`<ul class="topic-pages">
|
|
4
|
+
${t.map(n=>{let o=f(n.title||n.url||""),s=_(n.url);return s?`<li><a href="${E(s)}">${o}</a></li>`:`<li>${o}</li>`}).join(`
|
|
5
|
+
`)}
|
|
6
|
+
</ul>`}#u(t){let e=this.getAttribute("data-heading-level"),n=e==null||e===""?2:Number.parseInt(e,10);if(n===0)return"";let o=Number.isFinite(n)?Math.min(6,Math.max(1,n)):2;return`<h${o} class="topic-map-heading">${f(this.#r("heading"))} <small>(${f(this.#s(t))})</small></h${o}>`}#s(t){let e=this.#c(),n=new Intl.PluralRules(e).select(t)==="one"?"page":"pages";return this.#r(n).replaceAll("{count}",new Intl.NumberFormat(e).format(t))}#a(){this.querySelector(":scope > [data-topic-map-error]")?.remove();let t=document.createElement("p");t.setAttribute("data-topic-map-error",""),t.textContent=this.#r("error"),this.prepend(t)}#r(t){return this.getAttribute(`data-label-${t}`)||L[t]}#c(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};async function M(i){try{let t=await fetch(i);if(!t.ok)throw new Error(`status ${t.status}`);return{data:await t.json()}}catch(t){return{error:t instanceof Error?t.message:String(t)}}}function C(i){return typeof i?.url=="string"&&i.url?i.url:i}function A(i){return i==null?[]:Array.isArray(i)?i:[i]}function f(i){return String(i??"").replace(/[&<>]/g,t=>({"&":"&","<":"<",">":">"})[t])}function E(i){return String(i??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}v("topic-map",k);export{k as TopicMap,x as buildTopicGraph,_ as safeHref};
|
|
4
7
|
//# sourceMappingURL=topic-map.js.map
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`);let n=this.querySelector("form");n.addEventListener("change",r=>{let s=r.target;if(s&&s.matches('input[type="checkbox"]')){let o=s.getAttribute("data-dim"),f=s.value,u=o?this.#e[o]:null;if(!u)return;s.checked?u.add(f):u.delete(f),this.#n()}}),n.addEventListener("reset",()=>{for(let r of Object.values(this.#e))r.clear();setTimeout(()=>this.#n(),0)})}#s(t){let e=new Set;for(let n of this.#t){let r=n[t];if(r)if(t==="provenance")for(let s of String(r).split(/\s+/).filter(Boolean))e.add(s);else e.add(r)}return[...e].sort()}#a(t){if(this.#e.provenance.size&&!(t.provenance||"").split(/\s+/).filter(Boolean).some(n=>this.#e.provenance.has(n))||this.#e.review.size&&!this.#e.review.has(t.review)||this.#e.status.size&&!this.#e.status.has(t.status))return!1;if(this.#e.signed.size){let e=this.#e.signed,n=!!t.signed;if(e.has("yes")&&!n||e.has("no")&&n)return!1;e.has("yes")&&e.has("no")}return!0}#n(){let t=this.querySelector("[data-trust-filter-results]");if(!t)return;let e=this.#t.filter(s=>this.#a(s)),n=[];if(n.push(`<p class="trust-filter-count">${e.length} of ${this.#t.length} pages</p>`),e.length){n.push('<ul class="trust-filter-list">');for(let s of e){let o=[s.provenance?`<span class="trust-filter-prov" data-provenance="${c(s.provenance)}">${a(s.provenance)}</span>`:"",s.review&&s.review!=="unreviewed"?`<span>${a(s.review)}</span>`:"",s.status&&s.status!=="published"?`<span>${a(s.status)}</span>`:"",s.signed?'<span class="trust-filter-signed">signed</span>':""].filter(Boolean).join(" \xB7 ");n.push(`<li><a href="${c(s.url)}">${a(s.title||s.url)}</a>${o?`<small>${o}</small>`:""}</li>`)}n.push("</ul>")}t.innerHTML=n.join(`
|
|
3
|
-
`);let r={};for(let[s,o]of Object.entries(this.#e))r[s]=[...o];this.dispatchEvent(new CustomEvent("trust-filter:change",{detail:{selected:r,count:e.length},bubbles:!0}))}#r(t){let e=document.createElement("p");e.setAttribute("data-trust-filter-error",""),e.textContent=t,this.innerHTML="",this.append(e)}};function a(i){return String(i??"").replace(/[&<>]/g,t=>({"&":"&","<":"<",">":">"})[t])}function c(i){return String(i??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function m(i){return String(i).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function b(i){return String(i).replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}p("trust-filter",d);export{d as TrustFilter};
|
|
1
|
+
var M=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function y(i,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=v.get(i);if(customElements.get(i)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(i,s),customElements.define(i,t)}var m=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,n,s){t.addEventListener(e,n,s),this.#e.push(()=>t.removeEventListener(e,n,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 n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let s=`--${t}`;e?n.add(s):n.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t: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 k={form:"Filter pages",provenance:"How was it made",review:"Review",status:"Status",signed:"Has signature",yes:"Yes",no:"No",clear:"Clear all",page:"{count} of {total} page",pages:"{count} of {total} pages","has-signature":"has signature",error:"Pages could not be loaded.","no-source":"No data source set."},w=["provenance","review","status","signed"];function x(i){let t=String(i??"").trim();if(!t)return null;try{let{protocol:e}=new URL(t,"https://trust-filter.invalid/");return e==="http:"||e==="https:"?t:null}catch{return null}}function A(i){return String(i??"").split(/\s+/).filter(Boolean)}function E(i,t){if(t.provenance?.size&&!A(i.provenance).some(e=>t.provenance.has(e))||t.review?.size&&!t.review.has(i.review)||t.status?.size&&!t.status.has(i.status))return!1;if(t.signed?.size===1){let e=t.signed.has("yes");if(!!i.signed!==e)return!1}return!0}var b=class extends m{#e=[];#t=g();#n=0;setup(){let t=++this.#n;this.#t=g();let e=this.getAttribute("data-lens-src")||this.getAttribute("src");if(!e){this.#a(this.#r("no-source"));return}this.#c(e,t)}teardown(){this.#n++}async#c(t,e){let n;try{let r=await fetch(t);if(!r.ok)throw new Error(`status ${r.status}`);n=await r.json()}catch(r){if(e!==this.#n)return;console.warn(`[trust-filter] could not load ${t}:`,r),this.#a(this.#r("error"));return}if(e!==this.#n)return;let s=Array.isArray(n)?n:n?.pages;this.#e=Array.isArray(s)?s.filter(r=>r&&typeof r=="object"):[],this.#l(),this.#i()}#l(){let t={provenance:this.#s("provenance"),review:this.#s("review"),status:this.#s("status"),signed:["yes","no"]},e=document.createElement("form");e.setAttribute("data-trust-filter-controls",""),e.setAttribute("aria-label",this.#r("form"));for(let l of w){if(t[l].length===0)continue;let c=document.createElement("fieldset");c.dataset.dim=l;let u=document.createElement("legend");u.textContent=this.#r(l),c.append(u);for(let o of t[l]){let d=document.createElement("label"),f=document.createElement("input");f.type="checkbox",f.dataset.dim=l,f.value=o;let p=document.createElement("span");p.textContent=l==="signed"?this.#r(o):$(o),d.append(f," ",p),c.append(d)}e.append(c)}let n=document.createElement("button");n.type="reset",n.className="ghost",n.textContent=this.#r("clear"),e.append(n);let s=document.createElement("output");s.setAttribute("data-trust-filter-count",""),s.setAttribute("aria-live","polite");let r=document.createElement("ul");r.setAttribute("data-trust-filter-results",""),this.replaceChildren(e,s,r),e.addEventListener("change",l=>{let c=l.target;if(!c?.matches('input[type="checkbox"]'))return;let u=this.#t[c.dataset.dim||""];u&&(c.checked?u.add(c.value):u.delete(c.value),this.#i(),this.#o())}),e.addEventListener("reset",()=>{this.#t=g(),this.#i(),this.#o()})}#s(t){let e=new Set;for(let n of this.#e){let s=n[t];if(!(!s||typeof s!="string"))if(t==="provenance")for(let r of A(s))e.add(r);else e.add(s)}return[...e].sort()}#i(){let t=this.querySelector("[data-trust-filter-count]"),e=this.querySelector("[data-trust-filter-results]");if(!t||!e)return;let n=this.#e.filter(o=>E(o,this.#t)),s=this.#u(),r=this.#e.length,l=new Intl.NumberFormat(s),c=new Intl.PluralRules(s).select(r)==="one"?"page":"pages";t.textContent=this.#r(c).replaceAll("{count}",l.format(n.length)).replaceAll("{total}",l.format(r));let u=n.map(o=>{let d=document.createElement("li"),f=String(o.title||o.url||""),p=x(o.url);if(p){let a=document.createElement("a");a.href=p,a.textContent=f,d.append(a)}else d.append(f);let h=[];if(typeof o.provenance=="string"&&o.provenance){let a=document.createElement("span");a.className="trust-filter-prov",a.dataset.provenance=o.provenance,a.textContent=o.provenance,h.push(a)}if(o.review&&o.review!=="unreviewed"&&h.push(String(o.review)),o.status&&o.status!=="published"&&h.push(String(o.status)),o.signed){let a=document.createElement("span");a.className="trust-filter-signature",a.textContent=this.#r("has-signature"),h.push(a)}if(h.length){let a=document.createElement("small");h.forEach((S,C)=>{C&&a.append(" \xB7 "),a.append(S)}),d.append(a)}return d});e.replaceChildren(...u),e.hidden=u.length===0}#o(){let t={};for(let[n,s]of Object.entries(this.#t))t[n]=[...s];let e=this.#e.filter(n=>E(n,this.#t)).length;this.dispatchEvent(new CustomEvent("trust-filter:change",{detail:{selected:t,count:e},bubbles:!0}))}#a(t){let e=document.createElement("p");e.setAttribute("data-trust-filter-error",""),e.textContent=t,this.replaceChildren(e)}#r(t){return this.getAttribute(`data-label-${t}`)||k[t]}#u(){let t=this.closest("[lang]")?.getAttribute("lang")||void 0;try{return Intl.getCanonicalLocales(t)[0]}catch{return}}};function g(){return Object.fromEntries(w.map(i=>[i,new Set]))}function $(i){return String(i).replace(/-/g," ")}y("trust-filter",b);export{b as TrustFilter,E as matchesSelection,x as safeHref};
|
|
4
2
|
//# sourceMappingURL=trust-filter.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var S=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function p(h,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=w.get(h);if(customElements.get(h)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}w.set(h,s),customElements.define(h,t)}var u=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#t.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}};var f=CSS.supports("anchor-name","--x"),y=CSS.supports("position-area","bottom"),x=0,m=class extends u{#t=null;#e=null;#i=null;#s=null;setup(){this.id||(this.id=`pop-over-${++x}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#n(),this.#o(),this.#i=e=>{let i=e.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${i}`,{detail:{state:e.newState},bubbles:!0,composed:!0})),!f&&e.newState==="open"&&this.#t&&this.#a()},this.listen(this,"beforetoggle",this.#i),f||(this.#s=()=>{this.matches(":popover-open")&&this.#t&&this.#a()},this.listen(window,"resize",this.#s),this.listen(window,"scroll",this.#s,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#n(){let t=this.dataset.anchor;t?this.#t=document.getElementById(t)||document.querySelector(t):this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#o(){if(!(!this.#t||!f)&&(this.#e=`--pop-over-anchor-${this.id}`,this.#t.style.setProperty("anchor-name",this.#e),this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e||""),!y)){let t=this.dataset.position||"bottom";this.#c(t)}}#c(t){let e="var(--_pop-over-offset, var(--size-xs))",i={top:{bottom:`calc(anchor(top) + ${e})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${e})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},s=t.split("-")[0],n=i[s]||i.bottom;Object.entries(n).forEach(([r,a])=>this.style.setProperty(r,a))}#a(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#l(),s,n;switch(e.split("-")[0]){case"top":s=t.top-this.offsetHeight-i,n=t.left;break;case"left":s=t.top,n=t.left-this.offsetWidth-i;break;case"right":s=t.top,n=t.right+i;break;default:s=t.bottom+i,n=t.left;break}e.endsWith("-end")&&(e.startsWith("top")||e.startsWith("bottom")?n=t.right-this.offsetWidth:s=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(s)}px`,this.style.left=`${Math.round(n)}px`,this.style.margin="0"}#l(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};p("pop-over",m);var b=["tracking","final","original"],$={tracking:"Tracking",final:"Final",original:"Original"},v=class extends u{static observedAttributes=["view","author","datetime","controls"];setup(){this.#t(),this.listen(this,"click",this.#o)}attributeChangedCallback(t,e,i){!this.hasAttribute("data-upgraded")||e===i||(t==="view"?this.#n():this.#t())}#t(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#e(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#i(t)),this.prepend(...e),this.#n()}#e(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let i=document.createElement("p");if(i.setAttribute("data-change-caption",""),i.append(t?`Changes by ${t}`:"Changes"),e){i.append(t?", ":" from ");let s=document.createElement("time");s.setAttribute("datetime",e),s.textContent=this.#s(e),i.append(s)}return i}#i(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let i=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${i}`);for(let s of b){let n=document.createElement("button");n.type="button",n.dataset.action=s,n.textContent=$[s],e.append(n)}return e}#s(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let i=this.closest("[lang]")?.lang||void 0,s=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(i,{dateStyle:"medium",...s?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#n(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#o=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let i=e.dataset.action;!i||!b.includes(i)||i!==this.view&&(this.#c(i),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:i},bubbles:!0})))};#c(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#n()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!b.includes(t)||this.view===t||(this.#c(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};p("change-set",v);function E(h,t){let e=String(h??"").split(`
|
|
1
|
+
var Tt=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function m(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=$.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(s,n),customElements.define(s,t)}var p=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#i||(this.#i=t)}#e(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function L(s){return B(s&&s.closest("[lang]")?.lang||document.documentElement.lang||navigator.language||"en")}function B(s,t="en-US"){try{if(s)return Intl.getCanonicalLocales(s),s}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var j="http://www.w3.org/1999/xhtml",y="http://www.w3.org/2000/svg",H="http://www.w3.org/1998/Math/MathML",W=new Set([j,y,H]),A="user-content-",z=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),M=new Set(["title","desc"]),G=new Set(["animate","set","animatemotion","animatetransform"]),J=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),Y=new Set(["src","poster","srcset"]),K=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),X=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),Z=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),Q={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},tt=new Set(["social-embed","youtube-player","geo-map"]),et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],it=new Set(["audio-player","video-player","image-map","brand-mark"]);function nt(s){return String(s).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function g(s,t=!1){let e=nt(s);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(n=>n.startsWith("data:")).some(n=>!/^data:(image|audio|video|font)\//.test(n)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function I(s){let t=String(s).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var st=s=>String(s.localName||s.tagName||"").toLowerCase(),rt=s=>s.startsWith(A)?s:A+s;function ot(s,t){if(z.has(t))return!0;let e=s.namespaceURI;return!!(e&&!W.has(e)||t==="title"&&e!==y||M.has(t)&&e===y&&s.children?.length||G.has(t)&&(s.getAttribute("attributeName")||s.getAttribute("attributename")||"").toLowerCase().includes("href"))}function at(s,t){for(let e of[...s.attributes]){let i=e.name.toLowerCase();if(i.startsWith("on")||K.has(i)||!t.keepIds&&X.has(i)){s.removeAttribute(e.name);continue}if(i==="style"){(!t.keepStyle||I(e.value))&&s.removeAttribute(e.name);continue}if((i==="id"||i==="name")&&!t.keepIds){let n=rt(e.value);i==="id"?t.ids.set(e.value,n):t.ids.set(`name:${e.value}`,n),s.setAttribute(e.name,n);continue}if(J.has(i)||i.endsWith(":href")){g(e.value,!1)&&s.removeAttribute(e.name);continue}Y.has(i)&&g(e.value,!0)&&s.removeAttribute(e.name)}}function ct(s,t){let e=(s.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&s.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&s.setAttribute("type","button")}function lt(s,t){for(let e of s)for(let i of[...e.attributes]){let n=i.name.toLowerCase(),r=i.value;if((n==="href"||n.endsWith(":href"))&&r.startsWith("#")){let o=ht(r.slice(1));t.has(o)&&e.setAttribute(i.name,`#${t.get(o)}`)}else if(n==="usemap"&&r.startsWith("#")){let o=t.get(`name:${r.slice(1)}`);o?e.setAttribute(i.name,`#${o}`):e.removeAttribute(i.name)}else if(Z.has(n)){let o=r.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(A)?a:null)).filter(Boolean);o.length?e.setAttribute(i.name,o.join(" ")):e.removeAttribute(i.name)}else r.includes("url(#")&&e.setAttribute(i.name,r.replace(/url\(#([^)]+)\)/g,(o,a)=>t.has(a)?`url(#${t.get(a)})`:o))}}function ht(s){try{return decodeURIComponent(s)}catch{return s}}function R(s){let t=s.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&R(e)}function O(s,t){R(s);let e=[...s.querySelectorAll("*")];t.includeRoot&&e.unshift(s);let i=new Map,n=[],r={...t,ids:i};for(let o of e){if(!dt(o,s))continue;let a=st(o);if(t.svgOnly&&(M.has(a)||a==="style")){if(a==="style"&&I(o.textContent||"")){o.remove();continue}}else if(ot(o,a)){o.remove();continue}if(!t.keepIds&&!t.svgOnly&&tt.has(a)){ut(o);continue}if(a==="template"){let h=o.content;h&&O(h,{...t,includeRoot:!1})}at(o,r),t.keepIds||ct(o,a);let c=Q[a];if(c)for(let h of c)o.removeAttribute(h);if(a==="include-file"&&!t.allowIncludeFile&&o.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!it.has(a))for(let h of et)o.removeAttribute(h);n.push(o)}!t.keepIds&&i.size&<(n,i)}function ut(s){let t=s.parentNode;if(t){for(let e of[...s.childNodes])t.insertBefore(e,s);s.remove()}}function dt(s,t){let e=s;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function P(s,t={}){let e=document.createElement("template");return s&&typeof s=="string"&&(e.innerHTML=s,O(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var v=CSS.supports("anchor-name","--x"),ft=CSS.supports("position-area","bottom"),pt=(()=>{let s=document.createElement("span");return s.setAttribute("popover","hint"),s.popover==="hint"})(),mt=["auto","manual","hint"];function bt(s){let t=mt.includes(s||"")?s:"auto";return t==="hint"&&!pt?"auto":t}var gt=["top","bottom","left","right","inset-inline-start","inset-inline-end"],vt=["position","top","left","right","bottom","margin"],D=8,wt=0,yt=0;function _(s){return!s||s==="none"?[]:s.split(",").map(t=>t.trim()).filter(Boolean)}var E=class extends p{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#i=null;#e=`--pop-over-anchor-${++yt}`;#n=!1;#c=!1;#s=!1;setup(){if(this.id||(this.id=`pop-over-${++wt}`),(!this.hasAttribute("popover")||this.#n)&&this.#a(),this.#u(),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})),!v&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#r()})}),!v){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#r()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#c&&(gt.forEach(t=>this.style.removeProperty(t)),this.#c=!1),this.#s&&(vt.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#t=null}attributeChangedCallback(t,e,i){if(e!==i){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#n=!0);return}if(t==="data-mode"){this.#a();return}this._reinit()}}#a(){let t=bt(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#n=!0}show(){this.matches(":popover-open")||(this.showPopover(),!v&&this.#t&&this.matches(":popover-open")&&this.#r())}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.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#l(){if(!this.#t||!v)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),i=_(e||getComputedStyle(t).getPropertyValue("anchor-name"));i.includes(this.#e)||i.push(this.#e),t.style.setProperty("anchor-name",i.join(", ")),this.#i=this.#e,this.style.setProperty("position-anchor",this.#e),this.setAttribute("data-anchor-name",this.#e),ft||this.#h(this.dataset.position||"bottom")}#d(){if(this.#t&&this.#i){let t=_(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#i);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#i=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#h(t){let e="var(--_pop-over-offset, var(--size-xs))",i=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...i},bottom:{top:`calc(anchor(bottom) + ${e})`,...i},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},r=t.split("-")[0],o=n[r]||n.bottom;Object.entries(o).forEach(([a,c])=>this.style.setProperty(a,c)),this.#c=!0}#r(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",i=this.#b(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#s=!0;let o=this.offsetWidth,a=this.offsetHeight,c=e.split("-")[0];["top","bottom","left","right"].includes(c)||(c="bottom");let h={top:t.top-i,bottom:r-t.bottom-i,left:t.left-i,right:n-t.right-i},l={top:"bottom",bottom:"top",left:"right",right:"left"},u=c==="top"||c==="bottom"?a:o;h[c]<u&&h[l[c]]>h[c]&&(c=l[c]);let d,f;switch(c){case"top":d=t.top-a-i,f=t.left;break;case"left":d=t.top,f=t.left-o-i;break;case"right":d=t.top,f=t.right+i;break;default:d=t.bottom+i,f=t.left;break}if(c==="top"||c==="bottom"){let w=getComputedStyle(this).direction==="rtl";f=e.endsWith("-end")!==w?t.right-o:t.left}else e.endsWith("-end")&&(d=t.bottom-a);let T=(w,k,F)=>Math.max(D,Math.min(w,F-k-D));f=T(f,o,n),d=T(d,a,r),this.style.top=`${Math.round(d)}px`,this.style.left=`${Math.round(f)}px`}#b(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};m("pop-over",E);var S=["tracking","final","original"],At={tracking:"Tracking",final:"Final",original:"Original"},C=class extends p{static observedAttributes=["view","author","datetime","controls"];setup(){this.#t(),this.listen(this,"click",this.#s)}attributeChangedCallback(t,e,i){!this.hasAttribute("data-upgraded")||e===i||(t==="view"?this.#c():this.#t())}#t(){this.querySelector(":scope > [data-change-caption]")?.remove(),this.querySelector(":scope > [data-controls]")?.remove();let t=this.#i(),e=[];t&&e.push(t),this.getAttribute("controls")!=="none"&&e.push(this.#e(t)),this.prepend(...e),this.#c()}#i(){let t=this.getAttribute("author"),e=this.getAttribute("datetime");if(!t&&!e)return null;let i=document.createElement("p");if(i.setAttribute("data-change-caption",""),i.append(t?`Changes by ${t}`:"Changes"),e){i.append(t?", ":" from ");let n=document.createElement("time");n.setAttribute("datetime",e),n.textContent=this.#n(e),i.append(n)}return i}#e(t){let e=document.createElement("div");e.setAttribute("data-controls",""),e.setAttribute("role","group");let i=t?`, ${t.textContent}`:"";e.setAttribute("aria-label",`Change view${i}`);for(let n of S){let r=document.createElement("button");r.type="button",r.dataset.action=n,r.textContent=At[n],e.append(r)}return e}#n(t){let e=new Date(t);if(Number.isNaN(e.getTime()))return t;let i=this.closest("[lang]")?.lang||void 0,n=/^\d{4}-\d{2}-\d{2}$/.test(t);return new Intl.DateTimeFormat(i,{dateStyle:"medium",...n?{timeZone:"UTC"}:{timeStyle:"short"}}).format(e)}#c(){let t=this.view;for(let e of this.querySelectorAll(":scope > [data-controls] > button[data-action]"))e.setAttribute("aria-pressed",String(e.dataset.action===t))}#s=t=>{let e=t.target.closest?.("[data-action]");if(!e||e.parentElement?.parentElement!==this||!e.parentElement.hasAttribute("data-controls"))return;let i=e.dataset.action;!i||!S.includes(i)||i!==this.view&&(this.#a(i),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:i},bubbles:!0})))};#a(t){t==="tracking"?this.removeAttribute("view"):this.setAttribute("view",t),this.#c()}get view(){let t=this.getAttribute("view");return t==="final"||t==="original"?t:"tracking"}set view(t){!S.includes(t)||this.view===t||(this.#a(t),this.dispatchEvent(new CustomEvent("change-set:view",{detail:{view:t,source:"api"},bubbles:!0})))}};m("change-set",C);function U(s,t){let e=String(s??"").split(`
|
|
2
2
|
`),i=String(t??"").split(`
|
|
3
|
-
`),
|
|
4
|
-
`));else if(i.type==="add"){let
|
|
5
|
-
`,e.appendChild(
|
|
6
|
-
`,e.appendChild(s)}return t.appendChild(e),t}var N=0,g=class extends u{static observedAttributes=["data-versions","data-src"];#t=[];#e=null;#i;#s;#n;#o=null;#c=null;#a=null;setup(){this.#l(),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Version"),this.#$(),this.#N(),this.#h(),this.#d(),this.#p(),this.hasAttribute("data-page-info-target")&&this.#x(),this.#t.length===0&&(this.getAttribute("data-src")||this.#g())&&this.#w()}attributeChangedCallback(t,e,i){!this.isConnected||e===i||(t==="data-versions"&&this.refresh(),t==="data-src"&&this.#w())}#l(){let t=null,e=this.getAttribute("data-versions");if(e)try{t=JSON.parse(e)}catch(i){this.#r("Failed to parse data-versions JSON",{error:i})}if(!t){let i=this.querySelector(':scope > script[type="application/json"][data-versions]');if(i?.textContent.trim())try{t=JSON.parse(i.textContent)}catch(s){this.#r("Failed to parse <script data-versions> JSON",{error:s})}}Array.isArray(t)||(t=[]),this.#t=t.filter(i=>i&&typeof i.id=="string"),this.#e=this.#b()}#b(){if(this.#t.length===0)return null;let t=this.#t.find(i=>i.current===!0);if(t)return t.id;let e=document.querySelector('meta[itemprop="version"]')?.getAttribute("content");if(e){let i=this.#t.find(s=>s.id===e);if(i)return i.id}return this.#t[0].id}#v(){let t=this.getAttribute("data-mode");return t==="releases"||t==="history"?t:new Set(this.#t.map(i=>i.url).filter(Boolean)).size>1?"releases":"history"}#g(){return document.querySelector('meta[name="vb:versions-manifest"]')?.getAttribute("content")}async#w(){let t=this.getAttribute("data-src")||this.#g();if(!t)return;this.#a=t,this.#h();let e;try{let i=await fetch(t,{credentials:"same-origin"});if(!i.ok)throw new Error(`Fetch failed (${i.status}) for ${t}`);e=await i.json()}catch(i){this.#a=null,this.#r(`Failed to load versions manifest: ${i.message}`,{error:i}),this.#h();return}if(this.#a===t){if(this.#a=null,!Array.isArray(e)){this.#r(`Manifest is not a JSON array: ${t}`),this.#h();return}this.#t=e.filter(i=>i&&typeof i.id=="string"),this.#e=this.#b(),this.#h(),this.#d(),this.#p(),this.#o&&this.#f()}}#p(){if(!this.hasAttribute("data-banner"))return;let t=this.#t.find(r=>r.id===this.#e),e=this.#t.find(r=>!r.archived&&!r.draft);if(this.#c?.remove(),this.#c=null,!t?.archived||!e||e.id===t.id)return;let i=document.createElement("aside");i.className="version-switcher-banner",i.setAttribute("role","region"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-label","Archived version notice");let s=document.createElement("span");s.className="version-switcher-banner-text",s.textContent=`You're viewing ${t.label||t.id} (archived).`;let n=document.createElement("a");n.className="version-switcher-banner-link",e.url&&(n.href=e.url),n.textContent=`Latest: ${e.label||e.id} \u2192`,i.append(s," ",n),this.prepend(i),this.#c=i}#x(){let t=this.getAttribute("data-page-info-target");if(!t)return;let e=document.getElementById(t);if(!e||e.localName!=="page-info"){this.#r(`data-page-info-target: no <page-info id="${t}"> found.`);return}this.#i.hidden=!0;let i=()=>{let n=e.querySelector(".page-info-panel");return n?(this.#f(n),!0):!1};if(i())return;let s=new MutationObserver(()=>{i()&&s.disconnect()});s.observe(e,{childList:!0,subtree:!0}),setTimeout(()=>{this.#o||(s.disconnect(),this.#r(`<page-info id="${t}"> never rendered .page-info-panel within 5s.`))},5e3)}#f(t){let e=t||this.#o?.parentNode;if(!e)return;let i=this.#o;if(!i){i=document.createElement("section"),i.className="version-switcher-panel-section",i.setAttribute("aria-label",this.getAttribute("aria-label")||"Versions");let n=document.createElement("h3");n.className="version-switcher-panel-heading",n.textContent=this.#v()==="history"?"History":"Versions",i.appendChild(n),e.appendChild(i),this.#o=i}let s=i.querySelector("ul.version-switcher-panel-list");if(s||(s=document.createElement("ul"),s.className="version-switcher-panel-list",i.appendChild(s)),s.replaceChildren(),this.#t.length===0){let n=document.createElement("li");n.className="version-switcher-empty",n.textContent=this.#a?"Loading versions\u2026":"No versions available.",s.appendChild(n);return}for(let n of this.#t)s.appendChild(this.#E(n))}#$(){this.#i?.parentNode!==this&&(this.#i=document.createElement("button"),this.#i.type="button",this.#i.className="version-switcher-trigger",this.#i.setAttribute("aria-haspopup","dialog"),this.#i.setAttribute("aria-expanded","false"),this.appendChild(this.#i))}#N(){if(this.#s?.parentNode===this)return;let t=`version-switcher-${++N}`;this.#i.setAttribute("popovertarget",t),this.#s=document.createElement("pop-over"),this.#s.id=t,this.#s.className="version-switcher-popover",this.#s.dataset.position="bottom-end",this.#s.setAttribute("role","dialog"),this.#s.setAttribute("aria-label",this.getAttribute("aria-label")||"Version");let e=document.createElement("h3");e.className="version-switcher-heading",e.textContent=this.#v()==="history"?"History":"Versions",this.#n=document.createElement("ul"),this.#n.className="version-switcher-list",this.#n.setAttribute("role","list"),this.#s.append(e,this.#n),this.appendChild(this.#s),this.listen(this.#s,"pop-over:show",()=>{this.#i.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("version-switcher:open",{bubbles:!0}));let i=this.#n.querySelector('[data-current="true"] button')||this.#n.querySelector("button");requestAnimationFrame(()=>i?.focus())}),this.listen(this.#s,"pop-over:hide",()=>{this.#i.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("version-switcher:close",{bubbles:!0}))}),this.listen(this.#n,"keydown",this.#S)}#h(){let t=this.#t.find(r=>r.id===this.#e),e=!!this.#a&&this.#t.length===0,i=e?"Loading\u2026":t?.label||t?.id||"Version";this.#i.replaceChildren();let s=document.createElement("span");s.className="version-switcher-trigger-label",s.textContent=i;let n=document.createElement("span");n.className="version-switcher-trigger-chevron",n.setAttribute("aria-hidden","true"),n.textContent="\u25BE",this.#i.append(s,n),this.#t.length===0?(this.#i.disabled=!0,this.#i.setAttribute("title",e?"Loading versions\u2026":"No versions available")):(this.#i.disabled=!1,this.#i.removeAttribute("title"))}#d(){if(this.#n){if(this.#n.replaceChildren(),this.#t.length===0){let t=document.createElement("li");t.className="version-switcher-empty",t.textContent="No versions available.",this.#n.appendChild(t);return}for(let t of this.#t)this.#n.appendChild(this.#E(t))}}#E(t){let e=document.createElement("li");e.setAttribute("role","listitem"),e.dataset.versionId=t.id,t.id===this.#e&&(e.dataset.current="true"),t.archived&&(e.dataset.archived=""),t.draft&&(e.dataset.draft="");let i=document.createElement("button");i.type="button",i.className="version-switcher-entry",i.setAttribute("aria-current",t.id===this.#e?"true":"false");let s=document.createElement("span");if(s.className="version-switcher-entry-label",s.textContent=t.label||t.id,t.archived){let r=document.createElement("span");r.className="version-switcher-badge version-switcher-badge-archived",r.textContent="archived",s.appendChild(r)}if(t.draft){let r=document.createElement("span");r.className="version-switcher-badge version-switcher-badge-draft",r.textContent="draft",s.appendChild(r)}if(t.id===this.#e){let r=document.createElement("span");r.className="version-switcher-badge version-switcher-badge-current",r.textContent="current",s.appendChild(r)}if(i.appendChild(s),t.date){let r=document.createElement("time");r.className="version-switcher-entry-date",r.setAttribute("datetime",t.date);try{r.title=new Date(t.date).toLocaleString()}catch{}r.textContent=A(t.date)||t.date,i.appendChild(r)}if(t.author){let r=document.createElement("span");r.className="version-switcher-entry-author",r.textContent=`by ${t.author}`,i.appendChild(r)}if(t.summary){let r=document.createElement("span");r.className="version-switcher-entry-summary",r.textContent=t.summary,i.appendChild(r)}if(t.versionUrl){let r=document.createElement("a");r.className="version-switcher-entry-changelog",r.href=t.versionUrl,r.textContent="Changelog \u2192",this.listen(r,"click",a=>a.stopPropagation()),i.appendChild(r)}let n=[t.label||t.id];return t.date&&n.push(`released ${A(t.date)||t.date}`),t.archived&&n.push("archived"),t.draft&&n.push("draft"),t.id===this.#e&&n.push("current"),i.setAttribute("aria-label",n.join(", ")),this.listen(i,"click",()=>this.#k(t)),e.appendChild(i),e}#S=t=>{let e=[...this.#n.querySelectorAll("button.version-switcher-entry")],i=e.indexOf(document.activeElement);if(i===-1)return;let s=i;switch(t.key){case"ArrowDown":t.preventDefault(),s=Math.min(e.length-1,i+1);break;case"ArrowUp":t.preventDefault(),s=Math.max(0,i-1);break;case"Home":t.preventDefault(),s=0;break;case"End":t.preventDefault(),s=e.length-1;break;default:return}e[s]?.focus()};#k(t){this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:t}})),this.#C(t)}#C(t){let e=this.getAttribute("data-action")||"navigate";if(e==="navigate")return this.#A(t);if(e==="swap")return this.#M(t);if(e==="diff")return this.#q(t);this.#r(`Unknown action "${e}"; falling back to navigate.`),this.#A(t)}#A(t){if(!t?.url){this.#r("Cannot navigate: entry has no url.",{entry:t});return}let e=new CustomEvent("version-switcher:before-navigate",{bubbles:!0,cancelable:!0,detail:{entry:t}});this.dispatchEvent(e)&&(this.closePicker(),location.href=t.url)}#u(){return this.getAttribute("data-versioned-region")||"[data-versioned], main"}#m(t){return t.querySelector(this.#u())}async#y(t){let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw new Error(`Fetch failed (${e.status}) for ${t}`);let i=await e.text(),s=new DOMParser().parseFromString(i,"text/html"),n=this.#m(s);if(!n)throw new Error(`No versioned region (${this.#u()}) found in ${t}`);return n}async#M(t){if(!t?.url){this.#r("Cannot swap: entry has no url.",{entry:t});return}let e=this.#m(document);if(!e){this.#r(`No versioned region (${this.#u()}) on this page to swap.`,{entry:t});return}let i=new CustomEvent("version-switcher:before-swap",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(i))return;this.closePicker();let s=this.#e,n=async()=>{try{let a=await this.#y(t.url);e.replaceChildren(...a.childNodes)}catch(a){throw this.#r(a.message,{entry:t,error:a}),a}};try{"startViewTransition"in document?await document.startViewTransition(n).updateCallbackDone:await n()}catch{return}let r=document.querySelector('meta[itemprop="version"]');r||(r=document.createElement("meta"),r.setAttribute("itemprop","version"),document.head.appendChild(r)),r.setAttribute("content",t.id),this.#e=t.id,this.#h(),this.#d(),this.dispatchEvent(new CustomEvent("version-switcher:swap",{bubbles:!0,detail:{entry:t,previousId:s}}))}async#q(t){if(!t?.url){this.#r("Cannot diff: entry has no url.",{entry:t});return}let e=this.#m(document);if(!e){this.#r(`No versioned region (${this.#u()}) on this page to diff against.`,{entry:t});return}if(t.id===this.#e){this.#r("Cannot diff against the current version.",{entry:t});return}let i=new CustomEvent("version-switcher:before-diff",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(i))return;this.closePicker();let s;try{s=await this.#y(t.url)}catch(c){this.#r(c.message,{entry:t,error:c});return}document.querySelectorAll(".version-switcher-diff-host").forEach(c=>c.remove());let n=E(e.textContent.trim(),s.textContent.trim()),r=document.createElement("change-set");r.classList.add("version-switcher-diff-host"),r.dataset.versionFrom=this.#e??"",r.dataset.versionTo=t.id,r.appendChild(C(n)),(this.getAttribute("data-diff-position")||"before")==="after"?e.parentNode.insertBefore(r,e.nextSibling):e.parentNode.insertBefore(r,e),r.setAttribute("tabindex","-1"),r.focus({preventScroll:!1}),this.dispatchEvent(new CustomEvent("version-switcher:diff",{bubbles:!0,detail:{entry:t,previousId:this.#e,diffElement:r,opCount:n.length}}))}get versions(){return this.#t.slice()}get currentId(){return this.#e}openPicker(){this.#s?.show()}closePicker(){this.#s?.hide()}switchTo(t){let e=this.#t.find(i=>i.id===t);if(!e){this.#r(`switchTo: no entry with id "${t}"`);return}this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:e}})),this.#C(e)}refresh(){this.#l(),!(!this.#i||!this.#n)&&(this.#h(),this.#d(),this.#p(),this.#o&&this.#f())}#r(t,e={}){this.dispatchEvent(new CustomEvent("version-switcher:error",{bubbles:!0,detail:{message:t,...e}}))}};function A(h){let t=new Date(h);if(isNaN(t.getTime()))return null;let e=(Date.now()-t.getTime())/1e3;if(e<0)return null;let i=60,s=3600,n=86400,r=2592e3,a=31536e3;if(e<i)return"just now";if(e<s){let o=Math.floor(e/i);return`${o} minute${o!==1?"s":""} ago`}if(e<n){let o=Math.floor(e/s);return`${o} hour${o!==1?"s":""} ago`}if(e<r){let o=Math.floor(e/n);return`${o} day${o!==1?"s":""} ago`}if(e<a){let o=Math.floor(e/r);return`${o} month${o!==1?"s":""} ago`}let c=Math.floor(e/a);return`${c} year${c!==1?"s":""} ago`}p("version-switcher",g);export{g as VersionSwitcher};
|
|
3
|
+
`),n=e.length,r=i.length,o=Array.from({length:n+1},()=>new Array(r+1).fill(0));for(let l=1;l<=n;l++)for(let u=1;u<=r;u++)e[l-1]===i[u-1]?o[l][u]=o[l-1][u-1]+1:o[l][u]=Math.max(o[l-1][u],o[l][u-1]);let a=[],c=n,h=r;for(;c>0||h>0;)c>0&&h>0&&e[c-1]===i[h-1]?(a.unshift({type:"eq",text:e[c-1]}),c-=1,h-=1):h>0&&(c===0||o[c][h-1]>=o[c-1][h])?(a.unshift({type:"add",text:i[h-1]}),h-=1):(a.unshift({type:"del",text:e[c-1]}),c-=1);return a}function q(s){let t=document.createDocumentFragment(),e=document.createElement("pre");e.className="text-diff";for(let i of s)if(i.type==="eq")e.appendChild(document.createTextNode(`${i.text}
|
|
4
|
+
`));else if(i.type==="add"){let n=document.createElement("ins");n.textContent=`${i.text}
|
|
5
|
+
`,e.appendChild(n)}else if(i.type==="del"){let n=document.createElement("del");n.textContent=`${i.text}
|
|
6
|
+
`,e.appendChild(n)}return t.appendChild(e),t}var Et={trigger:"Version",loading:"Loading\u2026","loading-versions":"Loading versions\u2026",empty:"No versions available.","heading-releases":"Versions","heading-history":"History",archived:"archived",draft:"draft",current:"current",by:"by {author}",changelog:"Changelog","changelog-for":"{version} changelog","banner-label":"Archived version notice",banner:"You\u2019re viewing {version} (archived).","banner-latest":"Latest: {version}",diff:"Diff: {from} \u2192 {to}"},St=/^\d{4}-\d{2}-\d{2}$/,x=0,N=class extends p{static observedAttributes=["data-versions","data-src","data-mode","aria-label"];#t=[];#i=null;#e;#n;#c;#s;#a=null;#u=null;#l=null;#d=null;#h=null;setup(){this.#w(),this.#D(),this.#_(),this.#U(),this.#f(),this.#T(),this.#C(),this.hasAttribute("data-page-info-target")&&this.#P(),this.#t.length===0&&(this.getAttribute("data-src")||this.#E())&&this.#S()}teardown(){this.#u?.disconnect(),this.#u=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null,this.#a?.remove(),this.#a=null,this.#h=null}attributeChangedCallback(t,e,i){!this.isConnected||e===i||!this.#e||(t==="data-versions"&&this.refresh(),t==="data-src"&&this.#S(),(t==="data-mode"||t==="aria-label")&&this.#p())}#r(t,e={}){let i=this.getAttribute(`data-label-${t}`)??Et[t]??t;for(let[n,r]of Object.entries(e))i=i.replaceAll(`{${n}}`,String(r));return i}#b(){return this.getAttribute("aria-label")||this.#r("trigger")}#v(){return this.#r(this.#O()==="history"?"heading-history":"heading-releases")}#w(){let t=null,e=this.getAttribute("data-versions");if(e)try{t=JSON.parse(e)}catch(i){this.#o("Failed to parse data-versions JSON",{error:i})}if(!t){let i=this.querySelector(':scope > script[type="application/json"][data-versions]');if(i?.textContent.trim())try{t=JSON.parse(i.textContent)}catch(n){this.#o("Failed to parse <script data-versions> JSON",{error:n})}}this.#t=this.#y(t),this.#i=this.#A()}#y(t){if(!Array.isArray(t))return[];let e=[];for(let i of t){if(!i||typeof i.id!="string")continue;let n={...i};if(n.url!=null&&!b(n.url)){this.#o(`Dropped version "${n.id}": unsafe url.`,{entry:n});continue}n.versionUrl!=null&&!b(n.versionUrl)&&delete n.versionUrl,e.push(n)}return e}#A(){if(this.#t.length===0)return null;let t=this.#t.find(i=>i.current===!0);if(t)return t.id;let e=document.querySelector('meta[itemprop="version"]')?.getAttribute("content");if(e){let i=this.#t.find(n=>n.id===e);if(i)return i.id}return this.#t[0].id}#O(){let t=this.getAttribute("data-mode");return t==="releases"||t==="history"?t:new Set(this.#t.map(i=>i.url).filter(Boolean)).size>1?"releases":"history"}#E(){return document.querySelector('meta[name="vb:versions-manifest"]')?.getAttribute("content")}async#S(){let t=this.getAttribute("data-src")||this.#E();if(!t)return;this.#h=t,this.#f();let e;try{let i=await fetch(t,{credentials:"same-origin"});if(!i.ok)throw new Error(`Fetch failed (${i.status}) for ${t}`);e=await i.json()}catch(i){if(this.#h!==t)return;this.#h=null,this.#o(`Failed to load versions manifest: ${i.message}`,{error:i}),this.#f();return}if(this.#h===t){if(this.#h=null,!Array.isArray(e)){this.#o(`Manifest is not a JSON array: ${t}`),this.#f();return}this.#t=this.#y(e),this.#i=this.#A(),this.#p()}}#p(){this.#f(),this.#T(),this.#C(),this.#a&&this.#N()}#C(){if(this.#d?.remove(),this.#d=null,!this.hasAttribute("data-banner"))return;let t=this.#t.find(o=>o.id===this.#i),e=this.#t.find(o=>!o.archived&&!o.draft);if(!t?.archived||!e||e.id===t.id)return;let i=document.createElement("aside");i.className="version-switcher-banner",i.setAttribute("aria-label",this.#r("banner-label"));let n=document.createElement("p");n.className="version-switcher-banner-text",n.setAttribute("role","status"),i.append(n),this.prepend(i),this.#d=i;let r=()=>{if(this.#d!==i)return;n.textContent=this.#r("banner",{version:t.label||t.id});let o=this.#r("banner-latest",{version:e.label||e.id});if(e.url&&b(e.url)){let a=document.createElement("a");a.className="version-switcher-banner-link",a.href=e.url,a.textContent=o,i.append(a)}else{let a=document.createElement("span");a.className="version-switcher-banner-latest",a.textContent=o,i.append(a)}};requestAnimationFrame(()=>requestAnimationFrame(r))}#P(){let t=this.getAttribute("data-page-info-target");if(!t)return;let e=document.getElementById(t);if(!e||e.localName!=="page-info"){this.#o(`data-page-info-target: no <page-info id="${t}"> found.`);return}this.#e.hidden=!0;let i=()=>{let r=e.querySelector(".page-info-panel");return r?(this.#N(r),!0):!1};if(i())return;let n=new MutationObserver(()=>{i()&&this.#x()});n.observe(e,{childList:!0,subtree:!0}),this.#u=n,this.#l=setTimeout(()=>{this.#l=null,!this.#a&&(this.#x(),this.#o(`<page-info id="${t}"> never rendered .page-info-panel within 5s.`))},5e3)}#x(){this.#u?.disconnect(),this.#u=null,this.#l!=null&&clearTimeout(this.#l),this.#l=null}#N(t){let e=t||this.#a?.parentNode;if(!e)return;let i=this.#a;if(!i){i=document.createElement("section"),i.className="version-switcher-panel-section";let r=document.createElement("h3");r.className="version-switcher-panel-heading",r.id=`version-switcher-panel-${++x}`,i.setAttribute("aria-labelledby",r.id);let o=document.createElement("ul");o.className="version-switcher-panel-list",i.append(r,o),e.appendChild(i),this.#a=i,this.listen(o,"click",this.#$)}i.querySelector(".version-switcher-panel-heading").textContent=this.#v();let n=i.querySelector("ul.version-switcher-panel-list");this.#k(n,this.#h?"loading-versions":"empty")}#D(){this.#e?.parentNode!==this&&(this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="version-switcher-trigger",this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.appendChild(this.#e))}#_(){if(this.#n?.parentNode===this)return;let t=`version-switcher-${++x}`;this.#e.setAttribute("popovertarget",t),this.#n=document.createElement("pop-over"),this.#n.id=t,this.#n.className="version-switcher-popover",this.#n.dataset.position="bottom-end",this.#n.setAttribute("role","dialog"),this.#c=document.createElement("h3"),this.#c.className="version-switcher-heading",this.#s=document.createElement("ul"),this.#s.className="version-switcher-list",this.#s.setAttribute("role","list"),this.#n.append(this.#c,this.#s),this.appendChild(this.#n)}#U(){!this.#n||!this.#s||(this.listen(this.#n,"pop-over:show",()=>{this.#e.setAttribute("aria-expanded","true"),this.dispatchEvent(new CustomEvent("version-switcher:open",{bubbles:!0}));let t=this.#s.querySelector('[data-current="true"] button')||this.#s.querySelector("button");requestAnimationFrame(()=>t?.focus())}),this.listen(this.#n,"pop-over:hide",()=>{this.#e.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("version-switcher:close",{bubbles:!0}))}),this.listen(this.#s,"keydown",this.#V),this.listen(this.#s,"click",this.#$))}#f(){if(!this.#e)return;let t=this.#t.find(a=>a.id===this.#i),e=!!this.#h&&this.#t.length===0,i=e?this.#r("loading"):t?.label||t?.id||this.#r("trigger"),n=document.createElement("span");n.className="version-switcher-trigger-label",n.textContent=i;let r=document.createElement("span");r.className="version-switcher-trigger-chevron",r.setAttribute("aria-hidden","true"),r.textContent="\u25BE",this.#e.replaceChildren(n,r);let o=this.#b();this.#e.setAttribute("aria-label",i===o?o:`${o}: ${i}`),this.#n?.setAttribute("aria-label",o),this.#t.length===0?(this.#e.disabled=!0,this.#e.setAttribute("title",this.#r(e?"loading-versions":"empty"))):(this.#e.disabled=!1,this.#e.removeAttribute("title"))}#T(){this.#s&&(this.#c.textContent=this.#v(),this.#k(this.#s,"empty"))}#k(t,e){if(t.replaceChildren(),this.#t.length===0){let i=document.createElement("li");i.className="version-switcher-empty",i.textContent=this.#r(e),t.appendChild(i);return}for(let i of this.#t)t.appendChild(this.#q(i))}#q(t){let e=t.id===this.#i,i=t.label||t.id,n=document.createElement("li");n.setAttribute("role","listitem"),n.className="version-switcher-item",n.dataset.versionId=t.id,e&&(n.dataset.current="true"),t.archived&&(n.dataset.archived=""),t.draft&&(n.dataset.draft="");let r=document.createElement("button");r.type="button",r.className="version-switcher-entry",r.setAttribute("aria-current",e?"true":"false");let o=document.createElement("span");o.className="version-switcher-entry-label",o.append(i);let a=l=>{let u=document.createElement("span");u.className=`version-switcher-badge version-switcher-badge-${l}`,u.textContent=this.#r(l),o.append(" ",u)};if(t.archived&&a("archived"),t.draft&&a("draft"),e&&a("current"),r.appendChild(o),t.date){let l=document.createElement("time");l.className="version-switcher-entry-date",l.setAttribute("datetime",t.date);let u=L(this),d=xt(t.date,u);d&&(l.title=d),l.textContent=Nt(t.date,u)||d||t.date,r.append(" ",l)}n.appendChild(r);let c=[],h=`${this.#n?.id||"version-switcher"}-${Ct(t.id)}-${++x}`;if(t.author){let l=document.createElement("span");l.className="version-switcher-entry-author",l.id=`${h}-author`,l.textContent=this.#r("by",{author:t.author}),n.appendChild(l),c.push(l.id)}if(t.summary){let l=document.createElement("span");l.className="version-switcher-entry-summary",l.id=`${h}-summary`,l.textContent=t.summary,n.appendChild(l),c.push(l.id)}if(c.length&&r.setAttribute("aria-describedby",c.join(" ")),t.versionUrl&&b(t.versionUrl)){let l=document.createElement("a");l.className="version-switcher-entry-changelog",l.href=t.versionUrl,l.setAttribute("aria-label",this.#r("changelog-for",{version:i})),l.append(this.#r("changelog"));let u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.textContent=" \u2192",l.append(u),n.appendChild(l)}return n}#$=t=>{let e=t.target.closest?.("button.version-switcher-entry");if(!e)return;let i=e.closest("[data-version-id]")?.dataset.versionId,n=this.#t.find(r=>r.id===i);n&&this.#F(n)};#V=t=>{let e=[...this.#s.querySelectorAll("button.version-switcher-entry")],i=e.indexOf(document.activeElement);if(i===-1)return;let n=i;switch(t.key){case"ArrowDown":t.preventDefault(),n=Math.min(e.length-1,i+1);break;case"ArrowUp":t.preventDefault(),n=Math.max(0,i-1);break;case"Home":t.preventDefault(),n=0;break;case"End":t.preventDefault(),n=e.length-1;break;default:return}e[n]?.focus()};#F(t){this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:t}})),this.#L(t)}#L(t){let e=this.getAttribute("data-action")||"navigate";if(e==="navigate")return this.#M(t);if(e==="swap")return this.#B(t);if(e==="diff")return this.#j(t);this.#o(`Unknown action "${e}"; falling back to navigate.`),this.#M(t)}#M(t){if(!t?.url||!b(t.url)){this.#o("Cannot navigate: entry has no safe url.",{entry:t});return}let e=new URL(t.url,location.href);if(e.href===location.href){this.#o("Cannot navigate: entry url is the current page.",{entry:t});return}let i=new CustomEvent("version-switcher:before-navigate",{bubbles:!0,cancelable:!0,detail:{entry:t}});this.dispatchEvent(i)&&(this.closePicker(),location.href=e.href)}#m(){return this.getAttribute("data-versioned-region")||"[data-versioned], main"}#g(t){return t.querySelector(this.#m())}#I(t,e){if(!t?.url||!b(t.url))return this.#o(`Cannot ${e}: entry has no safe url.`,{entry:t}),null;let i=new URL(t.url,location.href);return i.origin!==location.origin?(this.#o(`Cannot ${e}: ${i.href} is not same-origin.`,{entry:t}),null):i}async#R(t){let e=await fetch(t,{credentials:"same-origin"});if(!e.ok)throw new Error(`Fetch failed (${e.status}) for ${t.href}`);let i=await e.text(),n=new DOMParser().parseFromString(i,"text/html"),r=this.#g(n);if(!r)throw new Error(`No versioned region (${this.#m()}) found in ${t.href}`);return r}async#B(t){let e=this.#I(t,"swap");if(!e)return;let i=this.#g(document);if(!i){this.#o(`No versioned region (${this.#m()}) on this page to swap.`,{entry:t});return}let n=new CustomEvent("version-switcher:before-swap",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(n))return;this.closePicker();let r=this.#i,o=async()=>{try{let c=await this.#R(e);i.replaceChildren(P(c.innerHTML,{keepIds:!0,keepStyle:!0}))}catch(c){throw this.#o(c.message,{entry:t,error:c}),c}};try{if("startViewTransition"in document){let c;try{c=document.startViewTransition({update:o,types:["version-swap"]})}catch{c=document.startViewTransition(o)}await c.updateCallbackDone}else await o()}catch{return}let a=document.querySelector('meta[itemprop="version"]');a||(a=document.createElement("meta"),a.setAttribute("itemprop","version"),document.head.appendChild(a)),a.setAttribute("content",t.id),this.#i=t.id,this.#p(),this.dispatchEvent(new CustomEvent("version-switcher:swap",{bubbles:!0,detail:{entry:t,previousId:r}}))}async#j(t){let e=this.#I(t,"diff");if(!e)return;let i=this.#g(document);if(!i){this.#o(`No versioned region (${this.#m()}) on this page to diff against.`,{entry:t});return}if(t.id===this.#i){this.#o("Cannot diff against the current version.",{entry:t});return}let n=new CustomEvent("version-switcher:before-diff",{bubbles:!0,cancelable:!0,detail:{entry:t}});if(!this.dispatchEvent(n))return;this.closePicker();let r;try{r=await this.#R(e)}catch(h){this.#o(h.message,{entry:t,error:h});return}document.querySelectorAll(".version-switcher-diff-host").forEach(h=>h.remove());let o=U(i.textContent.trim(),r.textContent.trim()),a=document.createElement("change-set");a.classList.add("version-switcher-diff-host"),a.dataset.versionFrom=this.#i??"",a.dataset.versionTo=t.id,a.dataset.diffLabel=this.#r("diff",{from:this.#i??"",to:t.id}),a.appendChild(q(o)),(this.getAttribute("data-diff-position")||"before")==="after"?i.parentNode.insertBefore(a,i.nextSibling):i.parentNode.insertBefore(a,i),a.setAttribute("tabindex","-1"),a.focus({preventScroll:!1}),this.dispatchEvent(new CustomEvent("version-switcher:diff",{bubbles:!0,detail:{entry:t,previousId:this.#i,diffElement:a,opCount:o.length}}))}get versions(){return this.#t.slice()}get currentId(){return this.#i}openPicker(){this.#n?.show()}closePicker(){this.#n?.hide()}switchTo(t){let e=this.#t.find(i=>i.id===t);if(!e){this.#o(`switchTo: no entry with id "${t}"`);return}this.dispatchEvent(new CustomEvent("version-switcher:select",{bubbles:!0,detail:{entry:e}})),this.#L(e)}refresh(){this.#w(),!(!this.#e||!this.#s)&&this.#p()}#o(t,e={}){this.dispatchEvent(new CustomEvent("version-switcher:error",{bubbles:!0,detail:{message:t,...e}}))}};function b(s){return typeof s=="string"&&s.trim()!==""&&!g(s,!1)}function Ct(s){return String(s).replace(/[^\w-]/g,"_")}function V(s){let t=new Date(s);return Number.isNaN(t.getTime())?null:t}function xt(s,t){let e=V(s);if(!e)return null;let i=St.test(s)?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long",timeStyle:"short"};try{return new Intl.DateTimeFormat(t,i).format(e)}catch{return e.toISOString()}}function Nt(s,t){let e=V(s);if(!e)return null;let i=(Date.now()-e.getTime())/1e3;if(i<0)return null;let n;try{n=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{n=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}let r=60,o=3600,a=86400,c=2592e3,h=31536e3;return i<r?n.format(0,"second"):i<o?n.format(-Math.floor(i/r),"minute"):i<a?n.format(-Math.floor(i/o),"hour"):i<c?n.format(-Math.floor(i/a),"day"):i<h?n.format(-Math.floor(i/c),"month"):n.format(-Math.floor(i/h),"year")}m("version-switcher",N);export{N as VersionSwitcher};
|
|
7
7
|
//# sourceMappingURL=version-switcher.js.map
|