pageflow 15.2.2 → 15.3.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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +338 -85
  3. data/admins/pageflow/accounts.rb +1 -98
  4. data/admins/pageflow/entry.rb +21 -1
  5. data/admins/pageflow/entry_templates.rb +140 -0
  6. data/admins/pageflow/membership.rb +12 -0
  7. data/admins/pageflow/user.rb +5 -3
  8. data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
  9. data/app/assets/javascripts/pageflow/admin/users.js +1 -1
  10. data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
  11. data/app/assets/javascripts/pageflow/base.js +0 -12
  12. data/app/assets/javascripts/pageflow/components.js +2 -6
  13. data/app/assets/javascripts/pageflow/dist/ui.js +47 -14
  14. data/app/assets/javascripts/pageflow/vendor.js +13 -10
  15. data/app/assets/stylesheets/pageflow/base.scss +0 -7
  16. data/app/assets/stylesheets/pageflow/editor/base.scss +2 -0
  17. data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
  18. data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
  19. data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
  20. data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
  21. data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
  22. data/app/helpers/pageflow/structured_data_helper.rb +0 -2
  23. data/app/models/pageflow/account.rb +21 -1
  24. data/app/models/pageflow/entry.rb +9 -2
  25. data/app/models/pageflow/entry_duplicate.rb +1 -0
  26. data/app/models/pageflow/entry_template.rb +16 -2
  27. data/app/policies/pageflow/account_policy.rb +10 -0
  28. data/app/policies/pageflow/entry_template_policy.rb +5 -1
  29. data/app/views/admin/accounts/_entry_template_details.html.arb +7 -5
  30. data/app/views/admin/accounts/_form.html.erb +3 -49
  31. data/app/views/admin/entries/_attributes_table.html.arb +5 -0
  32. data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
  33. data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
  34. data/app/views/admin/entry_templates/_form.html.erb +58 -0
  35. data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
  36. data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
  37. data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
  38. data/config/initializers/admin_resource_tabs.rb +5 -0
  39. data/config/initializers/help_entries.rb +1 -5
  40. data/config/locales/de.yml +88 -155
  41. data/config/locales/en.yml +79 -143
  42. data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
  43. data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
  44. data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
  45. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1479 -1391
  46. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9218 -0
  47. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
  48. data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
  49. data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
  50. data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
  51. data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +8 -0
  52. data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
  53. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
  54. data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
  55. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +2 -2
  56. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +2 -2
  57. data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
  58. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
  59. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
  60. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
  61. data/entry_types/paged/config/initializers/features.rb +1 -1
  62. data/entry_types/paged/config/initializers/help_entries.rb +17 -0
  63. data/entry_types/paged/config/locales/new/help.de.yml +162 -0
  64. data/entry_types/paged/config/locales/new/help.en.yml +153 -0
  65. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
  66. data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
  67. data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
  68. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
  69. data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
  70. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
  71. data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
  72. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
  73. data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
  74. data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
  75. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  76. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +14 -4
  77. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
  78. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +8 -0
  79. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +6 -0
  80. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -0
  81. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +33 -0
  82. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +8 -0
  83. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +38 -0
  84. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
  85. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
  86. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +19 -3
  87. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
  88. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +7 -0
  89. data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
  90. data/entry_types/scrolled/config/locales/new/de.yml +345 -13
  91. data/entry_types/scrolled/config/locales/new/en.yml +257 -14
  92. data/entry_types/scrolled/config/routes.rb +1 -0
  93. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +28 -0
  94. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
  95. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
  96. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +4 -0
  97. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
  98. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +90 -30
  99. data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +64 -27
  100. data/entry_types/scrolled/package/contentElements-editor.js +242 -183
  101. data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
  102. data/entry_types/scrolled/package/contentElements-frontend.js +624 -279
  103. data/entry_types/scrolled/package/editor.js +2561 -363
  104. data/entry_types/scrolled/package/frontend-server.js +228 -0
  105. data/entry_types/scrolled/package/frontend/EditableText-4264c349.js +1993 -0
  106. data/entry_types/scrolled/package/frontend/Wavesurfer-c3c45324.js +378 -0
  107. data/entry_types/scrolled/package/frontend/components-cfe6a479.js +2115 -0
  108. data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
  109. data/entry_types/scrolled/package/frontend/index.css +9 -0
  110. data/entry_types/scrolled/package/frontend/index.js +4425 -0
  111. data/entry_types/scrolled/package/package.json +17 -6
  112. data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
  113. data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
  114. data/lib/generators/pageflow/initializer/templates/pageflow.rb +20 -9
  115. data/lib/pageflow/ability_mixin.rb +14 -2
  116. data/lib/pageflow/configuration.rb +6 -5
  117. data/lib/pageflow/engine.rb +1 -0
  118. data/lib/pageflow/entry_type_configuration.rb +1 -0
  119. data/lib/pageflow/global_config_api.rb +5 -4
  120. data/lib/pageflow/react.rb +4 -2
  121. data/lib/pageflow/version.rb +1 -1
  122. data/{packages/pageflow → package}/config/jest/index.js +2 -1
  123. data/{packages/pageflow → package}/config/jest/transformers/jst.js +0 -0
  124. data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
  125. data/package/config/webpack.js +22 -0
  126. data/{packages/pageflow → package}/editor.js +480 -1129
  127. data/package/frontend.js +2525 -0
  128. data/{packages/pageflow → package}/package.json +3 -0
  129. data/{packages/pageflow → package}/testHelpers.js +114 -13
  130. data/{packages/pageflow → package}/ui.js +47 -14
  131. data/spec/factories/accounts.rb +3 -1
  132. data/spec/factories/entry_templates.rb +1 -0
  133. data/spec/factories/published_entries.rb +6 -1
  134. metadata +62 -26
  135. data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5800
  136. data/config/initializers/entry_types.rb +0 -4
  137. data/entry_types/scrolled/package/frontend.js +0 -2879
  138. data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
  139. data/packages/pageflow/config/webpack.js +0 -14
@@ -0,0 +1,86 @@
1
+ function _classCallCheck(instance, Constructor) {
2
+ if (!(instance instanceof Constructor)) {
3
+ throw new TypeError("Cannot call a class as a function");
4
+ }
5
+ }
6
+
7
+ function _defineProperties(target, props) {
8
+ for (var i = 0; i < props.length; i++) {
9
+ var descriptor = props[i];
10
+ descriptor.enumerable = descriptor.enumerable || false;
11
+ descriptor.configurable = true;
12
+ if ("value" in descriptor) descriptor.writable = true;
13
+ Object.defineProperty(target, descriptor.key, descriptor);
14
+ }
15
+ }
16
+
17
+ function _createClass(Constructor, protoProps, staticProps) {
18
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
19
+ if (staticProps) _defineProperties(Constructor, staticProps);
20
+ return Constructor;
21
+ }
22
+
23
+ function _setPrototypeOf(o, p) {
24
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
25
+ o.__proto__ = p;
26
+ return o;
27
+ };
28
+
29
+ return _setPrototypeOf(o, p);
30
+ }
31
+
32
+ function _inherits(subClass, superClass) {
33
+ if (typeof superClass !== "function" && superClass !== null) {
34
+ throw new TypeError("Super expression must either be null or a function");
35
+ }
36
+
37
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
38
+ constructor: {
39
+ value: subClass,
40
+ writable: true,
41
+ configurable: true
42
+ }
43
+ });
44
+ if (superClass) _setPrototypeOf(subClass, superClass);
45
+ }
46
+
47
+ function _typeof(obj) {
48
+ "@babel/helpers - typeof";
49
+
50
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
51
+ _typeof = function _typeof(obj) {
52
+ return typeof obj;
53
+ };
54
+ } else {
55
+ _typeof = function _typeof(obj) {
56
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
57
+ };
58
+ }
59
+
60
+ return _typeof(obj);
61
+ }
62
+
63
+ function _assertThisInitialized(self) {
64
+ if (self === void 0) {
65
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
66
+ }
67
+
68
+ return self;
69
+ }
70
+
71
+ function _possibleConstructorReturn(self, call) {
72
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
73
+ return call;
74
+ }
75
+
76
+ return _assertThisInitialized(self);
77
+ }
78
+
79
+ function _getPrototypeOf(o) {
80
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
81
+ return o.__proto__ || Object.getPrototypeOf(o);
82
+ };
83
+ return _getPrototypeOf(o);
84
+ }
85
+
86
+ export { _createClass as _, _classCallCheck as a, _inherits as b, _getPrototypeOf as c, _possibleConstructorReturn as d, _assertThisInitialized as e };
@@ -0,0 +1,9 @@
1
+ .ContentElementMargin-module_wrapper__20kIk{margin:1em 0 0}.useScrollPositionLifecycle-module_wrapper__1a6Kr{position:relative}.useScrollPositionLifecycle-module_isActiveProbe__3VKB5{position:absolute;top:0;left:0;bottom:2px;width:1px}.Text-module_h2__34chJ{font-size:66px;font-weight:700}.Text-module_h1__2_5kX{font-size:110px;line-height:1}.Text-module_body__4oWD-{font-size:22px;line-height:1.4}.Text-module_caption__3_6Au{font-size:20px;line-height:1.4}@media (max-width:600px){.Text-module_h2__34chJ{font-size:40px}.Text-module_h1__2_5kX{font-size:66px}}.SelectionRect-module_main__3AOhG{position:relative}.SelectionRect-module_main__3AOhG:after{content:"";position:absolute;top:-.5em;left:-.5em;right:-.5em;bottom:-.5em;pointer-events:none;opacity:.8}.SelectionRect-module_full__3tsQF:after{left:0;right:0}.SelectionRect-module_selected__1PhM6:after{border-left:1px solid;border-right:1px solid}.SelectionRect-module_toolbar__3nPrd{position:absolute;top:-40px;right:-15px;z-index:1;pointer-events:all}.SelectionRect-module_insert__w0Tl0{display:none;text-align:center;position:absolute;width:100%;opacity:.8;pointer-events:none}.SelectionRect-module_insertHovered__VTsDD.SelectionRect-module_insert__w0Tl0{opacity:1}.SelectionRect-module_end__3qOoK .SelectionRect-module_insert-after__3FJ4R,.SelectionRect-module_start__3_nAf .SelectionRect-module_insert-before__2Tyq5{display:block}.SelectionRect-module_insert__w0Tl0:after,.SelectionRect-module_insert__w0Tl0:before{content:"";position:absolute;top:0;width:calc(50% - 5px);height:0;border-bottom:1px solid}.SelectionRect-module_insert__w0Tl0:before{left:-.5em}.SelectionRect-module_insert__w0Tl0:after{right:-.5em}.SelectionRect-module_full__3tsQF .SelectionRect-module_insert__w0Tl0:after,.SelectionRect-module_full__3tsQF .SelectionRect-module_insert__w0Tl0:before{width:calc(50% - 5px + -.5em)}.SelectionRect-module_full__3tsQF .SelectionRect-module_insert__w0Tl0:before{left:0}.SelectionRect-module_full__3tsQF .SelectionRect-module_insert__w0Tl0:after{right:0}.SelectionRect-module_insertButton__1g-ZG{pointer-events:all;border:0;background:none;color:currentColor;display:inline-block;vertical-align:top;position:relative;top:-9px;padding:2px 10px}.SelectionRect-module_insert-before__2Tyq5{top:-.5em}.SelectionRect-module_insert-after__3FJ4R{top:calc(100% + .5em)}.TextPlaceholder-module_placeholder__sgVwx{position:absolute;transform:translateY(-100%);pointer-events:none;opacity:.5}.ContentElementInsertButton-module_container__3dvUS{height:0;position:relative;top:1em;text-align:center;opacity:.8}.ContentElementInsertButton-module_hovered__3Pggi{opacity:1}.ContentElementInsertButton-module_container__3dvUS:after,.ContentElementInsertButton-module_container__3dvUS:before{content:"";border-top:1px solid;width:calc(50% - 20px);position:absolute;top:0}.ContentElementInsertButton-module_container__3dvUS:before{left:0}.ContentElementInsertButton-module_container__3dvUS:after{right:0}.ContentElementInsertButton-module_button__2-eE2{border:0;background:none;color:currentColor;position:relative;top:-8px}.Toolbar-module_Toolbar__1INSj{background:#fff;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);display:flex;gap:2px}.Toolbar-module_button__de5BW{border:0;background:#fff;padding:10px;opacity:.6}.Toolbar-module_button__de5BW:hover{opacity:1}.Toolbar-module_activeButton__2sOLP{background:#ddd;opacity:1}@media (max-width:460px){.Toolbar-module_collapsible__3sivb .Toolbar-module_button__de5BW{display:none}.Toolbar-module_collapsible__3sivb .Toolbar-module_activeButton__2sOLP,.Toolbar-module_collapsible__3sivb:focus-within .Toolbar-module_button__de5BW,.Toolbar-module_collapsible__3sivb:hover .Toolbar-module_button__de5BW{display:inline-block}}.index-module_container__3dD9z{position:relative}.index-module_hoveringToolbar__31Xpd{position:absolute;z-index:2;top:-10000px;left:-10000px;margin-top:-6px;opacity:0;white-space:nowrap}.index-module_selection__3dUiD{display:none;position:absolute;z-index:1;width:100%;pointer-events:none}.index-module_linkTooltip__36m1K{background-color:#222;border-radius:4px;font-family:Helvetica,"Sans-Serif";font-size:13px;line-height:1;box-shadow:0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23)}.index-module_linkTooltip__36m1K:before{content:"";display:block;position:absolute;left:20px;bottom:100%;border:4px solid transparent;border-bottom-color:#222}.index-module_linkTooltip__36m1K a,.index-module_linkTooltip__36m1K button,.index-module_linkTooltip__36m1K input{color:#fff;background-color:transparent;border:0;display:inline-block;padding:10px}.index-module_linkTooltip__36m1K input{outline:none}.index-module_linkTooltip__36m1K button{border:0;cursor:pointer}.index-module_linkTooltip__36m1K svg{padding-left:7px}.SectionDecorator-module_wrapper__3sTk3{position:relative}.SectionDecorator-module_selected__1gcmF>section:before{content:"";display:block;position:absolute;border:1px solid;top:5px;left:5px;right:5px;bottom:5px;z-index:9;pointer-events:none}.SectionDecorator-module_transitionSelected__Wklk6>section:before{content:"";position:absolute;display:block;top:0;width:100%;border-top:2px dotted #fff;z-index:9;background-color:#555;opacity:.7}.SectionDecorator-module_controls__LVEJG{position:absolute;top:-33px;right:0;height:100%;padding-left:20px;z-index:10;display:none}.SectionDecorator-module_selected__1gcmF .SectionDecorator-module_controls__LVEJG,.SectionDecorator-module_transitionSelected__Wklk6 .SectionDecorator-module_controls__LVEJG{display:block}.SectionDecorator-module_transitionSelected__Wklk6 .SectionDecorator-module_editToolbar__18Kjq{visibility:hidden}.SectionDecorator-module_toolbar__2Va1D{position:absolute;padding:10px 0 10px 10px;z-index:10;overflow:hidden}.SectionDecorator-module_editToolbar__18Kjq{position:-webkit-sticky;position:sticky;top:calc(50vh - 30px);margin-top:55px}.SectionDecorator-module_transitionToolbar-before__KipOO{top:0}.SectionDecorator-module_transitionToolbar-after__2_DVO{bottom:-63px}.ContentElement-module_missing__2_1j9{color:#000;background-color:#fff;border-left:5px solid #f44336;padding:.5em;margin:1em 0 0}.TwoColumn-module_group__3Hg2y{margin-left:8%;margin-right:8%}.TwoColumn-module_group-full__2OT4o{margin-left:0;margin-right:0}.TwoColumn-module_inline__1fPfM,.TwoColumn-module_sticky__4LCDO{max-width:500px}.TwoColumn-module_narrow__qAgnL.TwoColumn-module_right__Fr52a .TwoColumn-module_sticky__4LCDO,.TwoColumn-module_right__Fr52a .TwoColumn-module_inline__1fPfM{margin-left:auto}.TwoColumn-module_wide__xdF_t .TwoColumn-module_sticky__4LCDO{position:-webkit-sticky;position:sticky;float:right;clear:right;top:33%;width:30%;max-width:600px}.TwoColumn-module_wide__xdF_t.TwoColumn-module_right__Fr52a .TwoColumn-module_sticky__4LCDO{float:left}.Center-module_outer__3Rr0H{margin-left:8%;margin-right:8%}.Center-module_outer-full__3dknO{margin-left:0;margin-right:0}.Center-module_item__1KSs3{margin-left:auto;margin-right:auto;max-width:700px}.Center-module_item-full__1cEuv{margin-left:0;margin-right:0;max-width:none}@media (min-width:950px){.Center-module_inner-left__2z9Ea,.Center-module_inner-right__KBkVt{margin-top:.375em}.Center-module_inner-left__2z9Ea{float:left;width:60%;margin-left:-10%;margin-right:1em;margin-bottom:1em}.Center-module_inner-right__KBkVt{float:right;width:60%;margin-right:-10%;margin-left:1em;margin-bottom:1em}}.Foreground-module_Foreground__13ODU{position:relative;z-index:3;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center}.Foreground-module_fullFadeHeight__2p9dx{min-height:51vh}.Foreground-module_fullHeight__1vMXb{min-height:100vh}.Foreground-module_paddingBottom__3OtY4{padding-bottom:3em}header svg{fill:#c2c2c2;cursor:pointer}header svg:hover{fill:#00375a}.AppHeader-module_navigationBar__2EFHw{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;position:-webkit-sticky;position:sticky;top:-50px;transition:top .15s;z-index:10000;width:100%;text-align:center;height:0}.AppHeader-module_navigationBarExpanded__18nbf{top:0}.AppHeader-module_navigationBarContentWrapper__2Sf8y{position:relative;z-index:2;background-color:#fff;height:50px}.AppHeader-module_menuIcon__5JKuj{position:absolute}.AppHeader-module_contextIcons__23I_3{position:absolute;top:0;right:0;width:80px;height:50px;padding:0 12px}.AppHeader-module_contextIcon__157kW{float:right;width:40px;height:50px}.AppHeader-module_logo__2E1pn{top:0;left:15px;height:100%}.AppHeader-module_chapterList__2lMMD{padding:0;margin:0;list-style:none}.AppHeader-module_chapterListItem__28zrc{position:relative;display:inline-block;padding:0 15px;border-right:1px solid #e9e9e9}.AppHeader-module_chapterListItem__28zrc:last-of-type{border-right:none}.AppHeader-module_navigationTooltip__1EvCy{opacity:1!important;box-shadow:0 0 .3125rem rgba(0,0,0,.2)}.AppHeader-module_progressBar__17IVu{background-color:hsla(0,0%,76.1%,.8);height:8px;width:100%}.AppHeader-module_progressIndicator__3SlYz{position:absolute;top:0;left:0;width:0;height:100%;background-color:#e10028}@media (max-width:780px){.AppHeader-module_logo__2E1pn{position:inherit}.AppHeader-module_navigationChapters__1dzyV{touch-action:none;display:block;position:fixed;top:60px;left:0;background:hsla(0,0%,100%,.95);width:100vw;height:100vh}.AppHeader-module_navigationChaptersHidden__8AEPA{display:none}.AppHeader-module_chapterList__2lMMD{margin-top:50px}.AppHeader-module_chapterListItem__28zrc{display:list-item;width:80vw;padding:25px 10vw;border-right:none}.AppHeader-module_chapterListItem__28zrc:after,.AppHeader-module_chapterListItem__28zrc:before{display:table;content:" ";border-top:1px solid #646464;width:14%;margin:0 43%;transition:width .15s,margin .15s}.AppHeader-module_chapterListItem__28zrc:hover:after,.AppHeader-module_chapterListItem__28zrc:hover:before{border-top:1px solid #00375a;width:80%;margin:0 10%}.AppHeader-module_chapterListItem__28zrc p{margin-top:0}.AppHeader-module_progressBar__17IVu{height:10px}}.HamburgerIcon-module_burgerMenuIconContainer__26RY4{display:none}.HamburgerIcon-module_burgerMenuIcon__24t-5{top:12px;left:12px;outline:none}@media (max-width:780px){.HamburgerIcon-module_burgerMenuIconContainer__26RY4{display:block}}
2
+
3
+ /*!
4
+ * Hamburgers
5
+ * @description Tasty CSS-animated hamburgers
6
+ * @author Jonathan Suh @jonsuh
7
+ * @site https://jonsuh.com/hamburgers
8
+ * @link https://github.com/jonsuh/hamburgers
9
+ */.HamburgerIcons-module_hamburger__NnCze{display:inline-block;cursor:pointer;transition-property:opacity,-webkit-filter;transition-property:opacity,filter;transition-property:opacity,filter,-webkit-filter;transition-duration:.15s;transition-timing-function:linear;font:inherit;color:inherit;text-transform:none;background-color:transparent;border:0;margin:0;overflow:visible}.HamburgerIcons-module_hamburger__NnCze.HamburgerIcons-module_is-active__10qoY .HamburgerIcons-module_hamburger-inner__187lg,.HamburgerIcons-module_hamburger__NnCze.HamburgerIcons-module_is-active__10qoY .HamburgerIcons-module_hamburger-inner__187lg:after,.HamburgerIcons-module_hamburger__NnCze.HamburgerIcons-module_is-active__10qoY .HamburgerIcons-module_hamburger-inner__187lg:before{background-color:#e10028}.HamburgerIcons-module_hamburger-box__34rgF{width:40px;height:24px;display:inline-block;position:relative}.HamburgerIcons-module_hamburger-inner__187lg{display:block;top:50%;margin-top:-2px}.HamburgerIcons-module_hamburger-inner__187lg,.HamburgerIcons-module_hamburger-inner__187lg:after,.HamburgerIcons-module_hamburger-inner__187lg:before{width:30px;height:4px;background-color:#00375a;border-radius:4px;position:absolute;transition-property:transform;transition-duration:.15s;transition-timing-function:ease}.HamburgerIcons-module_hamburger-inner__187lg:after,.HamburgerIcons-module_hamburger-inner__187lg:before{content:"";display:block}.HamburgerIcons-module_hamburger-inner__187lg:before{top:-10px}.HamburgerIcons-module_hamburger-inner__187lg:after{bottom:-10px}.HamburgerIcons-module_hamburger--collapse__gRQFa .HamburgerIcons-module_hamburger-inner__187lg{top:auto;bottom:0;transition-duration:.13s;transition-delay:.13s;transition-timing-function:cubic-bezier(.55,.055,.675,.19)}.HamburgerIcons-module_hamburger--collapse__gRQFa .HamburgerIcons-module_hamburger-inner__187lg:after{top:-20px;transition:top .2s cubic-bezier(.33333,.66667,.66667,1) .2s,opacity .1s linear}.HamburgerIcons-module_hamburger--collapse__gRQFa .HamburgerIcons-module_hamburger-inner__187lg:before{transition:top .12s cubic-bezier(.33333,.66667,.66667,1) .2s,transform .13s cubic-bezier(.55,.055,.675,.19)}.HamburgerIcons-module_hamburger--collapse__gRQFa.HamburgerIcons-module_is-active__10qoY .HamburgerIcons-module_hamburger-inner__187lg{transform:translate3d(0,-10px,0) rotate(-45deg);transition-delay:.22s;transition-timing-function:cubic-bezier(.215,.61,.355,1)}.HamburgerIcons-module_hamburger--collapse__gRQFa.HamburgerIcons-module_is-active__10qoY .HamburgerIcons-module_hamburger-inner__187lg:after{top:0;opacity:0;transition:top .2s cubic-bezier(.33333,0,.66667,.33333),opacity .1s linear .22s}.HamburgerIcons-module_hamburger--collapse__gRQFa.HamburgerIcons-module_is-active__10qoY .HamburgerIcons-module_hamburger-inner__187lg:before{top:0;transform:rotate(-90deg);transition:top .1s cubic-bezier(.33333,0,.66667,.33333) .16s,transform .13s cubic-bezier(.215,.61,.355,1) .25s}.ChapterLink-module_chapterLink__v5VRl{line-height:3rem;color:#00375a;text-decoration:none;position:relative;display:block;font-family:inherit;font-weight:700;font-size:1rem;height:50px}.ChapterLink-module_chapterLink__v5VRl:hover,.ChapterLink-module_chapterLinkActive__jl4h5{color:#e10028}.ChapterLink-module_summary__17aoW{display:none}@media (max-width:780px){.ChapterLink-module_summary__17aoW{display:block}}.ChapterLinkTooltip-module_chapterLinkTooltip__cCfsw{border-bottom:3px solid #e10028;width:200px}.ChapterLinkTooltip-module_tooltipHeadline__reew_{margin:5px 0 0;color:#e10028}@media (max-width:780px){.ChapterLinkTooltip-module_chapterLinkTooltip__cCfsw{display:none!important}}.LegalInfoMenu-module_infoIcon__1kTnt svg{width:26px;height:26px;margin:12px 0}.LegalInfoTooltip-module_legalInfoTooltip__ChzOS{width:200px;max-width:200px;text-align:left}.LegalInfoTooltip-module_legalInfoTooltip__ChzOS:after{left:90%!important}.LegalInfoTooltip-module_legalInfoTooltip__ChzOS p{margin:0 0 .5em}.LegalInfoTooltip-module_legalInfoTooltip__ChzOS a{color:#e10028}.SharingMenu-module_shareIcon__1AlDL svg{width:40px;height:40px;margin:5px 0}header .share svg{fill:#00375a}header .share:hover svg{fill:#e10028}.SharingTooltip-module_sharingTooltip__1cljv{width:160px;padding:0!important}.SharingTooltip-module_sharingTooltip__1cljv:after{left:90%!important}.SharingTooltip-module_shareLinkContainer__2MnKN{display:inline-block;width:80px;height:60px;cursor:pointer;color:transparent;text-align:center}.SharingTooltip-module_shareLink__2ySSX{position:relative;color:#00375a;text-decoration:none}.SharingTooltip-module_shareLink__2ySSX:hover{color:#e10028}.SharingTooltip-module_shareIcon__3igrs{width:80px;height:25px;margin-top:5px;margin-bottom:3px}.video-js{display:block;vertical-align:top;box-sizing:border-box;color:#fff;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}body.vjs-full-window{padding:0;margin:0;height:100%;overflow-y:auto}.vjs-full-window .video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen{width:100%!important;height:100%!important;padding-top:0!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1;visibility:visible}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.vjs-poster{display:inline-block;background-repeat:no-repeat;background-position:50% 50%;background-size:contain;background-color:#000;cursor:pointer;margin:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-poster,.vjs-poster img{vertical-align:middle;padding:0}.vjs-poster img{display:block;margin:0 auto;max-height:100%;width:100%}.vjs-has-started .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster{display:block}.vjs-using-native-controls .vjs-poster{display:none}.vjs-text-track-display{position:absolute;bottom:0;left:0;right:0;top:0;pointer-events:none}.video-js .vjs-text-track{font-size:17px;text-align:center;margin-bottom:.1em;background-color:#000;background-color:rgba(0,0,0,.5)}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.video-js{font-family:inherit!important}.textTracks-module_inset__K7DIL .vjs-text-track-display{bottom:20px}.vjs-text-track-display div{font-family:inherit!important;font-size:20px!important}.vjs-text-track-display>div>div>div{padding:0 4px 2px}.vjs-paused .vjs-text-track-display div{transition:opacity .2s,visibility .2s;opacity:0;visibility:hidden!important}.MediaPlayer-module_mask__3JQDW{position:absolute;top:0;left:0;width:100%;height:100%}.ViewportDependentPillarBoxes-module_opaque__2U9JL{background-color:#000}.ViewportDependentPillarBoxes-module_container__Pj-Fy{position:relative;width:100%;margin:0 auto}.ViewportDependentPillarBoxes-module_content__1IY7b{position:absolute;top:0;left:0;right:0;bottom:0}.Fullscreen-module_root__1N3CI{width:100%;height:100vh;position:relative;overflow:hidden}.AudioPlayer-module_audioPlayer__1Ms73{width:100%;height:100%;transition:transform .2s ease}.AudioPlayer-module_spaceForTextTracks__169MK{height:100%}.AudioPlayer-module_spaceForTextTracksActive__99m7R{height:90px}.AudioPlayer-module_audioPlayer__1Ms73>div{width:100%;height:100%}.AudioPlayer-module_audioPlayer__1Ms73 audio,.AudioPlayer-module_audioPlayer__1Ms73 audio:focus{outline:none}.Image-module_root__1ef3j{background-size:cover;position:absolute;top:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.VideoPlayer-module_videoPlayer__2q9NS{width:100%;height:100%;transition:transform .2s ease}.VideoPlayer-module_videoPlayer__2q9NS>div{width:100%;height:100%}.VideoPlayer-module_videoPlayer__2q9NS video,.VideoPlayer-module_videoPlayer__2q9NS video:focus{outline:none}.VideoPlayer-module_cover__2Rk-J video{-o-object-fit:cover;object-fit:cover}.FillColor-module_FillColor__S1uEG{width:100%}.MotifArea-module_root__1_ACd{position:absolute;background:hsla(0,0%,100%,.2);z-index:2;opacity:0;transition:opacity .2s ease}.MotifArea-module_active__1q4z2{opacity:1}.MotifArea-module_corner__3hB5t{position:absolute;width:10px;height:10px}.MotifArea-module_topLeft__3vHHi{border-top:2px solid #fff;border-left:2px solid #fff}.MotifArea-module_topRight__2gNmC{right:0;border-top:2px solid #fff;border-right:2px solid #fff}.MotifArea-module_bottomLeft__2qEqb{bottom:0;border-bottom:2px solid #fff;border-left:2px solid #fff}.MotifArea-module_bottomRight__3OjTb{right:0;bottom:0;border-bottom:2px solid #fff;border-right:2px solid #fff}.Backdrop-module_Backdrop__1w4UZ{width:100%;z-index:2}.Section-module_Section__Yo58b{position:relative;background-color:#000}.Section-module_invert__3_p7F{background-color:#fff;color:#222}.fadeInBgConceal-module_backdrop__11JGO{position:absolute;height:100%}.fadeInBgConceal-module_backdropInner__1IAYD{position:fixed;top:0;height:100vh;width:100%}.fadeInBgConceal-module_backdrop__11JGO{transition:opacity .5s ease,visibility .5s}.fadeInBgConceal-module_backdrop-below__3E6Uk{opacity:0;visibility:hidden}.fadeInBgFadeOut-module_backdrop__r0YXp{position:absolute;height:100%}.fadeInBgFadeOut-module_backdropInner__IQp87{position:fixed;top:0;height:100vh;width:100%}.fadeInBgFadeOut-module_backdrop__r0YXp .fadeInBgFadeOut-module_backdropInner__IQp87,.fadeInBgFadeOut-module_foreground__Q2vkT{transition:opacity .5s ease,visibility .5s}.fadeInBgFadeOut-module_backdrop-below__2G-Ic .fadeInBgFadeOut-module_backdropInner__IQp87,.fadeInBgFadeOut-module_foreground-above__3pmz9{opacity:0;visibility:hidden}.fadeInBgFadeOutBg-module_backdrop__15ocl{position:absolute;height:100%}.fadeInBgFadeOutBg-module_backdropInner__sAnz6{position:fixed;top:0;height:100vh;width:100%}.fadeInBgFadeOutBg-module_backdrop__15ocl .fadeInBgFadeOutBg-module_backdropInner__sAnz6,.fadeInBgFadeOutBg-module_boxShadow__xUKyj{transition:opacity .5s ease,visibility .5s}.fadeInBgFadeOutBg-module_backdrop-below__1rDT6 .fadeInBgFadeOutBg-module_backdropInner__sAnz6,.fadeInBgFadeOutBg-module_boxShadow-above__2bY0E{opacity:0;visibility:hidden}.fadeInBgScrollOut-module_backdrop__1bSsb{position:absolute;top:0;bottom:0;display:flex;flex-direction:column;justify-content:flex-end}.fadeInBgScrollOut-module_backdropInner__3JZBG{position:-webkit-sticky;position:sticky;bottom:0;width:100%}.fadeInBgScrollOut-module_backdropInner2__q-00L{position:absolute;bottom:0;width:100%}.fadeInBgScrollOut-module_foreground__1ODH9{min-height:100vh}.fadeInBgScrollOut-module_backdrop__1bSsb{transition:opacity .5s ease,visibility .5s}.fadeInBgScrollOut-module_backdrop-below__2Dbkr{opacity:0;visibility:hidden}.fadeInConceal-module_backdrop__1zaRO{position:absolute;height:100%}.fadeInConceal-module_backdropInner__1AIvq{position:fixed;top:0;height:100vh;width:100%}.fadeInConceal-module_backdrop__1zaRO,.fadeInConceal-module_foreground__3giM9{transition:opacity .5s ease,visibility .5s}.fadeInConceal-module_backdrop-below__AWyQe,.fadeInConceal-module_foreground-below__2z5Op{opacity:0;visibility:hidden}.fadeInFadeOut-module_backdrop__Y4xOA{position:absolute;height:100%}.fadeInFadeOut-module_backdropInner__1oRfP{position:fixed;top:0;height:100vh;width:100%}.fadeInFadeOut-module_backdrop__Y4xOA .fadeInFadeOut-module_backdropInner__1oRfP,.fadeInFadeOut-module_foreground__1eleZ{transition:opacity .5s ease,visibility .5s}.fadeInFadeOut-module_backdrop-below__1h2I4 .fadeInFadeOut-module_backdropInner__1oRfP,.fadeInFadeOut-module_foreground-above__249wa,.fadeInFadeOut-module_foreground-below__3mE6f{opacity:0;visibility:hidden}.fadeInFadeOutBg-module_backdrop__2-IF3{position:absolute;height:100%}.fadeInFadeOutBg-module_backdropInner__3r_bo{position:fixed;top:0;height:100vh;width:100%}.fadeInFadeOutBg-module_backdrop__2-IF3 .fadeInFadeOutBg-module_backdropInner__3r_bo,.fadeInFadeOutBg-module_boxShadow__3x7Ki,.fadeInFadeOutBg-module_foreground__24f_M{transition:opacity .5s ease,visibility .5s}.fadeInFadeOutBg-module_backdrop-below__4Ys_2 .fadeInFadeOutBg-module_backdropInner__3r_bo,.fadeInFadeOutBg-module_boxShadow-above__3T2K5,.fadeInFadeOutBg-module_foreground-below__3pTRc{opacity:0;visibility:hidden}.fadeInScrollOut-module_backdrop__2FhBb{position:absolute;top:0;bottom:0;display:flex;flex-direction:column;justify-content:flex-end}.fadeInScrollOut-module_backdropInner__1OfNZ{position:-webkit-sticky;position:sticky;bottom:0;width:100%}.fadeInScrollOut-module_backdropInner2__5bNPT{position:absolute;bottom:0;width:100%}.fadeInScrollOut-module_foreground__3h0EX{min-height:100vh}.fadeInScrollOut-module_backdrop__2FhBb,.fadeInScrollOut-module_foreground__3h0EX{transition:opacity .5s ease,visibility .5s}.fadeInScrollOut-module_backdrop-below__3cRLH,.fadeInScrollOut-module_foreground-below__1Jcql{opacity:0;visibility:hidden}.revealConceal-module_backdrop__dLUhU{position:absolute;height:100%}.revealConceal-module_backdropInner__2k1Z-{position:fixed;top:0;height:100vh;width:100%;transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.revealFadeOut-module_backdrop___Q1QF{position:absolute;height:calc(100% + 100vh)}.revealFadeOut-module_backdropInner__17qRn{position:fixed;top:0;height:100vh;width:100%;transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.revealFadeOut-module_foreground__1GzBs{transition:opacity .5s ease,visibility .5s}.revealFadeOut-module_foreground-above__3GxOf{opacity:0;visibility:hidden}.revealFadeOutBg-module_backdrop__30OCF{position:absolute;height:calc(100% + 100vh)}.revealFadeOutBg-module_backdropInner__3v3tM{position:fixed;top:0;height:100vh;width:100%;transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.revealFadeOutBg-module_boxShadow__1NZRz{transition:opacity 1s ease,visibility 1s}.revealFadeOutBg-module_boxShadow-above__2r4ov{opacity:0;visibility:hidden}.revealScrollOut-module_backdrop__2yOXd{position:absolute;top:0;bottom:0;display:flex;flex-direction:column;justify-content:flex-end}.revealScrollOut-module_backdropInner__211p3{position:-webkit-sticky;position:sticky;bottom:0;width:100%;transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.revealScrollOut-module_backdropInner2__v6WqM{position:absolute;bottom:0;width:100%}.scrollInConceal-module_backdrop__2OJJC,.scrollInFadeOut-module_backdrop__1vXJd{position:-webkit-sticky;position:sticky;top:0;height:0}.scrollInFadeOut-module_foreground__3Ikxb{transition:opacity .5s ease,visibility .5s}.scrollInFadeOut-module_foreground-above__6ipm-{opacity:0;visibility:hidden}.scrollInFadeOutBg-module_backdrop__zw95c{position:-webkit-sticky;position:sticky;top:0;height:0}.scrollInFadeOutBg-module_boxShadow__3UxCQ{transition:opacity .5s ease,visibility .5s}.scrollInFadeOutBg-module_boxShadow-above__3kfau{opacity:0;visibility:hidden}.scrollInScrollOut-module_backdrop__XzCge{position:-webkit-sticky;position:sticky;top:0;height:100vh}.scrollInScrollOut-module_foreground__1yyY8{margin-top:-100vh}.GradientShadow-module_shadow__2UiDH{position:absolute;top:0;left:0;width:100%;z-index:1;transition:opacity 1s ease}.GradientShadow-module_align-left__3qcNM .GradientShadow-module_shadowBlack__cSr14,.GradientShadow-module_align-right__3iXZs .GradientShadow-module_shadowBlack__cSr14{background:linear-gradient(90deg,#000 0,transparent)}@media (min-width:950px){.GradientShadow-module_align-right__3iXZs .GradientShadow-module_shadowBlack__cSr14{background:linear-gradient(270deg,#000 0,transparent)}}.GradientShadow-module_align-center__2C7cl .GradientShadow-module_shadowBlack__cSr14,.GradientShadow-module_intersecting__h6vpz .GradientShadow-module_shadowBlack__cSr14{background:#000}.GradientShadow-module_align-left__3qcNM .GradientShadow-module_shadowWhite__3Xw2q,.GradientShadow-module_align-right__3iXZs .GradientShadow-module_shadowWhite__3Xw2q{background:linear-gradient(90deg,#fff 0,hsla(0,0%,100%,0))}@media (min-width:950px){.GradientShadow-module_align-right__3iXZs .GradientShadow-module_shadowWhite__3Xw2q{background:linear-gradient(270deg,#fff 0,hsla(0,0%,100%,0))}}.GradientShadow-module_align-center__2C7cl .GradientShadow-module_shadowWhite__3Xw2q,.GradientShadow-module_intersecting__h6vpz .GradientShadow-module_shadowWhite__3Xw2q{background:#fff}.InvisibleBoxWrapper-module_start__F1nZ7{margin-top:1.375em}.InvisibleBoxWrapper-module_end__nphD-{margin-bottom:1.375em}.GradientBox-module_content__96lDk{position:relative}.GradientBox-module_shadow__2XilX{position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none}.GradientBox-module_long__10s6v .GradientBox-module_shadow__2XilX{bottom:-100vh}.GradientBox-module_gradient__31tJ- .GradientBox-module_withShadow__3mhPR{text-shadow:0 1px 5px #000}.GradientBox-module_gradient__31tJ- .GradientBox-module_shadowDark__3Tv0L{background:linear-gradient(180deg,transparent 0,rgba(0,0,0,.3) 100px,rgba(0,0,0,.3))}.GradientBox-module_gradient__31tJ- .GradientBox-module_shadowLight__Bieg6{background:linear-gradient(180deg,hsla(0,0%,100%,0) 0,hsla(0,0%,100%,.3) 100px,hsla(0,0%,100%,.3))}.CardBox-module_content__36v7J{position:relative}.CardBoxWrapper-module_card__hvRUa{position:relative;margin-top:-1px;padding:1px 1.5em 0}.CardBoxWrapper-module_card__hvRUa:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1}.CardBoxWrapper-module_cardStart__2NywG{margin-top:3em}.CardBoxWrapper-module_cardEnd__x4Ye6{margin-bottom:3em;padding-bottom:1.5em}.CardBoxWrapper-module_cardStart__2NywG:before{border-top-left-radius:15px;border-top-right-radius:15px}.CardBoxWrapper-module_cardEnd__x4Ye6:before{border-bottom-left-radius:15px;border-bottom-right-radius:15px}.CardBoxWrapper-module_cardBgWhite__xXhg7:before{background-color:#fff}.CardBoxWrapper-module_cardBgBlack__Ahp3s:before{background-color:#101010}.CardBoxWrapper-module_cardBgWhite__xXhg7{color:#000}.CardBoxWrapper-module_cardBgBlack__Ahp3s{color:#fff}.Entry-module_Entry__1nDGh{font-family:Source Sans Pro,sans-serif;background-color:#000;color:#fff}.Entry-module_Entry__1nDGh>div:first-child{padding-top:58px}body{margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[tabindex]:focus,a:focus,button:focus{outline:3px solid #518ad2}.focusOutline-module_focusOutlineDisabled__KV7d- [tabindex]:focus,.focusOutline-module_focusOutlineDisabled__KV7d- a:focus,.focusOutline-module_focusOutlineDisabled__KV7d- button:focus{outline:none}.Figure-module_root__3FC-x{margin:0}.Figure-module_root__3FC-x>figcaption{padding:3px 10px 5px;background-color:#fff;color:#222}.Figure-module_invert___0BJP>figcaption{background-color:#101010;color:#fff}.Waveform-module_container__1Dxdv{position:relative;width:100%;height:90px;bottom:1px}.Waveform-module_menus__1mOnJ{position:absolute;bottom:-5px;right:0;z-index:5}.Waveform-module_timeDisplay__1v4Tl{position:relative;bottom:20px}.Waveform-module_playControl__QWTsJ{z-index:5;position:absolute;top:32.5%;transform:scale(2)}.Waveform-module_waveWrapper__3gamc{position:relative;pointer-events:all;height:100%}.TimeDisplay-module_timeDisplay__2UwqM{margin:0 7px}.TimeDisplay-module_time__li1ZU{line-height:24px;font-size:15px;padding:0 4px;color:currentColor}.MenuBarButton-module_icon__2h8__{width:25px;height:25px;fill:currentColor}.MenuBarButton-module_subMenuItemAnnotation__32Quc{color:red;font-size:70%;vertical-align:5px;padding-left:3px}.MenuBarButton-module_subMenu__f-E-X{visibility:hidden;opacity:0;pointer-events:none;transition:opacity .5s,visibility .5s;position:absolute;right:0;bottom:31px;margin:0;padding:5px;background-color:rgba(17,17,17,.9);border-radius:2px}.MenuBarButton-module_subMenuExpanded__2UvkJ .MenuBarButton-module_subMenu__f-E-X{visibility:visible;opacity:1;pointer-events:all;transition:none}.MenuBarButton-module_subMenuItem__1pyn_{position:relative;list-style:none}.MenuBarButton-module_subMenuItemIcon__3iaB-{position:absolute;top:8px;left:5px;width:12px;height:12px;fill:#fff}.MenuBarButton-module_subMenuItemButton__2QnUz{width:100%;color:#fff;white-space:nowrap}button.MenuBarButton-module_subMenuItemButton__2QnUz{padding:5px 10px 5px 25px}.utils-module_clip__34eot{clip:rect(0,auto,auto,0);-webkit-clip-path:polygon(0 0,100% 0,100% 100%,0 100%);clip-path:polygon(0 0,100% 0,100% 100%,0 100%)}.utils-module_unstyledButton__3rgne{border:0;padding:0;background-color:transparent;text-align:initial}.ControlBar-module_transparent__eS4af{opacity:0}.ControlBar-module_lightBackground__3-tGf{background:hsla(0,0%,100%,.2)}.ControlBar-module_darkBackground__31Wv7{background:rgba(0,0,0,.2)}.ControlBar-module_controlBarContainer__1cxRO{color:currentColor;width:100%;display:flex;align-items:center;position:relative;transition:opacity .2s ease}.ControlBar-module_controlBarContainer__1cxRO.ControlBar-module_inset__JvBh9{margin-top:-32px;color:#fff;background:linear-gradient(0deg,rgba(0,0,0,.8),transparent)}.ControlBar-module_button___4aXE{width:32px;height:32px;margin-right:4px;display:flex;align-items:center;justify-content:center;color:currentColor}.ControlBar-module_button___4aXE svg{fill:currentColor;cursor:pointer}.ProgressIndicators-module_container__1QiQJ{flex-grow:1}.ProgressIndicators-module_wrapper__2PCVv{margin:0 10px;position:relative}.ProgressIndicators-module_draggable__1iAE8{height:32px;padding:13px 0;box-sizing:border-box;cursor:pointer}.ProgressIndicators-module_bars__2-ddd{position:relative;height:6px;border-radius:3.5px}.ProgressIndicators-module_progressBar__2PYn-{position:absolute;left:0;height:6px;border-radius:2.5px;background:currentColor}.ProgressIndicators-module_background__-x5f_{opacity:.1;width:100%}.ProgressIndicators-module_loadingProgressBar__YD2GH{opacity:.1}.ProgressIndicators-module_sliderHandle__3ArIf{width:14px;height:14px;margin-left:-6.5px;border-radius:6.5px;position:absolute;top:-4px;background:currentColor;opacity:0;transition:opacity .1s}.ProgressIndicators-module_container__1QiQJ:hover .ProgressIndicators-module_sliderHandle__3ArIf,.ProgressIndicators-module_dragging__3yY3t .ProgressIndicators-module_sliderHandle__3ArIf{opacity:1}.SectionThumbnail-module_crop__Q1nZj{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden}.SectionThumbnail-module_scale__2tKDG{transform:scale(.2);transform-origin:0 0;width:500%}
@@ -0,0 +1,4425 @@
1
+ import 'core-js/modules/es.symbol';
2
+ import 'core-js/modules/es.symbol.description';
3
+ import 'core-js/modules/es.symbol.async-iterator';
4
+ import 'core-js/modules/es.symbol.has-instance';
5
+ import 'core-js/modules/es.symbol.is-concat-spreadable';
6
+ import 'core-js/modules/es.symbol.iterator';
7
+ import 'core-js/modules/es.symbol.match';
8
+ import 'core-js/modules/es.symbol.replace';
9
+ import 'core-js/modules/es.symbol.search';
10
+ import 'core-js/modules/es.symbol.species';
11
+ import 'core-js/modules/es.symbol.split';
12
+ import 'core-js/modules/es.symbol.to-primitive';
13
+ import 'core-js/modules/es.symbol.to-string-tag';
14
+ import 'core-js/modules/es.symbol.unscopables';
15
+ import 'core-js/modules/es.array.concat';
16
+ import 'core-js/modules/es.array.fill';
17
+ import 'core-js/modules/es.json.to-string-tag';
18
+ import 'core-js/modules/es.map';
19
+ import 'core-js/modules/es.math.to-string-tag';
20
+ import 'core-js/modules/es.object.assign';
21
+ import 'core-js/modules/es.object.to-string';
22
+ import 'core-js/modules/es.promise';
23
+ import 'core-js/modules/es.promise.finally';
24
+ import 'core-js/modules/es.set';
25
+ import 'core-js/modules/es.string.iterator';
26
+ import 'core-js/modules/es.string.starts-with';
27
+ import 'core-js/modules/esnext.aggregate-error';
28
+ import 'core-js/modules/esnext.map.delete-all';
29
+ import 'core-js/modules/esnext.map.every';
30
+ import 'core-js/modules/esnext.map.filter';
31
+ import 'core-js/modules/esnext.map.find';
32
+ import 'core-js/modules/esnext.map.find-key';
33
+ import 'core-js/modules/esnext.map.from';
34
+ import 'core-js/modules/esnext.map.group-by';
35
+ import 'core-js/modules/esnext.map.includes';
36
+ import 'core-js/modules/esnext.map.key-by';
37
+ import 'core-js/modules/esnext.map.key-of';
38
+ import 'core-js/modules/esnext.map.map-keys';
39
+ import 'core-js/modules/esnext.map.map-values';
40
+ import 'core-js/modules/esnext.map.merge';
41
+ import 'core-js/modules/esnext.map.of';
42
+ import 'core-js/modules/esnext.map.reduce';
43
+ import 'core-js/modules/esnext.map.some';
44
+ import 'core-js/modules/esnext.map.update';
45
+ import 'core-js/modules/esnext.promise.all-settled';
46
+ import 'core-js/modules/esnext.promise.any';
47
+ import 'core-js/modules/esnext.promise.try';
48
+ import 'core-js/modules/esnext.set.add-all';
49
+ import 'core-js/modules/esnext.set.delete-all';
50
+ import 'core-js/modules/esnext.set.difference';
51
+ import 'core-js/modules/esnext.set.every';
52
+ import 'core-js/modules/esnext.set.filter';
53
+ import 'core-js/modules/esnext.set.find';
54
+ import 'core-js/modules/esnext.set.from';
55
+ import 'core-js/modules/esnext.set.intersection';
56
+ import 'core-js/modules/esnext.set.is-disjoint-from';
57
+ import 'core-js/modules/esnext.set.is-subset-of';
58
+ import 'core-js/modules/esnext.set.is-superset-of';
59
+ import 'core-js/modules/esnext.set.join';
60
+ import 'core-js/modules/esnext.set.map';
61
+ import 'core-js/modules/esnext.set.of';
62
+ import 'core-js/modules/esnext.set.reduce';
63
+ import 'core-js/modules/esnext.set.some';
64
+ import 'core-js/modules/esnext.set.symmetric-difference';
65
+ import 'core-js/modules/esnext.set.union';
66
+ import 'core-js/modules/esnext.symbol.dispose';
67
+ import 'core-js/modules/esnext.symbol.observable';
68
+ import 'core-js/modules/esnext.symbol.pattern-match';
69
+ import 'core-js/modules/web.dom-collections.iterator';
70
+ import 'intersection-observer';
71
+ import 'regenerator-runtime/runtime.js';
72
+ import React, { useLayoutEffect, useEffect, useRef, useState, createContext, useMemo, useContext, useReducer, useCallback, Suspense } from 'react';
73
+ import ReactDOM from 'react-dom';
74
+ import { _ as _defineProperty, u as useI18n, a as _objectWithoutProperties, b as useFileRights, c as useLegalInfo, d as useCredits, P as PhonePlatformContext, e as useShareUrl, f as useShareProviders, g as useTheme, h as _slicedToArray, i as useEntryStructure, j as createScrollPositionLifecycleProvider, k as createScrollPositionLifecycleHook, l as _objectSpread2, m as useEntryMetadata, n as useNestedFiles, o as useFile, p as useMediaQuery, w as withInlineEditingDecorator, F as Foreground, L as Layout, q as usePostMessageListener, r as withInlineEditingAlternative, E as EntryStateProvider, s as LocaleProvider, T as Text, t as _toConsumableArray, v as useAvailableQualities, x as useEntryStateDispatch, y as useSectionStructure, S as StaticPreview, z as setupI18n, A as loadInlineEditingComponents } from './EditableText-4264c349.js';
75
+ export { I as EditableText, s as LocaleProvider, T as Text, B as frontend, z as setupI18n, C as useContentElementConfigurationUpdate, D as useContentElementEditorCommandSubscription, G as useContentElementEditorState, H as useContentElementLifecycle, o as useFile, u as useI18n, K as useLocale, J as useOnScreen } from './EditableText-4264c349.js';
76
+ import classNames from 'classnames';
77
+ import ReactTooltip from 'react-tooltip';
78
+ import 'i18n-js';
79
+ import { events, browser, documentHiddenState, PlayerSourceIDMap, media, MultiPlayer, settings } from 'pageflow/frontend';
80
+ import { _ as _createClass, a as _classCallCheck } from './getPrototypeOf-63c7c8e8.js';
81
+ import BackboneEvents from 'backbone-events-standalone';
82
+ import Measure from 'react-measure';
83
+ import { DraggableCore } from 'react-draggable';
84
+
85
+ // This prevents `fetch()` from being imported in a Node test environment
86
+
87
+ if (typeof window !== 'undefined') {
88
+ require('whatwg-fetch');
89
+ }
90
+
91
+ var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
92
+
93
+ // from https://github.com/n8tb1t/use-scroll-position
94
+ var isBrowser = typeof window !== "undefined";
95
+
96
+ function getScrollPosition(_ref) {
97
+ var element = _ref.element,
98
+ useWindow = _ref.useWindow;
99
+ if (!isBrowser) return {
100
+ x: 0,
101
+ y: 0
102
+ };
103
+ var target = element ? element.current : document.body;
104
+ var position = target.getBoundingClientRect();
105
+ return useWindow ? {
106
+ x: window.scrollX,
107
+ y: window.scrollY
108
+ } : {
109
+ x: position.left,
110
+ y: position.top
111
+ };
112
+ }
113
+
114
+ function useScrollPosition(effect, deps, element, useWindow, wait) {
115
+ var position = useRef(getScrollPosition({
116
+ useWindow: useWindow
117
+ }));
118
+ var throttleTimeout = null;
119
+
120
+ var callBack = function callBack() {
121
+ var currPos = getScrollPosition({
122
+ element: element,
123
+ useWindow: useWindow
124
+ });
125
+ effect({
126
+ prevPos: position.current,
127
+ currPos: currPos
128
+ });
129
+ position.current = currPos;
130
+ throttleTimeout = null;
131
+ };
132
+
133
+ useIsomorphicLayoutEffect(function () {
134
+ if (!isBrowser) {
135
+ return;
136
+ }
137
+
138
+ var handleScroll = function handleScroll() {
139
+ if (wait) {
140
+ if (throttleTimeout === null) {
141
+ // Todo: store in useRef hook?
142
+ throttleTimeout = setTimeout(callBack, wait);
143
+ }
144
+ } else {
145
+ callBack();
146
+ }
147
+ };
148
+
149
+ window.addEventListener('scroll', handleScroll);
150
+ return function () {
151
+ return window.removeEventListener('scroll', handleScroll);
152
+ };
153
+ }, deps);
154
+ }
155
+ useScrollPosition.defaultProps = {
156
+ deps: [],
157
+ element: false,
158
+ useWindow: false,
159
+ wait: null
160
+ };
161
+
162
+ function useNativeScrollPrevention(ref) {
163
+ useEffect(function () {
164
+ function preventNativeScroll(e) {
165
+ e.preventDefault();
166
+ }
167
+
168
+ var current = ref.current;
169
+
170
+ if (current) {
171
+ current.addEventListener('touchmove', preventNativeScroll);
172
+ current.addEventListener('mousewheel', preventNativeScroll);
173
+ }
174
+
175
+ return function () {
176
+ if (current) {
177
+ current.removeEventListener('touchmove', preventNativeScroll);
178
+ current.removeEventListener('mousewheel', preventNativeScroll);
179
+ }
180
+ };
181
+ }, [ref]);
182
+ }
183
+
184
+ var styles = {"navigationBar":"AppHeader-module_navigationBar__2EFHw","navigationBarExpanded":"AppHeader-module_navigationBarExpanded__18nbf","navigationBarContentWrapper":"AppHeader-module_navigationBarContentWrapper__2Sf8y","menuIcon":"AppHeader-module_menuIcon__5JKuj","contextIcons":"AppHeader-module_contextIcons__23I_3","contextIcon":"AppHeader-module_contextIcon__157kW","logo":"AppHeader-module_logo__2E1pn","chapterList":"AppHeader-module_chapterList__2lMMD","chapterListItem":"AppHeader-module_chapterListItem__28zrc","navigationTooltip":"AppHeader-module_navigationTooltip__1EvCy","progressBar":"AppHeader-module_progressBar__17IVu","progressIndicator":"AppHeader-module_progressIndicator__3SlYz","navigationChapters":"AppHeader-module_navigationChapters__1dzyV","navigationChaptersHidden":"AppHeader-module_navigationChaptersHidden__8AEPA"};
185
+
186
+ var styles$1 = {"burgerMenuIconContainer":"HamburgerIcon-module_burgerMenuIconContainer__26RY4","burgerMenuIcon":"HamburgerIcon-module_burgerMenuIcon__24t-5"};
187
+
188
+ var hamburgerIconStyles = {"hamburger":"HamburgerIcons-module_hamburger__NnCze","is-active":"HamburgerIcons-module_is-active__10qoY","hamburger-inner":"HamburgerIcons-module_hamburger-inner__187lg","hamburger-box":"HamburgerIcons-module_hamburger-box__34rgF","hamburger--collapse":"HamburgerIcons-module_hamburger--collapse__gRQFa"};
189
+
190
+ function HamburgerIcon(props) {
191
+ return (
192
+ /*#__PURE__*/
193
+ React.createElement("div", {
194
+ className: styles$1.burgerMenuIconContainer
195
+ },
196
+ /*#__PURE__*/
197
+ React.createElement("button", {
198
+ className: classNames(styles.menuIcon, styles$1.burgerMenuIcon, hamburgerIconStyles.hamburger, hamburgerIconStyles['hamburger--collapse'], _defineProperty({}, hamburgerIconStyles['is-active'], !props.mobileNavHidden)),
199
+ type: "button",
200
+ onClick: props.onClick
201
+ },
202
+ /*#__PURE__*/
203
+ React.createElement("span", {
204
+ className: hamburgerIconStyles['hamburger-box']
205
+ },
206
+ /*#__PURE__*/
207
+ React.createElement("span", {
208
+ className: hamburgerIconStyles['hamburger-inner']
209
+ }))))
210
+ );
211
+ }
212
+
213
+ var styles$2 = {"chapterLink":"ChapterLink-module_chapterLink__v5VRl","chapterLinkActive":"ChapterLink-module_chapterLinkActive__jl4h5","summary":"ChapterLink-module_summary__17aoW"};
214
+
215
+ var styles$3 = {"chapterLinkTooltip":"ChapterLinkTooltip-module_chapterLinkTooltip__cCfsw","tooltipHeadline":"ChapterLinkTooltip-module_tooltipHeadline__reew_"};
216
+
217
+ function ChapterLinkTooltip(props) {
218
+ var _useI18n = useI18n(),
219
+ t = _useI18n.t;
220
+
221
+ return (
222
+ /*#__PURE__*/
223
+ React.createElement(ReactTooltip, {
224
+ id: props.chapterLinkId,
225
+ type: "light",
226
+ place: "bottom",
227
+ effect: "solid",
228
+ className: classNames(styles.navigationTooltip, styles$3.chapterLinkTooltip)
229
+ },
230
+ /*#__PURE__*/
231
+ React.createElement("div", null,
232
+ /*#__PURE__*/
233
+ React.createElement("h3", {
234
+ className: styles$3.tooltipHeadline
235
+ }, t('pageflow_scrolled.public.navigation.chapter'), " ", props.chapterIndex),
236
+ /*#__PURE__*/
237
+ React.createElement("p", {
238
+ dangerouslySetInnerHTML: {
239
+ __html: props.summary
240
+ }
241
+ })))
242
+ );
243
+ }
244
+
245
+ function ChapterLink(props) {
246
+ return (
247
+ /*#__PURE__*/
248
+ React.createElement("div", null,
249
+ /*#__PURE__*/
250
+ React.createElement("a", {
251
+ className: classNames(styles$2.chapterLink, _defineProperty({}, styles$2.chapterLinkActive, props.active)),
252
+ href: "#chapter-".concat(props.permaId),
253
+ onClick: function onClick() {
254
+ return props.handleMenuClick(props.chapterLinkId);
255
+ },
256
+ "data-tip": true,
257
+ "data-for": props.chapterLinkId
258
+ }, props.title),
259
+ /*#__PURE__*/
260
+ React.createElement("p", {
261
+ className: styles$2.summary,
262
+ dangerouslySetInnerHTML: {
263
+ __html: props.summary
264
+ }
265
+ }),
266
+ /*#__PURE__*/
267
+ React.createElement(ChapterLinkTooltip, Object.assign({
268
+ chapterIndex: props.chapterIndex,
269
+ chapterLinkId: props.chapterLinkId
270
+ }, props)))
271
+ );
272
+ }
273
+
274
+ var styles$4 = {"infoIcon":"LegalInfoMenu-module_infoIcon__1kTnt"};
275
+
276
+ function _extends() {
277
+ _extends = Object.assign || function (target) {
278
+ for (var i = 1; i < arguments.length; i++) {
279
+ var source = arguments[i];
280
+
281
+ for (var key in source) {
282
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
283
+ target[key] = source[key];
284
+ }
285
+ }
286
+ }
287
+
288
+ return target;
289
+ };
290
+
291
+ return _extends.apply(this, arguments);
292
+ }
293
+ var InfoIcon = (function (_ref) {
294
+ var _ref$styles = _ref.styles,
295
+ props = _objectWithoutProperties(_ref, ["styles"]);
296
+
297
+ return React.createElement("svg", _extends({
298
+ xmlns: "http://www.w3.org/2000/svg",
299
+ viewBox: "0 0 330 330"
300
+ }, props), React.createElement("path", {
301
+ d: "M165 0C74.019 0 0 74.02 0 165.001 0 255.982 74.019 330 165 330s165-74.018 165-164.999S255.981 0 165 0zm0 300c-74.44 0-135-60.56-135-134.999S90.56 30 165 30s135 60.562 135 135.001C300 239.44 239.439 300 165 300z"
302
+ }), React.createElement("path", {
303
+ d: "M164.998 70c-11.026 0-19.996 8.976-19.996 20.009 0 11.023 8.97 19.991 19.996 19.991 11.026 0 19.996-8.968 19.996-19.991 0-11.033-8.97-20.009-19.996-20.009zm.002 70c-8.284 0-15 6.716-15 15v90c0 8.284 6.716 15 15 15 8.284 0 15-6.716 15-15v-90c0-8.284-6.716-15-15-15z"
304
+ }));
305
+ });
306
+
307
+ var styles$5 = {"legalInfoTooltip":"LegalInfoTooltip-module_legalInfoTooltip__ChzOS"};
308
+
309
+ function LegalInfoLink(props) {
310
+ return (
311
+ /*#__PURE__*/
312
+ React.createElement("div", null, props.label && props.url &&
313
+ /*#__PURE__*/
314
+ React.createElement("a", {
315
+ target: "_blank",
316
+ href: props.url,
317
+ dangerouslySetInnerHTML: {
318
+ __html: props.label
319
+ }
320
+ }))
321
+ );
322
+ }
323
+
324
+ function LegalInfoTooltip() {
325
+ var fileRights = useFileRights();
326
+ var legalInfo = useLegalInfo();
327
+ var credits = useCredits();
328
+ return (
329
+ /*#__PURE__*/
330
+ React.createElement(ReactTooltip, {
331
+ id: 'legalInfoTooltip',
332
+ type: 'light',
333
+ place: 'bottom',
334
+ effect: 'solid',
335
+ event: 'click',
336
+ globalEventOff: 'click',
337
+ clickable: true,
338
+ offset: {
339
+ right: -97
340
+ },
341
+ className: classNames(styles.navigationTooltip, styles$5.legalInfoTooltip)
342
+ },
343
+ /*#__PURE__*/
344
+ React.createElement("div", {
345
+ onMouseLeave: function onMouseLeave() {
346
+ ReactTooltip.hide();
347
+ }
348
+ }, credits &&
349
+ /*#__PURE__*/
350
+ React.createElement("p", {
351
+ dangerouslySetInnerHTML: {
352
+ __html: credits
353
+ }
354
+ }), fileRights &&
355
+ /*#__PURE__*/
356
+ React.createElement("p", null, fileRights),
357
+ /*#__PURE__*/
358
+ React.createElement(LegalInfoLink, legalInfo.imprint),
359
+ /*#__PURE__*/
360
+ React.createElement(LegalInfoLink, legalInfo.copyright),
361
+ /*#__PURE__*/
362
+ React.createElement(LegalInfoLink, legalInfo.privacy)))
363
+ );
364
+ }
365
+
366
+ function LegalInfoMenu(props) {
367
+ return (
368
+ /*#__PURE__*/
369
+ React.createElement("div", null,
370
+ /*#__PURE__*/
371
+ React.createElement("a", {
372
+ className: classNames(styles.contextIcon, styles$4.infoIcon),
373
+ "data-tip": true,
374
+ "data-for": 'legalInfoTooltip',
375
+ onMouseEnter: function onMouseEnter() {
376
+ ReactTooltip.hide();
377
+ }
378
+ },
379
+ /*#__PURE__*/
380
+ React.createElement(InfoIcon, null)),
381
+ /*#__PURE__*/
382
+ React.createElement(LegalInfoTooltip, null))
383
+ );
384
+ }
385
+
386
+ var styles$6 = {"shareIcon":"SharingMenu-module_shareIcon__1AlDL"};
387
+
388
+ function _extends$1() {
389
+ _extends$1 = Object.assign || function (target) {
390
+ for (var i = 1; i < arguments.length; i++) {
391
+ var source = arguments[i];
392
+
393
+ for (var key in source) {
394
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
395
+ target[key] = source[key];
396
+ }
397
+ }
398
+ }
399
+
400
+ return target;
401
+ };
402
+
403
+ return _extends$1.apply(this, arguments);
404
+ }
405
+ var ShareIcon = (function (_ref) {
406
+ var _ref$styles = _ref.styles,
407
+ props = _objectWithoutProperties(_ref, ["styles"]);
408
+
409
+ return React.createElement("svg", _extends$1({
410
+ xmlns: "http://www.w3.org/2000/svg",
411
+ viewBox: "0 0 96 96"
412
+ }, props), React.createElement("path", {
413
+ d: "M67.5 18c-5.1 0-9.3 4.2-9.3 9.3 0 .5.1 1.1.2 1.6l-23 12.9c-1.7-1.8-4.1-3-6.8-3-5.1 0-9.3 4.1-9.3 9.3 0 5.1 4.1 9.3 9.3 9.3 2.7 0 5.2-1.2 6.9-3.1l22.8 13.4c0 .4-.1.7-.1 1.1 0 5.1 4.1 9.3 9.3 9.3 5.1 0 9.3-4.1 9.3-9.3 0-5.1-4.1-9.3-9.3-9.3-2.8 0-5.4 1.3-7.1 3.3L37.7 49.4c.1-.4.1-.9.1-1.3 0-.5 0-1-.1-1.5l23.1-13c1.7 1.8 4.1 3 6.8 3 5.1 0 9.3-4.1 9.3-9.3-.1-5.1-4.3-9.3-9.4-9.3z"
414
+ }));
415
+ });
416
+
417
+ var styles$7 = {"sharingTooltip":"SharingTooltip-module_sharingTooltip__1cljv","shareLinkContainer":"SharingTooltip-module_shareLinkContainer__2MnKN","shareLink":"SharingTooltip-module_shareLink__2ySSX","shareIcon":"SharingTooltip-module_shareIcon__3igrs"};
418
+
419
+ function usePhonePlatform() {
420
+ return React.useContext(PhonePlatformContext);
421
+ }
422
+
423
+ function SharingTooltip() {
424
+ var isPhonePlatform = usePhonePlatform();
425
+ var shareUrl = useShareUrl();
426
+ var shareProviders = useShareProviders({
427
+ isPhonePlatform: isPhonePlatform
428
+ });
429
+
430
+ function renderShareLinks(shareProviders) {
431
+ return shareProviders.map(function (shareProvider) {
432
+ var Icon = shareProvider.icon;
433
+ return (
434
+ /*#__PURE__*/
435
+ React.createElement("div", {
436
+ key: shareProvider.name,
437
+ className: styles$7.shareLinkContainer
438
+ },
439
+ /*#__PURE__*/
440
+ React.createElement("a", {
441
+ className: classNames('share', styles$7.shareLink),
442
+ href: shareProvider.url.replace('%{url}', shareUrl),
443
+ target: '_blank'
444
+ },
445
+ /*#__PURE__*/
446
+ React.createElement(Icon, {
447
+ className: styles$7.shareIcon
448
+ }), shareProvider.name))
449
+ );
450
+ });
451
+ }
452
+ return (
453
+ /*#__PURE__*/
454
+ React.createElement(ReactTooltip, {
455
+ id: 'sharingTooltip',
456
+ type: 'light',
457
+ place: 'bottom',
458
+ effect: 'solid',
459
+ event: 'click',
460
+ globalEventOff: 'click',
461
+ clickable: true,
462
+ offset: {
463
+ right: -64
464
+ },
465
+ className: classNames(styles.navigationTooltip, styles$7.sharingTooltip)
466
+ },
467
+ /*#__PURE__*/
468
+ React.createElement("div", {
469
+ onMouseLeave: function onMouseLeave() {
470
+ ReactTooltip.hide();
471
+ }
472
+ }, renderShareLinks(shareProviders)))
473
+ );
474
+ }
475
+
476
+ function SharingMenu() {
477
+ var isPhonePlatform = usePhonePlatform();
478
+ var shareProviders = useShareProviders({
479
+ isPhonePlatform: isPhonePlatform
480
+ });
481
+
482
+ if (shareProviders.length > 0) {
483
+ return (
484
+ /*#__PURE__*/
485
+ React.createElement("div", null,
486
+ /*#__PURE__*/
487
+ React.createElement("a", {
488
+ className: classNames(styles.contextIcon, styles$6.shareIcon),
489
+ "data-tip": true,
490
+ "data-for": 'sharingTooltip',
491
+ onMouseEnter: function onMouseEnter() {
492
+ ReactTooltip.hide();
493
+ }
494
+ },
495
+ /*#__PURE__*/
496
+ React.createElement(ShareIcon, null)),
497
+ /*#__PURE__*/
498
+ React.createElement(SharingTooltip, null))
499
+ );
500
+ } else {
501
+ return null;
502
+ }
503
+ }
504
+
505
+ function Logo() {
506
+ var theme = useTheme();
507
+ return (
508
+ /*#__PURE__*/
509
+ React.createElement("picture", null,
510
+ /*#__PURE__*/
511
+ React.createElement("source", {
512
+ media: "(max-width: 780px)",
513
+ srcSet: theme.assets.logoMobile
514
+ }),
515
+ /*#__PURE__*/
516
+ React.createElement("source", {
517
+ media: "(min-width: 781px)",
518
+ srcSet: theme.assets.logoDesktop
519
+ }),
520
+ /*#__PURE__*/
521
+ React.createElement("img", {
522
+ src: theme.assets.logoDesktop,
523
+ alt: theme.options.logoAltText,
524
+ className: classNames(styles.menuIcon, styles.logo)
525
+ }))
526
+ );
527
+ }
528
+
529
+ function AppHeader(props) {
530
+ var _useState = useState(true),
531
+ _useState2 = _slicedToArray(_useState, 2),
532
+ navExpanded = _useState2[0],
533
+ setNavExpanded = _useState2[1];
534
+
535
+ var _useState3 = useState(true),
536
+ _useState4 = _slicedToArray(_useState3, 2),
537
+ mobileNavHidden = _useState4[0],
538
+ setMobileNavHidden = _useState4[1];
539
+
540
+ var _useState5 = useState(0),
541
+ _useState6 = _slicedToArray(_useState5, 2),
542
+ readingProgress = _useState6[0],
543
+ setReadingProgress = _useState6[1];
544
+
545
+ var _useState7 = useState('chapterLink1'),
546
+ _useState8 = _slicedToArray(_useState7, 2),
547
+ activeChapterLink = _useState8[0],
548
+ setActiveChapterLink = _useState8[1];
549
+
550
+ var entryStructure = useEntryStructure();
551
+ var ref = useRef();
552
+ useNativeScrollPrevention(ref);
553
+ var chapters = entryStructure.map(function (chapter) {
554
+ return {
555
+ permaId: chapter.permaId,
556
+ title: chapter.title,
557
+ summary: chapter.summary
558
+ };
559
+ });
560
+ useScrollPosition(function (_ref) {
561
+ var prevPos = _ref.prevPos,
562
+ currPos = _ref.currPos;
563
+ var expand = currPos.y > prevPos.y;
564
+ if (expand !== navExpanded) setNavExpanded(expand);
565
+ }, [navExpanded]);
566
+ useScrollPosition(function (_ref2) {
567
+ var prevPos = _ref2.prevPos,
568
+ currPos = _ref2.currPos;
569
+ var current = currPos.y * -1; // Todo: Memoize and update on window resize
570
+
571
+ var total = document.body.clientHeight - window.innerHeight;
572
+ var progress = Math.min(100, Math.abs(current / total) * 100);
573
+ setReadingProgress(progress);
574
+ }, [readingProgress], null, false, 1);
575
+
576
+ function handleProgressBarMouseEnter() {
577
+ setNavExpanded(true);
578
+ }
579
+
580
+ function handleBurgerMenuClick() {
581
+ setMobileNavHidden(!mobileNavHidden);
582
+ }
583
+
584
+ function handleMenuClick(chapterLinkId) {
585
+ setActiveChapterLink(chapterLinkId);
586
+ setMobileNavHidden(true);
587
+ }
588
+
589
+ function renderChapterLinks(chapters) {
590
+ return chapters.filter(function (chapterConfiguration) {
591
+ return chapterConfiguration.title && chapterConfiguration.summary;
592
+ }).map(function (chapter, index) {
593
+ var chapterIndex = index + 1;
594
+ var chapterLinkId = "chapterLink".concat(chapterIndex);
595
+ return (
596
+ /*#__PURE__*/
597
+ React.createElement("li", {
598
+ key: index,
599
+ className: styles.chapterListItem
600
+ },
601
+ /*#__PURE__*/
602
+ React.createElement(ChapterLink, Object.assign({}, chapter, {
603
+ chapterIndex: chapterIndex,
604
+ chapterLinkId: chapterLinkId,
605
+ active: activeChapterLink === chapterLinkId,
606
+ handleMenuClick: handleMenuClick
607
+ })))
608
+ );
609
+ });
610
+ }
611
+ return (
612
+ /*#__PURE__*/
613
+ React.createElement("header", {
614
+ className: classNames(styles.navigationBar, _defineProperty({}, styles.navigationBarExpanded, navExpanded))
615
+ },
616
+ /*#__PURE__*/
617
+ React.createElement("div", {
618
+ className: styles.navigationBarContentWrapper
619
+ },
620
+ /*#__PURE__*/
621
+ React.createElement(HamburgerIcon, {
622
+ onClick: handleBurgerMenuClick,
623
+ mobileNavHidden: mobileNavHidden
624
+ }),
625
+ /*#__PURE__*/
626
+ React.createElement(Logo, null),
627
+ /*#__PURE__*/
628
+ React.createElement("nav", {
629
+ className: classNames(styles.navigationChapters, _defineProperty({}, styles.navigationChaptersHidden, mobileNavHidden)),
630
+ role: "navigation",
631
+ ref: ref
632
+ },
633
+ /*#__PURE__*/
634
+ React.createElement("ul", {
635
+ className: styles.chapterList
636
+ }, renderChapterLinks(chapters))),
637
+ /*#__PURE__*/
638
+ React.createElement("div", {
639
+ className: classNames(styles.contextIcons)
640
+ },
641
+ /*#__PURE__*/
642
+ React.createElement(SharingMenu, null),
643
+ /*#__PURE__*/
644
+ React.createElement(LegalInfoMenu, null))),
645
+ /*#__PURE__*/
646
+ React.createElement("div", {
647
+ className: styles.progressBar,
648
+ onMouseEnter: handleProgressBarMouseEnter
649
+ },
650
+ /*#__PURE__*/
651
+ React.createElement("span", {
652
+ className: styles.progressIndicator,
653
+ style: {
654
+ width: readingProgress + '%'
655
+ }
656
+ })))
657
+ );
658
+ }
659
+
660
+ var SectionLifecycleContext = createContext();
661
+ var SectionLifecycleProvider = createScrollPositionLifecycleProvider(SectionLifecycleContext);
662
+ var useSectionLifecycle = createScrollPositionLifecycleHook(SectionLifecycleContext);
663
+
664
+ var Atmo =
665
+ /*#__PURE__*/
666
+ function () {
667
+ function Atmo(_ref) {
668
+ var _this = this;
669
+
670
+ var atmoSourceId = _ref.atmoSourceId,
671
+ multiPlayer = _ref.multiPlayer,
672
+ backgroundMedia = _ref.backgroundMedia;
673
+
674
+ _classCallCheck(this, Atmo);
675
+
676
+ this.multiPlayer = multiPlayer;
677
+ this.atmoSourceId = atmoSourceId;
678
+ this.backgroundMedia = backgroundMedia;
679
+ this.backgroundMedia.on('change:muted', function () {
680
+ _this.update();
681
+ });
682
+ documentHiddenState(function (hiddenState) {
683
+ if (hiddenState === 'hidden') {
684
+ _this.multiPlayer.fadeOutIfPlaying();
685
+ } else {
686
+ _this.update();
687
+ }
688
+ });
689
+ this.listenTo(this.multiPlayer, 'playfailed', function () {
690
+ backgroundMedia.mute(true);
691
+ });
692
+ }
693
+
694
+ _createClass(Atmo, [{
695
+ key: "disable",
696
+ value: function disable() {
697
+ this.disabled = true;
698
+ this.multiPlayer.fadeOutAndPause();
699
+ events.trigger('atmo:disabled');
700
+ }
701
+ }, {
702
+ key: "enable",
703
+ value: function enable() {
704
+ this.disabled = false;
705
+ this.update();
706
+ events.trigger('atmo:enabled');
707
+ }
708
+ }, {
709
+ key: "pause",
710
+ value: function pause() {
711
+ if (browser.has('volume control support')) {
712
+ return this.multiPlayer.fadeOutAndPause();
713
+ } else {
714
+ this.multiPlayer.pause();
715
+ }
716
+ }
717
+ }, {
718
+ key: "turnDown",
719
+ value: function turnDown() {
720
+ if (browser.has('volume control support')) {
721
+ return this.multiPlayer.changeVolumeFactor(0.2);
722
+ } else {
723
+ this.multiPlayer.pause();
724
+ }
725
+ }
726
+ }, {
727
+ key: "resume",
728
+ value: function resume() {
729
+ if (this.multiPlayer.paused()) {
730
+ if (this.disabled || this.backgroundMedia.muted) {
731
+ return Promise.resolve();
732
+ } else {
733
+ return this.multiPlayer.resumeAndFadeIn();
734
+ }
735
+ } else {
736
+ return this.multiPlayer.changeVolumeFactor(1);
737
+ }
738
+ }
739
+ }, {
740
+ key: "update",
741
+ value: function update() {
742
+ if (!this.disabled) {
743
+ if (this.backgroundMedia.muted || this.atmoSourceId == undefined) {
744
+ this.multiPlayer.fadeOutAndPause();
745
+ } else {
746
+ this.multiPlayer.fadeTo(this.atmoSourceId);
747
+ }
748
+ }
749
+ }
750
+ }, {
751
+ key: "createMediaPlayerHooks",
752
+ value: function createMediaPlayerHooks(atmoDuringPlayback) {
753
+ var atmo = this;
754
+ return {
755
+ before: function before() {
756
+ if (atmoDuringPlayback === 'mute') {
757
+ atmo.pause();
758
+ } else if (atmoDuringPlayback === 'turnDown') {
759
+ atmo.turnDown();
760
+ }
761
+ },
762
+ after: function after() {
763
+ atmo.resume();
764
+ }
765
+ };
766
+ }
767
+ }]);
768
+
769
+ return Atmo;
770
+ }();
771
+ Object.assign(Atmo.prototype, BackboneEvents);
772
+
773
+ function getContextValue(updateAtmo, createMediaPlayerHooks) {
774
+ var empty = function empty() {};
775
+
776
+ return {
777
+ updateAtmo: updateAtmo || empty,
778
+ createMediaPlayerHooks: createMediaPlayerHooks || empty
779
+ };
780
+ }
781
+
782
+ var AtmoContext = createContext(getContextValue());
783
+ function AtmoProvider(_ref) {
784
+ var children = _ref.children;
785
+ var atmoConfig = useRef({});
786
+ useEffect(function () {
787
+ var currentAtmo = atmoConfig.current;
788
+ currentAtmo.pool = PlayerSourceIDMap(media, {
789
+ playerOptions: {
790
+ tagName: 'audio',
791
+ loop: true
792
+ }
793
+ });
794
+ currentAtmo.multiPlayer = new MultiPlayer(currentAtmo.pool, {
795
+ fadeDuration: 500,
796
+ crossFade: true,
797
+ playFromBeginning: false,
798
+ rewindOnChange: true
799
+ });
800
+ currentAtmo.atmo = new Atmo({
801
+ multiPlayer: currentAtmo.multiPlayer,
802
+ backgroundMedia: media
803
+ });
804
+ }, []);
805
+
806
+ var updateAtmo = function updateAtmo(_ref2) {
807
+ var audioFilePermaId = _ref2.audioFilePermaId,
808
+ sources = _ref2.sources;
809
+ var currentAtmo = atmoConfig.current;
810
+
811
+ if (currentAtmo.atmo) {
812
+ if (sources) {
813
+ currentAtmo.pool.mapSources(audioFilePermaId, sources);
814
+ }
815
+
816
+ currentAtmo.atmo.atmoSourceId = audioFilePermaId;
817
+ currentAtmo.atmo.update();
818
+ }
819
+ };
820
+
821
+ var createMediaPlayerHooks = function createMediaPlayerHooks(options) {
822
+ if (atmoConfig.current.atmo) {
823
+ return atmoConfig.current.atmo.createMediaPlayerHooks(options);
824
+ }
825
+ };
826
+
827
+ var contextValue = useMemo(function () {
828
+ return getContextValue(updateAtmo, createMediaPlayerHooks);
829
+ }, []);
830
+ return (
831
+ /*#__PURE__*/
832
+ React.createElement(AtmoContext.Provider, {
833
+ value: contextValue
834
+ }, children)
835
+ );
836
+ }
837
+ function useAtmo() {
838
+ return useContext(AtmoContext);
839
+ }
840
+
841
+ function PlayerContainer(_ref) {
842
+ var filePermaId = _ref.filePermaId,
843
+ className = _ref.className,
844
+ sources = _ref.sources,
845
+ textTrackSources = _ref.textTrackSources,
846
+ poster = _ref.poster,
847
+ type = _ref.type,
848
+ playsInline = _ref.playsInline,
849
+ loop = _ref.loop,
850
+ controls = _ref.controls,
851
+ mediaEventsContextData = _ref.mediaEventsContextData,
852
+ atmoDuringPlayback = _ref.atmoDuringPlayback,
853
+ onSetup = _ref.onSetup,
854
+ onDispose = _ref.onDispose;
855
+ var playerWrapperRef = useRef(null);
856
+ var atmo = useAtmo();
857
+ useEffect(function () {
858
+ var playerWrapper = playerWrapperRef.current;
859
+
860
+ if (sources) {
861
+ var player = media.getPlayer(sources, {
862
+ textTrackSources: textTrackSources,
863
+ filePermaId: filePermaId,
864
+ poster: poster,
865
+ tagName: type,
866
+ playsInline: playsInline,
867
+ loop: loop,
868
+ controls: controls,
869
+ hooks: atmoDuringPlayback ? atmo.createMediaPlayerHooks(atmoDuringPlayback) : {},
870
+ //create hooks only for inline media players
871
+ mediaEventsContextData: mediaEventsContextData
872
+ });
873
+ var playerElement = player.el();
874
+ playerWrapper.appendChild(playerElement);
875
+
876
+ if (onSetup) {
877
+ onSetup(player);
878
+ }
879
+
880
+ return function () {
881
+ media.releasePlayer(player);
882
+ playerWrapper.innerHTML = '';
883
+
884
+ if (onDispose) {
885
+ onDispose();
886
+ }
887
+ };
888
+ }
889
+ });
890
+ return (
891
+ /*#__PURE__*/
892
+ React.createElement("div", {
893
+ className: className,
894
+ ref: playerWrapperRef
895
+ })
896
+ );
897
+ }
898
+
899
+ PlayerContainer.defaultProps = {
900
+ textTrackSources: []
901
+ }; // This function assumes that that the parameters are arrays of
902
+ // objects containing only skalar values. It is not a full deep
903
+ // equality check, but suffices for the use case.
904
+
905
+ function deepEqual(a, b) {
906
+ if (a.length !== b.length) {
907
+ return false;
908
+ }
909
+
910
+ for (var i = 0; i < a.length; i++) {
911
+ var aItem = a[i];
912
+ var bItem = b[i];
913
+
914
+ if (Object.keys(aItem).length !== Object.keys(bItem).length) {
915
+ return false;
916
+ }
917
+
918
+ for (var key in aItem) {
919
+ if (aItem[key] !== bItem[key]) {
920
+ return false;
921
+ }
922
+ }
923
+ }
924
+
925
+ return true;
926
+ }
927
+
928
+ function areEqual(prevProps, nextProps) {
929
+ return prevProps.type === nextProps.type && prevProps.playsInline === nextProps.playsInline && prevProps.poster === nextProps.poster && prevProps.loop === nextProps.loop && prevProps.controls === nextProps.controls && prevProps.atmoDuringPlayback === nextProps.atmoDuringPlayback && deepEqual(prevProps.sources, nextProps.sources) && deepEqual(prevProps.textTrackSources, nextProps.textTrackSources);
930
+ }
931
+
932
+ var PlayerContainer$1 = React.memo(PlayerContainer, areEqual);
933
+
934
+ var ScrollToSectionContext = React.createContext(function () {});
935
+
936
+ function watchPlayer (player, actions) {
937
+ player.on('loadedmetadata', function () {
938
+ return actions.metaDataLoaded(player.currentTime(), player.duration());
939
+ });
940
+ player.on('progress', function () {
941
+ return actions.progress(player.bufferedEnd());
942
+ });
943
+ player.on('play', actions.playing);
944
+ player.on('playfailed', actions.playFailed);
945
+ player.on('pause', actions.paused);
946
+ player.on('waiting', actions.waiting);
947
+ player.on('seeking', actions.seeking);
948
+ player.on('seeked', actions.seeked);
949
+ player.on('bufferunderrun', actions.bufferUnderrun);
950
+ player.on('bufferunderruncontinue', actions.bufferUnderrunContinue);
951
+ player.on('timeupdate', function () {
952
+ return actions.timeUpdate(player.currentTime(), player.duration());
953
+ });
954
+ player.on('ended', actions.ended);
955
+ player.one('loadedmetadata', function () {
956
+ return actions.saveMediaElementId(player.getMediaElement().id);
957
+ });
958
+ }
959
+ function unwatchPlayer(player, actions) {
960
+ player.off('loadedmetadata');
961
+ player.off('progress');
962
+ player.off('play', actions.playing);
963
+ player.off('playfailed', actions.playFailed);
964
+ player.off('pause', actions.paused);
965
+ player.off('waiting', actions.waiting);
966
+ player.off('seeking', actions.seeking);
967
+ player.off('seeked', actions.seeked);
968
+ player.off('bufferunderrun', actions.bufferUnderrun);
969
+ player.off('bufferunderruncontinue', actions.bufferUnderrunContinue);
970
+ player.off('timeupdate');
971
+ player.off('canplay');
972
+ player.off('ended', actions.ended);
973
+ actions.discardMediaElementId();
974
+ }
975
+
976
+ function applyPlayerState(player, playerState, playerActions) {
977
+ player.one('loadedmetadata', function () {
978
+ return player.currentTime(playerState.currentTime);
979
+ });
980
+ player.changeVolumeFactor(playerState.volumeFactor, 0);
981
+
982
+ if (playerState.shouldPrebuffer) {
983
+ player.prebuffer().then(playerActions.prebuffered);
984
+ }
985
+
986
+ if (playerState.isPlaying) {
987
+ player.play();
988
+ }
989
+
990
+ player.on('canplay', function () {
991
+ if (playerState.shouldPlay && player.paused()) {
992
+ player.play();
993
+ }
994
+ });
995
+ }
996
+
997
+ function updatePlayerState(player, prevPlayerState, playerState, playerActions) {
998
+ if (!prevPlayerState.shouldPrebuffer && playerState.shouldPrebuffer) {
999
+ player.prebuffer().then(function () {
1000
+ return setTimeout(playerActions.prebuffered, 0);
1001
+ });
1002
+ }
1003
+
1004
+ if (!prevPlayerState.shouldPlay && playerState.shouldPlay) {
1005
+ if (playerState.fadeDuration) {
1006
+ player.playAndFadeIn(playerState.fadeDuration);
1007
+ } else {
1008
+ player.playOrPlayOnLoad();
1009
+ }
1010
+ } else if (prevPlayerState.shouldPlay && !playerState.shouldPlay && playerState.isPlaying) {
1011
+ if (playerState.fadeDuration) {
1012
+ player.fadeOutAndPause(playerState.fadeDuration);
1013
+ } else {
1014
+ player.pause();
1015
+ }
1016
+ }
1017
+
1018
+ if (playerState.shouldSeekTo !== undefined && prevPlayerState.shouldSeekTo !== playerState.shouldSeekTo) {
1019
+ player.currentTime(playerState.shouldSeekTo);
1020
+ }
1021
+
1022
+ if (prevPlayerState.volumeFactor !== playerState.volumeFactor) {
1023
+ player.changeVolumeFactor(playerState.volumeFactor, playerState.volumeFactorFadeDuration);
1024
+ }
1025
+ }
1026
+
1027
+ function getEventObject(sectionIndex, entryStructure) {
1028
+ var getSectionChapterTitle = function getSectionChapterTitle(sectionIndex) {
1029
+ var _entryStructure$filte;
1030
+
1031
+ var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1032
+ return ((_entryStructure$filte = entryStructure.filter(function (chapter) {
1033
+ return chapter.sections.some(function (section) {
1034
+ return section.sectionIndex === sectionIndex;
1035
+ });
1036
+ })[0]) === null || _entryStructure$filte === void 0 ? void 0 : _entryStructure$filte.title) + delimiter;
1037
+ };
1038
+
1039
+ var page = {
1040
+ configuration: {
1041
+ title: entryStructure ? getSectionChapterTitle(sectionIndex, ', ') + 'Section ' + sectionIndex : null
1042
+ },
1043
+ index: sectionIndex === null ? -1 : sectionIndex
1044
+ };
1045
+ return page;
1046
+ }
1047
+ var EventContext = createContext(getEventObject());
1048
+ function EventContextDataProvider(props) {
1049
+ var entryStructure = useEntryStructure();
1050
+ var contextValue = useMemo(function () {
1051
+ return {
1052
+ page: getEventObject(props.sectionIndex, entryStructure)
1053
+ };
1054
+ }, [props.sectionIndex, entryStructure]);
1055
+ return (
1056
+ /*#__PURE__*/
1057
+ React.createElement(EventContext.Provider, {
1058
+ value: contextValue
1059
+ }, props.children)
1060
+ );
1061
+ }
1062
+ function useEventContextData() {
1063
+ return useContext(EventContext);
1064
+ }
1065
+
1066
+ function updateTextTracksMode(player, activeTextTrackFileId) {
1067
+ [].slice.call(player.textTracks()).forEach(function (textTrack) {
1068
+ if (textTrack.id === "text_track_file_".concat(activeTextTrackFileId)) {
1069
+ textTrack.mode = 'showing';
1070
+ } else {
1071
+ textTrack.mode = 'disabled';
1072
+ }
1073
+ });
1074
+ }
1075
+ function getTextTrackSources(textTrackFiles, textTracksDisabled) {
1076
+ if (textTracksDisabled) {
1077
+ return [];
1078
+ }
1079
+
1080
+ return textTrackFiles.filter(function (textTrackFile) {
1081
+ return textTrackFile.isReady;
1082
+ }).map(function (textTrackFile) {
1083
+ return {
1084
+ id: "text_track_file_".concat(textTrackFile.id),
1085
+ kind: textTrackFile.configuration.kind,
1086
+ label: textTrackFile.displayLabel,
1087
+ srclang: textTrackFile.configuration.srclang,
1088
+ src: textTrackFile.urls.vtt
1089
+ };
1090
+ });
1091
+ }
1092
+
1093
+ var textTrackStyles = {"inset":"textTracks-module_inset__K7DIL"};
1094
+
1095
+ var styles$8 = {"-webkit-mask":"MediaPlayer-module_mask__3JQDW","mask":"MediaPlayer-module_mask__3JQDW"};
1096
+
1097
+ var PLAY = 'MEDIA_PLAY';
1098
+ var PLAYING = 'MEDIA_PLAYING';
1099
+ var PLAY_FAILED = 'MEDIA_PLAY_FAILED';
1100
+ var PAUSE = 'MEDIA_PAUSE';
1101
+ var PAUSED = 'MEDIA_PAUSED';
1102
+ var PLAY_AND_FADE_IN = 'MEDIA_PLAY_AND_FADE_IN';
1103
+ var FADE_OUT_AND_PAUSE = 'MEDIA_FADE_OUT_AND_PAUSE';
1104
+ var CHANGE_VOLUME_FACTOR = 'CHANGE_VOLUME_FACTOR';
1105
+ var META_DATA_LOADED = 'MEDIA_META_DATA_LOADED';
1106
+ var PROGRESS = 'MEDIA_PROGRESS';
1107
+ var TIME_UPDATE = 'MEDIA_TIME_UPDATE';
1108
+ var ENDED = 'MEDIA_ENDED';
1109
+ var SCRUB_TO = 'MEDIA_SCRUB_TO';
1110
+ var SEEK_TO = 'MEDIA_SEEK_TO';
1111
+ var SEEKING = 'MEDIA_SEEKING';
1112
+ var SEEKED = 'MEDIA_SEEKED';
1113
+ var WAITING = 'MEDIA_WAITING';
1114
+ var PREBUFFER = 'MEDIA_PREBUFFER';
1115
+ var PREBUFFERED = 'MEDIA_PREBUFFERED';
1116
+ var BUFFER_UNDERRUN = 'MEDIA_BUFFER_UNDERRUN';
1117
+ var BUFFER_UNDERRUN_CONTINUE = 'MEDIA_BUFFER_UNDERRUN_CONTINUE';
1118
+ var CONTROLS_ENTERED = 'MEDIA_CONTROLS_ENTERED';
1119
+ var CONTROLS_LEFT = 'MEDIA_CONTROLS_LEFT';
1120
+ var FOCUS_ENTERED_CONTROLS = 'MEDIA_FOCUS_ENTERED_CONTROLS';
1121
+ var FOCUS_LEFT_CONTROLS = 'MEDIA_FOCUS_LEFT_CONTROLS';
1122
+ var USER_INTERACTION = 'MEDIA_USER_INTERACTION';
1123
+ var USER_IDLE = 'MEDIA_USER_IDLE';
1124
+ var SAVE_MEDIA_ELEMENT_ID = 'MEDIA_SAVE_MEDIA_ELEMENT_ID';
1125
+ var DISCARD_MEDIA_ELEMENT_ID = 'MEDIA_DISCARD_MEDIA_ELEMENT_ID';
1126
+ var isBlessed = false;
1127
+ function createActions(dispatch) {
1128
+ return {
1129
+ playBlessed: function playBlessed() {
1130
+ if (!isBlessed) {
1131
+ media.mute(false);
1132
+ isBlessed = true;
1133
+ }
1134
+
1135
+ dispatch({
1136
+ type: PLAY
1137
+ });
1138
+ },
1139
+ play: function play() {
1140
+ dispatch({
1141
+ type: PLAY
1142
+ });
1143
+ },
1144
+ playing: function playing() {
1145
+ dispatch({
1146
+ type: PLAYING
1147
+ });
1148
+ },
1149
+ playFailed: function playFailed() {
1150
+ dispatch({
1151
+ type: PLAY_FAILED
1152
+ });
1153
+ },
1154
+ pause: function pause() {
1155
+ dispatch({
1156
+ type: PAUSE
1157
+ });
1158
+ },
1159
+ paused: function paused() {
1160
+ dispatch({
1161
+ type: PAUSED
1162
+ });
1163
+ },
1164
+ playAndFadeIn: function playAndFadeIn(fadeDuration) {
1165
+ dispatch({
1166
+ type: PLAY_AND_FADE_IN,
1167
+ payload: {
1168
+ fadeDuration: fadeDuration
1169
+ }
1170
+ });
1171
+ },
1172
+ fadeOutAndPause: function fadeOutAndPause(fadeDuration) {
1173
+ dispatch({
1174
+ type: FADE_OUT_AND_PAUSE,
1175
+ payload: {
1176
+ fadeDuration: fadeDuration
1177
+ }
1178
+ });
1179
+ },
1180
+ changeVolumeFactor: function changeVolumeFactor(volumeFactor, fadeDuration) {
1181
+ dispatch({
1182
+ type: CHANGE_VOLUME_FACTOR,
1183
+ payload: {
1184
+ fadeDuration: fadeDuration,
1185
+ volumeFactor: volumeFactor
1186
+ }
1187
+ });
1188
+ },
1189
+ metaDataLoaded: function metaDataLoaded(currentTime, duration) {
1190
+ dispatch({
1191
+ type: META_DATA_LOADED,
1192
+ payload: {
1193
+ currentTime: currentTime,
1194
+ duration: duration
1195
+ }
1196
+ });
1197
+ },
1198
+ progress: function progress(bufferedEnd) {
1199
+ dispatch({
1200
+ type: PROGRESS,
1201
+ payload: {
1202
+ bufferedEnd: bufferedEnd
1203
+ }
1204
+ });
1205
+ },
1206
+ timeUpdate: function timeUpdate(currentTime, duration) {
1207
+ dispatch({
1208
+ type: TIME_UPDATE,
1209
+ payload: {
1210
+ currentTime: currentTime,
1211
+ duration: duration
1212
+ }
1213
+ });
1214
+ },
1215
+ ended: function ended() {
1216
+ dispatch({
1217
+ type: ENDED
1218
+ });
1219
+ },
1220
+ scrubTo: function scrubTo(time) {
1221
+ dispatch({
1222
+ type: SCRUB_TO,
1223
+ payload: {
1224
+ time: time
1225
+ }
1226
+ });
1227
+ },
1228
+ seekTo: function seekTo(time) {
1229
+ dispatch({
1230
+ type: SEEK_TO,
1231
+ payload: {
1232
+ time: time
1233
+ }
1234
+ });
1235
+ },
1236
+ seeking: function seeking() {
1237
+ dispatch({
1238
+ type: SEEKING
1239
+ });
1240
+ },
1241
+ seeked: function seeked() {
1242
+ dispatch({
1243
+ type: SEEKED
1244
+ });
1245
+ },
1246
+ waiting: function waiting() {
1247
+ dispatch({
1248
+ type: WAITING
1249
+ });
1250
+ },
1251
+ prebuffer: function prebuffer() {
1252
+ dispatch({
1253
+ type: PREBUFFER
1254
+ });
1255
+ },
1256
+ prebuffered: function prebuffered() {
1257
+ dispatch({
1258
+ type: PREBUFFERED
1259
+ });
1260
+ },
1261
+ bufferUnderrun: function bufferUnderrun() {
1262
+ dispatch({
1263
+ type: BUFFER_UNDERRUN
1264
+ });
1265
+ },
1266
+ bufferUnderrunContinue: function bufferUnderrunContinue() {
1267
+ dispatch({
1268
+ type: BUFFER_UNDERRUN_CONTINUE
1269
+ });
1270
+ },
1271
+ controlsEntered: function controlsEntered() {
1272
+ dispatch({
1273
+ type: CONTROLS_ENTERED
1274
+ });
1275
+ },
1276
+ controlsLeft: function controlsLeft() {
1277
+ dispatch({
1278
+ type: CONTROLS_LEFT
1279
+ });
1280
+ },
1281
+ userInteraction: function userInteraction() {
1282
+ dispatch({
1283
+ type: USER_INTERACTION
1284
+ });
1285
+ },
1286
+ userIdle: function userIdle() {
1287
+ dispatch({
1288
+ type: USER_IDLE
1289
+ });
1290
+ },
1291
+ focusEnteredControls: function focusEnteredControls() {
1292
+ dispatch({
1293
+ type: FOCUS_ENTERED_CONTROLS
1294
+ });
1295
+ },
1296
+ focusLeftControls: function focusLeftControls() {
1297
+ dispatch({
1298
+ type: FOCUS_LEFT_CONTROLS
1299
+ });
1300
+ },
1301
+ saveMediaElementId: function saveMediaElementId(id) {
1302
+ dispatch({
1303
+ type: SAVE_MEDIA_ELEMENT_ID,
1304
+ payload: {
1305
+ id: id
1306
+ }
1307
+ });
1308
+ },
1309
+ discardMediaElementId: function discardMediaElementId() {
1310
+ dispatch({
1311
+ type: DISCARD_MEDIA_ELEMENT_ID
1312
+ });
1313
+ }
1314
+ };
1315
+ }
1316
+
1317
+ function getInitialPlayerState() {
1318
+ return {
1319
+ isPlaying: false,
1320
+ shouldPlay: false,
1321
+ shouldPause: false,
1322
+ hasPlayed: false,
1323
+ unplayed: true,
1324
+ isLoading: true,
1325
+ playFailed: false,
1326
+ duration: 0,
1327
+ bufferedEnd: 0,
1328
+ shouldPrebuffer: true,
1329
+ fadeDuration: undefined,
1330
+ bufferUnderrun: undefined,
1331
+ scrubbingAt: undefined,
1332
+ currentTime: 0,
1333
+ mediaElementId: undefined,
1334
+ shouldSeekTo: undefined,
1335
+ userHoveringControls: false,
1336
+ focusInsideControls: false,
1337
+ userIdle: false,
1338
+ volumeFactor: 1
1339
+ };
1340
+ }
1341
+ function playerStateReducer(state, action) {
1342
+ switch (action.type) {
1343
+ case PLAY:
1344
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1345
+ isLoading: true,
1346
+ shouldPlay: true,
1347
+ playFailed: false
1348
+ });
1349
+
1350
+ case PLAYING:
1351
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1352
+ shouldPlay: true,
1353
+ isPlaying: true,
1354
+ userIdle: false,
1355
+ unplayed: false
1356
+ });
1357
+
1358
+ case PLAY_AND_FADE_IN:
1359
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1360
+ shouldPlay: true,
1361
+ fadeDuration: action.payload.fadeDuration,
1362
+ isLoading: true
1363
+ });
1364
+
1365
+ case FADE_OUT_AND_PAUSE:
1366
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1367
+ shouldPlay: false,
1368
+ fadeDuration: action.payload.fadeDuration,
1369
+ isLoading: false
1370
+ });
1371
+
1372
+ case PLAY_FAILED:
1373
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1374
+ shouldPlay: false,
1375
+ playFailed: true,
1376
+ fadeDuration: null,
1377
+ unplayed: true,
1378
+ isLoading: false
1379
+ });
1380
+
1381
+ case PAUSE:
1382
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1383
+ shouldPlay: false,
1384
+ isLoading: false,
1385
+ fadeDuration: null,
1386
+ shouldPause: true
1387
+ });
1388
+
1389
+ case PAUSED:
1390
+ state.shouldPause = false;
1391
+
1392
+ if (state.bufferUnderrun) {
1393
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1394
+ isPlaying: false,
1395
+ hasPlayed: true
1396
+ });
1397
+ } else {
1398
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1399
+ shouldPlay: false,
1400
+ fadeDuration: null,
1401
+ isPlaying: false,
1402
+ isLoading: false
1403
+ });
1404
+ }
1405
+
1406
+ case SCRUB_TO:
1407
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1408
+ scrubbingAt: action.payload.time
1409
+ });
1410
+
1411
+ case SEEK_TO:
1412
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1413
+ shouldSeekTo: action.payload.time
1414
+ });
1415
+
1416
+ case SEEKING:
1417
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1418
+ isLoading: true
1419
+ });
1420
+
1421
+ case SEEKED:
1422
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1423
+ scrubbingAt: undefined,
1424
+ isLoading: false
1425
+ });
1426
+
1427
+ case META_DATA_LOADED:
1428
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1429
+ currentTime: action.payload.currentTime,
1430
+ duration: action.payload.duration
1431
+ });
1432
+
1433
+ case PROGRESS:
1434
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1435
+ bufferedEnd: action.payload.bufferedEnd
1436
+ });
1437
+
1438
+ case TIME_UPDATE:
1439
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1440
+ currentTime: action.payload.currentTime,
1441
+ duration: action.payload.duration,
1442
+ isLoading: false
1443
+ });
1444
+
1445
+ case ENDED:
1446
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1447
+ shouldPlay: false,
1448
+ isPlaying: false
1449
+ });
1450
+
1451
+ case WAITING:
1452
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1453
+ isLoading: true
1454
+ });
1455
+
1456
+ case PREBUFFER:
1457
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1458
+ shouldPrebuffer: true
1459
+ });
1460
+
1461
+ case PREBUFFERED:
1462
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1463
+ shouldPrebuffer: false
1464
+ });
1465
+
1466
+ case BUFFER_UNDERRUN:
1467
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1468
+ bufferUnderrun: true
1469
+ });
1470
+
1471
+ case BUFFER_UNDERRUN_CONTINUE:
1472
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1473
+ bufferUnderrun: false
1474
+ });
1475
+
1476
+ case CONTROLS_ENTERED:
1477
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1478
+ userHoveringControls: true
1479
+ });
1480
+
1481
+ case CONTROLS_LEFT:
1482
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1483
+ userHoveringControls: false
1484
+ });
1485
+
1486
+ case FOCUS_ENTERED_CONTROLS:
1487
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1488
+ focusInsideControls: true,
1489
+ userIdle: false
1490
+ });
1491
+
1492
+ case FOCUS_LEFT_CONTROLS:
1493
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1494
+ focusInsideControls: false,
1495
+ userIdle: false
1496
+ });
1497
+
1498
+ case USER_INTERACTION:
1499
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1500
+ userIdle: false
1501
+ });
1502
+
1503
+ case USER_IDLE:
1504
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1505
+ userIdle: true
1506
+ });
1507
+
1508
+ case SAVE_MEDIA_ELEMENT_ID:
1509
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1510
+ mediaElementId: action.payload.id
1511
+ });
1512
+
1513
+ case DISCARD_MEDIA_ELEMENT_ID:
1514
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1515
+ mediaElementId: null
1516
+ });
1517
+
1518
+ case CHANGE_VOLUME_FACTOR:
1519
+ return _objectSpread2(_objectSpread2({}, state), {}, {
1520
+ volumeFactor: action.payload.volumeFactor,
1521
+ volumeFactorFadeDuration: action.payload.fadeDuration
1522
+ });
1523
+
1524
+ default:
1525
+ return state;
1526
+ }
1527
+ }
1528
+ function usePlayerState() {
1529
+ var _useReducer = useReducer(playerStateReducer, getInitialPlayerState()),
1530
+ _useReducer2 = _slicedToArray(_useReducer, 2),
1531
+ state = _useReducer2[0],
1532
+ dispatch = _useReducer2[1];
1533
+
1534
+ var actions = useMemo(function () {
1535
+ return createActions(dispatch);
1536
+ }, [dispatch]);
1537
+ return [state, actions];
1538
+ }
1539
+
1540
+ function MediaPlayer(props) {
1541
+ if (!props.isPrepared) {
1542
+ return null;
1543
+ }
1544
+
1545
+ return (
1546
+ /*#__PURE__*/
1547
+ React.createElement(PreparedMediaPlayer, props)
1548
+ );
1549
+ }
1550
+ MediaPlayer.defaultProps = {
1551
+ isPrepared: true
1552
+ };
1553
+
1554
+ function PreparedMediaPlayer(props) {
1555
+ var playerRef = useRef();
1556
+ var previousPlayerState = useRef(props.playerState);
1557
+ var scrollToSection = useContext(ScrollToSectionContext);
1558
+ var eventContextData = useEventContextData();
1559
+
1560
+ var onSetup = function onSetup(newPlayer) {
1561
+ playerRef.current = newPlayer;
1562
+ newPlayer.on('ended', function () {
1563
+ return props.nextSectionOnEnd && scrollToSection('next');
1564
+ });
1565
+ watchPlayer(newPlayer, props.playerActions);
1566
+ applyPlayerState(newPlayer, props.playerState, props.playerActions);
1567
+ };
1568
+
1569
+ var onDispose = function onDispose() {
1570
+ unwatchPlayer(playerRef.current, props.playerActions);
1571
+ playerRef.current = undefined;
1572
+ };
1573
+
1574
+ useEffect(function () {
1575
+ var player = playerRef.current;
1576
+
1577
+ if (player) {
1578
+ updatePlayerState(player, previousPlayerState.current, props.playerState, props.playerActions);
1579
+ }
1580
+
1581
+ previousPlayerState.current = props.playerState;
1582
+ }, [props.playerState, props.playerActions]);
1583
+ useEffect(function () {
1584
+ var player = playerRef.current;
1585
+
1586
+ if (player) {
1587
+ updateTextTracksMode(player, props.textTracks.activeFileId);
1588
+ }
1589
+ }, [props.textTracks.activeFileId]);
1590
+ return (
1591
+ /*#__PURE__*/
1592
+ React.createElement(React.Fragment, null,
1593
+ /*#__PURE__*/
1594
+ React.createElement(PlayerContainer$1, {
1595
+ className: classNames(props.className, _defineProperty({}, textTrackStyles.inset, props.textTracksInset)),
1596
+ type: props.type,
1597
+ sources: appendSuffix(props.sources, props.sourceUrlSuffix),
1598
+ textTrackSources: getTextTrackSources(props.textTracks.files, props.textTracksDisabled),
1599
+ filePermaId: props.filePermaId,
1600
+ poster: props.posterImageUrl,
1601
+ loop: props.loop,
1602
+ controls: props.controls,
1603
+ playsInline: props.playsInline,
1604
+ mediaEventsContextData: eventContextData,
1605
+ atmoDuringPlayback: props.atmoDuringPlayback,
1606
+ onSetup: onSetup,
1607
+ onDispose: onDispose
1608
+ }),
1609
+ /*#__PURE__*/
1610
+ React.createElement("div", {
1611
+ className: styles$8.mask,
1612
+ onClick: props.onClick
1613
+ }))
1614
+ );
1615
+ }
1616
+ PreparedMediaPlayer.defaultProps = {
1617
+ textTracks: {
1618
+ files: []
1619
+ }
1620
+ };
1621
+
1622
+ function appendSuffix(sources, suffix) {
1623
+ if (!suffix) {
1624
+ return sources;
1625
+ }
1626
+
1627
+ return sources.map(function (source) {
1628
+ return _objectSpread2(_objectSpread2({}, source), {}, {
1629
+ src: "".concat(source.src).concat(suffix)
1630
+ });
1631
+ });
1632
+ }
1633
+
1634
+ function useSetting(name) {
1635
+ var _useState = useState(settings.get(name)),
1636
+ _useState2 = _slicedToArray(_useState, 2),
1637
+ value = _useState2[0],
1638
+ setValue = _useState2[1];
1639
+
1640
+ useEffect(function () {
1641
+ function update() {
1642
+ setValue(settings.get(name));
1643
+ }
1644
+
1645
+ settings.on("change:".concat(name), update);
1646
+ return function () {
1647
+ return settings.off(undefined, update);
1648
+ };
1649
+ }, [setValue, name]);
1650
+ var setter = useCallback(function (value) {
1651
+ return settings.set(name, value);
1652
+ }, [name]);
1653
+ return [value, setter];
1654
+ }
1655
+
1656
+ function useTextTracks(_ref) {
1657
+ var file = _ref.file,
1658
+ defaultTextTrackFilePermaId = _ref.defaultTextTrackFilePermaId,
1659
+ captionsByDefault = _ref.captionsByDefault;
1660
+
1661
+ var _useSetting = useSetting('textTrack'),
1662
+ _useSetting2 = _slicedToArray(_useSetting, 2),
1663
+ setting = _useSetting2[0],
1664
+ setSetting = _useSetting2[1];
1665
+
1666
+ setting = setting || {};
1667
+
1668
+ var _useI18n = useI18n(),
1669
+ t = _useI18n.t;
1670
+
1671
+ var _useEntryMetadata = useEntryMetadata(),
1672
+ locale = _useEntryMetadata.locale;
1673
+
1674
+ var textTrackFiles = useTextTrackFiles({
1675
+ file: file
1676
+ });
1677
+ var autoTextTrackFile = getAutoTextTrackFile(textTrackFiles, defaultTextTrackFilePermaId, locale, captionsByDefault);
1678
+ return {
1679
+ mode: setting.kind === 'off' ? 'off' : setting.kind ? 'user' : 'auto',
1680
+ autoDisplayLabel: autoTextTrackFile ? t('pageflow_scrolled.public.text_track_modes.auto', {
1681
+ label: autoTextTrackFile.displayLabel
1682
+ }) : t('pageflow_scrolled.public.text_track_modes.auto_off'),
1683
+ files: textTrackFiles,
1684
+ activeFileId: getActiveTextTrackFileId(textTrackFiles, autoTextTrackFile, setting),
1685
+ select: function select(textTrackFileIdOrKind) {
1686
+ if (textTrackFileIdOrKind === 'off') {
1687
+ setSetting({
1688
+ kind: 'off'
1689
+ });
1690
+ } else if (textTrackFileIdOrKind === 'auto') {
1691
+ setSetting({});
1692
+ } else {
1693
+ var textTrackFile = textTrackFiles.find(function (file) {
1694
+ return file.id === textTrackFileIdOrKind;
1695
+ });
1696
+ setSetting({
1697
+ kind: textTrackFile.configuration.kind,
1698
+ srclang: textTrackFile.configuration.srclang
1699
+ });
1700
+ }
1701
+ }
1702
+ };
1703
+ }
1704
+
1705
+ function useTextTrackFiles(_ref2) {
1706
+ var file = _ref2.file;
1707
+
1708
+ var _useI18n2 = useI18n(),
1709
+ t = _useI18n2.t;
1710
+
1711
+ return useNestedFiles({
1712
+ collectionName: 'textTrackFiles',
1713
+ parent: file
1714
+ }).map(function (file) {
1715
+ return addDisplayLabel(file, t);
1716
+ }).sort(function (file1, file2) {
1717
+ return file1.displayLabel.localeCompare(file2.displayLabel);
1718
+ });
1719
+ }
1720
+
1721
+ function getActiveTextTrackFileId(textTrackFiles, autoTextTrackFile, setting) {
1722
+ if (setting.kind === 'off') {
1723
+ return null;
1724
+ }
1725
+
1726
+ var file = textTrackFiles.find(function (textTrackFile) {
1727
+ return textTrackFile.configuration.srclang === setting.srclang && textTrackFile.configuration.kind === setting.kind;
1728
+ });
1729
+
1730
+ if (file) {
1731
+ return file.id;
1732
+ }
1733
+
1734
+ return autoTextTrackFile && autoTextTrackFile.id;
1735
+ }
1736
+
1737
+ function getAutoTextTrackFile(textTrackFiles, defaultTextTrackFilePermaId, locale, captionsByDefault) {
1738
+ if (defaultTextTrackFilePermaId) {
1739
+ var defaultTextTrackFile = textTrackFiles.find(function (textTrackFile) {
1740
+ return textTrackFile.permaId === defaultTextTrackFilePermaId;
1741
+ });
1742
+
1743
+ if (defaultTextTrackFile) {
1744
+ return defaultTextTrackFile;
1745
+ }
1746
+ }
1747
+
1748
+ var subtitlesInEntryLanguage = textTrackFiles.find(function (textTrackFile) {
1749
+ return textTrackFile.configuration.kind === 'subtitles' && textTrackFile.configuration.srclang === locale;
1750
+ });
1751
+ var defaultCaptions = captionsByDefault ? textTrackFiles.find(function (textTrackFile) {
1752
+ return textTrackFile.configuration.kind === 'captions';
1753
+ }) : null;
1754
+ return subtitlesInEntryLanguage || defaultCaptions;
1755
+ }
1756
+
1757
+ function addDisplayLabel(textTrackFile, t) {
1758
+ return _objectSpread2(_objectSpread2({}, textTrackFile), {}, {
1759
+ displayLabel: textTrackFile.configuration.label || t('pageflow_scrolled.public.languages.' + textTrackFile.configuration.srclang || 'unknown', {
1760
+ defaultValue: t('pageflow_scrolled.public.languages.unknown')
1761
+ })
1762
+ });
1763
+ }
1764
+
1765
+ var MediaMutedContext = createContext(false);
1766
+ function MediaMutedProvider(_ref) {
1767
+ var children = _ref.children;
1768
+
1769
+ var _useState = useState(media.muted),
1770
+ _useState2 = _slicedToArray(_useState, 2),
1771
+ value = _useState2[0],
1772
+ setValue = _useState2[1];
1773
+
1774
+ useEffect(function () {
1775
+ media.on('change:muted', setValue);
1776
+ return function () {
1777
+ return media.off('change:muted', setValue);
1778
+ };
1779
+ }, []);
1780
+ return (
1781
+ /*#__PURE__*/
1782
+ React.createElement(MediaMutedContext.Provider, {
1783
+ value: value
1784
+ }, children)
1785
+ );
1786
+ }
1787
+ function useMediaMuted() {
1788
+ return useContext(MediaMutedContext);
1789
+ }
1790
+
1791
+ var styles$9 = {"opaque":"ViewportDependentPillarBoxes-module_opaque__2U9JL","container":"ViewportDependentPillarBoxes-module_container__Pj-Fy","content":"ViewportDependentPillarBoxes-module_content__1IY7b"};
1792
+
1793
+ var styles$a = {"root":"Fullscreen-module_root__1N3CI"};
1794
+
1795
+ var HeightContext = React.createContext();
1796
+ function FullscreenHeightProvider(_ref) {
1797
+ var height = _ref.height,
1798
+ children = _ref.children;
1799
+ return (
1800
+ /*#__PURE__*/
1801
+ React.createElement(HeightContext.Provider, {
1802
+ value: height
1803
+ }, children)
1804
+ );
1805
+ }
1806
+ var Fullscreen = React.forwardRef(function Fullscreen(props, ref) {
1807
+ var height = useContext(HeightContext);
1808
+ return (
1809
+ /*#__PURE__*/
1810
+ React.createElement("div", {
1811
+ ref: ref,
1812
+ className: styles$a.root,
1813
+ style: {
1814
+ height: height
1815
+ }
1816
+ }, props.children)
1817
+ );
1818
+ });
1819
+
1820
+ /**
1821
+ * Render a spanning div with the given aspect ratio which does not
1822
+ * exceed the heigth of the viewport. Render pillar boxes instead to
1823
+ * make it fit otherwise.
1824
+ *
1825
+ * @param {Object} props
1826
+ * @param {string} props.position -
1827
+ * Position setting of parent content element to automatically
1828
+ * determine whether to use opaque background.
1829
+ * @param {boolean} [props.opaque] - Force using opaque background.
1830
+ * @param {number} [props.aspectRatio] - Aspect ratio of div.
1831
+ * @param {Object} [props.file] - Use width/height of file to calculate aspect ratio.
1832
+ */
1833
+
1834
+ function ViewportDependentPillarBoxes(_ref) {
1835
+ var file = _ref.file,
1836
+ aspectRatio = _ref.aspectRatio,
1837
+ position = _ref.position,
1838
+ opaque = _ref.opaque,
1839
+ children = _ref.children;
1840
+ var height = useContext(HeightContext);
1841
+ if (!file && !aspectRatio) return children;
1842
+ aspectRatio = aspectRatio || file.height / file.width;
1843
+ var arPaddingTop = aspectRatio * 100;
1844
+ var maxWidthCSS;
1845
+
1846
+ if (height) {
1847
+ // thumbnail view/fixed size: calculate absolute width in px
1848
+ maxWidthCSS = height / aspectRatio + 'px';
1849
+ } else {
1850
+ // published view: set max width to specific aspect ratio depending on viewport height
1851
+ maxWidthCSS = 100 / aspectRatio + 'vh';
1852
+ }
1853
+
1854
+ return (
1855
+ /*#__PURE__*/
1856
+ React.createElement("div", {
1857
+ className: classNames(_defineProperty({}, styles$9.opaque, position === 'full' || opaque))
1858
+ },
1859
+ /*#__PURE__*/
1860
+ React.createElement("div", {
1861
+ className: styles$9.container,
1862
+ style: {
1863
+ maxWidth: maxWidthCSS
1864
+ }
1865
+ },
1866
+ /*#__PURE__*/
1867
+ React.createElement("div", {
1868
+ style: {
1869
+ paddingTop: arPaddingTop + '%'
1870
+ }
1871
+ }),
1872
+ /*#__PURE__*/
1873
+ React.createElement("div", {
1874
+ className: styles$9.content
1875
+ }, children)))
1876
+ );
1877
+ }
1878
+
1879
+ function ensureProtocol(protocol, url) {
1880
+ if (url && url.match(/^\/\//)) {
1881
+ return "".concat(protocol, ":").concat(url);
1882
+ }
1883
+
1884
+ return url;
1885
+ }
1886
+
1887
+ function formatTimeDuration(durationInMs) {
1888
+ var seconds = Math.round(durationInMs / 1000) % 60;
1889
+ var minutes = Math.floor(durationInMs / 1000 / 60) % 60;
1890
+ var hours = Math.floor(durationInMs / 1000 / 60 / 60);
1891
+ var result = 'PT';
1892
+
1893
+ if (hours > 0) {
1894
+ result += "".concat(hours, "H");
1895
+ }
1896
+
1897
+ if (minutes > 0) {
1898
+ result += "".concat(minutes, "M");
1899
+ }
1900
+
1901
+ if (seconds > 0 || minutes === 0 && hours === 0) {
1902
+ result += "".concat(seconds, "S");
1903
+ }
1904
+
1905
+ return result;
1906
+ }
1907
+
1908
+ function StructuredData(_ref) {
1909
+ var data = _ref.data;
1910
+ return (
1911
+ /*#__PURE__*/
1912
+ React.createElement("script", {
1913
+ type: "application/ld+json",
1914
+ dangerouslySetInnerHTML: {
1915
+ __html: JSON.stringify(data)
1916
+ }
1917
+ })
1918
+ );
1919
+ }
1920
+
1921
+ function AudioStructuredData(_ref) {
1922
+ var file = _ref.file;
1923
+ var entryMedadata = useEntryMetadata();
1924
+ var data = {
1925
+ '@context': 'http://schema.org',
1926
+ '@type': 'AudioObject',
1927
+ name: file.basename,
1928
+ description: file.configuration.alt,
1929
+ url: ensureProtocol('https', file.urls.mp3),
1930
+ duration: formatTimeDuration(file.durationInMs),
1931
+ datePublished: entryMedadata.publishedAt,
1932
+ uploadDate: file.createdAt,
1933
+ copyrightHolder: {
1934
+ '@type': 'Organization',
1935
+ name: file.rights
1936
+ }
1937
+ };
1938
+ return (
1939
+ /*#__PURE__*/
1940
+ React.createElement(StructuredData, {
1941
+ data: data
1942
+ })
1943
+ );
1944
+ }
1945
+
1946
+ var styles$b = {"audioPlayer":"AudioPlayer-module_audioPlayer__1Ms73","spaceForTextTracks":"AudioPlayer-module_spaceForTextTracks__169MK","spaceForTextTracksActive":"AudioPlayer-module_spaceForTextTracksActive__99m7R"};
1947
+
1948
+ /**
1949
+ * Render audio file in MediaPlayer.
1950
+ *
1951
+ * @param {Object} props
1952
+ * @param {number} props.id - Perma id of the audio file.
1953
+ * @param {number} [props.posterId] - Perma id of the poster image file.
1954
+ * @param {number} [props.defaultTextTrackFileId] - Perma id of default text track file.
1955
+ * @param {String} [props.position] - Position of parent content element.
1956
+ * @param {boolean} [props.isPrepared] - Control lazy loading.
1957
+ */
1958
+
1959
+ function AudioPlayer(props) {
1960
+ var audioFile = useFile({
1961
+ collectionName: 'audioFiles',
1962
+ permaId: props.id
1963
+ });
1964
+ var posterImage = useFile({
1965
+ collectionName: 'imageFiles',
1966
+ permaId: props.posterId
1967
+ });
1968
+ var textTracks = useTextTracks({
1969
+ file: audioFile,
1970
+ defaultTextTrackFilePermaId: props.defaultTextTrackFilePermaId,
1971
+ captionsByDefault: useMediaMuted()
1972
+ });
1973
+
1974
+ if (audioFile && audioFile.isReady) {
1975
+ return (
1976
+ /*#__PURE__*/
1977
+ React.createElement(ViewportDependentPillarBoxes, {
1978
+ file: posterImage,
1979
+ position: props.position
1980
+ },
1981
+ /*#__PURE__*/
1982
+ React.createElement("div", {
1983
+ className: classNames(styles$b.spaceForTextTracks, _defineProperty({}, styles$b.spaceForTextTracksActive, !posterImage && textTracks.files.length))
1984
+ },
1985
+ /*#__PURE__*/
1986
+ React.createElement(MediaPlayer, Object.assign({
1987
+ className: styles$b.audioPlayer,
1988
+ type: 'audio',
1989
+ textTracks: textTracks,
1990
+ filePermaId: props.id,
1991
+ sources: processSources(audioFile),
1992
+ textTracksInset: props.position === 'full',
1993
+ posterImageUrl: posterImage && posterImage.isReady ? posterImage.urls.large : undefined
1994
+ }, props)),
1995
+ /*#__PURE__*/
1996
+ React.createElement(AudioStructuredData, {
1997
+ file: audioFile
1998
+ })))
1999
+ );
2000
+ }
2001
+
2002
+ return null;
2003
+ }
2004
+ AudioPlayer.defaultProps = {
2005
+ controls: true
2006
+ };
2007
+ function processSources(audioFile) {
2008
+ var sources = [];
2009
+
2010
+ if (audioFile.urls['ogg']) {
2011
+ sources.push({
2012
+ type: 'audio/ogg',
2013
+ src: "".concat(audioFile.urls['ogg'], "?u=1")
2014
+ });
2015
+ }
2016
+
2017
+ if (audioFile.urls['mp3']) {
2018
+ sources.push({
2019
+ type: 'audio/mp3',
2020
+ src: "".concat(audioFile.urls['mp3'], "?u=1")
2021
+ });
2022
+ }
2023
+
2024
+ if (audioFile.urls['m4a']) {
2025
+ sources.push({
2026
+ type: 'audio/m4a',
2027
+ src: "".concat(audioFile.urls['m4a'], "?u=1")
2028
+ });
2029
+ }
2030
+
2031
+ return sources;
2032
+ }
2033
+
2034
+ function usePrevious(value) {
2035
+ var ref = useRef();
2036
+ useEffect(function () {
2037
+ ref.current = value;
2038
+ });
2039
+ return ref.current;
2040
+ }
2041
+
2042
+ function SectionAtmo(props) {
2043
+ var audioFile = useFile({
2044
+ collectionName: 'audioFiles',
2045
+ permaId: props.audioFilePermaId
2046
+ });
2047
+ var lastAudioFile = usePrevious(audioFile);
2048
+ var atmo = useAtmo();
2049
+ var processAtmo = useCallback(function () {
2050
+ var sources = undefined;
2051
+
2052
+ if (audioFile && audioFile.isReady) {
2053
+ sources = processSources(audioFile);
2054
+ }
2055
+
2056
+ if (atmo) {
2057
+ atmo.updateAtmo({
2058
+ sources: sources,
2059
+ audioFilePermaId: props.audioFilePermaId
2060
+ });
2061
+ }
2062
+ }, [atmo, audioFile, props.audioFilePermaId]);
2063
+ useSectionLifecycle({
2064
+ onActivate: function onActivate() {
2065
+ processAtmo();
2066
+ }
2067
+ });
2068
+ useEffect(function () {
2069
+ if (lastAudioFile !== undefined && (lastAudioFile && lastAudioFile.permaId) !== (audioFile && audioFile.permaId)) {
2070
+ processAtmo();
2071
+ }
2072
+ }, [processAtmo, lastAudioFile, audioFile]);
2073
+ return null;
2074
+ }
2075
+
2076
+ var styles$c = {"root":"Image-module_root__1ef3j"};
2077
+
2078
+ function ImageStructuredData(_ref) {
2079
+ var file = _ref.file;
2080
+ var entryMedadata = useEntryMetadata();
2081
+ var data = {
2082
+ '@context': 'http://schema.org',
2083
+ '@type': 'ImageObject',
2084
+ name: file.basename,
2085
+ description: file.configuration.alt,
2086
+ url: ensureProtocol('https', file.urls.large),
2087
+ width: file.width,
2088
+ height: file.height,
2089
+ datePublished: entryMedadata.publishedAt,
2090
+ uploadDate: file.createdAt,
2091
+ copyrightHolder: {
2092
+ '@type': 'Organization',
2093
+ name: file.rights
2094
+ }
2095
+ };
2096
+ return (
2097
+ /*#__PURE__*/
2098
+ React.createElement(StructuredData, {
2099
+ data: data
2100
+ })
2101
+ );
2102
+ }
2103
+
2104
+ /**
2105
+ * Render an image file.
2106
+ *
2107
+ * @param {Object} props
2108
+ * @param {number} props.id - Perma id of the image file.
2109
+ * @param {number} [props.variant] - Paperclip style to use. Defaults to large.
2110
+ * @param {boolean} [props.structuredData] - Whether to render a JSON+LD script tag.
2111
+ */
2112
+
2113
+ function Image(props) {
2114
+ var image = useFile({
2115
+ collectionName: 'imageFiles',
2116
+ permaId: props.id
2117
+ });
2118
+
2119
+ if (image && image.isReady && props.isPrepared) {
2120
+ return (
2121
+ /*#__PURE__*/
2122
+ React.createElement(React.Fragment, null, renderImageTag(props, image), renderStructuredData(props, image))
2123
+ );
2124
+ }
2125
+
2126
+ return null;
2127
+ }
2128
+
2129
+ function renderImageTag(props, image) {
2130
+ var focusX = typeof image.configuration.focusX === 'undefined' ? 50 : image.configuration.focusX;
2131
+ var focusY = typeof image.configuration.focusY === 'undefined' ? 50 : image.configuration.focusY;
2132
+ return (
2133
+ /*#__PURE__*/
2134
+ React.createElement("img", {
2135
+ className: classNames(styles$c.root),
2136
+ src: image.urls[props.variant],
2137
+ style: {
2138
+ objectPosition: "".concat(focusX, "% ").concat(focusY, "%")
2139
+ }
2140
+ })
2141
+ );
2142
+ }
2143
+
2144
+ function renderStructuredData(props, file) {
2145
+ if (props.structuredData && file) {
2146
+ return (
2147
+ /*#__PURE__*/
2148
+ React.createElement(ImageStructuredData, {
2149
+ file: file
2150
+ })
2151
+ );
2152
+ }
2153
+ }
2154
+
2155
+ Image.defaultProps = {
2156
+ isPrepared: true,
2157
+ variant: 'large'
2158
+ };
2159
+
2160
+ function useVideoQualitySetting() {
2161
+ var _useSetting = useSetting('videoQuality'),
2162
+ _useSetting2 = _slicedToArray(_useSetting, 2),
2163
+ value = _useSetting2[0],
2164
+ setValue = _useSetting2[1];
2165
+
2166
+ return [value || 'auto', setValue];
2167
+ }
2168
+
2169
+ function sources(videoFile) {
2170
+ var quality = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
2171
+
2172
+ if (quality === 'auto') {
2173
+ var result = [{
2174
+ type: 'application/x-mpegURL',
2175
+ src: videoFile.urls['hls-playlist']
2176
+ }, {
2177
+ type: 'video/mp4',
2178
+ src: videoFile.urls.high
2179
+ }];
2180
+
2181
+ if (videoFile.urls['dash-playlist']) {
2182
+ result = [{
2183
+ type: 'application/dash+xml',
2184
+ src: videoFile.urls['dash-playlist']
2185
+ }].concat(result);
2186
+ }
2187
+
2188
+ return result;
2189
+ } else {
2190
+ if (!videoFile.urls[quality]) {
2191
+ quality = 'high';
2192
+ }
2193
+
2194
+ return [{
2195
+ type: 'video/mp4',
2196
+ src: videoFile.urls[quality]
2197
+ }];
2198
+ }
2199
+ }
2200
+
2201
+ var styles$d = {"videoPlayer":"VideoPlayer-module_videoPlayer__2q9NS","cover":"VideoPlayer-module_cover__2Rk-J"};
2202
+
2203
+ function VideoStructuredData(_ref) {
2204
+ var file = _ref.file;
2205
+ var entryMedadata = useEntryMetadata();
2206
+ var data = {
2207
+ '@context': 'http://schema.org',
2208
+ '@type': 'VideoObject',
2209
+ name: file.basename,
2210
+ description: file.configuration.alt,
2211
+ url: ensureProtocol('https', file.urls.high),
2212
+ thumbnailUrl: ensureProtocol('https', file.urls.posterMedium),
2213
+ width: file.width,
2214
+ height: file.height,
2215
+ duration: formatTimeDuration(file.durationInMs),
2216
+ datePublished: entryMedadata.publishedAt,
2217
+ uploadDate: file.createdAt,
2218
+ copyrightHolder: {
2219
+ '@type': 'Organization',
2220
+ name: file.rights
2221
+ }
2222
+ };
2223
+ return (
2224
+ /*#__PURE__*/
2225
+ React.createElement(StructuredData, {
2226
+ data: data
2227
+ })
2228
+ );
2229
+ }
2230
+
2231
+ /**
2232
+ * Render video file in MediaPlayer.
2233
+ *
2234
+ * @param {Object} props
2235
+ * @param {number} props.id - Perma id of the video file.
2236
+ * @param {number} [props.posterId] - Perma id of the poster image file.
2237
+ * @param {number} [props.defaultTextTrackFileId] - Perma id of default text track file.
2238
+ * @param {boolean} [props.isPrepared] - Control lazy loading.
2239
+ * @param {String} [props.fit] - `"contain"` (default) or `"cover"`.
2240
+ * @param {String} [props.position] - Position of parent content element.
2241
+ */
2242
+
2243
+ function VideoPlayer(props) {
2244
+ var _useVideoQualitySetti = useVideoQualitySetting(),
2245
+ _useVideoQualitySetti2 = _slicedToArray(_useVideoQualitySetti, 1),
2246
+ activeQuality = _useVideoQualitySetti2[0];
2247
+
2248
+ var videoFile = useFile({
2249
+ collectionName: 'videoFiles',
2250
+ permaId: props.id
2251
+ });
2252
+ var posterImage = useFile({
2253
+ collectionName: 'imageFiles',
2254
+ permaId: props.posterId
2255
+ });
2256
+ var textTracks = useTextTracks({
2257
+ file: videoFile,
2258
+ defaultTextTrackFilePermaId: props.defaultTextTrackFilePermaId,
2259
+ captionsByDefault: useMediaMuted()
2260
+ });
2261
+
2262
+ function renderPlayer() {
2263
+ if (videoFile && videoFile.isReady) {
2264
+ return (
2265
+ /*#__PURE__*/
2266
+ React.createElement(React.Fragment, null,
2267
+ /*#__PURE__*/
2268
+ React.createElement(MediaPlayer, Object.assign({
2269
+ className: classNames(styles$d.videoPlayer, styles$d[props.fit]),
2270
+ type: 'video',
2271
+ textTracks: textTracks,
2272
+ filePermaId: props.id,
2273
+ sources: sources(videoFile, activeQuality),
2274
+ textTracksInset: props.position === 'full',
2275
+ posterImageUrl: posterImage && posterImage.isReady ? posterImage.urls.large : undefined
2276
+ }, props)),
2277
+ /*#__PURE__*/
2278
+ React.createElement(VideoStructuredData, {
2279
+ file: videoFile
2280
+ }))
2281
+ );
2282
+ } else {
2283
+ return null;
2284
+ }
2285
+ }
2286
+
2287
+ return (
2288
+ /*#__PURE__*/
2289
+ React.createElement(Positioner, {
2290
+ file: videoFile,
2291
+ fit: props.fit,
2292
+ position: props.position
2293
+ }, renderPlayer())
2294
+ );
2295
+ }
2296
+ VideoPlayer.defaultProps = {
2297
+ fit: 'contain',
2298
+ controls: true
2299
+ };
2300
+ var fallbackAspectRatio = 0.5625;
2301
+
2302
+ function Positioner(_ref) {
2303
+ var children = _ref.children,
2304
+ fit = _ref.fit,
2305
+ file = _ref.file,
2306
+ position = _ref.position;
2307
+
2308
+ if (fit === 'contain') {
2309
+ return (
2310
+ /*#__PURE__*/
2311
+ React.createElement(ViewportDependentPillarBoxes, {
2312
+ file: file,
2313
+ aspectRatio: file ? undefined : fallbackAspectRatio,
2314
+ position: position,
2315
+ opaque: true
2316
+ }, children)
2317
+ );
2318
+ } else {
2319
+ return children;
2320
+ }
2321
+ }
2322
+
2323
+ var styles$e = {"FillColor":"FillColor-module_FillColor__S1uEG"};
2324
+
2325
+ function FillColor(props) {
2326
+ return (
2327
+ /*#__PURE__*/
2328
+ React.createElement("div", {
2329
+ className: styles$e.FillColor,
2330
+ style: {
2331
+ backgroundColor: props.color
2332
+ }
2333
+ },
2334
+ /*#__PURE__*/
2335
+ React.createElement(Fullscreen, null))
2336
+ );
2337
+ }
2338
+
2339
+ var styles$f = {"root":"MotifArea-module_root__1_ACd","active":"MotifArea-module_active__1q4z2","corner":"MotifArea-module_corner__3hB5t","topLeft":"MotifArea-module_topLeft__3vHHi MotifArea-module_corner__3hB5t","topRight":"MotifArea-module_topRight__2gNmC MotifArea-module_corner__3hB5t","bottomLeft":"MotifArea-module_bottomLeft__2qEqb MotifArea-module_corner__3hB5t","bottomRight":"MotifArea-module_bottomRight__3OjTb MotifArea-module_corner__3hB5t"};
2340
+
2341
+ var MotifArea = function MotifArea(props) {
2342
+ var image = useFile({
2343
+ collectionName: 'imageFiles',
2344
+ permaId: props.imageId
2345
+ });
2346
+ var lastPosition = useRef();
2347
+ var position = (image === null || image === void 0 ? void 0 : image.isReady) && getPosition(props, image);
2348
+ var elementRef = useRef();
2349
+ var onUpdate = props.onUpdate;
2350
+ var setElementRef = useCallback(function (element) {
2351
+ elementRef.current = element;
2352
+ onUpdate(element);
2353
+ }, [elementRef, onUpdate]);
2354
+ useEffect(function () {
2355
+ if (lastPosition.current && position && (lastPosition.current.top !== position.top || lastPosition.current.left !== position.left || lastPosition.current.width !== position.width || lastPosition.current.height !== position.height)) {
2356
+ onUpdate(elementRef.current);
2357
+ }
2358
+
2359
+ lastPosition.current = position;
2360
+ });
2361
+
2362
+ if (!position) {
2363
+ return null;
2364
+ }
2365
+
2366
+ return (
2367
+ /*#__PURE__*/
2368
+ React.createElement("div", {
2369
+ ref: setElementRef,
2370
+ className: classNames(styles$f.root, _defineProperty({}, styles$f.active, props.active)),
2371
+ style: position,
2372
+ onMouseEnter: props.onMouseEnter,
2373
+ onMouseLeave: props.onMouseLeave
2374
+ },
2375
+ /*#__PURE__*/
2376
+ React.createElement("div", {
2377
+ className: styles$f.topLeft
2378
+ }),
2379
+ /*#__PURE__*/
2380
+ React.createElement("div", {
2381
+ className: styles$f.topRight
2382
+ }),
2383
+ /*#__PURE__*/
2384
+ React.createElement("div", {
2385
+ className: styles$f.bottomLeft
2386
+ }),
2387
+ /*#__PURE__*/
2388
+ React.createElement("div", {
2389
+ className: styles$f.bottomRight
2390
+ }))
2391
+ );
2392
+ };
2393
+ MotifArea.defaultProps = {
2394
+ onUpdate: function onUpdate() {}
2395
+ };
2396
+
2397
+ function getPosition(props, image) {
2398
+ var originalRatio = image.width / image.height;
2399
+ var containerRatio = props.containerWidth / props.containerHeight;
2400
+ var scale = containerRatio > originalRatio ? props.containerWidth / image.width : props.containerHeight / image.height;
2401
+ var contentWidth = image.width * scale;
2402
+ var contentHeight = image.height * scale;
2403
+ var focusX = image.configuration.focusX === undefined ? 50 : image.configuration.focusX;
2404
+ var focusY = image.configuration.focusY === undefined ? 50 : image.configuration.focusY;
2405
+ var cropLeft = (contentWidth - props.containerWidth) * focusX / 100;
2406
+ var cropTop = (contentHeight - props.containerHeight) * focusY / 100;
2407
+ var motifArea = image.configuration.motifArea || {
2408
+ top: 0,
2409
+ left: 0,
2410
+ width: 0,
2411
+ height: 0
2412
+ };
2413
+ return {
2414
+ top: Math.round(contentHeight * motifArea.top / 100 - cropTop),
2415
+ left: Math.round(contentWidth * motifArea.left / 100 - cropLeft),
2416
+ width: Math.round(contentWidth * motifArea.width / 100),
2417
+ height: Math.round(contentHeight * motifArea.height / 100)
2418
+ };
2419
+ }
2420
+
2421
+ function getSize(el) {
2422
+ if (!el) {
2423
+ return {
2424
+ left: 0,
2425
+ top: 0,
2426
+ width: 0,
2427
+ height: 0
2428
+ };
2429
+ }
2430
+
2431
+ return {
2432
+ left: el.offsetLeft,
2433
+ top: el.offsetTop,
2434
+ width: el.offsetWidth,
2435
+ height: el.offsetHeight
2436
+ };
2437
+ }
2438
+
2439
+ function useDimension() {
2440
+ var _useState = useState(getSize(null)),
2441
+ _useState2 = _slicedToArray(_useState, 2),
2442
+ componentSize = _useState2[0],
2443
+ setComponentSize = _useState2[1];
2444
+
2445
+ var _useState3 = useState(null),
2446
+ _useState4 = _slicedToArray(_useState3, 2),
2447
+ currentNode = _useState4[0],
2448
+ setCurrentNode = _useState4[1];
2449
+
2450
+ var measuredRef = useCallback(function (node) {
2451
+ setCurrentNode(node);
2452
+ setComponentSize(getSize(node));
2453
+ }, []);
2454
+ useEffect(function () {
2455
+ function handleResize() {
2456
+ setComponentSize(getSize(currentNode));
2457
+ }
2458
+
2459
+ if (!currentNode) {
2460
+ return;
2461
+ }
2462
+
2463
+ handleResize();
2464
+ window.addEventListener('resize', handleResize);
2465
+ return function () {
2466
+ window.removeEventListener('resize', handleResize);
2467
+ };
2468
+ }, [currentNode]);
2469
+ return [componentSize, measuredRef];
2470
+ }
2471
+
2472
+ function usePortraitOrientation() {
2473
+ return useMediaQuery('(orientation: portrait)');
2474
+ }
2475
+
2476
+ var styles$g = {"Backdrop":"Backdrop-module_Backdrop__1w4UZ"};
2477
+
2478
+ function Backdrop(props) {
2479
+ var _useDimension = useDimension(),
2480
+ _useDimension2 = _slicedToArray(_useDimension, 2),
2481
+ containerDimension = _useDimension2[0],
2482
+ setContainerRef = _useDimension2[1];
2483
+
2484
+ return (
2485
+ /*#__PURE__*/
2486
+ React.createElement("div", {
2487
+ className: classNames(styles$g.Backdrop, props.transitionStyles.backdrop, props.transitionStyles["backdrop-".concat(props.state)])
2488
+ },
2489
+ /*#__PURE__*/
2490
+ React.createElement("div", {
2491
+ className: props.transitionStyles.backdropInner
2492
+ },
2493
+ /*#__PURE__*/
2494
+ React.createElement("div", {
2495
+ className: props.transitionStyles.backdropInner2
2496
+ }, props.children(renderContent(props, containerDimension, setContainerRef)))))
2497
+ );
2498
+ }
2499
+ Backdrop.defaultProps = {
2500
+ children: function children(_children) {
2501
+ return _children;
2502
+ },
2503
+ transitionStyles: {}
2504
+ };
2505
+
2506
+ function renderContent(props, containerDimension, setContainerRef) {
2507
+ if (props.video) {
2508
+ return (
2509
+ /*#__PURE__*/
2510
+ React.createElement(Fullscreen, {
2511
+ ref: setContainerRef
2512
+ },
2513
+ /*#__PURE__*/
2514
+ React.createElement(BackgroundVideo, props))
2515
+ );
2516
+ } else if (props.color || props.image && props.image.toString().startsWith('#')) {
2517
+ return (
2518
+ /*#__PURE__*/
2519
+ React.createElement(FillColor, {
2520
+ color: props.color || props.image
2521
+ })
2522
+ );
2523
+ } else {
2524
+ return (
2525
+ /*#__PURE__*/
2526
+ React.createElement(Fullscreen, {
2527
+ ref: setContainerRef
2528
+ }, renderBackgroundImage(props, containerDimension))
2529
+ );
2530
+ }
2531
+ }
2532
+
2533
+ function renderBackgroundImage(props, containerDimension) {
2534
+ if (props.image && props.imageMobile) {
2535
+ return (
2536
+ /*#__PURE__*/
2537
+ React.createElement(OrientationAwareBackgroundImage, {
2538
+ image: props.image,
2539
+ imageMobile: props.imageMobile,
2540
+ onMotifAreaUpdate: props.onMotifAreaUpdate,
2541
+ containerDimension: containerDimension
2542
+ })
2543
+ );
2544
+ } else {
2545
+ return (
2546
+ /*#__PURE__*/
2547
+ React.createElement(BackgroundImage, {
2548
+ image: props.image || props.imageMobile,
2549
+ onMotifAreaUpdate: props.onMotifAreaUpdate,
2550
+ containerDimension: containerDimension
2551
+ })
2552
+ );
2553
+ }
2554
+ }
2555
+
2556
+ function OrientationAwareBackgroundImage(_ref) {
2557
+ var image = _ref.image,
2558
+ onMotifAreaUpdate = _ref.onMotifAreaUpdate,
2559
+ imageMobile = _ref.imageMobile,
2560
+ containerDimension = _ref.containerDimension;
2561
+ var mobile = usePortraitOrientation();
2562
+
2563
+ if (mobile) {
2564
+ return (
2565
+ /*#__PURE__*/
2566
+ React.createElement(BackgroundImage, {
2567
+ image: imageMobile,
2568
+ onMotifAreaUpdate: onMotifAreaUpdate,
2569
+ containerDimension: containerDimension
2570
+ })
2571
+ );
2572
+ } else {
2573
+ return (
2574
+ /*#__PURE__*/
2575
+ React.createElement(BackgroundImage, {
2576
+ image: image,
2577
+ onMotifAreaUpdate: onMotifAreaUpdate,
2578
+ containerDimension: containerDimension
2579
+ })
2580
+ );
2581
+ }
2582
+ }
2583
+
2584
+ function BackgroundImage(_ref2) {
2585
+ var image = _ref2.image,
2586
+ onMotifAreaUpdate = _ref2.onMotifAreaUpdate,
2587
+ containerDimension = _ref2.containerDimension;
2588
+
2589
+ var _useSectionLifecycle = useSectionLifecycle(),
2590
+ isPrepared = _useSectionLifecycle.isPrepared;
2591
+
2592
+ return (
2593
+ /*#__PURE__*/
2594
+ React.createElement(React.Fragment, null,
2595
+ /*#__PURE__*/
2596
+ React.createElement(Image, {
2597
+ id: image,
2598
+ isPrepared: isPrepared,
2599
+ structuredData: true
2600
+ }),
2601
+ /*#__PURE__*/
2602
+ React.createElement(MotifArea, {
2603
+ key: image,
2604
+ onUpdate: onMotifAreaUpdate,
2605
+ imageId: image,
2606
+ containerWidth: containerDimension.width,
2607
+ containerHeight: containerDimension.height
2608
+ }))
2609
+ );
2610
+ }
2611
+
2612
+ function BackgroundVideo(props) {
2613
+ var _usePlayerState = usePlayerState(),
2614
+ _usePlayerState2 = _slicedToArray(_usePlayerState, 2),
2615
+ playerState = _usePlayerState2[0],
2616
+ playerActions = _usePlayerState2[1];
2617
+
2618
+ var _useSectionLifecycle2 = useSectionLifecycle({
2619
+ onVisible: function onVisible() {
2620
+ playerActions.changeVolumeFactor(0, 0);
2621
+ playerActions.play();
2622
+ },
2623
+ onActivate: function onActivate() {
2624
+ playerActions.changeVolumeFactor(1, 1000);
2625
+ },
2626
+ onDeactivate: function onDeactivate() {
2627
+ playerActions.changeVolumeFactor(0, 1000);
2628
+ },
2629
+ onInvisible: function onInvisible() {
2630
+ playerActions.pause();
2631
+ }
2632
+ }),
2633
+ isPrepared = _useSectionLifecycle2.isPrepared;
2634
+
2635
+ useEffect(function () {
2636
+ var documentState = documentHiddenState(function (visibilityState) {
2637
+ if (visibilityState === 'hidden') {
2638
+ playerActions.pause();
2639
+ } else {
2640
+ playerActions.play();
2641
+ }
2642
+ });
2643
+ return function () {
2644
+ documentState.removeCallback();
2645
+ };
2646
+ }, [playerActions]);
2647
+ return (
2648
+ /*#__PURE__*/
2649
+ React.createElement(VideoPlayer, {
2650
+ isPrepared: isPrepared,
2651
+ playerState: playerState,
2652
+ playerActions: playerActions,
2653
+ id: props.video,
2654
+ textTracksDisabled: true,
2655
+ fit: "cover",
2656
+ loop: true,
2657
+ playsInline: true
2658
+ })
2659
+ );
2660
+ }
2661
+
2662
+ function isIntersectingX(rectA, rectB) {
2663
+ return rectA.left < rectB.right && rectA.right > rectB.left || rectB.left < rectA.right && rectB.right > rectA.left;
2664
+ }
2665
+
2666
+ function getBoundingClientRect(el) {
2667
+ if (!el) {
2668
+ return {
2669
+ left: 0,
2670
+ right: 0,
2671
+ top: 0,
2672
+ bottom: 0,
2673
+ width: 0,
2674
+ height: 0
2675
+ };
2676
+ }
2677
+
2678
+ return el.getBoundingClientRect();
2679
+ }
2680
+
2681
+ function useBoundingClientRect() {
2682
+ var _useState = useState(getBoundingClientRect(null)),
2683
+ _useState2 = _slicedToArray(_useState, 2),
2684
+ boundingClientRect = _useState2[0],
2685
+ setBoundingClientRect = _useState2[1];
2686
+
2687
+ var _useState3 = useState(null),
2688
+ _useState4 = _slicedToArray(_useState3, 2),
2689
+ currentNode = _useState4[0],
2690
+ setCurrentNode = _useState4[1];
2691
+
2692
+ var measureRef = useCallback(function (node) {
2693
+ setCurrentNode(node);
2694
+ setBoundingClientRect(getBoundingClientRect(node));
2695
+ }, []);
2696
+ useEffect(function () {
2697
+ function handler() {
2698
+ setBoundingClientRect(getBoundingClientRect(currentNode));
2699
+ }
2700
+
2701
+ if (!currentNode) {
2702
+ return;
2703
+ }
2704
+
2705
+ window.addEventListener('resize', handler);
2706
+ window.addEventListener('scroll', handler);
2707
+ return function () {
2708
+ window.removeEventListener('resize', handler);
2709
+ window.removeEventListener('scroll', handler);
2710
+ };
2711
+ }, [currentNode]);
2712
+ return [boundingClientRect, measureRef];
2713
+ }
2714
+
2715
+ function useScrollTarget(ref, isScrollTarget) {
2716
+ useEffect(function () {
2717
+ if (ref.current && isScrollTarget) {
2718
+ window.scrollTo({
2719
+ top: ref.current.getBoundingClientRect().top + window.scrollY - window.innerHeight * 0.25,
2720
+ behavior: 'smooth'
2721
+ });
2722
+ }
2723
+ }, [ref, isScrollTarget]);
2724
+ }
2725
+
2726
+ var DarkBackgroundContext = createContext(true);
2727
+ function BackgroundColorProvider(_ref) {
2728
+ var dark = _ref.dark,
2729
+ invert = _ref.invert,
2730
+ children = _ref.children;
2731
+ var previousValue = useDarkBackground();
2732
+ return (
2733
+ /*#__PURE__*/
2734
+ React.createElement(DarkBackgroundContext.Provider, {
2735
+ value: getValue({
2736
+ dark: dark,
2737
+ invert: invert,
2738
+ previousValue: previousValue
2739
+ })
2740
+ }, children)
2741
+ );
2742
+ }
2743
+
2744
+ function getValue(_ref2) {
2745
+ var dark = _ref2.dark,
2746
+ invert = _ref2.invert,
2747
+ previousValue = _ref2.previousValue;
2748
+
2749
+ if (dark !== undefined) {
2750
+ return dark;
2751
+ } else if (invert === true) {
2752
+ return !previousValue;
2753
+ } else {
2754
+ return previousValue;
2755
+ }
2756
+ }
2757
+ /**
2758
+ * Use to invert elements depending on whether they are rendered on a
2759
+ * dark or light background to ensure correct display in inverted
2760
+ * sections or in sections with card appearance.
2761
+ *
2762
+ * @return {boolean}
2763
+ */
2764
+
2765
+
2766
+ function useDarkBackground() {
2767
+ return useContext(DarkBackgroundContext);
2768
+ }
2769
+
2770
+ var styles$h = {"Section":"Section-module_Section__Yo58b","invert":"Section-module_invert__3_p7F"};
2771
+
2772
+ var fadeInBgConceal = {"fade-duration":"0.5s","backdrop":"fadeInBgConceal-module_backdrop__11JGO","backdropInner":"fadeInBgConceal-module_backdropInner__1IAYD","backdrop-below":"fadeInBgConceal-module_backdrop-below__3E6Uk"};
2773
+
2774
+ var fadeInBgFadeOut = {"fade-duration":"0.5s","backdrop":"fadeInBgFadeOut-module_backdrop__r0YXp","backdropInner":"fadeInBgFadeOut-module_backdropInner__IQp87","foreground":"fadeInBgFadeOut-module_foreground__Q2vkT","foreground-above":"fadeInBgFadeOut-module_foreground-above__3pmz9","backdrop-below":"fadeInBgFadeOut-module_backdrop-below__2G-Ic"};
2775
+
2776
+ var fadeInBgFadeOutBg = {"fade-duration":"0.5s","backdrop":"fadeInBgFadeOutBg-module_backdrop__15ocl","backdropInner":"fadeInBgFadeOutBg-module_backdropInner__sAnz6","boxShadow":"fadeInBgFadeOutBg-module_boxShadow__xUKyj","boxShadow-above":"fadeInBgFadeOutBg-module_boxShadow-above__2bY0E","backdrop-below":"fadeInBgFadeOutBg-module_backdrop-below__1rDT6"};
2777
+
2778
+ var fadeInBgScrollOut = {"fade-duration":"0.5s","backdrop":"fadeInBgScrollOut-module_backdrop__1bSsb","backdropInner":"fadeInBgScrollOut-module_backdropInner__3JZBG","backdropInner2":"fadeInBgScrollOut-module_backdropInner2__q-00L","foreground":"fadeInBgScrollOut-module_foreground__1ODH9","backdrop-below":"fadeInBgScrollOut-module_backdrop-below__2Dbkr"};
2779
+
2780
+ var fadeInConceal = {"fade-duration":"0.5s","backdrop":"fadeInConceal-module_backdrop__1zaRO","backdropInner":"fadeInConceal-module_backdropInner__1AIvq","foreground":"fadeInConceal-module_foreground__3giM9","backdrop-below":"fadeInConceal-module_backdrop-below__AWyQe","foreground-below":"fadeInConceal-module_foreground-below__2z5Op"};
2781
+
2782
+ var fadeInFadeOut = {"fade-duration":"0.5s","backdrop":"fadeInFadeOut-module_backdrop__Y4xOA","backdropInner":"fadeInFadeOut-module_backdropInner__1oRfP","foreground":"fadeInFadeOut-module_foreground__1eleZ","foreground-above":"fadeInFadeOut-module_foreground-above__249wa","backdrop-below":"fadeInFadeOut-module_backdrop-below__1h2I4","foreground-below":"fadeInFadeOut-module_foreground-below__3mE6f"};
2783
+
2784
+ var fadeInFadeOutBg = {"fade-duration":"0.5s","backdrop":"fadeInFadeOutBg-module_backdrop__2-IF3","backdropInner":"fadeInFadeOutBg-module_backdropInner__3r_bo","boxShadow":"fadeInFadeOutBg-module_boxShadow__3x7Ki","foreground":"fadeInFadeOutBg-module_foreground__24f_M","backdrop-below":"fadeInFadeOutBg-module_backdrop-below__4Ys_2","boxShadow-above":"fadeInFadeOutBg-module_boxShadow-above__3T2K5","foreground-below":"fadeInFadeOutBg-module_foreground-below__3pTRc"};
2785
+
2786
+ var fadeInScrollOut = {"fade-duration":"0.5s","backdrop":"fadeInScrollOut-module_backdrop__2FhBb","backdropInner":"fadeInScrollOut-module_backdropInner__1OfNZ","backdropInner2":"fadeInScrollOut-module_backdropInner2__5bNPT","foreground":"fadeInScrollOut-module_foreground__3h0EX","backdrop-below":"fadeInScrollOut-module_backdrop-below__3cRLH","foreground-below":"fadeInScrollOut-module_foreground-below__1Jcql"};
2787
+
2788
+ var revealConceal = {"backdrop":"revealConceal-module_backdrop__dLUhU utils-module_clip__34eot","backdropInner":"revealConceal-module_backdropInner__2k1Z-"};
2789
+
2790
+ var revealFadeOut = {"fade-duration":"0.5s","backdrop":"revealFadeOut-module_backdrop___Q1QF utils-module_clip__34eot","backdropInner":"revealFadeOut-module_backdropInner__17qRn","foreground":"revealFadeOut-module_foreground__1GzBs","foreground-above":"revealFadeOut-module_foreground-above__3GxOf"};
2791
+
2792
+ var revealFadeOutBg = {"fade-duration":"0.5s","backdrop":"revealFadeOutBg-module_backdrop__30OCF utils-module_clip__34eot","backdropInner":"revealFadeOutBg-module_backdropInner__3v3tM","boxShadow":"revealFadeOutBg-module_boxShadow__1NZRz","boxShadow-above":"revealFadeOutBg-module_boxShadow-above__2r4ov"};
2793
+
2794
+ var revealScrollOut = {"backdrop":"revealScrollOut-module_backdrop__2yOXd utils-module_clip__34eot","backdropInner":"revealScrollOut-module_backdropInner__211p3","backdropInner2":"revealScrollOut-module_backdropInner2__v6WqM","foreground":"revealScrollOut-module_foreground__3z-hw"};
2795
+
2796
+ var scrollInConceal = {"backdrop":"scrollInConceal-module_backdrop__2OJJC"};
2797
+
2798
+ var scrollInFadeOut = {"fade-duration":"0.5s","backdrop":"scrollInFadeOut-module_backdrop__1vXJd","foreground":"scrollInFadeOut-module_foreground__3Ikxb","foreground-above":"scrollInFadeOut-module_foreground-above__6ipm-"};
2799
+
2800
+ var scrollInFadeOutBg = {"fade-duration":"0.5s","backdrop":"scrollInFadeOutBg-module_backdrop__zw95c","boxShadow":"scrollInFadeOutBg-module_boxShadow__3UxCQ","boxShadow-above":"scrollInFadeOutBg-module_boxShadow-above__3kfau"};
2801
+
2802
+ var scrollInScrollOut = {"backdrop":"scrollInScrollOut-module_backdrop__XzCge","foreground":"scrollInScrollOut-module_foreground__1yyY8"};
2803
+
2804
+ var styles$i = {
2805
+ fadeInBgConceal: fadeInBgConceal,
2806
+ fadeInBgFadeOut: fadeInBgFadeOut,
2807
+ fadeInBgFadeOutBg: fadeInBgFadeOutBg,
2808
+ fadeInBgScrollOut: fadeInBgScrollOut,
2809
+ fadeInConceal: fadeInConceal,
2810
+ fadeInFadeOut: fadeInFadeOut,
2811
+ fadeInFadeOutBg: fadeInFadeOutBg,
2812
+ fadeInScrollOut: fadeInScrollOut,
2813
+ revealConceal: revealConceal,
2814
+ revealFadeOut: revealFadeOut,
2815
+ revealFadeOutBg: revealFadeOutBg,
2816
+ revealScrollOut: revealScrollOut,
2817
+ scrollInConceal: scrollInConceal,
2818
+ scrollInFadeOut: scrollInFadeOut,
2819
+ scrollInFadeOutBg: scrollInFadeOutBg,
2820
+ scrollInScrollOut: scrollInScrollOut
2821
+ };
2822
+ var enterTransitions = {
2823
+ fade: 'fadeIn',
2824
+ fadeBg: 'fadeInBg',
2825
+ scroll: 'scrollIn',
2826
+ scrollOver: 'scrollIn',
2827
+ reveal: 'reveal',
2828
+ beforeAfter: 'reveal'
2829
+ };
2830
+ var exitTransitions = {
2831
+ fade: 'fadeOut',
2832
+ fadeBg: 'fadeOutBg',
2833
+ scroll: 'scrollOut',
2834
+ scrollOver: 'conceal',
2835
+ reveal: 'scrollOut',
2836
+ beforeAfter: 'conceal'
2837
+ };
2838
+ function getTransitionNames() {
2839
+ return Object.keys(exitTransitions);
2840
+ }
2841
+ function getAvailableTransitionNames(section, previousSection) {
2842
+ if (!section.fullHeight || !previousSection.fullHeight) {
2843
+ return getTransitionNames().filter(function (name) {
2844
+ return !name.startsWith('fade');
2845
+ });
2846
+ }
2847
+
2848
+ return getTransitionNames();
2849
+ }
2850
+ function getTransitionStyles(section, previousSection, nextSection) {
2851
+ var name = getTransitionStylesName(section, previousSection, nextSection);
2852
+
2853
+ if (!styles$i[name]) {
2854
+ throw new Error("Unknown transition ".concat(name));
2855
+ }
2856
+
2857
+ return styles$i[name];
2858
+ }
2859
+ function getTransitionStylesName(section, previousSection, nextSection) {
2860
+ var enterTransition = enterTransitions[getTransitionName(previousSection, section)];
2861
+ var exitTransition = exitTransitions[getTransitionName(section, nextSection)];
2862
+ return "".concat(enterTransition).concat(capitalize(exitTransition));
2863
+ }
2864
+
2865
+ function getTransitionName(previousSection, section) {
2866
+ if (!section || !previousSection) {
2867
+ return 'scroll';
2868
+ }
2869
+
2870
+ if ((!section.fullHeight || !previousSection.fullHeight) && section.transition.startsWith('fade')) {
2871
+ return 'scroll';
2872
+ }
2873
+
2874
+ return section.transition;
2875
+ }
2876
+
2877
+ function capitalize(string) {
2878
+ return string.charAt(0).toUpperCase() + string.slice(1);
2879
+ }
2880
+
2881
+ function NoOpShadow(props) {
2882
+ return (
2883
+ /*#__PURE__*/
2884
+ React.createElement("div", null, props.children)
2885
+ );
2886
+ }
2887
+
2888
+ var styles$j = {"shadow":"GradientShadow-module_shadow__2UiDH","align-right":"GradientShadow-module_align-right__3iXZs","shadowBlack":"GradientShadow-module_shadowBlack__cSr14","align-left":"GradientShadow-module_align-left__3qcNM","intersecting":"GradientShadow-module_intersecting__h6vpz","align-center":"GradientShadow-module_align-center__2C7cl","shadowWhite":"GradientShadow-module_shadowWhite__3Xw2q"};
2889
+
2890
+ function GradientShadow(props) {
2891
+ var maxOpacityOverlap = props.motifAreaRect.height / 2;
2892
+ var motifAreaOverlap = Math.min(maxOpacityOverlap, props.motifAreaRect.bottom - props.contentAreaRect.top);
2893
+ var opacityFactor = props.intersecting && props.motifAreaRect.height > 0 ? motifAreaOverlap / maxOpacityOverlap : 1;
2894
+ return (
2895
+ /*#__PURE__*/
2896
+ React.createElement("div", {
2897
+ className: classNames(styles$j.root, styles$j["align-".concat(props.align)], _defineProperty({}, styles$j.intersecting, props.intersecting))
2898
+ },
2899
+ /*#__PURE__*/
2900
+ React.createElement("div", {
2901
+ className: classNames(styles$j.shadow, props.inverted ? styles$j.shadowWhite : styles$j.shadowBlack),
2902
+ style: {
2903
+ opacity: props.opacity * Math.round(opacityFactor * 10) / 10
2904
+ }
2905
+ },
2906
+ /*#__PURE__*/
2907
+ React.createElement(Fullscreen, null)), props.children)
2908
+ );
2909
+ }
2910
+ GradientShadow.defaultProps = {
2911
+ opacity: 0.7,
2912
+ align: 'left'
2913
+ };
2914
+
2915
+ var styles$k = {"start":"InvisibleBoxWrapper-module_start__F1nZ7","end":"InvisibleBoxWrapper-module_end__nphD-"};
2916
+
2917
+ function InvisibleBoxWrapper(_ref) {
2918
+ var _classNames;
2919
+
2920
+ var position = _ref.position,
2921
+ openStart = _ref.openStart,
2922
+ openEnd = _ref.openEnd,
2923
+ children = _ref.children;
2924
+ return (
2925
+ /*#__PURE__*/
2926
+ React.createElement("div", {
2927
+ className: classNames((_classNames = {}, _defineProperty(_classNames, styles$k.start, !openStart && position !== 'full'), _defineProperty(_classNames, styles$k.end, !openEnd && position !== 'full'), _classNames))
2928
+ }, children)
2929
+ );
2930
+ }
2931
+
2932
+ var styles$l = {"wrapper":"GradientBox-module_wrapper__1Jj7N","content":"GradientBox-module_content__96lDk","shadow":"GradientBox-module_shadow__2XilX","long":"GradientBox-module_long__10s6v","gradient":"GradientBox-module_gradient__31tJ-","withShadow":"GradientBox-module_withShadow__3mhPR","shadowDark":"GradientBox-module_shadowDark__3Tv0L","shadowLight":"GradientBox-module_shadowLight__Bieg6"};
2933
+
2934
+ function GradientBox(props) {
2935
+ var _classNames;
2936
+
2937
+ var padding = props.active ? props.padding : 0;
2938
+ return (
2939
+ /*#__PURE__*/
2940
+ React.createElement("div", {
2941
+ className: classNames(styles$l.root, (_classNames = {}, _defineProperty(_classNames, styles$l.gradient, padding > 0), _defineProperty(_classNames, styles$l["long"], props.coverInvisibleNextSection), _classNames)),
2942
+ style: {
2943
+ paddingTop: padding
2944
+ }
2945
+ },
2946
+ /*#__PURE__*/
2947
+ React.createElement("div", {
2948
+ className: styles$l.wrapper
2949
+ },
2950
+ /*#__PURE__*/
2951
+ React.createElement("div", {
2952
+ className: classNames(styles$l.shadow, props.inverted ? styles$l.shadowLight : styles$l.shadowDark, props.transitionStyles.boxShadow, props.transitionStyles["boxShadow-".concat(props.state)]),
2953
+ style: {
2954
+ top: padding,
2955
+ opacity: props.opacity
2956
+ }
2957
+ }),
2958
+ /*#__PURE__*/
2959
+ React.createElement("div", {
2960
+ className: styles$l.content
2961
+ }, props.children)))
2962
+ );
2963
+ }
2964
+ GradientBox.defaultProps = {
2965
+ opacity: 1
2966
+ };
2967
+
2968
+ var styles$m = {"wrapper":"CardBox-module_wrapper__3vnaH","content":"CardBox-module_content__36v7J"};
2969
+
2970
+ function CardBox(props) {
2971
+ var padding = props.active ? props.padding : 0;
2972
+ return (
2973
+ /*#__PURE__*/
2974
+ React.createElement("div", {
2975
+ style: {
2976
+ paddingTop: padding
2977
+ }
2978
+ },
2979
+ /*#__PURE__*/
2980
+ React.createElement("div", {
2981
+ className: styles$m.wrapper
2982
+ },
2983
+ /*#__PURE__*/
2984
+ React.createElement("div", {
2985
+ style: {
2986
+ top: padding
2987
+ }
2988
+ }),
2989
+ /*#__PURE__*/
2990
+ React.createElement("div", {
2991
+ className: styles$m.content
2992
+ }, props.children)))
2993
+ );
2994
+ }
2995
+
2996
+ var styles$n = {"darkBackground":"#101010","lightBackground":"#fff","card":"CardBoxWrapper-module_card__hvRUa","cardStart":"CardBoxWrapper-module_cardStart__2NywG","cardEnd":"CardBoxWrapper-module_cardEnd__x4Ye6","cardBgWhite":"CardBoxWrapper-module_cardBgWhite__xXhg7","cardBgBlack":"CardBoxWrapper-module_cardBgBlack__Ahp3s"};
2997
+
2998
+ function CardBoxWrapper(props) {
2999
+ return (
3000
+ /*#__PURE__*/
3001
+ React.createElement("div", {
3002
+ className: className(props)
3003
+ },
3004
+ /*#__PURE__*/
3005
+ React.createElement(BackgroundColorProvider, {
3006
+ invert: props.position !== 'sticky' && props.position !== 'full'
3007
+ }, props.children))
3008
+ );
3009
+ }
3010
+
3011
+ function className(props) {
3012
+ if (props.position === 'sticky' || props.position === 'full') {
3013
+ return undefined;
3014
+ }
3015
+
3016
+ return classNames(styles$n.card, props.inverted ? styles$n.cardBgBlack : styles$n.cardBgWhite, _defineProperty({}, styles$n.cardStart, !props.openStart), _defineProperty({}, styles$n.cardEnd, !props.openEnd));
3017
+ }
3018
+
3019
+ var OnScreenContext = React.createContext({
3020
+ center: false,
3021
+ top: false,
3022
+ bottom: false
3023
+ });
3024
+ var Section = withInlineEditingDecorator('SectionDecorator', function Section(props) {
3025
+ var ref = useRef();
3026
+ useScrollTarget(ref, props.isScrollTarget);
3027
+ var sectionProperties = useMemo(function () {
3028
+ return {
3029
+ layout: props.layout,
3030
+ invert: props.invert,
3031
+ sectionIndex: props.sectionIndex
3032
+ };
3033
+ }, [props.layout, props.invert, props.sectionIndex]);
3034
+
3035
+ var _useBoundingClientRec = useBoundingClientRect(),
3036
+ _useBoundingClientRec2 = _slicedToArray(_useBoundingClientRec, 2),
3037
+ motifAreaRect = _useBoundingClientRec2[0],
3038
+ setMotifAreaRect = _useBoundingClientRec2[1];
3039
+
3040
+ var _useDimension = useDimension(),
3041
+ _useDimension2 = _slicedToArray(_useDimension, 2),
3042
+ motifAreaDimension = _useDimension2[0],
3043
+ setMotifAreaDimensionRef = _useDimension2[1];
3044
+
3045
+ var setMotifAreaRefs = useCallback(function (node) {
3046
+ setMotifAreaRect(node);
3047
+ setMotifAreaDimensionRef(node);
3048
+ }, [setMotifAreaRect, setMotifAreaDimensionRef]);
3049
+
3050
+ var _useBoundingClientRec3 = useBoundingClientRect(props.layout),
3051
+ _useBoundingClientRec4 = _slicedToArray(_useBoundingClientRec3, 2),
3052
+ contentAreaRect = _useBoundingClientRec4[0],
3053
+ setContentAreaRef = _useBoundingClientRec4[1];
3054
+
3055
+ var intersecting = isIntersectingX(motifAreaRect, contentAreaRect);
3056
+ var heightOffset = 0; //(props.backdrop.first || props.transition === 'scrollOver') ? 0 : (window.innerHeight / 3);
3057
+
3058
+ var transitionStyles = getTransitionStyles(props, props.previousSection, props.nextSection);
3059
+ var appearance = {
3060
+ shadow: {
3061
+ background: GradientShadow,
3062
+ foreground: GradientBox,
3063
+ foregroundWrapper: InvisibleBoxWrapper
3064
+ },
3065
+ transparent: {
3066
+ background: NoOpShadow,
3067
+ foreground: CardBox,
3068
+ foregroundWrapper: InvisibleBoxWrapper
3069
+ },
3070
+ cards: {
3071
+ background: NoOpShadow,
3072
+ foreground: CardBox,
3073
+ foregroundWrapper: CardBoxWrapper
3074
+ }
3075
+ }[props.appearance || 'shadow'];
3076
+ var Shadow = appearance.background;
3077
+ var Box = appearance.foreground;
3078
+ var BoxWrapper = appearance.foregroundWrapper;
3079
+ return (
3080
+ /*#__PURE__*/
3081
+ React.createElement("section", {
3082
+ id: "section-".concat(props.permaId),
3083
+ ref: ref,
3084
+ className: classNames(styles$h.Section, transitionStyles.section, _defineProperty({}, styles$h.invert, props.invert))
3085
+ },
3086
+ /*#__PURE__*/
3087
+ React.createElement(SectionLifecycleProvider, {
3088
+ onActivate: props.onActivate,
3089
+ isLast: !props.nextSection
3090
+ },
3091
+ /*#__PURE__*/
3092
+ React.createElement(SectionAtmo, {
3093
+ audioFilePermaId: props.atmoAudioFileId
3094
+ }),
3095
+ /*#__PURE__*/
3096
+ React.createElement(Backdrop, Object.assign({}, props.backdrop, {
3097
+ onMotifAreaUpdate: setMotifAreaRefs,
3098
+ state: props.state,
3099
+ transitionStyles: transitionStyles
3100
+ }), function (children) {
3101
+ return (
3102
+ /*#__PURE__*/
3103
+ React.createElement(Shadow, {
3104
+ align: props.layout,
3105
+ inverted: props.invert,
3106
+ intersecting: intersecting,
3107
+ opacity: props.shadowOpacity >= 0 ? props.shadowOpacity / 100 : 0.7,
3108
+ motifAreaRect: motifAreaRect,
3109
+ contentAreaRect: contentAreaRect
3110
+ }, children)
3111
+ );
3112
+ }),
3113
+ /*#__PURE__*/
3114
+ React.createElement(Foreground, {
3115
+ transitionStyles: transitionStyles,
3116
+ state: props.state,
3117
+ paddingBottom: !endsWithFullWidthElement(props.foreground),
3118
+ heightMode: heightMode(props)
3119
+ },
3120
+ /*#__PURE__*/
3121
+ React.createElement(Box, {
3122
+ active: intersecting,
3123
+ inverted: props.invert,
3124
+ coverInvisibleNextSection: props.nextSection && props.nextSection.transition.startsWith('fade'),
3125
+ transitionStyles: transitionStyles,
3126
+ state: props.state,
3127
+ padding: Math.max(0, motifAreaDimension.top + motifAreaDimension.height - heightOffset),
3128
+ opacity: props.shadowOpacity
3129
+ },
3130
+ /*#__PURE__*/
3131
+ React.createElement(BackgroundColorProvider, {
3132
+ dark: !props.invert
3133
+ },
3134
+ /*#__PURE__*/
3135
+ React.createElement(Layout, {
3136
+ sectionId: props.id,
3137
+ items: indexItems(props.foreground),
3138
+ appearance: props.appearance,
3139
+ contentAreaRef: setContentAreaRef,
3140
+ sectionProps: sectionProperties
3141
+ }, function (children, boxProps) {
3142
+ return (
3143
+ /*#__PURE__*/
3144
+ React.createElement(BoxWrapper, Object.assign({}, boxProps, {
3145
+ inverted: props.invert
3146
+ }), children)
3147
+ );
3148
+ }))))))
3149
+ );
3150
+ });
3151
+
3152
+ function indexItems(items) {
3153
+ return items.map(function (item, index) {
3154
+ return _objectSpread2(_objectSpread2({}, item), {}, {
3155
+ index: index
3156
+ });
3157
+ });
3158
+ }
3159
+
3160
+ function heightMode(props) {
3161
+ if (props.fullHeight) {
3162
+ if (props.transition.startsWith('fade') || props.nextSection && props.nextSection.transition.startsWith('fade')) {
3163
+ return 'fullFade';
3164
+ } else {
3165
+ return 'full';
3166
+ }
3167
+ }
3168
+
3169
+ return 'dynamic';
3170
+ }
3171
+
3172
+ function endsWithFullWidthElement(elements) {
3173
+ var lastElement = elements[elements.length - 1];
3174
+ return lastElement && lastElement.position === 'full';
3175
+ }
3176
+
3177
+ function Chapter(props) {
3178
+ return (
3179
+ /*#__PURE__*/
3180
+ React.createElement("div", {
3181
+ id: "chapter-".concat(props.permaId)
3182
+ }, renderSections(props.sections, props.currentSectionIndex, props.setCurrentSectionIndex, props.scrollTargetSectionIndex, props.setScrollTargetSectionIndex))
3183
+ );
3184
+ }
3185
+
3186
+ function renderSections(sections, currentSectionIndex, setCurrentSectionIndex, scrollTargetSectionIndex, setScrollTargetSectionIndex) {
3187
+ function _onActivate(sectionIndex) {
3188
+ setCurrentSectionIndex(sectionIndex);
3189
+ setScrollTargetSectionIndex(null);
3190
+ }
3191
+
3192
+ return sections.map(function (section) {
3193
+ return (
3194
+ /*#__PURE__*/
3195
+ React.createElement(EventContextDataProvider, {
3196
+ key: section.permaId,
3197
+ sectionIndex: section.sectionIndex
3198
+ },
3199
+ /*#__PURE__*/
3200
+ React.createElement(Section, Object.assign({
3201
+ state: section.sectionIndex > currentSectionIndex ? 'below' : section.sectionIndex < currentSectionIndex ? 'above' : 'active',
3202
+ isScrollTarget: section.sectionIndex === scrollTargetSectionIndex,
3203
+ onActivate: function onActivate() {
3204
+ return _onActivate(section.sectionIndex);
3205
+ }
3206
+ }, section)))
3207
+ );
3208
+ });
3209
+ }
3210
+
3211
+ var useSectionChangeEvents = function useSectionChangeEvents(entryStructure, currentSectionIndex) {
3212
+ var previousSectionIndex = usePrevious(currentSectionIndex);
3213
+ useEffect(function () {
3214
+ if (previousSectionIndex !== currentSectionIndex) {
3215
+ events.trigger('page:change', getEventObject(currentSectionIndex, entryStructure));
3216
+ }
3217
+ });
3218
+ };
3219
+
3220
+ var sectionChangeMessagePoster = function sectionChangeMessagePoster(index) {
3221
+ if (window.parent !== window) {
3222
+ window.parent.postMessage({
3223
+ type: 'CHANGE_SECTION',
3224
+ payload: {
3225
+ index: index
3226
+ }
3227
+ }, window.location.origin);
3228
+ }
3229
+ };
3230
+
3231
+ var entryStyles = {"font-sans":"'Source Sans Pro', sans-serif","Entry":"Entry-module_Entry__1nDGh"};
3232
+
3233
+ var Entry = withInlineEditingDecorator('EntryDecorator', function Entry(props) {
3234
+ var _useState = useState(0),
3235
+ _useState2 = _slicedToArray(_useState, 2),
3236
+ currentSectionIndex = _useState2[0],
3237
+ setCurrentSectionIndexState = _useState2[1];
3238
+
3239
+ var _useState3 = useState(null),
3240
+ _useState4 = _slicedToArray(_useState3, 2),
3241
+ scrollTargetSectionIndex = _useState4[0],
3242
+ setScrollTargetSectionIndex = _useState4[1];
3243
+
3244
+ var entryStructure = useEntryStructure();
3245
+ useSectionChangeEvents(entryStructure, currentSectionIndex);
3246
+ var setCurrentSectionIndex = useCallback(function (index) {
3247
+ sectionChangeMessagePoster(index);
3248
+ setCurrentSectionIndexState(index);
3249
+ }, [setCurrentSectionIndexState]);
3250
+ var receiveMessage = useCallback(function (data) {
3251
+ if (data.type === 'SCROLL_TO_SECTION') {
3252
+ setScrollTargetSectionIndex(data.payload.index);
3253
+ }
3254
+ }, []);
3255
+ usePostMessageListener(receiveMessage);
3256
+
3257
+ function scrollToSection(index) {
3258
+ if (index === 'next') {
3259
+ index = currentSectionIndex + 1;
3260
+ }
3261
+
3262
+ setScrollTargetSectionIndex(index);
3263
+ }
3264
+
3265
+ return (
3266
+ /*#__PURE__*/
3267
+ React.createElement("div", {
3268
+ className: entryStyles.Entry
3269
+ },
3270
+ /*#__PURE__*/
3271
+ React.createElement(MediaMutedProvider, null,
3272
+ /*#__PURE__*/
3273
+ React.createElement(AtmoProvider, null,
3274
+ /*#__PURE__*/
3275
+ React.createElement(ScrollToSectionContext.Provider, {
3276
+ value: scrollToSection
3277
+ }, renderChapters(entryStructure, currentSectionIndex, setCurrentSectionIndex, scrollTargetSectionIndex, setScrollTargetSectionIndex)))))
3278
+ );
3279
+ });
3280
+
3281
+ function renderChapters(entryStructure, currentSectionIndex, setCurrentSectionIndex, scrollTargetSectionIndex, setScrollTargetSectionIndex) {
3282
+ return entryStructure.map(function (chapter, index) {
3283
+ return (
3284
+ /*#__PURE__*/
3285
+ React.createElement(Chapter, {
3286
+ key: index,
3287
+ permaId: chapter.permaId,
3288
+ sections: chapter.sections,
3289
+ currentSectionIndex: currentSectionIndex,
3290
+ setCurrentSectionIndex: setCurrentSectionIndex,
3291
+ scrollTargetSectionIndex: scrollTargetSectionIndex,
3292
+ setScrollTargetSectionIndex: setScrollTargetSectionIndex
3293
+ })
3294
+ );
3295
+ });
3296
+ }
3297
+
3298
+ var BrowserFeaturesAvailableContext = createContext(); // Browser feature detection is not available during server side
3299
+ // rendering. To prevent mismatches during hydration, we keep features
3300
+ // disabled in the initial render. Since hydration only starts after
3301
+ // feature detection has finished, we can immediately re-render once
3302
+ // the provider has mounted.
3303
+
3304
+ function BrowserFeaturesProvider(_ref) {
3305
+ var children = _ref.children;
3306
+
3307
+ var _useState = useState(false),
3308
+ _useState2 = _slicedToArray(_useState, 2),
3309
+ isAvailable = _useState2[0],
3310
+ setIsAvailable = _useState2[1];
3311
+
3312
+ useEffect(function () {
3313
+ return setIsAvailable(true);
3314
+ }, []);
3315
+ return (
3316
+ /*#__PURE__*/
3317
+ React.createElement(BrowserFeaturesAvailableContext.Provider, {
3318
+ value: isAvailable
3319
+ }, children)
3320
+ );
3321
+ }
3322
+ function useBrowserFeature(name) {
3323
+ return useContext(BrowserFeaturesAvailableContext) && browser.has(name);
3324
+ }
3325
+
3326
+ var styles$o = {"focusOutlineDisabled":"focusOutline-module_focusOutlineDisabled__KV7d-"};
3327
+
3328
+ var FocusVisibleContext = createContext();
3329
+ function useFocusOutlineVisible() {
3330
+ return useContext(FocusVisibleContext);
3331
+ }
3332
+ function FocusOutlineProvider(_ref) {
3333
+ var children = _ref.children;
3334
+
3335
+ var _useState = useState(),
3336
+ _useState2 = _slicedToArray(_useState, 2),
3337
+ value = _useState2[0],
3338
+ setValue = _useState2[1];
3339
+
3340
+ useEffect(function () {
3341
+ document.body.addEventListener('keydown', enable);
3342
+ document.body.addEventListener('mousedown', disable);
3343
+ disable();
3344
+ return function () {
3345
+ document.body.removeEventListener('keydown', enable);
3346
+ document.body.removeEventListener('mousedown', disable);
3347
+ };
3348
+
3349
+ function enable() {
3350
+ document.body.classList.remove(styles$o.focusOutlineDisabled);
3351
+ setValue(true);
3352
+ }
3353
+
3354
+ function disable() {
3355
+ document.body.classList.add(styles$o.focusOutlineDisabled);
3356
+ setValue(false);
3357
+ }
3358
+ }, []);
3359
+ return (
3360
+ /*#__PURE__*/
3361
+ React.createElement(FocusVisibleContext.Provider, {
3362
+ value: value
3363
+ }, children)
3364
+ );
3365
+ }
3366
+
3367
+ var PhonePlatformProvider = withInlineEditingAlternative('PhonePlatformProvider', function PhonePlatformProvider(_ref) {
3368
+ var children = _ref.children;
3369
+ var isPhonePlatform = useBrowserFeature('phone platform');
3370
+ return (
3371
+ /*#__PURE__*/
3372
+ React.createElement(PhonePlatformContext.Provider, {
3373
+ value: isPhonePlatform
3374
+ }, children)
3375
+ );
3376
+ });
3377
+
3378
+ function RootProviders(_ref) {
3379
+ var seed = _ref.seed,
3380
+ children = _ref.children;
3381
+ return (
3382
+ /*#__PURE__*/
3383
+ React.createElement(FocusOutlineProvider, null,
3384
+ /*#__PURE__*/
3385
+ React.createElement(BrowserFeaturesProvider, null,
3386
+ /*#__PURE__*/
3387
+ React.createElement(PhonePlatformProvider, null,
3388
+ /*#__PURE__*/
3389
+ React.createElement(EntryStateProvider, {
3390
+ seed: seed
3391
+ },
3392
+ /*#__PURE__*/
3393
+ React.createElement(LocaleProvider, null, children)))))
3394
+ );
3395
+ }
3396
+
3397
+ var styles$p = {"darkBackground":"#101010","lightBackground":"#fff","root":"Figure-module_root__3FC-x","invert":"Figure-module_invert___0BJP"};
3398
+
3399
+ /**
3400
+ * Render a figure with a caption text attached.
3401
+ *
3402
+ * @param {Object} props
3403
+ * @param {string} props.children - Content of figure.
3404
+ * @param {string} props.text - The text to be displayed.
3405
+ */
3406
+
3407
+ function Figure(_ref) {
3408
+ var children = _ref.children,
3409
+ caption = _ref.caption;
3410
+ var darkBackground = useDarkBackground();
3411
+
3412
+ if (caption) {
3413
+ return (
3414
+ /*#__PURE__*/
3415
+ React.createElement("figure", {
3416
+ className: classNames(styles$p.root, _defineProperty({}, styles$p.invert, !darkBackground))
3417
+ }, children,
3418
+ /*#__PURE__*/
3419
+ React.createElement("figcaption", null,
3420
+ /*#__PURE__*/
3421
+ React.createElement(Text, {
3422
+ scaleCategory: "caption"
3423
+ }, caption)))
3424
+ );
3425
+ } else {
3426
+ return children;
3427
+ }
3428
+ }
3429
+
3430
+ function MediaInteractionTracking(_ref) {
3431
+ var playerState = _ref.playerState,
3432
+ playerActions = _ref.playerActions,
3433
+ idleDelay = _ref.idleDelay,
3434
+ children = _ref.children;
3435
+ var hideControlsTimeout = useRef();
3436
+ var wasPlaying = usePrevious(playerState.isPlaying);
3437
+ var focusWasInside = usePrevious(playerState.focusInsideControls);
3438
+ var setHideControlsTimeout = useCallback(function () {
3439
+ clearTimeout(hideControlsTimeout.current);
3440
+ hideControlsTimeout.current = setTimeout(playerActions.userIdle, idleDelay);
3441
+ }, [playerActions.userIdle, idleDelay]);
3442
+ useEffect(function () {
3443
+ if (!wasPlaying && playerState.isPlaying || focusWasInside !== playerState.focusInsideControls) {
3444
+ setHideControlsTimeout();
3445
+ }
3446
+ }, [wasPlaying, playerState.isPlaying, setHideControlsTimeout, playerState.focusInsideControls, focusWasInside]);
3447
+
3448
+ var handleInteraction = function handleInteraction() {
3449
+ playerActions.userInteraction();
3450
+ setHideControlsTimeout();
3451
+ };
3452
+
3453
+ return (
3454
+ /*#__PURE__*/
3455
+ React.createElement("div", {
3456
+ onClick: handleInteraction,
3457
+ onMouseMove: handleInteraction
3458
+ }, children)
3459
+ );
3460
+ }
3461
+ MediaInteractionTracking.defaultProps = {
3462
+ idleDelay: 2000
3463
+ };
3464
+
3465
+ var styles$q = {"container":"Waveform-module_container__1Dxdv","menus":"Waveform-module_menus__1mOnJ","timeDisplay":"Waveform-module_timeDisplay__1v4Tl","playControl":"Waveform-module_playControl__QWTsJ","waveWrapper":"Waveform-module_waveWrapper__3gamc"};
3466
+
3467
+ var waveColor = '#828282ed';
3468
+ var waveColorInverted = 'rgba(0, 0, 0, 0.5)';
3469
+ var cursorColor = '#fff';
3470
+ var cursorColorInverted = '#888';
3471
+ var Wavesurfer = React.lazy(function () {
3472
+ return import('./Wavesurfer-c3c45324.js');
3473
+ });
3474
+ function Waveform(props) {
3475
+ var _useState = useState(90),
3476
+ _useState2 = _slicedToArray(_useState, 2),
3477
+ height = _useState2[0],
3478
+ setHeight = _useState2[1];
3479
+
3480
+ if (props.mediaElementId) {
3481
+ return (
3482
+ /*#__PURE__*/
3483
+ React.createElement(Suspense, {
3484
+ fallback:
3485
+ /*#__PURE__*/
3486
+ React.createElement("div", null)
3487
+ },
3488
+ /*#__PURE__*/
3489
+ React.createElement(Measure, {
3490
+ client: true,
3491
+ onResize: function onResize(contentRect) {
3492
+ return setHeight(contentRect.client.height);
3493
+ }
3494
+ }, function (_ref) {
3495
+ var measureRef = _ref.measureRef;
3496
+ return (
3497
+ /*#__PURE__*/
3498
+ React.createElement("div", {
3499
+ ref: measureRef,
3500
+ className: styles$q.waveWrapper
3501
+ },
3502
+ /*#__PURE__*/
3503
+ React.createElement(Wavesurfer, {
3504
+ mediaElt: "#".concat(props.mediaElementId),
3505
+ options: {
3506
+ normalize: true,
3507
+ removeMediaElementOnDestroy: false,
3508
+ hideScrollbar: true,
3509
+ progressColor: props.waveformColor || props.mainColor,
3510
+ waveColor: props.inverted ? waveColorInverted : waveColor,
3511
+ cursorColor: props.inverted ? cursorColorInverted : cursorColor,
3512
+ height: height
3513
+ }
3514
+ }))
3515
+ );
3516
+ }))
3517
+ );
3518
+ } else {
3519
+ return null;
3520
+ }
3521
+ }
3522
+
3523
+ var styles$r = {"timeDisplay":"TimeDisplay-module_timeDisplay__2UwqM","time":"TimeDisplay-module_time__li1ZU"};
3524
+
3525
+ var unknownTimePlaceholder = '-:--';
3526
+ function formatTime(value) {
3527
+ if (isNaN(value)) {
3528
+ return unknownTimePlaceholder;
3529
+ }
3530
+
3531
+ var seconds = Math.floor(value) % 60;
3532
+ var minutes = Math.floor(value / 60) % 60;
3533
+ var hours = Math.floor(value / 60 / 60);
3534
+
3535
+ if (hours > 0) {
3536
+ return "".concat(hours, ":").concat(pad(minutes), ":").concat(pad(seconds));
3537
+ } else {
3538
+ return "".concat(minutes, ":").concat(pad(seconds));
3539
+ }
3540
+ }
3541
+
3542
+ function pad(value) {
3543
+ return value < 10 ? '0' + value : value;
3544
+ }
3545
+
3546
+ function TimeDisplay(props) {
3547
+ return (
3548
+ /*#__PURE__*/
3549
+ React.createElement("div", {
3550
+ "data-testid": 'time-display',
3551
+ className: styles$r.timeDisplay
3552
+ },
3553
+ /*#__PURE__*/
3554
+ React.createElement("span", {
3555
+ className: styles$r.time
3556
+ }, formatTime(props.currentTime)), "/",
3557
+ /*#__PURE__*/
3558
+ React.createElement("span", {
3559
+ className: styles$r.time
3560
+ }, formatTime(props.duration)))
3561
+ );
3562
+ }
3563
+
3564
+ var styles$s = {"button":"MenuBarButton-module_button__2sY0F ControlBar-module_button___4aXE utils-module_unstyledButton__3rgne","icon":"MenuBarButton-module_icon__2h8__","subMenuItemAnnotation":"MenuBarButton-module_subMenuItemAnnotation__32Quc","subMenu":"MenuBarButton-module_subMenu__f-E-X","subMenuExpanded":"MenuBarButton-module_subMenuExpanded__2UvkJ","subMenuItem":"MenuBarButton-module_subMenuItem__1pyn_","subMenuItemIcon":"MenuBarButton-module_subMenuItemIcon__3iaB-","subMenuItemButton":"MenuBarButton-module_subMenuItemButton__2QnUz utils-module_unstyledButton__3rgne"};
3565
+
3566
+ function _extends$2() {
3567
+ _extends$2 = Object.assign || function (target) {
3568
+ for (var i = 1; i < arguments.length; i++) {
3569
+ var source = arguments[i];
3570
+
3571
+ for (var key in source) {
3572
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3573
+ target[key] = source[key];
3574
+ }
3575
+ }
3576
+ }
3577
+
3578
+ return target;
3579
+ };
3580
+
3581
+ return _extends$2.apply(this, arguments);
3582
+ }
3583
+ var CheckIcon = (function (_ref) {
3584
+ var _ref$styles = _ref.styles,
3585
+ props = _objectWithoutProperties(_ref, ["styles"]);
3586
+
3587
+ return React.createElement("svg", _extends$2({
3588
+ xmlns: "http://www.w3.org/2000/svg",
3589
+ width: "24",
3590
+ height: "24",
3591
+ viewBox: "0 0 512 512"
3592
+ }, props), React.createElement("path", {
3593
+ d: "M434.442 58.997L195.559 297.881 77.554 179.88 0 257.438l195.559 195.565L512 136.551z"
3594
+ }));
3595
+ });
3596
+
3597
+ function MenuBarButton(props) {
3598
+ var subMenuItems = props.subMenuItems,
3599
+ onClick = props.onClick;
3600
+
3601
+ var _useState = useState(props.subMenuExpanded),
3602
+ _useState2 = _slicedToArray(_useState, 2),
3603
+ subMenuExpanded = _useState2[0],
3604
+ setSubMenuExpanded = _useState2[1];
3605
+
3606
+ var closeMenuTimeout = useRef();
3607
+ var openMenu = useCallback(function () {
3608
+ if (subMenuItems.length > 0) {
3609
+ setSubMenuExpanded(true);
3610
+ }
3611
+ }, [subMenuItems.length]);
3612
+ var closeMenu = useCallback(function () {
3613
+ setSubMenuExpanded(false);
3614
+ }, []);
3615
+ var onButtonClick = useCallback(function (event) {
3616
+ openMenu();
3617
+
3618
+ if (onClick) {
3619
+ onClick();
3620
+ }
3621
+ }, [onClick, openMenu]);
3622
+ var onFocus = useCallback(function () {
3623
+ clearTimeout(closeMenuTimeout.current);
3624
+ }, []);
3625
+ var onBlur = useCallback(function () {
3626
+ clearTimeout(closeMenuTimeout.current);
3627
+ closeMenuTimeout.current = setTimeout(function () {
3628
+ setSubMenuExpanded(false);
3629
+ }, 100);
3630
+ }, []);
3631
+ var onKeyDown = useCallback(function (event) {
3632
+ if (event.key === 'Escape') {
3633
+ setSubMenuExpanded(false);
3634
+ }
3635
+ }, []);
3636
+ return (
3637
+ /*#__PURE__*/
3638
+ React.createElement("div", {
3639
+ className: classNames(_defineProperty({}, styles$s.subMenuExpanded, subMenuExpanded), styles$s.wrapper),
3640
+ onMouseEnter: openMenu,
3641
+ onMouseLeave: closeMenu,
3642
+ onFocus: onFocus,
3643
+ onBlur: onBlur,
3644
+ onKeyDown: onKeyDown
3645
+ },
3646
+ /*#__PURE__*/
3647
+ React.createElement("button", {
3648
+ className: styles$s.button,
3649
+ title: props.title,
3650
+ onClick: onButtonClick
3651
+ }, React.createElement(props.icon, {
3652
+ className: styles$s.icon
3653
+ })), renderSubMenu(props, closeMenu))
3654
+ );
3655
+ }
3656
+ MenuBarButton.defaultProps = {
3657
+ subMenuItems: []
3658
+ };
3659
+
3660
+ function renderSubMenu(props, closeMenu) {
3661
+ if (props.subMenuItems.length > 0) {
3662
+ return (
3663
+ /*#__PURE__*/
3664
+ React.createElement("ul", {
3665
+ className: styles$s.subMenu,
3666
+ role: "menu"
3667
+ }, renderSubMenuItems(props, closeMenu))
3668
+ );
3669
+ }
3670
+ }
3671
+
3672
+ function renderSubMenuItems(props, closeMenu) {
3673
+ return props.subMenuItems.map(function (item) {
3674
+ return (
3675
+ /*#__PURE__*/
3676
+ React.createElement("li", {
3677
+ className: styles$s.subMenuItem,
3678
+ key: item.value
3679
+ },
3680
+ /*#__PURE__*/
3681
+ React.createElement("button", {
3682
+ className: styles$s.subMenuItemButton,
3683
+ role: "menuitemradio",
3684
+ "aria-checked": item.active,
3685
+ onClick: subMenuItemClickHandler(props, item.value, closeMenu)
3686
+ }, renderSubMenuItemIcon(item), item.label, renderSubMenuItemAnnotation(props, item)))
3687
+ );
3688
+ });
3689
+ }
3690
+
3691
+ function renderSubMenuItemIcon(item) {
3692
+ if (item.active) {
3693
+ return (
3694
+ /*#__PURE__*/
3695
+ React.createElement(CheckIcon, {
3696
+ className: styles$s.subMenuItemIcon
3697
+ })
3698
+ );
3699
+ }
3700
+ }
3701
+
3702
+ function renderSubMenuItemAnnotation(props, item) {
3703
+ if (item.annotation) {
3704
+ return (
3705
+ /*#__PURE__*/
3706
+ React.createElement("span", {
3707
+ className: styles$s.subMenuItemAnnotation
3708
+ }, item.annotation)
3709
+ );
3710
+ }
3711
+ }
3712
+
3713
+ function subMenuItemClickHandler(props, value, closeMenu) {
3714
+ return function (event) {
3715
+ event.preventDefault();
3716
+ closeMenu();
3717
+
3718
+ if (props.onSubMenuItemClick) {
3719
+ props.onSubMenuItemClick(value);
3720
+ }
3721
+ };
3722
+ }
3723
+
3724
+ function _extends$3() {
3725
+ _extends$3 = Object.assign || function (target) {
3726
+ for (var i = 1; i < arguments.length; i++) {
3727
+ var source = arguments[i];
3728
+
3729
+ for (var key in source) {
3730
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3731
+ target[key] = source[key];
3732
+ }
3733
+ }
3734
+ }
3735
+
3736
+ return target;
3737
+ };
3738
+
3739
+ return _extends$3.apply(this, arguments);
3740
+ }
3741
+ var TextTracksIcon = (function (_ref) {
3742
+ var _ref$styles = _ref.styles,
3743
+ props = _objectWithoutProperties(_ref, ["styles"]);
3744
+
3745
+ return React.createElement("svg", _extends$3({
3746
+ xmlns: "http://www.w3.org/2000/svg",
3747
+ width: "24",
3748
+ height: "24"
3749
+ }, props), React.createElement("path", {
3750
+ d: "M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h4v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"
3751
+ }));
3752
+ });
3753
+
3754
+ function TextTracksMenu(props) {
3755
+ var _useI18n = useI18n(),
3756
+ t = _useI18n.t;
3757
+
3758
+ if (props.items.length < 2) {
3759
+ return null;
3760
+ }
3761
+
3762
+ return (
3763
+ /*#__PURE__*/
3764
+ React.createElement(MenuBarButton, {
3765
+ title: t('pageflow_scrolled.public.player_controls.text_tracks'),
3766
+ icon: TextTracksIcon,
3767
+ subMenuItems: props.items,
3768
+ onSubMenuItemClick: props.onItemClick
3769
+ })
3770
+ );
3771
+ }
3772
+ TextTracksMenu.defaultProps = {
3773
+ items: []
3774
+ };
3775
+
3776
+ var styles$t = {"transparent":"ControlBar-module_transparent__eS4af","lightBackground":"ControlBar-module_lightBackground__3-tGf","darkBackground":"ControlBar-module_darkBackground__31Wv7","controlBarContainer":"ControlBar-module_controlBarContainer__1cxRO","inset":"ControlBar-module_inset__JvBh9","button":"ControlBar-module_button___4aXE utils-module_unstyledButton__3rgne","playControl":"ControlBar-module_playControl__Vg5et ControlBar-module_button___4aXE utils-module_unstyledButton__3rgne"};
3777
+
3778
+ function _extends$4() {
3779
+ _extends$4 = Object.assign || function (target) {
3780
+ for (var i = 1; i < arguments.length; i++) {
3781
+ var source = arguments[i];
3782
+
3783
+ for (var key in source) {
3784
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3785
+ target[key] = source[key];
3786
+ }
3787
+ }
3788
+ }
3789
+
3790
+ return target;
3791
+ };
3792
+
3793
+ return _extends$4.apply(this, arguments);
3794
+ }
3795
+ var PlayIcon = (function (_ref) {
3796
+ var _ref$styles = _ref.styles,
3797
+ props = _objectWithoutProperties(_ref, ["styles"]);
3798
+
3799
+ return React.createElement("svg", _extends$4({
3800
+ xmlns: "http://www.w3.org/2000/svg",
3801
+ width: "24",
3802
+ height: "24"
3803
+ }, props), React.createElement("path", {
3804
+ d: "M8 5v14l11-7z"
3805
+ }));
3806
+ });
3807
+
3808
+ function _extends$5() {
3809
+ _extends$5 = Object.assign || function (target) {
3810
+ for (var i = 1; i < arguments.length; i++) {
3811
+ var source = arguments[i];
3812
+
3813
+ for (var key in source) {
3814
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3815
+ target[key] = source[key];
3816
+ }
3817
+ }
3818
+ }
3819
+
3820
+ return target;
3821
+ };
3822
+
3823
+ return _extends$5.apply(this, arguments);
3824
+ }
3825
+ var PauseIcon = (function (_ref) {
3826
+ var _ref$styles = _ref.styles,
3827
+ props = _objectWithoutProperties(_ref, ["styles"]);
3828
+
3829
+ return React.createElement("svg", _extends$5({
3830
+ xmlns: "http://www.w3.org/2000/svg",
3831
+ width: "24",
3832
+ height: "24"
3833
+ }, props), React.createElement("path", {
3834
+ d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z"
3835
+ }));
3836
+ });
3837
+
3838
+ function PlayPauseButton(props) {
3839
+ var _useI18n = useI18n(),
3840
+ t = _useI18n.t;
3841
+
3842
+ return (
3843
+ /*#__PURE__*/
3844
+ React.createElement("button", {
3845
+ className: styles$t.playControl,
3846
+ "aria-label": t(props.isPlaying ? 'pause' : 'play', {
3847
+ scope: 'pageflow_scrolled.public.player_controls'
3848
+ }),
3849
+ onClick: function onClick() {
3850
+ return props.isPlaying ? props.pause() : props.play();
3851
+ }
3852
+ }, pausePlayIcon(props))
3853
+ );
3854
+ }
3855
+
3856
+ function pausePlayIcon(props) {
3857
+ if (props.isPlaying) {
3858
+ return (
3859
+ /*#__PURE__*/
3860
+ React.createElement(PauseIcon, {
3861
+ className: styles$t.controlsIcon
3862
+ })
3863
+ );
3864
+ } else {
3865
+ return (
3866
+ /*#__PURE__*/
3867
+ React.createElement(PlayIcon, {
3868
+ className: styles$t.controlsIcon
3869
+ })
3870
+ );
3871
+ }
3872
+ }
3873
+
3874
+ function WaveformPlayerControls(props) {
3875
+ var darkBackground = useDarkBackground();
3876
+ return (
3877
+ /*#__PURE__*/
3878
+ React.createElement("div", {
3879
+ onFocus: props.onFocus,
3880
+ onBlur: props.onBlur,
3881
+ onMouseEnter: props.onMouseEnter,
3882
+ onMouseLeave: props.onMouseLeave,
3883
+ "data-testid": "waveform-controls",
3884
+ className: classNames(styles$q.container, darkBackground ? styles$t.darkBackground : styles$t.lightBackground)
3885
+ },
3886
+ /*#__PURE__*/
3887
+ React.createElement("div", {
3888
+ className: styles$q.playControl
3889
+ },
3890
+ /*#__PURE__*/
3891
+ React.createElement(PlayPauseButton, {
3892
+ isPlaying: props.isPlaying,
3893
+ play: props.play,
3894
+ pause: props.pause
3895
+ })),
3896
+ /*#__PURE__*/
3897
+ React.createElement(Waveform, {
3898
+ isPlaying: props.isPlaying,
3899
+ inverted: !darkBackground,
3900
+ waveformColor: props.waveformColor,
3901
+ mainColor: '#e10028',
3902
+ play: props.play,
3903
+ pause: props.pause,
3904
+ mediaElementId: props.mediaElementId
3905
+ }),
3906
+ /*#__PURE__*/
3907
+ React.createElement("div", {
3908
+ className: styles$q.timeDisplay
3909
+ },
3910
+ /*#__PURE__*/
3911
+ React.createElement(TimeDisplay, {
3912
+ currentTime: props.currentTime,
3913
+ duration: props.duration
3914
+ })),
3915
+ /*#__PURE__*/
3916
+ React.createElement("div", {
3917
+ className: styles$q.menus
3918
+ },
3919
+ /*#__PURE__*/
3920
+ React.createElement(TextTracksMenu, {
3921
+ items: props.textTracksMenuItems,
3922
+ onItemClick: props.onTextTracksMenuItemClick
3923
+ })))
3924
+ );
3925
+ }
3926
+
3927
+ var styles$u = {"container":"ProgressIndicators-module_container__1QiQJ","wrapper":"ProgressIndicators-module_wrapper__2PCVv","draggable":"ProgressIndicators-module_draggable__1iAE8","bars":"ProgressIndicators-module_bars__2-ddd","progressBar":"ProgressIndicators-module_progressBar__2PYn-","background":"ProgressIndicators-module_background__-x5f_ ProgressIndicators-module_progressBar__2PYn-","loadingProgressBar":"ProgressIndicators-module_loadingProgressBar__YD2GH ProgressIndicators-module_progressBar__2PYn-","playProgressBar":"ProgressIndicators-module_playProgressBar__3mCSX ProgressIndicators-module_progressBar__2PYn-","sliderHandle":"ProgressIndicators-module_sliderHandle__3ArIf","dragging":"ProgressIndicators-module_dragging__3yY3t"};
3928
+
3929
+ function ProgressIndicators(_ref) {
3930
+ var currentTime = _ref.currentTime,
3931
+ duration = _ref.duration,
3932
+ bufferedEnd = _ref.bufferedEnd,
3933
+ scrubTo = _ref.scrubTo,
3934
+ seekTo = _ref.seekTo;
3935
+
3936
+ var _useI18n = useI18n(),
3937
+ t = _useI18n.t;
3938
+
3939
+ var _useState = useState(),
3940
+ _useState2 = _slicedToArray(_useState, 2),
3941
+ dragging = _useState2[0],
3942
+ setDragging = _useState2[1];
3943
+
3944
+ var progressBarsContainerWidth = useRef();
3945
+ var positionToTime = useCallback(function (x) {
3946
+ if (duration && progressBarsContainerWidth.current) {
3947
+ var fraction = Math.max(0, Math.min(1, x / progressBarsContainerWidth.current));
3948
+ return fraction * duration;
3949
+ } else {
3950
+ return 0;
3951
+ }
3952
+ }, [duration]);
3953
+ var handleStop = useCallback(function (mouseEvent, dragEvent) {
3954
+ setDragging(false);
3955
+ seekTo(positionToTime(dragEvent.x));
3956
+ }, [seekTo, positionToTime]);
3957
+ var handleDrag = useCallback(function (mouseEvent, dragEvent) {
3958
+ setDragging(true);
3959
+ scrubTo(positionToTime(dragEvent.x));
3960
+ }, [scrubTo, positionToTime]);
3961
+ var handleKeyDown = useCallback(function (event) {
3962
+ var destination;
3963
+
3964
+ if (event.key === 'ArrowLeft') {
3965
+ destination = Math.max(0, currentTime - 1);
3966
+ } else if (event.key === 'ArrowRight') {
3967
+ destination = Math.min(currentTime + 1, duration || Infinity);
3968
+ }
3969
+
3970
+ seekTo(destination);
3971
+ }, [seekTo, currentTime, duration]);
3972
+ var loadProgress = duration > 0 ? Math.min(1, bufferedEnd / duration) : 0;
3973
+ var playProgress = duration > 0 ? Math.min(1, currentTime / duration) : 0;
3974
+ return (
3975
+ /*#__PURE__*/
3976
+ React.createElement("div", {
3977
+ className: classNames(styles$u.container, _defineProperty({}, styles$u.dragging, dragging)),
3978
+ "aria-label": t('pageflow_scrolled.public.player_controls.progress', {
3979
+ currentTime: formatTime(currentTime),
3980
+ duration: formatTime(duration)
3981
+ }),
3982
+ onKeyDown: handleKeyDown,
3983
+ tabIndex: "0"
3984
+ },
3985
+ /*#__PURE__*/
3986
+ React.createElement("div", {
3987
+ className: styles$u.wrapper
3988
+ },
3989
+ /*#__PURE__*/
3990
+ React.createElement(Measure, {
3991
+ client: true,
3992
+ onResize: function onResize(contentRect) {
3993
+ return progressBarsContainerWidth.current = contentRect.client.width;
3994
+ }
3995
+ }, function (_ref2) {
3996
+ var measureRef = _ref2.measureRef;
3997
+ return (
3998
+ /*#__PURE__*/
3999
+ React.createElement(DraggableCore, {
4000
+ onStart: handleDrag,
4001
+ onDrag: handleDrag,
4002
+ onStop: handleStop
4003
+ },
4004
+ /*#__PURE__*/
4005
+ React.createElement("div", {
4006
+ className: classNames(styles$u.draggable)
4007
+ },
4008
+ /*#__PURE__*/
4009
+ React.createElement("div", {
4010
+ ref: measureRef,
4011
+ className: styles$u.bars
4012
+ },
4013
+ /*#__PURE__*/
4014
+ React.createElement("div", {
4015
+ className: styles$u.background
4016
+ }),
4017
+ /*#__PURE__*/
4018
+ React.createElement("div", {
4019
+ className: styles$u.loadingProgressBar,
4020
+ style: {
4021
+ width: toPercent(loadProgress)
4022
+ },
4023
+ "data-testid": "loading-progress-bar"
4024
+ }),
4025
+ /*#__PURE__*/
4026
+ React.createElement("div", {
4027
+ className: styles$u.playProgressBar,
4028
+ style: {
4029
+ width: toPercent(playProgress)
4030
+ },
4031
+ "data-testid": "play-progress-bar"
4032
+ }),
4033
+ /*#__PURE__*/
4034
+ React.createElement("div", {
4035
+ className: styles$u.sliderHandle,
4036
+ style: {
4037
+ left: toPercent(playProgress)
4038
+ },
4039
+ "data-testid": "slider-handle"
4040
+ }))))
4041
+ );
4042
+ })))
4043
+ );
4044
+ }
4045
+
4046
+ function toPercent(value) {
4047
+ return value > 0 ? value * 100 + '%' : 0;
4048
+ }
4049
+
4050
+ function _extends$6() {
4051
+ _extends$6 = Object.assign || function (target) {
4052
+ for (var i = 1; i < arguments.length; i++) {
4053
+ var source = arguments[i];
4054
+
4055
+ for (var key in source) {
4056
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
4057
+ target[key] = source[key];
4058
+ }
4059
+ }
4060
+ }
4061
+
4062
+ return target;
4063
+ };
4064
+
4065
+ return _extends$6.apply(this, arguments);
4066
+ }
4067
+ var QualityIcon = (function (_ref) {
4068
+ var _ref$styles = _ref.styles,
4069
+ props = _objectWithoutProperties(_ref, ["styles"]);
4070
+
4071
+ return React.createElement("svg", _extends$6({
4072
+ xmlns: "http://www.w3.org/2000/svg",
4073
+ viewBox: "0 0 24 24"
4074
+ }, props), React.createElement("path", {
4075
+ d: "M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65A.488.488 0 0014 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"
4076
+ }));
4077
+ });
4078
+
4079
+ function QualityMenu(props) {
4080
+ var _useI18n = useI18n(),
4081
+ t = _useI18n.t;
4082
+
4083
+ if (props.items.length < 2) {
4084
+ return null;
4085
+ }
4086
+
4087
+ return (
4088
+ /*#__PURE__*/
4089
+ React.createElement(MenuBarButton, {
4090
+ title: t('pageflow_scrolled.public.player_controls.quality'),
4091
+ icon: QualityIcon,
4092
+ subMenuItems: props.items,
4093
+ subMenuExpanded: props.subMenuExpanded,
4094
+ onSubMenuItemClick: props.onItemClick,
4095
+ x: true
4096
+ })
4097
+ );
4098
+ }
4099
+ QualityMenu.defaultProps = {
4100
+ items: []
4101
+ };
4102
+
4103
+ function ClassicPlayerControls(props) {
4104
+ var _classNames;
4105
+
4106
+ var darkBackground = useDarkBackground();
4107
+ return (
4108
+ /*#__PURE__*/
4109
+ React.createElement("div", {
4110
+ onFocus: props.onFocus,
4111
+ onBlur: props.onBlur,
4112
+ onMouseEnter: props.onMouseEnter,
4113
+ onMouseLeave: props.onMouseLeave,
4114
+ className: classNames(styles$t.controlBarContainer, darkBackground ? styles$t.darkBackground : styles$t.lightBackground, (_classNames = {}, _defineProperty(_classNames, styles$t.inset, props.inset), _defineProperty(_classNames, styles$t.transparent, props.isPlaying && props.inset && props.inactive), _classNames))
4115
+ },
4116
+ /*#__PURE__*/
4117
+ React.createElement(PlayPauseButton, {
4118
+ isPlaying: props.isPlaying,
4119
+ play: props.play,
4120
+ pause: props.pause
4121
+ }),
4122
+ /*#__PURE__*/
4123
+ React.createElement(ProgressIndicators, {
4124
+ currentTime: props.currentTime,
4125
+ duration: props.duration,
4126
+ bufferedEnd: props.bufferedEnd,
4127
+ scrubTo: props.scrubTo,
4128
+ seekTo: props.seekTo
4129
+ }),
4130
+ /*#__PURE__*/
4131
+ React.createElement(TimeDisplay, {
4132
+ currentTime: props.currentTime,
4133
+ duration: props.duration
4134
+ }),
4135
+ /*#__PURE__*/
4136
+ React.createElement(TextTracksMenu, {
4137
+ items: props.textTracksMenuItems,
4138
+ onItemClick: props.onTextTracksMenuItemClick
4139
+ }),
4140
+ /*#__PURE__*/
4141
+ React.createElement(QualityMenu, {
4142
+ items: props.qualityMenuItems,
4143
+ onItemClick: props.onQualityMenuItemClick,
4144
+ subMenuExpanded: props.qualityMenuExpanded
4145
+ }))
4146
+ );
4147
+ }
4148
+
4149
+ function PlayerControls(props) {
4150
+ var ControlComponent = props.variant === 'waveform' ? WaveformPlayerControls : ClassicPlayerControls;
4151
+ return (
4152
+ /*#__PURE__*/
4153
+ React.createElement(ControlComponent, props)
4154
+ );
4155
+ }
4156
+ PlayerControls.defaultProps = {
4157
+ currentTime: 200,
4158
+ duration: 600,
4159
+ bufferedEnd: 400,
4160
+ isPlaying: false,
4161
+ play: function play() {},
4162
+ pause: function pause() {},
4163
+ scrubTo: function scrubTo() {},
4164
+ seekTo: function seekTo() {},
4165
+ inset: false
4166
+ };
4167
+
4168
+ function MediaPlayerControls(props) {
4169
+ var playerState = props.playerState;
4170
+ var playerActions = props.playerActions;
4171
+
4172
+ var _useI18n = useI18n(),
4173
+ t = _useI18n.t;
4174
+
4175
+ var textTracks = useTextTracks({
4176
+ file: props.file,
4177
+ defaultTextTrackFilePermaId: props.defaultTextTrackFilePermaId,
4178
+ captionsByDefault: useMediaMuted()
4179
+ });
4180
+ var focusOutlineVisible = useFocusOutlineVisible();
4181
+ return (
4182
+ /*#__PURE__*/
4183
+ React.createElement(PlayerControls, Object.assign({
4184
+ inset: props.configuration.position === 'full' || props.configuration.caption,
4185
+ type: props.type,
4186
+ variant: props.configuration.playerControlVariant,
4187
+ waveformColor: props.configuration.waveformColor,
4188
+ mediaElementId: playerState.mediaElementId,
4189
+ currentTime: playerState.scrubbingAt !== undefined ? playerState.scrubbingAt : playerState.currentTime,
4190
+ bufferedEnd: playerState.bufferedEnd,
4191
+ duration: playerState.duration,
4192
+ isPlaying: playerState.isPlaying,
4193
+ inactive: playerState.userIdle && (!focusOutlineVisible || !playerState.focusInsideControls) && !playerState.userHoveringControls,
4194
+ onFocus: playerActions.focusEnteredControls,
4195
+ onBlur: playerActions.focusLeftControls,
4196
+ onMouseEnter: playerActions.controlsEntered,
4197
+ onMouseLeave: playerActions.controlsLeft,
4198
+ play: playerActions.playBlessed,
4199
+ pause: playerActions.pause,
4200
+ scrubTo: playerActions.scrubTo,
4201
+ seekTo: playerActions.seekTo,
4202
+ textTracksMenuItems: getTextTracksMenuItems(textTracks, t),
4203
+ onTextTracksMenuItemClick: textTracks.select,
4204
+ qualityMenuItems: props.qualityMenuItems,
4205
+ onQualityMenuItemClick: props.onQualityMenuItemClick
4206
+ }, props))
4207
+ );
4208
+ }
4209
+ MediaPlayerControls.defaultProps = {
4210
+ configuration: {},
4211
+ sectionProps: {}
4212
+ };
4213
+
4214
+ function getTextTracksMenuItems(textTracks, t) {
4215
+ if (!textTracks.files.length) {
4216
+ return [];
4217
+ }
4218
+
4219
+ return [{
4220
+ value: 'off',
4221
+ label: t('pageflow_scrolled.public.text_track_modes.none'),
4222
+ active: textTracks.mode === 'off'
4223
+ }, {
4224
+ value: 'auto',
4225
+ label: textTracks.autoDisplayLabel,
4226
+ active: textTracks.mode === 'auto'
4227
+ }].concat(_toConsumableArray(textTracks.files.map(function (textTrackFile) {
4228
+ return {
4229
+ value: textTrackFile.id,
4230
+ label: textTrackFile.displayLabel,
4231
+ active: textTracks.mode === 'user' && textTrackFile.id === textTracks.activeFileId
4232
+ };
4233
+ })));
4234
+ }
4235
+
4236
+ function VideoPlayerControls(props) {
4237
+ var _useVideoQualitySetti = useVideoQualitySetting(),
4238
+ _useVideoQualitySetti2 = _slicedToArray(_useVideoQualitySetti, 2),
4239
+ activeQuality = _useVideoQualitySetti2[0],
4240
+ setActiveQuality = _useVideoQualitySetti2[1];
4241
+
4242
+ var file = useFile({
4243
+ collectionName: 'videoFiles',
4244
+ permaId: props.videoFilePermaId
4245
+ });
4246
+ var availableQualities = useAvailableQualities(file);
4247
+
4248
+ var _useI18n = useI18n(),
4249
+ t = _useI18n.t;
4250
+
4251
+ return (
4252
+ /*#__PURE__*/
4253
+ React.createElement(MediaPlayerControls, Object.assign({}, props, {
4254
+ file: file,
4255
+ qualityMenuItems: getQualityMenuItems(availableQualities, activeQuality, t),
4256
+ onQualityMenuItemClick: setActiveQuality
4257
+ }))
4258
+ );
4259
+ }
4260
+
4261
+ function getQualityMenuItems(availableQualities, activeQuality, t) {
4262
+ return availableQualities.map(function (quality) {
4263
+ return {
4264
+ value: quality,
4265
+ label: t("pageflow_scrolled.public.video_qualities.labels.".concat(quality)),
4266
+ annotation: t("pageflow_scrolled.public.video_qualities.annotations.".concat(quality), {
4267
+ defaultValue: ''
4268
+ }),
4269
+ active: activeQuality === quality
4270
+ };
4271
+ });
4272
+ }
4273
+
4274
+ function AudioPlayerControls(props) {
4275
+ var file = useFile({
4276
+ collectionName: 'audioFiles',
4277
+ permaId: props.audioFilePermaId
4278
+ });
4279
+ return (
4280
+ /*#__PURE__*/
4281
+ React.createElement(MediaPlayerControls, Object.assign({}, props, {
4282
+ file: file
4283
+ }))
4284
+ );
4285
+ }
4286
+
4287
+ var styles$v = {"crop":"SectionThumbnail-module_crop__Q1nZj","scale":"SectionThumbnail-module_scale__2tKDG"};
4288
+
4289
+ function SectionThumbnail(_ref) {
4290
+ var seed = _ref.seed,
4291
+ props = _objectWithoutProperties(_ref, ["seed"]);
4292
+
4293
+ return (
4294
+ /*#__PURE__*/
4295
+ React.createElement(RootProviders, {
4296
+ seed: seed
4297
+ },
4298
+ /*#__PURE__*/
4299
+ React.createElement(Inner, props))
4300
+ );
4301
+ }
4302
+
4303
+ function Inner(_ref2) {
4304
+ var sectionPermaId = _ref2.sectionPermaId,
4305
+ subscribe = _ref2.subscribe;
4306
+ var dispatch = useEntryStateDispatch();
4307
+ useEffect(function () {
4308
+ return subscribe(dispatch);
4309
+ }, [subscribe, dispatch]);
4310
+ var section = useSectionStructure({
4311
+ sectionPermaId: sectionPermaId
4312
+ });
4313
+
4314
+ if (section) {
4315
+ return (
4316
+ /*#__PURE__*/
4317
+ React.createElement(StaticPreview, null,
4318
+ /*#__PURE__*/
4319
+ React.createElement(Measure, {
4320
+ client: true
4321
+ }, function (_ref3) {
4322
+ var measureRef = _ref3.measureRef,
4323
+ contentRect = _ref3.contentRect;
4324
+ return (
4325
+ /*#__PURE__*/
4326
+ React.createElement(FullscreenHeightProvider, {
4327
+ height: contentRect.client.height && Math.ceil(contentRect.client.height) * 5
4328
+ },
4329
+ /*#__PURE__*/
4330
+ React.createElement("div", {
4331
+ ref: measureRef,
4332
+ className: styles$v.crop
4333
+ },
4334
+ /*#__PURE__*/
4335
+ React.createElement("div", {
4336
+ className: styles$v.scale
4337
+ },
4338
+ /*#__PURE__*/
4339
+ React.createElement("div", {
4340
+ className: entryStyles.Entry
4341
+ },
4342
+ /*#__PURE__*/
4343
+ React.createElement(Section, Object.assign({
4344
+ state: "active"
4345
+ }, section, {
4346
+ transition: "preview"
4347
+ }))))))
4348
+ );
4349
+ }))
4350
+ );
4351
+ } else {
4352
+ return (
4353
+ /*#__PURE__*/
4354
+ React.createElement("div", {
4355
+ className: styles$v.root
4356
+ }, "Not found.")
4357
+ );
4358
+ }
4359
+ }
4360
+
4361
+ Inner.defaultProps = {
4362
+ subscribe: function subscribe() {}
4363
+ };
4364
+
4365
+ var EditableInlineText = withInlineEditingAlternative('EditableInlineText', function EditableInlineText(_ref) {
4366
+ var _value$, _value$$children$;
4367
+
4368
+ var value = _ref.value,
4369
+ _ref$defaultValue = _ref.defaultValue,
4370
+ defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue;
4371
+ return value ? (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : (_value$$children$ = _value$.children[0]) === null || _value$$children$ === void 0 ? void 0 : _value$$children$.text : defaultValue;
4372
+ });
4373
+
4374
+ function registerTemplateWidgetType (typeName, callback) {
4375
+ var element = document.getElementById('template-widget-container');
4376
+ callback(element);
4377
+ }
4378
+
4379
+ var editMode = typeof window !== 'undefined' && window.location.pathname.indexOf('/editor/entries') === 0;
4380
+ var withShadowClassName = styles$l.withShadow;
4381
+
4382
+ global.pageflowScrolledRender = function (seed) {
4383
+ setupI18n(seed.i18n);
4384
+ browser.detectFeatures().then(function () {
4385
+ if (editMode) {
4386
+ loadInlineEditingComponents().then(function () {
4387
+ return render(seed);
4388
+ });
4389
+ } else {
4390
+ render(seed);
4391
+ }
4392
+ });
4393
+ };
4394
+
4395
+ function render(seed) {
4396
+ if (editMode) {
4397
+ ReactDOM.render(
4398
+ /*#__PURE__*/
4399
+ React.createElement(Root, {
4400
+ seed: seed
4401
+ }), document.getElementById('root'));
4402
+ } else {
4403
+ ReactDOM.hydrate(
4404
+ /*#__PURE__*/
4405
+ React.createElement(Root, {
4406
+ seed: seed
4407
+ }), document.getElementById('root'));
4408
+ }
4409
+ }
4410
+
4411
+ function Root(_ref) {
4412
+ var seed = _ref.seed;
4413
+ return (
4414
+ /*#__PURE__*/
4415
+ React.createElement(RootProviders, {
4416
+ seed: seed
4417
+ },
4418
+ /*#__PURE__*/
4419
+ React.createElement(AppHeader, null),
4420
+ /*#__PURE__*/
4421
+ React.createElement(Entry, null))
4422
+ );
4423
+ }
4424
+
4425
+ export { Atmo, AtmoContext, AtmoProvider, AudioPlayer, AudioPlayerControls, ClassicPlayerControls, EditableInlineText, Entry, Figure, Image, MediaInteractionTracking, MediaPlayer, MediaPlayerControls, PhonePlatformProvider, PlayerControls, Root, RootProviders, SectionThumbnail, VideoPlayer, VideoPlayerControls, ViewportDependentPillarBoxes, WaveformPlayerControls, getAvailableTransitionNames, getInitialPlayerState, getTransitionNames, playerStateReducer, processSources, registerTemplateWidgetType, useAtmo, useDarkBackground, usePlayerState, withShadowClassName };