@internetarchive/collection-browser 3.3.2 → 3.3.4-alpha-webdev7761.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/index.d.ts +16 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/src/app-root.d.ts +105 -0
  13. package/dist/src/app-root.js +1076 -0
  14. package/dist/src/app-root.js.map +1 -0
  15. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -0
  16. package/dist/src/assets/img/icons/arrow-left.js +10 -0
  17. package/dist/src/assets/img/icons/arrow-left.js.map +1 -0
  18. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -0
  19. package/dist/src/assets/img/icons/arrow-right.js +10 -0
  20. package/dist/src/assets/img/icons/arrow-right.js.map +1 -0
  21. package/dist/src/assets/img/icons/chevron.d.ts +2 -0
  22. package/dist/src/assets/img/icons/chevron.js +4 -0
  23. package/dist/src/assets/img/icons/chevron.js.map +1 -0
  24. package/dist/src/assets/img/icons/close-circle-dark.d.ts +2 -0
  25. package/dist/src/assets/img/icons/close-circle-dark.js +5 -0
  26. package/dist/src/assets/img/icons/close-circle-dark.js.map +1 -0
  27. package/dist/src/assets/img/icons/contract.d.ts +2 -0
  28. package/dist/src/assets/img/icons/contract.js +9 -0
  29. package/dist/src/assets/img/icons/contract.js.map +1 -0
  30. package/dist/src/assets/img/icons/empty-query.d.ts +2 -0
  31. package/dist/src/assets/img/icons/empty-query.js +5 -0
  32. package/dist/src/assets/img/icons/empty-query.js.map +1 -0
  33. package/dist/src/assets/img/icons/expand.d.ts +2 -0
  34. package/dist/src/assets/img/icons/expand.js +9 -0
  35. package/dist/src/assets/img/icons/expand.js.map +1 -0
  36. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -0
  37. package/dist/src/assets/img/icons/eye-closed.js +5 -0
  38. package/dist/src/assets/img/icons/eye-closed.js.map +1 -0
  39. package/dist/src/assets/img/icons/eye.d.ts +2 -0
  40. package/dist/src/assets/img/icons/eye.js +5 -0
  41. package/dist/src/assets/img/icons/eye.js.map +1 -0
  42. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -0
  43. package/dist/src/assets/img/icons/favorite-filled.js +10 -0
  44. package/dist/src/assets/img/icons/favorite-filled.js.map +1 -0
  45. package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -0
  46. package/dist/src/assets/img/icons/favorite-unfilled.js +9 -0
  47. package/dist/src/assets/img/icons/favorite-unfilled.js.map +1 -0
  48. package/dist/src/assets/img/icons/filter.d.ts +2 -0
  49. package/dist/src/assets/img/icons/filter.js +10 -0
  50. package/dist/src/assets/img/icons/filter.js.map +1 -0
  51. package/dist/src/assets/img/icons/login-required.d.ts +1 -0
  52. package/dist/src/assets/img/icons/login-required.js +18 -0
  53. package/dist/src/assets/img/icons/login-required.js.map +1 -0
  54. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -0
  55. package/dist/src/assets/img/icons/mediatype/account.js +14 -0
  56. package/dist/src/assets/img/icons/mediatype/account.js.map +1 -0
  57. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -0
  58. package/dist/src/assets/img/icons/mediatype/audio.js +14 -0
  59. package/dist/src/assets/img/icons/mediatype/audio.js.map +1 -0
  60. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -0
  61. package/dist/src/assets/img/icons/mediatype/collection.js +12 -0
  62. package/dist/src/assets/img/icons/mediatype/collection.js.map +1 -0
  63. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -0
  64. package/dist/src/assets/img/icons/mediatype/data.js +15 -0
  65. package/dist/src/assets/img/icons/mediatype/data.js.map +1 -0
  66. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -0
  67. package/dist/src/assets/img/icons/mediatype/etree.js +14 -0
  68. package/dist/src/assets/img/icons/mediatype/etree.js.map +1 -0
  69. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -0
  70. package/dist/src/assets/img/icons/mediatype/film.js +14 -0
  71. package/dist/src/assets/img/icons/mediatype/film.js.map +1 -0
  72. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -0
  73. package/dist/src/assets/img/icons/mediatype/images.js +13 -0
  74. package/dist/src/assets/img/icons/mediatype/images.js.map +1 -0
  75. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -0
  76. package/dist/src/assets/img/icons/mediatype/radio.js +15 -0
  77. package/dist/src/assets/img/icons/mediatype/radio.js.map +1 -0
  78. package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -0
  79. package/dist/src/assets/img/icons/mediatype/search.js +14 -0
  80. package/dist/src/assets/img/icons/mediatype/search.js.map +1 -0
  81. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -0
  82. package/dist/src/assets/img/icons/mediatype/software.js +13 -0
  83. package/dist/src/assets/img/icons/mediatype/software.js.map +1 -0
  84. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -0
  85. package/dist/src/assets/img/icons/mediatype/texts.js +13 -0
  86. package/dist/src/assets/img/icons/mediatype/texts.js.map +1 -0
  87. package/dist/src/assets/img/icons/mediatype/tv-commercial.d.ts +1 -0
  88. package/dist/src/assets/img/icons/mediatype/tv-commercial.js +12 -0
  89. package/dist/src/assets/img/icons/mediatype/tv-commercial.js.map +1 -0
  90. package/dist/src/assets/img/icons/mediatype/tv-fact-check.d.ts +1 -0
  91. package/dist/src/assets/img/icons/mediatype/tv-fact-check.js +12 -0
  92. package/dist/src/assets/img/icons/mediatype/tv-fact-check.js.map +1 -0
  93. package/dist/src/assets/img/icons/mediatype/tv-quote.d.ts +1 -0
  94. package/dist/src/assets/img/icons/mediatype/tv-quote.js +12 -0
  95. package/dist/src/assets/img/icons/mediatype/tv-quote.js.map +1 -0
  96. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -0
  97. package/dist/src/assets/img/icons/mediatype/tv.js +14 -0
  98. package/dist/src/assets/img/icons/mediatype/tv.js.map +1 -0
  99. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -0
  100. package/dist/src/assets/img/icons/mediatype/video.js +14 -0
  101. package/dist/src/assets/img/icons/mediatype/video.js.map +1 -0
  102. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -0
  103. package/dist/src/assets/img/icons/mediatype/web.js +13 -0
  104. package/dist/src/assets/img/icons/mediatype/web.js.map +1 -0
  105. package/dist/src/assets/img/icons/null-result.d.ts +2 -0
  106. package/dist/src/assets/img/icons/null-result.js +5 -0
  107. package/dist/src/assets/img/icons/null-result.js.map +1 -0
  108. package/dist/src/assets/img/icons/quote.d.ts +1 -0
  109. package/dist/src/assets/img/icons/quote.js +7 -0
  110. package/dist/src/assets/img/icons/quote.js.map +1 -0
  111. package/dist/src/assets/img/icons/restricted.d.ts +1 -0
  112. package/dist/src/assets/img/icons/restricted.js +13 -0
  113. package/dist/src/assets/img/icons/restricted.js.map +1 -0
  114. package/dist/src/assets/img/icons/reviews.d.ts +1 -0
  115. package/dist/src/assets/img/icons/reviews.js +11 -0
  116. package/dist/src/assets/img/icons/reviews.js.map +1 -0
  117. package/dist/src/assets/img/icons/upload.d.ts +1 -0
  118. package/dist/src/assets/img/icons/upload.js +12 -0
  119. package/dist/src/assets/img/icons/upload.js.map +1 -0
  120. package/dist/src/assets/img/icons/views.d.ts +1 -0
  121. package/dist/src/assets/img/icons/views.js +11 -0
  122. package/dist/src/assets/img/icons/views.js.map +1 -0
  123. package/dist/src/circular-activity-indicator.d.ts +5 -0
  124. package/dist/src/circular-activity-indicator.js +66 -0
  125. package/dist/src/circular-activity-indicator.js.map +1 -0
  126. package/dist/src/collection-browser.d.ts +692 -0
  127. package/dist/src/collection-browser.js +2669 -0
  128. package/dist/src/collection-browser.js.map +1 -0
  129. package/dist/src/collection-facets/facet-row.d.ts +30 -0
  130. package/dist/src/collection-facets/facet-row.js +266 -0
  131. package/dist/src/collection-facets/facet-row.js.map +1 -0
  132. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -0
  133. package/dist/src/collection-facets/facet-tombstone-row.js +43 -0
  134. package/dist/src/collection-facets/facet-tombstone-row.js.map +1 -0
  135. package/dist/src/collection-facets/facets-template.d.ts +13 -0
  136. package/dist/src/collection-facets/facets-template.js +68 -0
  137. package/dist/src/collection-facets/facets-template.js.map +1 -0
  138. package/dist/src/collection-facets/models.d.ts +9 -0
  139. package/dist/src/collection-facets/models.js +10 -0
  140. package/dist/src/collection-facets/models.js.map +1 -0
  141. package/dist/src/collection-facets/more-facets-content.d.ts +109 -0
  142. package/dist/src/collection-facets/more-facets-content.js +547 -0
  143. package/dist/src/collection-facets/more-facets-content.js.map +1 -0
  144. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -0
  145. package/dist/src/collection-facets/more-facets-pagination.js +264 -0
  146. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -0
  147. package/dist/src/collection-facets/smart-facets/dedupe.d.ts +10 -0
  148. package/dist/src/collection-facets/smart-facets/dedupe.js +35 -0
  149. package/dist/src/collection-facets/smart-facets/dedupe.js.map +1 -0
  150. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.d.ts +5 -0
  151. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js +24 -0
  152. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js.map +1 -0
  153. package/dist/src/collection-facets/smart-facets/heuristics/index.d.ts +3 -0
  154. package/dist/src/collection-facets/smart-facets/heuristics/index.js +4 -0
  155. package/dist/src/collection-facets/smart-facets/heuristics/index.js.map +1 -0
  156. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.d.ts +4 -0
  157. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js +14 -0
  158. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js.map +1 -0
  159. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.d.ts +6 -0
  160. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js +68 -0
  161. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js.map +1 -0
  162. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.d.ts +9 -0
  163. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js +69 -0
  164. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js.map +1 -0
  165. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.d.ts +21 -0
  166. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +76 -0
  167. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -0
  168. package/dist/src/collection-facets/smart-facets/models.d.ts +30 -0
  169. package/dist/src/collection-facets/smart-facets/models.js +2 -0
  170. package/dist/src/collection-facets/smart-facets/models.js.map +1 -0
  171. package/dist/src/collection-facets/smart-facets/smart-facet-bar.d.ts +54 -0
  172. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +383 -0
  173. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -0
  174. package/dist/src/collection-facets/smart-facets/smart-facet-button.d.ts +11 -0
  175. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +133 -0
  176. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -0
  177. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.d.ts +28 -0
  178. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +172 -0
  179. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -0
  180. package/dist/src/collection-facets/smart-facets/smart-facet-equals.d.ts +2 -0
  181. package/dist/src/collection-facets/smart-facets/smart-facet-equals.js +13 -0
  182. package/dist/src/collection-facets/smart-facets/smart-facet-equals.js.map +1 -0
  183. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.d.ts +5 -0
  184. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +18 -0
  185. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -0
  186. package/dist/src/collection-facets/toggle-switch.d.ts +41 -0
  187. package/dist/src/collection-facets/toggle-switch.js +174 -0
  188. package/dist/src/collection-facets/toggle-switch.js.map +1 -0
  189. package/dist/src/collection-facets.d.ts +113 -0
  190. package/dist/src/collection-facets.js +884 -0
  191. package/dist/src/collection-facets.js.map +1 -0
  192. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +270 -0
  193. package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
  194. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
  195. package/dist/src/data-source/collection-browser-data-source.d.ts +418 -0
  196. package/dist/src/data-source/collection-browser-data-source.js +1121 -0
  197. package/dist/src/data-source/collection-browser-data-source.js.map +1 -0
  198. package/dist/src/data-source/collection-browser-query-state.d.ts +48 -0
  199. package/dist/src/data-source/collection-browser-query-state.js +2 -0
  200. package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
  201. package/dist/src/data-source/models.d.ts +43 -0
  202. package/dist/src/data-source/models.js +9 -0
  203. package/dist/src/data-source/models.js.map +1 -0
  204. package/dist/src/empty-placeholder.d.ts +23 -0
  205. package/dist/src/empty-placeholder.js +165 -0
  206. package/dist/src/empty-placeholder.js.map +1 -0
  207. package/dist/src/expanded-date-picker.d.ts +50 -0
  208. package/dist/src/expanded-date-picker.js +182 -0
  209. package/dist/src/expanded-date-picker.js.map +1 -0
  210. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -0
  211. package/dist/src/language-code-handler/language-code-handler.js +27 -0
  212. package/dist/src/language-code-handler/language-code-handler.js.map +1 -0
  213. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -0
  214. package/dist/src/language-code-handler/language-code-mapping.js +563 -0
  215. package/dist/src/language-code-handler/language-code-mapping.js.map +1 -0
  216. package/dist/src/manage/manage-bar.d.ts +58 -0
  217. package/dist/src/manage/manage-bar.js +237 -0
  218. package/dist/src/manage/manage-bar.js.map +1 -0
  219. package/dist/src/manage/remove-items-modal-content.d.ts +9 -0
  220. package/dist/src/manage/remove-items-modal-content.js +104 -0
  221. package/dist/src/manage/remove-items-modal-content.js.map +1 -0
  222. package/dist/src/mediatype/mediatype-config.d.ts +11 -0
  223. package/dist/src/mediatype/mediatype-config.js +116 -0
  224. package/dist/src/mediatype/mediatype-config.js.map +1 -0
  225. package/dist/src/models.d.ts +298 -0
  226. package/dist/src/models.js +507 -0
  227. package/dist/src/models.js.map +1 -0
  228. package/dist/src/restoration-state-handler.d.ts +74 -0
  229. package/dist/src/restoration-state-handler.js +397 -0
  230. package/dist/src/restoration-state-handler.js.map +1 -0
  231. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -0
  232. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +60 -0
  233. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -0
  234. package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -0
  235. package/dist/src/sort-filter-bar/alpha-bar.js +241 -0
  236. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -0
  237. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -0
  238. package/dist/src/sort-filter-bar/img/compact.js +5 -0
  239. package/dist/src/sort-filter-bar/img/compact.js.map +1 -0
  240. package/dist/src/sort-filter-bar/img/list.d.ts +1 -0
  241. package/dist/src/sort-filter-bar/img/list.js +5 -0
  242. package/dist/src/sort-filter-bar/img/list.js.map +1 -0
  243. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -0
  244. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +15 -0
  245. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js.map +1 -0
  246. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -0
  247. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +17 -0
  248. package/dist/src/sort-filter-bar/img/sort-toggle-down.js.map +1 -0
  249. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -0
  250. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +17 -0
  251. package/dist/src/sort-filter-bar/img/sort-toggle-up.js.map +1 -0
  252. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -0
  253. package/dist/src/sort-filter-bar/img/sort-triangle.js +5 -0
  254. package/dist/src/sort-filter-bar/img/sort-triangle.js.map +1 -0
  255. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -0
  256. package/dist/src/sort-filter-bar/img/tile.js +5 -0
  257. package/dist/src/sort-filter-bar/img/tile.js.map +1 -0
  258. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +278 -0
  259. package/dist/src/sort-filter-bar/sort-filter-bar.js +1161 -0
  260. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -0
  261. package/dist/src/styles/ia-button.d.ts +2 -0
  262. package/dist/src/styles/ia-button.js +134 -0
  263. package/dist/src/styles/ia-button.js.map +1 -0
  264. package/dist/src/styles/item-image-styles.d.ts +8 -0
  265. package/dist/src/styles/item-image-styles.js +123 -0
  266. package/dist/src/styles/item-image-styles.js.map +1 -0
  267. package/dist/src/styles/sr-only.d.ts +1 -0
  268. package/dist/src/styles/sr-only.js +18 -0
  269. package/dist/src/styles/sr-only.js.map +1 -0
  270. package/dist/src/tiles/base-tile-component.d.ts +27 -0
  271. package/dist/src/tiles/base-tile-component.js +82 -0
  272. package/dist/src/tiles/base-tile-component.js.map +1 -0
  273. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -0
  274. package/dist/src/tiles/collection-browser-loading-tile.js +29 -0
  275. package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -0
  276. package/dist/src/tiles/grid/account-tile.d.ts +18 -0
  277. package/dist/src/tiles/grid/account-tile.js +111 -0
  278. package/dist/src/tiles/grid/account-tile.js.map +1 -0
  279. package/dist/src/tiles/grid/collection-tile.d.ts +15 -0
  280. package/dist/src/tiles/grid/collection-tile.js +160 -0
  281. package/dist/src/tiles/grid/collection-tile.js.map +1 -0
  282. package/dist/src/tiles/grid/item-tile.d.ts +41 -0
  283. package/dist/src/tiles/grid/item-tile.js +321 -0
  284. package/dist/src/tiles/grid/item-tile.js.map +1 -0
  285. package/dist/src/tiles/grid/search-tile.d.ts +10 -0
  286. package/dist/src/tiles/grid/search-tile.js +95 -0
  287. package/dist/src/tiles/grid/search-tile.js.map +1 -0
  288. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -0
  289. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +128 -0
  290. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -0
  291. package/dist/src/tiles/grid/tile-stats.d.ts +58 -0
  292. package/dist/src/tiles/grid/tile-stats.js +204 -0
  293. package/dist/src/tiles/grid/tile-stats.js.map +1 -0
  294. package/dist/src/tiles/hover/hover-pane-controller.d.ts +228 -0
  295. package/dist/src/tiles/hover/hover-pane-controller.js +446 -0
  296. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -0
  297. package/dist/src/tiles/hover/tile-hover-pane.d.ts +20 -0
  298. package/dist/src/tiles/hover/tile-hover-pane.js +185 -0
  299. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -0
  300. package/dist/src/tiles/image-block.d.ts +19 -0
  301. package/dist/src/tiles/image-block.js +175 -0
  302. package/dist/src/tiles/image-block.js.map +1 -0
  303. package/dist/src/tiles/item-image.d.ts +40 -0
  304. package/dist/src/tiles/item-image.js +191 -0
  305. package/dist/src/tiles/item-image.js.map +1 -0
  306. package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -0
  307. package/dist/src/tiles/list/tile-list-compact-header.js +85 -0
  308. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -0
  309. package/dist/src/tiles/list/tile-list-compact.d.ts +19 -0
  310. package/dist/src/tiles/list/tile-list-compact.js +223 -0
  311. package/dist/src/tiles/list/tile-list-compact.js.map +1 -0
  312. package/dist/src/tiles/list/tile-list.d.ts +54 -0
  313. package/dist/src/tiles/list/tile-list.js +621 -0
  314. package/dist/src/tiles/list/tile-list.js.map +1 -0
  315. package/dist/src/tiles/models.d.ts +1 -0
  316. package/dist/src/tiles/models.js +2 -0
  317. package/dist/src/tiles/models.js.map +1 -0
  318. package/dist/src/tiles/overlay/icon-overlay.d.ts +8 -0
  319. package/dist/src/tiles/overlay/icon-overlay.js +55 -0
  320. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -0
  321. package/dist/src/tiles/overlay/text-overlay.d.ts +9 -0
  322. package/dist/src/tiles/overlay/text-overlay.js +74 -0
  323. package/dist/src/tiles/overlay/text-overlay.js.map +1 -0
  324. package/dist/src/tiles/review-block.d.ts +12 -0
  325. package/dist/src/tiles/review-block.js +134 -0
  326. package/dist/src/tiles/review-block.js.map +1 -0
  327. package/dist/src/tiles/text-snippet-block.d.ts +27 -0
  328. package/dist/src/tiles/text-snippet-block.js +132 -0
  329. package/dist/src/tiles/text-snippet-block.js.map +1 -0
  330. package/dist/src/tiles/tile-dispatcher.d.ts +71 -0
  331. package/dist/src/tiles/tile-dispatcher.js +472 -0
  332. package/dist/src/tiles/tile-dispatcher.js.map +1 -0
  333. package/dist/src/tiles/tile-display-value-provider.d.ts +47 -0
  334. package/dist/src/tiles/tile-display-value-provider.js +95 -0
  335. package/dist/src/tiles/tile-display-value-provider.js.map +1 -0
  336. package/dist/src/tiles/tile-mediatype-icon.d.ts +27 -0
  337. package/dist/src/tiles/tile-mediatype-icon.js +130 -0
  338. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -0
  339. package/dist/src/utils/analytics-events.d.ts +28 -0
  340. package/dist/src/utils/analytics-events.js +31 -0
  341. package/dist/src/utils/analytics-events.js.map +1 -0
  342. package/dist/src/utils/array-equals.d.ts +4 -0
  343. package/dist/src/utils/array-equals.js +11 -0
  344. package/dist/src/utils/array-equals.js.map +1 -0
  345. package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -0
  346. package/dist/src/utils/collapse-repeated-quotes.js +14 -0
  347. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -0
  348. package/dist/src/utils/facet-utils.d.ts +83 -0
  349. package/dist/src/utils/facet-utils.js +152 -0
  350. package/dist/src/utils/facet-utils.js.map +1 -0
  351. package/dist/src/utils/format-count.d.ts +7 -0
  352. package/dist/src/utils/format-count.js +76 -0
  353. package/dist/src/utils/format-count.js.map +1 -0
  354. package/dist/src/utils/format-date.d.ts +16 -0
  355. package/dist/src/utils/format-date.js +33 -0
  356. package/dist/src/utils/format-date.js.map +1 -0
  357. package/dist/src/utils/format-unit-size.d.ts +2 -0
  358. package/dist/src/utils/format-unit-size.js +34 -0
  359. package/dist/src/utils/format-unit-size.js.map +1 -0
  360. package/dist/src/utils/local-date-from-utc.d.ts +9 -0
  361. package/dist/src/utils/local-date-from-utc.js +16 -0
  362. package/dist/src/utils/local-date-from-utc.js.map +1 -0
  363. package/dist/src/utils/log.d.ts +7 -0
  364. package/dist/src/utils/log.js +14 -0
  365. package/dist/src/utils/log.js.map +1 -0
  366. package/dist/src/utils/resolve-mediatype.d.ts +8 -0
  367. package/dist/src/utils/resolve-mediatype.js +24 -0
  368. package/dist/src/utils/resolve-mediatype.js.map +1 -0
  369. package/dist/src/utils/sha1.d.ts +2 -0
  370. package/dist/src/utils/sha1.js +9 -0
  371. package/dist/src/utils/sha1.js.map +1 -0
  372. package/dist/test/collection-browser.test.d.ts +1 -0
  373. package/dist/test/collection-browser.test.js +1721 -0
  374. package/dist/test/collection-browser.test.js.map +1 -0
  375. package/dist/test/collection-facets/facet-row.test.d.ts +1 -0
  376. package/dist/test/collection-facets/facet-row.test.js +274 -0
  377. package/dist/test/collection-facets/facet-row.test.js.map +1 -0
  378. package/dist/test/collection-facets/facets-template.test.d.ts +1 -0
  379. package/dist/test/collection-facets/facets-template.test.js +101 -0
  380. package/dist/test/collection-facets/facets-template.test.js.map +1 -0
  381. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -0
  382. package/dist/test/collection-facets/more-facets-content.test.js +169 -0
  383. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -0
  384. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -0
  385. package/dist/test/collection-facets/more-facets-pagination.test.js +132 -0
  386. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -0
  387. package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -0
  388. package/dist/test/collection-facets/toggle-switch.test.js +96 -0
  389. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -0
  390. package/dist/test/collection-facets.test.d.ts +2 -0
  391. package/dist/test/collection-facets.test.js +745 -0
  392. package/dist/test/collection-facets.test.js.map +1 -0
  393. package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -0
  394. package/dist/test/data-source/collection-browser-data-source.test.js +102 -0
  395. package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -0
  396. package/dist/test/empty-placeholder.test.d.ts +1 -0
  397. package/dist/test/empty-placeholder.test.js +63 -0
  398. package/dist/test/empty-placeholder.test.js.map +1 -0
  399. package/dist/test/expanded-date-picker.test.d.ts +1 -0
  400. package/dist/test/expanded-date-picker.test.js +130 -0
  401. package/dist/test/expanded-date-picker.test.js.map +1 -0
  402. package/dist/test/icon-overlay.test.d.ts +1 -0
  403. package/dist/test/icon-overlay.test.js +30 -0
  404. package/dist/test/icon-overlay.test.js.map +1 -0
  405. package/dist/test/image-block.test.d.ts +1 -0
  406. package/dist/test/image-block.test.js +218 -0
  407. package/dist/test/image-block.test.js.map +1 -0
  408. package/dist/test/item-image.test.d.ts +1 -0
  409. package/dist/test/item-image.test.js +196 -0
  410. package/dist/test/item-image.test.js.map +1 -0
  411. package/dist/test/manage/manage-bar.test.d.ts +2 -0
  412. package/dist/test/manage/manage-bar.test.js +106 -0
  413. package/dist/test/manage/manage-bar.test.js.map +1 -0
  414. package/dist/test/manage/remove-items-modal-content.test.d.ts +1 -0
  415. package/dist/test/manage/remove-items-modal-content.test.js +65 -0
  416. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -0
  417. package/dist/test/mediatype-config.test.d.ts +1 -0
  418. package/dist/test/mediatype-config.test.js +11 -0
  419. package/dist/test/mediatype-config.test.js.map +1 -0
  420. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -0
  421. package/dist/test/mocks/mock-analytics-handler.js +16 -0
  422. package/dist/test/mocks/mock-analytics-handler.js.map +1 -0
  423. package/dist/test/mocks/mock-search-responses.d.ts +31 -0
  424. package/dist/test/mocks/mock-search-responses.js +1241 -0
  425. package/dist/test/mocks/mock-search-responses.js.map +1 -0
  426. package/dist/test/mocks/mock-search-service.d.ts +16 -0
  427. package/dist/test/mocks/mock-search-service.js +65 -0
  428. package/dist/test/mocks/mock-search-service.js.map +1 -0
  429. package/dist/test/restoration-state-handler.test.d.ts +1 -0
  430. package/dist/test/restoration-state-handler.test.js +343 -0
  431. package/dist/test/restoration-state-handler.test.js.map +1 -0
  432. package/dist/test/review-block.test.d.ts +1 -0
  433. package/dist/test/review-block.test.js +48 -0
  434. package/dist/test/review-block.test.js.map +1 -0
  435. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -0
  436. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +13 -0
  437. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -0
  438. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -0
  439. package/dist/test/sort-filter-bar/alpha-bar.test.js +74 -0
  440. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -0
  441. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -0
  442. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +609 -0
  443. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -0
  444. package/dist/test/text-overlay.test.d.ts +1 -0
  445. package/dist/test/text-overlay.test.js +42 -0
  446. package/dist/test/text-overlay.test.js.map +1 -0
  447. package/dist/test/text-snippet-block.test.d.ts +1 -0
  448. package/dist/test/text-snippet-block.test.js +63 -0
  449. package/dist/test/text-snippet-block.test.js.map +1 -0
  450. package/dist/test/tile-stats.test.d.ts +1 -0
  451. package/dist/test/tile-stats.test.js +128 -0
  452. package/dist/test/tile-stats.test.js.map +1 -0
  453. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -0
  454. package/dist/test/tiles/grid/account-tile.test.js +96 -0
  455. package/dist/test/tiles/grid/account-tile.test.js.map +1 -0
  456. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -0
  457. package/dist/test/tiles/grid/collection-tile.test.js +96 -0
  458. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -0
  459. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -0
  460. package/dist/test/tiles/grid/item-tile.test.js +427 -0
  461. package/dist/test/tiles/grid/item-tile.test.js.map +1 -0
  462. package/dist/test/tiles/grid/search-tile.test.d.ts +1 -0
  463. package/dist/test/tiles/grid/search-tile.test.js +66 -0
  464. package/dist/test/tiles/grid/search-tile.test.js.map +1 -0
  465. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -0
  466. package/dist/test/tiles/hover/hover-pane-controller.test.js +329 -0
  467. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -0
  468. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -0
  469. package/dist/test/tiles/hover/tile-hover-pane.test.js +57 -0
  470. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -0
  471. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -0
  472. package/dist/test/tiles/list/tile-list-compact.test.js +251 -0
  473. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -0
  474. package/dist/test/tiles/list/tile-list.test.d.ts +1 -0
  475. package/dist/test/tiles/list/tile-list.test.js +469 -0
  476. package/dist/test/tiles/list/tile-list.test.js.map +1 -0
  477. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -0
  478. package/dist/test/tiles/tile-dispatcher.test.js +231 -0
  479. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -0
  480. package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -0
  481. package/dist/test/tiles/tile-display-value-provider.test.js +142 -0
  482. package/dist/test/tiles/tile-display-value-provider.test.js.map +1 -0
  483. package/dist/test/tiles/tile-mediatype-icon.test.d.ts +1 -0
  484. package/dist/test/tiles/tile-mediatype-icon.test.js +145 -0
  485. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -0
  486. package/dist/test/utils/array-equals.test.d.ts +1 -0
  487. package/dist/test/utils/array-equals.test.js +27 -0
  488. package/dist/test/utils/array-equals.test.js.map +1 -0
  489. package/dist/test/utils/format-count.test.d.ts +1 -0
  490. package/dist/test/utils/format-count.test.js +24 -0
  491. package/dist/test/utils/format-count.test.js.map +1 -0
  492. package/dist/test/utils/format-date.test.d.ts +1 -0
  493. package/dist/test/utils/format-date.test.js +61 -0
  494. package/dist/test/utils/format-date.test.js.map +1 -0
  495. package/dist/test/utils/format-unit-size.test.d.ts +1 -0
  496. package/dist/test/utils/format-unit-size.test.js +18 -0
  497. package/dist/test/utils/format-unit-size.test.js.map +1 -0
  498. package/dist/test/utils/local-date-from-utc.test.d.ts +1 -0
  499. package/dist/test/utils/local-date-from-utc.test.js +27 -0
  500. package/dist/test/utils/local-date-from-utc.test.js.map +1 -0
  501. package/eslint.config.mjs +53 -53
  502. package/index.html +24 -24
  503. package/local.archive.org.cert +86 -86
  504. package/local.archive.org.key +27 -27
  505. package/package.json +118 -117
  506. package/renovate.json +6 -6
  507. package/src/collection-browser.ts +2954 -2829
  508. package/src/collection-facets/facet-row.ts +299 -296
  509. package/src/collection-facets/models.ts +10 -10
  510. package/src/collection-facets/more-facets-content.ts +639 -639
  511. package/src/collection-facets.ts +1005 -995
  512. package/src/data-source/collection-browser-data-source-interface.ts +345 -333
  513. package/src/data-source/collection-browser-data-source.ts +1441 -1401
  514. package/src/data-source/collection-browser-query-state.ts +59 -65
  515. package/src/data-source/models.ts +56 -43
  516. package/src/manage/manage-bar.ts +247 -247
  517. package/src/models.ts +866 -870
  518. package/src/restoration-state-handler.ts +542 -544
  519. package/src/tiles/base-tile-component.ts +65 -65
  520. package/src/tiles/grid/account-tile.ts +113 -113
  521. package/src/tiles/grid/collection-tile.ts +163 -163
  522. package/src/tiles/grid/item-tile.ts +340 -340
  523. package/src/tiles/grid/search-tile.ts +90 -90
  524. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  525. package/src/tiles/hover/hover-pane-controller.ts +613 -517
  526. package/src/tiles/hover/tile-hover-pane.ts +184 -180
  527. package/src/tiles/list/tile-list-compact.ts +239 -239
  528. package/src/tiles/list/tile-list.ts +700 -700
  529. package/src/tiles/tile-dispatcher.ts +517 -490
  530. package/src/utils/format-date.ts +62 -62
  531. package/test/collection-browser.test.ts +2413 -2403
  532. package/test/collection-facets/facet-row.test.ts +375 -375
  533. package/test/collection-facets.test.ts +928 -928
  534. package/test/restoration-state-handler.test.ts +480 -510
  535. package/test/tiles/grid/item-tile.test.ts +520 -520
  536. package/test/tiles/hover/hover-pane-controller.test.ts +418 -353
  537. package/test/tiles/list/tile-list-compact.test.ts +282 -282
  538. package/test/tiles/list/tile-list.test.ts +552 -552
  539. package/test/tiles/tile-dispatcher.test.ts +283 -187
  540. package/test/utils/format-date.test.ts +89 -89
  541. package/tsconfig.json +20 -20
  542. package/web-dev-server.config.mjs +30 -30
  543. package/web-test-runner.config.mjs +41 -41
@@ -0,0 +1,2669 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, css, LitElement, nothing, } from 'lit';
3
+ import { customElement, property, query, state } from 'lit/decorators.js';
4
+ import { map } from 'lit/directives/map.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+ import { msg } from '@lit/localize';
7
+ import { SearchType, } from '@internetarchive/search-service';
8
+ import '@internetarchive/infinite-scroller';
9
+ import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, defaultFacetDisplayOrder, tvFacetDisplayOrder, defaultSortAvailability, favoritesSortAvailability, tvSortAvailability, } from './models';
10
+ import { RestorationStateHandler, } from './restoration-state-handler';
11
+ import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
+ import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
13
+ import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
14
+ import chevronIcon from './assets/img/icons/chevron';
15
+ import { srOnlyStyle } from './styles/sr-only';
16
+ import { sha1 } from './utils/sha1';
17
+ import { log } from './utils/log';
18
+ import './empty-placeholder';
19
+ import './tiles/tile-dispatcher';
20
+ import './tiles/collection-browser-loading-tile';
21
+ import './sort-filter-bar/sort-filter-bar';
22
+ import './manage/manage-bar';
23
+ import './collection-facets';
24
+ import './circular-activity-indicator';
25
+ import './collection-facets/smart-facets/smart-facet-bar';
26
+ import { mergeSelectedFacets, updateSelectedFacetBucket, } from './utils/facet-utils';
27
+ let CollectionBrowser = class CollectionBrowser extends LitElement {
28
+ constructor() {
29
+ super();
30
+ this.baseImageUrl = 'https://archive.org';
31
+ /**
32
+ * Which backend should be targeted by searches (e.g., metadata or FTS)
33
+ */
34
+ this.searchType = SearchType.DEFAULT;
35
+ this.selectedSort = SortField.default;
36
+ this.selectedTitleFilter = null;
37
+ this.selectedCreatorFilter = null;
38
+ this.sortDirection = null;
39
+ this.defaultSortField = SortField.relevance;
40
+ this.defaultSortDirection = null;
41
+ this.pageSize = 50;
42
+ /**
43
+ * Whether to show smart facets (bubbles) along the top of the component
44
+ */
45
+ this.showSmartFacetBar = false;
46
+ /**
47
+ * Whether to show the date picker (above the facets)
48
+ */
49
+ this.showHistogramDatePicker = false;
50
+ /**
51
+ * Whether placeholder views should be suppressed. If true, searches that produce an
52
+ * error or empty result set will simply show a blank results view instead of a placeholder.
53
+ */
54
+ this.suppressPlaceholders = false;
55
+ /**
56
+ * Whether the result count text should be suppressed.
57
+ * If true, no "X Results" message will be shown.
58
+ */
59
+ this.suppressResultCount = false;
60
+ /**
61
+ * Whether the scrolling result view should be suppressed entirely.
62
+ * If true, no infinite scroller (and thus no result tiles) will be rendered.
63
+ */
64
+ this.suppressResultTiles = false;
65
+ /**
66
+ * Whether to suppress persistence of the query to the URL.
67
+ * If true, the `query` param will not be added to the URL or updated on query changes.
68
+ */
69
+ this.suppressURLQuery = false;
70
+ /**
71
+ * Whether to suppress persistence of the `sin` search type param to the URL.
72
+ * If true, the `sin` param will not be added to the URL or updated on query changes.
73
+ */
74
+ this.suppressURLSinParam = false;
75
+ /**
76
+ * Whether to suppress display of the sort bar.
77
+ * If true, the entire sort bar (incl. display modes) will be omitted from rendering.
78
+ */
79
+ this.suppressSortBar = false;
80
+ /**
81
+ * Whether to suppress showing the display mode options in the sort bar.
82
+ * If true, those options will be omitted (though the rest of the sort bar may still render).
83
+ */
84
+ this.suppressDisplayModes = false;
85
+ /**
86
+ * Whether to suppress the display of the `mediatype` facet group, e.g., because this instance
87
+ * of collection browser is being shown in a filtered single-mediatype context.
88
+ */
89
+ this.suppressMediatypeFacets = false;
90
+ /**
91
+ * What strategy to use for when/whether to load facet data for a search.
92
+ *
93
+ * Defaults to `eager`, always loading facets immediately alongside search results.
94
+ *
95
+ * To eliminate facets that are never seen, this can be reduced to `lazy-mobile`, which
96
+ * will delay loading facets in the mobile view until the "Filters" accordion is opened.
97
+ * Facets are still loaded eagerly when viewing the desktop layout.
98
+ *
99
+ * To further reduce facet requests for patrons who do not need to use them, this can be
100
+ * again reduced to `opt-in`, which will also require desktop users to explicitly request
101
+ * that they be loaded (in addition to the lazy mobile behavior described above).
102
+ *
103
+ * To entirely suppress facets from being loaded, this may be set to `off`.
104
+ */
105
+ this.facetLoadStrategy = 'eager';
106
+ this.facetPaneVisible = false;
107
+ this.clearResultsOnEmptyQuery = false;
108
+ this.collectionPagePath = '/details/';
109
+ /** describes where this component is being used */
110
+ this.searchContext = analyticsCategories.default;
111
+ this.pageContext = 'search';
112
+ this.restorationStateHandler = new RestorationStateHandler({
113
+ context: this.pageContext,
114
+ });
115
+ this.mobileBreakpoint = 600;
116
+ this.loggedIn = false;
117
+ this.modalManager = undefined;
118
+ /**
119
+ * Whether we are representing a TV collection, needing slightly different tile handling.
120
+ */
121
+ this.isTVCollection = false;
122
+ /**
123
+ * If item management UI active
124
+ */
125
+ this.isManageView = false;
126
+ this.manageViewLabel = 'Select items to remove';
127
+ /** Whether to replace the default sort options with a slot for customization (default: false) */
128
+ this.enableSortOptionsSlot = false;
129
+ /** Whether to expose a slot for a smart results carousel above the full results */
130
+ this.showSmartResults = false;
131
+ /**
132
+ * The maximum number of pages we will load when a privileged user clicks
133
+ * the "Manage" button on the search page. Limited to 15 pages.
134
+ */
135
+ this.maxPagesToManage = 15;
136
+ /**
137
+ * The results per page so we can paginate.
138
+ *
139
+ * This allows us to start in the middle of the search results and
140
+ * fetch data before or after the current page. If we don't have a key
141
+ * for the previous/next page, we'll fetch the next/previous page to populate it
142
+ */
143
+ this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
144
+ /**
145
+ * The page that the consumer wants to load.
146
+ */
147
+ this.initialPageNumber = 1;
148
+ /**
149
+ * This the the number of pages that we want to show.
150
+ *
151
+ * The data isn't necessarily loaded for all of the pages, but this lets us
152
+ * know how many cells we should render.
153
+ */
154
+ this.pagesToRender = this.initialPageNumber;
155
+ /**
156
+ * Whether the initial page fetch for a new query is currently in progress.
157
+ */
158
+ this.searchResultsLoading = false;
159
+ this.facetsLoading = false;
160
+ this.mobileView = false;
161
+ /**
162
+ * Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
163
+ * have chosen to override it, or `no-override` if they have not.
164
+ */
165
+ this.tileBlurOverrideState = 'no-override';
166
+ this.collapsibleFacetsVisible = false;
167
+ this.placeholderType = null;
168
+ /** Whether layout size analytics have been sent already. */
169
+ this.layoutSizeAnalyticsSent = false;
170
+ /**
171
+ * When we're animated scrolling to the page, we don't want to fetch
172
+ * all of the pages as it scrolls so this lets us know if we're scrolling
173
+ */
174
+ this.isScrollingToCell = false;
175
+ /**
176
+ * When page width resizes from desktop to mobile, set true to
177
+ * disable expand/collapse transition when loading.
178
+ */
179
+ this.isResizeToMobile = false;
180
+ /**
181
+ * Flag indicating that a new data source is currently being installed.
182
+ * During the install, any URL persistence operation should replace the current entry
183
+ * instead of creating a new one.
184
+ */
185
+ this.dataSourceInstallInProgress = false;
186
+ this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
187
+ this.selectedTVNetwork = undefined;
188
+ this.selectedTVShow = undefined;
189
+ /**
190
+ * Updates the height of the left column according to its position on the page.
191
+ * Arrow function ensures proper `this` binding.
192
+ */
193
+ this.updateLeftColumnHeight = () => {
194
+ var _a, _b, _c, _d, _e;
195
+ if (this.mobileView) {
196
+ (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
197
+ }
198
+ else {
199
+ const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
200
+ const columnHeight = window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0);
201
+ const cssHeightValue = clientTop === 0
202
+ ? null
203
+ : // Subtract off the column's top padding so that it doesn't overflow
204
+ `calc(${columnHeight}px - var(--leftColumnPaddingTop, 2rem))`;
205
+ (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', cssHeightValue);
206
+ }
207
+ };
208
+ /**
209
+ * Toggles whether the fade-out is visible at the bottom of the facets.
210
+ * It should only be visible if the facets are not scrolled to the bottom.
211
+ * Arrow function ensures proper `this` binding.
212
+ */
213
+ this.updateFacetFadeOut = (entries) => {
214
+ var _a, _b;
215
+ const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
216
+ fadeElmt === null || fadeElmt === void 0 ? void 0 : fadeElmt.classList.toggle('hidden', (_b = entries === null || entries === void 0 ? void 0 : entries[0]) === null || _b === void 0 ? void 0 : _b.isIntersecting);
217
+ };
218
+ // we only want to scroll on the very first query change
219
+ // so this keeps track of whether we've already set the initial query
220
+ this.initialQueryChangeHappened = false;
221
+ this.historyPopOccurred = false;
222
+ this.addController(this.dataSource);
223
+ }
224
+ tileModelAtCellIndex(index) {
225
+ const model = this.dataSource.getTileModelAt(index);
226
+ /**
227
+ * If we encounter a model we don't have yet and we're not in the middle of an
228
+ * automated scroll, fetch the page and just return undefined.
229
+ * The datasource will be updated once the page is loaded and the cell will be rendered.
230
+ *
231
+ * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
232
+ * user may never see.
233
+ */
234
+ if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
235
+ const pageNumber = Math.floor(index / this.pageSize) + 1;
236
+ this.dataSource.fetchPage(pageNumber);
237
+ }
238
+ return model;
239
+ }
240
+ // this is the total number of tiles we expect if
241
+ // the data returned is a full page worth
242
+ // this is useful for putting in placeholders for the expected number of tiles
243
+ get estimatedTileCount() {
244
+ return this.pagesToRender * this.pageSize;
245
+ }
246
+ /**
247
+ * Returns a promise resolving to a unique string that persists for the current browser session.
248
+ * Used in generating unique IDs for search requests, so that multiple requests coming from the
249
+ * same browser session can be identified.
250
+ */
251
+ async getSessionId() {
252
+ try {
253
+ const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
254
+ if (storedSessionId) {
255
+ return storedSessionId;
256
+ }
257
+ // If we enter this method a second time while a first session ID is already being generated,
258
+ // ensure we produce the same ID from both calls instead of generating another one.
259
+ if (this.sessionIdGenPromise) {
260
+ return this.sessionIdGenPromise;
261
+ }
262
+ this.sessionIdGenPromise = sha1(Math.random().toString());
263
+ const newSessionId = await this.sessionIdGenPromise;
264
+ sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
265
+ return newSessionId;
266
+ }
267
+ catch (_a) {
268
+ // Either we can't generate the hash or we're restricted from accessing sessionStorage
269
+ return '';
270
+ }
271
+ }
272
+ /**
273
+ * Go to the given page of results
274
+ *
275
+ * @param pageNumber
276
+ */
277
+ goToPage(pageNumber) {
278
+ this.initialPageNumber = pageNumber;
279
+ this.pagesToRender = pageNumber;
280
+ return this.scrollToPage(pageNumber);
281
+ }
282
+ /**
283
+ * Sets the state for whether the initial set of search results is loading in.
284
+ */
285
+ setSearchResultsLoading(loading) {
286
+ this.searchResultsLoading = loading;
287
+ }
288
+ /**
289
+ * Sets the state for whether facet data is loading in
290
+ */
291
+ setFacetsLoading(loading) {
292
+ this.facetsLoading = loading;
293
+ }
294
+ /**
295
+ * Sets the total number of results to be displayed for the current search
296
+ */
297
+ setTotalResultCount(totalResults) {
298
+ this.totalResults = totalResults;
299
+ }
300
+ /**
301
+ * Clears all selected/negated facets, date ranges, and letter filters.
302
+ *
303
+ * By default, the current sort field/direction are not cleared,
304
+ * but this can be overridden by setting the `sort` option to `true`.
305
+ *
306
+ * Similarly, it is possible to finely control what is cleared by
307
+ * setting any of the `facets`, `dateRange`, or `letterFilters` flags
308
+ * in the options object.
309
+ */
310
+ clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
311
+ // Don't bother clearing facets if none are checked, so that we don't
312
+ // trigger unnecessary update cycles.
313
+ if (facets && this.hasCheckedFacets) {
314
+ this.selectedFacets = getDefaultSelectedFacets();
315
+ }
316
+ if (dateRange) {
317
+ this.minSelectedDate = undefined;
318
+ this.maxSelectedDate = undefined;
319
+ }
320
+ if (letterFilters) {
321
+ this.selectedTitleFilter = null;
322
+ this.selectedCreatorFilter = null;
323
+ }
324
+ if (sort) {
325
+ this.sortDirection = null;
326
+ this.selectedSort = SortField.default;
327
+ }
328
+ if (this.smartFacetBar) {
329
+ this.smartFacetBar.deselectAll();
330
+ }
331
+ }
332
+ /**
333
+ * Returns true if the current value of `this.selectedFacets` contains
334
+ * any facet buckets than have been selected or negated, or false otherwise.
335
+ */
336
+ get hasCheckedFacets() {
337
+ if (!this.selectedFacets)
338
+ return false;
339
+ for (const facetGroup of Object.values(this.selectedFacets)) {
340
+ for (const bucket of Object.values(facetGroup)) {
341
+ if (bucket.state !== 'none')
342
+ return true;
343
+ }
344
+ }
345
+ return false;
346
+ }
347
+ /**
348
+ * Returns true if there are any currently selected/negated facet buckets,
349
+ * any selected date range, or any selected letter filters. False otherwise.
350
+ *
351
+ * Ignores sorting options.
352
+ */
353
+ get hasActiveFilters() {
354
+ return !!(this.hasCheckedFacets ||
355
+ this.minSelectedDate ||
356
+ this.maxSelectedDate ||
357
+ this.selectedTitleFilter ||
358
+ this.selectedCreatorFilter);
359
+ }
360
+ willUpdate() {
361
+ this.setPlaceholderType();
362
+ }
363
+ render() {
364
+ return html `
365
+ ${this.showSmartFacetBar && this.placeholderType === null
366
+ ? html `<smart-facet-bar
367
+ .query=${this.baseQuery}
368
+ .aggregations=${this.dataSource.aggregations}
369
+ .selectedFacets=${this.selectedFacets}
370
+ .collectionTitles=${this.dataSource.collectionTitles}
371
+ .filterToggleShown=${!this.mobileView}
372
+ .filterToggleActive=${this.facetPaneVisible}
373
+ .label=${this.smartFacetBarLabel}
374
+ @facetsChanged=${this.facetsChanged}
375
+ @filtersToggled=${() => {
376
+ this.facetPaneVisible = !this.facetPaneVisible;
377
+ this.emitFacetPaneVisibilityChanged();
378
+ }}
379
+ ></smart-facet-bar>`
380
+ : nothing}
381
+
382
+ <div
383
+ id="content-container"
384
+ class=${this.mobileView ? 'mobile' : 'desktop'}
385
+ >
386
+ ${this.placeholderType
387
+ ? this.emptyPlaceholderTemplate
388
+ : this.collectionBrowserTemplate}
389
+ </div>
390
+ `;
391
+ }
392
+ /**
393
+ * Determines what type of placeholder content should be shown instead of result tiles, if applicable.
394
+ * The placeholders indicate states where we have no results to show, which could be the result of:
395
+ * - No query is set (on the search page)
396
+ * - No results were returned for the most recent search
397
+ * - The collection being searched within has no viewable items
398
+ * - An error occurred on the most recent search attempt
399
+ */
400
+ setPlaceholderType() {
401
+ var _a, _b;
402
+ const isInitialized = this.dataSource.queryInitialized;
403
+ const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
404
+ const hasIdentifiers = !!((_b = this.identifiers) === null || _b === void 0 ? void 0 : _b.length);
405
+ const isCollection = !!this.withinCollection;
406
+ const isProfile = !!this.withinProfile;
407
+ const isSearchResults = !isCollection && !isProfile;
408
+ const noResults = !this.searchResultsLoading &&
409
+ (this.dataSource.size === 0 || !this.searchService);
410
+ this.placeholderType = null;
411
+ if (this.suppressPlaceholders)
412
+ return;
413
+ if (!isInitialized) {
414
+ this.placeholderType = 'empty-query';
415
+ }
416
+ else if (isSearchResults && !hasQuery && !hasIdentifiers) {
417
+ this.placeholderType = 'empty-query';
418
+ }
419
+ else if (noResults) {
420
+ // Within a collection, no query + no results means the collection simply has no viewable items.
421
+ // Otherwise, we must have a user query that produced 0 results.
422
+ this.placeholderType =
423
+ !hasQuery && isCollection ? 'empty-collection' : 'no-results';
424
+ }
425
+ if (this.dataSource.queryErrorMessage) {
426
+ this.placeholderType =
427
+ !hasQuery && isCollection ? 'collection-error' : 'query-error';
428
+ }
429
+ }
430
+ /**
431
+ * Template for the placeholder content to show when no results are available.
432
+ */
433
+ get emptyPlaceholderTemplate() {
434
+ var _a;
435
+ return html `
436
+ <empty-placeholder
437
+ .placeholderType=${this.placeholderType}
438
+ ?isMobileView=${this.mobileView}
439
+ ?isCollection=${!!this.withinCollection}
440
+ .detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
441
+ .baseNavigationUrl=${this.baseNavigationUrl}
442
+ ></empty-placeholder>
443
+ `;
444
+ }
445
+ /**
446
+ * Top-level template for rendering the left (facets) and right (results) columns.
447
+ */
448
+ get collectionBrowserTemplate() {
449
+ return html `
450
+ <div id="left-column-scroll-sentinel"></div>
451
+ ${this.leftColumnTemplate} ${this.rightColumnTemplate}
452
+ `;
453
+ }
454
+ /**
455
+ * Template for either the mobile or desktop version of the left column, depending
456
+ * on current component state.
457
+ */
458
+ get leftColumnTemplate() {
459
+ if (this.mobileView) {
460
+ return this.mobileLeftColumnTemplate;
461
+ }
462
+ return this.desktopLeftColumnTemplate;
463
+ }
464
+ /**
465
+ * Template for the mobile version of the "left column" (which in this case, appears
466
+ * *above* the search results rather than beside them), for rendering the
467
+ * accordion-style facets.
468
+ */
469
+ get mobileLeftColumnTemplate() {
470
+ return html `
471
+ <div
472
+ id="left-column"
473
+ class="column${this.isResizeToMobile ? ' preload' : ''}"
474
+ >
475
+ ${this.facetTopViewSlot} ${this.resultsCountTemplate}
476
+ <div id="facets-header-container">${this.mobileFacetsTemplate}</div>
477
+ </div>
478
+ `;
479
+ }
480
+ /**
481
+ * Template for the desktop version of the left column, displaying the facets sidebar.
482
+ */
483
+ get desktopLeftColumnTemplate() {
484
+ return html `
485
+ <div id="left-column" class="column" ?hidden=${!this.facetPaneVisible}>
486
+ ${this.facetTopViewSlot}
487
+ <div id="facets-header-container">
488
+ <h2 id="facets-header" class="sr-only">${msg('Filters')}</h2>
489
+ ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}
490
+ </div>
491
+ <div id="facets-container" aria-labelledby="facets-header">
492
+ ${this.facetsTemplate}
493
+ <div id="facets-scroll-sentinel"></div>
494
+ </div>
495
+ <div id="facets-bottom-fade"></div>
496
+ </div>
497
+ `;
498
+ }
499
+ /**
500
+ * Slot which is placed at top of the facets area for user-profile page
501
+ * - mainly used to render userlists
502
+ */
503
+ get facetTopViewSlot() {
504
+ return html `<div id="facet-top-view">
505
+ <slot name="facet-top-slot"></slot>
506
+ </div>`;
507
+ }
508
+ /**
509
+ * Template for the "X Results" count at the top of the search results.
510
+ * Changes to the "Searching..." label if the search results are still loading.
511
+ */
512
+ get resultsCountTemplate() {
513
+ var _a;
514
+ if (this.suppressResultCount)
515
+ return nothing;
516
+ const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
517
+ const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
518
+ const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
519
+ // Added data-testid for Playwright testing
520
+ return html `
521
+ <div id="results-total" data-testid="results-total">
522
+ <span id="big-results-count">
523
+ ${shouldShowSearching ? html `Searching&hellip;` : resultsCount}
524
+ </span>
525
+ <span id="big-results-label">
526
+ ${shouldShowSearching ? nothing : resultsLabel}
527
+ </span>
528
+ </div>
529
+ `;
530
+ }
531
+ /**
532
+ * Template for the right column of the collection browser, where the result
533
+ * tiles and sort/filter bar are shown.
534
+ */
535
+ get rightColumnTemplate() {
536
+ const rightColumnClasses = classMap({
537
+ column: true,
538
+ 'full-width': !this.facetPaneVisible,
539
+ 'smart-results-spacing': !!this.showSmartResults,
540
+ });
541
+ return html `
542
+ <div id="right-column" class=${rightColumnClasses}>
543
+ ${this.showSmartResults
544
+ ? html `<slot name="smart-results"></slot>`
545
+ : nothing}
546
+ <section id="results">
547
+ <h2 class="results-section-heading">
548
+ <slot name="results-heading"></slot>
549
+ </h2>
550
+ <div id="cb-top-view">
551
+ <slot name="cb-top-slot"></slot>
552
+ </div>
553
+ ${this.isManageView
554
+ ? this.manageBarTemplate
555
+ : this.sortFilterBarTemplate}
556
+ <slot name="cb-results"></slot>
557
+ ${this.displayMode === `list-compact` && this.totalResults
558
+ ? this.listHeaderTemplate
559
+ : nothing}
560
+ ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
561
+ </section>
562
+ </div>
563
+ `;
564
+ }
565
+ /**
566
+ * Template for the infinite scroller widget that contains the result tiles.
567
+ */
568
+ get infiniteScrollerTemplate() {
569
+ return html `<infinite-scroller
570
+ class=${this.infiniteScrollerClasses}
571
+ itemCount=${this.placeholderType ? 0 : nothing}
572
+ ariaLandmarkLabel="Search results"
573
+ .cellProvider=${this}
574
+ .placeholderCellTemplate=${this.placeholderCellTemplate}
575
+ @scrollThresholdReached=${this.scrollThresholdReached}
576
+ @visibleCellsChanged=${this.visibleCellsChanged}
577
+ >${this.displayMode === 'grid'
578
+ ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
579
+ : nothing}
580
+ </infinite-scroller>`;
581
+ }
582
+ /**
583
+ * Produces a `classMap` indicating which classes the infinite scroller should have
584
+ * given the current display mode & placeholder case.
585
+ */
586
+ get infiniteScrollerClasses() {
587
+ var _a;
588
+ return classMap({
589
+ [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
590
+ hidden: !!this.placeholderType,
591
+ });
592
+ }
593
+ /**
594
+ * Template for the sort & filtering bar that appears atop the search results.
595
+ */
596
+ get sortFilterBarTemplate() {
597
+ var _a;
598
+ if (this.suppressSortBar)
599
+ return nothing;
600
+ // Determine the set of sortable fields that should be shown in the sort bar
601
+ let defaultViewSort = SortField.weeklyview;
602
+ let defaultDateSort = SortField.date;
603
+ let sortFieldAvailability = defaultSortAvailability;
604
+ // We adjust the sort options for a couple of special cases...
605
+ if ((_a = this.withinCollection) === null || _a === void 0 ? void 0 : _a.startsWith('fav-')) {
606
+ // When viewing a fav- collection, we include the Date Favorited option and show
607
+ // it as the default in the date dropdown.
608
+ defaultDateSort = SortField.datefavorited;
609
+ sortFieldAvailability = favoritesSortAvailability;
610
+ }
611
+ else if (!this.withinCollection && this.searchType === SearchType.TV) {
612
+ // When viewing TV search results, we default the views dropdown to All-time Views
613
+ // and exclude several of the usual date sort options.
614
+ defaultViewSort = SortField.alltimeview;
615
+ defaultDateSort = SortField.datearchived;
616
+ sortFieldAvailability = tvSortAvailability;
617
+ }
618
+ // We only show relevance sort if a search query is currently defined
619
+ sortFieldAvailability.relevance = this.isRelevanceSortAvailable;
620
+ return html `
621
+ <sort-filter-bar
622
+ .defaultSortField=${this.defaultSortField}
623
+ .defaultSortDirection=${this.defaultSortDirection}
624
+ .defaultViewSort=${defaultViewSort}
625
+ .defaultDateSort=${defaultDateSort}
626
+ .selectedSort=${this.selectedSort}
627
+ .sortDirection=${this.sortDirection}
628
+ .sortFieldAvailability=${sortFieldAvailability}
629
+ .displayMode=${this.displayMode}
630
+ .selectedTitleFilter=${this.selectedTitleFilter}
631
+ .selectedCreatorFilter=${this.selectedCreatorFilter}
632
+ .prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}
633
+ .resizeObserver=${this.resizeObserver}
634
+ .enableSortOptionsSlot=${this.enableSortOptionsSlot}
635
+ .suppressDisplayModes=${this.suppressDisplayModes}
636
+ @sortChanged=${this.userChangedSort}
637
+ @displayModeChanged=${this.displayModeChanged}
638
+ @titleLetterChanged=${this.titleLetterSelected}
639
+ @creatorLetterChanged=${this.creatorLetterSelected}
640
+ >
641
+ ${this.tileBlurCheckboxTemplate}
642
+ <slot name="sort-options-left" slot="sort-options-left"></slot>
643
+ <slot name="sort-options" slot="sort-options"></slot>
644
+ <slot name="sort-options-right" slot="sort-options-right"></slot>
645
+ </sort-filter-bar>
646
+ `;
647
+ }
648
+ /**
649
+ * Template for the Blurring toggle for admins to enable/disable blurring of
650
+ * sensitive content in result tiles.
651
+ */
652
+ get tileBlurCheckboxTemplate() {
653
+ var _a;
654
+ // Only show the checkbox for @archive.org users
655
+ if (!((_a = this.dataSource.sessionContext) === null || _a === void 0 ? void 0 : _a.is_archive_user))
656
+ return nothing;
657
+ return html `
658
+ <label
659
+ id="tile-blur-label"
660
+ for="tile-blur-check"
661
+ slot="sort-options-right"
662
+ >
663
+ ${msg('Blurring')}
664
+ <input
665
+ id="tile-blur-check"
666
+ type="checkbox"
667
+ ?checked=${!this.shouldSuppressTileBlurring}
668
+ @change=${this.tileBlurCheckboxChanged}
669
+ />
670
+ </label>
671
+ `;
672
+ }
673
+ /**
674
+ * Message to show in the manage view modal, depending on context.
675
+ */
676
+ get manageViewModalMsg() {
677
+ const pluralize = this.dataSource.checkedTileModels.length > 1;
678
+ switch (this.profileElement) {
679
+ case 'uploads':
680
+ return pluralize
681
+ ? msg('Note: It may take a few minutes for these items to stop appearing in your uploads list.')
682
+ : msg('Note: It may take a few minutes for this item to stop appearing in your uploads list.');
683
+ case 'web_archives':
684
+ return pluralize
685
+ ? msg('Note: It may take a few minutes for these items to stop appearing in your web archives list.')
686
+ : msg('Note: It may take a few minutes for this item to stop appearing in your web archives list.');
687
+ default:
688
+ return '';
689
+ }
690
+ }
691
+ /**
692
+ * Template for the manage bar UI that appears atop the search results when we are
693
+ * showing the management view. This generally replaces the sort bar when present.
694
+ */
695
+ get manageBarTemplate() {
696
+ return html `
697
+ <manage-bar
698
+ .label=${this.manageViewLabel}
699
+ .modalManager=${this.modalManager}
700
+ .selectedItems=${this.dataSource.checkedTileModels}
701
+ .manageViewModalMsg=${this.manageViewModalMsg}
702
+ showSelectAll
703
+ showUnselectAll
704
+ ?showItemManageButton=${this.pageContext === 'search'}
705
+ ?removeAllowed=${this.dataSource.checkedTileModels.length !== 0}
706
+ @removeItems=${this.handleRemoveItems}
707
+ @manageItems=${this.handleManageItems}
708
+ @selectAll=${() => this.dataSource.checkAllTiles()}
709
+ @unselectAll=${() => this.dataSource.uncheckAllTiles()}
710
+ @cancel=${() => {
711
+ this.isManageView = false;
712
+ this.dataSource.uncheckAllTiles();
713
+ if (this.searchResultsLoading)
714
+ this.dataSource.resetPages();
715
+ }}
716
+ ></manage-bar>
717
+ `;
718
+ }
719
+ /**
720
+ * Handler for when the user requests to remove all checked items via the manage bar.
721
+ * Emits an `itemRemovalRequested` event with all checked tile models.
722
+ */
723
+ handleRemoveItems() {
724
+ this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
725
+ detail: {
726
+ items: this.dataSource.checkedTileModels.map(model => {
727
+ var _a;
728
+ // For favorited searches, we attach a search: prefix to differentiate it from an item
729
+ const searchPrefix = (model === null || model === void 0 ? void 0 : model.mediatype) === 'search' ? 'search:' : '';
730
+ const identifier = (_a = model === null || model === void 0 ? void 0 : model.identifier) !== null && _a !== void 0 ? _a : '';
731
+ return `${searchPrefix}${identifier}`;
732
+ }),
733
+ },
734
+ }));
735
+ }
736
+ /**
737
+ * Handler when user request to bulk edit from /search/ page
738
+ */
739
+ handleManageItems() {
740
+ this.dispatchEvent(new CustomEvent('itemManagerRequested', {
741
+ detail: {
742
+ items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
743
+ },
744
+ }));
745
+ }
746
+ refreshSmartFacets() {
747
+ var _a;
748
+ (_a = this.smartFacetBar) === null || _a === void 0 ? void 0 : _a.refresh();
749
+ }
750
+ /**
751
+ * Handler to show processing modal while removing item
752
+ */
753
+ showRemoveItemsProcessingModal() {
754
+ var _a;
755
+ (_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsProcessingModal();
756
+ }
757
+ /**
758
+ * Handler to show error modal when item removal failed
759
+ */
760
+ showRemoveItemsErrorModal() {
761
+ var _a;
762
+ (_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsErrorModal();
763
+ }
764
+ /**
765
+ * Removes all tile models that are currently checked & adjusts the paging
766
+ * of the data source to account for any new gaps in the data.
767
+ */
768
+ removeCheckedTiles() {
769
+ this.dataSource.removeCheckedTiles();
770
+ }
771
+ /**
772
+ * Handler for when the tile blurring checkbox state is toggled
773
+ */
774
+ tileBlurCheckboxChanged(e) {
775
+ var _a;
776
+ const { checked } = e.target;
777
+ this.tileBlurOverrideState = checked ? 'on' : 'off';
778
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
779
+ }
780
+ /**
781
+ * Whether result tiles should have the default blurring of sensitive content suppressed.
782
+ * First considers any override specified by the user, falling back to the setting in
783
+ * user preferences if not overridden.
784
+ */
785
+ get shouldSuppressTileBlurring() {
786
+ if (this.tileBlurOverrideState !== 'no-override') {
787
+ // User wants to override their preference.
788
+ // Return true if they want blurring turned off, or false otherwise.
789
+ return this.tileBlurOverrideState === 'off';
790
+ }
791
+ // Not overriding, so use the preference from session context
792
+ const { sessionContext } = this.dataSource;
793
+ const userPrefs = sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.pps_relevant_user_preferences;
794
+ const blurringPref = userPrefs === null || userPrefs === void 0 ? void 0 : userPrefs.display__blur_moderated_content;
795
+ // Only suppress blurring if the preference is disabled.
796
+ // If enabled or missing, tile blurring remains on.
797
+ return blurringPref === 'off';
798
+ }
799
+ /**
800
+ * Handler for when the user changes the selected sort option or direction.
801
+ */
802
+ userChangedSort(e) {
803
+ var _a;
804
+ const { selectedSort, sortDirection } = e.detail;
805
+ this.selectedSort = selectedSort;
806
+ this.sortDirection = sortDirection;
807
+ if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
808
+ this.goToPage(1);
809
+ }
810
+ this.currentPage = 1;
811
+ }
812
+ /**
813
+ * Fires an analytics event for sorting changes.
814
+ * @param prevSortDirection Which sort direction was previously set.
815
+ */
816
+ sendSortByAnalytics(prevSortDirection) {
817
+ var _a;
818
+ const directionCleared = prevSortDirection && !this.sortDirection;
819
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
820
+ category: this.searchContext,
821
+ action: analyticsActions.sortBy,
822
+ label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
823
+ });
824
+ }
825
+ /**
826
+ * Handler for when the selected sort option is updated, whether by the user
827
+ * themselves or programmatically.
828
+ */
829
+ selectedSortChanged() {
830
+ // Lazy-load the alphabet counts for title/creator sort bar as needed
831
+ this.dataSource.updatePrefixFiltersForCurrentSort();
832
+ }
833
+ /**
834
+ * An object representing the current sort field & direction.
835
+ */
836
+ get sortParam() {
837
+ var _a;
838
+ const sortOption = SORT_OPTIONS[this.selectedSort];
839
+ if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
840
+ return null;
841
+ }
842
+ // If the sort option specified in the URL is unrecognized, we just use it as-is
843
+ const urlSortParam = new URL(window.location.href).searchParams.get('sort');
844
+ const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
845
+ // If the sort direction is still null at this point, then we assume ascending
846
+ // (i.e., it was unrecognized and had no directional flag)
847
+ if (!this.sortDirection)
848
+ this.sortDirection = 'asc';
849
+ if (!sortField)
850
+ return null;
851
+ return { field: sortField, direction: this.sortDirection };
852
+ }
853
+ /**
854
+ * An object representing the default sort field & direction, if none are explicitly set.
855
+ */
856
+ get defaultSortParam() {
857
+ var _a;
858
+ const direction = (_a = this.defaultSortDirection) !== null && _a !== void 0 ? _a : 'asc';
859
+ const field = SORT_OPTIONS[this.defaultSortField].searchServiceKey;
860
+ if (!field)
861
+ return null;
862
+ return { field, direction };
863
+ }
864
+ /**
865
+ * Handler for when the display mode option is changed (grid/list/compact-list views).
866
+ */
867
+ displayModeChanged(e) {
868
+ var _a;
869
+ this.displayMode = e.detail.displayMode;
870
+ if (this.displayMode) {
871
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
872
+ category: this.searchContext,
873
+ action: analyticsActions.displayMode,
874
+ label: this.displayMode,
875
+ });
876
+ }
877
+ }
878
+ /**
879
+ * Returns a query clause identifying the currently selected title filter,
880
+ * e.g., `firstTitle:X`.
881
+ */
882
+ get titleQuery() {
883
+ return this.selectedTitleFilter
884
+ ? `firstTitle:${this.selectedTitleFilter}`
885
+ : undefined;
886
+ }
887
+ /**
888
+ * Returns a query clause identifying the currently selected creator filter,
889
+ * e.g., `firstCreator:X`.
890
+ */
891
+ get creatorQuery() {
892
+ return this.selectedCreatorFilter
893
+ ? `firstCreator:${this.selectedCreatorFilter}`
894
+ : undefined;
895
+ }
896
+ /**
897
+ * Send Analytics when sorting by title's first letter
898
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
899
+ */
900
+ sendFilterByTitleAnalytics(prevSelectedLetter) {
901
+ var _a;
902
+ if (!prevSelectedLetter && !this.selectedTitleFilter) {
903
+ return;
904
+ }
905
+ const cleared = prevSelectedLetter && !this.selectedTitleFilter;
906
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
907
+ category: this.searchContext,
908
+ action: analyticsActions.filterByTitle,
909
+ label: cleared
910
+ ? `clear-${prevSelectedLetter}`
911
+ : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
912
+ });
913
+ }
914
+ /**
915
+ * Send Analytics when filtering by creator's first letter
916
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
917
+ */
918
+ sendFilterByCreatorAnalytics(prevSelectedLetter) {
919
+ var _a;
920
+ if (!prevSelectedLetter && !this.selectedCreatorFilter) {
921
+ return;
922
+ }
923
+ const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
924
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
925
+ category: this.searchContext,
926
+ action: analyticsActions.filterByCreator,
927
+ label: cleared
928
+ ? `clear-${prevSelectedLetter}`
929
+ : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
930
+ });
931
+ }
932
+ /**
933
+ * Handler for changes to which letter is selected in the title alphabet bar.
934
+ */
935
+ titleLetterSelected(e) {
936
+ this.selectedCreatorFilter = null;
937
+ this.selectedTitleFilter = e.detail.selectedLetter;
938
+ }
939
+ /**
940
+ * Handler for changes to which letter is selected in the creator alphabet bar.
941
+ */
942
+ creatorLetterSelected(e) {
943
+ this.selectedTitleFilter = null;
944
+ this.selectedCreatorFilter = e.detail.selectedLetter;
945
+ }
946
+ /**
947
+ * The full template for how the facets should be structured in mobile view,
948
+ * including the collapsible container (with header) and the facets themselves.
949
+ */
950
+ get mobileFacetsTemplate() {
951
+ if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
952
+ return nothing;
953
+ const toggleFacetsVisible = (e) => {
954
+ var _a;
955
+ const target = e.target;
956
+ this.isResizeToMobile = false;
957
+ this.collapsibleFacetsVisible = target.open;
958
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
959
+ category: this.searchContext,
960
+ action: analyticsActions.mobileFacetsToggled,
961
+ label: target.open ? 'open' : 'closed',
962
+ });
963
+ };
964
+ return html `
965
+ <details id="mobile-filter-collapse" @toggle=${toggleFacetsVisible}>
966
+ <summary>
967
+ <span class="collapser-icon">${chevronIcon}</span>
968
+ <h2>${msg('Filters')}</h2>
969
+ ${this.clearFiltersBtnTemplate(true)}
970
+ </summary>
971
+ ${this.facetsTemplate}
972
+ </details>
973
+ `;
974
+ }
975
+ async networksDropdownClicked() {
976
+ var _a, _b;
977
+ (_a = this.tvNetworksDropdown) === null || _a === void 0 ? void 0 : _a.classList.add('loading');
978
+ await this.dataSource.populateTVChannelMaps();
979
+ (_b = this.tvNetworksDropdown) === null || _b === void 0 ? void 0 : _b.classList.remove('loading');
980
+ }
981
+ async showsDropdownClicked() {
982
+ var _a, _b;
983
+ (_a = this.tvShowsDropdown) === null || _a === void 0 ? void 0 : _a.classList.add('loading');
984
+ await this.dataSource.populateTVChannelMaps();
985
+ (_b = this.tvShowsDropdown) === null || _b === void 0 ? void 0 : _b.classList.remove('loading');
986
+ }
987
+ async networksDropdownChanged() {
988
+ var _a;
989
+ if (((_a = this.tvNetworksDropdown) === null || _a === void 0 ? void 0 : _a.selectedIndex) === 0) {
990
+ this.selectedTVNetwork = undefined;
991
+ return;
992
+ }
993
+ this.selectedTVNetwork = this.tvNetworksDropdown.selectedOptions[0].value;
994
+ let newNetworkFacets = getDefaultSelectedFacets();
995
+ for (const [channel, network,] of this.dataSource.tvChannelMaps.channelToNetwork.entries()) {
996
+ if (network === this.selectedTVNetwork) {
997
+ newNetworkFacets = updateSelectedFacetBucket(newNetworkFacets, 'creator', {
998
+ key: channel.toLowerCase(),
999
+ count: 0,
1000
+ state: 'selected',
1001
+ });
1002
+ }
1003
+ }
1004
+ log(newNetworkFacets);
1005
+ this.selectedFacets = mergeSelectedFacets(this.selectedFacets, newNetworkFacets);
1006
+ log(this.selectedFacets);
1007
+ }
1008
+ async showsDropdownChanged() {
1009
+ var _a;
1010
+ if (((_a = this.tvShowsDropdown) === null || _a === void 0 ? void 0 : _a.selectedIndex) === 0) {
1011
+ this.selectedTVShow = undefined;
1012
+ return;
1013
+ }
1014
+ this.selectedTVShow = this.tvShowsDropdown.selectedOptions[0].value;
1015
+ this.selectedFacets = updateSelectedFacetBucket(this.selectedFacets, 'program', {
1016
+ key: this.selectedTVShow,
1017
+ count: 0,
1018
+ state: 'selected',
1019
+ });
1020
+ }
1021
+ get tvDropdownFiltersTemplate() {
1022
+ if (this.searchType !== SearchType.TV)
1023
+ return nothing;
1024
+ log('start filters template preprocess', Date.now());
1025
+ const { channelToNetwork, programToChannels } = this.dataSource.tvChannelMaps;
1026
+ const networks = channelToNetwork
1027
+ ? [...new Set(channelToNetwork.values())]
1028
+ : [];
1029
+ let showEntries = programToChannels ? [...programToChannels.entries()] : [];
1030
+ if (channelToNetwork && this.selectedTVNetwork) {
1031
+ showEntries = showEntries.filter(([, channels]) => Object.keys(channels).some(c => channelToNetwork.get(c) === this.selectedTVNetwork));
1032
+ }
1033
+ const shows = showEntries.map(([show]) => show);
1034
+ log('end filters template preprocess', Date.now());
1035
+ return html `
1036
+ <div id="tv-filters" slot="facets-top">
1037
+ <select
1038
+ id="tv-networks"
1039
+ class="tv-filter-dropdown"
1040
+ @click=${this.networksDropdownClicked}
1041
+ @change=${this.networksDropdownChanged}
1042
+ >
1043
+ <option selected value="">${msg('Filter by Network')}</option>
1044
+ ${map(networks, n => html `<option>${n}</option>`)}
1045
+ </select>
1046
+ <select
1047
+ id="tv-shows"
1048
+ class="tv-filter-dropdown"
1049
+ @click=${this.showsDropdownClicked}
1050
+ @change=${this.showsDropdownChanged}
1051
+ >
1052
+ <option selected value="">${msg('Filter by Show')}</option>
1053
+ ${map(shows, s => html `<option>${s}</option>`)}
1054
+ </select>
1055
+ </div>
1056
+ `;
1057
+ }
1058
+ /**
1059
+ * The template for the facets component alone, without any surrounding wrappers.
1060
+ */
1061
+ get facetsTemplate() {
1062
+ if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
1063
+ return nothing;
1064
+ if (this.facetLoadStrategy === 'off') {
1065
+ return html `
1066
+ <p class="facets-message">
1067
+ ${msg('Facets are temporarily unavailable.')}
1068
+ </p>
1069
+ `;
1070
+ }
1071
+ // We switch to TV facet ordering & date picker if we are in a TV collection or showing TV search results
1072
+ const shouldUseTvInterface = this.isTVCollection ||
1073
+ (!this.withinCollection && this.searchType === SearchType.TV);
1074
+ const facetDisplayOrder = shouldUseTvInterface
1075
+ ? tvFacetDisplayOrder
1076
+ : defaultFacetDisplayOrder;
1077
+ const facets = html `
1078
+ <collection-facets
1079
+ .collectionPagePath=${this.collectionPagePath}
1080
+ .parentCollections=${this.dataSource.parentCollections}
1081
+ .pageSpecifierParams=${this.dataSource.pageSpecifierParams}
1082
+ .searchService=${this.searchService}
1083
+ .featureFeedbackService=${this.featureFeedbackService}
1084
+ .recaptchaManager=${this.recaptchaManager}
1085
+ .resizeObserver=${this.resizeObserver}
1086
+ .searchType=${this.searchType}
1087
+ .aggregations=${this.dataSource.aggregations}
1088
+ .histogramAggregation=${this.dataSource.histogramAggregation}
1089
+ .minSelectedDate=${this.minSelectedDate}
1090
+ .maxSelectedDate=${this.maxSelectedDate}
1091
+ .selectedFacets=${this.selectedFacets}
1092
+ .baseNavigationUrl=${this.baseNavigationUrl}
1093
+ .collectionTitles=${this.dataSource.collectionTitles}
1094
+ .tvChannelAliases=${this.dataSource.tvChannelAliases}
1095
+ .showHistogramDatePicker=${this.showHistogramDatePicker}
1096
+ .allowExpandingDatePicker=${!this.mobileView}
1097
+ .allowDatePickerMonths=${shouldUseTvInterface}
1098
+ .contentWidth=${this.contentWidth}
1099
+ .query=${this.baseQuery}
1100
+ .identifiers=${this.identifiers}
1101
+ .filterMap=${this.dataSource.filterMap}
1102
+ .isManageView=${this.isManageView}
1103
+ .modalManager=${this.modalManager}
1104
+ .analyticsHandler=${this.analyticsHandler}
1105
+ .facetDisplayOrder=${facetDisplayOrder}
1106
+ .isTvSearch=${shouldUseTvInterface}
1107
+ ?collapsableFacets=${this.mobileView}
1108
+ ?facetsLoading=${this.facetsLoading}
1109
+ ?histogramAggregationLoading=${this.facetsLoading}
1110
+ ?suppressMediatypeFacets=${this.suppressMediatypeFacets}
1111
+ @facetClick=${this.facetClickHandler}
1112
+ @facetsChanged=${this.facetsChanged}
1113
+ @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
1114
+ >
1115
+ ${this.tvDropdownFiltersTemplate}
1116
+ </collection-facets>
1117
+ `;
1118
+ // If we are using one of the opt-in facet load strategies, we may need to wrap the
1119
+ // desktop view facets in a <details> widget so that patrons can opt into loading them.
1120
+ // In the `opt-in-or-login` case, we only do this if they are not logged in.
1121
+ const showDesktopOptInWidget = this.facetLoadStrategy === 'opt-in' ||
1122
+ (this.facetLoadStrategy === 'opt-in-or-login' && !this.loggedIn);
1123
+ if (showDesktopOptInWidget && !this.mobileView) {
1124
+ return html `
1125
+ <details
1126
+ class="desktop-facets-dropdown"
1127
+ @toggle=${(e) => {
1128
+ const target = e.target;
1129
+ this.collapsibleFacetsVisible = target.open;
1130
+ }}
1131
+ >
1132
+ <summary>
1133
+ <span class="collapser-icon">${chevronIcon}</span>
1134
+ <h2>${msg('Filters')}</h2>
1135
+ </summary>
1136
+ ${facets}
1137
+ </details>
1138
+ `;
1139
+ }
1140
+ // Otherwise, just render the facets component bare
1141
+ return facets;
1142
+ }
1143
+ /**
1144
+ * The HTML template for the "Clear all filters" button, or `nothing` if no
1145
+ * filters are currently active.
1146
+ *
1147
+ * @param mobile Whether to style/shorten the button for mobile view
1148
+ */
1149
+ clearFiltersBtnTemplate(mobile) {
1150
+ if (!this.hasActiveFilters)
1151
+ return nothing;
1152
+ const buttonClasses = classMap({
1153
+ 'clear-filters-btn': true,
1154
+ mobile,
1155
+ });
1156
+ const buttonText = mobile ? 'Clear all' : 'Clear all filters';
1157
+ return html `
1158
+ <div class="clear-filters-btn-row">
1159
+ ${mobile
1160
+ ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
1161
+ : nothing}
1162
+ <button class=${buttonClasses} @click=${this.clearFilters}>
1163
+ ${buttonText}
1164
+ </button>
1165
+ </div>
1166
+ `;
1167
+ }
1168
+ /**
1169
+ * Template for the table header content that appears atop the compact list view.
1170
+ */
1171
+ get listHeaderTemplate() {
1172
+ return html `
1173
+ <div id="list-header">
1174
+ <tile-dispatcher
1175
+ .tileDisplayMode=${'list-header'}
1176
+ .resizeObserver=${this.resizeObserver}
1177
+ .sortParam=${this.sortParam}
1178
+ .defaultSortParam=${this.defaultSortParam}
1179
+ .mobileBreakpoint=${this.mobileBreakpoint}
1180
+ .loggedIn=${this.loggedIn}
1181
+ .suppressBlurring=${this.shouldSuppressTileBlurring}
1182
+ >
1183
+ </tile-dispatcher>
1184
+ </div>
1185
+ `;
1186
+ }
1187
+ /**
1188
+ * Handler for when the date picker's date range is changed.
1189
+ */
1190
+ histogramDateRangeUpdated(e) {
1191
+ var _a;
1192
+ const { minDate, maxDate } = e.detail;
1193
+ [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
1194
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1195
+ category: this.searchContext,
1196
+ action: analyticsActions.histogramChanged,
1197
+ label: this.dateRangeQueryClause,
1198
+ });
1199
+ }
1200
+ /**
1201
+ * The Lucene query corresponding to the current date range.
1202
+ */
1203
+ get dateRangeQueryClause() {
1204
+ if (!this.minSelectedDate || !this.maxSelectedDate) {
1205
+ return undefined;
1206
+ }
1207
+ return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
1208
+ }
1209
+ /**
1210
+ * Emits an event indicating a change in whether the manage mode is shown.
1211
+ */
1212
+ emitManageModeChangedEvent() {
1213
+ this.dispatchEvent(new CustomEvent('manageModeChanged', {
1214
+ detail: this.isManageView,
1215
+ }));
1216
+ }
1217
+ /**
1218
+ * Installs a new data source component and associated query state parameters into
1219
+ * this component, causing it to efficiently update its views to represent the
1220
+ * newly-provided data. In this way, one can reuse a single instance of
1221
+ * <collection-browser> to handle multiple different sets of search results on
1222
+ * a single page, each set of results being loaded & updated by its own data
1223
+ * source.
1224
+ *
1225
+ * @param dataSource The data source component containing (or prepared to fetch)
1226
+ * the tile data to be displayed.
1227
+ * @param queryState The new query-related state that this component should
1228
+ * represent, such as the search query, sort option, and any filters applied.
1229
+ */
1230
+ async installDataSourceAndQueryState(dataSource, queryState) {
1231
+ var _a, _b;
1232
+ log('Installing data source & query state in CB:', dataSource, queryState);
1233
+ if (this.dataSource)
1234
+ this.removeController(this.dataSource);
1235
+ this.dataSource = dataSource;
1236
+ this.addController(this.dataSource);
1237
+ this.baseQuery = queryState.baseQuery;
1238
+ this.profileElement = queryState.profileElement;
1239
+ this.searchType = queryState.searchType;
1240
+ this.selectedFacets =
1241
+ (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
1242
+ this.internalFilters = queryState.internalFilters;
1243
+ this.minSelectedDate = queryState.minSelectedDate;
1244
+ this.maxSelectedDate = queryState.maxSelectedDate;
1245
+ this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
1246
+ this.sortDirection = queryState.sortDirection;
1247
+ this.selectedTitleFilter = queryState.selectedTitleFilter;
1248
+ this.selectedCreatorFilter = queryState.selectedCreatorFilter;
1249
+ this.pagesToRender = this.initialPageNumber;
1250
+ // We set this flag during the update to prevent the URL state persistence
1251
+ // from creating an unwanted extra history entry.
1252
+ this.dataSourceInstallInProgress = true;
1253
+ this.requestUpdate();
1254
+ await this.updateComplete;
1255
+ this.dataSourceInstallInProgress = false;
1256
+ if (!this.searchResultsLoading) {
1257
+ this.setTotalResultCount(this.dataSource.totalResults);
1258
+ this.setTileCount(this.dataSource.size);
1259
+ }
1260
+ this.refreshVisibleResults();
1261
+ }
1262
+ firstUpdated() {
1263
+ this.restoreState();
1264
+ this.setInitialSize();
1265
+ }
1266
+ /**
1267
+ * Determines the initial size of the content container and whether or not
1268
+ * the mobile layout should be used.
1269
+ */
1270
+ setInitialSize() {
1271
+ this.contentWidth = this.contentContainer.getBoundingClientRect().width;
1272
+ this.mobileView =
1273
+ this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1274
+ this.sendLayoutSizeAnalytics();
1275
+ }
1276
+ /**
1277
+ * Fires an analytics event indicating which type of layout was rendered:
1278
+ * mobile or desktop.
1279
+ */
1280
+ sendLayoutSizeAnalytics() {
1281
+ if (this.analyticsHandler) {
1282
+ this.layoutSizeAnalyticsSent = true;
1283
+ this.analyticsHandler.sendEvent({
1284
+ category: this.searchContext,
1285
+ action: this.mobileView
1286
+ ? analyticsActions.loadMobileView
1287
+ : analyticsActions.loadDesktopView,
1288
+ });
1289
+ }
1290
+ }
1291
+ updated(changed) {
1292
+ var _a, _b, _c;
1293
+ if (changed.has('placeholderType') && this.placeholderType === null) {
1294
+ if (!this.leftColIntersectionObserver) {
1295
+ this.setupLeftColumnScrollListeners();
1296
+ }
1297
+ if (!this.facetsIntersectionObserver) {
1298
+ this.setupFacetsScrollListeners();
1299
+ }
1300
+ this.updateLeftColumnHeight();
1301
+ }
1302
+ if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
1303
+ this.sendLayoutSizeAnalytics();
1304
+ }
1305
+ if (changed.has('displayMode') ||
1306
+ changed.has('baseNavigationUrl') ||
1307
+ changed.has('baseImageUrl') ||
1308
+ changed.has('loggedIn')) {
1309
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
1310
+ }
1311
+ if (changed.has('baseQuery') ||
1312
+ changed.has('identifiers') ||
1313
+ changed.has('searchType') ||
1314
+ changed.has('withinCollection')) {
1315
+ // Unless this query/search type update is from the initial page load or the
1316
+ // result of hitting the back button,
1317
+ // we need to clear any existing filters since they may no longer be valid for
1318
+ // the new set of search results.
1319
+ if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
1320
+ // Ordinarily, we leave the sort param unchanged between searches.
1321
+ // However, if we are changing the target collection itself, we want the sort cleared too,
1322
+ // since different collections may have different sorting options available.
1323
+ const shouldClearSort = changed.has('withinCollection') &&
1324
+ !changed.has('selectedSort') &&
1325
+ !changed.has('sortDirection');
1326
+ // Otherwise, only clear filters that haven't been simultaneously applied in this update
1327
+ this.clearFilters({
1328
+ sort: shouldClearSort,
1329
+ facets: !changed.has('selectedFacets'),
1330
+ dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
1331
+ letterFilters: !(changed.has('selectedTitleFilter') ||
1332
+ changed.has('selectedCreatorFilter')),
1333
+ });
1334
+ }
1335
+ }
1336
+ if (changed.has('profileElement')) {
1337
+ this.applyDefaultProfileSort();
1338
+ }
1339
+ if (changed.has('baseQuery')) {
1340
+ this.emitBaseQueryChanged();
1341
+ }
1342
+ if (changed.has('searchType')) {
1343
+ this.emitSearchTypeChanged();
1344
+ }
1345
+ if (changed.has('currentPage') || changed.has('displayMode')) {
1346
+ this.persistState();
1347
+ }
1348
+ if (changed.has('baseQuery') ||
1349
+ changed.has('identifiers') ||
1350
+ changed.has('minSelectedDate') ||
1351
+ changed.has('maxSelectedDate') ||
1352
+ changed.has('selectedFacets') ||
1353
+ changed.has('searchService') ||
1354
+ changed.has('withinCollection') ||
1355
+ changed.has('withinProfile') ||
1356
+ changed.has('profileElement')) {
1357
+ this.dataSource.refreshLetterCounts();
1358
+ }
1359
+ if (changed.has('selectedSort') || changed.has('sortDirection')) {
1360
+ const prevSortDirection = changed.get('sortDirection');
1361
+ this.sendSortByAnalytics(prevSortDirection);
1362
+ this.selectedSortChanged();
1363
+ }
1364
+ if (changed.has('selectedTitleFilter')) {
1365
+ this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
1366
+ }
1367
+ if (changed.has('selectedCreatorFilter')) {
1368
+ this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
1369
+ }
1370
+ this.updateFacetReadiness();
1371
+ if (changed.has('baseQuery') ||
1372
+ changed.has('identifiers') ||
1373
+ changed.has('searchType') ||
1374
+ changed.has('selectedTitleFilter') ||
1375
+ changed.has('selectedCreatorFilter') ||
1376
+ changed.has('minSelectedDate') ||
1377
+ changed.has('maxSelectedDate') ||
1378
+ changed.has('selectedSort') ||
1379
+ changed.has('sortDirection') ||
1380
+ changed.has('selectedFacets') ||
1381
+ changed.has('searchService') ||
1382
+ changed.has('withinCollection') ||
1383
+ changed.has('withinProfile') ||
1384
+ changed.has('profileElement')) {
1385
+ this.handleQueryChange();
1386
+ }
1387
+ if (changed.has('searchResultsLoading')) {
1388
+ this.emitSearchResultsLoadingChanged();
1389
+ }
1390
+ if (changed.has('facetsLoading') &&
1391
+ this.facetsLoading &&
1392
+ this.collectionFacets) {
1393
+ this.collectionFacets.moreLinksVisible =
1394
+ this.searchType !== SearchType.FULLTEXT;
1395
+ }
1396
+ if (changed.has('pagesToRender')) {
1397
+ if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
1398
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
1399
+ }
1400
+ }
1401
+ if (changed.has('isManageView')) {
1402
+ if (this.isManageView) {
1403
+ this.displayMode = 'grid';
1404
+ this.fetchManageableSearchResults();
1405
+ }
1406
+ else if (this.pageContext === 'search')
1407
+ (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
1408
+ (_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
1409
+ // Only emit change event if changing b/w true & false, not on initial value set.
1410
+ if (changed.get('isManageView') !== undefined) {
1411
+ this.emitManageModeChangedEvent();
1412
+ }
1413
+ }
1414
+ if (changed.has('resizeObserver')) {
1415
+ const oldObserver = changed.get('resizeObserver');
1416
+ if (oldObserver)
1417
+ this.disconnectResizeObserver(oldObserver);
1418
+ this.setupResizeObserver();
1419
+ }
1420
+ this.ensureAvailableTilesDisplayed();
1421
+ }
1422
+ connectedCallback() {
1423
+ var _a;
1424
+ (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
1425
+ this.setupStateRestorationObserver();
1426
+ this.setupResizeObserver();
1427
+ }
1428
+ disconnectedCallback() {
1429
+ var _a, _b;
1430
+ if (this.resizeObserver) {
1431
+ this.disconnectResizeObserver(this.resizeObserver);
1432
+ }
1433
+ if (this.boundNavigationHandler) {
1434
+ window.removeEventListener('popstate', this.boundNavigationHandler);
1435
+ }
1436
+ (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1437
+ (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
1438
+ window.removeEventListener('resize', this.updateLeftColumnHeight);
1439
+ }
1440
+ handleResize(entry) {
1441
+ const previousView = this.mobileView;
1442
+ if (entry.target === this.contentContainer) {
1443
+ this.contentWidth = entry.contentRect.width;
1444
+ this.mobileView =
1445
+ this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1446
+ // If changing from desktop to mobile disable transition
1447
+ if (this.mobileView && !previousView) {
1448
+ this.isResizeToMobile = true;
1449
+ }
1450
+ }
1451
+ // Ensure the facet sidebar remains sized correctly
1452
+ this.updateLeftColumnHeight();
1453
+ }
1454
+ /**
1455
+ * Ensures that if we have new results from the data source that are not yet
1456
+ * displayed in the infinite scroller, that they are immediately reflected
1457
+ * in the tile count.
1458
+ */
1459
+ ensureAvailableTilesDisplayed() {
1460
+ if (this.infiniteScroller &&
1461
+ this.infiniteScroller.itemCount < this.dataSource.size) {
1462
+ this.setTileCount(this.dataSource.endOfDataReached
1463
+ ? this.dataSource.size
1464
+ : this.estimatedTileCount);
1465
+ }
1466
+ }
1467
+ /**
1468
+ * Updates the data source with the current state of facet readiness for loading,
1469
+ * so that they will begin to load in at the appropriate time according to the
1470
+ * current facet loading strategy.
1471
+ */
1472
+ updateFacetReadiness() {
1473
+ // There are two ways to opt into facet production:
1474
+ // (1) have the facets dropdown open, or
1475
+ // (2) if using the `opt-in-or-login` strategy, be logged into an account
1476
+ const optedIn = this.collapsibleFacetsVisible ||
1477
+ (this.facetLoadStrategy === 'opt-in-or-login' && this.loggedIn);
1478
+ // In desktop view, we are always ready to load facets *unless* we are using one of the
1479
+ // `opt-in` strategies and have not opted in (whether by login or UI interaction).
1480
+ const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(this.facetLoadStrategy);
1481
+ const desktopFacetsReady = !this.mobileView && (!usingOptInStrategy || optedIn);
1482
+ // In the mobile view, facets are considered ready provided we have opted in (whether by
1483
+ // login or UI interaction).
1484
+ const mobileFacetsReady = this.mobileView && optedIn;
1485
+ this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
1486
+ }
1487
+ /**
1488
+ * Sets up listeners for events that may require updating the left column height.
1489
+ */
1490
+ setupLeftColumnScrollListeners() {
1491
+ var _a;
1492
+ // We observe intersections between the left column's scroll sentinel and
1493
+ // the viewport, so that we can ensure the left column is always sized to
1494
+ // match the _available_ viewport height. This should generally be more
1495
+ // performant than listening to scroll events on the page or column.
1496
+ const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
1497
+ if (leftColumnSentinel) {
1498
+ this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
1499
+ threshold: [...Array(201).keys()].map(n => n / 200), // Threshold every 0.5%
1500
+ });
1501
+ this.leftColIntersectionObserver.observe(leftColumnSentinel);
1502
+ }
1503
+ // We also listen for window resize events, as they are not always captured
1504
+ // by the resize observer and can affect the desired height of the left column.
1505
+ window.addEventListener('resize', this.updateLeftColumnHeight);
1506
+ }
1507
+ /**
1508
+ * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
1509
+ * Note this uses a separate IntersectionObserver from the left column, because we
1510
+ * don't need granular intersection thresholds for this.
1511
+ */
1512
+ setupFacetsScrollListeners() {
1513
+ var _a;
1514
+ const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
1515
+ if (facetsSentinel) {
1516
+ this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
1517
+ this.facetsIntersectionObserver.observe(facetsSentinel);
1518
+ }
1519
+ }
1520
+ /**
1521
+ * Emits a `baseQueryChanged` event indicating an update to the search query.
1522
+ */
1523
+ emitBaseQueryChanged() {
1524
+ this.dispatchEvent(new CustomEvent('baseQueryChanged', {
1525
+ detail: {
1526
+ baseQuery: this.baseQuery,
1527
+ },
1528
+ }));
1529
+ }
1530
+ /**
1531
+ * Emits a `searchTypeChanged` event indicating an update to the search type
1532
+ * (e.g., metadata vs. full-text).
1533
+ */
1534
+ emitSearchTypeChanged() {
1535
+ this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1536
+ detail: this.searchType,
1537
+ }));
1538
+ }
1539
+ /**
1540
+ * Emits a `facetPaneVisibilityChanged` event indicating that the facet pane has
1541
+ * been toggled open or closed.
1542
+ */
1543
+ emitFacetPaneVisibilityChanged() {
1544
+ this.dispatchEvent(new CustomEvent('facetPaneVisibilityChanged', {
1545
+ detail: this.facetPaneVisible,
1546
+ }));
1547
+ }
1548
+ /**
1549
+ * Emits a `searchError` event indicating that the most recent search has encountered
1550
+ * an error from the backend.
1551
+ */
1552
+ emitSearchError() {
1553
+ this.dispatchEvent(new CustomEvent('searchError', {
1554
+ detail: this.dataSource.queryErrorMessage,
1555
+ }));
1556
+ }
1557
+ /**
1558
+ * Emits a `queryStateChanged` event indicating that one or more of this component's
1559
+ * properties have changed in a way that could affect the set of search results.
1560
+ */
1561
+ emitQueryStateChanged() {
1562
+ this.dispatchEvent(new CustomEvent('queryStateChanged', {
1563
+ detail: {
1564
+ baseQuery: this.baseQuery,
1565
+ withinCollection: this.withinCollection,
1566
+ withinProfile: this.withinProfile,
1567
+ profileElement: this.profileElement,
1568
+ searchType: this.searchType,
1569
+ selectedFacets: this.selectedFacets,
1570
+ internalFilters: this.internalFilters,
1571
+ minSelectedDate: this.minSelectedDate,
1572
+ maxSelectedDate: this.maxSelectedDate,
1573
+ selectedSort: this.selectedSort,
1574
+ sortDirection: this.sortDirection,
1575
+ selectedTitleFilter: this.selectedTitleFilter,
1576
+ selectedCreatorFilter: this.selectedCreatorFilter,
1577
+ },
1578
+ }));
1579
+ }
1580
+ /**
1581
+ * Emits an `emptyResults` event indicating that we have received an empty result set
1582
+ * for the most recent query.
1583
+ */
1584
+ emitEmptyResults() {
1585
+ this.dispatchEvent(new Event('emptyResults'));
1586
+ }
1587
+ disconnectResizeObserver(resizeObserver) {
1588
+ resizeObserver.removeObserver({
1589
+ target: this.contentContainer,
1590
+ handler: this,
1591
+ });
1592
+ }
1593
+ setupResizeObserver() {
1594
+ if (!this.resizeObserver || !this.contentContainer)
1595
+ return;
1596
+ this.resizeObserver.addObserver({
1597
+ target: this.contentContainer,
1598
+ handler: this,
1599
+ });
1600
+ }
1601
+ /**
1602
+ * When the visible cells change from the infinite scroller, we want to emit
1603
+ * which page is currently visible so the consumer can update its UI or the URL
1604
+ *
1605
+ * @param e
1606
+ * @returns
1607
+ */
1608
+ visibleCellsChanged(e) {
1609
+ if (this.isScrollingToCell)
1610
+ return;
1611
+ const { visibleCellIndices } = e.detail;
1612
+ if (visibleCellIndices.length === 0)
1613
+ return;
1614
+ // For page determination, do not count more than a single page of visible cells,
1615
+ // since otherwise patrons using very tall screens will be treated as one page
1616
+ // further than they actually are.
1617
+ const lastIndexWithinCurrentPage = Math.min(this.pageSize, visibleCellIndices.length) - 1;
1618
+ const lastVisibleCellIndex = visibleCellIndices[lastIndexWithinCurrentPage];
1619
+ const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1620
+ if (this.currentPage !== lastVisibleCellPage) {
1621
+ this.currentPage = lastVisibleCellPage;
1622
+ }
1623
+ const event = new CustomEvent('visiblePageChanged', {
1624
+ detail: {
1625
+ pageNumber: lastVisibleCellPage,
1626
+ },
1627
+ });
1628
+ this.dispatchEvent(event);
1629
+ }
1630
+ /**
1631
+ * A Promise which, after each query change, resolves once the fetches for the initial
1632
+ * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1633
+ *
1634
+ * Ensure you await this component's `updateComplete` promise before awaiting this
1635
+ * one, to ensure you do not await an obsolete promise from the previous update.
1636
+ */
1637
+ get initialSearchComplete() {
1638
+ return this.dataSource.initialSearchComplete;
1639
+ }
1640
+ /**
1641
+ * Handler for whenever the component's properties change in a way that may require
1642
+ * fetching new results.
1643
+ */
1644
+ async handleQueryChange() {
1645
+ var _a;
1646
+ // only reset if the query has actually changed
1647
+ if (!this.searchService ||
1648
+ this.dataSource.pageFetchQueryKey === this.previousQueryKey) {
1649
+ return;
1650
+ }
1651
+ // If the new state prevents us from updating the search results, don't reset
1652
+ if (this.baseQuery && !this.dataSource.canPerformSearch) {
1653
+ return;
1654
+ }
1655
+ this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1656
+ this.totalResults = undefined;
1657
+ this.pagesToRender =
1658
+ this.initialPageNumber === 1
1659
+ ? 2 // First two pages are batched into one request when starting from page 1
1660
+ : this.initialPageNumber;
1661
+ // Reset the infinite scroller's item count, so that it
1662
+ // shows tile placeholders until the new query's results load in
1663
+ if (this.infiniteScroller) {
1664
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
1665
+ this.infiniteScroller.reload();
1666
+ }
1667
+ if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1668
+ this.defaultSortField = SortField.relevance;
1669
+ this.defaultSortDirection = null;
1670
+ }
1671
+ if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1672
+ this.scrollToPage(this.initialPageNumber);
1673
+ }
1674
+ this.initialQueryChangeHappened = true;
1675
+ // if the query changed as part of a window.history pop event, we don't want to
1676
+ // persist the state because it overwrites the forward history
1677
+ if (!this.historyPopOccurred) {
1678
+ this.persistState();
1679
+ }
1680
+ this.historyPopOccurred = false;
1681
+ }
1682
+ setupStateRestorationObserver() {
1683
+ if (!this.boundNavigationHandler) {
1684
+ this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1685
+ }
1686
+ // when the user navigates back, we want to update the UI to match the URL
1687
+ window.addEventListener('popstate', this.boundNavigationHandler);
1688
+ }
1689
+ historyNavigationHandler() {
1690
+ this.historyPopOccurred = true;
1691
+ this.restoreState();
1692
+ }
1693
+ restoreState() {
1694
+ var _a, _b, _c, _d, _e;
1695
+ const restorationState = this.restorationStateHandler.getRestorationState();
1696
+ this.displayMode = restorationState.displayMode;
1697
+ if (!this.suppressURLSinParam && restorationState.searchType != null)
1698
+ this.searchType = restorationState.searchType;
1699
+ this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1700
+ this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1701
+ this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1702
+ this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1703
+ this.selectedFacets = restorationState.selectedFacets;
1704
+ if (!this.suppressURLQuery)
1705
+ this.baseQuery = restorationState.baseQuery;
1706
+ this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1707
+ this.minSelectedDate = restorationState.minSelectedDate;
1708
+ this.maxSelectedDate = restorationState.maxSelectedDate;
1709
+ if (this.currentPage > 1) {
1710
+ this.goToPage(this.currentPage);
1711
+ }
1712
+ }
1713
+ persistState() {
1714
+ var _a, _b, _c, _d;
1715
+ const restorationState = {
1716
+ displayMode: this.displayMode,
1717
+ searchType: this.suppressURLSinParam ? undefined : this.searchType,
1718
+ selectedSort: this.selectedSort,
1719
+ sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1720
+ selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1721
+ baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1722
+ currentPage: this.currentPage,
1723
+ titleQuery: this.titleQuery,
1724
+ creatorQuery: this.creatorQuery,
1725
+ minSelectedDate: this.minSelectedDate,
1726
+ maxSelectedDate: this.maxSelectedDate,
1727
+ selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1728
+ selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1729
+ };
1730
+ const persistOptions = {
1731
+ forceReplace: this.dataSourceInstallInProgress,
1732
+ persistMetadataSearchType: this.isTVCollection,
1733
+ };
1734
+ this.restorationStateHandler.persistState(restorationState, persistOptions);
1735
+ }
1736
+ /**
1737
+ * Emits a `searchResultsLoadingChanged` event indicating that our loading state has
1738
+ * changed (either we have started loading new results, or we have finished loading them).
1739
+ */
1740
+ emitSearchResultsLoadingChanged() {
1741
+ this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1742
+ detail: {
1743
+ loading: this.searchResultsLoading,
1744
+ },
1745
+ }));
1746
+ }
1747
+ /**
1748
+ * Handler for when the set of selected facets changes.
1749
+ */
1750
+ facetsChanged(e) {
1751
+ this.selectedFacets = e.detail;
1752
+ }
1753
+ /**
1754
+ * Handler for when any facet is selected/unselected/hidden/unhidden.
1755
+ * Fires analytics indicating the type of facet event that took place.
1756
+ */
1757
+ facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1758
+ var _a;
1759
+ let action;
1760
+ if (negative) {
1761
+ action =
1762
+ bucket.state !== 'none'
1763
+ ? analyticsActions.facetNegativeSelected
1764
+ : analyticsActions.facetNegativeDeselected;
1765
+ }
1766
+ else {
1767
+ action =
1768
+ bucket.state !== 'none'
1769
+ ? analyticsActions.facetSelected
1770
+ : analyticsActions.facetDeselected;
1771
+ }
1772
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1773
+ category: this.searchContext,
1774
+ action,
1775
+ label: facetType,
1776
+ });
1777
+ }
1778
+ scrollToPage(pageNumber) {
1779
+ return new Promise(resolve => {
1780
+ const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1781
+ // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1782
+ // then scrolls to the cell
1783
+ setTimeout(() => {
1784
+ var _a;
1785
+ this.isScrollingToCell = true;
1786
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1787
+ // This timeout is to give the scroll animation time to finish
1788
+ // then updating the infinite scroller once we're done scrolling
1789
+ // There's no scroll animation completion callback so we're
1790
+ // giving it 0.5s to finish.
1791
+ setTimeout(() => {
1792
+ var _a;
1793
+ this.isScrollingToCell = false;
1794
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1795
+ resolve();
1796
+ }, 500);
1797
+ }, 0);
1798
+ });
1799
+ }
1800
+ /**
1801
+ * Whether sorting by relevance makes sense for the current state.
1802
+ * Currently equivalent to having a non-empty query.
1803
+ */
1804
+ get isRelevanceSortAvailable() {
1805
+ var _a;
1806
+ return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1807
+ }
1808
+ /**
1809
+ * Sets the total number of tiles displayed in the infinite scroller.
1810
+ */
1811
+ setTileCount(count) {
1812
+ if (this.infiniteScroller) {
1813
+ this.infiniteScroller.itemCount = count;
1814
+ }
1815
+ }
1816
+ /**
1817
+ * Applies any default sort option for the current collection, by checking
1818
+ * for one in the collection's metadata. If none is found, defaults to sorting
1819
+ * descending by:
1820
+ * - Date Favorited for fav-* collections
1821
+ * - Weekly views for all other collections
1822
+ */
1823
+ applyDefaultCollectionSort(collectionInfo) {
1824
+ var _a, _b, _c;
1825
+ if (this.baseQuery) {
1826
+ // If there's a query set, then we default to relevance sorting regardless of
1827
+ // the collection metadata-specified sort.
1828
+ this.defaultSortField = SortField.relevance;
1829
+ this.defaultSortDirection = null;
1830
+ return;
1831
+ }
1832
+ // Favorite collections sort on Date Favorited by default.
1833
+ // Other collections fall back to sorting on weekly views.
1834
+ const baseDefaultSort = ((_b = (_a = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _a === void 0 ? void 0 : _a.identifier) === null || _b === void 0 ? void 0 : _b.startsWith('fav-'))
1835
+ ? '-favoritedate'
1836
+ : '-week';
1837
+ // The collection metadata may override the default sorting with something else
1838
+ const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1839
+ // Prefer the metadata-specified sort if one exists
1840
+ const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1841
+ // Account for both -field and field:dir formats
1842
+ let [field, dir] = defaultSortToApply.split(':');
1843
+ if (field.startsWith('-')) {
1844
+ field = field.slice(1);
1845
+ dir = 'desc';
1846
+ }
1847
+ else if (!['asc', 'desc'].includes(dir)) {
1848
+ dir = 'asc';
1849
+ }
1850
+ const sortOption = sortOptionFromAPIString(field);
1851
+ const sortField = sortOption.field;
1852
+ if (sortField && sortField !== SortField.default) {
1853
+ this.defaultSortField = sortField;
1854
+ this.defaultSortDirection = dir;
1855
+ }
1856
+ }
1857
+ /**
1858
+ * Applies the default sort option for the current profile element
1859
+ */
1860
+ applyDefaultProfileSort() {
1861
+ if (this.profileElement) {
1862
+ const defaultSortField = defaultProfileElementSorts[this.profileElement];
1863
+ this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1864
+ }
1865
+ else {
1866
+ this.defaultSortField = SortField.weeklyview;
1867
+ }
1868
+ this.defaultSortDirection = 'desc';
1869
+ }
1870
+ /**
1871
+ * This is useful for determining whether we need to reload the scroller.
1872
+ *
1873
+ * When the fetch completes, we need to reload the scroller if the cells for that
1874
+ * page are visible, but if the page is not currenlty visible, we don't need to reload
1875
+ */
1876
+ get currentVisiblePageNumbers() {
1877
+ var _a, _b;
1878
+ const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1879
+ const visiblePages = new Set();
1880
+ visibleCells.forEach(cellIndex => {
1881
+ const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1882
+ visiblePages.add(visiblePage);
1883
+ });
1884
+ return Array.from(visiblePages);
1885
+ }
1886
+ /**
1887
+ * Whether we are currently displaying results for a radio collection
1888
+ */
1889
+ get isRadioCollection() {
1890
+ const { withinCollection } = this;
1891
+ const topCollections = ['radio'];
1892
+ const isTopCollection = topCollections.includes(withinCollection);
1893
+ const isSubCollection = topCollections.some(topCollxn => { var _a; return (_a = this.dataSource.parentCollections) === null || _a === void 0 ? void 0 : _a.includes(topCollxn); });
1894
+ return isTopCollection || isSubCollection;
1895
+ }
1896
+ /**
1897
+ * Refreshes all visible result cells in the infinite scroller.
1898
+ */
1899
+ refreshVisibleResults() {
1900
+ var _a;
1901
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1902
+ }
1903
+ /**
1904
+ * Callback when a result is selected
1905
+ */
1906
+ resultSelected(event) {
1907
+ var _a, _b, _c;
1908
+ if (this.isManageView) {
1909
+ // Checked/unchecked state change -- rerender to ensure it propagates
1910
+ // this.mapDataSource(model => ({ ...model }));
1911
+ const cellIndex = this.dataSource.indexOf(event.detail);
1912
+ if (cellIndex >= 0)
1913
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1914
+ this.requestUpdate();
1915
+ }
1916
+ (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1917
+ category: this.searchContext,
1918
+ action: analyticsActions.resultSelected,
1919
+ label: event.detail.mediatype,
1920
+ });
1921
+ (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1922
+ category: this.searchContext,
1923
+ action: analyticsActions.resultSelected,
1924
+ label: `page-${this.currentPage}`,
1925
+ });
1926
+ }
1927
+ cellForIndex(index) {
1928
+ const model = this.tileModelAtCellIndex(index);
1929
+ if (!model)
1930
+ return undefined;
1931
+ // Tiles show dates in UTC by default.
1932
+ // But for certain types of time-based media, we want them to use local time instead.
1933
+ // Those local-time cases are:
1934
+ // - TV or Radio search results
1935
+ // - TV or Radio collection results
1936
+ const isTVSearch = this.searchType === SearchType.TV;
1937
+ const isRadioSearch = this.searchType === SearchType.RADIO;
1938
+ const { isTVCollection, isRadioCollection } = this;
1939
+ const shouldUseLocalTime = isTVSearch || isRadioSearch || isTVCollection || isRadioCollection;
1940
+ return html `
1941
+ <tile-dispatcher
1942
+ .collectionPagePath=${this.collectionPagePath}
1943
+ .baseNavigationUrl=${this.baseNavigationUrl}
1944
+ .baseImageUrl=${this.baseImageUrl}
1945
+ .model=${model}
1946
+ .tileDisplayMode=${this.displayMode}
1947
+ .resizeObserver=${this.resizeObserver}
1948
+ .collectionTitles=${this.dataSource.collectionTitles}
1949
+ .sortParam=${this.sortParam}
1950
+ .defaultSortParam=${this.defaultSortParam}
1951
+ .creatorFilter=${this.selectedCreatorFilter}
1952
+ .mobileBreakpoint=${this.mobileBreakpoint}
1953
+ .loggedIn=${this.loggedIn}
1954
+ .suppressBlurring=${this.shouldSuppressTileBlurring}
1955
+ .isManageView=${this.isManageView}
1956
+ ?showTvClips=${isTVSearch || isTVCollection}
1957
+ ?enableHoverPane=${true}
1958
+ ?useLocalTime=${shouldUseLocalTime}
1959
+ @resultSelected=${(e) => this.resultSelected(e)}
1960
+ >
1961
+ </tile-dispatcher>
1962
+ `;
1963
+ }
1964
+ /**
1965
+ * When the user scrolls near to the bottom of the page, fetch the next page
1966
+ * increase the number of pages to render and start fetching data for the new page
1967
+ */
1968
+ scrollThresholdReached() {
1969
+ if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1970
+ this.pagesToRender += 1;
1971
+ this.dataSource.fetchPage(this.pagesToRender);
1972
+ }
1973
+ }
1974
+ /**
1975
+ * Fetches search results for privileged users when in manage view.
1976
+ *
1977
+ * This method:
1978
+ * 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
1979
+ * 2. Resets the datasource pagination state
1980
+ * 3. Fetches first page with limit based on maxPagesToManage threshold
1981
+ * 4. Reloads the infinite scroller to display new results
1982
+ */
1983
+ fetchManageableSearchResults() {
1984
+ var _a;
1985
+ const hasNotLoadedInitialResults = !this.dataSource.totalResults;
1986
+ const hasLoadedWithMoreResultsAvailable = !this.searchResultsLoading && this.dataSource.totalResults > 100;
1987
+ if (this.pageContext === 'search' &&
1988
+ (hasNotLoadedInitialResults || hasLoadedWithMoreResultsAvailable)) {
1989
+ this.dataSource.resetPages();
1990
+ this.dataSource.fetchPage(1, this.maxPagesToManage);
1991
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
1992
+ }
1993
+ }
1994
+ static get styles() {
1995
+ return [
1996
+ srOnlyStyle,
1997
+ css `
1998
+ :host {
1999
+ display: block;
2000
+ --leftColumnWidth: 18rem;
2001
+ --leftColumnPaddingTop: 2rem;
2002
+ --leftColumnPaddingRight: 2.5rem;
2003
+ }
2004
+
2005
+ #facet-top-view {
2006
+ display: flex;
2007
+ }
2008
+
2009
+ /**
2010
+ * When page width resizes from desktop to mobile, use this class to
2011
+ * disable expand/collapse transition when loading.
2012
+ */
2013
+ .preload * {
2014
+ transition: none !important;
2015
+ -webkit-transition: none !important;
2016
+ -moz-transition: none !important;
2017
+ -ms-transition: none !important;
2018
+ -o-transition: none !important;
2019
+ }
2020
+
2021
+ #content-container {
2022
+ display: flex;
2023
+ }
2024
+
2025
+ empty-placeholder {
2026
+ margin-top: var(--placeholderMarginTop, 0);
2027
+ }
2028
+
2029
+ .collapser-icon {
2030
+ display: inline-block;
2031
+ }
2032
+
2033
+ .collapser-icon svg {
2034
+ display: inline-block;
2035
+ width: 12px;
2036
+ height: 12px;
2037
+ transition: transform 0.2s ease-out;
2038
+ }
2039
+
2040
+ #mobile-filter-collapse {
2041
+ width: 100%;
2042
+ }
2043
+
2044
+ #mobile-filter-collapse > summary {
2045
+ cursor: pointer;
2046
+ list-style: none;
2047
+ }
2048
+
2049
+ #mobile-filter-collapse[open] > summary {
2050
+ margin-bottom: 10px;
2051
+ }
2052
+
2053
+ #mobile-filter-collapse h2 {
2054
+ display: inline-block;
2055
+ margin: 0;
2056
+ font-size: 2rem;
2057
+ }
2058
+
2059
+ #mobile-filter-collapse[open] svg {
2060
+ transform: rotate(90deg);
2061
+ }
2062
+
2063
+ #content-container.mobile {
2064
+ display: block;
2065
+ }
2066
+
2067
+ #right-column {
2068
+ flex: 1;
2069
+ position: relative;
2070
+ min-height: 90vh;
2071
+ border-right: 1px solid rgb(232, 232, 232);
2072
+ margin-top: var(--rightColumnMarginTop, 0);
2073
+ padding-top: var(--rightColumnPaddingTop, 2rem);
2074
+ background: #fff;
2075
+ }
2076
+
2077
+ #left-column:not([hidden]) + #right-column {
2078
+ border-left: 1px solid rgb(232, 232, 232);
2079
+ }
2080
+
2081
+ #right-column.smart-results-spacing {
2082
+ padding-top: 0.5rem;
2083
+ border-right: none;
2084
+ background: transparent;
2085
+ min-width: 0;
2086
+ }
2087
+
2088
+ #results {
2089
+ background: #fff;
2090
+ padding-left: 1rem;
2091
+ padding-right: 1rem;
2092
+ }
2093
+
2094
+ #right-column.smart-results-spacing #results {
2095
+ border-radius: 10px 10px 0px 0px;
2096
+ padding-top: 0.5rem;
2097
+ margin-top: 1rem;
2098
+ }
2099
+
2100
+ .mobile #right-column {
2101
+ border-left: none;
2102
+ }
2103
+
2104
+ .mobile #results {
2105
+ padding: 5px 5px 0;
2106
+ }
2107
+
2108
+ #left-column {
2109
+ width: var(--leftColumnWidth, 18rem);
2110
+ /* Prevents Safari from shrinking col at first draw */
2111
+ min-width: var(--leftColumnWidth, 18rem);
2112
+ padding-top: var(--leftColumnPaddingTop, 2rem);
2113
+ /* Reduced padding by 0.2rem to add the invisible border in the rule below */
2114
+ padding-right: calc(var(--leftColumnPaddingRight, 2.5rem) - 0.2rem);
2115
+ border-right: 0.2rem solid transparent; /* Pads to the right of the scrollbar a bit */
2116
+ z-index: 1;
2117
+ }
2118
+
2119
+ .desktop #left-column {
2120
+ top: 0;
2121
+ position: sticky;
2122
+ height: calc(100vh - 2rem);
2123
+ max-height: calc(100vh - 2rem);
2124
+ overflow-x: hidden;
2125
+ overflow-y: scroll;
2126
+
2127
+ /*
2128
+ * Firefox doesn't support any of the -webkit-scrollbar stuff below, but
2129
+ * does at least give us a tiny bit of control over width & color.
2130
+ */
2131
+ scrollbar-width: thin;
2132
+ scrollbar-color: transparent transparent;
2133
+ }
2134
+ .desktop #left-column:hover {
2135
+ scrollbar-color: auto;
2136
+ }
2137
+ .desktop #left-column::-webkit-scrollbar {
2138
+ appearance: none;
2139
+ width: 6px;
2140
+ }
2141
+ .desktop #left-column::-webkit-scrollbar-button {
2142
+ height: 3px;
2143
+ background: transparent;
2144
+ }
2145
+ .desktop #left-column::-webkit-scrollbar-corner {
2146
+ background: transparent;
2147
+ }
2148
+ .desktop #left-column::-webkit-scrollbar-thumb {
2149
+ border-radius: 4px;
2150
+ }
2151
+ .desktop #left-column:hover::-webkit-scrollbar-thumb {
2152
+ background: rgba(0, 0, 0, 0.15);
2153
+ }
2154
+ .desktop #left-column:hover::-webkit-scrollbar-thumb:hover {
2155
+ background: rgba(0, 0, 0, 0.2);
2156
+ }
2157
+ .desktop #left-column:hover::-webkit-scrollbar-thumb:active {
2158
+ background: rgba(0, 0, 0, 0.3);
2159
+ }
2160
+
2161
+ #facets-bottom-fade {
2162
+ background: linear-gradient(
2163
+ to bottom,
2164
+ #f5f5f700 0%,
2165
+ #f5f5f7c0 50%,
2166
+ #f5f5f7 80%,
2167
+ #f5f5f7 100%
2168
+ );
2169
+ position: fixed;
2170
+ bottom: 0;
2171
+ height: 50px;
2172
+ /* Wide enough to cover the content, but leave the scrollbar uncovered */
2173
+ width: calc(
2174
+ var(--leftColumnWidth) + var(--leftColumnPaddingRight) - 10px
2175
+ );
2176
+ z-index: 2;
2177
+ pointer-events: none;
2178
+ transition: height 0.1s ease;
2179
+ }
2180
+ #facets-bottom-fade.hidden {
2181
+ height: 0;
2182
+ }
2183
+
2184
+ .facets-message {
2185
+ font-size: 1.4rem;
2186
+ }
2187
+
2188
+ .desktop-facets-dropdown > summary {
2189
+ cursor: pointer;
2190
+ list-style: none;
2191
+ }
2192
+
2193
+ .desktop-facets-dropdown h2 {
2194
+ display: inline-block;
2195
+ margin: 0;
2196
+ font-size: 1.6rem;
2197
+ }
2198
+
2199
+ .desktop-facets-dropdown[open] > summary {
2200
+ margin-bottom: 10px;
2201
+ }
2202
+
2203
+ .desktop-facets-dropdown[open] svg {
2204
+ transform: rotate(90deg);
2205
+ }
2206
+
2207
+ .desktop #left-column-scroll-sentinel {
2208
+ width: 1px;
2209
+ height: 100vh;
2210
+ background: transparent;
2211
+ }
2212
+
2213
+ .desktop #facets-scroll-sentinel {
2214
+ width: 1px;
2215
+ height: 1px;
2216
+ background: transparent;
2217
+ }
2218
+
2219
+ #facets-header-container {
2220
+ display: flex;
2221
+ justify-content: space-between;
2222
+ align-items: flex-start;
2223
+ clear: both;
2224
+ }
2225
+
2226
+ .desktop #facets-header-container {
2227
+ flex-wrap: wrap;
2228
+ }
2229
+
2230
+ .mobile #left-column {
2231
+ width: 100%;
2232
+ min-width: 0;
2233
+ padding: 5px 0;
2234
+ border: 0;
2235
+ }
2236
+
2237
+ .clear-filters-btn-row {
2238
+ display: inline-block;
2239
+ }
2240
+
2241
+ .desktop .clear-filters-btn-row {
2242
+ width: 100%;
2243
+ }
2244
+
2245
+ .clear-filters-btn {
2246
+ display: inline-block;
2247
+ appearance: none;
2248
+ margin: 0;
2249
+ padding: 0;
2250
+ border: 0;
2251
+ background: none;
2252
+ color: var(--ia-theme-link-color);
2253
+ font-size: 1.4rem;
2254
+ font-family: inherit;
2255
+ cursor: pointer;
2256
+ }
2257
+
2258
+ .clear-filters-btn:hover {
2259
+ text-decoration: underline;
2260
+ }
2261
+
2262
+ .clear-filters-btn-separator {
2263
+ display: inline-block;
2264
+ margin-left: 5px;
2265
+ border-left: 1px solid #2c2c2c;
2266
+ font-size: 1.4rem;
2267
+ line-height: 1.3rem;
2268
+ }
2269
+
2270
+ #tv-filters {
2271
+ margin-bottom: 15px;
2272
+ }
2273
+
2274
+ .tv-filter-dropdown {
2275
+ width: 100%;
2276
+ padding: 3px;
2277
+ margin-bottom: 5px;
2278
+ }
2279
+
2280
+ #facets-container {
2281
+ position: relative;
2282
+ max-height: 0;
2283
+ transition: max-height 0.2s ease-in-out;
2284
+ z-index: 1;
2285
+ margin-top: var(--facetsContainerMarginTop, 5rem);
2286
+ padding-bottom: 2rem;
2287
+ }
2288
+
2289
+ .desktop #facets-container {
2290
+ width: 18rem;
2291
+ }
2292
+
2293
+ .mobile #facets-container {
2294
+ overflow: hidden;
2295
+ padding-bottom: 0;
2296
+ padding-left: 10px;
2297
+ padding-right: 10px;
2298
+ }
2299
+
2300
+ #facets-container.expanded {
2301
+ max-height: 2000px;
2302
+ }
2303
+
2304
+ .results-section-heading {
2305
+ margin: 0.5rem 0.3rem;
2306
+ font-size: 2rem;
2307
+ line-height: 25px;
2308
+ }
2309
+
2310
+ #results-total {
2311
+ display: flex;
2312
+ align-items: baseline;
2313
+ }
2314
+
2315
+ .mobile #results-total {
2316
+ position: absolute;
2317
+ right: 10px;
2318
+ }
2319
+
2320
+ #big-results-count {
2321
+ font-size: 2.4rem;
2322
+ font-weight: 500;
2323
+ margin-right: 5px;
2324
+ }
2325
+
2326
+ .mobile #big-results-count {
2327
+ font-size: 2rem;
2328
+ }
2329
+
2330
+ #big-results-label {
2331
+ font-size: 1.4rem;
2332
+ font-weight: 200;
2333
+ }
2334
+
2335
+ #list-header {
2336
+ max-height: 4.2rem;
2337
+ }
2338
+
2339
+ .loading-cover {
2340
+ position: absolute;
2341
+ top: 0;
2342
+ left: 0;
2343
+ width: 100%;
2344
+ height: 100%;
2345
+ display: flex;
2346
+ justify-content: center;
2347
+ z-index: 1;
2348
+ padding-top: 50px;
2349
+ }
2350
+
2351
+ #tile-blur-label {
2352
+ display: flex;
2353
+ align-items: center;
2354
+ column-gap: 5px;
2355
+ }
2356
+
2357
+ #tile-blur-check {
2358
+ margin: 0 5px 0 0;
2359
+ width: 15px;
2360
+ }
2361
+
2362
+ circular-activity-indicator {
2363
+ width: 30px;
2364
+ height: 30px;
2365
+ }
2366
+
2367
+ sort-filter-bar {
2368
+ display: block;
2369
+ margin-bottom: 4rem;
2370
+ }
2371
+
2372
+ infinite-scroller {
2373
+ display: block;
2374
+ --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);
2375
+ --infiniteScrollerColGap: var(--collectionBrowserColGap, 1.7rem);
2376
+ }
2377
+
2378
+ infinite-scroller.list-compact {
2379
+ --infiniteScrollerCellMinWidth: var(
2380
+ --collectionBrowserCellMinWidth,
2381
+ 100%
2382
+ );
2383
+ --infiniteScrollerCellMinHeight: 45px; /* override infinite scroller component */
2384
+ --infiniteScrollerCellMaxHeight: 56px;
2385
+ --infiniteScrollerRowGap: 10px;
2386
+ }
2387
+
2388
+ infinite-scroller.list-detail {
2389
+ --infiniteScrollerCellMinWidth: var(
2390
+ --collectionBrowserCellMinWidth,
2391
+ 100%
2392
+ );
2393
+ --infiniteScrollerCellMinHeight: var(
2394
+ --collectionBrowserCellMinHeight,
2395
+ 5rem
2396
+ );
2397
+ /*
2398
+ 30px in spec, compensating for a -4px margin
2399
+ to align title with top of item image
2400
+ src/tiles/list/tile-list.ts
2401
+ */
2402
+ --infiniteScrollerRowGap: 34px;
2403
+ }
2404
+
2405
+ .mobile infinite-scroller.list-detail {
2406
+ --infiniteScrollerRowGap: 24px;
2407
+ }
2408
+
2409
+ infinite-scroller.grid {
2410
+ --infiniteScrollerCellMinWidth: var(
2411
+ --collectionBrowserCellMinWidth,
2412
+ 17rem
2413
+ );
2414
+ --infiniteScrollerCellMaxWidth: var(
2415
+ --collectionBrowserCellMaxWidth,
2416
+ 1fr
2417
+ );
2418
+ }
2419
+
2420
+ /* Allow tiles to shrink a bit further at smaller viewport widths */
2421
+ @media screen and (max-width: 880px) {
2422
+ infinite-scroller.grid {
2423
+ --infiniteScrollerCellMinWidth: var(
2424
+ --collectionBrowserCellMinWidth,
2425
+ 15rem
2426
+ );
2427
+ }
2428
+ }
2429
+ /* At very small widths, maintain a 2-tile layout as far as it can reasonably go */
2430
+ @media screen and (max-width: 360px) {
2431
+ infinite-scroller.grid {
2432
+ --infiniteScrollerCellMinWidth: var(
2433
+ --collectionBrowserCellMinWidth,
2434
+ 12rem
2435
+ );
2436
+ }
2437
+ }
2438
+
2439
+ infinite-scroller.hidden {
2440
+ display: none;
2441
+ }
2442
+ `,
2443
+ ];
2444
+ }
2445
+ };
2446
+ __decorate([
2447
+ property({ type: String })
2448
+ ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
2449
+ __decorate([
2450
+ property({ type: String })
2451
+ ], CollectionBrowser.prototype, "baseImageUrl", void 0);
2452
+ __decorate([
2453
+ property({ type: Object })
2454
+ ], CollectionBrowser.prototype, "searchService", void 0);
2455
+ __decorate([
2456
+ property({ type: Number })
2457
+ ], CollectionBrowser.prototype, "searchType", void 0);
2458
+ __decorate([
2459
+ property({ type: String })
2460
+ ], CollectionBrowser.prototype, "withinCollection", void 0);
2461
+ __decorate([
2462
+ property({ type: String })
2463
+ ], CollectionBrowser.prototype, "withinProfile", void 0);
2464
+ __decorate([
2465
+ property({ type: String })
2466
+ ], CollectionBrowser.prototype, "profileElement", void 0);
2467
+ __decorate([
2468
+ property({ type: String })
2469
+ ], CollectionBrowser.prototype, "baseQuery", void 0);
2470
+ __decorate([
2471
+ property({ type: Array })
2472
+ ], CollectionBrowser.prototype, "identifiers", void 0);
2473
+ __decorate([
2474
+ property({ type: String })
2475
+ ], CollectionBrowser.prototype, "displayMode", void 0);
2476
+ __decorate([
2477
+ property({ type: String })
2478
+ ], CollectionBrowser.prototype, "selectedSort", void 0);
2479
+ __decorate([
2480
+ property({ type: String })
2481
+ ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
2482
+ __decorate([
2483
+ property({ type: String })
2484
+ ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
2485
+ __decorate([
2486
+ property({ type: String })
2487
+ ], CollectionBrowser.prototype, "sortDirection", void 0);
2488
+ __decorate([
2489
+ property({ type: String })
2490
+ ], CollectionBrowser.prototype, "defaultSortField", void 0);
2491
+ __decorate([
2492
+ property({ type: String })
2493
+ ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
2494
+ __decorate([
2495
+ property({ type: Number })
2496
+ ], CollectionBrowser.prototype, "pageSize", void 0);
2497
+ __decorate([
2498
+ property({ type: Number })
2499
+ ], CollectionBrowser.prototype, "currentPage", void 0);
2500
+ __decorate([
2501
+ property({ type: String })
2502
+ ], CollectionBrowser.prototype, "minSelectedDate", void 0);
2503
+ __decorate([
2504
+ property({ type: String })
2505
+ ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
2506
+ __decorate([
2507
+ property({ type: Object })
2508
+ ], CollectionBrowser.prototype, "selectedFacets", void 0);
2509
+ __decorate([
2510
+ property({ type: Object })
2511
+ ], CollectionBrowser.prototype, "internalFilters", void 0);
2512
+ __decorate([
2513
+ property({ type: Boolean })
2514
+ ], CollectionBrowser.prototype, "showSmartFacetBar", void 0);
2515
+ __decorate([
2516
+ property({ type: String })
2517
+ ], CollectionBrowser.prototype, "smartFacetBarLabel", void 0);
2518
+ __decorate([
2519
+ property({ type: Boolean })
2520
+ ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
2521
+ __decorate([
2522
+ property({ type: Boolean })
2523
+ ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
2524
+ __decorate([
2525
+ property({ type: Boolean })
2526
+ ], CollectionBrowser.prototype, "suppressResultCount", void 0);
2527
+ __decorate([
2528
+ property({ type: Boolean })
2529
+ ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
2530
+ __decorate([
2531
+ property({ type: Boolean })
2532
+ ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
2533
+ __decorate([
2534
+ property({ type: Boolean })
2535
+ ], CollectionBrowser.prototype, "suppressURLSinParam", void 0);
2536
+ __decorate([
2537
+ property({ type: Boolean })
2538
+ ], CollectionBrowser.prototype, "suppressSortBar", void 0);
2539
+ __decorate([
2540
+ property({ type: Boolean })
2541
+ ], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
2542
+ __decorate([
2543
+ property({ type: Boolean })
2544
+ ], CollectionBrowser.prototype, "suppressMediatypeFacets", void 0);
2545
+ __decorate([
2546
+ property({ type: String })
2547
+ ], CollectionBrowser.prototype, "facetLoadStrategy", void 0);
2548
+ __decorate([
2549
+ property({ type: Boolean, reflect: true })
2550
+ ], CollectionBrowser.prototype, "facetPaneVisible", void 0);
2551
+ __decorate([
2552
+ property({ type: Boolean })
2553
+ ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
2554
+ __decorate([
2555
+ property({ type: String })
2556
+ ], CollectionBrowser.prototype, "collectionPagePath", void 0);
2557
+ __decorate([
2558
+ property({ type: String, reflect: true })
2559
+ ], CollectionBrowser.prototype, "searchContext", void 0);
2560
+ __decorate([
2561
+ property({ type: String })
2562
+ ], CollectionBrowser.prototype, "pageContext", void 0);
2563
+ __decorate([
2564
+ property({ type: Object })
2565
+ ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
2566
+ __decorate([
2567
+ property({ type: Number })
2568
+ ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
2569
+ __decorate([
2570
+ property({ type: Boolean })
2571
+ ], CollectionBrowser.prototype, "loggedIn", void 0);
2572
+ __decorate([
2573
+ property({ type: Object })
2574
+ ], CollectionBrowser.prototype, "resizeObserver", void 0);
2575
+ __decorate([
2576
+ property({ type: Object })
2577
+ ], CollectionBrowser.prototype, "modalManager", void 0);
2578
+ __decorate([
2579
+ property({ type: Object })
2580
+ ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
2581
+ __decorate([
2582
+ property({ type: Object })
2583
+ ], CollectionBrowser.prototype, "recaptchaManager", void 0);
2584
+ __decorate([
2585
+ property({ type: Boolean })
2586
+ ], CollectionBrowser.prototype, "isTVCollection", void 0);
2587
+ __decorate([
2588
+ property({ type: Boolean })
2589
+ ], CollectionBrowser.prototype, "isManageView", void 0);
2590
+ __decorate([
2591
+ property({ type: String })
2592
+ ], CollectionBrowser.prototype, "manageViewLabel", void 0);
2593
+ __decorate([
2594
+ property({ type: Boolean })
2595
+ ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
2596
+ __decorate([
2597
+ property({ type: Boolean, reflect: true })
2598
+ ], CollectionBrowser.prototype, "showSmartResults", void 0);
2599
+ __decorate([
2600
+ property({ type: Number })
2601
+ ], CollectionBrowser.prototype, "maxPagesToManage", void 0);
2602
+ __decorate([
2603
+ property({ type: Object })
2604
+ ], CollectionBrowser.prototype, "dataSource", void 0);
2605
+ __decorate([
2606
+ state()
2607
+ ], CollectionBrowser.prototype, "pagesToRender", void 0);
2608
+ __decorate([
2609
+ state()
2610
+ ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
2611
+ __decorate([
2612
+ state()
2613
+ ], CollectionBrowser.prototype, "facetsLoading", void 0);
2614
+ __decorate([
2615
+ state()
2616
+ ], CollectionBrowser.prototype, "totalResults", void 0);
2617
+ __decorate([
2618
+ state()
2619
+ ], CollectionBrowser.prototype, "mobileView", void 0);
2620
+ __decorate([
2621
+ state()
2622
+ ], CollectionBrowser.prototype, "tileBlurOverrideState", void 0);
2623
+ __decorate([
2624
+ state()
2625
+ ], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);
2626
+ __decorate([
2627
+ state()
2628
+ ], CollectionBrowser.prototype, "contentWidth", void 0);
2629
+ __decorate([
2630
+ state()
2631
+ ], CollectionBrowser.prototype, "placeholderType", void 0);
2632
+ __decorate([
2633
+ query('#content-container')
2634
+ ], CollectionBrowser.prototype, "contentContainer", void 0);
2635
+ __decorate([
2636
+ query('#left-column')
2637
+ ], CollectionBrowser.prototype, "leftColumn", void 0);
2638
+ __decorate([
2639
+ query('collection-facets')
2640
+ ], CollectionBrowser.prototype, "collectionFacets", void 0);
2641
+ __decorate([
2642
+ query('manage-bar')
2643
+ ], CollectionBrowser.prototype, "manageBar", void 0);
2644
+ __decorate([
2645
+ query('smart-facet-bar')
2646
+ ], CollectionBrowser.prototype, "smartFacetBar", void 0);
2647
+ __decorate([
2648
+ property({ type: Object, attribute: false })
2649
+ ], CollectionBrowser.prototype, "analyticsHandler", void 0);
2650
+ __decorate([
2651
+ query('infinite-scroller')
2652
+ ], CollectionBrowser.prototype, "infiniteScroller", void 0);
2653
+ __decorate([
2654
+ state()
2655
+ ], CollectionBrowser.prototype, "selectedTVNetwork", void 0);
2656
+ __decorate([
2657
+ state()
2658
+ ], CollectionBrowser.prototype, "selectedTVShow", void 0);
2659
+ __decorate([
2660
+ query('#tv-networks')
2661
+ ], CollectionBrowser.prototype, "tvNetworksDropdown", void 0);
2662
+ __decorate([
2663
+ query('#tv-shows')
2664
+ ], CollectionBrowser.prototype, "tvShowsDropdown", void 0);
2665
+ CollectionBrowser = __decorate([
2666
+ customElement('collection-browser')
2667
+ ], CollectionBrowser);
2668
+ export { CollectionBrowser };
2669
+ //# sourceMappingURL=collection-browser.js.map