@uvalib/web-components 1.7.0 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +60 -15
  3. package/dist/base/states.d.ts +12 -0
  4. package/dist/base/states.js +33 -0
  5. package/dist/base/states.js.map +1 -0
  6. package/dist/base.css +69 -6
  7. package/dist/components/bento-box/BentoBox.js +1 -0
  8. package/dist/components/bento-box/BentoBox.js.map +1 -1
  9. package/dist/components/events-section/EventsSection.js +1 -0
  10. package/dist/components/events-section/EventsSection.js.map +1 -1
  11. package/dist/components/library-hours/hours-data.js +1 -1
  12. package/dist/components/library-hours/hours-data.js.map +1 -1
  13. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +1 -0
  14. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
  15. package/dist/components/site-main-nav/SiteMainNav.d.ts +1 -1
  16. package/dist/components/site-main-nav/SiteMainNav.js +9 -2
  17. package/dist/components/site-main-nav/SiteMainNav.js.map +1 -1
  18. package/dist/components/site-page/SitePage.d.ts +1 -1
  19. package/dist/components/site-page/SitePage.js +3 -2
  20. package/dist/components/site-page/SitePage.js.map +1 -1
  21. package/dist/components/site-style/SiteStyle.d.ts +1 -1
  22. package/dist/components/site-style/SiteStyle.js +3 -2
  23. package/dist/components/site-style/SiteStyle.js.map +1 -1
  24. package/dist/components/uvalib-card/UvalibCard.js +6 -0
  25. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  26. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +27 -0
  27. package/dist/components/uvalib-combobox/UvalibCombobox.js +85 -1
  28. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -1
  29. package/dist/components/uvalib-contents/UvalibContents.js +5 -0
  30. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  31. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +6 -0
  32. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +10 -0
  33. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -1
  34. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +2 -0
  35. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
  36. package/dist/components/uvalib-image-regions/regions.d.ts +6 -2
  37. package/dist/components/uvalib-image-regions/regions.js +6 -3
  38. package/dist/components/uvalib-image-regions/regions.js.map +1 -1
  39. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +9 -2
  40. package/dist/components/uvalib-lightbox/UvalibLightbox.js +23 -3
  41. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  42. package/dist/components/uvalib-lightbox/compare.d.ts +30 -3
  43. package/dist/components/uvalib-lightbox/compare.js +98 -29
  44. package/dist/components/uvalib-lightbox/compare.js.map +1 -1
  45. package/dist/components/uvalib-map/UvalibMap.js +2 -2
  46. package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
  47. package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -0
  48. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  49. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +3 -1
  50. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
  51. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +3 -3
  52. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +16 -8
  53. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  54. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +4 -1
  55. package/dist/components/uvalib-tag-list/UvalibTagList.js +9 -2
  56. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -1
  57. package/dist/custom-elements.json +1992 -1681
  58. package/dist/pagefind.css +8 -1
  59. package/dist/styles/base.js +8 -1
  60. package/dist/styles/base.js.map +1 -1
  61. package/dist/styles/font-fallback.d.ts +17 -0
  62. package/dist/styles/font-fallback.js +64 -0
  63. package/dist/styles/font-fallback.js.map +1 -0
  64. package/dist/styles/message.js +4 -0
  65. package/dist/styles/message.js.map +1 -1
  66. package/dist/styles/pagefind.js +8 -1
  67. package/dist/styles/pagefind.js.map +1 -1
  68. package/dist/styles/result-list.js +25 -4
  69. package/dist/styles/result-list.js.map +1 -1
  70. package/dist/styles/results.js +17 -2
  71. package/dist/styles/results.js.map +1 -1
  72. package/dist/styles/tokens.js +1 -1
  73. package/dist/tokens.css +47 -1
  74. package/dist-cdn/base.css +69 -6
  75. package/dist-cdn/bento-box.js +1 -0
  76. package/dist-cdn/bento-box.js.map +1 -1
  77. package/dist-cdn/chunks/{base-BI8h0Gf3.js → base-CIX_-Rmo.js} +58 -6
  78. package/dist-cdn/chunks/base-CIX_-Rmo.js.map +1 -0
  79. package/dist-cdn/chunks/{compare-DV6ltvsJ.js → compare-C0nhByn7.js} +66 -29
  80. package/dist-cdn/chunks/compare-C0nhByn7.js.map +1 -0
  81. package/dist-cdn/chunks/{hours-data-Bw6vkIw7.js → hours-data-gMu5uT7H.js} +2 -2
  82. package/dist-cdn/chunks/hours-data-gMu5uT7H.js.map +1 -0
  83. package/dist-cdn/chunks/{library-weekly-hours-CrV3TlP5.js → library-weekly-hours-BJgxAyah.js} +3 -2
  84. package/dist-cdn/chunks/library-weekly-hours-BJgxAyah.js.map +1 -0
  85. package/dist-cdn/chunks/{regions-B8ExwUGP.js → regions-B-rOwa-v.js} +15 -15
  86. package/dist-cdn/chunks/regions-B-rOwa-v.js.map +1 -0
  87. package/dist-cdn/chunks/{site-header-DYRMpdBj.js → site-header-CEmNtmk5.js} +2 -2
  88. package/dist-cdn/chunks/{site-header-DYRMpdBj.js.map → site-header-CEmNtmk5.js.map} +1 -1
  89. package/dist-cdn/chunks/{site-main-nav-DURrQMal.js → site-main-nav-CAwKq_x5.js} +9 -2
  90. package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +1 -0
  91. package/dist-cdn/chunks/states-DGXGzcte.js +17 -0
  92. package/dist-cdn/chunks/states-DGXGzcte.js.map +1 -0
  93. package/dist-cdn/custom-elements.json +1992 -1681
  94. package/dist-cdn/events-section.js +1 -0
  95. package/dist-cdn/events-section.js.map +1 -1
  96. package/dist-cdn/library-hours-setup.js +1 -1
  97. package/dist-cdn/library-weekly-hours.js +1 -1
  98. package/dist-cdn/manifest.json +1 -1
  99. package/dist-cdn/pagefind.css +8 -1
  100. package/dist-cdn/site-header.js +1 -1
  101. package/dist-cdn/site-hours-section.js +1 -1
  102. package/dist-cdn/site-main-nav.js +1 -1
  103. package/dist-cdn/site-page.js +50 -46
  104. package/dist-cdn/site-page.js.map +1 -1
  105. package/dist-cdn/site-style.js +6 -6
  106. package/dist-cdn/site-style.js.map +1 -1
  107. package/dist-cdn/skills/uvalib-web-components/SKILL.md +6 -5
  108. package/dist-cdn/skills/uvalib-web-components/reference/components.md +36 -9
  109. package/dist-cdn/tokens.css +47 -1
  110. package/dist-cdn/uvalib-card.js +6 -0
  111. package/dist-cdn/uvalib-card.js.map +1 -1
  112. package/dist-cdn/uvalib-combobox.js +107 -68
  113. package/dist-cdn/uvalib-combobox.js.map +1 -1
  114. package/dist-cdn/uvalib-contents.js +5 -0
  115. package/dist-cdn/uvalib-contents.js.map +1 -1
  116. package/dist-cdn/uvalib-filter-drawer.js +27 -25
  117. package/dist-cdn/uvalib-filter-drawer.js.map +1 -1
  118. package/dist-cdn/uvalib-image-regions.js +3 -1
  119. package/dist-cdn/uvalib-image-regions.js.map +1 -1
  120. package/dist-cdn/uvalib-lightbox.js +80 -69
  121. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  122. package/dist-cdn/uvalib-map.js +2 -2
  123. package/dist-cdn/uvalib-map.js.map +1 -1
  124. package/dist-cdn/uvalib-metadata.js +3 -0
  125. package/dist-cdn/uvalib-metadata.js.map +1 -1
  126. package/dist-cdn/uvalib-pagefind-search.js +2 -1
  127. package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
  128. package/dist-cdn/uvalib-photo-grid.js +4 -5
  129. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  130. package/dist-cdn/uvalib-tag-list.js +21 -16
  131. package/dist-cdn/uvalib-tag-list.js.map +1 -1
  132. package/package.json +1 -1
  133. package/skills/uvalib-web-components/SKILL.md +6 -5
  134. package/skills/uvalib-web-components/reference/components.md +36 -9
  135. package/dist-cdn/chunks/base-BI8h0Gf3.js.map +0 -1
  136. package/dist-cdn/chunks/compare-DV6ltvsJ.js.map +0 -1
  137. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +0 -1
  138. package/dist-cdn/chunks/library-weekly-hours-CrV3TlP5.js.map +0 -1
  139. package/dist-cdn/chunks/regions-B8ExwUGP.js.map +0 -1
  140. package/dist-cdn/chunks/site-main-nav-DURrQMal.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"compare-DV6ltvsJ.js","names":["unsafeCSS","nothing","b","A","r","trackEvent","parseXywh","MODES","MODE_NAMES","compareTiming","MAX_SIDE","framing","list","v","ext","f","x0","y0","uw","uh","r4","n","place","norm","s","clamp","structure","h","ACCENT","LINK","look","styled","install","root","host","opts","installLightDomStyles","text","sheet","nextId","Compare","rtl","k","d","key","index","slide","restore","raw","bad","out","o","label","href","box","i","size","w","img","m","param","mode","other","next","announce","fn","state","el","write","a","on","stack","l0","lk","base","geo","hide","top","sizer","layers","visible","notes","failed","seg","pressed","onClick","switching","panel","body","switchPanel","sliding","slot"],"sources":["../../src/components/uvalib-lightbox/compare.ts"],"sourcesContent":["/**\n * Versions of an image compared over the photo: Switch, Reveal (a wipe) and Fade. Loaded by\n * `<uvalib-lightbox>` the first time an open image has versions, so pages without them never\n * load it.\n */\nimport { html, nothing, unsafeCSS } from 'lit';\nimport { trackEvent } from '../../base/analytics.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { parseXywh } from '../uvalib-image-regions/regions.js';\n\nexport type CompareMode = 'switch' | 'wipe' | 'fade';\n\nconst MODES: CompareMode[] = ['switch', 'wipe', 'fade'];\nconst MODE_NAMES: Record<CompareMode, string> = {\n switch: 'Switch',\n wipe: 'Reveal',\n fade: 'Fade',\n};\n\n/** How long (ms) after the last slider or drag change it counts as settled. Tests shorten it. */\nexport const compareTiming = { settle: 400 };\n\n/** A box in percent: of a version (its `frame`), or of the box that holds every version. */\ninterface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface Version {\n label: string;\n href: string;\n note: string;\n /** Where the original sits in this version, in percent of the version; null: the same framing. */\n frame: Box | null;\n}\n\n/**\n * Versions with a different framing: every version's box (and the original's, first) in\n * percent of the box that holds them all, at the original's scale; `uw` × `uh` is that box in\n * original widths and heights; `covers` says whether a version covers the whole original.\n */\ninterface Framing {\n boxes: Box[];\n uw: number;\n uh: number;\n covers: boolean[];\n}\n\n/** The largest side of the sizer (a canvas never drawn on, so nothing is allocated). */\nconst MAX_SIDE = 4096;\n\nfunction framing(list: Version[]): Framing | null {\n if (!list.some((v) => v.frame)) return null;\n // Each version's extent in original units: the original is 0..1 across and down.\n const ext = list.map(({ frame: f }) =>\n f ? { x: -f.x / f.w, y: -f.y / f.h, w: 100 / f.w, h: 100 / f.h } : { x: 0, y: 0, w: 1, h: 1 },\n );\n const x0 = Math.min(...ext.map((e) => e.x));\n const y0 = Math.min(...ext.map((e) => e.y));\n const uw = Math.max(...ext.map((e) => e.x + e.w)) - x0;\n const uh = Math.max(...ext.map((e) => e.y + e.h)) - y0;\n return {\n uw,\n uh,\n boxes: ext.map((e) => ({\n x: ((e.x - x0) / uw) * 100,\n y: ((e.y - y0) / uh) * 100,\n w: (e.w / uw) * 100,\n h: (e.h / uh) * 100,\n })),\n covers: list.map(({ frame: f }) => !f || (f.x + f.w <= 100.001 && f.y + f.h <= 100.001)),\n };\n}\n\nconst r4 = (n: number) => Math.round(n * 1e4) / 1e4;\n/** Custom properties placing a layer (numbers, percent of the stack). */\nconst place = (b: Box) =>\n `--uvalib-frame-x: ${r4(b.x)}; --uvalib-frame-y: ${r4(b.y)}; --uvalib-frame-w: ${r4(b.w)}; --uvalib-frame-h: ${r4(b.h)}`;\n\n/** What the lightbox lends the comparison. */\nexport interface CompareHost {\n el: HTMLElement;\n light: boolean;\n root: Node;\n noStyle: boolean;\n /** The `compare` attribute: the first mode. */\n mode(): string;\n /** The URL the viewer would load for `href` ('' when it may not be shown). */\n size(href: string): string;\n /** Write the comparison to `version-param` (replaceState). */\n write(value: string | null): void;\n update(): void;\n}\n\n/** The parts of a lightbox slide the comparison reads. */\nexport interface CompareSlide {\n id: string;\n href: string;\n versions: string | unknown[] | null;\n}\n\nconst norm = (s: unknown) => (typeof s === 'string' ? s.replace(/\\s+/g, ' ').trim() : '');\nconst clamp = (n: number) => Math.min(100, Math.max(0, Math.round(n)));\n\n/**\n * Kept with `no-style`: the stacked layers, the clip and fade, the divider and its handle\n * (white inside black, so it shows on any photo), the side labels and the control layout.\n * `h` is `:host` (shadow) or the tag (light DOM).\n */\nconst structure = (h: string) => `\n ${h} .stack { isolation: isolate; }\n ${h} .stack > img.top {\n position: absolute; inset: 0; width: 100%; height: 100%;\n max-width: none; max-height: none; margin: 0; opacity: 0; pointer-events: none;\n }\n ${h} .stack > img.top.on { opacity: 1; }\n ${h} .compare-fade > img.top.on { opacity: var(--uvalib-compare-opacity, 1); }\n ${h} .compare-wipe > img.top.on { clip-path: inset(0 calc(100% - var(--uvalib-compare, 50%)) 0 0); }\n ${h} .compare-wipe:dir(rtl) > img.top.on { clip-path: inset(0 0 0 calc(100% - var(--uvalib-compare, 50%))); }\n ${h} .compare-wipe { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: col-resize; }\n ${h} .compare-wipe img { -webkit-user-drag: none; }\n ${h} .stack.framed > img {\n position: absolute; inset: auto;\n left: calc(var(--uvalib-frame-x) * 1%); top: calc(var(--uvalib-frame-y) * 1%);\n width: calc(var(--uvalib-frame-w) * 1%); height: calc(var(--uvalib-frame-h) * 1%);\n max-width: none; max-height: none; margin: 0;\n }\n ${h} .stack.framed > canvas.frame-box {\n display: block; width: auto; height: auto; max-width: 100%; max-height: 70dvh; margin: auto;\n }\n ${h} .stack.framed.hide-base > img:not(.top) { opacity: 0; }\n ${h} .stack.framed.compare-fade > img.top.on { opacity: 1; }\n ${h} .stack.framed.compare-fade.top-on > img:not(.top) {\n z-index: 1; opacity: calc(1 - var(--uvalib-compare-opacity, 1));\n }\n ${h} .stack.framed.compare-wipe > img.top.on {\n clip-path: inset(0 max(0%, calc((var(--uvalib-frame-x) + var(--uvalib-frame-w) - var(--uvalib-compare-n, 50)) / var(--uvalib-frame-w) * 100%)) 0 0);\n }\n ${h} .stack.framed.compare-wipe:dir(rtl) > img.top.on {\n clip-path: inset(0 0 0 max(0%, calc((100 - var(--uvalib-compare-n, 50) - var(--uvalib-frame-x)) / var(--uvalib-frame-w) * 100%)));\n }\n ${h} .divider {\n position: absolute; inset-block: 0; inset-inline-start: var(--uvalib-compare, 50%);\n width: 0; pointer-events: none; forced-color-adjust: none;\n }\n ${h} .divider::before {\n content: ''; position: absolute; inset-block: 0; inset-inline-start: -2px; width: 4px;\n background: #fff; outline: 1px solid #000;\n }\n ${h} .handle {\n position: absolute; top: 50%; inset-inline-start: -22px; box-sizing: border-box;\n width: 44px; height: 44px; margin-top: -22px; border: 3px solid #000; border-radius: 50%;\n background: #fff; outline: 2px solid #fff;\n }\n ${h} .handle::before, ${h} .handle::after {\n content: ''; position: absolute; top: 50%; margin-top: -6px;\n border-block: 6px solid transparent;\n }\n ${h} .handle::before { left: 7px; border-right: 8px solid #000; }\n ${h} .handle::after { right: 7px; border-left: 8px solid #000; }\n ${h} .side {\n position: absolute; inset-block-end: 0.5rem; max-width: 40%; overflow: hidden;\n padding: 0.125rem 0.5rem; background: #000; color: #fff; outline: 1px solid #fff;\n font-size: 0.875rem; font-weight: 700; line-height: 1.3; white-space: nowrap;\n text-overflow: ellipsis; pointer-events: none; forced-color-adjust: none;\n }\n ${h} .side-start { inset-inline-start: 0.5rem; }\n ${h} .side-end { inset-inline-end: 0.5rem; }\n ${h} .compare { display: flex; flex-direction: column; gap: 0.5rem; margin-block-start: 0.75rem; }\n ${h} .compare-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }\n ${h} .mode-panels { display: grid; flex: 1 1 auto; min-width: 0; }\n ${h} .mode-panel { grid-area: 1 / 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }\n ${h} .mode-panel[data-off] { visibility: hidden; }\n ${h} .seg-group { display: flex; flex-wrap: wrap; }\n ${h} .slider { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; flex: 1 1 14rem; min-width: 0; }\n ${h} .slider input { flex: 1 1 8rem; min-width: 0; min-height: 44px; margin: 0; }\n ${h} .note { margin: 0; overflow-wrap: anywhere; }\n ${h} .note[data-off] { visibility: hidden; }\n ${h} .compare button.hold { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: none; }\n @media (forced-colors: active) {\n ${h} .divider::before { background: CanvasText; outline-color: Canvas; }\n ${h} .handle { background: Canvas; border-color: Highlight; outline-color: Canvas; }\n ${h} .handle::before { border-right-color: CanvasText; }\n ${h} .handle::after { border-left-color: CanvasText; }\n ${h} .side { background: CanvasText; color: Canvas; outline-color: Canvas; }\n }\n`;\n\nconst ACCENT = 'var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b))';\nconst LINK = 'var(--uva-color-link, var(--uva-brand-blue, #232d4b))';\n\n/** The look: segmented buttons like `<uvalib-chip-group segmented>`, the slider's accent. */\nconst look = (h: string) => `\n ${h} .compare button.seg, ${h} .compare button.jump, ${h} .compare button.hold {\n display: inline-flex; align-items: center; justify-content: center;\n border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));\n background: var(--uva-color-surface-raised, var(--uva-color-surface, #fff));\n color: ${LINK}; font-size: 0.9375rem; font-weight: 600; line-height: 1.3;\n }\n ${h} .seg-group > button + button { margin-inline-start: -1px; }\n ${h} .seg-group > button:first-child { border-start-start-radius: 0.3rem; border-end-start-radius: 0.3rem; }\n ${h} .seg-group > button:last-child { border-start-end-radius: 0.3rem; border-end-end-radius: 0.3rem; }\n ${h} .compare button.seg[aria-pressed='true'] {\n position: relative; border-color: ${ACCENT}; background: ${ACCENT};\n color: var(--uva-color-on-accent, #fff);\n }\n ${h} .compare button.seg[aria-pressed='true']::before {\n content: ''; box-sizing: border-box; width: 0.375rem; height: 0.75rem;\n margin-inline-end: 0.5rem; border: solid currentColor; border-width: 0 2px 2px 0;\n transform: translateY(-0.0625rem) rotate(45deg);\n }\n ${h} .compare button:hover { border-color: ${LINK}; }\n ${h} .compare button.seg[aria-pressed='true']:hover { border-color: ${ACCENT}; }\n ${h} .compare button.hold[data-held] { background: var(--uva-color-surface-hover, #f1f1f1); }\n ${h} .slider label { font-weight: 600; }\n ${h} .slider input { accent-color: ${ACCENT}; }\n ${h} .slider input:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n ${h} .note { font-size: 0.9375rem; line-height: 1.5; }\n ${h} .stack.framed {\n background: repeating-linear-gradient(135deg, transparent 0 7px, rgb(128 128 128 / 0.2) 7px 9px);\n }\n @media (prefers-reduced-motion: no-preference) {\n ${h} .compare-switch > img.top, ${h} .compare-switch.framed > img { transition: opacity 0.2s ease; }\n }\n @media (forced-colors: active) {\n ${h} .compare button.seg, ${h} .compare button.jump, ${h} .compare button.hold { border-color: ButtonText; }\n ${h} .compare button.seg[aria-pressed='true'] { background: Highlight; color: HighlightText; border-color: Highlight; }\n }\n`;\n\n/** Shadow roots that already have the comparison's sheets. */\nconst styled = new WeakSet<Node>();\n\nfunction install(host: CompareHost): void {\n const root = host.root;\n if (host.light) {\n const opts = { root: root as Document | ShadowRoot, scope: false };\n installLightDomStyles(\n 'uvalib-lightbox::compare-structure',\n unsafeCSS(structure('uvalib-lightbox')),\n opts,\n );\n if (!host.noStyle)\n installLightDomStyles('uvalib-lightbox::compare', unsafeCSS(look('uvalib-lightbox')), opts);\n return;\n }\n if (!(root instanceof ShadowRoot) || styled.has(root)) return;\n styled.add(root);\n const text = structure(':host') + (host.noStyle ? '' : look(':host'));\n const sheet = unsafeCSS(text).styleSheet;\n if (sheet) root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];\n}\n\nlet nextId = 0;\n\n/**\n * The comparison for one lightbox. State: the mode, the version shown (Switch) or compared\n * with the original (Reveal, Fade), and the percentage of it shown. Another version's image\n * is requested the first time it is needed, and drawn (and announced) once it has loaded.\n */\nexport class Compare {\n private list: Version[] = [];\n private slideKey = '';\n private id = '';\n private warned = false;\n private warnedFrame = false;\n private geo: Framing | null = null;\n private baseHref = '';\n /** The mode the visitor (or the address) chose; else the lightbox's `compare`. */\n private chosen: CompareMode | null = null;\n mode: CompareMode = 'switch';\n /** The version compared with the original (Reveal, Fade), from 1. */\n private other = 1;\n /** The percentage of `other` shown (Reveal, Fade). */\n private value = 50;\n /** The version shown (Switch), from 0. */\n private shown = 0;\n private holding = false;\n private requested = new Set<number>();\n private ready = new Set<number>();\n private failed = new Set<number>();\n private message = '';\n private flip = false;\n private pendingAnnounce = false;\n private announceNext = false;\n private settleTimer = 0;\n private settled = '';\n private dragging = false;\n private dragEnd = 0;\n private readonly uid = `uvalib-compare-${++nextId}`;\n\n constructor(private readonly host: CompareHost) {\n install(host);\n }\n\n /** At least two usable versions. */\n get active(): boolean {\n return this.list.length > 1;\n }\n\n /** Follow the open image: a new one starts again (in the current mode); `restore` is the address's value. */\n sync(slide: CompareSlide, index: number, restore: string | null): void {\n const key = `${index}\\n${slide.href}\\n${JSON.stringify(slide.versions)}`;\n if (key !== this.slideKey) {\n this.reset();\n this.slideKey = key;\n this.id = slide.id;\n this.list = this.parse(slide);\n this.geo = framing(this.list);\n this.baseHref = slide.href;\n this.mode =\n this.chosen ??\n (MODES.includes(this.host.mode() as CompareMode)\n ? (this.host.mode() as CompareMode)\n : 'switch');\n this.value = this.mode === 'wipe' ? 50 : 0;\n this.need();\n this.settled = this.encode();\n }\n if (restore != null && this.active) this.restore(restore);\n }\n\n /** Forget the open image (the viewer closed): report a change still settling first. */\n reset(): void {\n // Its event and analytics, but not the address: that is the next image's now.\n if (this.settleTimer) this.settle(false);\n this.slideKey = '';\n this.list = [];\n this.geo = null;\n this.other = 1;\n this.shown = 0;\n this.holding = false;\n this.dragging = false;\n this.requested = new Set();\n this.ready = new Set();\n this.failed = new Set();\n this.message = '';\n this.pendingAnnounce = false;\n }\n\n private parse(slide: CompareSlide): Version[] {\n let raw: unknown = slide.versions;\n let bad = false;\n if (typeof raw === 'string') {\n try {\n raw = JSON.parse(raw);\n } catch {\n raw = null;\n bad = true;\n }\n }\n const out: Version[] = [];\n if (Array.isArray(raw)) {\n raw.forEach((v: unknown, i) => {\n const o = v && typeof v === 'object' ? (v as Record<string, unknown>) : {};\n const label = norm(o.label) || (i === 0 ? 'Original' : '');\n const href = i === 0 ? slide.href : norm(o.href);\n if (label && href && this.host.size(href))\n out.push({ label, href, note: norm(o.note), frame: this.frame(o, i) });\n else if (i === 0) out.length = 0;\n else bad = true;\n });\n } else bad = true;\n if (bad && !this.warned) {\n this.warned = true;\n console.warn(\n 'uvalib-lightbox: data-versions (or the versions callback) has entries without a label or a usable href; they are left out.',\n );\n }\n return out.length > 1 ? out : [];\n }\n\n /**\n * A version's `frame`: the original's box in it, `percent:x,y,w,h`, or pixels\n * (`x,y,w,h` / `pixel:`) of the version's `width` × `height`. Anything else is ignored\n * (the same framing), with one warning.\n */\n private frame(o: Record<string, unknown>, i: number): Box | null {\n if (o.frame == null || o.frame === '') return null;\n const box = i > 0 && typeof o.frame === 'string' ? parseXywh(o.frame) : null;\n const size = (v: unknown) => (typeof v === 'number' || typeof v === 'string' ? Number(v) : 0);\n const w = size(o.width);\n const h = size(o.height);\n if (box?.unit === 'percent') return { x: box.x, y: box.y, w: box.w, h: box.h };\n if (box && w > 0 && h > 0)\n return {\n x: (box.x / w) * 100,\n y: (box.y / h) * 100,\n w: (box.w / w) * 100,\n h: (box.h / h) * 100,\n };\n if (!this.warnedFrame) {\n this.warnedFrame = true;\n console.warn(\n \"uvalib-lightbox: a version has a frame that is not usable (on the first version, not percent:x,y,w,h, or pixels without the version's width and height); it is shown with the original's framing.\",\n );\n }\n return null;\n }\n\n /**\n * The original's natural size, once its image (the one rendered now) has loaded: the framed\n * layout needs it, and is used only from then on (before, the original sizes the stack).\n */\n private natural(): { w: number; h: number } | null {\n if (!this.geo) return null;\n const scope = (this.host.light ? this.host.el : this.host.root) as ParentNode;\n const img = scope.querySelector<HTMLImageElement>('dialog .stack > img:not(.top)');\n if (!img?.complete || !img.naturalWidth || !img.naturalHeight) return null;\n if (img.getAttribute('src') !== this.host.size(this.baseHref)) return null;\n return { w: img.naturalWidth, h: img.naturalHeight };\n }\n\n /** `2`, `switch:2`, `wipe:40`, `fade:60`, `wipe:40:2` (the version compared, from 1). */\n private restore(param: string): void {\n const m = /^(?:(switch|wipe|fade):)?(\\d{1,3})(?::(\\d{1,3}))?$/.exec(param.trim().toLowerCase());\n if (!m) return;\n const mode = (m[1] ?? 'switch') as CompareMode;\n const n = Number(m[2]);\n if (mode === 'switch') {\n if (n >= this.list.length) return;\n this.shown = n;\n } else {\n const other = m[3] ? Number(m[3]) : 1;\n this.other = other >= 1 && other < this.list.length ? other : 1;\n this.value = clamp(n);\n }\n this.mode = this.chosen = mode;\n this.need();\n this.settled = this.encode();\n }\n\n private encode(): string {\n if (this.mode === 'switch') return String(this.shown);\n return `${this.mode}:${this.value}${this.other !== 1 ? `:${this.other}` : ''}`;\n }\n\n /** The version over the original: shown (Switch) or compared (Reveal, Fade). */\n private get top(): number {\n return this.mode === 'switch' ? this.shown : this.other;\n }\n\n /** The percentage of the top version asked for. */\n private get amount(): number {\n if (this.holding) return 0;\n if (this.mode === 'switch') return this.shown > 0 ? 100 : 0;\n return this.value;\n }\n\n /** The percentage of it on screen: none until its image has loaded. */\n private get seen(): number {\n return this.top > 0 && this.ready.has(this.top) ? this.amount : 0;\n }\n\n private label(i: number): string {\n return this.list[i]?.label ?? '';\n }\n\n /** Request the top version's image the first time it is needed. */\n private need(): void {\n if (this.amount > 0 && this.top > 0) this.requested.add(this.top);\n }\n\n // ------------------------------------------------------------ changes\n\n private set(v: number, announce: boolean): void {\n const next = clamp(v);\n if (next === this.value) return;\n this.value = next;\n this.need();\n this.host.update();\n this.announceNext ||= announce;\n window.clearTimeout(this.settleTimer);\n this.settleTimer = window.setTimeout(() => this.settle(), compareTiming.settle);\n }\n\n private change(fn: () => void): void {\n fn();\n this.need();\n this.host.update();\n this.announceNext = true;\n this.settle();\n }\n\n /** A visitor's change has settled: the event, analytics, the address and the announcement. */\n private settle(write = true): void {\n window.clearTimeout(this.settleTimer);\n this.settleTimer = 0;\n const state = this.encode();\n const announce = this.announceNext;\n this.announceNext = false;\n if (state === this.settled || !this.active) return;\n this.settled = state;\n const index = this.top;\n const el = this.host.el;\n el.dispatchEvent(\n new CustomEvent('uvalib-lightbox-version', {\n detail: {\n id: this.id,\n mode: this.mode,\n index,\n value: this.mode === 'switch' ? null : this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n trackEvent(el, ['uvalib-lightbox', 'compare', this.mode, index + 1]);\n if (!write) return;\n this.host.write(state);\n if (!announce) return;\n if (this.amount > 0 && !this.ready.has(this.top)) this.pendingAnnounce = true;\n else this.say(this.stateText());\n }\n\n private say(text: string): void {\n this.pendingAnnounce = false;\n // A repeated message is still a change, so it is read again.\n this.flip = !this.flip;\n this.message = text + (this.flip ? ' ' : '');\n this.host.update();\n }\n\n private stateText(): string {\n const a = this.amount;\n if (a <= 0) return `${this.label(0)} shown`;\n if (a >= 100) return `${this.label(this.top)} shown`;\n return `${a}% ${this.label(this.top)}`;\n }\n\n private setMode(mode: CompareMode): void {\n if (mode === this.mode) return;\n this.change(() => {\n if (mode === 'switch') this.shown = this.value >= 50 ? this.other : 0;\n else if (this.mode === 'switch') {\n if (this.shown > 0) this.other = this.shown;\n this.value = mode === 'wipe' ? 50 : this.shown > 0 ? 100 : 0;\n }\n this.mode = this.chosen = mode;\n });\n }\n\n private hold(on: boolean): void {\n if (on === this.holding) return;\n this.holding = on;\n this.host.update();\n }\n\n private loaded(i: number): void {\n this.ready.add(i);\n this.host.update();\n if (this.pendingAnnounce && i === this.top) this.say(this.stateText());\n }\n\n private errored(i: number): void {\n this.failed.add(i);\n this.pendingAnnounce = false;\n this.say(`${this.label(i)} could not be loaded.`);\n }\n\n // ------------------------------------------------------------ input\n\n /** The `o` key held anywhere in the dialog shows the original. True when handled. */\n key(e: KeyboardEvent): boolean {\n if (!this.active || (e.key !== 'o' && e.key !== 'O') || e.altKey || e.ctrlKey || e.metaKey)\n return false;\n this.hold(e.type === 'keydown');\n return true;\n }\n\n /** A press on the photo in Reveal moves the divider there; a drag keeps moving it. */\n pointer(e: PointerEvent): void {\n if (!this.active || this.mode !== 'wipe') return;\n const stack = e.currentTarget as HTMLElement;\n if (e.type === 'pointerdown') {\n if (e.button !== 0 || !e.isPrimary) return;\n this.dragging = true;\n try {\n stack.setPointerCapture(e.pointerId);\n } catch {\n // A synthetic pointer cannot be captured; the press still moves the divider.\n }\n e.preventDefault();\n } else if (e.type !== 'pointermove') {\n if (this.dragging) this.dragEnd = performance.now();\n this.dragging = false;\n return;\n }\n if (!this.dragging) return;\n const r = stack.getBoundingClientRect();\n if (!r.width) return;\n const rtl = getComputedStyle(stack).direction === 'rtl';\n this.set(((rtl ? r.right - e.clientX : e.clientX - r.left) / r.width) * 100, true);\n }\n\n /** A drag that ended outside the photo must not count as a click on the backdrop. */\n dragged(): boolean {\n return this.dragging || performance.now() - this.dragEnd < 100;\n }\n\n private readonly onInput = (e: Event): void => {\n this.set(Number((e.target as HTMLInputElement).value), false);\n };\n\n /** Shift with an arrow, and Page Up / Page Down, move 10%. */\n private readonly onSliderKey = (e: KeyboardEvent): void => {\n const rtl = getComputedStyle(e.target as Element).direction === 'rtl';\n const k = e.key;\n let d = 0;\n if (k === 'PageUp') d = 10;\n else if (k === 'PageDown') d = -10;\n else if (e.shiftKey && (k === 'ArrowUp' || k === 'ArrowDown')) d = k === 'ArrowUp' ? 10 : -10;\n else if (e.shiftKey && (k === 'ArrowLeft' || k === 'ArrowRight'))\n d = (k === 'ArrowRight') !== rtl ? 10 : -10;\n if (!d) return;\n e.preventDefault();\n this.set(this.value + d, false);\n };\n\n private readonly onHold = (e: Event): void => {\n const t = e.type;\n if (t === 'keydown' || t === 'keyup') {\n const k = (e as KeyboardEvent).key;\n if (k !== ' ' && k !== 'Enter') return;\n this.hold(t === 'keydown');\n } else this.hold(t === 'pointerdown');\n };\n\n // ------------------------------------------------------------ render\n\n /** The image's accessible name ends with what is on screen. */\n alt(base: string): string {\n const a = this.seen;\n const l0 = this.label(0);\n const lk = this.label(this.top);\n const what =\n a <= 0\n ? l0\n : a >= 100\n ? lk\n : `${l0} and ${lk}, ${this.mode === 'wipe' ? 'compared side by side' : 'blended'}`;\n return `${base} (${what})`;\n }\n\n get stackClass(): string {\n const geo = this.natural() ? this.geo : null;\n if (!geo) return `compare-${this.mode}`;\n const on = this.seen > 0;\n // Switch: a version that does not cover the whole original (a crop) hides it.\n const hide = this.mode === 'switch' && on && this.seen >= 100 && !geo.covers[this.top];\n return `compare-${this.mode} framed${on ? ' top-on' : ''}${hide ? ' hide-base' : ''}`;\n }\n\n get stackStyle(): string {\n const a = this.mode === 'switch' ? 100 : this.value;\n const base = `--uvalib-compare: ${a}%; --uvalib-compare-opacity: ${a / 100}`;\n const geo = this.natural() ? this.geo : null;\n return geo ? `${base}; --uvalib-compare-n: ${a}; ${place(geo.boxes[0]!)}` : base;\n }\n\n /**\n * With a different framing, where the outlines of regions go: the original's box in the\n * stack, as `<uvalib-image-regions>`'s overlay inset. Empty otherwise.\n */\n get regionsStyle(): string {\n const geo = this.natural() ? this.geo : null;\n if (!geo) return '';\n const b = geo.boxes[0]!;\n return `--uvalib-image-regions-inset: ${r4(b.y)}% ${r4(100 - b.x - b.w)}% ${r4(100 - b.y - b.h)}% ${r4(b.x)}%`;\n }\n\n /** The other versions' images (each requested on first use), the divider and the side labels. */\n layers() {\n const top = this.top;\n const on = this.seen > 0;\n const size = this.natural();\n const geo = size ? this.geo : null;\n // The stack's size, reserved from the frames and the original: a canvas of the whole box\n // at the original's scale (never drawn on), sized like the image it stands for.\n const sizer =\n geo && size\n ? (() => {\n const w = size.w * geo.uw;\n const h = size.h * geo.uh;\n const k = Math.min(1, MAX_SIDE / Math.max(w, h));\n return html`<canvas\n class=\"frame-box\"\n aria-hidden=\"true\"\n width=${Math.max(1, Math.round(w * k))}\n height=${Math.max(1, Math.round(h * k))}\n ></canvas>`;\n })()\n : nothing;\n const layers = this.list.map((v, i) =>\n i === 0\n ? nothing\n : html`<img\n class=\"top ${i === top && on ? 'on' : ''}\"\n style=${geo && v.frame ? place(geo.boxes[i]!) : nothing}\n data-version=${i}\n alt=\"\"\n decoding=\"async\"\n draggable=\"false\"\n src=${this.requested.has(i) ? this.host.size(v.href) : nothing}\n @load=${() => this.loaded(i)}\n @error=${() => this.errored(i)}\n />`,\n );\n if (this.mode !== 'wipe') return html`${sizer}${layers}`;\n const a = this.seen;\n return html`${sizer}${layers}\n <div class=\"divider\" aria-hidden=\"true\"><span class=\"handle\"></span></div>\n <span class=\"side side-start\" aria-hidden=\"true\" ?hidden=${a <= 0}>${this.label(top)}</span>\n <span class=\"side side-end\" aria-hidden=\"true\" ?hidden=${a >= 100}>${this.label(0)}</span>`;\n }\n\n /** Notes of the versions on screen, then the controls. `slot` puts them under regions' image. */\n controls(slot: string) {\n const a = this.seen;\n const top = this.top;\n // Every note keeps its line (hidden while its version is not on screen), so showing\n // another version never moves the photo or the controls.\n const visible = (i: number) => (i === 0 ? a < 100 : i === top && a > 0);\n const notes = this.list.map((v, i) =>\n v.note\n ? html`<p class=\"note\" ?data-off=${!visible(i)}><strong>${v.label}:</strong> ${v.note}</p>`\n : nothing,\n );\n const failed =\n this.failed.has(top) && this.amount > 0\n ? html`<p class=\"note\">${this.label(top)} could not be loaded.</p>`\n : nothing;\n const seg = (pressed: boolean, text: string, onClick: () => void) =>\n html`<button\n type=\"button\"\n class=\"seg\"\n aria-pressed=${pressed ? 'true' : 'false'}\n @click=${onClick}\n >\n ${text}\n </button>`;\n const l0 = this.label(0);\n const lk = this.label(this.other);\n // Both panels are always drawn, in one grid cell: the row is as tall as the taller one,\n // so changing mode never moves the photo (the dialog re-centres on any height change).\n // The other panel is inert and hidden, out of the tab order and the accessibility tree.\n const switching = this.mode === 'switch';\n const panel = (on: boolean, body: unknown) =>\n html`<div class=\"mode-panel\" ?inert=${!on} ?data-off=${!on}>${body}</div>`;\n const switchPanel = html`<div class=\"seg-group\" role=\"group\" aria-label=\"Version shown\">\n ${this.list.map((v, i) =>\n seg(this.shown === i, v.label, () => this.change(() => (this.shown = i))),\n )}\n </div>`;\n const sliding = html`${\n this.list.length > 2\n ? html`<div class=\"seg-group\" role=\"group\" aria-label=\"Compare ${l0} with\">\n ${this.list.map((v, i) =>\n i\n ? seg(this.other === i, v.label, () => this.change(() => (this.other = i)))\n : nothing,\n )}\n </div>`\n : nothing\n }\n <div class=\"slider\">\n <label for=${this.uid}>${this.mode === 'fade' ? 'Fade to' : 'Reveal'} ${lk}</label>\n <input\n id=${this.uid}\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n .value=${String(this.value)}\n aria-valuetext=\"${this.value}% ${lk}\"\n @input=${this.onInput}\n @keydown=${this.onSliderKey}\n />\n </div>\n <div class=\"seg-group\" role=\"group\" aria-label=\"Jump to\">\n ${[\n [0, l0],\n [50, '50/50'],\n [100, lk],\n ].map(\n ([v, text]) =>\n html`<button\n type=\"button\"\n class=\"jump\"\n @click=${() => this.change(() => (this.value = v as number))}\n >\n ${text}\n </button>`,\n )}\n </div>\n <button\n type=\"button\"\n class=\"hold\"\n aria-keyshortcuts=\"O\"\n ?data-held=${this.holding}\n @pointerdown=${this.onHold}\n @pointerup=${this.onHold}\n @pointerleave=${this.onHold}\n @pointercancel=${this.onHold}\n @keydown=${this.onHold}\n @keyup=${this.onHold}\n @blur=${() => this.hold(false)}\n @contextmenu=${(e: Event) => e.preventDefault()}\n >\n Hold for ${l0}\n </button>`;\n return html`<div class=\"compare\" part=\"compare\" slot=${slot || nothing}>\n ${notes}${failed}\n <div class=\"compare-bar\">\n <div class=\"seg-group\" role=\"group\" aria-label=\"Compare versions\">\n ${MODES.map((m) => seg(this.mode === m, MODE_NAMES[m], () => this.setMode(m)))}\n </div>\n <div class=\"mode-panels\">${panel(switching, switchPanel)}${panel(!switching, sliding)}</div>\n </div>\n <p class=\"visually-hidden\" role=\"status\">${this.message}</p>\n </div>`;\n }\n\n /**\n * Full size, in every mode: the original and the version shown (Switch) or compared (Reveal,\n * Fade), each named. The same two links in every mode keep the toolbar's height, so changing\n * mode never moves the photo; and a visitor can always open the original at full size.\n */\n full(): { href: string; label: string }[] {\n const k = this.mode === 'switch' ? this.shown || this.other : this.other;\n return [0, k].map((i) => ({ href: this.list[i]!.href, label: this.label(i) }));\n }\n}\n"],"mappings":";;;;AAYA,IAAMO,IAAuB;CAAC;CAAU;CAAQ;AAAM,GAChDC,IAA0C;CAC9C,QAAQ;CACR,MAAM;CACN,MAAM;AACR,GAGaC,IAAgB,EAAE,QAAQ,IAAI,GA+BrCC,IAAW;AAEjB,SAASC,EAAQ,GAAiC;CAChD,IAAI,CAACC,EAAK,MAAM,MAAMC,EAAE,KAAK,GAAG,OAAO;CAEvC,IAAMC,IAAMF,EAAK,KAAK,EAAE,OAAOG,QAC7BA,IAAI;EAAE,GAAG,CAACA,EAAE,IAAIA,EAAE;EAAG,GAAG,CAACA,EAAE,IAAIA,EAAE;EAAG,GAAG,MAAMA,EAAE;EAAG,GAAG,MAAMA,EAAE;CAAE,IAAI;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAE,CAC9F,GACMC,IAAK,KAAK,IAAI,GAAGF,EAAI,KAAK,MAAM,EAAE,CAAC,CAAC,GACpCG,IA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EAAG;;EAElB,OAAO,CAAI,4CAA4CmB,KAAQ1F,EAAQ;QACnEgF,IAAQC,EAAO;;;YAGX3E,EAAM,KAAK,MAAM4E,EAAI,KAAK,SAASxB,GAAGnD,EAAWmD,UAAU,KAAK,QAAQA,CAAC,CAAC,CAAC,EAAE;;mCAEtD4B,EAAMD,GAAWG,CAAW,IAAIF,EAAM,CAACD,GAAWI,CAAO,EAAE;;iDAE7C,KAAK,QAAQ;;CAE5D;CAOA,OAA0C;EAExC,OAAO,CAAC,GADE,KAAK,SAAS,YAAW,KAAK,SAAS,KAAK,KAC1C,CAAC,CAAC,KAAK,OAAO;GAAE,MAAM,KAAK,KAAKnC,EAAE,CAAE;GAAM,OAAO,KAAK,MAAMA,CAAC;EAAE,EAAE;CAC/E;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hours-data-Bw6vkIw7.js","names":["fetchJsonWith","fetchJson$1","formatter","hoursEndpoints","hoursTiming","setHoursEndpoints","key","value","from","globalApplied","endpoints","fetchJson","url","orUndefined","v","parseLibraries","data","json","n","a","calId","uri","siteLink","node","librariesCache","loadLibraries","p","promise","hoursCache","HOURS_CACHE_MAX","loadHours","sorted","ids","b","to","hit","maxAge","out","c","lid","entry","sortLibraries","rank","l","libs","utc","y","m","d","iso","date","addDays","days","weekStart","fmt","options","longDate","shortDate","shortWeekday","fullDate","headingDate","weekHeadingDate","formatTime","time","ampm","formatDay","day","h","ALLOWED","DROPPED","SAFE_PROTOCOLS","safeHref","href","base","copyAllowed","doc","name","el","sanitizeHoursHtml","parsed","html"],"sources":["../../src/components/library-hours/hours-data.ts"],"sourcesContent":["// Shared data and formatting for the library-hours components. Internal: not exported from\n// the package entry (only the LibraryInfo and DayHours types are). No side effects on import.\n\nimport { fetchJson as fetchJsonWith } from '../../data/fetch-json.js';\nimport { TIME_ZONE, formatter, todayInNewYork } from '../../data/new-york.js';\n\n/** One day's hours from LibCal: a status and, when open, one or more ranges. */\nexport interface DayHours {\n /** `open`, `closed`, `24hours`, or another LibCal status, shown as is. */\n status: string;\n /** Opening ranges, LibCal's own text (`9:00am` to `12:00am`); `to` may be past midnight. */\n hours?: { from: string; to: string }[];\n}\n\n/** A library (or a space inside one) from the Drupal JSON:API, reduced to the fields used. */\nexport interface LibraryInfo {\n /** Drupal node UUID. */\n id: string;\n title: string;\n shortTitle?: string;\n slug?: string;\n /** LibCal calendar id. */\n calId?: number;\n /** `Library`, `space` or `other-professional`. */\n placeType?: string;\n priorityPlacement?: number;\n /** Site link, with Drupal's `internal:` prefix removed (other schemes are kept as is). */\n siteLink?: string;\n /** Drupal's processed `field_hours_information` HTML. Sanitise before display. */\n hoursInformation?: string;\n /** Parent library's node UUID. */\n parent?: string;\n}\n\n/** Hours per LibCal calendar id, each a map of `YYYY-MM-DD` to that day's hours. */\nexport type HoursByCalendar = Map<number, Record<string, DayHours>>;\n\n/** The two data URLs. */\nexport interface HoursEndpoints {\n /** The Drupal JSON:API library list (relative by default: same origin, no CORS). */\n libraries: string;\n /** LibCal hours, with `{ids}` for the comma-separated calendar ids; `from` / `to` are appended. */\n hours: string;\n}\n\n/**\n * Where the data comes from, shared by every hours element (and exposed to pages as the\n * elements' static `endpoints`). The LibCal key is LibCal's public client widget key\n * (already public in the live bundles). A page can also set `window.uvalibHoursEndpoints`\n * (`{ libraries?, hours? }`) before the elements' script runs; it is merged in at the\n * first fetch. Requests are cached by URL, so a change applies to the next load.\n */\nexport const hoursEndpoints: HoursEndpoints = {\n libraries: '/jsonapi/index/default_index?filter[type]=library&page[limit]=100',\n hours:\n 'https://cal.lib.virginia.edu/api/1.0/hours/{ids}?iid=863&key=e4b27d40b7099e8e392113da2f8bf30a',\n};\n\n/**\n * Fetch attempts, the delay between them (ms), each attempt's timeout (ms), and how often\n * elements check the date (ms).\n */\nexport const hoursTiming = { retries: 3, retryDelay: 1000, timeout: 10_000, tick: 60_000 };\n\ndeclare global {\n interface Window {\n /** Optional endpoint overrides for the library-hours elements, read at their first fetch. */\n uvalibHoursEndpoints?: Partial<HoursEndpoints>;\n }\n}\n\n/** Copy the known endpoint keys (strings only) from `from` into the shared endpoints. */\nexport function setHoursEndpoints(from: Partial<HoursEndpoints> | null | undefined): void {\n for (const key of ['libraries', 'hours'] as const) {\n const value = from?.[key];\n if (typeof value === 'string' && value) hoursEndpoints[key] = value;\n }\n}\n\nlet globalApplied = false;\n/** The endpoints to use now: the page's `window.uvalibHoursEndpoints` is merged in once. */\nfunction endpoints(): HoursEndpoints {\n if (!globalApplied) {\n globalApplied = true;\n setHoursEndpoints(globalThis.window?.uvalibHoursEndpoints);\n }\n return hoursEndpoints;\n}\n\nexport { TIME_ZONE, todayInNewYork };\n\n// --- fetching -------------------------------------------------------------------------\n\nconst fetchJson = (url: string) => fetchJsonWith(url, hoursTiming);\n\ninterface RawLibrary {\n id: string;\n attributes: {\n title: string;\n field_short_title?: string | null;\n field_slug?: string | null;\n field_libcal_id?: string | number | null;\n field_type_basic?: string | null;\n field_priority_placement?: number | null;\n field_library_site_link?: { uri?: string } | null;\n field_hours_information?: { processed?: string } | null;\n };\n relationships?: { field_parent?: { data?: { id?: string } | null } };\n}\n\nconst orUndefined = <T>(v: T | null | undefined): T | undefined => v ?? undefined;\n\n/** Reduce a JSON:API response to LibraryInfo, in response order. */\nexport function parseLibraries(json: unknown): LibraryInfo[] {\n const data = (json as { data?: RawLibrary[] } | null)?.data;\n if (!Array.isArray(data)) return [];\n return data\n .filter((n) => n?.id && n.attributes?.title)\n .map((n) => {\n const a = n.attributes;\n const calId = parseInt(String(a.field_libcal_id ?? ''), 10);\n const uri = a.field_library_site_link?.uri;\n return {\n id: n.id,\n title: a.title,\n shortTitle: orUndefined(a.field_short_title),\n slug: orUndefined(a.field_slug),\n calId: Number.isNaN(calId) ? undefined : calId,\n placeType: orUndefined(a.field_type_basic),\n priorityPlacement: orUndefined(a.field_priority_placement),\n siteLink: siteLink(uri),\n hoursInformation: orUndefined(a.field_hours_information?.processed),\n parent: orUndefined(n.relationships?.field_parent?.data?.id),\n };\n });\n}\n\n/**\n * A Drupal link field as an href: `internal:/rmc/` becomes `/rmc/` and `entity:node/807`\n * becomes `/node/807` (Drupal redirects it to the page's alias). Other `entity:` links have\n * no URL outside Drupal, so they are dropped.\n */\nfunction siteLink(uri: string | undefined): string | undefined {\n if (!uri) return undefined;\n if (uri.startsWith('internal:')) return uri.slice('internal:'.length) || undefined;\n const node = /^entity:node\\/(\\d+)$/.exec(uri);\n if (node) return `/node/${node[1]}`;\n return uri.startsWith('entity:') ? undefined : uri;\n}\n\nconst librariesCache = new Map<string, Promise<LibraryInfo[]>>();\n\n/** The library list, fetched once per page (per URL) and shared. A failure is not cached. */\nexport function loadLibraries(): Promise<LibraryInfo[]> {\n const url = endpoints().libraries;\n let p = librariesCache.get(url);\n if (!p) {\n const promise = fetchJson(url).then(parseLibraries);\n librariesCache.set(url, (p = promise));\n promise.catch(() => {\n if (librariesCache.get(url) === promise) librariesCache.delete(url);\n });\n }\n return p;\n}\n\ninterface CacheEntry {\n at: number;\n promise: Promise<HoursByCalendar>;\n}\nconst hoursCache = new Map<string, CacheEntry>();\nconst HOURS_CACHE_MAX = 50;\n\n/**\n * Hours for LibCal calendars `ids` from `from` to `to` (inclusive, `YYYY-MM-DD`, at most\n * 100 days). Identical requests share one fetch; a cached result older than `maxAge` ms is\n * fetched again. A failure is not cached.\n */\nexport function loadHours(\n ids: number[],\n from: string,\n to: string,\n maxAge = Infinity,\n): Promise<HoursByCalendar> {\n const sorted = [...new Set(ids)].sort((a, b) => a - b);\n if (!sorted.length) return Promise.resolve(new Map());\n const url =\n endpoints().hours.replace('{ids}', sorted.join(',')) +\n `&from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}`;\n const key = url;\n const hit = hoursCache.get(key);\n if (hit && performance.now() - hit.at <= maxAge) return hit.promise;\n const promise = fetchJson(url).then((json) => {\n const out: HoursByCalendar = new Map();\n if (Array.isArray(json)) {\n for (const c of json as { lid?: unknown; dates?: unknown }[]) {\n const lid = Number(c?.lid);\n if (Number.isFinite(lid) && c.dates && typeof c.dates === 'object')\n out.set(lid, c.dates as Record<string, DayHours>);\n }\n }\n return out;\n });\n const entry = { at: performance.now(), promise };\n hoursCache.delete(key);\n hoursCache.set(key, entry);\n if (hoursCache.size > HOURS_CACHE_MAX) hoursCache.delete(hoursCache.keys().next().value!);\n promise.catch(() => {\n if (hoursCache.get(key) === entry) hoursCache.delete(key);\n });\n return promise;\n}\n\n/** Forget the cached library list and hours (for tests). */\nexport function resetHoursCache(): void {\n librariesCache.clear();\n hoursCache.clear();\n globalApplied = false;\n}\n\n/** Libraries by priority placement (missing last), then title. Returns a new array. */\nexport function sortLibraries(libs: readonly LibraryInfo[]): LibraryInfo[] {\n const rank = (l: LibraryInfo) => l.priorityPlacement || Infinity;\n return [...libs].sort((a, b) => rank(a) - rank(b) || a.title.localeCompare(b.title));\n}\n\n// --- dates: all arithmetic on YYYY-MM-DD strings, in UTC -------------------------------\n\nconst utc = (iso: string): Date => {\n const [y, m, d] = iso.split('-').map(Number) as [number, number, number];\n return new Date(Date.UTC(y, m - 1, d));\n};\nconst iso = (date: Date): string => date.toISOString().slice(0, 10);\n\nexport function addDays(date: string, days: number): string {\n const d = utc(date);\n d.setUTCDate(d.getUTCDate() + days);\n return iso(d);\n}\n\n/** The Sunday on or before `date`. */\nexport function weekStart(date: string): string {\n return addDays(date, -utc(date).getUTCDay());\n}\n\nconst fmt = (key: string, options: Intl.DateTimeFormatOptions) => (date: string) =>\n formatter(key, { ...options, timeZone: 'UTC' }).format(utc(date));\n\n/** \"Monday, November 9\" */\nexport const longDate = fmt('long', { weekday: 'long', month: 'long', day: 'numeric' });\n/** \"Nov 9\" */\nexport const shortDate = fmt('short', { month: 'short', day: 'numeric' });\n/** \"Mon\" */\nexport const shortWeekday = fmt('weekday', { weekday: 'short' });\n/** \"Saturday, November 14, 2026\" */\nexport const fullDate = fmt('full', {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n});\nconst headingDate = fmt('heading', { year: 'numeric', month: 'short', day: '2-digit' });\n/** \"Nov 08. 2026\": the live week heading's format, kept because Drupal's /hours shows it. */\nexport const weekHeadingDate = (date: string): string => headingDate(date).replace(',', '.');\n\n// --- hours text ----------------------------------------------------------------------\n\n/** `9:00am` → `9am`, `5:30pm` → `5:30pm`; anything else unchanged. */\nexport function formatTime(time: string): string {\n const m = /^(\\d+):(\\d+)\\s*(am|pm)$/i.exec(time.trim());\n if (!m) return time;\n const ampm = m[3]!.toLowerCase();\n return m[2] === '00' ? `${m[1]}${ampm}` : `${m[1]}:${m[2]}${ampm}`;\n}\n\n/** A day's hours as text: `9am - 6pm` (ranges joined by commas), `24 Hours`, `closed`, or ''. */\nexport function formatDay(day: DayHours | undefined): string {\n if (!day) return '';\n if (Array.isArray(day.hours) && day.hours.length)\n return day.hours.map((h) => `${formatTime(h.from)} - ${formatTime(h.to)}`).join(', ');\n return (day.status ?? '').replace('24hours', '24 Hours').replace('ByApp', 'By Appt').trim();\n}\n\n// --- HTML from Drupal ----------------------------------------------------------------\n\nconst ALLOWED = new Set(['a', 'p', 'br', 'strong', 'em']);\n/** Dropped with their content; any other element is unwrapped (its content kept). */\nconst DROPPED = new Set([\n 'script',\n 'style',\n 'template',\n 'iframe',\n 'object',\n 'embed',\n 'noscript',\n 'svg',\n 'math',\n 'title',\n 'textarea',\n 'select',\n 'img',\n 'video',\n 'audio',\n 'head',\n]);\nconst SAFE_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nfunction safeHref(href: string, base: string): boolean {\n try {\n return SAFE_PROTOCOLS.has(new URL(href, base).protocol);\n } catch {\n return false;\n }\n}\n\nfunction copyAllowed(from: Node, to: Node, doc: Document): void {\n for (const node of from.childNodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n to.appendChild(doc.createTextNode((node as Text).data));\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n const name = (node as Element).localName;\n if (ALLOWED.has(name)) {\n const el = doc.createElement(name);\n const href = (node as Element).getAttribute('href');\n if (name === 'a' && href && safeHref(href, doc.baseURI)) el.setAttribute('href', href);\n copyAllowed(node, el, doc);\n to.appendChild(el);\n } else if (!DROPPED.has(name)) {\n copyAllowed(node, to, doc);\n }\n }\n }\n}\n\n/**\n * Drupal's hours HTML reduced to an allowlist (`a[href]` with an http(s), mailto, tel or\n * relative URL, `p`, `br`, `strong`, `em`), as new nodes owned by `doc`. It is parsed in an\n * inert document, so nothing in it runs or loads. The same walk is used in every browser\n * (rather than `setHTML` where available) so the output never differs between browsers.\n */\nexport function sanitizeHoursHtml(html: string, doc: Document = document): DocumentFragment {\n const out = doc.createDocumentFragment();\n let parsed: Document;\n try {\n parsed = new DOMParser().parseFromString(html, 'text/html');\n } catch {\n // For example a page enforcing Trusted Types: fall back to the text alone.\n out.append(doc.createTextNode(html.replace(/<[^>]*>/g, '')));\n return out;\n }\n copyAllowed(parsed.body, out, doc);\n return out;\n}\n"],"mappings":";;;AAoDA,IAAaG,IAAiC;CAC5C,WAAW;CACX,OACE;AACJ,GAMaC,IAAc;CAAE,SAAS;CAAG,YAAY;CAAM,SAAS;CAAQ,MAAM;AAAO;AAUzF,SAAgBC,EAAkB,GAAwD;CACxF,KAAK,IAAMC,KAAO,CAAC,aAAa,OAAO,GAAY;EACjD,IAAMC,IAAQC,IAAOF;EACrB,AAAI,OAAOC,KAAU,YAAYA,MAAO,EAAeD,KAAOC;CAChE;AACF;AAEA,IAAIE,IAAgB;AAEpB,SAASC,IAA4B;CAKnC,OAJKD,MACH,IAAgB,IAChBJ,EAAkB,WAAW,QAAQ,oBAAoB,IAEpDF;AACT;AAMA,IAAMQ,KAAa,MAAgBX,EAAcY,GAAKR,CAAW,GAiB3DS,KAAkB,MAA2CC,KAAK,KAAA;AAGxE,SAAgBC,EAAe,GAA8B;CAC3D,IAAMC,IAAQC,GAAyC;CAEvD,OADK,MAAM,QAAQD,CAAI,IAChBA,EACJ,QAAQ,MAAME,GAAG,MAAMA,EAAE,YAAY,KAAK,CAAC,CAC3C,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cC,CAAI,GAC3BJ,IAAQjD,EAAiB,aAAa,MAAM;GAGlD,AAFIqD,MAAS,OAAOJ,KAAQD,EAASC,GAAMG,EAAI,OAAO,KAAGE,EAAG,aAAa,QAAQL,CAAI,GACrFE,EAAYnD,GAAMsD,GAAIF,CAAG,GACzBzC,EAAG,YAAY2C,CAAE;EACnB,OAAO,AAAKR,EAAQ,IAAIO,CAAI,KAC1BF,EAAYnD,GAAMW,GAAIyC,CAAG;CAE7B;AAEJ;AAQA,SAAgBG,EAAkB,GAAc,IAAgB,UAA4B;CAC1F,IAAMzC,IAAMsC,EAAI,uBAAuB,GACnCI;CACJ,IAAI;EACF,IAAS,IAAI,UAAU,CAAC,CAAC,gBAAgBC,GAAM,WAAW;CAC5D,QAAQ;EAGN,OADA3C,EAAI,OAAOsC,EAAI,eAAeK,EAAK,QAAQ,YAAY,EAAE,CAAC,CAAC,GACpD3C;CACT;CAEA,OADAqC,EAAYK,EAAO,MAAM1C,GAAKsC,CAAG,GAC1BtC;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"library-weekly-hours-CrV3TlP5.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","trackError","precedingHeadingLevel","accessible","todayInNewYork","hoursTiming","longDate","shortDate","shortWeekday","weekStart","hoursEndpoints","weekHeadingDate","formatDay","loadHours","fullDate","loadLibraries","addDays","setHoursEndpoints","instanceCounter","structuralRules","host","shadowStructure","LibraryWeeklyHours","_args","value","root","sheet","above","node","today","every","start","changed","id","announce","slug","days","background","libraries","library","l","spaces","ids","hours","maxAge","sameWeek","hadFocus","active","day","dates","calId","text","A","lib","cells","building","space","view","level","headingId","tableDays"],"sources":["../../src/components/library-weekly-hours/LibraryWeeklyHours.ts","../../src/components/library-weekly-hours/library-weekly-hours.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackError, trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport {\n addDays,\n formatDay,\n fullDate,\n hoursEndpoints,\n hoursTiming,\n setHoursEndpoints,\n loadHours,\n loadLibraries,\n longDate,\n shortDate,\n shortWeekday,\n todayInNewYork,\n weekHeadingDate,\n weekStart,\n type HoursByCalendar,\n type HoursEndpoints,\n type LibraryInfo,\n} from '../library-hours/hours-data.js';\n\n/** Element ids share the document id space in light DOM, so each instance gets its own prefix. */\nlet instanceCounter = 0;\n\n/** What the table shows: one week's data, kept on screen while the next week loads. */\ninterface WeekView {\n days: string[];\n library: LibraryInfo;\n spaces: LibraryInfo[];\n hours: HoursByCalendar;\n}\n\n/** `loading` until the first data arrives, then `ready`, or `error` when it cannot be loaded. */\nexport type HoursState = 'loading' | 'ready' | 'error';\n\n/**\n * The layout rules the week header and table need even with `no-style`: Drupal's /hours CSS\n * relies on them. `host` is `:host` (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host}[loading] { min-height: var(--library-weekly-hours-min-height, 0); }\n ${host} .hours-placeholder { visibility: hidden; }\n /* One line even when empty, so \"Loading hours…\" giving way to nothing moves nothing below. */\n ${host} .weekly-hours-status { min-height: 1.5em; min-height: 1lh; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .weekly-hours-header-section {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n text-align: center;\n }\n ${host} .weekly-hours-header-section div[role='heading'] { flex: 1; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/**\n * One library's opening hours for a week (Sunday to Saturday, in America/New_York): a\n * header with \"Previous week\" / \"Next week\" buttons and the date range, then a table with a\n * \"Building hours\" row and a row per space in the library. Data comes from the library\n * website's JSON:API (same origin) and LibCal, shared between all hours elements on a page.\n * Used on library.virginia.edu/hours through `<library-hours-setup>`.\n *\n * @tagname library-weekly-hours\n * @fires uvalib-analytics-event - For `<site-analytics>`: `['library-weekly-hours', 'week-change', 'next' | 'previous']` for the week buttons, and `['library-weekly-hours', 'error', 'hours-load']` once when the hours cannot be loaded. Bubbles and is composed.\n * @csspart building-hours - The \"Building hours\" table row (shadow mode).\n * @cssprop [--library-weekly-hours-min-height=0] - Height the element keeps during its first load (while it has the `loading` attribute, before any rows show), so content below does not jump when the hours arrive. Applies with `no-style` too. Pages can reserve the same height before the element upgrades with `library-weekly-hours:not(:defined) { display: block; min-height: … }`.\n * @cssprop [--uva-brand-orange=#e57200] - Border of today's column; focus ring colour.\n * @cssprop [--uva-brand-blue=#232d4b] - Header and button colour.\n * @cssprop --uva-color-border - Dark-mode role token: table cell borders (else #dadada).\n * @cssprop --uva-color-current - Dark-mode role token: today's column border (else `--uva-brand-orange`).\n * @cssprop --uva-color-link - Dark-mode role token: heading, button text and border (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: button background (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class LibraryWeeklyHours extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin-block: 1rem;\n }\n th,\n td {\n padding: 0.5rem;\n border: 1px solid var(--uva-color-border, #dadada);\n text-align: center;\n vertical-align: middle;\n }\n tbody th {\n text-align: start;\n }\n th.today,\n td.today {\n border-inline: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n th.today {\n border-block-start: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n .date-header-day {\n font-weight: bold;\n }\n tbody .date--mobile {\n display: none;\n }\n .uvalib-button {\n font: inherit;\n padding: 0.4rem 0.9rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n cursor: pointer;\n }\n .heading-h1,\n .heading-h2,\n .heading-h3,\n .heading-h4,\n .heading-h5,\n .heading-h6 {\n font-size: 1.25rem;\n font-weight: bold;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n `,\n ];\n\n /**\n * The data endpoints shared by all hours elements: `libraries` (the Drupal JSON:API URL,\n * relative by default) and `hours` (LibCal, with `{ids}`). Assigning an object (or setting\n * a key) changes them for every hours element from the next load on. To repoint before\n * elements already in the HTML start fetching, set `window.uvalibHoursEndpoints` before\n * the define script runs.\n */\n static get endpoints(): HoursEndpoints {\n return hoursEndpoints;\n }\n static set endpoints(value: Partial<HoursEndpoints>) {\n setHoursEndpoints(value);\n }\n\n /** The library's `field_slug` in Drupal (for example `clemons`). */\n @property({ type: String, attribute: 'library-slug' })\n librarySlug?: string;\n\n /** Which week to show: 0 is this week, 1 next week, -1 last week. Changed by the buttons. */\n @property({ type: Number, attribute: 'week-count', reflect: true })\n weekCount = 0;\n\n /** How often (ms) the current week's hours are fetched again. 0 turns it off. */\n @property({ type: Number, attribute: 'refresh-every' })\n refreshEvery = 600000;\n\n /** Hide the \"Building hours\" row (for a library whose building calendar is one of its spaces). */\n @property({ type: Boolean, attribute: 'hide-building-hours', reflect: true })\n hideBuildingHours = false;\n\n /**\n * `aria-level` (1–6) of the week heading, also its `heading-h<n>` class. Unset (the\n * default), the level is one below the nearest heading before the element in the page\n * (`aria-level` 3 under a library's `<h2>` on /hours), or 2 when there is none, and the\n * class stays `heading-h2`, the one the library website's CSS styles.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n /** Old name of `heading-level`, still accepted; `heading-level` wins. */\n @property({ type: Number, attribute: 'headinglevelstart' })\n headingLevelStart?: number;\n\n /** One below the nearest preceding heading, worked out on connect (see `level`). */\n @state() private inferredLevel = 2;\n\n /** `loading` (the default, until data arrives), `ready` or `error`. Read-only. */\n get state(): HoursState {\n return this._state;\n }\n\n @state() private _state: HoursState = 'loading';\n @state() private today = '';\n @state() private view?: WeekView;\n /**\n * During the first load, once the library list is in: the rows the table will have, so\n * placeholder rows can hold their height until the hours arrive.\n */\n @state() private pending?: Omit<WeekView, 'hours'>;\n @state() private announcement = '';\n\n private readonly uid = `library-weekly-hours-${++instanceCounter}`;\n private loadId = 0;\n /** Set by the week buttons and Retry: announce the result of the next load. */\n private userInitiated = false;\n private tickTimer?: ReturnType<typeof setInterval>;\n private refreshTimer?: ReturnType<typeof setInterval>;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? 2 : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n this.today = todayInNewYork();\n clearInterval(this.tickTimer);\n this.tickTimer = setInterval(() => {\n const today = todayInNewYork();\n if (today !== this.today) this.today = today;\n else if (this._state === 'error') void this.load({ background: true });\n }, hoursTiming.tick);\n this.restartRefresh();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearInterval(this.tickTimer);\n clearInterval(this.refreshTimer);\n this.tickTimer = this.refreshTimer = undefined;\n }\n\n private restartRefresh() {\n clearInterval(this.refreshTimer);\n this.refreshTimer = undefined;\n const every = this.refreshEvery;\n if (!this.isConnected || !(every > 0)) return;\n this.refreshTimer = setInterval(() => {\n if (this.weekCount === 0 && this._state !== 'loading')\n void this.load({ background: true, maxAge: every / 2 });\n }, every);\n }\n\n /** The seven `YYYY-MM-DD` dates of the week shown. */\n private get days(): string[] {\n const start = addDays(weekStart(this.today), (Math.trunc(this.weekCount) || 0) * 7);\n return Array.from({ length: 7 }, (_, i) => addDays(start, i));\n }\n\n /** The level set by `heading-level` (or the old `headinglevelstart`), or null. */\n private get explicitLevel(): number | null {\n const n = Math.trunc(this.headingLevel ?? this.headingLevelStart ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : null;\n }\n\n /** The week heading's `aria-level`: as set, else inferred from the page on connect. */\n private get level(): number {\n return this.explicitLevel ?? this.inferredLevel;\n }\n\n /** The `heading-h<n>` class: as set, else `heading-h2` (what the library's CSS styles). */\n private get headingClass(): number {\n return this.explicitLevel ?? 2;\n }\n\n // A plain map: `today` is private, which PropertyValues<this> does not cover.\n protected override willUpdate(changed: Map<PropertyKey, unknown>) {\n if (!this.isConnected || !this.today) return;\n if (!this.hasUpdated || changed.has('librarySlug') || changed.has('weekCount')) {\n void this.load();\n } else if (changed.has('today')) {\n // The date rolled over: reload quietly. The same week keeps its rows on a failure.\n void this.load({ background: this.view?.days[0] === this.days[0] });\n }\n }\n\n protected override updated(changed: PropertyValues<this>) {\n // Only the first load, before any rows show, reserves --library-weekly-hours-min-height.\n this.toggleAttribute('loading', this._state === 'loading' && !this.view);\n // The first value is picked up by connectedCallback.\n if (changed.has('refreshEvery') && changed.get('refreshEvery') !== undefined)\n this.restartRefresh();\n }\n\n /**\n * Load the week shown. The previous rows stay on screen (the table is `aria-busy`) until\n * the new data lands. A `background` load (refresh, retry from the interval or a rollover\n * within the week) does not change the state to loading and, if it fails while rows for\n * the same week are shown, keeps them. Only user-initiated loads announce their result.\n */\n private async load({\n background = false,\n maxAge = Infinity,\n }: { background?: boolean; maxAge?: number } = {}) {\n const id = ++this.loadId;\n const announce = this.userInitiated;\n this.userInitiated = false;\n const slug = this.librarySlug;\n if (!slug) {\n this._state = 'ready';\n this.view = undefined;\n return;\n }\n const days = this.days;\n if (!background) {\n this._state = 'loading';\n this.announcement = '';\n }\n try {\n const libraries = await loadLibraries();\n const library = libraries.find((l) => l.slug === slug);\n if (!library) throw new Error(`no library with slug \"${slug}\"`);\n const spaces = libraries.filter((l) => l.parent === library.id);\n if (id === this.loadId && !this.view) this.pending = { days, library, spaces };\n const ids = [library, ...spaces]\n .map((l) => l.calId)\n .filter((n): n is number => n !== undefined);\n const hours = await loadHours(ids, days[0]!, days[6]!, maxAge);\n if (id !== this.loadId) return; // a newer load owns the element\n this.view = { days, library, spaces, hours };\n this.pending = undefined;\n this._state = 'ready';\n if (announce)\n this.announcement = `Showing hours for ${fullDate(days[0]!)} to ${fullDate(days[6]!)}`;\n } catch {\n if (id !== this.loadId) return;\n const sameWeek = this.view?.days[0] === days[0];\n if (background && sameWeek && this._state !== 'error') return;\n if (!sameWeek) this.view = undefined;\n this.pending = undefined;\n this._state = 'error';\n trackError(this, 'library-weekly-hours', 'hours-load');\n }\n }\n\n private retry() {\n this.userInitiated = true;\n const hadFocus = this.focusedInside();\n void this.load().then(() => {\n // The Retry button is gone once the hours load; keep keyboard focus in the element.\n if (hadFocus && this._state === 'ready' && !this.focusedInside())\n this.renderRoot\n .querySelector<HTMLButtonElement>('.weekly-hours-header-section button')\n ?.focus();\n });\n }\n\n private focusedInside(): boolean {\n const active =\n this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement\n : document.activeElement;\n return !!active && (this.renderRoot as Node).contains(active) && active !== this;\n }\n\n private previousWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) - 1;\n trackEvent(this, ['library-weekly-hours', 'week-change', 'previous']);\n }\n\n private nextWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) + 1;\n trackEvent(this, ['library-weekly-hours', 'week-change', 'next']);\n }\n\n private renderMobileDate(day: string) {\n return html`<div class=\"date--mobile\">\n <div class=\"date-header-day\">${shortWeekday(day)}</div>\n <div class=\"date-header-month\">${shortDate(day)}</div>\n </div>`;\n }\n\n private renderCells(days: string[], hours: HoursByCalendar, calId: number | undefined) {\n const dates = calId === undefined ? undefined : hours.get(calId);\n return days.map((day) => {\n const text = formatDay(dates?.[day]);\n return html`<td\n aria-label=${text ? `${longDate(day)}: ${text}` : longDate(day)}\n class=${day === this.today ? 'today' : nothing}\n >\n ${this.renderMobileDate(day)}${text}\n </td>`;\n });\n }\n\n /**\n * The first load's rows before the hours arrive: the real row headers with invisible,\n * typical hours text in each cell, so the table already has its final height in whatever\n * font the page uses and nothing below it moves when the hours replace the placeholders.\n */\n private renderPlaceholderRows({ days, library: lib, spaces }: Omit<WeekView, 'hours'>) {\n const cells = () =>\n days.map(\n (day) =>\n html`<td class=${day === this.today ? 'today' : nothing}>\n ${this.renderMobileDate(day)}<span class=\"hours-placeholder\" aria-hidden=\"true\"\n >10am - 10pm</span\n >\n </td>`,\n );\n const building =\n !this.hideBuildingHours && lib.calId !== undefined\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\">Building hours</th>\n ${cells()}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\">\n <span class=${space.siteLink ? 'lib-space-link' : 'lib-space'}>${space.title}</span>\n </th>\n ${cells()}\n </tr>`,\n )}`;\n }\n\n private renderRows(view: WeekView | undefined) {\n if (!view) {\n if (this.pending) return this.renderPlaceholderRows(this.pending);\n // Before the library list is in: the Building hours row nearly every library has, so\n // only a library's extra spaces can still move what follows the table.\n if (this._state === 'loading' && !this.hideBuildingHours)\n return this.renderPlaceholderRows({\n days: this.days,\n library: { calId: 0 } as LibraryInfo,\n spaces: [],\n });\n return nothing;\n }\n const { days, library: lib, spaces, hours } = view;\n const building =\n !this.hideBuildingHours && lib.calId !== undefined && hours.has(lib.calId)\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\" aria-label=\"Building hours\">Building hours</th>\n ${this.renderCells(days, hours, lib.calId)}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\" aria-label=${space.title}>\n ${\n space.siteLink\n ? html`<a class=\"lib-space-link\" href=${space.siteLink}>${space.title}</a>`\n : html`<span class=\"lib-space\">${space.title}</span>`\n }\n </th>\n ${this.renderCells(days, hours, space.calId)}\n </tr>`,\n )}`;\n }\n\n private renderStatus() {\n // Only the first load says so; later loads keep the previous rows (aria-busy) quietly.\n if (this._state === 'loading') return this.view ? nothing : 'Loading hours…';\n if (this._state === 'error')\n return html`Hours are unavailable right now.\n <button type=\"button\" class=\"uvalib-button uvalib-button--basic\" @click=${this.retry}>\n Retry\n </button>`;\n return this.announcement\n ? html`<span class=\"visually-hidden\">${this.announcement}</span>`\n : nothing;\n }\n\n render() {\n if (!this.librarySlug || !this.today) return nothing;\n const days = this.days;\n const level = this.level;\n const headingId = `${this.uid}-heading`;\n // The table shows the data it has (the previous week while the next one loads).\n const tableDays = this.view?.days ?? days;\n return html`<div class=\"weekly-hours-header-section\">\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.previousWeek}\n >\n Previous week\n </button>\n <div\n class=\"heading-h${this.headingClass}\"\n role=\"heading\"\n aria-level=${level}\n id=${headingId}\n >\n ${weekHeadingDate(days[0]!)} - ${weekHeadingDate(days[6]!)}\n </div>\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.nextWeek}\n >\n Next week\n </button>\n </div>\n <table\n class=\"weekly-hours-body-section\"\n aria-busy=${this._state === 'loading' ? 'true' : nothing}\n >\n <colgroup>\n <col class=\"location-column\" />\n ${tableDays.map(() => html`<col />`)}\n <col />\n </colgroup>\n <thead>\n <tr>\n <th colspan=\"2\" scope=\"col\"><span class=\"visually-hidden\">Day</span></th>\n ${tableDays.map(\n (day) =>\n html`<th\n scope=\"col\"\n aria-label=${longDate(day)}\n aria-current=${day === this.today ? 'date' : nothing}\n class=${day === this.today ? 'today' : nothing}\n >\n <div class=\"date-header\">${this.renderMobileDate(day)}</div>\n </th>`,\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderRows(this.view)}\n </tbody>\n </table>\n <div class=\"weekly-hours-status\" role=\"status\">${this.renderStatus()}</div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { LibraryWeeklyHours } from './LibraryWeeklyHours.js';\n\ndefine('library-weekly-hours', LibraryWeeklyHours);\n"],"mappings":";;;;;;;AA4BA,IAAIgC,IAAkB,GAiBhBC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;IACLA,EAAK;;IAELA,EAAK;IACLA,EAAK,YAAYA,EAAK;IACtBA,EAAK;;;;;;;IAOLA,EAAK;IACLA,EAAK;;;;;;;;;;;GAYHC,IAAkBnC,EAAUiC,EAAgB,OAAO,CAAC,GAqB7CG,IAAb,cAAwCvB,EAAc;;EAuH5B,A,aA5CZ,KAAA,YAAA,GAIG,KAAA,eAAA,KAIK,KAAA,oBAAA,IAgBa,KAAA,gBAAA,GAOK,KAAA,SAAA,WACb,KAAA,QAAA,IAOO,KAAA,eAAA,IAET,KAAA,MAAA,wBAAwB,EAAEmB,KAChC,KAAA,SAAA,GAEO,KAAA,gBAAA;;;EAtHR,KAAA,SAAA;GACdf;GACAkB;GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDL;;CASA,WAAW,YAA4B;EACrC,OAAOX;CACT;CACA,WAAW,UAAU,GAAgC;EACnD,EAAkBc,CAAK;CACzB;CAmCA,IAAI,QAAoB;EACtB,OAAO,KAAK;CACd;CAmBA,mBAAsE;EACpE,IAAMC,IAAO,MAAM,iBAAiB;EACpC,IAAIA,aAAgB,cAAc,KAAK,SAAS;GAC9C,IAAMC,IAAQL,EAAgB;GAC9B,AAAIK,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,KAAA,CAAA,GACNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,SAAA,KAAA,CAAA,GACNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,QAAA,KAAA,CAAA,GAKNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,WAAA,KAAA,CAAA,GACNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,gBAAA,KAAA,CAAA,GC5MT3B,EAAO,wBAAwB2B,CAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"regions-B8ExwUGP.js","names":["parseXywh","s","value","at","unit","prefix","parts","p","x","y","w","h","text","v","toRegion","o","label","box","n","out","parseRegions","list","r","entry","m","toPercent","width","height","clamp","left","top","right","bottom"],"sources":["../../src/components/uvalib-image-regions/regions.ts"],"sourcesContent":["/**\n * Region parsing shared by `<uvalib-image-regions>` and `<uvalib-lightbox>` (its\n * `data-regions`). No Lit, no DOM rendering: small enough for the lightbox to import\n * statically.\n */\n\n/** One region on an image. */\nexport interface ImageRegion {\n /** A stable id, sent back in events. */\n id?: string;\n /** The region's name, shown in the list and on the highlighted outline. */\n label: string;\n /** Left edge, in `unit`s from the image's left. */\n x: number;\n /** Top edge, in `unit`s from the image's top. */\n y: number;\n /** Width, in `unit`s. */\n w: number;\n /** Height, in `unit`s. */\n h: number;\n /**\n * `percent` (of the image's width and height) or `px` (pixels of the image's natural size,\n * or of `image-width` × `image-height` when set). Default `px`, as in IIIF.\n */\n unit?: 'px' | 'percent';\n /** Where the region's list entry links. */\n href?: string;\n /** A short description after the label in the list. */\n description?: string;\n}\n\n/** A region box: its unit and four numbers. */\nexport interface RegionBox {\n x: number;\n y: number;\n w: number;\n h: number;\n unit: 'px' | 'percent';\n}\n\n/**\n * A IIIF / Media Fragments `xywh` value: `percent:10,20,30,40`, `pixel:160,120,320,240`\n * or `160,120,320,240` (pixels), optionally as `xywh=…` or a URL ending `#xywh=…`.\n * Returns null for anything else, and for a zero width or height.\n */\nexport function parseXywh(value: string | null | undefined): RegionBox | null {\n let s = String(value ?? '').trim();\n const at = s.lastIndexOf('xywh=');\n if (at >= 0) s = s.slice(at + 5);\n s = s.split('&')[0]!.trim();\n let unit: RegionBox['unit'] = 'px';\n const prefix = /^(pixel|percent):/i.exec(s);\n if (prefix) {\n unit = prefix[1]!.toLowerCase() === 'percent' ? 'percent' : 'px';\n s = s.slice(prefix[0].length);\n }\n const parts = s.split(',');\n if (parts.length !== 4 || parts.some((p) => !/^\\s*\\d+(\\.\\d+)?\\s*$/.test(p))) return null;\n const [x, y, w, h] = parts.map(Number) as [number, number, number, number];\n if (w <= 0 || h <= 0) return null;\n return { x, y, w, h, unit };\n}\n\nconst text = (v: unknown): string =>\n String(v ?? '')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/** A usable region from an unknown value (an `items` entry or JSON), or null. */\nexport function toRegion(v: unknown): ImageRegion | null {\n if (!v || typeof v !== 'object') return null;\n const o = v as Record<string, unknown>;\n const label = text(o.label);\n let box: RegionBox | null = null;\n if (typeof o.xywh === 'string') box = parseXywh(o.xywh);\n else {\n const n = [o.x, o.y, o.w, o.h].map((x) => (typeof x === 'string' ? Number(x) : x));\n if (n.every((x) => typeof x === 'number' && Number.isFinite(x) && x >= 0)) {\n const [x, y, w, h] = n as number[];\n if (w! > 0 && h! > 0)\n box = { x: x!, y: y!, w: w!, h: h!, unit: o.unit === 'percent' ? 'percent' : 'px' };\n }\n }\n if (!box) return null;\n const out: ImageRegion = { label, ...box };\n if (o.id != null && text(o.id)) out.id = text(o.id);\n if (typeof o.href === 'string' && o.href.trim()) out.href = o.href.trim();\n if (o.description != null && text(o.description)) out.description = text(o.description);\n return out;\n}\n\n/**\n * Regions written in an attribute (the lightbox's `data-regions`): a JSON array of region\n * objects, or entries separated by `;`, each an `xywh` value then its label, e.g.\n * `percent:10,20,30,40 Person 1; percent:55,15,20,30 Sign`. Entries that do not parse are\n * dropped.\n */\nexport function parseRegions(value: string | null | undefined): ImageRegion[] {\n const s = String(value ?? '').trim();\n if (!s) return [];\n if (s.startsWith('[')) {\n try {\n const list: unknown = JSON.parse(s);\n return Array.isArray(list)\n ? list.map(toRegion).filter((r): r is ImageRegion => r !== null)\n : [];\n } catch {\n return [];\n }\n }\n const out: ImageRegion[] = [];\n for (const entry of s.split(';')) {\n const m = /^\\s*(\\S+)\\s*(.*)$/.exec(entry);\n if (!m) continue;\n const box = parseXywh(m[1]);\n if (box) out.push({ label: text(m[2]), ...box });\n }\n return out;\n}\n\n/**\n * The box in percent of the image, clamped to it. Pixel boxes need the coordinate space\n * (`width` × `height`); without it they return null (not drawn yet).\n */\nexport function toPercent(box: RegionBox, width: number, height: number): RegionBox | null {\n let { x, y, w, h } = box;\n if (box.unit === 'px') {\n if (!(width > 0) || !(height > 0)) return null;\n x = (x / width) * 100;\n w = (w / width) * 100;\n y = (y / height) * 100;\n h = (h / height) * 100;\n }\n const clamp = (v: number) => Math.min(100, Math.max(0, v));\n const left = clamp(x);\n const top = clamp(y);\n const right = clamp(x + w);\n const bottom = clamp(y + h);\n if (right <= left || bottom <= top) return null;\n return { x: left, y: top, w: right - left, h: bottom - top, unit: 'percent' };\n}\n"],"mappings":";AA6CA,SAAgBA,EAAU,GAAoD;CAC5E,IAAIC,IAAI,OAAOC,KAAS,EAAE,CAAC,CAAC,KAAK,GAC3BC,IAAKF,EAAE,YAAY,OAAO;CAEhC,AADIE,KAAM,MAAG,IAAIF,EAAE,MAAME,IAAK,CAAC,IAC/B,IAAIF,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAE,KAAK;CAC1B,IAAIG,IAA0B,MACxBC,IAAS,qBAAqB,KAAKJ,CAAC;CAC1C,AAAII,MACF,IAAOA,EAAO,EAAE,CAAE,YAAY,MAAM,YAAY,YAAY,MAC5D,IAAIJ,EAAE,MAAMI,EAAO,EAAE,CAAC,MAAM;CAE9B,IAAMC,IAAQL,EAAE,MAAM,GAAG;CACzB,IAAIK,EAAM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E1B,OADIoB,KAASF,KAAQG,KAAUF,IAAY,OACpC;EAAE,GAAGD;EAAM,GAAGC;EAAK,GAAGC,IAAQF;EAAM,GAAGG,IAASF;EAAK,MAAM;CAAU;AAC9E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"site-main-nav-DURrQMal.js","names":["t","unsafeCSS","ifDefined","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","accessible","siteLink","o","A","str","v","normalizeItems","out","raw","collect","nodes","label","href","kids","into","depth","links","text","el","readItemsMarkup","list","source","readLi","li","sub","k","head","mainNavTiming","fetchJson","error","attempts","response","url","cache","loadMainNavItems","p","promise","result","json","MAIN_NAV_SNAPSHOT","\"label\"","\"items\"","\"href\"","navCounter","MAIN_NAV","isSourceChild","SOURCE_ATTRS","FOCUS_RULES","focusRules","lightFocusRules","tag","pageKey","u","base","hashOf","SiteMainNav","_args","nav","root","win","on","target","type","kind","what","moved","sources","next","s","content","changed","src","key","index","opening","doc","to","tops","top","open","openButton","panel","button","here","matches","hrefs","h","hash","a","group","items","item","l","all","current","mark","marked","cur","id","expanded","has","linkMarked"],"sources":["../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/if-defined.js","../../src/components/site-main-nav/main-nav-items.ts","../../src/components/site-main-nav/main-nav-data.ts","../../src/components/site-main-nav/SiteMainNav.ts","../../src/components/site-main-nav/site-main-nav.ts"],"sourcesContent":["import{nothing as t}from\"../lit-html.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o=o=>o??t;export{o as ifDefined};\n//# sourceMappingURL=if-defined.js.map\n","// Data helpers for <site-main-nav>: the item types, normalising items from any source\n// (property, JSON, markup) to the two levels the nav shows, and the `items-src` loader.\n// Internal apart from the types. No side effects on import.\n\n/** A link inside a main-navigation group. */\nexport interface MainNavLink {\n label: string;\n href: string;\n}\n\n/**\n * One top-level main-navigation entry: a group (a button that discloses `items`) or, with\n * no `items`, a direct link to `href`. A group's own `href` is not shown.\n */\nexport interface MainNavItem {\n label: string;\n href?: string;\n items?: MainNavLink[];\n}\n\n/** What normalising found besides the items: skipped entries, flattened deeper levels. */\nexport interface NormalizeResult {\n items: MainNavItem[];\n invalid: boolean;\n flattened: boolean;\n}\n\nconst str = (v: unknown): string => (typeof v === 'string' ? v.replace(/\\s+/g, ' ').trim() : '');\n\n/**\n * Reduce untrusted items (a property, JSON or parsed markup) to the two levels the nav\n * shows. Entries without a label, links without an href, and groups with no valid links\n * are skipped (`invalid`); links nested deeper than a group are lifted into it\n * (`flattened`), and a deeper level's own label is dropped unless it has an href.\n */\nexport function normalizeItems(raw: unknown): NormalizeResult {\n const out: NormalizeResult = { items: [], invalid: false, flattened: false };\n if (!Array.isArray(raw)) {\n out.invalid = raw != null;\n return out;\n }\n const collect = (nodes: unknown[], into: MainNavLink[], depth: number): void => {\n for (const n of nodes) {\n const o = (n ?? {}) as Record<string, unknown>;\n const label = str(o.label);\n const href = str(o.href);\n const kids = Array.isArray(o.items) && o.items.length ? o.items : null;\n if (kids) {\n out.flattened = true;\n if (label && href) into.push({ label, href });\n collect(kids, into, depth + 1);\n } else if (label && href) {\n into.push({ label, href });\n } else {\n out.invalid = true;\n }\n }\n };\n for (const n of raw) {\n const o = (n ?? {}) as Record<string, unknown>;\n const label = str(o.label);\n const href = str(o.href);\n const kids = Array.isArray(o.items) && o.items.length ? o.items : null;\n if (!label) {\n out.invalid = true;\n } else if (kids) {\n const links: MainNavLink[] = [];\n collect(kids, links, 2);\n if (links.length) out.items.push({ label, items: links });\n else if (href) out.items.push({ label, href });\n else out.invalid = true;\n } else if (href) {\n out.items.push({ label, href });\n } else {\n out.invalid = true;\n }\n }\n return out;\n}\n\nconst text = (el: Element): string => (el.textContent ?? '').replace(/\\s+/g, ' ').trim();\n\n/**\n * Read `<nav><ul><li>…</li></ul></nav>` (or a bare `<ul>`) markup into raw items: an\n * `<li>` holding an `<a href>` (and no list) is a direct link; an `<li>` whose first child\n * element is a label (`<span>`, or any element but a list) followed by a `<ul>` is a group.\n * Anything else is reported as invalid by normalizeItems().\n */\nexport function readItemsMarkup(source: Element): unknown[] {\n const list =\n source.localName === 'ul' ? source : (source.querySelector(':scope > ul') ?? undefined);\n if (!list) return [{}];\n const readLi = (li: Element): unknown => {\n if (li.localName !== 'li') return {};\n const kids = [...li.children];\n const sub = kids.find((k) => k.localName === 'ul');\n const head = kids.find((k) => k.localName !== 'ul');\n if (!head) return {};\n const label = text(head);\n const href = head.localName === 'a' ? head.getAttribute('href') : null;\n if (!sub) return head.localName === 'a' ? { label, href } : { label };\n return { label, href, items: [...sub.children].map(readLi) };\n };\n return [...list.children].map(readLi);\n}\n\n/**\n * `items-src` fetch: how many attempts, the delay between them (ms) and each attempt's\n * timeout (ms). With the defaults a hung server is given up on after about 21 s.\n */\nexport const mainNavTiming = { attempts: 2, retryDelay: 1000, timeout: 10_000 };\n\nasync function fetchJson(url: string): Promise<unknown> {\n let error: unknown;\n const attempts = Math.max(1, mainNavTiming.attempts);\n for (let i = 0; i < attempts; i++) {\n if (i > 0) await new Promise((r) => setTimeout(r, mainNavTiming.retryDelay));\n try {\n // A hung attempt times out and counts as a failed attempt.\n const response = await fetch(url, { signal: AbortSignal.timeout(mainNavTiming.timeout) });\n if (!response.ok) throw new Error(`${response.status} ${response.statusText} for ${url}`);\n return await response.json();\n } catch (e) {\n error = e;\n }\n }\n throw error instanceof Error ? error : new Error(String(error));\n}\n\nconst cache = new Map<string, Promise<NormalizeResult>>();\n\n/**\n * The items at `url` (JSON in the `MainNavItem[]` shape), fetched once per URL and shared by\n * every nav on the page. A response with no valid entries is an error. Failures are not\n * cached, so a later load tries again.\n */\nexport function loadMainNavItems(url: string): Promise<NormalizeResult> {\n let p = cache.get(url);\n if (!p) {\n const promise = fetchJson(url).then((json) => {\n const result = normalizeItems(json);\n if (!result.items.length) throw new Error(`no valid main navigation entries in ${url}`);\n return result;\n });\n cache.set(url, (p = promise));\n promise.catch(() => {\n if (cache.get(url) === promise) cache.delete(url);\n });\n }\n return p;\n}\n","// GENERATED by scripts/sync-main-nav.mjs from a saved page on 2026-11-14 — do not edit.\n// The desktop \"Main navigation\" of library.virginia.edu. Regenerate with `pnpm sync:main-nav`.\nimport type { MainNavItem } from './main-nav-items.js';\n\n/** The day the snapshot was taken (YYYY-MM-DD). */\nexport const MAIN_NAV_SNAPSHOT_DATE = '2026-11-14';\n\n/** The library main navigation, as on library.virginia.edu when the snapshot was taken. */\nexport const MAIN_NAV_SNAPSHOT: readonly MainNavItem[] = [\n {\n \"label\": \"About\",\n \"items\": [\n {\n \"label\": \"About UVA Library\",\n \"href\": \"/about-uva-library\"\n },\n {\n \"label\": \"News & announcements\",\n \"href\": \"https://library.virginia.edu/news/all?mtm_campaign=main-nav\"\n },\n {\n \"label\": \"Plan a visit\",\n \"href\": \"/about-uva-library#visit\"\n },\n {\n \"label\": \"Library Assessment\",\n \"href\": \"/assessment\"\n },\n {\n \"label\": \"Staff directory\",\n \"href\": \"/staff\"\n }\n ]\n },\n {\n \"label\": \"Using the Library\",\n \"items\": [\n {\n \"label\": \"Search, borrow, request\",\n \"href\": \"/services\"\n },\n {\n \"label\": \"Library spaces\",\n \"href\": \"/spaces\"\n },\n {\n \"label\": \"Equipment & technology\",\n \"href\": \"/equipment-and-tech\"\n }\n ]\n },\n {\n \"label\": \"Research & teaching support\",\n \"items\": [\n {\n \"label\": \"Research & teaching support\",\n \"href\": \"/research-and-teaching\"\n },\n {\n \"label\": \"Research support\",\n \"href\": \"/research-and-teaching/research\"\n },\n {\n \"label\": \"Instruction assistance\",\n \"href\": \"/research-and-teaching/teach\"\n },\n {\n \"label\": \"Writing & publication\",\n \"href\": \"/research-and-teaching/write\"\n }\n ]\n },\n {\n \"label\": \"Get help\",\n \"items\": [\n {\n \"label\": \"Get help\",\n \"href\": \"/help\"\n },\n {\n \"label\": \"Ask a Librarian\",\n \"href\": \"/askalibrarian\"\n },\n {\n \"label\": \"Accessibility services\",\n \"href\": \"/accessibility\"\n },\n {\n \"label\": \"Subject specialists\",\n \"href\": \"https://guides.lib.virginia.edu/subjectlibrarians\"\n }\n ]\n }\n];\n","import { html, css, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { siteLink } from '../link.js';\nimport { MAIN_NAV_SNAPSHOT } from './main-nav-data.js';\nimport {\n loadMainNavItems,\n normalizeItems,\n readItemsMarkup,\n type MainNavItem,\n type NormalizeResult,\n} from './main-nav-items.js';\n\nexport type { MainNavItem, MainNavLink } from './main-nav-items.js';\n\n/** Light-DOM instances share the document id space, so every instance numbers its own ids. */\nlet navCounter = 0;\n\nconst MAIN_NAV = 'main-nav';\nconst isSourceChild = (n: Node): n is Element =>\n n instanceof Element && n.getAttribute('slot') === MAIN_NAV;\n/** Attributes of the source markup that change what the nav renders. */\nconst SOURCE_ATTRS = ['href', 'slot'];\n\n/**\n * Focus rings: inset (as on the live site) so an open panel or a neighbour never covers\n * them; orange on white, brand blue where the background is grey (hover, the open group),\n * so the ring keeps 3:1 contrast.\n */\nconst FOCUS_RULES = `\n .toggle:focus-visible,\n .top-link:focus-visible,\n .panel a:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: -4px;\n }\n .toggle[aria-expanded='true']:focus-visible,\n .toggle:hover:focus-visible,\n .top-link:hover:focus-visible,\n .panel a:hover:focus-visible {\n outline-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n`;\nconst focusRules = unsafeCSS(FOCUS_RULES);\n/** The focus rules scoped to `tag`, for the unlayered light-mode sheet. */\nconst lightFocusRules = (tag: string) =>\n unsafeCSS(FOCUS_RULES.replace(/(^|,)\\s*\\./gm, `$1 ${tag} .`));\n\n/** A URL reduced to what \"the same page\" means here: host (without `www.`) and path. */\nfunction pageKey(href: string, base: string): string | null {\n try {\n const u = new URL(href, base);\n return `${u.host.replace(/^www\\./, '')}${u.pathname.replace(/\\/+$/, '')}`;\n } catch {\n return null;\n }\n}\nconst hashOf = (href: string, base: string): string => {\n try {\n return new URL(href, base).hash;\n } catch {\n return '';\n }\n};\n\n/**\n * The UVA Library main navigation (About, Using the Library, Research & teaching support,\n * Get help), as on library.virginia.edu, following the WAI-ARIA disclosure navigation\n * pattern: one `<nav>` landmark; each group is a `<button aria-expanded aria-controls>`\n * followed by its list of links, and an entry with no group is a plain link. Click, Enter or\n * Space toggles a group and only one is open at a time; Escape closes it and returns focus to\n * its button; arrow keys, Home and End move between the buttons and between a panel's links,\n * and ArrowDown on an open button moves into its panel. In the `bar` layout a panel also closes\n * when focus leaves the nav or on a pointer press outside it. There is no hover-to-open.\n *\n * The items come from, in order of precedence: a `<nav slot=\"main-nav\">` child holding\n * `<ul><li><a href>…</a></li></ul>` (a direct link) or `<li><span>Group</span><ul><li><a href>…`\n * (a group), kept hidden and watched for changes; the `items` property; JSON at `items-src`;\n * and the snapshot of the live menu bundled with the component (see `pnpm sync:main-nav`).\n * Invalid entries are skipped and levels deeper than two are flattened, each with one console\n * warning. Relative hrefs are joined to `root-link-domain`; absolute ones are kept, and\n * fragment-only ones (`#…`, a hash route) stay on this page. A plain click on a link closes\n * the open group.\n *\n * The link for the current page (`current`, default the page location, followed through\n * same-document navigations; host and path, ignoring the query, the hash, a trailing slash\n * and a leading `www.`) gets `aria-current=\"page\"`, and its group button\n * `aria-current=\"true\"`, shown bold with a thick underline. Of links that differ only by\n * hash, the one with the page's hash is marked, else the one without a hash; if every one\n * has a hash, the first is marked while the page has none, and none for a hash none has.\n *\n * `<site-header>` renders it: as a row under the logo on wide screens and as an accordion in\n * the Menu popover on narrow ones.\n *\n * @tagname site-main-nav\n * @slot main-nav - Optional `<nav>` (or `<ul>`) whose list replaces the menu: `<li><a href>` for a direct link, `<li><span>Group</span><ul><li><a href>…</a></li></ul></li>` for a group. It is never shown itself; in light mode it is moved into a hidden holder.\n * @fires site-main-nav-error - `items-src` could not be loaded: both attempts failed (network error, a 10 s timeout per attempt, or no valid entries), after about 21 s at worst; the nav shows the bundled snapshot. `detail` is `{ src, message }`. Bubbles and is composed.\n * @fires uvalib-analytics-event - For `<site-analytics>`: a group was opened, `['site-main-nav', 'menu-open', <the group's label>]` (not on close), and a link was clicked, `['site-main-nav', 'link-click', '<Group> > <Link>']` (a top-level link: its label alone; never the URL). Bubbles and is composed.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Top-level button colour.\n * @cssprop [--uva-brand-blue=#232d4b] - Bar bottom border, chevrons, panel links, and the hover and expanded button text.\n * @cssprop [--uva-grey-100=#dadada] - Hover and expanded button background, and panel link hover background.\n * @cssprop [--uva-brand-orange=#e57200] - Focus ring colour, and the underline of the current page's link and group (also bold, with a 3px underline).\n * @cssprop [--uva-font-family=franklin-gothic-urw, Arial, Helvetica, sans-serif] - Font family.\n * @cssprop --uva-color-text - Dark-mode role token: top-level button text (else `--uva-grey-darkest`).\n * @cssprop --uva-color-link - Dark-mode role token: chevrons, panel links, hover text and the focus ring over hover (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-hover - Dark-mode role token: hover and open-group background (else `--uva-grey-100`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: bar and panel background (else #ffffff).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: bar bottom rule (else `--uva-brand-blue`).\n * @cssprop --uva-color-shadow - Dark-mode role token: panel shadow colour (else rgba(0, 0, 0, 0.2)).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n * @cssprop --uva-color-current - Dark-mode role token: current-page underline (else `--uva-brand-orange`).\n */\nexport class SiteMainNav extends UvalibElement {\n static styles = [\n accessible,\n css`\n :host {\n display: block;\n font-family: var(--uva-font-family, franklin-gothic-urw, Arial, Helvetica, sans-serif);\n font-size: 17px;\n line-height: 1.5;\n }\n :host([hidden]) {\n display: none;\n }\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .panel[hidden] {\n display: none;\n }\n .toggle,\n .top-link {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n margin: 0;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n font: inherit;\n font-weight: 500;\n line-height: 1.5;\n text-align: start;\n text-decoration: none;\n cursor: pointer;\n }\n /* Chevron: a rotated border box, turned over when expanded. */\n .toggle::after {\n content: '';\n flex: none;\n inline-size: 0.5em;\n block-size: 0.5em;\n margin-inline-start: 0.75em;\n border-style: solid;\n border-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-width: 0 1px 1px 0;\n transform: translateY(-0.15em) rotate(45deg);\n }\n .toggle[aria-expanded='true']::after {\n transform: translateY(0.15em) rotate(-135deg);\n }\n /* Grey for hover and the open group only, never for focus: the orange focus ring\n would fall below 3:1 against it. */\n .toggle:hover,\n .toggle[aria-expanded='true'],\n .top-link:hover {\n background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n .panel a {\n display: block;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font-weight: 400;\n text-decoration: underline;\n }\n .panel a:hover {\n background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));\n text-decoration: none;\n }\n ${focusRules}\n /* Current page, and the group holding it: bold with a thick underline, not colour alone. */\n [aria-current]:not([aria-current='false']),\n .panel a[aria-current]:not([aria-current='false']):hover {\n font-weight: 700;\n text-decoration-line: underline;\n text-decoration-thickness: 3px;\n text-decoration-color: var(--uva-color-current, var(--uva-brand-orange, #e57200));\n text-underline-offset: 0.3em;\n }\n\n /* Bar: a full-width row with the brand-blue rule, content capped at 1600px. */\n .bar {\n border-bottom: 5px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n background: var(--uva-color-surface-raised, #ffffff);\n }\n .bar > ul {\n display: flex;\n flex-wrap: wrap;\n box-sizing: border-box;\n max-inline-size: 1600px;\n margin-inline: auto;\n padding-inline: 16px;\n }\n .bar > ul > li {\n position: relative;\n display: flex;\n }\n .bar .toggle,\n .bar .top-link {\n padding: 11.5px 17px;\n }\n .bar .panel {\n position: absolute;\n top: 100%;\n inset-inline-start: 0;\n z-index: 1000;\n box-sizing: border-box;\n inline-size: max-content;\n min-inline-size: 100%;\n max-inline-size: 20rem;\n background: var(--uva-color-surface-raised, #ffffff);\n border-radius: 0 0 4px 4px;\n box-shadow: 0 8px 16px var(--uva-color-shadow, rgba(0, 0, 0, 0.2));\n /* Invisible normally; forced colors paint it, so the panel keeps an edge. */\n outline: 1px solid transparent;\n }\n .bar .panel a {\n padding: 8.5px 17px;\n }\n\n /* Accordion (the header's narrow-screen Menu popover): full-width rows, panels in flow. */\n .accordion .toggle,\n .accordion .top-link {\n inline-size: 100%;\n justify-content: space-between;\n padding: 0.375rem 0.5rem;\n }\n .accordion .toggle::after {\n margin-inline-end: 0.25em;\n }\n .accordion .panel {\n position: static;\n padding-inline-start: 1rem;\n }\n .accordion .panel a {\n padding: 0.375rem 0.5rem;\n }\n\n /* Forced colors drop backgrounds and shadows: outline the open group and hovered\n controls instead. */\n @media (forced-colors: active) {\n .toggle[aria-expanded='true']:not(:focus-visible),\n .toggle:hover:not(:focus-visible),\n .top-link:hover:not(:focus-visible),\n .panel a:hover:not(:focus-visible) {\n outline: 1px solid CanvasText;\n outline-offset: -1px;\n }\n }\n `,\n ];\n\n /**\n * Light mode: the focus rules again, unlayered. A page's own accessibility sheet (which\n * `<site-page>` installs unlayered) would otherwise beat the layered component rules.\n */\n protected override installLightStyles(root?: Document | ShadowRoot): void {\n super.installLightStyles(root);\n installLightDomStyles(`${this.localName}-focus`, [lightFocusRules(this.localName)], {\n root,\n scope: false,\n layer: false,\n });\n }\n\n /** Accessible name of the navigation landmark. */\n @property({ type: String }) label = 'Main';\n @property({ type: String, attribute: 'root-link-domain' }) rootLinkDomain =\n 'https://www.library.virginia.edu';\n /** URL of JSON in the `MainNavItem[]` shape (needs CORS); the snapshot is shown until it loads, and if it fails. */\n @property({ type: String, attribute: 'items-src' }) itemsSrc?: string;\n /** `bar` (a row of buttons with floating panels) or `accordion` (stacked, panels in flow). */\n @property({ type: String }) layout: 'bar' | 'accordion' = 'bar';\n /**\n * The URL whose link is marked current. Default: the page location, followed through\n * same-document navigations (`popstate`, `hashchange`, and the Navigation API's\n * `currententrychange` where supported).\n */\n @property({ type: String }) current?: string;\n /**\n * The menu, replacing the bundled snapshot (but not `slot=\"main-nav\"` markup):\n * `{ label, href }` for a direct link, `{ label, items: [{ label, href }] }` for a group.\n * Unset or empty uses `items-src` or the snapshot.\n */\n @property({ attribute: false }) items?: MainNavItem[];\n\n /** Items from slotted markup, or null when there is none. */\n @state() private slotItems: MainNavItem[] | null = null;\n /** Items loaded from `items-src`. */\n @state() private fetched: MainNavItem[] | null = null;\n /** Index of the open group. */\n @state() private open: number | null = null;\n\n private propItems: MainNavItem[] | null = null;\n private fetchedFor?: string;\n /** The shown items last rendered, to close the open group when they change. */\n private shownKey?: string;\n private warned = new Set<string>();\n private observer?: MutationObserver;\n private holder?: HTMLDivElement;\n private readonly idBase = `main-nav-${++navCounter}`;\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Read the markup before the first render where it is already there (no second update);\n // the observer catches markup parsed or added later.\n this.syncSource();\n this.listenLocation(true);\n // Reconnected while a group was open: watch for outside presses again.\n this.listenOutside(this.open !== null && this.layout === 'bar');\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.listenOutside(false);\n this.listenLocation(false);\n }\n\n /** Same-document navigation: re-mark the current page when `current` is not set. */\n private onLocationChange = (): void => {\n if (!this.current) this.requestUpdate();\n };\n\n private locationTargets(): { target: EventTarget; type: string }[] {\n const win = this.ownerDocument.defaultView;\n if (!win) return [];\n const nav = (win as Window & { navigation?: EventTarget }).navigation;\n return [\n { target: win, type: 'popstate' },\n { target: win, type: 'hashchange' },\n ...(nav ? [{ target: nav, type: 'currententrychange' }] : []),\n ];\n }\n\n private listeningLocation = false;\n private listenLocation(on: boolean): void {\n if (on === this.listeningLocation) return;\n this.listeningLocation = on;\n for (const { target, type } of this.locationTargets()) {\n if (on) target.addEventListener(type, this.onLocationChange);\n else target.removeEventListener(type, this.onLocationChange);\n }\n }\n\n private warnOnce(kind: 'invalid' | 'flattened', what: string): void {\n if (this.warned.has(kind)) return;\n this.warned.add(kind);\n console.warn(\n kind === 'invalid'\n ? `${this.localName}: ignoring invalid ${what} entries (each needs a label, and an href or links).`\n : `${this.localName}: ${what} nests deeper than two levels; the deeper links are shown in their group.`,\n );\n }\n\n private use(result: NormalizeResult, what: string): MainNavItem[] | null {\n if (result.invalid) this.warnOnce('invalid', what);\n if (result.flattened) this.warnOnce('flattened', what);\n return result.items.length ? result.items : null;\n }\n\n /** Light mode: move `slot=\"main-nav\"` children into a hidden holder this element owns. */\n private adoptSource(): Element[] {\n const moved = [...this.children].filter(isSourceChild);\n if (moved.length && !this.holder) {\n this.holder = document.createElement('div');\n this.holder.hidden = true;\n this.holder.className = 'main-nav-source';\n }\n if (this.holder) {\n this.holder.append(...moved);\n if (this.holder.parentNode !== this) this.append(this.holder);\n }\n return this.holder ? [...this.holder.children] : [];\n }\n\n /** Read the `slot=\"main-nav\"` markup, render it, and watch it for changes. */\n private syncSource(): void {\n const sources = this.lightDom ? this.adoptSource() : [...this.children].filter(isSourceChild);\n let next: MainNavItem[] | null = null;\n if (sources.length) {\n const raw = sources.flatMap((s, i) => (i === 0 ? readItemsMarkup(s) : [{}]));\n next = this.use(normalizeItems(raw), 'slot=\"main-nav\"');\n }\n // Only a real change re-renders.\n if (JSON.stringify(next) !== JSON.stringify(this.slotItems)) this.slotItems = next;\n this.observer ??= new MutationObserver(() => this.syncSource());\n this.observer.disconnect();\n const content = {\n attributes: true,\n attributeFilter: SOURCE_ATTRS,\n characterData: true,\n childList: true,\n subtree: true,\n };\n if (this.lightDom) {\n this.observer.observe(this, { childList: true });\n if (this.holder) this.observer.observe(this.holder, content);\n } else {\n // Shadow mode: the host's children are only the source markup.\n this.observer.observe(this, content);\n }\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('items')) {\n this.propItems = this.items == null ? null : this.use(normalizeItems(this.items), 'items');\n }\n if (changed.has('itemsSrc') && this.fetchedFor !== this.itemsSrc) {\n this.fetched = null;\n this.fetchedFor = undefined;\n }\n const src = this.itemsSrc;\n // Fetch only when items-src is what would be shown. The result arrives asynchronously.\n if (src && !this.slotItems && !this.propItems && this.fetchedFor !== src) {\n this.fetchedFor = src;\n loadMainNavItems(src).then(\n (result) => {\n if (this.itemsSrc !== src) return;\n this.fetched = this.use(result, 'items-src');\n },\n (error: unknown) => {\n if (this.itemsSrc !== src) return;\n this.dispatchEvent(\n new CustomEvent('site-main-nav-error', {\n detail: { src, message: error instanceof Error ? error.message : String(error) },\n bubbles: true,\n composed: true,\n }),\n );\n },\n );\n }\n // A different menu: the open index would point at another group, so close it.\n const key = JSON.stringify(this.shown);\n if (this.shownKey !== undefined && key !== this.shownKey) this.open = null;\n this.shownKey = key;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has('open') || changed.has('layout')) {\n this.listenOutside(this.isConnected && this.open !== null && this.layout === 'bar');\n }\n }\n\n /** The items shown, by precedence. */\n private get shown(): readonly MainNavItem[] {\n return this.slotItems ?? this.propItems ?? this.fetched ?? MAIN_NAV_SNAPSHOT;\n }\n\n // --- behaviour ----------------------------------------------------------------------\n\n private get navEl(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>('nav.main-nav');\n }\n\n /** The top-level buttons and direct links, in order. */\n private get tops(): HTMLElement[] {\n const nav = this.navEl;\n return nav\n ? [...nav.querySelectorAll<HTMLElement>(':scope > ul > li > :is(.toggle, .top-link)')]\n : [];\n }\n\n private setOpen(index: number | null): void {\n this.open = index;\n }\n\n private onToggle(index: number): void {\n const opening = this.open !== index;\n this.setOpen(opening ? index : null);\n const label = this.shown[index]?.label;\n if (opening && label) trackEvent(this, ['site-main-nav', 'menu-open', label]);\n }\n\n private onOutsidePointer = (e: Event): void => {\n const nav = this.navEl;\n if (nav && !e.composedPath().includes(nav)) this.setOpen(null);\n };\n\n private listening = false;\n private listenOutside(on: boolean): void {\n if (on === this.listening) return;\n this.listening = on;\n const doc = this.ownerDocument;\n if (on) doc.addEventListener('pointerdown', this.onOutsidePointer, true);\n else doc.removeEventListener('pointerdown', this.onOutsidePointer, true);\n }\n\n private onFocusOut(e: FocusEvent): void {\n if (this.layout !== 'bar' || this.open === null) return;\n const to = e.relatedTarget as Node | null;\n // A null relatedTarget (a click on nothing focusable) is left to the pointerdown check.\n if (to && !this.navEl?.contains(to)) this.setOpen(null);\n }\n\n /** Arrow keys, Home and End over `nodes`, from `index` (as the live site's script does). */\n private move(e: KeyboardEvent, nodes: HTMLElement[], index: number): void {\n let to: number;\n switch (e.key) {\n case 'ArrowUp':\n case 'ArrowLeft':\n to = Math.max(0, index - 1);\n break;\n case 'ArrowDown':\n case 'ArrowRight':\n to = Math.min(nodes.length - 1, index + 1);\n break;\n case 'Home':\n to = 0;\n break;\n case 'End':\n to = nodes.length - 1;\n break;\n default:\n return;\n }\n e.preventDefault();\n nodes[to]?.focus();\n }\n\n private onKeyDown(e: KeyboardEvent): void {\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n const target = e.target as HTMLElement;\n const tops = this.tops;\n const top = tops.indexOf(target);\n const open = this.open;\n const openButton = open === null ? null : this.toggleAt(open);\n if (top >= 0) {\n if (e.key === 'Escape') {\n if (open === null) return; // nothing to close: let a surrounding popover handle it\n e.preventDefault();\n this.setOpen(null);\n } else if (e.key === 'ArrowDown' && openButton === target) {\n e.preventDefault();\n this.panelOf(openButton)?.querySelector<HTMLElement>('a')?.focus();\n } else {\n this.move(e, tops, top);\n }\n return;\n }\n const panel = target.closest('.panel');\n if (!panel || !openButton || this.panelOf(openButton) !== panel) return;\n if (e.key === 'Escape') {\n e.preventDefault();\n this.setOpen(null);\n openButton.focus();\n return;\n }\n const links = [...panel.querySelectorAll<HTMLElement>('a')];\n this.move(e, links, links.indexOf(target));\n }\n\n private toggleAt(index: number): HTMLElement | null {\n return (\n this.navEl?.querySelector<HTMLElement>(`[aria-controls=\"${this.panelId(index)}\"]`) ?? null\n );\n }\n\n /** A group button's panel: the list right after it, whose id it controls. */\n private panelOf(button: HTMLElement): HTMLElement | null {\n const next = button.nextElementSibling as HTMLElement | null;\n return next && next.id === button.getAttribute('aria-controls') ? next : null;\n }\n\n private panelId(index: number): string {\n return `${this.idBase}-${index}`;\n }\n\n // --- rendering ----------------------------------------------------------------------\n\n /** The one link to mark current: same host and path; then the same hash; then no hash. */\n private currentHref(hrefs: string[]): string | null {\n const here = this.current || this.ownerDocument.defaultView?.location.href || '';\n const base = this.ownerDocument.baseURI;\n const key = pageKey(here, base);\n if (!key) return null;\n const matches = hrefs.filter((h) => pageKey(h, base) === key);\n const hash = hashOf(here, base);\n return (\n matches.find((h) => hash && hashOf(h, base) === hash) ??\n matches.find((h) => !hashOf(h, base)) ??\n // Every match has a hash: with no hash of its own the page is theirs, so the first is\n // marked; a hash none of them has (a hash route the menu does not list) marks none.\n (hash ? null : matches[0]) ??\n null\n );\n }\n\n /** A link's href: fragment-only (`#…`) stays on this page; others go through siteLink. */\n private resolve(href: string): string {\n return href.startsWith('#') ? href : siteLink(this.rootLinkDomain, href);\n }\n\n /**\n * A plain click on a link closes the open group, so a single-page app that handles the\n * navigation in place does not leave the panel open. Modified clicks (a new tab or\n * window) keep it open.\n */\n private onClick(e: MouseEvent): void {\n const a = e.composedPath().find((n) => n instanceof HTMLAnchorElement);\n // Only the menu's own links (rendered here), never anything else on the click's path.\n if (a && this.renderRoot.contains(a)) {\n const text = (n: Node | null | undefined) =>\n (n?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n // `Group > Link` for a link in a group, the link alone for a top-level one.\n const group = text(a.closest('.panel')?.previousElementSibling);\n const label = text(a);\n if (label)\n trackEvent(this, ['site-main-nav', 'link-click', group ? `${group} > ${label}` : label]);\n }\n if (this.open === null || e.button !== 0) return;\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;\n if (e.composedPath().some((n) => n instanceof Element && n.localName === 'a')) {\n this.setOpen(null);\n }\n }\n\n render() {\n const items = this.shown.map((item) => ({\n label: item.label,\n href: item.items ? undefined : this.resolve(item.href!),\n items: item.items?.map((l) => ({ label: l.label, href: this.resolve(l.href) })),\n }));\n const all = items.flatMap((i) => (i.items ? i.items.map((l) => l.href) : [i.href!]));\n const current = this.currentHref(all);\n const mark = (href: string) => (href === current ? 'page' : undefined);\n let marked = false;\n return html`<nav\n class=\"main-nav ${this.layout === 'accordion' ? 'accordion' : 'bar'}\"\n aria-label=${this.label}\n @keydown=${this.onKeyDown}\n @focusout=${this.onFocusOut}\n @click=${this.onClick}\n >\n <ul>\n ${items.map((item, i) => {\n if (!item.items) {\n const cur = !marked && mark(item.href!);\n if (cur) marked = true;\n return html`<li>\n <a class=\"top-link\" href=${item.href!} aria-current=${ifDefined(cur || undefined)}\n >${item.label}</a\n >\n </li>`;\n }\n const id = this.panelId(i);\n const expanded = this.open === i;\n const has = !marked && item.items.some((l) => l.href === current);\n let linkMarked = false;\n if (has) marked = true;\n return html`<li>\n <button\n type=\"button\"\n class=\"toggle\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${id}\n aria-current=${ifDefined(has ? 'true' : undefined)}\n @click=${() => this.onToggle(i)}\n >\n ${item.label}\n </button>\n <ul class=\"panel\" id=${id} ?hidden=${!expanded}>\n ${item.items.map((l) => {\n const cur = has && !linkMarked && l.href === current;\n if (cur) linkMarked = true;\n return html`<li>\n <a href=${l.href} aria-current=${ifDefined(cur ? 'page' : undefined)}\n >${l.label}</a\n >\n </li>`;\n })}\n </ul>\n </li>`;\n })}\n </ul>\n </nav>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SiteMainNav } from './SiteMainNav.js';\n\ndefine('site-main-nav', SiteMainNav);\n"],"ignoreList":[0],"mappings":";;;;;AAKG,IAAMkB,KAAE,MAAGA,KAAGlB,GCsBXoB,KAAO,MAAwB,OAAOC,KAAM,WAAWA,EAAE,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK,IAAI;AAQ7F,SAAgBC,EAAe,GAA+B;CAC5D,IAAMC,IAAuB;EAAE,OAAO,CAAC;EAAG,SAAS;EAAO,WAAW;CAAM;CAC3E,IAAI,CAAC,MAAM,QAAQC,CAAG,GAEpB,OADA,EAAI,UAAUA,KAAO,MACdD;CAET,IAAME,KAAW,GAAkB,GAAqB,MAAwB;EAC9E,KAAK,IAAMnB,KAAKoB,GAAO;GACrB,IAAMR,IAAKZ,KAAK,CAAC,GACXqB,IAAQP,EAAIF,EAAE,KAAK,GACnBU,IAAOR,EAAIF,EAAE,IAAI,GACjBW,IAAO,MAAM,QAAQX,EAAE,KAAK,KAAKA,EAAE,MAAM,SAASA,EAAE,QAAQ;GAClE,AAAIW,KACF,EAAI,YAAY,IACZF,KAASC,KAAME,EAAK,KAAK;IAAE;IAAO;GAAK,CAAC,GAC5CL,EAAQI,GAAMC,GAAMC,IAAQ,CAAC,KACpBJ,KAASC,IAClBE,EAAK,KAAK;IAAE;IAAO;GAAK,CAAC,IAEzB,EAAI,UAAU;EAElB;CACF;CACA,KAAK,IAAMxB,KAAKkB,GAAK;EACnB,IAAMN,IAAKZ,KAAK,CAAC,GACXqB,IAAQP,EAAIF,EAAE,KAAK,GACnBU,IAAOR,EAAIF,EAAE,IAAI,GACjBW,IAAO,MAAM,QAAQX,EAAE,KAAK,KAAKA,EAAE,MAAM,SAASA,EAAE,QAAQ;EAClE,IAAI,CAACS,GACH,EAAI,UAAU;OACT,IAAIE,GAAM;GACf,IAAMG,IAAuB,CAAC;GAE9B,AADAP,EAAQI,GAAMG,GAAO,CAAC,GAClBA,EAAM,SAAQT,EAAI,M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