@internetarchive/collection-browser 2.1.4-alpha3 → 2.1.5

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 (303) hide show
  1. package/.editorconfig +29 -29
  2. package/.husky/pre-commit +4 -4
  3. package/LICENSE +661 -661
  4. package/README.md +83 -83
  5. package/dist/index.d.ts +12 -12
  6. package/dist/index.js +12 -12
  7. package/dist/src/app-root.d.ts +88 -84
  8. package/dist/src/app-root.js +486 -454
  9. package/dist/src/app-root.js.map +1 -1
  10. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  11. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  12. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  13. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  14. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  15. package/dist/src/assets/img/icons/chevron.js +2 -2
  16. package/dist/src/assets/img/icons/contract.d.ts +2 -2
  17. package/dist/src/assets/img/icons/contract.js +2 -2
  18. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  19. package/dist/src/assets/img/icons/empty-query.js +2 -2
  20. package/dist/src/assets/img/icons/expand.d.ts +2 -2
  21. package/dist/src/assets/img/icons/expand.js +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  23. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  24. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  25. package/dist/src/assets/img/icons/eye.js +2 -2
  26. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  27. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  28. package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -1
  29. package/dist/src/assets/img/icons/favorite-unfilled.js +2 -2
  30. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  31. package/dist/src/assets/img/icons/login-required.js +2 -2
  32. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  33. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  34. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  35. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  36. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  37. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  38. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  39. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  40. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  41. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  42. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  43. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  44. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  45. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  46. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  47. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  48. package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
  49. package/dist/src/assets/img/icons/mediatype/search.js +2 -2
  50. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  51. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  52. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  53. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  54. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  55. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  56. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  57. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  58. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  59. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  60. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  61. package/dist/src/assets/img/icons/null-result.js +2 -2
  62. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  63. package/dist/src/assets/img/icons/restricted.js +2 -2
  64. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  65. package/dist/src/assets/img/icons/reviews.js +2 -2
  66. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  67. package/dist/src/assets/img/icons/upload.js +2 -2
  68. package/dist/src/assets/img/icons/views.d.ts +1 -1
  69. package/dist/src/assets/img/icons/views.js +2 -2
  70. package/dist/src/circular-activity-indicator.d.ts +5 -5
  71. package/dist/src/circular-activity-indicator.js +17 -17
  72. package/dist/src/collection-browser.d.ts +446 -395
  73. package/dist/src/collection-browser.js +1415 -1367
  74. package/dist/src/collection-browser.js.map +1 -1
  75. package/dist/src/collection-facets/facet-row.d.ts +30 -30
  76. package/dist/src/collection-facets/facet-row.js +114 -114
  77. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  78. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  79. package/dist/src/collection-facets/facets-template.d.ts +17 -17
  80. package/dist/src/collection-facets/facets-template.js +114 -114
  81. package/dist/src/collection-facets/more-facets-content.d.ts +70 -70
  82. package/dist/src/collection-facets/more-facets-content.js +354 -354
  83. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  84. package/dist/src/collection-facets/more-facets-pagination.js +196 -196
  85. package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
  86. package/dist/src/collection-facets/toggle-switch.js +94 -94
  87. package/dist/src/collection-facets.d.ts +103 -103
  88. package/dist/src/collection-facets.js +509 -509
  89. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +232 -232
  90. package/dist/src/data-source/collection-browser-data-source-interface.js +1 -1
  91. package/dist/src/data-source/collection-browser-data-source.d.ts +360 -360
  92. package/dist/src/data-source/collection-browser-data-source.js +930 -930
  93. package/dist/src/data-source/collection-browser-query-state.d.ts +43 -43
  94. package/dist/src/data-source/collection-browser-query-state.js +1 -1
  95. package/dist/src/data-source/models.d.ts +28 -28
  96. package/dist/src/data-source/models.js +8 -8
  97. package/dist/src/empty-placeholder.d.ts +23 -23
  98. package/dist/src/empty-placeholder.js +74 -74
  99. package/dist/src/expanded-date-picker.d.ts +43 -43
  100. package/dist/src/expanded-date-picker.js +109 -109
  101. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  102. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  103. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  104. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  105. package/dist/src/manage/manage-bar.d.ts +30 -30
  106. package/dist/src/manage/manage-bar.js +61 -61
  107. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  108. package/dist/src/mediatype/mediatype-config.js +91 -91
  109. package/dist/src/models.d.ts +198 -198
  110. package/dist/src/models.js +381 -381
  111. package/dist/src/restoration-state-handler.d.ts +70 -70
  112. package/dist/src/restoration-state-handler.js +357 -357
  113. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  114. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  115. package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
  116. package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
  117. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  118. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  119. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  120. package/dist/src/sort-filter-bar/img/list.js +2 -2
  121. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
  122. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
  123. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
  124. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
  125. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
  126. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
  127. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  128. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  129. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  130. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  131. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +221 -219
  132. package/dist/src/sort-filter-bar/sort-filter-bar.js +695 -685
  133. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  134. package/dist/src/styles/ia-button.d.ts +2 -2
  135. package/dist/src/styles/ia-button.js +16 -16
  136. package/dist/src/styles/item-image-styles.d.ts +8 -8
  137. package/dist/src/styles/item-image-styles.js +9 -9
  138. package/dist/src/styles/sr-only.d.ts +1 -1
  139. package/dist/src/styles/sr-only.js +2 -2
  140. package/dist/src/tiles/base-tile-component.d.ts +19 -19
  141. package/dist/src/tiles/base-tile-component.js +63 -63
  142. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  143. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  144. package/dist/src/tiles/grid/account-tile.d.ts +18 -18
  145. package/dist/src/tiles/grid/account-tile.js +72 -72
  146. package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
  147. package/dist/src/tiles/grid/collection-tile.js +80 -80
  148. package/dist/src/tiles/grid/item-tile.d.ts +30 -30
  149. package/dist/src/tiles/grid/item-tile.js +149 -149
  150. package/dist/src/tiles/grid/search-tile.d.ts +10 -10
  151. package/dist/src/tiles/grid/search-tile.js +51 -51
  152. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  153. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
  154. package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
  155. package/dist/src/tiles/grid/tile-stats.js +53 -53
  156. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  157. package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
  158. package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
  159. package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
  160. package/dist/src/tiles/image-block.d.ts +17 -17
  161. package/dist/src/tiles/image-block.js +73 -73
  162. package/dist/src/tiles/item-image.d.ts +39 -39
  163. package/dist/src/tiles/item-image.js +154 -154
  164. package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
  165. package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
  166. package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
  167. package/dist/src/tiles/list/tile-list-compact.js +114 -114
  168. package/dist/src/tiles/list/tile-list.d.ts +50 -50
  169. package/dist/src/tiles/list/tile-list.js +315 -315
  170. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  171. package/dist/src/tiles/mediatype-icon.js +47 -47
  172. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  173. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  174. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  175. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  176. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  177. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  178. package/dist/src/tiles/review-block.d.ts +12 -12
  179. package/dist/src/tiles/review-block.js +56 -56
  180. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  181. package/dist/src/tiles/text-snippet-block.js +73 -73
  182. package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
  183. package/dist/src/tiles/tile-dispatcher.js +229 -229
  184. package/dist/src/tiles/tile-display-value-provider.d.ts +47 -47
  185. package/dist/src/tiles/tile-display-value-provider.js +94 -94
  186. package/dist/src/utils/analytics-events.d.ts +26 -25
  187. package/dist/src/utils/analytics-events.js +28 -27
  188. package/dist/src/utils/analytics-events.js.map +1 -1
  189. package/dist/src/utils/array-equals.d.ts +4 -4
  190. package/dist/src/utils/array-equals.js +10 -10
  191. package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -11
  192. package/dist/src/utils/collapse-repeated-quotes.js +13 -13
  193. package/dist/src/utils/format-count.d.ts +7 -7
  194. package/dist/src/utils/format-count.js +76 -76
  195. package/dist/src/utils/format-date.d.ts +2 -2
  196. package/dist/src/utils/format-date.js +25 -25
  197. package/dist/src/utils/format-unit-size.d.ts +2 -2
  198. package/dist/src/utils/format-unit-size.js +33 -33
  199. package/dist/src/utils/local-date-from-utc.d.ts +9 -9
  200. package/dist/src/utils/local-date-from-utc.js +15 -15
  201. package/dist/src/utils/log.d.ts +7 -7
  202. package/dist/src/utils/log.js +15 -15
  203. package/dist/src/utils/resolve-mediatype.d.ts +8 -8
  204. package/dist/src/utils/resolve-mediatype.js +23 -23
  205. package/dist/src/utils/sha1.d.ts +2 -2
  206. package/dist/src/utils/sha1.js +8 -8
  207. package/dist/test/collection-browser.test.d.ts +1 -1
  208. package/dist/test/collection-browser.test.js +1288 -1242
  209. package/dist/test/collection-browser.test.js.map +1 -1
  210. package/dist/test/collection-facets/facet-row.test.d.ts +1 -1
  211. package/dist/test/collection-facets/facet-row.test.js +203 -203
  212. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  213. package/dist/test/collection-facets/facets-template.test.js +105 -105
  214. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  215. package/dist/test/collection-facets/more-facets-content.test.js +133 -133
  216. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  217. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  218. package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
  219. package/dist/test/collection-facets/toggle-switch.test.js +73 -73
  220. package/dist/test/collection-facets.test.d.ts +2 -2
  221. package/dist/test/collection-facets.test.js +652 -652
  222. package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -1
  223. package/dist/test/data-source/collection-browser-data-source.test.js +89 -89
  224. package/dist/test/empty-placeholder.test.d.ts +1 -1
  225. package/dist/test/empty-placeholder.test.js +63 -63
  226. package/dist/test/expanded-date-picker.test.d.ts +1 -1
  227. package/dist/test/expanded-date-picker.test.js +95 -95
  228. package/dist/test/icon-overlay.test.d.ts +1 -1
  229. package/dist/test/icon-overlay.test.js +24 -24
  230. package/dist/test/image-block.test.d.ts +1 -1
  231. package/dist/test/image-block.test.js +48 -48
  232. package/dist/test/item-image.test.d.ts +1 -1
  233. package/dist/test/item-image.test.js +85 -85
  234. package/dist/test/manage/manage-bar.test.d.ts +1 -1
  235. package/dist/test/manage/manage-bar.test.js +81 -81
  236. package/dist/test/mediatype-config.test.d.ts +1 -1
  237. package/dist/test/mediatype-config.test.js +16 -16
  238. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  239. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  240. package/dist/test/mocks/mock-search-responses.d.ts +24 -24
  241. package/dist/test/mocks/mock-search-responses.js +840 -840
  242. package/dist/test/mocks/mock-search-service.d.ts +15 -15
  243. package/dist/test/mocks/mock-search-service.js +53 -53
  244. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  245. package/dist/test/restoration-state-handler.test.js +270 -270
  246. package/dist/test/review-block.test.d.ts +1 -1
  247. package/dist/test/review-block.test.js +44 -44
  248. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  249. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  250. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  251. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  252. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  253. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +428 -420
  254. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  255. package/dist/test/text-overlay.test.d.ts +1 -1
  256. package/dist/test/text-overlay.test.js +48 -48
  257. package/dist/test/text-snippet-block.test.d.ts +1 -1
  258. package/dist/test/text-snippet-block.test.js +57 -57
  259. package/dist/test/tile-stats.test.d.ts +1 -1
  260. package/dist/test/tile-stats.test.js +81 -81
  261. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  262. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  263. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  264. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  265. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  266. package/dist/test/tiles/grid/item-tile.test.js +312 -312
  267. package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
  268. package/dist/test/tiles/grid/search-tile.test.js +51 -51
  269. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  270. package/dist/test/tiles/hover/hover-pane-controller.test.js +259 -259
  271. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  272. package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
  273. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  274. package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
  275. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  276. package/dist/test/tiles/list/tile-list.test.js +297 -297
  277. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  278. package/dist/test/tiles/tile-dispatcher.test.js +100 -100
  279. package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
  280. package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
  281. package/dist/test/utils/array-equals.test.d.ts +1 -1
  282. package/dist/test/utils/array-equals.test.js +26 -26
  283. package/dist/test/utils/format-count.test.d.ts +1 -1
  284. package/dist/test/utils/format-count.test.js +23 -23
  285. package/dist/test/utils/format-date.test.d.ts +1 -1
  286. package/dist/test/utils/format-date.test.js +17 -17
  287. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  288. package/dist/test/utils/format-unit-size.test.js +17 -17
  289. package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
  290. package/dist/test/utils/local-date-from-utc.test.js +26 -26
  291. package/local.archive.org.cert +86 -86
  292. package/local.archive.org.key +27 -27
  293. package/package.json +1 -1
  294. package/renovate.json +6 -6
  295. package/src/app-root.ts +56 -23
  296. package/src/collection-browser.ts +69 -8
  297. package/src/sort-filter-bar/sort-filter-bar.ts +10 -1
  298. package/src/utils/analytics-events.ts +1 -0
  299. package/test/collection-browser.test.ts +67 -1
  300. package/test/sort-filter-bar/sort-filter-bar.test.ts +11 -0
  301. package/tsconfig.json +21 -21
  302. package/web-dev-server.config.mjs +30 -30
  303. package/web-test-runner.config.mjs +41 -41
@@ -1,315 +1,351 @@
1
- import { __decorate } from "tslib";
2
- /* eslint-disable import/no-duplicates */
3
- import { html, css, LitElement, nothing, } from 'lit';
4
- import { customElement, property, query, state } from 'lit/decorators.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, } from './models';
10
- import { RestorationStateHandler, } from './restoration-state-handler';
11
- import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
- import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
13
- import chevronIcon from './assets/img/icons/chevron';
14
- import { srOnlyStyle } from './styles/sr-only';
15
- import { sha1 } from './utils/sha1';
16
- import { formatDate } from './utils/format-date';
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
- let CollectionBrowser = class CollectionBrowser extends LitElement {
26
- constructor() {
27
- super();
28
- this.baseImageUrl = 'https://archive.org';
29
- this.searchType = SearchType.METADATA;
30
- this.defaultSortParam = null;
31
- this.selectedSort = SortField.default;
32
- this.selectedTitleFilter = null;
33
- this.selectedCreatorFilter = null;
34
- this.sortDirection = null;
35
- this.pageSize = 50;
36
- this.showHistogramDatePicker = false;
37
- this.suppressPlaceholders = false;
38
- this.suppressResultCount = false;
39
- this.suppressResultTiles = false;
40
- this.suppressURLQuery = false;
41
- this.suppressFacets = false;
42
- this.suppressSortBar = false;
43
- this.clearResultsOnEmptyQuery = false;
44
- this.collectionPagePath = '/details/';
45
- /** describes where this component is being used */
46
- this.searchContext = analyticsCategories.default;
47
- this.pageContext = 'search';
48
- this.restorationStateHandler = new RestorationStateHandler({
49
- context: this.pageContext,
50
- });
51
- this.mobileBreakpoint = 600;
52
- this.loggedIn = false;
53
- this.modalManager = undefined;
54
- /**
55
- * If item management UI active
56
- */
57
- this.isManageView = false;
58
- this.manageViewLabel = 'Select items to remove';
59
- /** Whether to replace the default sort options with a slot for customization (default: false) */
60
- this.enableSortOptionsSlot = false;
61
- /**
62
- * The results per page so we can paginate.
63
- *
64
- * This allows us to start in the middle of the search results and
65
- * fetch data before or after the current page. If we don't have a key
66
- * for the previous/next page, we'll fetch the next/previous page to populate it
67
- */
68
- this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
69
- /**
70
- * The page that the consumer wants to load.
71
- */
72
- this.initialPageNumber = 1;
73
- /**
74
- * This the the number of pages that we want to show.
75
- *
76
- * The data isn't necessarily loaded for all of the pages, but this lets us
77
- * know how many cells we should render.
78
- */
79
- this.pagesToRender = this.initialPageNumber;
80
- /**
81
- * Whether the initial page fetch for a new query is currently in progress.
82
- */
83
- this.searchResultsLoading = false;
84
- this.facetsLoading = false;
85
- this.mobileView = false;
86
- this.mobileFacetsVisible = false;
87
- this.defaultSortField = SortField.relevance;
88
- this.defaultSortDirection = null;
89
- this.placeholderType = null;
90
- /**
91
- * When we're animated scrolling to the page, we don't want to fetch
92
- * all of the pages as it scrolls so this lets us know if we're scrolling
93
- */
94
- this.isScrollingToCell = false;
95
- /**
96
- * When page width resizes from desktop to mobile, set true to
97
- * disable expand/collapse transition when loading.
98
- */
99
- this.isResizeToMobile = false;
100
- /**
101
- * Flag indicating that a new data source is currently being installed.
102
- * During the install, any URL persistence operation should replace the current entry
103
- * instead of creating a new one.
104
- */
105
- this.dataSourceInstallInProgress = false;
106
- this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
107
- /**
108
- * How many tiles to offset the data source by, to account for any removed tiles.
109
- */
110
- this.tileModelOffset = 0;
111
- /**
112
- * Updates the height of the left column according to its position on the page.
113
- * Arrow function ensures proper `this` binding.
114
- */
115
- this.updateLeftColumnHeight = () => {
116
- var _a, _b, _c, _d, _e;
117
- if (this.mobileView) {
118
- (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
119
- }
120
- else {
121
- const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
122
- (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
123
- }
124
- };
125
- /**
126
- * Toggles whether the fade-out is visible at the bottom of the facets.
127
- * It should only be visible if the facets are not scrolled to the bottom.
128
- * Arrow function ensures proper `this` binding.
129
- */
130
- this.updateFacetFadeOut = (entries) => {
131
- var _a, _b;
132
- const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
133
- 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);
134
- };
135
- // we only want to scroll on the very first query change
136
- // so this keeps track of whether we've already set the initial query
137
- this.initialQueryChangeHappened = false;
138
- this.historyPopOccurred = false;
139
- this.addController(this.dataSource);
140
- }
141
- tileModelAtCellIndex(index) {
142
- const model = this.dataSource.getTileModelAt(index);
143
- /**
144
- * If we encounter a model we don't have yet and we're not in the middle of an
145
- * automated scroll, fetch the page and just return undefined.
146
- * The datasource will be updated once the page is loaded and the cell will be rendered.
147
- *
148
- * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
149
- * user may never see.
150
- */
151
- if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
152
- const pageNumber = Math.floor(index / this.pageSize) + 1;
153
- this.dataSource.fetchPage(pageNumber);
154
- }
155
- return model;
156
- }
157
- // this is the total number of tiles we expect if
158
- // the data returned is a full page worth
159
- // this is useful for putting in placeholders for the expected number of tiles
160
- get estimatedTileCount() {
161
- return this.pagesToRender * this.pageSize;
162
- }
163
- /**
164
- * Returns a promise resolving to a unique string that persists for the current browser session.
165
- * Used in generating unique IDs for search requests, so that multiple requests coming from the
166
- * same browser session can be identified.
167
- */
168
- async getSessionId() {
169
- try {
170
- const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
171
- if (storedSessionId) {
172
- return storedSessionId;
173
- }
174
- // If we enter this method a second time while a first session ID is already being generated,
175
- // ensure we produce the same ID from both calls instead of generating another one.
176
- if (this.sessionIdGenPromise) {
177
- return this.sessionIdGenPromise;
178
- }
179
- this.sessionIdGenPromise = sha1(Math.random().toString());
180
- const newSessionId = await this.sessionIdGenPromise;
181
- sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
182
- return newSessionId;
183
- }
184
- catch (err) {
185
- // Either we can't generate the hash or we're restricted from accessing sessionStorage
186
- return '';
187
- }
188
- }
189
- /**
190
- * Go to the given page of results
191
- *
192
- * @param pageNumber
193
- */
194
- goToPage(pageNumber) {
195
- this.initialPageNumber = pageNumber;
196
- this.pagesToRender = pageNumber;
197
- return this.scrollToPage(pageNumber);
198
- }
199
- /**
200
- * Sets the state for whether the initial set of search results is loading in.
201
- */
202
- setSearchResultsLoading(loading) {
203
- this.searchResultsLoading = loading;
204
- }
205
- /**
206
- * Sets the state for whether facet data is loading in
207
- */
208
- setFacetsLoading(loading) {
209
- this.facetsLoading = loading;
210
- }
211
- /**
212
- * Sets the total number of results to be displayed for the current search
213
- */
214
- setTotalResultCount(totalResults) {
215
- this.totalResults = totalResults;
216
- }
217
- /**
218
- * Clears all selected/negated facets, date ranges, and letter filters.
219
- *
220
- * By default, the current sort field/direction are not cleared,
221
- * but this can be overridden by setting the `sort` option to `true`.
222
- *
223
- * Similarly, it is possible to finely control what is cleared by
224
- * setting any of the `facets`, `dateRange`, or `letterFilters` flags
225
- * in the options object.
226
- */
227
- clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
228
- // Don't bother clearing facets if none are checked, so that we don't
229
- // trigger unnecessary update cycles.
230
- if (facets && this.hasCheckedFacets) {
231
- this.selectedFacets = getDefaultSelectedFacets();
232
- }
233
- if (dateRange) {
234
- this.minSelectedDate = undefined;
235
- this.maxSelectedDate = undefined;
236
- }
237
- if (letterFilters) {
238
- this.selectedTitleFilter = null;
239
- this.selectedCreatorFilter = null;
240
- }
241
- if (sort) {
242
- this.sortDirection = null;
243
- this.selectedSort = SortField.default;
244
- }
245
- }
246
- /**
247
- * Returns true if the current value of `this.selectedFacets` contains
248
- * any facet buckets than have been selected or negated, or false otherwise.
249
- */
250
- get hasCheckedFacets() {
251
- if (!this.selectedFacets)
252
- return false;
253
- for (const facetGroup of Object.values(this.selectedFacets)) {
254
- for (const bucket of Object.values(facetGroup)) {
255
- if (bucket.state !== 'none')
256
- return true;
257
- }
258
- }
259
- return false;
260
- }
261
- /**
262
- * Returns true if there are any currently selected/negated facet buckets,
263
- * any selected date range, or any selected letter filters. False otherwise.
264
- *
265
- * Ignores sorting options.
266
- */
267
- get hasActiveFilters() {
268
- return !!(this.hasCheckedFacets ||
269
- this.minSelectedDate ||
270
- this.maxSelectedDate ||
271
- this.selectedTitleFilter ||
272
- this.selectedCreatorFilter);
273
- }
274
- render() {
275
- this.setPlaceholderType();
1
+ import { __decorate } from "tslib";
2
+ /* eslint-disable import/no-duplicates */
3
+ import { html, css, LitElement, nothing, } from 'lit';
4
+ import { customElement, property, query, state } from 'lit/decorators.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, } from './models';
10
+ import { RestorationStateHandler, } from './restoration-state-handler';
11
+ import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
+ import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
13
+ import chevronIcon from './assets/img/icons/chevron';
14
+ import { srOnlyStyle } from './styles/sr-only';
15
+ import { sha1 } from './utils/sha1';
16
+ import { formatDate } from './utils/format-date';
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
+ let CollectionBrowser = class CollectionBrowser extends LitElement {
26
+ constructor() {
27
+ super();
28
+ this.baseImageUrl = 'https://archive.org';
29
+ /**
30
+ * Which backend should be targeted by searches (e.g., metadata or FTS)
31
+ */
32
+ this.searchType = SearchType.METADATA;
33
+ this.defaultSortParam = null;
34
+ this.selectedSort = SortField.default;
35
+ this.selectedTitleFilter = null;
36
+ this.selectedCreatorFilter = null;
37
+ this.sortDirection = null;
38
+ this.pageSize = 50;
39
+ /**
40
+ * Whether to show the date picker (above the facets)
41
+ */
42
+ this.showHistogramDatePicker = false;
43
+ /**
44
+ * Whether placeholder views should be suppressed. If true, searches that produce an
45
+ * error or empty result set will simply show a blank results view instead of a placeholder.
46
+ */
47
+ this.suppressPlaceholders = false;
48
+ /**
49
+ * Whether the result count text should be suppressed.
50
+ * If true, no "X Results" message will be shown.
51
+ */
52
+ this.suppressResultCount = false;
53
+ /**
54
+ * Whether the scrolling result view should be suppressed entirely.
55
+ * If true, no infinite scroller (and thus no result tiles) will be rendered.
56
+ */
57
+ this.suppressResultTiles = false;
58
+ /**
59
+ * Whether to suppress persistence of the query to the URL.
60
+ * If true, the `query` param will not be added to the URL or updated on query changes.
61
+ */
62
+ this.suppressURLQuery = false;
63
+ /**
64
+ * Whether to suppress the display of facets.
65
+ * If true, the facet sidebar content will be replaced by a message that facets are
66
+ * temporarily unavailable.
67
+ */
68
+ this.suppressFacets = false;
69
+ /**
70
+ * Whether to suppress display of the sort bar.
71
+ * If true, the entire sort bar (incl. display modes) will be omitted from rendering.
72
+ */
73
+ this.suppressSortBar = false;
74
+ /**
75
+ * Whether to suppress showing the display mode options in the sort bar.
76
+ * If true, those options will be omitted (though the rest of the sort bar may still render).
77
+ */
78
+ this.suppressDisplayModes = false;
79
+ this.clearResultsOnEmptyQuery = false;
80
+ this.collectionPagePath = '/details/';
81
+ /** describes where this component is being used */
82
+ this.searchContext = analyticsCategories.default;
83
+ this.pageContext = 'search';
84
+ this.restorationStateHandler = new RestorationStateHandler({
85
+ context: this.pageContext,
86
+ });
87
+ this.mobileBreakpoint = 600;
88
+ this.loggedIn = false;
89
+ this.modalManager = undefined;
90
+ /**
91
+ * If item management UI active
92
+ */
93
+ this.isManageView = false;
94
+ this.manageViewLabel = 'Select items to remove';
95
+ /** Whether to replace the default sort options with a slot for customization (default: false) */
96
+ this.enableSortOptionsSlot = false;
97
+ /**
98
+ * The results per page so we can paginate.
99
+ *
100
+ * This allows us to start in the middle of the search results and
101
+ * fetch data before or after the current page. If we don't have a key
102
+ * for the previous/next page, we'll fetch the next/previous page to populate it
103
+ */
104
+ this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
105
+ /**
106
+ * The page that the consumer wants to load.
107
+ */
108
+ this.initialPageNumber = 1;
109
+ /**
110
+ * This the the number of pages that we want to show.
111
+ *
112
+ * The data isn't necessarily loaded for all of the pages, but this lets us
113
+ * know how many cells we should render.
114
+ */
115
+ this.pagesToRender = this.initialPageNumber;
116
+ /**
117
+ * Whether the initial page fetch for a new query is currently in progress.
118
+ */
119
+ this.searchResultsLoading = false;
120
+ this.facetsLoading = false;
121
+ this.mobileView = false;
122
+ this.mobileFacetsVisible = false;
123
+ this.defaultSortField = SortField.relevance;
124
+ this.defaultSortDirection = null;
125
+ this.placeholderType = null;
126
+ /**
127
+ * When we're animated scrolling to the page, we don't want to fetch
128
+ * all of the pages as it scrolls so this lets us know if we're scrolling
129
+ */
130
+ this.isScrollingToCell = false;
131
+ /**
132
+ * When page width resizes from desktop to mobile, set true to
133
+ * disable expand/collapse transition when loading.
134
+ */
135
+ this.isResizeToMobile = false;
136
+ /**
137
+ * Flag indicating that a new data source is currently being installed.
138
+ * During the install, any URL persistence operation should replace the current entry
139
+ * instead of creating a new one.
140
+ */
141
+ this.dataSourceInstallInProgress = false;
142
+ this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
143
+ /**
144
+ * How many tiles to offset the data source by, to account for any removed tiles.
145
+ */
146
+ this.tileModelOffset = 0;
147
+ /**
148
+ * Updates the height of the left column according to its position on the page.
149
+ * Arrow function ensures proper `this` binding.
150
+ */
151
+ this.updateLeftColumnHeight = () => {
152
+ var _a, _b, _c, _d, _e;
153
+ if (this.mobileView) {
154
+ (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
155
+ }
156
+ else {
157
+ const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
158
+ (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
159
+ }
160
+ };
161
+ /**
162
+ * Toggles whether the fade-out is visible at the bottom of the facets.
163
+ * It should only be visible if the facets are not scrolled to the bottom.
164
+ * Arrow function ensures proper `this` binding.
165
+ */
166
+ this.updateFacetFadeOut = (entries) => {
167
+ var _a, _b;
168
+ const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
169
+ 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);
170
+ };
171
+ // we only want to scroll on the very first query change
172
+ // so this keeps track of whether we've already set the initial query
173
+ this.initialQueryChangeHappened = false;
174
+ this.historyPopOccurred = false;
175
+ this.addController(this.dataSource);
176
+ }
177
+ tileModelAtCellIndex(index) {
178
+ const model = this.dataSource.getTileModelAt(index);
179
+ /**
180
+ * If we encounter a model we don't have yet and we're not in the middle of an
181
+ * automated scroll, fetch the page and just return undefined.
182
+ * The datasource will be updated once the page is loaded and the cell will be rendered.
183
+ *
184
+ * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
185
+ * user may never see.
186
+ */
187
+ if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
188
+ const pageNumber = Math.floor(index / this.pageSize) + 1;
189
+ this.dataSource.fetchPage(pageNumber);
190
+ }
191
+ return model;
192
+ }
193
+ // this is the total number of tiles we expect if
194
+ // the data returned is a full page worth
195
+ // this is useful for putting in placeholders for the expected number of tiles
196
+ get estimatedTileCount() {
197
+ return this.pagesToRender * this.pageSize;
198
+ }
199
+ /**
200
+ * Returns a promise resolving to a unique string that persists for the current browser session.
201
+ * Used in generating unique IDs for search requests, so that multiple requests coming from the
202
+ * same browser session can be identified.
203
+ */
204
+ async getSessionId() {
205
+ try {
206
+ const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
207
+ if (storedSessionId) {
208
+ return storedSessionId;
209
+ }
210
+ // If we enter this method a second time while a first session ID is already being generated,
211
+ // ensure we produce the same ID from both calls instead of generating another one.
212
+ if (this.sessionIdGenPromise) {
213
+ return this.sessionIdGenPromise;
214
+ }
215
+ this.sessionIdGenPromise = sha1(Math.random().toString());
216
+ const newSessionId = await this.sessionIdGenPromise;
217
+ sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
218
+ return newSessionId;
219
+ }
220
+ catch (err) {
221
+ // Either we can't generate the hash or we're restricted from accessing sessionStorage
222
+ return '';
223
+ }
224
+ }
225
+ /**
226
+ * Go to the given page of results
227
+ *
228
+ * @param pageNumber
229
+ */
230
+ goToPage(pageNumber) {
231
+ this.initialPageNumber = pageNumber;
232
+ this.pagesToRender = pageNumber;
233
+ return this.scrollToPage(pageNumber);
234
+ }
235
+ /**
236
+ * Sets the state for whether the initial set of search results is loading in.
237
+ */
238
+ setSearchResultsLoading(loading) {
239
+ this.searchResultsLoading = loading;
240
+ }
241
+ /**
242
+ * Sets the state for whether facet data is loading in
243
+ */
244
+ setFacetsLoading(loading) {
245
+ this.facetsLoading = loading;
246
+ }
247
+ /**
248
+ * Sets the total number of results to be displayed for the current search
249
+ */
250
+ setTotalResultCount(totalResults) {
251
+ this.totalResults = totalResults;
252
+ }
253
+ /**
254
+ * Clears all selected/negated facets, date ranges, and letter filters.
255
+ *
256
+ * By default, the current sort field/direction are not cleared,
257
+ * but this can be overridden by setting the `sort` option to `true`.
258
+ *
259
+ * Similarly, it is possible to finely control what is cleared by
260
+ * setting any of the `facets`, `dateRange`, or `letterFilters` flags
261
+ * in the options object.
262
+ */
263
+ clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
264
+ // Don't bother clearing facets if none are checked, so that we don't
265
+ // trigger unnecessary update cycles.
266
+ if (facets && this.hasCheckedFacets) {
267
+ this.selectedFacets = getDefaultSelectedFacets();
268
+ }
269
+ if (dateRange) {
270
+ this.minSelectedDate = undefined;
271
+ this.maxSelectedDate = undefined;
272
+ }
273
+ if (letterFilters) {
274
+ this.selectedTitleFilter = null;
275
+ this.selectedCreatorFilter = null;
276
+ }
277
+ if (sort) {
278
+ this.sortDirection = null;
279
+ this.selectedSort = SortField.default;
280
+ }
281
+ }
282
+ /**
283
+ * Returns true if the current value of `this.selectedFacets` contains
284
+ * any facet buckets than have been selected or negated, or false otherwise.
285
+ */
286
+ get hasCheckedFacets() {
287
+ if (!this.selectedFacets)
288
+ return false;
289
+ for (const facetGroup of Object.values(this.selectedFacets)) {
290
+ for (const bucket of Object.values(facetGroup)) {
291
+ if (bucket.state !== 'none')
292
+ return true;
293
+ }
294
+ }
295
+ return false;
296
+ }
297
+ /**
298
+ * Returns true if there are any currently selected/negated facet buckets,
299
+ * any selected date range, or any selected letter filters. False otherwise.
300
+ *
301
+ * Ignores sorting options.
302
+ */
303
+ get hasActiveFilters() {
304
+ return !!(this.hasCheckedFacets ||
305
+ this.minSelectedDate ||
306
+ this.maxSelectedDate ||
307
+ this.selectedTitleFilter ||
308
+ this.selectedCreatorFilter);
309
+ }
310
+ render() {
311
+ this.setPlaceholderType();
276
312
  return html `
277
313
  <div
278
314
  id="content-container"
279
315
  class=${this.mobileView ? 'mobile' : 'desktop'}
280
316
  >
281
- ${this.placeholderType
282
- ? this.emptyPlaceholderTemplate
317
+ ${this.placeholderType
318
+ ? this.emptyPlaceholderTemplate
283
319
  : this.collectionBrowserTemplate}
284
320
  </div>
285
- `;
286
- }
287
- setPlaceholderType() {
288
- var _a;
289
- const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
290
- const isCollection = !!this.withinCollection;
291
- const isProfile = !!this.withinProfile;
292
- const noResults = !this.searchResultsLoading &&
293
- (this.dataSource.size === 0 || !this.searchService);
294
- this.placeholderType = null;
295
- if (this.suppressPlaceholders)
296
- return;
297
- if (!hasQuery && !isCollection && !isProfile) {
298
- this.placeholderType = 'empty-query';
299
- }
300
- else if (noResults) {
301
- // Within a collection, no query + no results means the collection simply has no viewable items.
302
- // Otherwise, we must have a user query that produced 0 results.
303
- this.placeholderType =
304
- !hasQuery && isCollection ? 'empty-collection' : 'no-results';
305
- }
306
- if (this.dataSource.queryErrorMessage) {
307
- this.placeholderType =
308
- !hasQuery && isCollection ? 'collection-error' : 'query-error';
309
- }
310
- }
311
- get emptyPlaceholderTemplate() {
312
- var _a;
321
+ `;
322
+ }
323
+ setPlaceholderType() {
324
+ var _a;
325
+ const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
326
+ const isCollection = !!this.withinCollection;
327
+ const isProfile = !!this.withinProfile;
328
+ const noResults = !this.searchResultsLoading &&
329
+ (this.dataSource.size === 0 || !this.searchService);
330
+ this.placeholderType = null;
331
+ if (this.suppressPlaceholders)
332
+ return;
333
+ if (!hasQuery && !isCollection && !isProfile) {
334
+ this.placeholderType = 'empty-query';
335
+ }
336
+ else if (noResults) {
337
+ // Within a collection, no query + no results means the collection simply has no viewable items.
338
+ // Otherwise, we must have a user query that produced 0 results.
339
+ this.placeholderType =
340
+ !hasQuery && isCollection ? 'empty-collection' : 'no-results';
341
+ }
342
+ if (this.dataSource.queryErrorMessage) {
343
+ this.placeholderType =
344
+ !hasQuery && isCollection ? 'collection-error' : 'query-error';
345
+ }
346
+ }
347
+ get emptyPlaceholderTemplate() {
348
+ var _a;
313
349
  return html `
314
350
  <empty-placeholder
315
351
  .placeholderType=${this.placeholderType}
@@ -318,33 +354,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
318
354
  .detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
319
355
  .baseNavigationUrl=${this.baseNavigationUrl}
320
356
  ></empty-placeholder>
321
- `;
322
- }
323
- /**
324
- * Top-level template for rendering the left (facets) and right (results) columns.
325
- */
326
- get collectionBrowserTemplate() {
357
+ `;
358
+ }
359
+ /**
360
+ * Top-level template for rendering the left (facets) and right (results) columns.
361
+ */
362
+ get collectionBrowserTemplate() {
327
363
  return html `
328
364
  <div id="left-column-scroll-sentinel"></div>
329
365
  ${this.leftColumnTemplate} ${this.rightColumnTemplate}
330
- `;
331
- }
332
- /**
333
- * Template for either the mobile or desktop version of the left column, depending
334
- * on current component state.
335
- */
336
- get leftColumnTemplate() {
337
- if (this.mobileView) {
338
- return this.mobileLeftColumnTemplate;
339
- }
340
- return this.desktopLeftColumnTemplate;
341
- }
342
- /**
343
- * Template for the mobile version of the "left column" (which in this case, appears
344
- * *above* the search results rather than beside them), for rendering the
345
- * accordion-style facets.
346
- */
347
- get mobileLeftColumnTemplate() {
366
+ `;
367
+ }
368
+ /**
369
+ * Template for either the mobile or desktop version of the left column, depending
370
+ * on current component state.
371
+ */
372
+ get leftColumnTemplate() {
373
+ if (this.mobileView) {
374
+ return this.mobileLeftColumnTemplate;
375
+ }
376
+ return this.desktopLeftColumnTemplate;
377
+ }
378
+ /**
379
+ * Template for the mobile version of the "left column" (which in this case, appears
380
+ * *above* the search results rather than beside them), for rendering the
381
+ * accordion-style facets.
382
+ */
383
+ get mobileLeftColumnTemplate() {
348
384
  return html `
349
385
  <div
350
386
  id="left-column"
@@ -353,12 +389,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
353
389
  ${this.facetTopViewSlot} ${this.resultsCountTemplate}
354
390
  <div id="facets-header-container">${this.mobileFacetsTemplate}</div>
355
391
  </div>
356
- `;
357
- }
358
- /**
359
- * Template for the desktop version of the left column, displaying the facets sidebar.
360
- */
361
- get desktopLeftColumnTemplate() {
392
+ `;
393
+ }
394
+ /**
395
+ * Template for the desktop version of the left column, displaying the facets sidebar.
396
+ */
397
+ get desktopLeftColumnTemplate() {
362
398
  return html `
363
399
  <div id="left-column" class="column">
364
400
  ${this.facetTopViewSlot}
@@ -372,28 +408,28 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
372
408
  </div>
373
409
  <div id="facets-bottom-fade"></div>
374
410
  </div>
375
- `;
376
- }
377
- /**
378
- * Slot which is placed at top of the facets area for user-profile page
379
- * - mainly used to render userlists
380
- */
381
- get facetTopViewSlot() {
411
+ `;
412
+ }
413
+ /**
414
+ * Slot which is placed at top of the facets area for user-profile page
415
+ * - mainly used to render userlists
416
+ */
417
+ get facetTopViewSlot() {
382
418
  return html `<div id="facet-top-view">
383
419
  <slot name="facet-top-slot"></slot>
384
- </div>`;
385
- }
386
- /**
387
- * Template for the "X Results" count at the top of the search results.
388
- * Changes to the "Searching..." label if the search results are still loading.
389
- */
390
- get resultsCountTemplate() {
391
- var _a;
392
- if (this.suppressResultCount)
393
- return nothing;
394
- const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
395
- const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
396
- const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
420
+ </div>`;
421
+ }
422
+ /**
423
+ * Template for the "X Results" count at the top of the search results.
424
+ * Changes to the "Searching..." label if the search results are still loading.
425
+ */
426
+ get resultsCountTemplate() {
427
+ var _a;
428
+ if (this.suppressResultCount)
429
+ return nothing;
430
+ const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
431
+ const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
432
+ const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
397
433
  return html `
398
434
  <div id="results-total">
399
435
  <span id="big-results-count">
@@ -403,30 +439,30 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
403
439
  ${shouldShowSearching ? nothing : resultsLabel}
404
440
  </span>
405
441
  </div>
406
- `;
407
- }
408
- /**
409
- * Template for the right column of the collection browser, where the result
410
- * tiles and sort/filter bar are shown.
411
- */
412
- get rightColumnTemplate() {
442
+ `;
443
+ }
444
+ /**
445
+ * Template for the right column of the collection browser, where the result
446
+ * tiles and sort/filter bar are shown.
447
+ */
448
+ get rightColumnTemplate() {
413
449
  return html `
414
450
  <div id="right-column" class="column">
415
451
  <div id="cb-top-view">
416
452
  <slot name="cb-top-slot"></slot>
417
453
  </div>
418
- ${this.isManageView
419
- ? this.manageBarTemplate
454
+ ${this.isManageView
455
+ ? this.manageBarTemplate
420
456
  : this.sortFilterBarTemplate}
421
457
  <slot name="cb-results"></slot>
422
- ${this.displayMode === `list-compact`
423
- ? this.listHeaderTemplate
458
+ ${this.displayMode === `list-compact`
459
+ ? this.listHeaderTemplate
424
460
  : nothing}
425
461
  ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
426
462
  </div>
427
- `;
428
- }
429
- get infiniteScrollerTemplate() {
463
+ `;
464
+ }
465
+ get infiniteScrollerTemplate() {
430
466
  return html `<infinite-scroller
431
467
  class=${this.infiniteScrollerClasses}
432
468
  itemCount=${this.placeholderType ? 0 : nothing}
@@ -435,22 +471,22 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
435
471
  .placeholderCellTemplate=${this.placeholderCellTemplate}
436
472
  @scrollThresholdReached=${this.scrollThresholdReached}
437
473
  @visibleCellsChanged=${this.visibleCellsChanged}
438
- >${this.displayMode === 'grid'
439
- ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
474
+ >${this.displayMode === 'grid'
475
+ ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
440
476
  : nothing}
441
- </infinite-scroller>`;
442
- }
443
- get infiniteScrollerClasses() {
444
- var _a;
445
- return classMap({
446
- [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
447
- hidden: !!this.placeholderType,
448
- });
449
- }
450
- get sortFilterBarTemplate() {
451
- var _a;
452
- if (this.suppressSortBar)
453
- return nothing;
477
+ </infinite-scroller>`;
478
+ }
479
+ get infiniteScrollerClasses() {
480
+ var _a;
481
+ return classMap({
482
+ [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
483
+ hidden: !!this.placeholderType,
484
+ });
485
+ }
486
+ get sortFilterBarTemplate() {
487
+ var _a;
488
+ if (this.suppressSortBar)
489
+ return nothing;
454
490
  return html `
455
491
  <sort-filter-bar
456
492
  .defaultSortField=${this.defaultSortField}
@@ -465,6 +501,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
465
501
  .prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}
466
502
  .resizeObserver=${this.resizeObserver}
467
503
  .enableSortOptionsSlot=${this.enableSortOptionsSlot}
504
+ .suppressDisplayModes=${this.suppressDisplayModes}
468
505
  @sortChanged=${this.userChangedSort}
469
506
  @displayModeChanged=${this.displayModeChanged}
470
507
  @titleLetterChanged=${this.titleLetterSelected}
@@ -472,10 +509,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
472
509
  >
473
510
  <slot name="sort-options-left" slot="sort-options-left"></slot>
474
511
  <slot name="sort-options" slot="sort-options"></slot>
512
+ <slot name="sort-options-right" slot="sort-options-right"></slot>
475
513
  </sort-filter-bar>
476
- `;
477
- }
478
- get manageBarTemplate() {
514
+ `;
515
+ }
516
+ get manageBarTemplate() {
479
517
  return html `
480
518
  <manage-bar
481
519
  .label=${this.manageViewLabel}
@@ -485,189 +523,192 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
485
523
  @removeItems=${this.handleRemoveItems}
486
524
  @selectAll=${() => this.dataSource.checkAllTiles()}
487
525
  @unselectAll=${() => this.dataSource.uncheckAllTiles()}
488
- @cancel=${() => {
489
- this.isManageView = false;
490
- this.dataSource.uncheckAllTiles();
526
+ @cancel=${() => {
527
+ this.isManageView = false;
528
+ this.dataSource.uncheckAllTiles();
491
529
  }}
492
530
  ></manage-bar>
493
- `;
494
- }
495
- /**
496
- * Handler for when the user requests to remove all checked items via the manage bar.
497
- * Emits an `itemRemovalRequested` event with all checked tile models.
498
- */
499
- handleRemoveItems() {
500
- this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
501
- detail: {
502
- items: this.dataSource.checkedTileModels.map(model => {
503
- const cloned = model.clone();
504
- cloned.dateStr = formatDate(model.datePublished, 'long');
505
- return cloned;
506
- }),
507
- },
508
- }));
509
- }
510
- /**
511
- * Removes all tile models that are currently checked & adjusts the paging
512
- * of the data source to account for any new gaps in the data.
513
- */
514
- removeCheckedTiles() {
515
- this.dataSource.removeCheckedTiles();
516
- }
517
- userChangedSort(e) {
518
- var _a;
519
- const { selectedSort, sortDirection } = e.detail;
520
- this.selectedSort = selectedSort;
521
- this.sortDirection = sortDirection;
522
- if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
523
- this.goToPage(1);
524
- }
525
- this.currentPage = 1;
526
- }
527
- sendSortByAnalytics(prevSortDirection) {
528
- var _a;
529
- const directionCleared = prevSortDirection && !this.sortDirection;
530
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
531
- category: this.searchContext,
532
- action: analyticsActions.sortBy,
533
- label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
534
- });
535
- }
536
- selectedSortChanged() {
537
- // Lazy-load the alphabet counts for title/creator sort bar as needed
538
- this.dataSource.updatePrefixFiltersForCurrentSort();
539
- }
540
- get sortParam() {
541
- var _a;
542
- const sortOption = SORT_OPTIONS[this.selectedSort];
543
- if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
544
- return null;
545
- }
546
- // If the sort option specified in the URL is unrecognized, we just use it as-is
547
- const urlSortParam = new URL(window.location.href).searchParams.get('sort');
548
- const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
549
- // If the sort direction is still null at this point, then we assume ascending
550
- // (i.e., it was unrecognized and had no directional flag)
551
- if (!this.sortDirection)
552
- this.sortDirection = 'asc';
553
- if (!sortField)
554
- return null;
555
- return { field: sortField, direction: this.sortDirection };
556
- }
557
- displayModeChanged(e) {
558
- var _a;
559
- this.displayMode = e.detail.displayMode;
560
- if (this.displayMode) {
561
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
562
- category: this.searchContext,
563
- action: analyticsActions.displayMode,
564
- label: this.displayMode,
565
- });
566
- }
567
- }
568
- /**
569
- * Returns a query clause identifying the currently selected title filter,
570
- * e.g., `firstTitle:X`.
571
- */
572
- get titleQuery() {
573
- return this.selectedTitleFilter
574
- ? `firstTitle:${this.selectedTitleFilter}`
575
- : undefined;
576
- }
577
- /**
578
- * Returns a query clause identifying the currently selected creator filter,
579
- * e.g., `firstCreator:X`.
580
- */
581
- get creatorQuery() {
582
- return this.selectedCreatorFilter
583
- ? `firstCreator:${this.selectedCreatorFilter}`
584
- : undefined;
585
- }
586
- /**
587
- * Send Analytics when sorting by title's first letter
588
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
589
- */
590
- sendFilterByTitleAnalytics(prevSelectedLetter) {
591
- var _a;
592
- if (!prevSelectedLetter && !this.selectedTitleFilter) {
593
- return;
594
- }
595
- const cleared = prevSelectedLetter && !this.selectedTitleFilter;
596
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
597
- category: this.searchContext,
598
- action: analyticsActions.filterByTitle,
599
- label: cleared
600
- ? `clear-${prevSelectedLetter}`
601
- : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
602
- });
603
- }
604
- /**
605
- * Send Analytics when filtering by creator's first letter
606
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
607
- */
608
- sendFilterByCreatorAnalytics(prevSelectedLetter) {
609
- var _a;
610
- if (!prevSelectedLetter && !this.selectedCreatorFilter) {
611
- return;
612
- }
613
- const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
614
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
615
- category: this.searchContext,
616
- action: analyticsActions.filterByCreator,
617
- label: cleared
618
- ? `clear-${prevSelectedLetter}`
619
- : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
620
- });
621
- }
622
- /**
623
- * Handler for changes to which letter is selected in the title alphabet bar.
624
- */
625
- titleLetterSelected(e) {
626
- this.selectedCreatorFilter = null;
627
- this.selectedTitleFilter = e.detail.selectedLetter;
628
- }
629
- /**
630
- * Handler for changes to which letter is selected in the creator alphabet bar.
631
- */
632
- creatorLetterSelected(e) {
633
- this.selectedTitleFilter = null;
634
- this.selectedCreatorFilter = e.detail.selectedLetter;
635
- }
636
- /**
637
- * The full template for how the facets should be structured in mobile view,
638
- * including the collapsible container (with header) and the facets themselves.
639
- */
640
- get mobileFacetsTemplate() {
641
- const toggleFacetsVisible = () => {
642
- this.isResizeToMobile = false;
643
- this.mobileFacetsVisible = !this.mobileFacetsVisible;
644
- };
531
+ `;
532
+ }
533
+ /**
534
+ * Handler for when the user requests to remove all checked items via the manage bar.
535
+ * Emits an `itemRemovalRequested` event with all checked tile models.
536
+ */
537
+ handleRemoveItems() {
538
+ this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
539
+ detail: {
540
+ items: this.dataSource.checkedTileModels.map(model => {
541
+ const cloned = model.clone();
542
+ cloned.dateStr = formatDate(model.datePublished, 'long');
543
+ return cloned;
544
+ }),
545
+ },
546
+ }));
547
+ }
548
+ /**
549
+ * Removes all tile models that are currently checked & adjusts the paging
550
+ * of the data source to account for any new gaps in the data.
551
+ */
552
+ removeCheckedTiles() {
553
+ this.dataSource.removeCheckedTiles();
554
+ }
555
+ userChangedSort(e) {
556
+ var _a;
557
+ const { selectedSort, sortDirection } = e.detail;
558
+ this.selectedSort = selectedSort;
559
+ this.sortDirection = sortDirection;
560
+ if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
561
+ this.goToPage(1);
562
+ }
563
+ this.currentPage = 1;
564
+ }
565
+ sendSortByAnalytics(prevSortDirection) {
566
+ var _a;
567
+ const directionCleared = prevSortDirection && !this.sortDirection;
568
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
569
+ category: this.searchContext,
570
+ action: analyticsActions.sortBy,
571
+ label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
572
+ });
573
+ }
574
+ selectedSortChanged() {
575
+ // Lazy-load the alphabet counts for title/creator sort bar as needed
576
+ this.dataSource.updatePrefixFiltersForCurrentSort();
577
+ }
578
+ get sortParam() {
579
+ var _a;
580
+ const sortOption = SORT_OPTIONS[this.selectedSort];
581
+ if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
582
+ return null;
583
+ }
584
+ // If the sort option specified in the URL is unrecognized, we just use it as-is
585
+ const urlSortParam = new URL(window.location.href).searchParams.get('sort');
586
+ const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
587
+ // If the sort direction is still null at this point, then we assume ascending
588
+ // (i.e., it was unrecognized and had no directional flag)
589
+ if (!this.sortDirection)
590
+ this.sortDirection = 'asc';
591
+ if (!sortField)
592
+ return null;
593
+ return { field: sortField, direction: this.sortDirection };
594
+ }
595
+ displayModeChanged(e) {
596
+ var _a;
597
+ this.displayMode = e.detail.displayMode;
598
+ if (this.displayMode) {
599
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
600
+ category: this.searchContext,
601
+ action: analyticsActions.displayMode,
602
+ label: this.displayMode,
603
+ });
604
+ }
605
+ }
606
+ /**
607
+ * Returns a query clause identifying the currently selected title filter,
608
+ * e.g., `firstTitle:X`.
609
+ */
610
+ get titleQuery() {
611
+ return this.selectedTitleFilter
612
+ ? `firstTitle:${this.selectedTitleFilter}`
613
+ : undefined;
614
+ }
615
+ /**
616
+ * Returns a query clause identifying the currently selected creator filter,
617
+ * e.g., `firstCreator:X`.
618
+ */
619
+ get creatorQuery() {
620
+ return this.selectedCreatorFilter
621
+ ? `firstCreator:${this.selectedCreatorFilter}`
622
+ : undefined;
623
+ }
624
+ /**
625
+ * Send Analytics when sorting by title's first letter
626
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
627
+ */
628
+ sendFilterByTitleAnalytics(prevSelectedLetter) {
629
+ var _a;
630
+ if (!prevSelectedLetter && !this.selectedTitleFilter) {
631
+ return;
632
+ }
633
+ const cleared = prevSelectedLetter && !this.selectedTitleFilter;
634
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
635
+ category: this.searchContext,
636
+ action: analyticsActions.filterByTitle,
637
+ label: cleared
638
+ ? `clear-${prevSelectedLetter}`
639
+ : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
640
+ });
641
+ }
642
+ /**
643
+ * Send Analytics when filtering by creator's first letter
644
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
645
+ */
646
+ sendFilterByCreatorAnalytics(prevSelectedLetter) {
647
+ var _a;
648
+ if (!prevSelectedLetter && !this.selectedCreatorFilter) {
649
+ return;
650
+ }
651
+ const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
652
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
653
+ category: this.searchContext,
654
+ action: analyticsActions.filterByCreator,
655
+ label: cleared
656
+ ? `clear-${prevSelectedLetter}`
657
+ : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
658
+ });
659
+ }
660
+ /**
661
+ * Handler for changes to which letter is selected in the title alphabet bar.
662
+ */
663
+ titleLetterSelected(e) {
664
+ this.selectedCreatorFilter = null;
665
+ this.selectedTitleFilter = e.detail.selectedLetter;
666
+ }
667
+ /**
668
+ * Handler for changes to which letter is selected in the creator alphabet bar.
669
+ */
670
+ creatorLetterSelected(e) {
671
+ this.selectedTitleFilter = null;
672
+ this.selectedCreatorFilter = e.detail.selectedLetter;
673
+ }
674
+ /**
675
+ * The full template for how the facets should be structured in mobile view,
676
+ * including the collapsible container (with header) and the facets themselves.
677
+ */
678
+ get mobileFacetsTemplate() {
679
+ const toggleFacetsVisible = (e) => {
680
+ var _a;
681
+ this.isResizeToMobile = false;
682
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
683
+ const target = e.target;
684
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
685
+ category: this.searchContext,
686
+ action: analyticsActions.mobileFacetsToggled,
687
+ label: target.open ? 'open' : 'closed',
688
+ });
689
+ };
645
690
  return html `
646
- <details
647
- id="mobile-filter-collapse"
648
- @click=${toggleFacetsVisible}
649
- @keyup=${toggleFacetsVisible}
650
- >
691
+ <details id="mobile-filter-collapse" @toggle=${toggleFacetsVisible}>
651
692
  <summary>
652
693
  <span class="collapser-icon">${chevronIcon}</span>
653
- <h2>Filters</h2>
694
+ <h2>${msg('Filters')}</h2>
654
695
  ${this.clearFiltersBtnTemplate(true)}
655
696
  </summary>
656
697
  ${this.facetsTemplate}
657
698
  </details>
658
- `;
659
- }
660
- /**
661
- * The template for the facets component alone, without any surrounding wrappers.
662
- */
663
- get facetsTemplate() {
664
- if (this.suppressFacets) {
699
+ `;
700
+ }
701
+ /**
702
+ * The template for the facets component alone, without any surrounding wrappers.
703
+ */
704
+ get facetsTemplate() {
705
+ if (this.suppressFacets) {
665
706
  return html `
666
707
  <p class="facets-message">
667
708
  ${msg('Facets are temporarily unavailable.')}
668
709
  </p>
669
- `;
670
- }
710
+ `;
711
+ }
671
712
  return html `
672
713
  <collection-facets
673
714
  @facetsChanged=${this.facetsChanged}
@@ -681,7 +722,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
681
722
  .resizeObserver=${this.resizeObserver}
682
723
  .searchType=${this.searchType}
683
724
  .aggregations=${this.dataSource.aggregations}
684
- .fullYearsHistogramAggregation=${this.dataSource
725
+ .fullYearsHistogramAggregation=${this.dataSource
685
726
  .yearHistogramAggregation}
686
727
  .minSelectedDate=${this.minSelectedDate}
687
728
  .maxSelectedDate=${this.maxSelectedDate}
@@ -702,41 +743,41 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
702
743
  .analyticsHandler=${this.analyticsHandler}
703
744
  >
704
745
  </collection-facets>
705
- `;
706
- }
707
- /**
708
- * The HTML template for the "Clear all filters" button, or `nothing` if no
709
- * filters are currently active.
710
- *
711
- * @param mobile Whether to style/shorten the button for mobile view
712
- */
713
- clearFiltersBtnTemplate(mobile) {
714
- if (!this.hasActiveFilters)
715
- return nothing;
716
- const buttonClasses = classMap({
717
- 'clear-filters-btn': true,
718
- mobile,
719
- });
720
- const buttonText = mobile ? 'Clear all' : 'Clear all filters';
746
+ `;
747
+ }
748
+ /**
749
+ * The HTML template for the "Clear all filters" button, or `nothing` if no
750
+ * filters are currently active.
751
+ *
752
+ * @param mobile Whether to style/shorten the button for mobile view
753
+ */
754
+ clearFiltersBtnTemplate(mobile) {
755
+ if (!this.hasActiveFilters)
756
+ return nothing;
757
+ const buttonClasses = classMap({
758
+ 'clear-filters-btn': true,
759
+ mobile,
760
+ });
761
+ const buttonText = mobile ? 'Clear all' : 'Clear all filters';
721
762
  return html `
722
763
  <div class="clear-filters-btn-row">
723
- ${mobile
724
- ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
764
+ ${mobile
765
+ ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
725
766
  : nothing}
726
767
  <button class=${buttonClasses} @click=${this.clearFilters}>
727
768
  ${buttonText}
728
769
  </button>
729
770
  </div>
730
- `;
731
- }
732
- get loadingTemplate() {
771
+ `;
772
+ }
773
+ get loadingTemplate() {
733
774
  return html `
734
775
  <div class="loading-cover">
735
776
  <circular-activity-indicator></circular-activity-indicator>
736
777
  </div>
737
- `;
738
- }
739
- get listHeaderTemplate() {
778
+ `;
779
+ }
780
+ get listHeaderTemplate() {
740
781
  return html `
741
782
  <div id="list-header">
742
783
  <tile-dispatcher
@@ -749,600 +790,601 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
749
790
  >
750
791
  </tile-dispatcher>
751
792
  </div>
752
- `;
753
- }
754
- histogramDateRangeUpdated(e) {
755
- var _a;
756
- const { minDate, maxDate } = e.detail;
757
- [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
758
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
759
- category: this.searchContext,
760
- action: analyticsActions.histogramChanged,
761
- label: this.dateRangeQueryClause,
762
- });
763
- }
764
- get dateRangeQueryClause() {
765
- if (!this.minSelectedDate || !this.maxSelectedDate) {
766
- return undefined;
767
- }
768
- return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
769
- }
770
- /**
771
- * Emits an event indicating a change in whether the manage mode is shown.
772
- */
773
- emitManageModeChangedEvent() {
774
- this.dispatchEvent(new CustomEvent('manageModeChanged', {
775
- detail: this.isManageView,
776
- }));
777
- }
778
- async installDataSourceAndQueryState(dataSource, queryState) {
779
- var _a, _b;
780
- log('Installing data source & query state in CB:', dataSource, queryState);
781
- if (this.dataSource)
782
- this.removeController(this.dataSource);
783
- this.dataSource = dataSource;
784
- this.addController(this.dataSource);
785
- this.baseQuery = queryState.baseQuery;
786
- this.profileElement = queryState.profileElement;
787
- this.searchType = queryState.searchType;
788
- this.selectedFacets =
789
- (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
790
- this.minSelectedDate = queryState.minSelectedDate;
791
- this.maxSelectedDate = queryState.maxSelectedDate;
792
- this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
793
- this.sortDirection = queryState.sortDirection;
794
- this.selectedTitleFilter = queryState.selectedTitleFilter;
795
- this.selectedCreatorFilter = queryState.selectedCreatorFilter;
796
- // We set this flag during the update to prevent the URL state persistence
797
- // from creating an unwanted extra history entry.
798
- this.dataSourceInstallInProgress = true;
799
- this.requestUpdate();
800
- await this.updateComplete;
801
- this.dataSourceInstallInProgress = false;
802
- if (!this.searchResultsLoading) {
803
- this.setTotalResultCount(this.dataSource.totalResults);
804
- this.setTileCount(this.dataSource.size);
805
- }
806
- this.refreshVisibleResults();
807
- }
808
- firstUpdated() {
809
- this.restoreState();
810
- }
811
- updated(changed) {
812
- var _a, _b;
813
- if (changed.has('placeholderType') && this.placeholderType === null) {
814
- if (!this.leftColIntersectionObserver) {
815
- this.setupLeftColumnScrollListeners();
816
- }
817
- if (!this.facetsIntersectionObserver) {
818
- this.setupFacetsScrollListeners();
819
- }
820
- this.updateLeftColumnHeight();
821
- }
822
- if (changed.has('displayMode') ||
823
- changed.has('baseNavigationUrl') ||
824
- changed.has('baseImageUrl') ||
825
- changed.has('loggedIn')) {
826
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
827
- }
828
- if (changed.has('baseQuery') ||
829
- changed.has('searchType') ||
830
- changed.has('withinCollection')) {
831
- // Unless this query/search type update is from the initial page load or the
832
- // result of hitting the back button,
833
- // we need to clear any existing filters since they may no longer be valid for
834
- // the new set of search results.
835
- if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
836
- // Ordinarily, we leave the sort param unchanged between searches.
837
- // However, if we are changing the target collection itself, we want the sort cleared too,
838
- // since different collections may have different sorting options available.
839
- const shouldClearSort = changed.has('withinCollection') &&
840
- !changed.has('selectedSort') &&
841
- !changed.has('sortDirection');
842
- // Otherwise, only clear filters that haven't been simultaneously applied in this update
843
- this.clearFilters({
844
- sort: shouldClearSort,
845
- facets: !changed.has('selectedFacets'),
846
- dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
847
- letterFilters: !(changed.has('selectedTitleFilter') ||
848
- changed.has('selectedCreatorFilter')),
849
- });
850
- }
851
- }
852
- if (changed.has('profileElement')) {
853
- this.applyDefaultProfileSort();
854
- }
855
- if (changed.has('baseQuery')) {
856
- this.emitBaseQueryChanged();
857
- }
858
- if (changed.has('searchType')) {
859
- this.emitSearchTypeChanged();
860
- }
861
- if (changed.has('currentPage') || changed.has('displayMode')) {
862
- this.persistState();
863
- }
864
- if (changed.has('baseQuery') ||
865
- changed.has('minSelectedDate') ||
866
- changed.has('maxSelectedDate') ||
867
- changed.has('selectedFacets') ||
868
- changed.has('searchService') ||
869
- changed.has('withinCollection') ||
870
- changed.has('withinProfile') ||
871
- changed.has('profileElement')) {
872
- this.dataSource.refreshLetterCounts();
873
- }
874
- if (changed.has('selectedSort') || changed.has('sortDirection')) {
875
- const prevSortDirection = changed.get('sortDirection');
876
- this.sendSortByAnalytics(prevSortDirection);
877
- this.selectedSortChanged();
878
- }
879
- if (changed.has('selectedTitleFilter')) {
880
- this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
881
- }
882
- if (changed.has('selectedCreatorFilter')) {
883
- this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
884
- }
885
- if (changed.has('baseQuery') ||
886
- changed.has('searchType') ||
887
- changed.has('selectedTitleFilter') ||
888
- changed.has('selectedCreatorFilter') ||
889
- changed.has('minSelectedDate') ||
890
- changed.has('maxSelectedDate') ||
891
- changed.has('selectedSort') ||
892
- changed.has('sortDirection') ||
893
- changed.has('selectedFacets') ||
894
- changed.has('searchService') ||
895
- changed.has('withinCollection') ||
896
- changed.has('withinProfile') ||
897
- changed.has('profileElement')) {
898
- this.handleQueryChange();
899
- }
900
- if (changed.has('searchResultsLoading')) {
901
- this.emitSearchResultsLoadingChanged();
902
- }
903
- if (changed.has('facetsLoading') &&
904
- this.facetsLoading &&
905
- this.collectionFacets) {
906
- this.collectionFacets.moreLinksVisible =
907
- this.searchType !== SearchType.FULLTEXT;
908
- }
909
- if (changed.has('pagesToRender')) {
910
- if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
911
- this.infiniteScroller.itemCount = this.estimatedTileCount;
912
- }
913
- }
914
- if (changed.has('isManageView')) {
915
- if (this.isManageView)
916
- this.displayMode = 'grid';
917
- (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
918
- this.emitManageModeChangedEvent();
919
- }
920
- if (changed.has('resizeObserver')) {
921
- const oldObserver = changed.get('resizeObserver');
922
- if (oldObserver)
923
- this.disconnectResizeObserver(oldObserver);
924
- this.setupResizeObserver();
925
- }
926
- }
927
- connectedCallback() {
928
- var _a;
929
- (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
930
- this.setupStateRestorationObserver();
931
- }
932
- disconnectedCallback() {
933
- var _a, _b;
934
- if (this.resizeObserver) {
935
- this.disconnectResizeObserver(this.resizeObserver);
936
- }
937
- if (this.boundNavigationHandler) {
938
- window.removeEventListener('popstate', this.boundNavigationHandler);
939
- }
940
- (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
941
- (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
942
- window.removeEventListener('resize', this.updateLeftColumnHeight);
943
- }
944
- handleResize(entry) {
945
- const previousView = this.mobileView;
946
- if (entry.target === this.contentContainer) {
947
- this.contentWidth = entry.contentRect.width;
948
- this.mobileView =
949
- this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
950
- // If changing from desktop to mobile disable transition
951
- if (this.mobileView && !previousView) {
952
- this.isResizeToMobile = true;
953
- }
954
- }
955
- // Ensure the facet sidebar remains sized correctly
956
- this.updateLeftColumnHeight();
957
- }
958
- /**
959
- * Sets up listeners for events that may require updating the left column height.
960
- */
961
- setupLeftColumnScrollListeners() {
962
- var _a;
963
- // We observe intersections between the left column's scroll sentinel and
964
- // the viewport, so that we can ensure the left column is always sized to
965
- // match the _available_ viewport height. This should generally be more
966
- // performant than listening to scroll events on the page or column.
967
- const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
968
- if (leftColumnSentinel) {
969
- this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
970
- threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
971
- });
972
- this.leftColIntersectionObserver.observe(leftColumnSentinel);
973
- }
974
- // We also listen for window resize events, as they are not always captured
975
- // by the resize observer and can affect the desired height of the left column.
976
- window.addEventListener('resize', this.updateLeftColumnHeight);
977
- }
978
- /**
979
- * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
980
- * Note this uses a separate IntersectionObserver from the left column, because we
981
- * don't need granular intersection thresholds for this.
982
- */
983
- setupFacetsScrollListeners() {
984
- var _a;
985
- const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
986
- if (facetsSentinel) {
987
- this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
988
- this.facetsIntersectionObserver.observe(facetsSentinel);
989
- }
990
- }
991
- emitBaseQueryChanged() {
992
- this.dispatchEvent(new CustomEvent('baseQueryChanged', {
993
- detail: {
994
- baseQuery: this.baseQuery,
995
- },
996
- }));
997
- }
998
- emitSearchTypeChanged() {
999
- this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1000
- detail: this.searchType,
1001
- }));
1002
- }
1003
- emitQueryStateChanged() {
1004
- this.dispatchEvent(new CustomEvent('queryStateChanged', {
1005
- detail: {
1006
- baseQuery: this.baseQuery,
1007
- withinCollection: this.withinCollection,
1008
- withinProfile: this.withinProfile,
1009
- profileElement: this.profileElement,
1010
- searchType: this.searchType,
1011
- selectedFacets: this.selectedFacets,
1012
- minSelectedDate: this.minSelectedDate,
1013
- maxSelectedDate: this.maxSelectedDate,
1014
- selectedSort: this.selectedSort,
1015
- sortDirection: this.sortDirection,
1016
- selectedTitleFilter: this.selectedTitleFilter,
1017
- selectedCreatorFilter: this.selectedCreatorFilter,
1018
- },
1019
- }));
1020
- }
1021
- emitEmptyResults() {
1022
- this.dispatchEvent(new Event('emptyResults'));
1023
- }
1024
- disconnectResizeObserver(resizeObserver) {
1025
- resizeObserver.removeObserver({
1026
- target: this.contentContainer,
1027
- handler: this,
1028
- });
1029
- }
1030
- setupResizeObserver() {
1031
- if (!this.resizeObserver)
1032
- return;
1033
- this.resizeObserver.addObserver({
1034
- target: this.contentContainer,
1035
- handler: this,
1036
- });
1037
- }
1038
- /**
1039
- * When the visible cells change from the infinite scroller, we want to emit
1040
- * which page is currently visible so the consumer can update its UI or the URL
1041
- *
1042
- * @param e
1043
- * @returns
1044
- */
1045
- visibleCellsChanged(e) {
1046
- if (this.isScrollingToCell)
1047
- return;
1048
- const { visibleCellIndices } = e.detail;
1049
- if (visibleCellIndices.length === 0)
1050
- return;
1051
- const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
1052
- const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1053
- if (this.currentPage !== lastVisibleCellPage) {
1054
- this.currentPage = lastVisibleCellPage;
1055
- }
1056
- const event = new CustomEvent('visiblePageChanged', {
1057
- detail: {
1058
- pageNumber: lastVisibleCellPage,
1059
- },
1060
- });
1061
- this.dispatchEvent(event);
1062
- }
1063
- /**
1064
- * A Promise which, after each query change, resolves once the fetches for the initial
1065
- * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1066
- *
1067
- * Ensure you await this component's `updateComplete` promise before awaiting this
1068
- * one, to ensure you do not await an obsolete promise from the previous update.
1069
- */
1070
- get initialSearchComplete() {
1071
- return this.dataSource.initialSearchComplete;
1072
- }
1073
- async handleQueryChange() {
1074
- var _a;
1075
- // only reset if the query has actually changed
1076
- if (!this.searchService ||
1077
- this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1078
- return;
1079
- // If the new state prevents us from updating the search results, don't reset
1080
- if (!this.dataSource.canPerformSearch &&
1081
- !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1082
- return;
1083
- this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1084
- // this.emitQueryStateChanged();
1085
- this.tileModelOffset = 0;
1086
- this.totalResults = undefined;
1087
- this.pagesToRender =
1088
- this.initialPageNumber === 1
1089
- ? 2 // First two pages are batched into one request when starting from page 1
1090
- : this.initialPageNumber;
1091
- // Reset the infinite scroller's item count, so that it
1092
- // shows tile placeholders until the new query's results load in
1093
- if (this.infiniteScroller) {
1094
- this.infiniteScroller.itemCount = this.estimatedTileCount;
1095
- this.infiniteScroller.reload();
1096
- }
1097
- if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1098
- this.defaultSortField = SortField.relevance;
1099
- this.defaultSortDirection = null;
1100
- }
1101
- if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1102
- this.scrollToPage(this.initialPageNumber);
1103
- }
1104
- this.initialQueryChangeHappened = true;
1105
- // if the query changed as part of a window.history pop event, we don't want to
1106
- // persist the state because it overwrites the forward history
1107
- if (!this.historyPopOccurred) {
1108
- this.persistState();
1109
- }
1110
- this.historyPopOccurred = false;
1111
- // Fire the initial page and facets requests
1112
- // await this.dataSource.handleQueryChange();
1113
- }
1114
- setupStateRestorationObserver() {
1115
- if (!this.boundNavigationHandler) {
1116
- this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1117
- }
1118
- // when the user navigates back, we want to update the UI to match the URL
1119
- window.addEventListener('popstate', this.boundNavigationHandler);
1120
- }
1121
- historyNavigationHandler() {
1122
- this.historyPopOccurred = true;
1123
- this.restoreState();
1124
- }
1125
- restoreState() {
1126
- var _a, _b, _c, _d, _e;
1127
- const restorationState = this.restorationStateHandler.getRestorationState();
1128
- this.displayMode = restorationState.displayMode;
1129
- if (restorationState.searchType != null)
1130
- this.searchType = restorationState.searchType;
1131
- this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1132
- this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1133
- this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1134
- this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1135
- this.selectedFacets = restorationState.selectedFacets;
1136
- if (!this.suppressURLQuery)
1137
- this.baseQuery = restorationState.baseQuery;
1138
- this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1139
- this.minSelectedDate = restorationState.minSelectedDate;
1140
- this.maxSelectedDate = restorationState.maxSelectedDate;
1141
- if (this.currentPage > 1) {
1142
- this.goToPage(this.currentPage);
1143
- }
1144
- }
1145
- persistState() {
1146
- var _a, _b, _c, _d;
1147
- const restorationState = {
1148
- displayMode: this.displayMode,
1149
- searchType: this.searchType,
1150
- selectedSort: this.selectedSort,
1151
- sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1152
- selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1153
- baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1154
- currentPage: this.currentPage,
1155
- titleQuery: this.titleQuery,
1156
- creatorQuery: this.creatorQuery,
1157
- minSelectedDate: this.minSelectedDate,
1158
- maxSelectedDate: this.maxSelectedDate,
1159
- selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1160
- selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1161
- };
1162
- this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
1163
- }
1164
- emitSearchResultsLoadingChanged() {
1165
- this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1166
- detail: {
1167
- loading: this.searchResultsLoading,
1168
- },
1169
- }));
1170
- }
1171
- facetsChanged(e) {
1172
- this.selectedFacets = e.detail;
1173
- }
1174
- facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1175
- var _a;
1176
- let action;
1177
- if (negative) {
1178
- action =
1179
- bucket.state !== 'none'
1180
- ? analyticsActions.facetNegativeSelected
1181
- : analyticsActions.facetNegativeDeselected;
1182
- }
1183
- else {
1184
- action =
1185
- bucket.state !== 'none'
1186
- ? analyticsActions.facetSelected
1187
- : analyticsActions.facetDeselected;
1188
- }
1189
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1190
- category: this.searchContext,
1191
- action,
1192
- label: facetType,
1193
- });
1194
- }
1195
- scrollToPage(pageNumber) {
1196
- return new Promise(resolve => {
1197
- const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1198
- // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1199
- // then scrolls to the cell
1200
- setTimeout(() => {
1201
- var _a;
1202
- this.isScrollingToCell = true;
1203
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1204
- // This timeout is to give the scroll animation time to finish
1205
- // then updating the infinite scroller once we're done scrolling
1206
- // There's no scroll animation completion callback so we're
1207
- // giving it 0.5s to finish.
1208
- setTimeout(() => {
1209
- var _a;
1210
- this.isScrollingToCell = false;
1211
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1212
- resolve();
1213
- }, 500);
1214
- }, 0);
1215
- });
1216
- }
1217
- /**
1218
- * Whether sorting by relevance makes sense for the current state.
1219
- * Currently equivalent to having a non-empty query.
1220
- */
1221
- get isRelevanceSortAvailable() {
1222
- var _a;
1223
- return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1224
- }
1225
- /**
1226
- * Sets the total number of tiles displayed in the infinite scroller.
1227
- */
1228
- setTileCount(count) {
1229
- if (this.infiniteScroller) {
1230
- this.infiniteScroller.itemCount = count;
1231
- }
1232
- }
1233
- /**
1234
- * Applies any default sort option for the current collection, by checking
1235
- * for one in the collection's metadata. If none is found, defaults to sorting
1236
- * descending by:
1237
- * - Date Favorited for fav-* collections
1238
- * - Weekly views for all other collections
1239
- */
1240
- applyDefaultCollectionSort(collectionInfo) {
1241
- var _a, _b, _c;
1242
- if (this.baseQuery) {
1243
- // If there's a query set, then we default to relevance sorting regardless of
1244
- // the collection metadata-specified sort.
1245
- this.defaultSortField = SortField.relevance;
1246
- this.defaultSortDirection = null;
1247
- return;
1248
- }
1249
- // Favorite collections sort on Date Favorited by default.
1250
- // Other collections fall back to sorting on weekly views.
1251
- 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-'))
1252
- ? '-favoritedate'
1253
- : '-week';
1254
- // The collection metadata may override the default sorting with something else
1255
- const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1256
- // Prefer the metadata-specified sort if one exists
1257
- const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1258
- // Account for both -field and field:dir formats
1259
- let [field, dir] = defaultSortToApply.split(':');
1260
- if (field.startsWith('-')) {
1261
- field = field.slice(1);
1262
- dir = 'desc';
1263
- }
1264
- else if (!['asc', 'desc'].includes(dir)) {
1265
- dir = 'asc';
1266
- }
1267
- const sortOption = sortOptionFromAPIString(field);
1268
- const sortField = sortOption.field;
1269
- if (sortField && sortField !== SortField.default) {
1270
- this.defaultSortField = sortField;
1271
- this.defaultSortDirection = dir;
1272
- this.defaultSortParam = {
1273
- field: this.defaultSortField,
1274
- direction: this.defaultSortDirection,
1275
- };
1276
- }
1277
- }
1278
- /**
1279
- * Applies the default sort option for the current profile element
1280
- */
1281
- applyDefaultProfileSort() {
1282
- if (this.profileElement) {
1283
- const defaultSortField = defaultProfileElementSorts[this.profileElement];
1284
- this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1285
- }
1286
- else {
1287
- this.defaultSortField = SortField.weeklyview;
1288
- }
1289
- this.defaultSortDirection = 'desc';
1290
- this.defaultSortParam = {
1291
- field: this.defaultSortField,
1292
- direction: this.defaultSortDirection,
1293
- };
1294
- }
1295
- /**
1296
- * This is useful for determining whether we need to reload the scroller.
1297
- *
1298
- * When the fetch completes, we need to reload the scroller if the cells for that
1299
- * page are visible, but if the page is not currenlty visible, we don't need to reload
1300
- */
1301
- get currentVisiblePageNumbers() {
1302
- var _a, _b;
1303
- const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1304
- const visiblePages = new Set();
1305
- visibleCells.forEach(cellIndex => {
1306
- const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1307
- visiblePages.add(visiblePage);
1308
- });
1309
- return Array.from(visiblePages);
1310
- }
1311
- /**
1312
- * Refreshes all visible result cells in the infinite scroller.
1313
- */
1314
- refreshVisibleResults() {
1315
- var _a;
1316
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1317
- }
1318
- /**
1319
- * Callback when a result is selected
1320
- */
1321
- resultSelected(event) {
1322
- var _a, _b, _c;
1323
- if (this.isManageView) {
1324
- // Checked/unchecked state change -- rerender to ensure it propagates
1325
- // this.mapDataSource(model => ({ ...model }));
1326
- const cellIndex = this.dataSource.indexOf(event.detail);
1327
- if (cellIndex >= 0)
1328
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1329
- this.requestUpdate();
1330
- }
1331
- (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1332
- category: this.searchContext,
1333
- action: analyticsActions.resultSelected,
1334
- label: event.detail.mediatype,
1335
- });
1336
- (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1337
- category: this.searchContext,
1338
- action: analyticsActions.resultSelected,
1339
- label: `page-${this.currentPage}`,
1340
- });
1341
- }
1342
- cellForIndex(index) {
1343
- const model = this.tileModelAtCellIndex(index);
1344
- if (!model)
1345
- return undefined;
793
+ `;
794
+ }
795
+ histogramDateRangeUpdated(e) {
796
+ var _a;
797
+ const { minDate, maxDate } = e.detail;
798
+ [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
799
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
800
+ category: this.searchContext,
801
+ action: analyticsActions.histogramChanged,
802
+ label: this.dateRangeQueryClause,
803
+ });
804
+ }
805
+ get dateRangeQueryClause() {
806
+ if (!this.minSelectedDate || !this.maxSelectedDate) {
807
+ return undefined;
808
+ }
809
+ return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
810
+ }
811
+ /**
812
+ * Emits an event indicating a change in whether the manage mode is shown.
813
+ */
814
+ emitManageModeChangedEvent() {
815
+ this.dispatchEvent(new CustomEvent('manageModeChanged', {
816
+ detail: this.isManageView,
817
+ }));
818
+ }
819
+ async installDataSourceAndQueryState(dataSource, queryState) {
820
+ var _a, _b;
821
+ log('Installing data source & query state in CB:', dataSource, queryState);
822
+ if (this.dataSource)
823
+ this.removeController(this.dataSource);
824
+ this.dataSource = dataSource;
825
+ this.addController(this.dataSource);
826
+ this.baseQuery = queryState.baseQuery;
827
+ this.profileElement = queryState.profileElement;
828
+ this.searchType = queryState.searchType;
829
+ this.selectedFacets =
830
+ (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
831
+ this.minSelectedDate = queryState.minSelectedDate;
832
+ this.maxSelectedDate = queryState.maxSelectedDate;
833
+ this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
834
+ this.sortDirection = queryState.sortDirection;
835
+ this.selectedTitleFilter = queryState.selectedTitleFilter;
836
+ this.selectedCreatorFilter = queryState.selectedCreatorFilter;
837
+ // We set this flag during the update to prevent the URL state persistence
838
+ // from creating an unwanted extra history entry.
839
+ this.dataSourceInstallInProgress = true;
840
+ this.requestUpdate();
841
+ await this.updateComplete;
842
+ this.dataSourceInstallInProgress = false;
843
+ if (!this.searchResultsLoading) {
844
+ this.setTotalResultCount(this.dataSource.totalResults);
845
+ this.setTileCount(this.dataSource.size);
846
+ }
847
+ this.refreshVisibleResults();
848
+ }
849
+ firstUpdated() {
850
+ this.restoreState();
851
+ }
852
+ updated(changed) {
853
+ var _a, _b;
854
+ if (changed.has('placeholderType') && this.placeholderType === null) {
855
+ if (!this.leftColIntersectionObserver) {
856
+ this.setupLeftColumnScrollListeners();
857
+ }
858
+ if (!this.facetsIntersectionObserver) {
859
+ this.setupFacetsScrollListeners();
860
+ }
861
+ this.updateLeftColumnHeight();
862
+ }
863
+ if (changed.has('displayMode') ||
864
+ changed.has('baseNavigationUrl') ||
865
+ changed.has('baseImageUrl') ||
866
+ changed.has('loggedIn')) {
867
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
868
+ }
869
+ if (changed.has('baseQuery') ||
870
+ changed.has('searchType') ||
871
+ changed.has('withinCollection')) {
872
+ // Unless this query/search type update is from the initial page load or the
873
+ // result of hitting the back button,
874
+ // we need to clear any existing filters since they may no longer be valid for
875
+ // the new set of search results.
876
+ if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
877
+ // Ordinarily, we leave the sort param unchanged between searches.
878
+ // However, if we are changing the target collection itself, we want the sort cleared too,
879
+ // since different collections may have different sorting options available.
880
+ const shouldClearSort = changed.has('withinCollection') &&
881
+ !changed.has('selectedSort') &&
882
+ !changed.has('sortDirection');
883
+ // Otherwise, only clear filters that haven't been simultaneously applied in this update
884
+ this.clearFilters({
885
+ sort: shouldClearSort,
886
+ facets: !changed.has('selectedFacets'),
887
+ dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
888
+ letterFilters: !(changed.has('selectedTitleFilter') ||
889
+ changed.has('selectedCreatorFilter')),
890
+ });
891
+ }
892
+ }
893
+ if (changed.has('profileElement')) {
894
+ this.applyDefaultProfileSort();
895
+ }
896
+ if (changed.has('baseQuery')) {
897
+ this.emitBaseQueryChanged();
898
+ }
899
+ if (changed.has('searchType')) {
900
+ this.emitSearchTypeChanged();
901
+ }
902
+ if (changed.has('currentPage') || changed.has('displayMode')) {
903
+ this.persistState();
904
+ }
905
+ if (changed.has('baseQuery') ||
906
+ changed.has('minSelectedDate') ||
907
+ changed.has('maxSelectedDate') ||
908
+ changed.has('selectedFacets') ||
909
+ changed.has('searchService') ||
910
+ changed.has('withinCollection') ||
911
+ changed.has('withinProfile') ||
912
+ changed.has('profileElement')) {
913
+ this.dataSource.refreshLetterCounts();
914
+ }
915
+ if (changed.has('selectedSort') || changed.has('sortDirection')) {
916
+ const prevSortDirection = changed.get('sortDirection');
917
+ this.sendSortByAnalytics(prevSortDirection);
918
+ this.selectedSortChanged();
919
+ }
920
+ if (changed.has('selectedTitleFilter')) {
921
+ this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
922
+ }
923
+ if (changed.has('selectedCreatorFilter')) {
924
+ this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
925
+ }
926
+ if (changed.has('baseQuery') ||
927
+ changed.has('searchType') ||
928
+ changed.has('selectedTitleFilter') ||
929
+ changed.has('selectedCreatorFilter') ||
930
+ changed.has('minSelectedDate') ||
931
+ changed.has('maxSelectedDate') ||
932
+ changed.has('selectedSort') ||
933
+ changed.has('sortDirection') ||
934
+ changed.has('selectedFacets') ||
935
+ changed.has('searchService') ||
936
+ changed.has('withinCollection') ||
937
+ changed.has('withinProfile') ||
938
+ changed.has('profileElement')) {
939
+ this.handleQueryChange();
940
+ }
941
+ if (changed.has('searchResultsLoading')) {
942
+ this.emitSearchResultsLoadingChanged();
943
+ }
944
+ if (changed.has('facetsLoading') &&
945
+ this.facetsLoading &&
946
+ this.collectionFacets) {
947
+ this.collectionFacets.moreLinksVisible =
948
+ this.searchType !== SearchType.FULLTEXT;
949
+ }
950
+ if (changed.has('pagesToRender')) {
951
+ if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
952
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
953
+ }
954
+ }
955
+ if (changed.has('isManageView')) {
956
+ if (this.isManageView)
957
+ this.displayMode = 'grid';
958
+ (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
959
+ this.emitManageModeChangedEvent();
960
+ }
961
+ if (changed.has('resizeObserver')) {
962
+ const oldObserver = changed.get('resizeObserver');
963
+ if (oldObserver)
964
+ this.disconnectResizeObserver(oldObserver);
965
+ this.setupResizeObserver();
966
+ }
967
+ }
968
+ connectedCallback() {
969
+ var _a;
970
+ (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
971
+ this.setupStateRestorationObserver();
972
+ this.setupResizeObserver();
973
+ }
974
+ disconnectedCallback() {
975
+ var _a, _b;
976
+ if (this.resizeObserver) {
977
+ this.disconnectResizeObserver(this.resizeObserver);
978
+ }
979
+ if (this.boundNavigationHandler) {
980
+ window.removeEventListener('popstate', this.boundNavigationHandler);
981
+ }
982
+ (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
983
+ (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
984
+ window.removeEventListener('resize', this.updateLeftColumnHeight);
985
+ }
986
+ handleResize(entry) {
987
+ const previousView = this.mobileView;
988
+ if (entry.target === this.contentContainer) {
989
+ this.contentWidth = entry.contentRect.width;
990
+ this.mobileView =
991
+ this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
992
+ // If changing from desktop to mobile disable transition
993
+ if (this.mobileView && !previousView) {
994
+ this.isResizeToMobile = true;
995
+ }
996
+ }
997
+ // Ensure the facet sidebar remains sized correctly
998
+ this.updateLeftColumnHeight();
999
+ }
1000
+ /**
1001
+ * Sets up listeners for events that may require updating the left column height.
1002
+ */
1003
+ setupLeftColumnScrollListeners() {
1004
+ var _a;
1005
+ // We observe intersections between the left column's scroll sentinel and
1006
+ // the viewport, so that we can ensure the left column is always sized to
1007
+ // match the _available_ viewport height. This should generally be more
1008
+ // performant than listening to scroll events on the page or column.
1009
+ const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
1010
+ if (leftColumnSentinel) {
1011
+ this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
1012
+ threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
1013
+ });
1014
+ this.leftColIntersectionObserver.observe(leftColumnSentinel);
1015
+ }
1016
+ // We also listen for window resize events, as they are not always captured
1017
+ // by the resize observer and can affect the desired height of the left column.
1018
+ window.addEventListener('resize', this.updateLeftColumnHeight);
1019
+ }
1020
+ /**
1021
+ * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
1022
+ * Note this uses a separate IntersectionObserver from the left column, because we
1023
+ * don't need granular intersection thresholds for this.
1024
+ */
1025
+ setupFacetsScrollListeners() {
1026
+ var _a;
1027
+ const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
1028
+ if (facetsSentinel) {
1029
+ this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
1030
+ this.facetsIntersectionObserver.observe(facetsSentinel);
1031
+ }
1032
+ }
1033
+ emitBaseQueryChanged() {
1034
+ this.dispatchEvent(new CustomEvent('baseQueryChanged', {
1035
+ detail: {
1036
+ baseQuery: this.baseQuery,
1037
+ },
1038
+ }));
1039
+ }
1040
+ emitSearchTypeChanged() {
1041
+ this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1042
+ detail: this.searchType,
1043
+ }));
1044
+ }
1045
+ emitQueryStateChanged() {
1046
+ this.dispatchEvent(new CustomEvent('queryStateChanged', {
1047
+ detail: {
1048
+ baseQuery: this.baseQuery,
1049
+ withinCollection: this.withinCollection,
1050
+ withinProfile: this.withinProfile,
1051
+ profileElement: this.profileElement,
1052
+ searchType: this.searchType,
1053
+ selectedFacets: this.selectedFacets,
1054
+ minSelectedDate: this.minSelectedDate,
1055
+ maxSelectedDate: this.maxSelectedDate,
1056
+ selectedSort: this.selectedSort,
1057
+ sortDirection: this.sortDirection,
1058
+ selectedTitleFilter: this.selectedTitleFilter,
1059
+ selectedCreatorFilter: this.selectedCreatorFilter,
1060
+ },
1061
+ }));
1062
+ }
1063
+ emitEmptyResults() {
1064
+ this.dispatchEvent(new Event('emptyResults'));
1065
+ }
1066
+ disconnectResizeObserver(resizeObserver) {
1067
+ resizeObserver.removeObserver({
1068
+ target: this.contentContainer,
1069
+ handler: this,
1070
+ });
1071
+ }
1072
+ setupResizeObserver() {
1073
+ if (!this.resizeObserver || !this.contentContainer)
1074
+ return;
1075
+ this.resizeObserver.addObserver({
1076
+ target: this.contentContainer,
1077
+ handler: this,
1078
+ });
1079
+ }
1080
+ /**
1081
+ * When the visible cells change from the infinite scroller, we want to emit
1082
+ * which page is currently visible so the consumer can update its UI or the URL
1083
+ *
1084
+ * @param e
1085
+ * @returns
1086
+ */
1087
+ visibleCellsChanged(e) {
1088
+ if (this.isScrollingToCell)
1089
+ return;
1090
+ const { visibleCellIndices } = e.detail;
1091
+ if (visibleCellIndices.length === 0)
1092
+ return;
1093
+ const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
1094
+ const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1095
+ if (this.currentPage !== lastVisibleCellPage) {
1096
+ this.currentPage = lastVisibleCellPage;
1097
+ }
1098
+ const event = new CustomEvent('visiblePageChanged', {
1099
+ detail: {
1100
+ pageNumber: lastVisibleCellPage,
1101
+ },
1102
+ });
1103
+ this.dispatchEvent(event);
1104
+ }
1105
+ /**
1106
+ * A Promise which, after each query change, resolves once the fetches for the initial
1107
+ * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1108
+ *
1109
+ * Ensure you await this component's `updateComplete` promise before awaiting this
1110
+ * one, to ensure you do not await an obsolete promise from the previous update.
1111
+ */
1112
+ get initialSearchComplete() {
1113
+ return this.dataSource.initialSearchComplete;
1114
+ }
1115
+ async handleQueryChange() {
1116
+ var _a;
1117
+ // only reset if the query has actually changed
1118
+ if (!this.searchService ||
1119
+ this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1120
+ return;
1121
+ // If the new state prevents us from updating the search results, don't reset
1122
+ if (!this.dataSource.canPerformSearch &&
1123
+ !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1124
+ return;
1125
+ this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1126
+ // this.emitQueryStateChanged();
1127
+ this.tileModelOffset = 0;
1128
+ this.totalResults = undefined;
1129
+ this.pagesToRender =
1130
+ this.initialPageNumber === 1
1131
+ ? 2 // First two pages are batched into one request when starting from page 1
1132
+ : this.initialPageNumber;
1133
+ // Reset the infinite scroller's item count, so that it
1134
+ // shows tile placeholders until the new query's results load in
1135
+ if (this.infiniteScroller) {
1136
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
1137
+ this.infiniteScroller.reload();
1138
+ }
1139
+ if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1140
+ this.defaultSortField = SortField.relevance;
1141
+ this.defaultSortDirection = null;
1142
+ }
1143
+ if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1144
+ this.scrollToPage(this.initialPageNumber);
1145
+ }
1146
+ this.initialQueryChangeHappened = true;
1147
+ // if the query changed as part of a window.history pop event, we don't want to
1148
+ // persist the state because it overwrites the forward history
1149
+ if (!this.historyPopOccurred) {
1150
+ this.persistState();
1151
+ }
1152
+ this.historyPopOccurred = false;
1153
+ // Fire the initial page and facets requests
1154
+ // await this.dataSource.handleQueryChange();
1155
+ }
1156
+ setupStateRestorationObserver() {
1157
+ if (!this.boundNavigationHandler) {
1158
+ this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1159
+ }
1160
+ // when the user navigates back, we want to update the UI to match the URL
1161
+ window.addEventListener('popstate', this.boundNavigationHandler);
1162
+ }
1163
+ historyNavigationHandler() {
1164
+ this.historyPopOccurred = true;
1165
+ this.restoreState();
1166
+ }
1167
+ restoreState() {
1168
+ var _a, _b, _c, _d, _e;
1169
+ const restorationState = this.restorationStateHandler.getRestorationState();
1170
+ this.displayMode = restorationState.displayMode;
1171
+ if (restorationState.searchType != null)
1172
+ this.searchType = restorationState.searchType;
1173
+ this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1174
+ this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1175
+ this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1176
+ this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1177
+ this.selectedFacets = restorationState.selectedFacets;
1178
+ if (!this.suppressURLQuery)
1179
+ this.baseQuery = restorationState.baseQuery;
1180
+ this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1181
+ this.minSelectedDate = restorationState.minSelectedDate;
1182
+ this.maxSelectedDate = restorationState.maxSelectedDate;
1183
+ if (this.currentPage > 1) {
1184
+ this.goToPage(this.currentPage);
1185
+ }
1186
+ }
1187
+ persistState() {
1188
+ var _a, _b, _c, _d;
1189
+ const restorationState = {
1190
+ displayMode: this.displayMode,
1191
+ searchType: this.searchType,
1192
+ selectedSort: this.selectedSort,
1193
+ sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1194
+ selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1195
+ baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1196
+ currentPage: this.currentPage,
1197
+ titleQuery: this.titleQuery,
1198
+ creatorQuery: this.creatorQuery,
1199
+ minSelectedDate: this.minSelectedDate,
1200
+ maxSelectedDate: this.maxSelectedDate,
1201
+ selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1202
+ selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1203
+ };
1204
+ this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
1205
+ }
1206
+ emitSearchResultsLoadingChanged() {
1207
+ this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1208
+ detail: {
1209
+ loading: this.searchResultsLoading,
1210
+ },
1211
+ }));
1212
+ }
1213
+ facetsChanged(e) {
1214
+ this.selectedFacets = e.detail;
1215
+ }
1216
+ facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1217
+ var _a;
1218
+ let action;
1219
+ if (negative) {
1220
+ action =
1221
+ bucket.state !== 'none'
1222
+ ? analyticsActions.facetNegativeSelected
1223
+ : analyticsActions.facetNegativeDeselected;
1224
+ }
1225
+ else {
1226
+ action =
1227
+ bucket.state !== 'none'
1228
+ ? analyticsActions.facetSelected
1229
+ : analyticsActions.facetDeselected;
1230
+ }
1231
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1232
+ category: this.searchContext,
1233
+ action,
1234
+ label: facetType,
1235
+ });
1236
+ }
1237
+ scrollToPage(pageNumber) {
1238
+ return new Promise(resolve => {
1239
+ const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1240
+ // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1241
+ // then scrolls to the cell
1242
+ setTimeout(() => {
1243
+ var _a;
1244
+ this.isScrollingToCell = true;
1245
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1246
+ // This timeout is to give the scroll animation time to finish
1247
+ // then updating the infinite scroller once we're done scrolling
1248
+ // There's no scroll animation completion callback so we're
1249
+ // giving it 0.5s to finish.
1250
+ setTimeout(() => {
1251
+ var _a;
1252
+ this.isScrollingToCell = false;
1253
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1254
+ resolve();
1255
+ }, 500);
1256
+ }, 0);
1257
+ });
1258
+ }
1259
+ /**
1260
+ * Whether sorting by relevance makes sense for the current state.
1261
+ * Currently equivalent to having a non-empty query.
1262
+ */
1263
+ get isRelevanceSortAvailable() {
1264
+ var _a;
1265
+ return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1266
+ }
1267
+ /**
1268
+ * Sets the total number of tiles displayed in the infinite scroller.
1269
+ */
1270
+ setTileCount(count) {
1271
+ if (this.infiniteScroller) {
1272
+ this.infiniteScroller.itemCount = count;
1273
+ }
1274
+ }
1275
+ /**
1276
+ * Applies any default sort option for the current collection, by checking
1277
+ * for one in the collection's metadata. If none is found, defaults to sorting
1278
+ * descending by:
1279
+ * - Date Favorited for fav-* collections
1280
+ * - Weekly views for all other collections
1281
+ */
1282
+ applyDefaultCollectionSort(collectionInfo) {
1283
+ var _a, _b, _c;
1284
+ if (this.baseQuery) {
1285
+ // If there's a query set, then we default to relevance sorting regardless of
1286
+ // the collection metadata-specified sort.
1287
+ this.defaultSortField = SortField.relevance;
1288
+ this.defaultSortDirection = null;
1289
+ return;
1290
+ }
1291
+ // Favorite collections sort on Date Favorited by default.
1292
+ // Other collections fall back to sorting on weekly views.
1293
+ 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-'))
1294
+ ? '-favoritedate'
1295
+ : '-week';
1296
+ // The collection metadata may override the default sorting with something else
1297
+ const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1298
+ // Prefer the metadata-specified sort if one exists
1299
+ const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1300
+ // Account for both -field and field:dir formats
1301
+ let [field, dir] = defaultSortToApply.split(':');
1302
+ if (field.startsWith('-')) {
1303
+ field = field.slice(1);
1304
+ dir = 'desc';
1305
+ }
1306
+ else if (!['asc', 'desc'].includes(dir)) {
1307
+ dir = 'asc';
1308
+ }
1309
+ const sortOption = sortOptionFromAPIString(field);
1310
+ const sortField = sortOption.field;
1311
+ if (sortField && sortField !== SortField.default) {
1312
+ this.defaultSortField = sortField;
1313
+ this.defaultSortDirection = dir;
1314
+ this.defaultSortParam = {
1315
+ field: this.defaultSortField,
1316
+ direction: this.defaultSortDirection,
1317
+ };
1318
+ }
1319
+ }
1320
+ /**
1321
+ * Applies the default sort option for the current profile element
1322
+ */
1323
+ applyDefaultProfileSort() {
1324
+ if (this.profileElement) {
1325
+ const defaultSortField = defaultProfileElementSorts[this.profileElement];
1326
+ this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1327
+ }
1328
+ else {
1329
+ this.defaultSortField = SortField.weeklyview;
1330
+ }
1331
+ this.defaultSortDirection = 'desc';
1332
+ this.defaultSortParam = {
1333
+ field: this.defaultSortField,
1334
+ direction: this.defaultSortDirection,
1335
+ };
1336
+ }
1337
+ /**
1338
+ * This is useful for determining whether we need to reload the scroller.
1339
+ *
1340
+ * When the fetch completes, we need to reload the scroller if the cells for that
1341
+ * page are visible, but if the page is not currenlty visible, we don't need to reload
1342
+ */
1343
+ get currentVisiblePageNumbers() {
1344
+ var _a, _b;
1345
+ const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1346
+ const visiblePages = new Set();
1347
+ visibleCells.forEach(cellIndex => {
1348
+ const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1349
+ visiblePages.add(visiblePage);
1350
+ });
1351
+ return Array.from(visiblePages);
1352
+ }
1353
+ /**
1354
+ * Refreshes all visible result cells in the infinite scroller.
1355
+ */
1356
+ refreshVisibleResults() {
1357
+ var _a;
1358
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1359
+ }
1360
+ /**
1361
+ * Callback when a result is selected
1362
+ */
1363
+ resultSelected(event) {
1364
+ var _a, _b, _c;
1365
+ if (this.isManageView) {
1366
+ // Checked/unchecked state change -- rerender to ensure it propagates
1367
+ // this.mapDataSource(model => ({ ...model }));
1368
+ const cellIndex = this.dataSource.indexOf(event.detail);
1369
+ if (cellIndex >= 0)
1370
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1371
+ this.requestUpdate();
1372
+ }
1373
+ (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1374
+ category: this.searchContext,
1375
+ action: analyticsActions.resultSelected,
1376
+ label: event.detail.mediatype,
1377
+ });
1378
+ (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1379
+ category: this.searchContext,
1380
+ action: analyticsActions.resultSelected,
1381
+ label: `page-${this.currentPage}`,
1382
+ });
1383
+ }
1384
+ cellForIndex(index) {
1385
+ const model = this.tileModelAtCellIndex(index);
1386
+ if (!model)
1387
+ return undefined;
1346
1388
  return html `
1347
1389
  <tile-dispatcher
1348
1390
  .collectionPagePath=${this.collectionPagePath}
@@ -1362,21 +1404,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1362
1404
  @resultSelected=${(e) => this.resultSelected(e)}
1363
1405
  >
1364
1406
  </tile-dispatcher>
1365
- `;
1366
- }
1367
- /**
1368
- * When the user scrolls near to the bottom of the page, fetch the next page
1369
- * increase the number of pages to render and start fetching data for the new page
1370
- */
1371
- scrollThresholdReached() {
1372
- if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1373
- this.pagesToRender += 1;
1374
- this.dataSource.fetchPage(this.pagesToRender);
1375
- }
1376
- }
1377
- static get styles() {
1378
- return [
1379
- srOnlyStyle,
1407
+ `;
1408
+ }
1409
+ /**
1410
+ * When the user scrolls near to the bottom of the page, fetch the next page
1411
+ * increase the number of pages to render and start fetching data for the new page
1412
+ */
1413
+ scrollThresholdReached() {
1414
+ if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1415
+ this.pagesToRender += 1;
1416
+ this.dataSource.fetchPage(this.pagesToRender);
1417
+ }
1418
+ }
1419
+ static get styles() {
1420
+ return [
1421
+ srOnlyStyle,
1380
1422
  css `
1381
1423
  :host {
1382
1424
  display: block;
@@ -1453,6 +1495,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1453
1495
  #right-column {
1454
1496
  flex: 1;
1455
1497
  position: relative;
1498
+ min-height: 90vh;
1456
1499
  border-left: 1px solid rgb(232, 232, 232);
1457
1500
  border-right: 1px solid rgb(232, 232, 232);
1458
1501
  padding-left: 1rem;
@@ -1569,7 +1612,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1569
1612
 
1570
1613
  .mobile #left-column {
1571
1614
  width: 100%;
1615
+ min-width: 0;
1572
1616
  padding: 0;
1617
+ border: 0;
1573
1618
  }
1574
1619
 
1575
1620
  .clear-filters-btn-row {
@@ -1751,180 +1796,183 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1751
1796
  infinite-scroller.hidden {
1752
1797
  display: none;
1753
1798
  }
1754
- `,
1755
- ];
1756
- }
1757
- };
1758
- __decorate([
1759
- property({ type: String })
1760
- ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1761
- __decorate([
1762
- property({ type: String })
1763
- ], CollectionBrowser.prototype, "baseImageUrl", void 0);
1764
- __decorate([
1765
- property({ type: Object })
1766
- ], CollectionBrowser.prototype, "searchService", void 0);
1767
- __decorate([
1768
- property({ type: String })
1769
- ], CollectionBrowser.prototype, "searchType", void 0);
1770
- __decorate([
1771
- property({ type: String })
1772
- ], CollectionBrowser.prototype, "withinCollection", void 0);
1773
- __decorate([
1774
- property({ type: String })
1775
- ], CollectionBrowser.prototype, "withinProfile", void 0);
1776
- __decorate([
1777
- property({ type: String })
1778
- ], CollectionBrowser.prototype, "profileElement", void 0);
1779
- __decorate([
1780
- property({ type: String })
1781
- ], CollectionBrowser.prototype, "baseQuery", void 0);
1782
- __decorate([
1783
- property({ type: String })
1784
- ], CollectionBrowser.prototype, "displayMode", void 0);
1785
- __decorate([
1786
- property({ type: Object })
1787
- ], CollectionBrowser.prototype, "defaultSortParam", void 0);
1788
- __decorate([
1789
- property({ type: String })
1790
- ], CollectionBrowser.prototype, "selectedSort", void 0);
1791
- __decorate([
1792
- property({ type: String })
1793
- ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1794
- __decorate([
1795
- property({ type: String })
1796
- ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1797
- __decorate([
1798
- property({ type: String })
1799
- ], CollectionBrowser.prototype, "sortDirection", void 0);
1800
- __decorate([
1801
- property({ type: Number })
1802
- ], CollectionBrowser.prototype, "pageSize", void 0);
1803
- __decorate([
1804
- property({ type: Number })
1805
- ], CollectionBrowser.prototype, "currentPage", void 0);
1806
- __decorate([
1807
- property({ type: String })
1808
- ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1809
- __decorate([
1810
- property({ type: String })
1811
- ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1812
- __decorate([
1813
- property({ type: Object })
1814
- ], CollectionBrowser.prototype, "selectedFacets", void 0);
1815
- __decorate([
1816
- property({ type: Boolean })
1817
- ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1818
- __decorate([
1819
- property({ type: Boolean })
1820
- ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
1821
- __decorate([
1822
- property({ type: Boolean })
1823
- ], CollectionBrowser.prototype, "suppressResultCount", void 0);
1824
- __decorate([
1825
- property({ type: Boolean })
1826
- ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
1827
- __decorate([
1828
- property({ type: Boolean })
1829
- ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
1830
- __decorate([
1831
- property({ type: Boolean })
1832
- ], CollectionBrowser.prototype, "suppressFacets", void 0);
1833
- __decorate([
1834
- property({ type: Boolean })
1835
- ], CollectionBrowser.prototype, "suppressSortBar", void 0);
1836
- __decorate([
1837
- property({ type: Boolean })
1838
- ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
1839
- __decorate([
1840
- property({ type: String })
1841
- ], CollectionBrowser.prototype, "collectionPagePath", void 0);
1842
- __decorate([
1843
- property({ type: String, reflect: true })
1844
- ], CollectionBrowser.prototype, "searchContext", void 0);
1845
- __decorate([
1846
- property({ type: String })
1847
- ], CollectionBrowser.prototype, "pageContext", void 0);
1848
- __decorate([
1849
- property({ type: Object })
1850
- ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1851
- __decorate([
1852
- property({ type: Number })
1853
- ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
1854
- __decorate([
1855
- property({ type: Boolean })
1856
- ], CollectionBrowser.prototype, "loggedIn", void 0);
1857
- __decorate([
1858
- property({ type: Object })
1859
- ], CollectionBrowser.prototype, "resizeObserver", void 0);
1860
- __decorate([
1861
- property({ type: Object })
1862
- ], CollectionBrowser.prototype, "modalManager", void 0);
1863
- __decorate([
1864
- property({ type: Object })
1865
- ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
1866
- __decorate([
1867
- property({ type: Object })
1868
- ], CollectionBrowser.prototype, "recaptchaManager", void 0);
1869
- __decorate([
1870
- property({ type: Boolean })
1871
- ], CollectionBrowser.prototype, "isManageView", void 0);
1872
- __decorate([
1873
- property({ type: String })
1874
- ], CollectionBrowser.prototype, "manageViewLabel", void 0);
1875
- __decorate([
1876
- property({ type: Boolean })
1877
- ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
1878
- __decorate([
1879
- property({ type: Object })
1880
- ], CollectionBrowser.prototype, "dataSource", void 0);
1881
- __decorate([
1882
- state()
1883
- ], CollectionBrowser.prototype, "pagesToRender", void 0);
1884
- __decorate([
1885
- state()
1886
- ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
1887
- __decorate([
1888
- state()
1889
- ], CollectionBrowser.prototype, "facetsLoading", void 0);
1890
- __decorate([
1891
- state()
1892
- ], CollectionBrowser.prototype, "totalResults", void 0);
1893
- __decorate([
1894
- state()
1895
- ], CollectionBrowser.prototype, "mobileView", void 0);
1896
- __decorate([
1897
- state()
1898
- ], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
1899
- __decorate([
1900
- state()
1901
- ], CollectionBrowser.prototype, "contentWidth", void 0);
1902
- __decorate([
1903
- state()
1904
- ], CollectionBrowser.prototype, "defaultSortField", void 0);
1905
- __decorate([
1906
- state()
1907
- ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
1908
- __decorate([
1909
- state()
1910
- ], CollectionBrowser.prototype, "placeholderType", void 0);
1911
- __decorate([
1912
- query('#content-container')
1913
- ], CollectionBrowser.prototype, "contentContainer", void 0);
1914
- __decorate([
1915
- query('#left-column')
1916
- ], CollectionBrowser.prototype, "leftColumn", void 0);
1917
- __decorate([
1918
- query('collection-facets')
1919
- ], CollectionBrowser.prototype, "collectionFacets", void 0);
1920
- __decorate([
1921
- property({ type: Object, attribute: false })
1922
- ], CollectionBrowser.prototype, "analyticsHandler", void 0);
1923
- __decorate([
1924
- query('infinite-scroller')
1925
- ], CollectionBrowser.prototype, "infiniteScroller", void 0);
1926
- CollectionBrowser = __decorate([
1927
- customElement('collection-browser')
1928
- ], CollectionBrowser);
1929
- export { CollectionBrowser };
1799
+ `,
1800
+ ];
1801
+ }
1802
+ };
1803
+ __decorate([
1804
+ property({ type: String })
1805
+ ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1806
+ __decorate([
1807
+ property({ type: String })
1808
+ ], CollectionBrowser.prototype, "baseImageUrl", void 0);
1809
+ __decorate([
1810
+ property({ type: Object })
1811
+ ], CollectionBrowser.prototype, "searchService", void 0);
1812
+ __decorate([
1813
+ property({ type: String })
1814
+ ], CollectionBrowser.prototype, "searchType", void 0);
1815
+ __decorate([
1816
+ property({ type: String })
1817
+ ], CollectionBrowser.prototype, "withinCollection", void 0);
1818
+ __decorate([
1819
+ property({ type: String })
1820
+ ], CollectionBrowser.prototype, "withinProfile", void 0);
1821
+ __decorate([
1822
+ property({ type: String })
1823
+ ], CollectionBrowser.prototype, "profileElement", void 0);
1824
+ __decorate([
1825
+ property({ type: String })
1826
+ ], CollectionBrowser.prototype, "baseQuery", void 0);
1827
+ __decorate([
1828
+ property({ type: String })
1829
+ ], CollectionBrowser.prototype, "displayMode", void 0);
1830
+ __decorate([
1831
+ property({ type: Object })
1832
+ ], CollectionBrowser.prototype, "defaultSortParam", void 0);
1833
+ __decorate([
1834
+ property({ type: String })
1835
+ ], CollectionBrowser.prototype, "selectedSort", void 0);
1836
+ __decorate([
1837
+ property({ type: String })
1838
+ ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1839
+ __decorate([
1840
+ property({ type: String })
1841
+ ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1842
+ __decorate([
1843
+ property({ type: String })
1844
+ ], CollectionBrowser.prototype, "sortDirection", void 0);
1845
+ __decorate([
1846
+ property({ type: Number })
1847
+ ], CollectionBrowser.prototype, "pageSize", void 0);
1848
+ __decorate([
1849
+ property({ type: Number })
1850
+ ], CollectionBrowser.prototype, "currentPage", void 0);
1851
+ __decorate([
1852
+ property({ type: String })
1853
+ ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1854
+ __decorate([
1855
+ property({ type: String })
1856
+ ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1857
+ __decorate([
1858
+ property({ type: Object })
1859
+ ], CollectionBrowser.prototype, "selectedFacets", void 0);
1860
+ __decorate([
1861
+ property({ type: Boolean })
1862
+ ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1863
+ __decorate([
1864
+ property({ type: Boolean })
1865
+ ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
1866
+ __decorate([
1867
+ property({ type: Boolean })
1868
+ ], CollectionBrowser.prototype, "suppressResultCount", void 0);
1869
+ __decorate([
1870
+ property({ type: Boolean })
1871
+ ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
1872
+ __decorate([
1873
+ property({ type: Boolean })
1874
+ ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
1875
+ __decorate([
1876
+ property({ type: Boolean })
1877
+ ], CollectionBrowser.prototype, "suppressFacets", void 0);
1878
+ __decorate([
1879
+ property({ type: Boolean })
1880
+ ], CollectionBrowser.prototype, "suppressSortBar", void 0);
1881
+ __decorate([
1882
+ property({ type: Boolean })
1883
+ ], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
1884
+ __decorate([
1885
+ property({ type: Boolean })
1886
+ ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
1887
+ __decorate([
1888
+ property({ type: String })
1889
+ ], CollectionBrowser.prototype, "collectionPagePath", void 0);
1890
+ __decorate([
1891
+ property({ type: String, reflect: true })
1892
+ ], CollectionBrowser.prototype, "searchContext", void 0);
1893
+ __decorate([
1894
+ property({ type: String })
1895
+ ], CollectionBrowser.prototype, "pageContext", void 0);
1896
+ __decorate([
1897
+ property({ type: Object })
1898
+ ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1899
+ __decorate([
1900
+ property({ type: Number })
1901
+ ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
1902
+ __decorate([
1903
+ property({ type: Boolean })
1904
+ ], CollectionBrowser.prototype, "loggedIn", void 0);
1905
+ __decorate([
1906
+ property({ type: Object })
1907
+ ], CollectionBrowser.prototype, "resizeObserver", void 0);
1908
+ __decorate([
1909
+ property({ type: Object })
1910
+ ], CollectionBrowser.prototype, "modalManager", void 0);
1911
+ __decorate([
1912
+ property({ type: Object })
1913
+ ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
1914
+ __decorate([
1915
+ property({ type: Object })
1916
+ ], CollectionBrowser.prototype, "recaptchaManager", void 0);
1917
+ __decorate([
1918
+ property({ type: Boolean })
1919
+ ], CollectionBrowser.prototype, "isManageView", void 0);
1920
+ __decorate([
1921
+ property({ type: String })
1922
+ ], CollectionBrowser.prototype, "manageViewLabel", void 0);
1923
+ __decorate([
1924
+ property({ type: Boolean })
1925
+ ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
1926
+ __decorate([
1927
+ property({ type: Object })
1928
+ ], CollectionBrowser.prototype, "dataSource", void 0);
1929
+ __decorate([
1930
+ state()
1931
+ ], CollectionBrowser.prototype, "pagesToRender", void 0);
1932
+ __decorate([
1933
+ state()
1934
+ ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
1935
+ __decorate([
1936
+ state()
1937
+ ], CollectionBrowser.prototype, "facetsLoading", void 0);
1938
+ __decorate([
1939
+ state()
1940
+ ], CollectionBrowser.prototype, "totalResults", void 0);
1941
+ __decorate([
1942
+ state()
1943
+ ], CollectionBrowser.prototype, "mobileView", void 0);
1944
+ __decorate([
1945
+ state()
1946
+ ], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
1947
+ __decorate([
1948
+ state()
1949
+ ], CollectionBrowser.prototype, "contentWidth", void 0);
1950
+ __decorate([
1951
+ state()
1952
+ ], CollectionBrowser.prototype, "defaultSortField", void 0);
1953
+ __decorate([
1954
+ state()
1955
+ ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
1956
+ __decorate([
1957
+ state()
1958
+ ], CollectionBrowser.prototype, "placeholderType", void 0);
1959
+ __decorate([
1960
+ query('#content-container')
1961
+ ], CollectionBrowser.prototype, "contentContainer", void 0);
1962
+ __decorate([
1963
+ query('#left-column')
1964
+ ], CollectionBrowser.prototype, "leftColumn", void 0);
1965
+ __decorate([
1966
+ query('collection-facets')
1967
+ ], CollectionBrowser.prototype, "collectionFacets", void 0);
1968
+ __decorate([
1969
+ property({ type: Object, attribute: false })
1970
+ ], CollectionBrowser.prototype, "analyticsHandler", void 0);
1971
+ __decorate([
1972
+ query('infinite-scroller')
1973
+ ], CollectionBrowser.prototype, "infiniteScroller", void 0);
1974
+ CollectionBrowser = __decorate([
1975
+ customElement('collection-browser')
1976
+ ], CollectionBrowser);
1977
+ export { CollectionBrowser };
1930
1978
  //# sourceMappingURL=collection-browser.js.map