pageflow 15.5.0 → 15.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pageflow might be problematic. Click here for more details.

Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +219 -87
  3. data/README.md +1 -2
  4. data/admins/pageflow/entry.rb +28 -57
  5. data/admins/pageflow/user.rb +1 -3
  6. data/app/assets/images/pageflow/admin/icons/buttons/editor.svg +2 -0
  7. data/app/assets/images/pageflow/admin/icons/buttons/preview.svg +2 -0
  8. data/app/assets/images/pageflow/admin/icons/buttons/show_public.svg +2 -0
  9. data/app/assets/images/pageflow/admin/icons/delete.svg +9 -0
  10. data/app/assets/images/pageflow/admin/icons/done.svg +6 -0
  11. data/app/assets/images/pageflow/admin/icons/edit.svg +7 -0
  12. data/app/assets/images/pageflow/admin/icons/editor.svg +2 -0
  13. data/app/assets/images/pageflow/admin/icons/folder.svg +8 -0
  14. data/app/assets/images/pageflow/admin/icons/folder_active.svg +8 -0
  15. data/app/assets/images/pageflow/admin/icons/info.svg +3 -0
  16. data/app/assets/images/pageflow/admin/icons/new.svg +5 -0
  17. data/app/assets/images/pageflow/admin/icons/preview.svg +2 -0
  18. data/app/assets/images/pageflow/admin/icons/published.svg +2 -0
  19. data/app/assets/images/pageflow/admin/icons/published_with_password.svg +2 -0
  20. data/app/assets/images/pageflow/admin/icons/show_public.svg +2 -0
  21. data/app/assets/images/pageflow/editor/blank_entry/logo.png +0 -0
  22. data/app/assets/images/pageflow/themes/default/embed_opt_in.svg +3 -0
  23. data/app/assets/images/pageflow/themes/default/embed_opt_out_info.svg +16 -0
  24. data/app/assets/javascripts/pageflow/admin/entries.js +9 -57
  25. data/app/assets/javascripts/pageflow/dist/ui.js +127 -10
  26. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +18 -16
  27. data/app/assets/stylesheets/pageflow/admin/badge_list.scss +25 -35
  28. data/app/assets/stylesheets/pageflow/admin/columns.scss +13 -11
  29. data/app/assets/stylesheets/pageflow/admin/embed_code.scss +1 -4
  30. data/app/assets/stylesheets/pageflow/admin/entries/folders.scss +44 -19
  31. data/app/assets/stylesheets/pageflow/admin/entries.scss +15 -31
  32. data/app/assets/stylesheets/pageflow/admin/features.scss +3 -1
  33. data/app/assets/stylesheets/pageflow/admin/forms.scss +14 -12
  34. data/app/assets/stylesheets/pageflow/admin/hint.scss +8 -14
  35. data/app/assets/stylesheets/pageflow/admin/icon_button.scss +25 -14
  36. data/app/assets/stylesheets/pageflow/admin/icon_link.scss +31 -15
  37. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +14 -7
  38. data/app/assets/stylesheets/pageflow/admin/status_tags.scss +5 -4
  39. data/app/assets/stylesheets/pageflow/admin/tabs_view.scss +36 -34
  40. data/app/assets/stylesheets/pageflow/admin/tooltip_bubble.scss +15 -11
  41. data/app/assets/stylesheets/pageflow/admin.scss +12 -0
  42. data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +15 -61
  43. data/app/assets/stylesheets/pageflow/editor/base.scss +28 -13
  44. data/app/assets/stylesheets/pageflow/editor/blank_entry.scss +6 -6
  45. data/app/assets/stylesheets/pageflow/editor/change_theme.scss +28 -71
  46. data/app/assets/stylesheets/pageflow/editor/composables.scss +2 -2
  47. data/app/assets/stylesheets/pageflow/editor/confirm_encoding.scss +18 -36
  48. data/app/assets/stylesheets/pageflow/editor/confirm_upload.scss +12 -39
  49. data/app/assets/stylesheets/pageflow/editor/dialogs.scss +39 -12
  50. data/app/assets/stylesheets/pageflow/editor/disabled_atmo_indicator.scss +3 -3
  51. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +7 -10
  52. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +3 -8
  53. data/app/assets/stylesheets/pageflow/editor/failures.scss +3 -3
  54. data/app/assets/stylesheets/pageflow/editor/file_import.scss +22 -38
  55. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +3 -7
  56. data/app/assets/stylesheets/pageflow/editor/file_settings_dialog.scss +4 -24
  57. data/app/assets/stylesheets/pageflow/editor/file_stages.scss +10 -11
  58. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -8
  59. data/app/assets/stylesheets/pageflow/editor/files.scss +7 -6
  60. data/app/assets/stylesheets/pageflow/editor/files_explorer.scss +13 -30
  61. data/app/assets/stylesheets/pageflow/editor/files_gallery.scss +15 -11
  62. data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +6 -7
  63. data/app/assets/stylesheets/pageflow/editor/help.scss +19 -14
  64. data/app/assets/stylesheets/pageflow/editor/help_image.scss +1 -1
  65. data/app/assets/stylesheets/pageflow/editor/info_box.scss +19 -0
  66. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +7 -11
  67. data/app/assets/stylesheets/pageflow/editor/inputs/file_processing_state_display.scss +0 -2
  68. data/app/assets/stylesheets/pageflow/editor/inputs/reference.scss +7 -11
  69. data/app/assets/stylesheets/pageflow/editor/list.scss +13 -10
  70. data/app/assets/stylesheets/pageflow/editor/loading.scss +1 -1
  71. data/app/assets/stylesheets/pageflow/editor/locked.scss +9 -5
  72. data/app/assets/stylesheets/pageflow/editor/menu.scss +5 -5
  73. data/app/assets/stylesheets/pageflow/editor/notifications.scss +15 -14
  74. data/app/assets/stylesheets/pageflow/editor/other_entry_item.scss +7 -3
  75. data/app/assets/stylesheets/pageflow/editor/outline.scss +57 -19
  76. data/app/assets/stylesheets/pageflow/editor/page_links.scss +10 -8
  77. data/app/assets/stylesheets/pageflow/editor/page_selection.scss +2 -29
  78. data/app/assets/stylesheets/pageflow/editor/publish_entry.scss +5 -6
  79. data/app/assets/stylesheets/pageflow/editor/quotas.scss +2 -3
  80. data/app/assets/stylesheets/pageflow/editor/select_button.scss +12 -6
  81. data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -5
  82. data/app/assets/stylesheets/pageflow/editor/storyline_picker.scss +6 -2
  83. data/app/assets/stylesheets/pageflow/editor/text_tracks.scss +6 -22
  84. data/app/assets/stylesheets/pageflow/editor/widgets.scss +2 -2
  85. data/app/assets/stylesheets/pageflow/editor/wysihtml5.scss +35 -29
  86. data/app/assets/stylesheets/pageflow/mixins/background_icons.scss +3 -3
  87. data/app/assets/stylesheets/pageflow/mixins/buttons.scss +50 -68
  88. data/app/assets/stylesheets/pageflow/themes/default/base.scss +2 -0
  89. data/app/assets/stylesheets/pageflow/themes/default/consent/bar.scss +156 -0
  90. data/app/assets/stylesheets/pageflow/themes/default/consent/vendor_list.scss +62 -0
  91. data/app/assets/stylesheets/pageflow/themes/default/consent.scss +2 -0
  92. data/app/assets/stylesheets/pageflow/themes/default/logo/alignment.scss +7 -0
  93. data/app/assets/stylesheets/pageflow/themes/default/page/shadow.scss +44 -0
  94. data/app/assets/stylesheets/pageflow/themes/default/third_party_embed_consent.scss +103 -0
  95. data/app/assets/stylesheets/pageflow/ui/forms.scss +79 -84
  96. data/app/assets/stylesheets/pageflow/ui/functions.scss +56 -0
  97. data/app/assets/stylesheets/pageflow/ui/input/check_box_group_input.scss +2 -3
  98. data/app/assets/stylesheets/pageflow/ui/input/color_input.scss +6 -6
  99. data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +63 -50
  100. data/app/assets/stylesheets/pageflow/ui/normalize/forms.scss +153 -0
  101. data/app/assets/stylesheets/pageflow/ui/normalize.scss +278 -0
  102. data/app/assets/stylesheets/pageflow/ui/properties.scss +44 -0
  103. data/app/assets/stylesheets/pageflow/ui/table_cells/delete_row_table_cell.scss +1 -1
  104. data/app/assets/stylesheets/pageflow/ui/table_view.scss +14 -18
  105. data/app/assets/stylesheets/pageflow/ui/tabs_view.scss +8 -11
  106. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +6 -8
  107. data/app/assets/stylesheets/pageflow/ui/validation_error_messages.scss +6 -0
  108. data/app/assets/stylesheets/pageflow/ui.scss +4 -0
  109. data/app/controllers/pageflow/edit_locks_controller.rb +3 -1
  110. data/app/helpers/pageflow/admin/entries_helper.rb +2 -12
  111. data/app/helpers/pageflow/embed_code_helper.rb +1 -1
  112. data/app/helpers/pageflow/entries_helper.rb +41 -2
  113. data/app/helpers/pageflow/file_background_images_helper.rb +1 -1
  114. data/app/helpers/pageflow/page_types_helper.rb +1 -1
  115. data/app/helpers/pageflow/themes_helper.rb +1 -1
  116. data/app/jobs/pageflow/poll_meta_data_from_zencoder_job.rb +1 -1
  117. data/app/jobs/pageflow/poll_zencoder_job.rb +1 -9
  118. data/app/models/pageflow/audio_file.rb +17 -0
  119. data/app/models/pageflow/audio_file_url_templates.rb +4 -1
  120. data/app/models/pageflow/customized_theme.rb +37 -0
  121. data/app/models/pageflow/draft_entry.rb +6 -59
  122. data/app/models/pageflow/entry_at_revision.rb +68 -0
  123. data/app/models/pageflow/entry_role_query.rb +44 -24
  124. data/app/models/pageflow/image_file_css_background_image_urls.rb +8 -2
  125. data/app/models/pageflow/published_entry.rb +9 -56
  126. data/app/models/pageflow/theme_customization.rb +46 -0
  127. data/app/models/pageflow/theme_customization_file.rb +58 -0
  128. data/app/models/pageflow/video_file.rb +11 -1
  129. data/app/models/pageflow/video_file_url_templates.rb +1 -0
  130. data/app/policies/pageflow/entry_policy.rb +4 -0
  131. data/app/state_machines/pageflow/media_encoding_state_machine.rb +23 -4
  132. data/app/views/admin/entries/_form.html.erb +50 -0
  133. data/app/views/admin/entries/entry_type_name_input.html.erb +5 -0
  134. data/app/views/admin/features/_form.html.erb +1 -1
  135. data/app/views/admin/memberships/_form.html.erb +2 -3
  136. data/app/views/admin/users/_form.html.erb +1 -1
  137. data/app/views/admin/users/invitation.html.erb +2 -2
  138. data/app/views/components/pageflow/admin/entry_user_badge_list.rb +10 -9
  139. data/app/views/components/pageflow/admin/members_tab.rb +5 -1
  140. data/app/views/components/pageflow/admin/revisions_tab.rb +13 -3
  141. data/app/views/components/pageflow/admin/timestamp.rb +20 -0
  142. data/app/views/components/pageflow/admin/user_account_badge_list.rb +5 -6
  143. data/app/views/pageflow/admin/entries/_cannot_add_user.html.erb +9 -5
  144. data/app/views/pageflow/admin/entries/_entry_type_name_input.html.erb +7 -0
  145. data/app/views/pageflow/audio_files/_audio_file.json.jbuilder +13 -0
  146. data/app/views/pageflow/editor/encoding_confirmations/_intro.html.erb +0 -0
  147. data/app/views/pageflow/editor/encoding_confirmations/check.json.jbuilder +14 -2
  148. data/config/initializers/paperclip.rb +16 -1
  149. data/config/locales/de.yml +24 -28
  150. data/config/locales/en.yml +19 -10
  151. data/db/migrate/20210528073122_create_pageflow_theme_customizations.rb +11 -0
  152. data/db/migrate/20210531090654_create_pageflow_theme_customization_files.rb +15 -0
  153. data/db/migrate/20210531102228_add_selected_file_ids_to_theme_customizations.rb +5 -0
  154. data/db/migrate/20211020085902_add_canonical_entry_url_prefix_to_themings.rb +5 -0
  155. data/db/migrate/20220503150010_add_peak_data_to_audio_files.rb +5 -0
  156. data/db/migrate/20220705084830_add_trailing_slash_in_canonical_urls_to_themings.rb +5 -0
  157. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +256 -124
  158. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +566 -167
  159. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +5 -5
  160. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +4 -4
  161. data/entry_types/paged/app/helpers/pageflow_paged/third_party_embed_consent_helper.rb +38 -0
  162. data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_in.html.erb +12 -0
  163. data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_out_info.html.erb +10 -0
  164. data/entry_types/paged/config/initializers/features.rb +2 -0
  165. data/entry_types/paged/config/locales/new/video_contain.de.yml +7 -0
  166. data/entry_types/paged/config/locales/new/video_contain.en.yml +7 -0
  167. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
  168. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +1 -0
  169. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +58 -0
  170. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +37 -3
  171. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +92 -6
  172. data/entry_types/scrolled/app/helpers/pageflow_scrolled/webpack_public_path_helper.rb +20 -0
  173. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +7 -0
  174. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +5 -2
  175. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +5 -1
  176. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +5 -4
  177. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +16 -0
  178. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +13 -2
  179. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_widget.json.jbuilder +2 -0
  180. data/entry_types/scrolled/config/locales/de.yml +1 -8
  181. data/entry_types/scrolled/config/locales/en.yml +1 -9
  182. data/entry_types/scrolled/config/locales/new/before_after_slider.de.yml +8 -0
  183. data/entry_types/scrolled/config/locales/new/before_after_slider.en.yml +8 -0
  184. data/entry_types/scrolled/config/locales/new/center_ragged.de.yml +8 -0
  185. data/entry_types/scrolled/config/locales/new/center_ragged.en.yml +9 -0
  186. data/entry_types/scrolled/config/locales/new/consent.de.yml +25 -0
  187. data/entry_types/scrolled/config/locales/new/consent.en.yml +24 -0
  188. data/entry_types/scrolled/config/locales/new/content_element_categories.de.yml +39 -0
  189. data/entry_types/scrolled/config/locales/new/content_element_categories.en.yml +39 -0
  190. data/entry_types/scrolled/config/locales/new/default_transition.de.yml +14 -0
  191. data/entry_types/scrolled/config/locales/new/default_transition.en.yml +14 -0
  192. data/entry_types/scrolled/config/locales/new/header_line_breaks.de.yml +28 -0
  193. data/entry_types/scrolled/config/locales/new/header_line_breaks.en.yml +27 -0
  194. data/entry_types/scrolled/config/locales/new/header_size.de.yml +17 -0
  195. data/entry_types/scrolled/config/locales/new/header_size.en.yml +17 -0
  196. data/entry_types/scrolled/config/locales/new/iframe_embed.de.yml +39 -0
  197. data/entry_types/scrolled/config/locales/new/iframe_embed.en.yml +39 -0
  198. data/entry_types/scrolled/config/locales/new/inline_loops.de.yml +26 -0
  199. data/entry_types/scrolled/config/locales/new/inline_loops.en.yml +26 -0
  200. data/entry_types/scrolled/config/locales/new/portrait_inline_image.de.yml +9 -0
  201. data/entry_types/scrolled/config/locales/new/portrait_inline_image.en.yml +9 -0
  202. data/entry_types/scrolled/config/locales/new/section_width.de.yml +10 -0
  203. data/entry_types/scrolled/config/locales/new/section_width.en.yml +10 -0
  204. data/entry_types/scrolled/config/locales/new/typography_variants.de.yml +7 -0
  205. data/entry_types/scrolled/config/locales/new/typography_variants.en.yml +7 -0
  206. data/entry_types/scrolled/config/locales/new/video_embed_poster.de.yml +8 -0
  207. data/entry_types/scrolled/config/locales/new/video_embed_poster.en.yml +8 -0
  208. data/entry_types/scrolled/config/locales/new/waveform_styles.de.yml +11 -0
  209. data/entry_types/scrolled/config/locales/new/waveform_styles.en.yml +12 -0
  210. data/entry_types/scrolled/config/locales/new/widgets.de.yml +6 -0
  211. data/entry_types/scrolled/config/locales/new/widgets.en.yml +6 -0
  212. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +29 -5
  213. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +8 -6
  214. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +37 -0
  215. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +57 -0
  216. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +49 -0
  217. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +2 -0
  218. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +8 -0
  219. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +42 -0
  220. data/entry_types/scrolled/lib/pageflow_scrolled.rb +17 -1
  221. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/create_bundle_symlinks_for_yarn.rake +3 -2
  222. data/entry_types/scrolled/package/config/webpack.js +11 -0
  223. data/entry_types/scrolled/package/contentElements-editor.js +323 -89
  224. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  225. data/entry_types/scrolled/package/contentElements-frontend.js +719 -529
  226. data/entry_types/scrolled/package/editor.js +459 -261
  227. data/entry_types/scrolled/package/frontend/{EditableText-7093fd0e.js → EditableInlineText.module-b9923660.js} +284 -362
  228. data/entry_types/scrolled/package/frontend/{i18n-4dc6c377.js → PhonePlatformContext-9fb97827.js} +199 -106
  229. data/entry_types/scrolled/package/frontend/{Viewer-e49e7807.js → Viewer-e2290ea0.js} +196 -79
  230. data/entry_types/scrolled/package/frontend/{Wavesurfer-0adf5667.js → Wavesurfer-7d9cf1b7.js} +16 -58
  231. data/entry_types/scrolled/package/frontend/{components-6a6793ca.js → components-6ab26015.js} +664 -671
  232. data/entry_types/scrolled/package/frontend/{getPrototypeOf-63c7c8e8.js → createSuper-d0f30da3.js} +34 -5
  233. data/entry_types/scrolled/package/frontend/index.css +1 -9
  234. data/entry_types/scrolled/package/frontend/index.js +1919 -2386
  235. data/entry_types/scrolled/package/frontend/{useBrowserFeature-91a4c29d.js → usePhonePlatform-2857c22b.js} +9 -8
  236. data/entry_types/scrolled/package/frontend-server.js +3 -6
  237. data/entry_types/scrolled/package/package.json +16 -8
  238. data/entry_types/scrolled/package/testHelpers.js +456 -0
  239. data/entry_types/scrolled/package/values/breakpoints.module.css +9 -0
  240. data/entry_types/scrolled/package/values/colors.module.css +5 -0
  241. data/entry_types/scrolled/package/widgets/defaultNavigation.css +9 -0
  242. data/entry_types/scrolled/package/widgets/defaultNavigation.js +612 -0
  243. data/entry_types/scrolled/spec/fixtures/image.svg +1 -0
  244. data/lib/pageflow/ability_mixin.rb +4 -0
  245. data/lib/pageflow/built_in_widget_type.rb +4 -0
  246. data/lib/pageflow/built_in_widget_types_plugin.rb +7 -0
  247. data/lib/pageflow/configuration.rb +34 -1
  248. data/lib/pageflow/entry_type.rb +11 -2
  249. data/lib/pageflow/entry_type_configuration.rb +2 -0
  250. data/lib/pageflow/file_type.rb +24 -0
  251. data/lib/pageflow/paperclip_processors/audio_waveform.rb +42 -0
  252. data/lib/pageflow/paperclip_processors/noop.rb +10 -0
  253. data/lib/pageflow/theme_customizations.rb +61 -0
  254. data/lib/pageflow/version.rb +1 -1
  255. data/lib/pageflow.rb +9 -0
  256. data/package/config/jest/index.js +2 -1
  257. data/package/config/postcss/scaleFunctions.js +71 -0
  258. data/package/editor.js +95 -85
  259. data/package/frontend.js +521 -161
  260. data/package/package.json +5 -3
  261. data/package/testHelpers.js +26 -5
  262. data/package/ui.js +124 -11
  263. data/spec/factories/draft_entries.rb +19 -1
  264. data/spec/factories/entries.rb +4 -0
  265. data/spec/factories/published_entries.rb +6 -0
  266. data/spec/fixtures/audio.ogg +0 -0
  267. metadata +119 -14
  268. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +0 -2
  269. data/app/views/admin/entries/entry_types.json.jbuilder +0 -4
  270. data/package/config/jest/transformers/upwardBabel.js +0 -5
@@ -0,0 +1,612 @@
1
+ import { useI18n, utils, Tooltip, useFileRights, useLegalInfo, useCredits, Widget, ThemeIcon, usePhonePlatform, useShareProviders, useShareUrl, useMediaMuted, useTheme, useOnUnmuteMedia, useChapters, useCurrentChapter, useScrollPosition, frontend } from 'pageflow-scrolled/frontend';
2
+ import React, { useRef, useEffect, useCallback, useState } from 'react';
3
+ import classNames from 'classnames';
4
+ import { media } from 'pageflow/frontend';
5
+ import Measure from 'react-measure';
6
+
7
+ function _defineProperty(obj, key, value) {
8
+ if (key in obj) {
9
+ Object.defineProperty(obj, key, {
10
+ value: value,
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true
14
+ });
15
+ } else {
16
+ obj[key] = value;
17
+ }
18
+
19
+ return obj;
20
+ }
21
+
22
+ function _arrayWithHoles(arr) {
23
+ if (Array.isArray(arr)) return arr;
24
+ }
25
+
26
+ function _iterableToArrayLimit(arr, i) {
27
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
28
+ var _arr = [];
29
+ var _n = true;
30
+ var _d = false;
31
+ var _e = undefined;
32
+
33
+ try {
34
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
35
+ _arr.push(_s.value);
36
+
37
+ if (i && _arr.length === i) break;
38
+ }
39
+ } catch (err) {
40
+ _d = true;
41
+ _e = err;
42
+ } finally {
43
+ try {
44
+ if (!_n && _i["return"] != null) _i["return"]();
45
+ } finally {
46
+ if (_d) throw _e;
47
+ }
48
+ }
49
+
50
+ return _arr;
51
+ }
52
+
53
+ function _arrayLikeToArray(arr, len) {
54
+ if (len == null || len > arr.length) len = arr.length;
55
+
56
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
57
+ arr2[i] = arr[i];
58
+ }
59
+
60
+ return arr2;
61
+ }
62
+
63
+ function _unsupportedIterableToArray(o, minLen) {
64
+ if (!o) return;
65
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
66
+ var n = Object.prototype.toString.call(o).slice(8, -1);
67
+ if (n === "Object" && o.constructor) n = o.constructor.name;
68
+ if (n === "Map" || n === "Set") return Array.from(n);
69
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
70
+ }
71
+
72
+ function _nonIterableRest() {
73
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
74
+ }
75
+
76
+ function _slicedToArray(arr, i) {
77
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
78
+ }
79
+
80
+ var styles = {"breakpoint-below-md":"(max-width: 767px)","navigationBar":"DefaultNavigation-module_navigationBar__2RK0h scope-defaultNavigation","navigationBarExpanded":"DefaultNavigation-module_navigationBarExpanded__C3sLq","navigationBarContentWrapper":"DefaultNavigation-module_navigationBarContentWrapper__3narH","menuIcon":"DefaultNavigation-module_menuIcon__2bb8s","contextIcons":"DefaultNavigation-module_contextIcons__2e65s","contextIcon":"DefaultNavigation-module_contextIcon__ELsqa utils-module_unstyledButton__3rgne","logo":"DefaultNavigation-module_logo__3gUbx","chapterList":"DefaultNavigation-module_chapterList__3VoXX scope-defaultNavigationChapterList","chapterListItem":"DefaultNavigation-module_chapterListItem__1YF5e","navigationTooltip":"DefaultNavigation-module_navigationTooltip__26Fvn","progressBar":"DefaultNavigation-module_progressBar__1jvov","progressIndicator":"DefaultNavigation-module_progressIndicator__2d_e3","hasChapters":"DefaultNavigation-module_hasChapters__3ab-r","navigationChapters":"DefaultNavigation-module_navigationChapters__3M6zh","navigationChaptersHidden":"DefaultNavigation-module_navigationChaptersHidden__2TrUo"};
81
+
82
+ var styles$1 = {"breakpoint-md":"(min-width: 768px)","burgerMenuIconContainer":"HamburgerIcon-module_burgerMenuIconContainer__3aBkk","burgerMenuIcon":"HamburgerIcon-module_burgerMenuIcon__1WUV0"};
83
+
84
+ var hamburgerIconStyles = {"hamburger":"HamburgerIcons-module_hamburger__SOreS","is-active":"HamburgerIcons-module_is-active__2jpzX","hamburger-inner":"HamburgerIcons-module_hamburger-inner__Wv7Dn","hamburger-box":"HamburgerIcons-module_hamburger-box__10MR1","hamburger--collapse":"HamburgerIcons-module_hamburger--collapse__1xOkf"};
85
+
86
+ function HamburgerIcon(props) {
87
+ var _useI18n = useI18n(),
88
+ t = _useI18n.t;
89
+
90
+ return /*#__PURE__*/React.createElement("div", {
91
+ className: styles$1.burgerMenuIconContainer
92
+ }, /*#__PURE__*/React.createElement("button", {
93
+ className: classNames(styles.menuIcon, styles$1.burgerMenuIcon, hamburgerIconStyles.hamburger, hamburgerIconStyles['hamburger--collapse'], _defineProperty({}, hamburgerIconStyles['is-active'], !props.mobileNavHidden)),
94
+ title: props.mobileNavHidden ? t('pageflow_scrolled.public.navigation.open_mobile_menu') : t('pageflow_scrolled.public.navigation.close_mobile_menu'),
95
+ type: "button",
96
+ onClick: props.onClick
97
+ }, /*#__PURE__*/React.createElement("span", {
98
+ className: hamburgerIconStyles['hamburger-box']
99
+ }, /*#__PURE__*/React.createElement("span", {
100
+ className: hamburgerIconStyles['hamburger-inner']
101
+ }))));
102
+ }
103
+
104
+ var styles$2 = {"breakpoint-md":"(min-width: 768px)","chapterLink":"ChapterLink-module_chapterLink__3YspQ typography-defaultNavigationChapterLink","chapterLinkActive":"ChapterLink-module_chapterLinkActive__9i8SL typography-defaultNavigationActiveChapterLink","summary":"ChapterLink-module_summary__2ZfRU","tooltipBubble":"ChapterLink-module_tooltipBubble__3VRUO"};
105
+
106
+ var isBlank = utils.isBlank,
107
+ presence = utils.presence;
108
+ function ChapterLink(props) {
109
+ var _useI18n = useI18n(),
110
+ t = _useI18n.t;
111
+
112
+ var item = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
113
+ className: classNames(styles$2.chapterLink, _defineProperty({}, styles$2.chapterLinkActive, props.active)),
114
+ href: "#".concat(props.chapterSlug),
115
+ onClick: function onClick() {
116
+ return props.handleMenuClick(props.chapterLinkId);
117
+ }
118
+ }, presence(props.title) || t('pageflow_scrolled.public.navigation.chapter', {
119
+ number: props.chapterIndex
120
+ })), !isBlank(props.summary) && /*#__PURE__*/React.createElement("p", {
121
+ className: styles$2.summary,
122
+ dangerouslySetInnerHTML: {
123
+ __html: props.summary
124
+ }
125
+ }));
126
+
127
+ if (isBlank(props.summary)) {
128
+ return item;
129
+ }
130
+
131
+ var content = /*#__PURE__*/React.createElement("p", {
132
+ dangerouslySetInnerHTML: {
133
+ __html: props.summary
134
+ }
135
+ });
136
+ return /*#__PURE__*/React.createElement(Tooltip, {
137
+ content: content,
138
+ openOnHover: true,
139
+ highlight: true,
140
+ bubbleClassName: styles$2.tooltipBubble
141
+ }, item);
142
+ }
143
+
144
+ var styles$3 = {"legalInfoTooltip":"LegalInfoMenu-module_legalInfoTooltip__Qmf8u","scroller":"LegalInfoMenu-module_scroller__3NPW_","links":"LegalInfoMenu-module_links__1kpsd","legalInfoLink":"LegalInfoMenu-module_legalInfoLink__gkXaF"};
145
+
146
+ function LegalInfoLink(props) {
147
+ return /*#__PURE__*/React.createElement("div", null, props.label && props.url && /*#__PURE__*/React.createElement("a", {
148
+ target: "_blank",
149
+ rel: "noreferrer noopener",
150
+ href: props.url,
151
+ className: styles$3.legalInfoLink,
152
+ dangerouslySetInnerHTML: {
153
+ __html: props.label
154
+ }
155
+ }));
156
+ }
157
+
158
+ function LegalInfoMenu(props) {
159
+ var fileRights = useFileRights();
160
+ var legalInfo = useLegalInfo();
161
+ var credits = useCredits();
162
+
163
+ var _useI18n = useI18n(),
164
+ t = _useI18n.t;
165
+
166
+ var content = /*#__PURE__*/React.createElement("div", {
167
+ className: styles$3.legalInfoTooltip
168
+ }, /*#__PURE__*/React.createElement("div", {
169
+ className: styles$3.scroller
170
+ }, credits && /*#__PURE__*/React.createElement("p", {
171
+ dangerouslySetInnerHTML: {
172
+ __html: credits
173
+ }
174
+ }), fileRights && /*#__PURE__*/React.createElement("p", null, t('pageflow_scrolled.public.image_rights'), ": ", fileRights)), /*#__PURE__*/React.createElement("div", {
175
+ className: styles$3.links
176
+ }, /*#__PURE__*/React.createElement(LegalInfoLink, legalInfo.imprint), /*#__PURE__*/React.createElement(LegalInfoLink, legalInfo.copyright), /*#__PURE__*/React.createElement(LegalInfoLink, legalInfo.privacy)), /*#__PURE__*/React.createElement(Widget, {
177
+ role: "creditsBoxFooter"
178
+ }));
179
+ return /*#__PURE__*/React.createElement(Tooltip, {
180
+ horizontalOffset: -30,
181
+ arrowPos: 120,
182
+ content: content
183
+ }, /*#__PURE__*/React.createElement("button", {
184
+ className: classNames(styles.contextIcon),
185
+ "aria-haspopup": "true",
186
+ title: t('pageflow_scrolled.public.navigation.legal_info')
187
+ }, /*#__PURE__*/React.createElement(ThemeIcon, {
188
+ name: "information"
189
+ })));
190
+ }
191
+
192
+ var styles$4 = {"shareIcon":"SharingMenu-module_shareIcon__2iW2l","sharingTooltip":"SharingMenu-module_sharingTooltip__2Tyev","shareLinkContainer":"SharingMenu-module_shareLinkContainer__3-3W6","shareLink":"SharingMenu-module_shareLink__3PdRE"};
193
+
194
+ function SharingMenu() {
195
+ var isPhonePlatform = usePhonePlatform();
196
+ var shareProviders = useShareProviders({
197
+ isPhonePlatform: isPhonePlatform
198
+ });
199
+ var shareUrl = useShareUrl();
200
+
201
+ var _useI18n = useI18n(),
202
+ t = _useI18n.t;
203
+
204
+ function renderShareLinks(shareProviders) {
205
+ return shareProviders.map(function (shareProvider) {
206
+ var Icon = shareProvider.icon;
207
+ return /*#__PURE__*/React.createElement("div", {
208
+ key: shareProvider.name,
209
+ className: styles$4.shareLinkContainer
210
+ }, /*#__PURE__*/React.createElement("a", {
211
+ className: classNames('share', styles$4.shareLink),
212
+ href: shareProvider.url.replace('%{url}', shareUrl),
213
+ target: '_blank',
214
+ rel: "noopener noreferrer"
215
+ }, /*#__PURE__*/React.createElement(Icon, {
216
+ className: styles$4.shareIcon
217
+ }), shareProvider.name));
218
+ });
219
+ }
220
+
221
+ if (shareProviders.length > 0) {
222
+ return /*#__PURE__*/React.createElement(Tooltip, {
223
+ horizontalOffset: -70,
224
+ arrowPos: 160,
225
+ content: renderShareLinks(shareProviders)
226
+ }, /*#__PURE__*/React.createElement("button", {
227
+ className: classNames(styles.contextIcon),
228
+ title: t('pageflow_scrolled.public.navigation.share')
229
+ }, /*#__PURE__*/React.createElement(ThemeIcon, {
230
+ name: "share"
231
+ })));
232
+ } else {
233
+ return null;
234
+ }
235
+ }
236
+
237
+ var styles$5 = {"button":"ToggleMuteButton-module_button__1ACmo","animate":"ToggleMuteButton-module_animate__pd1yK","pulse":"ToggleMuteButton-module_pulse__2UN7Q"};
238
+
239
+ function ToggleMuteButton() {
240
+ var muted = useMediaMuted();
241
+
242
+ var _useI18n = useI18n(),
243
+ t = _useI18n.t;
244
+
245
+ useUnmuteSound();
246
+ return /*#__PURE__*/React.createElement("div", {
247
+ className: classNames(_defineProperty({}, styles$5.animate, !muted))
248
+ }, /*#__PURE__*/React.createElement("button", {
249
+ className: classNames(styles.contextIcon, styles$5.button),
250
+ title: muted ? t('pageflow_scrolled.public.navigation.unmute') : t('pageflow_scrolled.public.navigation.mute'),
251
+ onClick: function onClick() {
252
+ return media.mute(!muted);
253
+ }
254
+ }, muted ? /*#__PURE__*/React.createElement(ThemeIcon, {
255
+ name: "muted"
256
+ }) : /*#__PURE__*/React.createElement(ThemeIcon, {
257
+ name: "unmuted"
258
+ })));
259
+ }
260
+
261
+ function useUnmuteSound() {
262
+ var theme = useTheme();
263
+ var audio = useRef();
264
+ useEffect(function () {
265
+ audio.current = new Audio(theme.assets.unmute);
266
+ }, [theme.assets.unmute]);
267
+ useOnUnmuteMedia(useCallback(function () {
268
+ return audio.current.play();
269
+ }, []));
270
+ }
271
+
272
+ function Logo() {
273
+ var theme = useTheme();
274
+ return /*#__PURE__*/React.createElement("a", {
275
+ target: "_blank",
276
+ rel: "noopener noreferrer",
277
+ href: theme.options.logoUrl,
278
+ className: classNames(styles.menuIcon, styles.logo)
279
+ }, /*#__PURE__*/React.createElement("picture", null, /*#__PURE__*/React.createElement("source", {
280
+ media: "(max-width: 780px)",
281
+ srcSet: theme.assets.logoMobile
282
+ }), /*#__PURE__*/React.createElement("source", {
283
+ media: "(min-width: 781px)",
284
+ srcSet: theme.assets.logoDesktop
285
+ }), /*#__PURE__*/React.createElement("img", {
286
+ src: theme.assets.logoDesktop,
287
+ alt: theme.options.logoAltText
288
+ })));
289
+ }
290
+
291
+ var styles$6 = {"link":"SkipLinks-module_link__HMj9l"};
292
+
293
+ function SkipLinks() {
294
+ var _useI18n = useI18n(),
295
+ t = _useI18n.t;
296
+
297
+ function scrollDown() {
298
+ setTimeout(function () {
299
+ window.scrollTo(0, 50);
300
+ }, 50);
301
+ }
302
+
303
+ return /*#__PURE__*/React.createElement("div", {
304
+ id: "skipLinks"
305
+ }, /*#__PURE__*/React.createElement("a", {
306
+ href: "#goToContent",
307
+ className: styles$6.link,
308
+ onClick: scrollDown
309
+ }, t('pageflow_scrolled.public.navigation_skip_links.content')));
310
+ }
311
+
312
+ function _objectWithoutPropertiesLoose(source, excluded) {
313
+ if (source == null) return {};
314
+ var target = {};
315
+ var sourceKeys = Object.keys(source);
316
+ var key, i;
317
+
318
+ for (i = 0; i < sourceKeys.length; i++) {
319
+ key = sourceKeys[i];
320
+ if (excluded.indexOf(key) >= 0) continue;
321
+ target[key] = source[key];
322
+ }
323
+
324
+ return target;
325
+ }
326
+
327
+ function _objectWithoutProperties(source, excluded) {
328
+ if (source == null) return {};
329
+ var target = _objectWithoutPropertiesLoose(source, excluded);
330
+ var key, i;
331
+
332
+ if (Object.getOwnPropertySymbols) {
333
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
334
+
335
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
336
+ key = sourceSymbolKeys[i];
337
+ if (excluded.indexOf(key) >= 0) continue;
338
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
339
+ target[key] = source[key];
340
+ }
341
+ }
342
+
343
+ return target;
344
+ }
345
+
346
+ function _extends() {
347
+ _extends = Object.assign || function (target) {
348
+ for (var i = 1; i < arguments.length; i++) {
349
+ var source = arguments[i];
350
+
351
+ for (var key in source) {
352
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
353
+ target[key] = source[key];
354
+ }
355
+ }
356
+ }
357
+
358
+ return target;
359
+ };
360
+
361
+ return _extends.apply(this, arguments);
362
+ }
363
+ var ChevronLeftIcon = (function (_ref) {
364
+ var _ref$styles = _ref.styles,
365
+ props = _objectWithoutProperties(_ref, ["styles"]);
366
+
367
+ return /*#__PURE__*/React.createElement("svg", _extends({
368
+ xmlns: "http://www.w3.org/2000/svg",
369
+ viewBox: "0 0 320 512"
370
+ }, props), /*#__PURE__*/React.createElement("path", {
371
+ fill: "currentColor",
372
+ d: "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"
373
+ }));
374
+ });
375
+
376
+ function _extends$1() {
377
+ _extends$1 = Object.assign || function (target) {
378
+ for (var i = 1; i < arguments.length; i++) {
379
+ var source = arguments[i];
380
+
381
+ for (var key in source) {
382
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
383
+ target[key] = source[key];
384
+ }
385
+ }
386
+ }
387
+
388
+ return target;
389
+ };
390
+
391
+ return _extends$1.apply(this, arguments);
392
+ }
393
+ var ChevronRightIcon = (function (_ref) {
394
+ var _ref$styles = _ref.styles,
395
+ props = _objectWithoutProperties(_ref, ["styles"]);
396
+
397
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
398
+ xmlns: "http://www.w3.org/2000/svg",
399
+ viewBox: "0 0 320 512"
400
+ }, props), /*#__PURE__*/React.createElement("path", {
401
+ fill: "currentColor",
402
+ d: "M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"
403
+ }));
404
+ });
405
+
406
+ var styles$7 = {"button":"ScrollButton-module_button__1GKRF utils-module_unstyledButton__3rgne","visible":"ScrollButton-module_visible__29yco","start":"ScrollButton-module_start__1XPra ScrollButton-module_button__1GKRF utils-module_unstyledButton__3rgne","end":"ScrollButton-module_end__3PxQt ScrollButton-module_button__1GKRF utils-module_unstyledButton__3rgne"};
407
+
408
+ function ScrollButton(_ref) {
409
+ var _classNames;
410
+
411
+ var type = _ref.type,
412
+ contentRect = _ref.contentRect,
413
+ onStep = _ref.onStep;
414
+ var visible = type === 'start' ? contentRect.scroll.left > 0 : contentRect.scroll.width > contentRect.client.width && contentRect.scroll.left < contentRect.scroll.width - contentRect.client.width;
415
+ var step = type === 'start' ? -100 : 100;
416
+ var interval = useRef();
417
+ return /*#__PURE__*/React.createElement("button", {
418
+ className: classNames((_classNames = {}, _defineProperty(_classNames, styles$7.start, type === 'start'), _defineProperty(_classNames, styles$7.end, type === 'end'), _defineProperty(_classNames, styles$7.visible, visible), _classNames)),
419
+ onMouseDown: handleMouseDown,
420
+ onKeyPress: handleKeyPress
421
+ }, type === 'start' ? /*#__PURE__*/React.createElement(ChevronLeftIcon, null) : /*#__PURE__*/React.createElement(ChevronRightIcon, null));
422
+
423
+ function handleMouseDown(event) {
424
+ if (event.button === 0) {
425
+ scrollUntilMouseUp();
426
+ }
427
+ }
428
+
429
+ function scrollUntilMouseUp() {
430
+ scrollStep();
431
+ clearInterval(interval.current);
432
+ interval.current = setInterval(function () {
433
+ return scrollStep();
434
+ }, 400);
435
+ document.addEventListener('mouseup', stopScrolling);
436
+
437
+ function stopScrolling() {
438
+ document.removeEventListener('mouseup', stopScrolling);
439
+ clearInterval(interval.current);
440
+ }
441
+ }
442
+
443
+ function handleKeyPress(event) {
444
+ if (event.key === 'Enter' || event.key === ' ') {
445
+ scrollStep();
446
+ }
447
+ }
448
+
449
+ function scrollStep() {
450
+ onStep(step);
451
+ }
452
+ }
453
+
454
+ var styles$8 = {"breakpoint-md":"(min-width: 768px)","scroller":"Scroller-module_scroller__139cK","inner":"Scroller-module_inner__3dhuM"};
455
+
456
+ function Scroller(_ref) {
457
+ var children = _ref.children;
458
+ var ref = useRef();
459
+ return /*#__PURE__*/React.createElement(Measure, {
460
+ scroll: true,
461
+ client: true,
462
+ innerRef: ref
463
+ }, function (_ref2) {
464
+ var contentRect = _ref2.contentRect,
465
+ measureRef = _ref2.measureRef,
466
+ measure = _ref2.measure;
467
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScrollButton, {
468
+ type: "start",
469
+ contentRect: contentRect,
470
+ onStep: scrollBy
471
+ }), /*#__PURE__*/React.createElement(ScrollButton, {
472
+ type: "end",
473
+ contentRect: contentRect,
474
+ onStep: scrollBy
475
+ }), /*#__PURE__*/React.createElement("div", {
476
+ className: styles$8.scroller,
477
+ ref: measureRef,
478
+ onFocus: scrollTargetIntoView,
479
+ onScroll: function onScroll() {
480
+ return measure();
481
+ }
482
+ }, /*#__PURE__*/React.createElement("div", {
483
+ className: styles$8.inner
484
+ }, children)));
485
+ });
486
+
487
+ function scrollBy(x) {
488
+ // IE11 does not support scrollBy
489
+ ref.current.scrollLeft = ref.current.scrollLeft + x;
490
+ }
491
+
492
+ function scrollTargetIntoView(event) {
493
+ var targetBounds = event.target.getBoundingClientRect();
494
+ var scrollerClipRight = ref.current.clientWidth * 0.75;
495
+ var scrollerClipLeft = ref.current.clientWidth * 0.25;
496
+
497
+ if (targetBounds.left < scrollerClipLeft) {
498
+ scrollBy(targetBounds.left - scrollerClipLeft);
499
+ } else if (targetBounds.right > scrollerClipRight) {
500
+ scrollBy(targetBounds.right - scrollerClipRight);
501
+ }
502
+ }
503
+ }
504
+
505
+ function DefaultNavigation(props) {
506
+ var _chapters$, _chapters$2, _classNames2;
507
+
508
+ var _useState = useState(true),
509
+ _useState2 = _slicedToArray(_useState, 2),
510
+ navExpanded = _useState2[0],
511
+ setNavExpanded = _useState2[1];
512
+
513
+ var _useState3 = useState(true),
514
+ _useState4 = _slicedToArray(_useState3, 2),
515
+ mobileNavHidden = _useState4[0],
516
+ setMobileNavHidden = _useState4[1];
517
+
518
+ var _useState5 = useState(0),
519
+ _useState6 = _slicedToArray(_useState5, 2),
520
+ readingProgress = _useState6[0],
521
+ setReadingProgress = _useState6[1];
522
+
523
+ var chapters = useChapters();
524
+ var currentChapter = useCurrentChapter();
525
+ useScrollPosition(function (_ref) {
526
+ var prevPos = _ref.prevPos,
527
+ currPos = _ref.currPos;
528
+ var expand = currPos.y > prevPos.y || // Mobile Safari reports positive scroll position
529
+ // during scroll bounce animation when scrolling
530
+ // back to the top. Make sure navigation bar
531
+ // stays expanded:
532
+ currPos.y >= 0;
533
+ if (expand !== navExpanded) setNavExpanded(expand);
534
+ }, [navExpanded]);
535
+ useScrollPosition(function (_ref2) {
536
+ var prevPos = _ref2.prevPos,
537
+ currPos = _ref2.currPos;
538
+ var current = currPos.y * -1; // Todo: Memoize and update on window resize
539
+
540
+ var total = document.body.clientHeight - window.innerHeight;
541
+ var progress = Math.min(100, Math.abs(current / total) * 100);
542
+ setReadingProgress(progress);
543
+ }, [readingProgress], null, false, 1);
544
+ useOnUnmuteMedia(useCallback(function () {
545
+ return setNavExpanded(true);
546
+ }, []));
547
+ var hasChapters = chapters.length > 1 || !utils.isBlank((_chapters$ = chapters[0]) === null || _chapters$ === void 0 ? void 0 : _chapters$.title) || !utils.isBlank((_chapters$2 = chapters[0]) === null || _chapters$2 === void 0 ? void 0 : _chapters$2.summary);
548
+
549
+ function handleProgressBarMouseEnter() {
550
+ setNavExpanded(true);
551
+ }
552
+
553
+ function handleBurgerMenuClick() {
554
+ setMobileNavHidden(!mobileNavHidden);
555
+ }
556
+
557
+ function handleMenuClick(chapterLinkId) {
558
+ setMobileNavHidden(true);
559
+ }
560
+
561
+ function renderChapterLinks(chapters) {
562
+ return chapters.map(function (chapter, index) {
563
+ var chapterIndex = index + 1;
564
+ var chapterLinkId = "chapterLink".concat(chapterIndex);
565
+ return /*#__PURE__*/React.createElement("li", {
566
+ key: index,
567
+ className: styles.chapterListItem
568
+ }, /*#__PURE__*/React.createElement(ChapterLink, Object.assign({}, chapter, {
569
+ chapterIndex: chapterIndex,
570
+ chapterLinkId: chapterLinkId,
571
+ active: (currentChapter === null || currentChapter === void 0 ? void 0 : currentChapter.id) === chapter.id,
572
+ handleMenuClick: handleMenuClick
573
+ })));
574
+ });
575
+ }
576
+
577
+ function renderNav() {
578
+ if (!hasChapters) {
579
+ return null;
580
+ }
581
+
582
+ return /*#__PURE__*/React.createElement(Scroller, null, /*#__PURE__*/React.createElement("nav", {
583
+ className: classNames(styles.navigationChapters, _defineProperty({}, styles.navigationChaptersHidden, mobileNavHidden)),
584
+ role: "navigation"
585
+ }, /*#__PURE__*/React.createElement("ul", {
586
+ className: styles.chapterList
587
+ }, renderChapterLinks(chapters))));
588
+ }
589
+
590
+ return /*#__PURE__*/React.createElement("header", {
591
+ className: classNames(styles.navigationBar, (_classNames2 = {}, _defineProperty(_classNames2, styles.navigationBarExpanded, navExpanded || !mobileNavHidden), _defineProperty(_classNames2, styles.hasChapters, hasChapters), _classNames2))
592
+ }, /*#__PURE__*/React.createElement("div", {
593
+ className: styles.navigationBarContentWrapper
594
+ }, hasChapters && /*#__PURE__*/React.createElement(HamburgerIcon, {
595
+ onClick: handleBurgerMenuClick,
596
+ mobileNavHidden: mobileNavHidden
597
+ }), /*#__PURE__*/React.createElement(SkipLinks, null), /*#__PURE__*/React.createElement(Logo, null), renderNav(), /*#__PURE__*/React.createElement("div", {
598
+ className: classNames(styles.contextIcons)
599
+ }, /*#__PURE__*/React.createElement(ToggleMuteButton, null), /*#__PURE__*/React.createElement(LegalInfoMenu, null), /*#__PURE__*/React.createElement(SharingMenu, null))), /*#__PURE__*/React.createElement("div", {
600
+ className: styles.progressBar,
601
+ onMouseEnter: handleProgressBarMouseEnter
602
+ }, /*#__PURE__*/React.createElement("span", {
603
+ className: styles.progressIndicator,
604
+ style: {
605
+ width: readingProgress + '%'
606
+ }
607
+ })));
608
+ }
609
+
610
+ frontend.widgetTypes.register('defaultNavigation', {
611
+ component: DefaultNavigation
612
+ });
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"></svg>
@@ -83,6 +83,10 @@ module Pageflow
83
83
  EntryPolicy.new(user, Entry.new).create_any?
84
84
  end
85
85
 
86
+ can :filter_by_type, :entries do
87
+ EntryPolicy.new(user, Entry).filter_by_type?
88
+ end
89
+
86
90
  can :see_own_role_on, :entries do
87
91
  !user.admin?
88
92
  end
@@ -44,6 +44,10 @@ module Pageflow
44
44
  Pageflow::React.create_widget_type('cookie_notice_bar', 'cookie_notice')
45
45
  end
46
46
 
47
+ def self.consent_bar
48
+ Pageflow::React.create_widget_type('consent_bar', 'cookie_notice')
49
+ end
50
+
47
51
  def self.unmute_button
48
52
  Pageflow::React.create_widget_type('unmute_button', 'background_media_control')
49
53
  end
@@ -8,6 +8,7 @@ module Pageflow
8
8
  navigation(entry_type_config)
9
9
  player_controls(entry_type_config)
10
10
  cookie_notice(entry_type_config)
11
+ consent_bar(entry_type_config)
11
12
  background_media_control(entry_type_config)
12
13
  end
13
14
  end
@@ -52,6 +53,12 @@ module Pageflow
52
53
  config.widget_types.register(BuiltInWidgetType.cookie_notice_bar)
53
54
  end
54
55
 
56
+ def consent_bar(config)
57
+ config.features.register('consent_bar') do |feature_config|
58
+ feature_config.widget_types.register(BuiltInWidgetType.consent_bar, default: true)
59
+ end
60
+ end
61
+
55
62
  def background_media_control(config)
56
63
  config.widget_types.register(BuiltInWidgetType.unmute_button, default: true)
57
64
  end