hyrax 3.6.0 → 4.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (497) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +41 -61
  3. data/.dassie/Gemfile +4 -4
  4. data/.dassie/app/assets/javascripts/application.js +8 -4
  5. data/.dassie/app/assets/stylesheets/application.css +1 -1
  6. data/.dassie/app/assets/stylesheets/hyrax.scss +1 -2
  7. data/.dassie/app/controllers/application_controller.rb +1 -3
  8. data/.dassie/app/controllers/catalog_controller.rb +23 -19
  9. data/.dassie/app/models/user.rb +0 -3
  10. data/.dassie/config/analytics.yml +2 -4
  11. data/.dassie/config/application.rb +1 -1
  12. data/.dassie/config/initializers/riiif.rb +1 -1
  13. data/.dassie/db/schema.rb +5 -5
  14. data/.dassie/package.json +7 -7
  15. data/.engine_cart.yml +2 -39
  16. data/.env +1 -0
  17. data/.github/workflows/main.yml +17 -0
  18. data/.github/workflows/release.yml +17 -0
  19. data/.regen +1 -1
  20. data/.rubocop.yml +1 -1
  21. data/CONTRIBUTING.md +22 -24
  22. data/Dockerfile +1 -1
  23. data/Rakefile +0 -4
  24. data/app/actors/hyrax/actors/base_actor.rb +1 -1
  25. data/app/actors/hyrax/actors/collections_membership_actor.rb +1 -1
  26. data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +5 -11
  27. data/app/actors/hyrax/actors/embargo_actor.rb +4 -11
  28. data/app/actors/hyrax/actors/file_actor.rb +9 -37
  29. data/app/actors/hyrax/actors/file_set_actor.rb +13 -62
  30. data/app/actors/hyrax/actors/lease_actor.rb +4 -11
  31. data/app/assets/javascripts/hyrax/analytics_events.js +38 -88
  32. data/app/assets/javascripts/hyrax/app.js.erb +2 -2
  33. data/app/assets/javascripts/hyrax/batch.js +2 -2
  34. data/app/assets/javascripts/hyrax/batch_edit.js +4 -4
  35. data/app/assets/javascripts/hyrax/batch_select_all.js +13 -13
  36. data/app/assets/javascripts/hyrax/browse_everything.js +4 -2
  37. data/app/assets/javascripts/hyrax/collection_types.es6 +1 -1
  38. data/app/assets/javascripts/hyrax/collections/editor.es6 +5 -1
  39. data/app/assets/javascripts/hyrax/dashboard_actions.js +5 -5
  40. data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +3 -3
  41. data/app/assets/javascripts/hyrax/editor.es6 +3 -3
  42. data/app/assets/javascripts/hyrax/facets.js +6 -4
  43. data/app/assets/javascripts/hyrax/file_manager/member.es6 +1 -1
  44. data/app/assets/javascripts/hyrax/file_manager/save_manager.es6 +2 -2
  45. data/app/assets/javascripts/hyrax/file_manager/sorting.es6 +2 -2
  46. data/app/assets/javascripts/hyrax/file_manager.es6 +2 -17
  47. data/app/assets/javascripts/hyrax/notification.es6 +1 -1
  48. data/app/assets/javascripts/hyrax/permissions/control.es6 +1 -8
  49. data/app/assets/javascripts/hyrax/permissions/registry.es6 +4 -4
  50. data/app/assets/javascripts/hyrax/permissions/user_controls.es6 +3 -1
  51. data/app/assets/javascripts/hyrax/relationships/confirm_remove_dialog.es6 +1 -1
  52. data/app/assets/javascripts/hyrax/relationships/control.es6 +2 -2
  53. data/app/assets/javascripts/hyrax/relationships/registry_entry.es6 +1 -1
  54. data/app/assets/javascripts/hyrax/reports-buttons.js +9 -9
  55. data/app/assets/javascripts/hyrax/save_work/required_fields.es6 +1 -1
  56. data/app/assets/javascripts/hyrax/save_work/save_work_control.es6 +6 -6
  57. data/app/assets/javascripts/hyrax/save_work/uploaded_files.es6 +2 -2
  58. data/app/assets/javascripts/hyrax/single_use_links_manager.js +1 -1
  59. data/app/assets/javascripts/hyrax/skip_to_content.js +1 -1
  60. data/app/assets/javascripts/hyrax/sorting.js +1 -1
  61. data/app/assets/javascripts/hyrax/trophy.js +1 -1
  62. data/app/assets/javascripts/hyrax/uploader.js +3 -3
  63. data/app/assets/javascripts/hyrax.js +1 -19
  64. data/app/assets/stylesheets/_bootstrap-default-overrides.scss +4 -4
  65. data/app/assets/stylesheets/hyrax/_accessibility.scss +1 -1
  66. data/app/assets/stylesheets/hyrax/_badge.scss +7 -0
  67. data/app/assets/stylesheets/hyrax/_batch-edit.scss +8 -8
  68. data/app/assets/stylesheets/hyrax/_browse_everything_overrides.scss +1 -1
  69. data/app/assets/stylesheets/hyrax/_buttons.scss +31 -1
  70. data/app/assets/stylesheets/hyrax/_card.scss +10 -0
  71. data/app/assets/stylesheets/hyrax/_catalog.scss +22 -48
  72. data/app/assets/stylesheets/hyrax/_collection_types.scss +1 -1
  73. data/app/assets/stylesheets/hyrax/_collections.scss +13 -13
  74. data/app/assets/stylesheets/hyrax/_facets.scss +46 -0
  75. data/app/assets/stylesheets/hyrax/_featured.scss +1 -1
  76. data/app/assets/stylesheets/hyrax/_file-listing.scss +3 -3
  77. data/app/assets/stylesheets/hyrax/_file_manager.scss +17 -17
  78. data/app/assets/stylesheets/hyrax/_file_sets.scss +1 -1
  79. data/app/assets/stylesheets/hyrax/_file_upload.scss +4 -4
  80. data/app/assets/stylesheets/hyrax/_fixedsticky.scss +1 -1
  81. data/app/assets/stylesheets/hyrax/_footer.scss +3 -3
  82. data/app/assets/stylesheets/hyrax/_form-progress.scss +9 -9
  83. data/app/assets/stylesheets/hyrax/_form.scss +3 -4
  84. data/app/assets/stylesheets/hyrax/_forms.scss +62 -29
  85. data/app/assets/stylesheets/hyrax/_header.scss +0 -17
  86. data/app/assets/stylesheets/hyrax/_home-page.scss +13 -51
  87. data/app/assets/stylesheets/hyrax/_html.scss +11 -0
  88. data/app/assets/stylesheets/hyrax/_hyrax.scss +16 -14
  89. data/app/assets/stylesheets/hyrax/_nestable.scss +1 -1
  90. data/app/assets/stylesheets/hyrax/_select_work_type.scss +2 -2
  91. data/app/assets/stylesheets/hyrax/_styles.scss +9 -14
  92. data/app/assets/stylesheets/hyrax/_users.scss +2 -2
  93. data/app/assets/stylesheets/hyrax/_variables.scss +20 -1
  94. data/app/assets/stylesheets/hyrax/_work-show.scss +21 -13
  95. data/app/assets/stylesheets/hyrax/blacklight_gallery.scss +75 -2
  96. data/app/assets/stylesheets/hyrax/dashboard.scss +70 -95
  97. data/app/assets/stylesheets/hyrax/sidebar.scss +39 -19
  98. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +9 -0
  99. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +2 -11
  100. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +2 -11
  101. data/app/controllers/concerns/hyrax/manages_embargoes.rb +1 -13
  102. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +4 -9
  103. data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +2 -2
  104. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +1 -1
  105. data/app/controllers/hyrax/admin/strategies_controller.rb +1 -1
  106. data/app/controllers/hyrax/admin/workflows_controller.rb +3 -48
  107. data/app/controllers/hyrax/batch_edits_controller.rb +1 -1
  108. data/app/controllers/hyrax/dashboard/collections_controller.rb +2 -1
  109. data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +0 -32
  110. data/app/controllers/hyrax/downloads_controller.rb +1 -16
  111. data/app/controllers/hyrax/file_sets_controller.rb +4 -10
  112. data/app/controllers/hyrax/homepage_controller.rb +0 -1
  113. data/app/controllers/hyrax/my_controller.rb +0 -6
  114. data/app/controllers/hyrax/permissions_controller.rb +1 -1
  115. data/app/controllers/hyrax/single_use_links_controller.rb +1 -2
  116. data/app/controllers/hyrax/transfers_controller.rb +2 -0
  117. data/app/controllers/hyrax/workflow_actions_controller.rb +2 -3
  118. data/app/forms/hyrax/forms/collection_form.rb +1 -1
  119. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +0 -2
  120. data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
  121. data/app/forms/hyrax/forms/file_set_form.rb +35 -8
  122. data/app/forms/hyrax/forms/resource_form.rb +32 -36
  123. data/app/helpers/hyrax/embargo_helper.rb +0 -11
  124. data/app/helpers/hyrax/facets_helper.rb +150 -0
  125. data/app/helpers/hyrax/hyrax_helper_behavior.rb +5 -5
  126. data/app/helpers/hyrax/lease_helper.rb +0 -11
  127. data/app/indexers/hyrax/basic_metadata_indexer.rb +3 -9
  128. data/app/indexers/hyrax/pcdm_collection_indexer.rb +0 -1
  129. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +8 -2
  130. data/app/jobs/characterize_job.rb +4 -7
  131. data/app/jobs/content_event_job.rb +1 -1
  132. data/app/jobs/create_derivatives_job.rb +4 -2
  133. data/app/jobs/ingest_local_file_job.rb +5 -13
  134. data/app/jobs/inherit_permissions_job.rb +1 -5
  135. data/app/models/admin_set.rb +0 -8
  136. data/app/models/concerns/hyrax/collection_behavior.rb +2 -3
  137. data/app/models/concerns/hyrax/collection_nesting.rb +1 -10
  138. data/app/models/concerns/hyrax/file_set_behavior.rb +1 -2
  139. data/app/models/concerns/hyrax/in_admin_set.rb +0 -7
  140. data/app/models/concerns/hyrax/user.rb +3 -3
  141. data/app/models/concerns/hyrax/work_behavior.rb +1 -3
  142. data/app/models/content_block.rb +0 -6
  143. data/app/models/hyrax/embargo.rb +1 -1
  144. data/app/models/hyrax/file_metadata.rb +1 -1
  145. data/app/models/hyrax/file_set.rb +3 -3
  146. data/app/models/hyrax/lease.rb +1 -1
  147. data/app/models/hyrax/permission_template.rb +0 -35
  148. data/app/models/proxy_deposit_request.rb +1 -1
  149. data/app/presenters/hyrax/admin/repository_object_presenter.rb +0 -2
  150. data/app/presenters/hyrax/collapsable_section_presenter.rb +2 -2
  151. data/app/presenters/hyrax/collection_presenter.rb +1 -1
  152. data/app/presenters/hyrax/fixity_status_presenter.rb +2 -2
  153. data/app/presenters/hyrax/menu_presenter.rb +1 -1
  154. data/app/presenters/hyrax/permission_badge.rb +8 -9
  155. data/app/presenters/hyrax/version_list_presenter.rb +1 -6
  156. data/app/presenters/hyrax/workflow_presenter.rb +1 -1
  157. data/app/renderers/hyrax/renderers/external_link_attribute_renderer.rb +1 -1
  158. data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +5 -13
  159. data/app/search_builders/hyrax/deposit_search_builder.rb +1 -1
  160. data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +10 -1
  161. data/app/search_builders/hyrax/single_result.rb +1 -1
  162. data/app/search_builders/hyrax/stats/work_status_search_builder.rb +1 -1
  163. data/app/services/hyrax/adapters/nesting_index_adapter.rb +1 -1
  164. data/app/services/hyrax/analytics/google.rb +15 -23
  165. data/app/services/hyrax/analytics/matomo.rb +3 -4
  166. data/app/services/hyrax/collection_member_service.rb +1 -2
  167. data/app/services/hyrax/collections/nested_collection_query_service.rb +1 -1
  168. data/app/services/hyrax/collections/search_service.rb +0 -1
  169. data/app/services/hyrax/custom_queries.rb +25 -0
  170. data/app/services/hyrax/edit_permissions_service.rb +3 -21
  171. data/app/services/hyrax/embargo_manager.rb +0 -9
  172. data/app/services/hyrax/file_set_csv_service.rb +1 -1
  173. data/app/services/hyrax/graph_exporter.rb +3 -8
  174. data/app/services/hyrax/iiif_authorization_service.rb +1 -1
  175. data/app/services/hyrax/lease_manager.rb +0 -9
  176. data/app/services/hyrax/listeners/file_metadata_listener.rb +0 -11
  177. data/app/services/hyrax/search_service.rb +1 -81
  178. data/app/services/hyrax/solr_query_service.rb +4 -4
  179. data/app/services/hyrax/statistics/depositors/summary.rb +1 -3
  180. data/app/services/hyrax/user_stat_importer.rb +0 -2
  181. data/app/services/hyrax/valkyrie_upload.rb +13 -1
  182. data/app/services/hyrax/versioning_service.rb +9 -77
  183. data/app/services/hyrax/visibility_propagator.rb +5 -5
  184. data/app/services/hyrax/work_query_service.rb +1 -1
  185. data/app/services/hyrax/workflow/actionable_objects.rb +3 -28
  186. data/app/services/hyrax/workflow/permission_query.rb +2 -23
  187. data/app/services/hyrax/working_directory.rb +2 -0
  188. data/app/views/_controls.html.erb +14 -18
  189. data/app/views/_logo.html.erb +0 -1
  190. data/app/views/_masthead.html.erb +8 -18
  191. data/app/views/_user_util_links.html.erb +16 -18
  192. data/app/views/catalog/_document.html.erb +2 -2
  193. data/app/views/catalog/_document_list.html.erb +1 -1
  194. data/app/views/catalog/_facet_limit.html.erb +1 -1
  195. data/app/views/catalog/_index_gallery_collection_wrapper.html.erb +1 -1
  196. data/app/views/catalog/_index_header_list_collection.html.erb +2 -2
  197. data/app/views/catalog/_index_header_list_default.html.erb +1 -1
  198. data/app/views/catalog/_index_list_default.html.erb +7 -5
  199. data/app/views/catalog/_search_form.html.erb +13 -15
  200. data/app/views/catalog/_thumbnail_list_collection.html.erb +2 -2
  201. data/app/views/catalog/_thumbnail_list_default.html.erb +3 -3
  202. data/app/views/catalog/facet.html.erb +21 -0
  203. data/app/views/catalog/index.html.erb +6 -4
  204. data/app/views/hyrax/admin/admin_sets/_form.html.erb +16 -16
  205. data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +35 -33
  206. data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +9 -8
  207. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +24 -24
  208. data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +5 -5
  209. data/app/views/hyrax/admin/admin_sets/_show_actions.html.erb +3 -3
  210. data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +9 -9
  211. data/app/views/hyrax/admin/admin_sets/index.html.erb +3 -3
  212. data/app/views/hyrax/admin/admin_sets/show.html.erb +4 -4
  213. data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +3 -3
  214. data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +3 -3
  215. data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +3 -3
  216. data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +3 -3
  217. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +7 -7
  218. data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +7 -7
  219. data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +10 -10
  220. data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +3 -3
  221. data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +3 -3
  222. data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +3 -3
  223. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +5 -5
  224. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +7 -7
  225. data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +4 -4
  226. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +5 -5
  227. data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +8 -8
  228. data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +10 -10
  229. data/app/views/hyrax/admin/appearances/show.html.erb +2 -2
  230. data/app/views/hyrax/admin/collection_types/_form.html.erb +24 -23
  231. data/app/views/hyrax/admin/collection_types/_form_appearance.html.erb +2 -2
  232. data/app/views/hyrax/admin/collection_types/_form_participants.html.erb +4 -4
  233. data/app/views/hyrax/admin/collection_types/_form_settings.html.erb +9 -9
  234. data/app/views/hyrax/admin/collection_types/index.html.erb +6 -6
  235. data/app/views/hyrax/admin/features/index.html.erb +3 -3
  236. data/app/views/hyrax/admin/stats/_new_users.html.erb +1 -1
  237. data/app/views/hyrax/admin/stats/show.html.erb +4 -6
  238. data/app/views/hyrax/admin/users/index.html.erb +3 -3
  239. data/app/views/hyrax/admin/workflow_roles/index.html.erb +8 -8
  240. data/app/views/hyrax/admin/workflows/index.html.erb +80 -55
  241. data/app/views/hyrax/base/_citations.html.erb +6 -6
  242. data/app/views/hyrax/base/_currently_shared.html.erb +3 -3
  243. data/app/views/hyrax/base/_file_manager_actions.html.erb +5 -3
  244. data/app/views/hyrax/base/_file_manager_member.html.erb +5 -5
  245. data/app/views/hyrax/base/_file_manager_member_resource_options.html.erb +6 -6
  246. data/app/views/hyrax/base/_file_manager_members.html.erb +1 -1
  247. data/app/views/hyrax/base/_file_manager_thumbnail.html.erb +1 -1
  248. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +3 -3
  249. data/app/views/hyrax/base/_form_files.html.erb +9 -9
  250. data/app/views/hyrax/base/_form_member_of_collections.html.erb +3 -3
  251. data/app/views/hyrax/base/_form_metadata.html.erb +1 -1
  252. data/app/views/hyrax/base/_form_permission.html.erb +30 -20
  253. data/app/views/hyrax/base/_form_permission_under_embargo.html.erb +1 -1
  254. data/app/views/hyrax/base/_form_permission_under_lease.html.erb +1 -1
  255. data/app/views/hyrax/base/_form_progress.html.erb +7 -7
  256. data/app/views/hyrax/base/_form_relationships.html.erb +1 -1
  257. data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
  258. data/app/views/hyrax/base/_form_representative.html.erb +1 -1
  259. data/app/views/hyrax/base/_form_share.html.erb +6 -6
  260. data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
  261. data/app/views/hyrax/base/_form_visibility_component.html.erb +16 -20
  262. data/app/views/hyrax/base/_guts4form.html.erb +12 -20
  263. data/app/views/hyrax/base/_member.html.erb +1 -1
  264. data/app/views/hyrax/base/_metadata.html.erb +1 -1
  265. data/app/views/hyrax/base/_show_actions.html.erb +10 -10
  266. data/app/views/hyrax/base/_work_button_row.html.erb +17 -16
  267. data/app/views/hyrax/base/_workflow_actions.html.erb +10 -10
  268. data/app/views/hyrax/base/_workflow_actions_widget.erb +1 -1
  269. data/app/views/hyrax/base/file_manager.html.erb +4 -5
  270. data/app/views/hyrax/base/inspect_work.html.erb +1 -1
  271. data/app/views/hyrax/base/show.html.erb +12 -12
  272. data/app/views/hyrax/base/unavailable.html.erb +2 -2
  273. data/app/views/hyrax/batch_edits/_check_all.html.erb +0 -1
  274. data/app/views/hyrax/batch_edits/_delete_selected.html.erb +1 -1
  275. data/app/views/hyrax/batch_edits/edit.html.erb +26 -18
  276. data/app/views/hyrax/collections/_bookmark_control.html.erb +2 -2
  277. data/app/views/hyrax/collections/_list_collections.html.erb +6 -6
  278. data/app/views/hyrax/collections/_list_works.html.erb +3 -1
  279. data/app/views/hyrax/collections/_search_form.html.erb +4 -4
  280. data/app/views/hyrax/collections/_show_document_list_row.html.erb +5 -2
  281. data/app/views/hyrax/collections/_sort_and_per_page.html.erb +3 -3
  282. data/app/views/hyrax/collections/_view_type_group.html.erb +2 -2
  283. data/app/views/hyrax/contact_form/new.html.erb +12 -13
  284. data/app/views/hyrax/content_blocks/_form.html.erb +29 -23
  285. data/app/views/hyrax/content_blocks/templates/agreement.html.erb +3 -3
  286. data/app/views/hyrax/dashboard/_admin_sets.html.erb +22 -28
  287. data/app/views/hyrax/dashboard/_index_partials/_current_proxy_rights.html.erb +2 -2
  288. data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +4 -4
  289. data/app/views/hyrax/dashboard/_index_partials/_transfers.html.erb +2 -2
  290. data/app/views/hyrax/dashboard/_repository_growth.html.erb +28 -28
  291. data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +4 -4
  292. data/app/views/hyrax/dashboard/_sidebar.html.erb +3 -3
  293. data/app/views/hyrax/dashboard/_tabs.html.erb +6 -2
  294. data/app/views/hyrax/dashboard/_user_activity.html.erb +22 -19
  295. data/app/views/hyrax/dashboard/_visibility_graph.html.erb +4 -4
  296. data/app/views/hyrax/dashboard/_work_type_graph.html.erb +4 -4
  297. data/app/views/hyrax/dashboard/collections/_batch_edits_actions.html.erb +1 -1
  298. data/app/views/hyrax/dashboard/collections/_bookmark_control.html.erb +2 -2
  299. data/app/views/hyrax/dashboard/collections/_edit_actions.html.erb +1 -1
  300. data/app/views/hyrax/dashboard/collections/_form.html.erb +30 -22
  301. data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +19 -19
  302. data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +8 -4
  303. data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +7 -7
  304. data/app/views/hyrax/dashboard/collections/_form_share.html.erb +11 -9
  305. data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +34 -31
  306. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
  307. data/app/views/hyrax/dashboard/collections/_list_works.html.erb +3 -1
  308. data/app/views/hyrax/dashboard/collections/_modal_remove_from_collection.html.erb +1 -1
  309. data/app/views/hyrax/dashboard/collections/_modal_remove_sub_collection.html.erb +1 -1
  310. data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +1 -1
  311. data/app/views/hyrax/dashboard/collections/_show_descriptions.html.erb +5 -3
  312. data/app/views/hyrax/dashboard/collections/_show_document_list_menu.html.erb +4 -4
  313. data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +12 -10
  314. data/app/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb +2 -2
  315. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +4 -4
  316. data/app/views/hyrax/dashboard/collections/_subcollection_list.html.erb +1 -1
  317. data/app/views/hyrax/dashboard/collections/_work_action_menu.html.erb +10 -10
  318. data/app/views/hyrax/dashboard/collections/show.html.erb +4 -4
  319. data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +21 -21
  320. data/app/views/hyrax/dashboard/profiles/_trophy_edit.html.erb +5 -5
  321. data/app/views/hyrax/dashboard/profiles/_zotero.html.erb +2 -2
  322. data/app/views/hyrax/dashboard/profiles/edit.html.erb +2 -2
  323. data/app/views/hyrax/dashboard/profiles/show.html.erb +3 -3
  324. data/app/views/hyrax/dashboard/show_admin.html.erb +36 -34
  325. data/app/views/hyrax/dashboard/show_user.html.erb +16 -16
  326. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +11 -11
  327. data/app/views/hyrax/dashboard/sidebar/_configuration.html.erb +8 -8
  328. data/app/views/hyrax/dashboard/sidebar/_repository_content.html.erb +3 -1
  329. data/app/views/hyrax/dashboard/sidebar/_tasks.html.erb +5 -1
  330. data/app/views/hyrax/dashboard/works/_list_works.html.erb +4 -1
  331. data/app/views/hyrax/depositors/index.html.erb +2 -2
  332. data/app/views/hyrax/embargoes/edit.html.erb +14 -14
  333. data/app/views/hyrax/embargoes/index.html.erb +18 -6
  334. data/app/views/hyrax/file_sets/_actions.html.erb +5 -6
  335. data/app/views/hyrax/file_sets/_descriptions.html.erb +1 -1
  336. data/app/views/hyrax/file_sets/_extra_fields_modal.html.erb +1 -1
  337. data/app/views/hyrax/file_sets/_form.html.erb +1 -1
  338. data/app/views/hyrax/file_sets/_permission.html.erb +1 -1
  339. data/app/views/hyrax/file_sets/_permission_form.html.erb +39 -30
  340. data/app/views/hyrax/file_sets/_show_actions.html.erb +3 -3
  341. data/app/views/hyrax/file_sets/_show_details.html.erb +27 -17
  342. data/app/views/hyrax/file_sets/_single_use_link_rows.html.erb +2 -2
  343. data/app/views/hyrax/file_sets/_single_use_links.html.erb +2 -2
  344. data/app/views/hyrax/file_sets/_versioning.html.erb +9 -9
  345. data/app/views/hyrax/file_sets/edit.html.erb +19 -13
  346. data/app/views/hyrax/file_sets/media_display/_image.html.erb +4 -4
  347. data/app/views/hyrax/file_sets/show.html.erb +2 -2
  348. data/app/views/hyrax/homepage/_announcement.html.erb +2 -2
  349. data/app/views/hyrax/homepage/_explore_collections.html.erb +6 -4
  350. data/app/views/hyrax/homepage/_featured_fields.html.erb +1 -1
  351. data/app/views/hyrax/homepage/_featured_works.html.erb +1 -1
  352. data/app/views/hyrax/homepage/_home_content.html.erb +24 -10
  353. data/app/views/hyrax/homepage/_marketing.html.erb +1 -1
  354. data/app/views/hyrax/homepage/_recent_document.html.erb +4 -1
  355. data/app/views/hyrax/homepage/_sortable_featured.html.erb +3 -3
  356. data/app/views/hyrax/homepage/index.html.erb +4 -4
  357. data/app/views/hyrax/leases/edit.html.erb +14 -14
  358. data/app/views/hyrax/leases/index.html.erb +18 -6
  359. data/app/views/hyrax/my/_admin_set_action_menu.html.erb +5 -5
  360. data/app/views/hyrax/my/_collection_action_menu.html.erb +6 -6
  361. data/app/views/hyrax/my/_constraints.html.erb +2 -2
  362. data/app/views/hyrax/my/_document_list.html.erb +1 -1
  363. data/app/views/hyrax/my/_facet_layout.html.erb +1 -2
  364. data/app/views/hyrax/my/_facet_limit.html.erb +4 -4
  365. data/app/views/hyrax/my/_facet_pagination.html.erb +1 -25
  366. data/app/views/hyrax/my/_facet_pivot.html.erb +1 -1
  367. data/app/views/hyrax/my/_facet_selected.html.erb +1 -1
  368. data/app/views/hyrax/my/_search_form.html.erb +7 -8
  369. data/app/views/hyrax/my/_sort_and_per_page.html.erb +10 -12
  370. data/app/views/hyrax/my/_work_action_menu.html.erb +4 -5
  371. data/app/views/hyrax/my/collections/_facets.html.erb +2 -2
  372. data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
  373. data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +2 -2
  374. data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +2 -2
  375. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +5 -5
  376. data/app/views/hyrax/my/collections/_modal_delete_collection.html.erb +1 -1
  377. data/app/views/hyrax/my/collections/_modal_delete_empty_collection.html.erb +1 -1
  378. data/app/views/hyrax/my/collections/_modal_delete_selected_collections.html.erb +1 -1
  379. data/app/views/hyrax/my/collections/_tabs.html.erb +11 -4
  380. data/app/views/hyrax/my/collections/index.html.erb +3 -3
  381. data/app/views/hyrax/my/facet.html.erb +17 -16
  382. data/app/views/hyrax/my/index.html.erb +2 -2
  383. data/app/views/hyrax/my/works/_batch_actions.html.erb +1 -1
  384. data/app/views/hyrax/my/works/_facets.html.erb +2 -2
  385. data/app/views/hyrax/my/works/_list_works.html.erb +6 -7
  386. data/app/views/hyrax/my/works/_tabs.html.erb +6 -6
  387. data/app/views/hyrax/my/works/index.html.erb +20 -18
  388. data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
  389. data/app/views/hyrax/notifications/index.html.erb +4 -4
  390. data/app/views/hyrax/operations/index.html.erb +1 -1
  391. data/app/views/hyrax/operations/show.html.erb +2 -2
  392. data/app/views/hyrax/pages/_form.html.erb +76 -64
  393. data/app/views/hyrax/permissions/confirm.html.erb +4 -4
  394. data/app/views/hyrax/permissions/confirm_access.html.erb +4 -4
  395. data/app/views/hyrax/stats/file.html.erb +1 -1
  396. data/app/views/hyrax/stats/work.html.erb +1 -1
  397. data/app/views/hyrax/transfers/_received.html.erb +4 -4
  398. data/app/views/hyrax/transfers/index.html.erb +8 -8
  399. data/app/views/hyrax/transfers/new.html.erb +1 -1
  400. data/app/views/hyrax/uploads/_js_templates.html.erb +14 -14
  401. data/app/views/hyrax/uploads/_js_templates_branding.html.erb +5 -5
  402. data/app/views/hyrax/uploads/_js_templates_versioning.html.erb +15 -15
  403. data/app/views/hyrax/users/_activity.html.erb +3 -3
  404. data/app/views/hyrax/users/_contributions.html.erb +3 -3
  405. data/app/views/hyrax/users/_left_sidebar.html.erb +1 -1
  406. data/app/views/hyrax/users/_profile_tabs.html.erb +16 -8
  407. data/app/views/hyrax/users/_search_form.html.erb +2 -2
  408. data/app/views/hyrax/users/_user.html.erb +5 -5
  409. data/app/views/hyrax/users/_user_info.html.erb +4 -4
  410. data/app/views/hyrax/users/_vitals.html.erb +3 -3
  411. data/app/views/hyrax/users/show.html.erb +2 -2
  412. data/app/views/layouts/_head_tag_content.html.erb +2 -5
  413. data/app/views/layouts/hyrax/dashboard.html.erb +4 -4
  414. data/app/views/layouts/hyrax.html.erb +4 -3
  415. data/app/views/shared/_appearance_styles.html.erb +8 -8
  416. data/app/views/shared/_footer.html.erb +1 -1
  417. data/app/views/shared/_locale_picker.html.erb +5 -8
  418. data/app/views/shared/_nav_safety_modal.html.erb +2 -2
  419. data/app/views/shared/_select_work_type_modal.html.erb +2 -2
  420. data/config/locales/hyrax.de.yml +5 -6
  421. data/config/locales/hyrax.en.yml +4 -15
  422. data/config/locales/hyrax.es.yml +6 -7
  423. data/config/locales/hyrax.fr.yml +8 -9
  424. data/config/locales/hyrax.it.yml +6 -7
  425. data/config/locales/hyrax.pt-BR.yml +6 -7
  426. data/config/locales/hyrax.zh.yml +6 -7
  427. data/docker-compose.yml +2 -1
  428. data/documentation/developing-your-hyrax-based-app.md +2 -2
  429. data/documentation/legacyREADME.md +3 -3
  430. data/hyrax.gemspec +13 -24
  431. data/karma.conf.js +104 -0
  432. data/lib/generators/hyrax/assets_generator.rb +2 -5
  433. data/lib/generators/hyrax/install_generator.rb +9 -33
  434. data/lib/generators/hyrax/templates/catalog_controller.rb +20 -13
  435. data/lib/generators/hyrax/templates/config/analytics.yml +0 -3
  436. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +1 -1
  437. data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +1 -1
  438. data/lib/generators/hyrax/templates/hyrax.scss +1 -2
  439. data/lib/generators/hyrax/templates/package.json +7 -8
  440. data/lib/hyrax/active_fedora_dummy_model.rb +0 -13
  441. data/lib/hyrax/configuration.rb +2 -49
  442. data/lib/hyrax/engine.rb +1 -2
  443. data/lib/hyrax/errors.rb +0 -2
  444. data/lib/hyrax/publisher.rb +0 -4
  445. data/lib/hyrax/specs/capybara.rb +5 -3
  446. data/lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb +0 -6
  447. data/lib/hyrax/specs/shared_specs/indexers.rb +0 -5
  448. data/lib/hyrax/transactions/container.rb +0 -54
  449. data/lib/hyrax/version.rb +1 -1
  450. data/lib/valkyrie/indexing/solr/indexing_adapter.rb +1 -1
  451. data/lib/wings/valkyrie/persister.rb +2 -1
  452. data/lib/wings/valkyrie/storage.rb +2 -6
  453. data/package.json +11 -0
  454. data/tasks/hyrax_dev.rake +32 -0
  455. data/template.rb +1 -1
  456. data/vendor/assets/javascripts/dataTables.bootstrap4.js +184 -0
  457. data/vendor/assets/javascripts/fileupload/jquery.fileupload-ui.js +1 -1
  458. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +2 -2
  459. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +1 -1
  460. data/vendor/assets/javascripts/handlebars.js +5214 -0
  461. data/vendor/assets/javascripts/jquery-ui.js +19057 -0
  462. data/vendor/assets/javascripts/jquery.dataTables.js +15336 -0
  463. data/vendor/assets/javascripts/morris/morris.min.js +9 -1
  464. data/vendor/assets/javascripts/morris/raphael-min.js +4 -6
  465. data/vendor/assets/javascripts/nestable.js +1 -1
  466. data/vendor/assets/stylesheets/dataTables.bootstrap4.css +307 -0
  467. data/vendor/assets/stylesheets/jquery-ui.css +1315 -0
  468. data/vendor/assets/stylesheets/morris.css +3 -0
  469. metadata +95 -218
  470. data/app/actors/hyrax/actors/initialize_workflow_actor.rb +0 -35
  471. data/app/forms/hyrax/forms/embargo.rb +0 -13
  472. data/app/forms/hyrax/forms/lease.rb +0 -13
  473. data/app/forms/hyrax/forms/pcdm_object_form.rb +0 -46
  474. data/app/forms/hyrax/forms/work_embargo_form.rb +0 -35
  475. data/app/forms/hyrax/forms/work_lease_form.rb +0 -35
  476. data/app/helpers/hyrax/url_helper.rb +0 -13
  477. data/app/jobs/content_depositor_change_event_job.rb +0 -48
  478. data/app/models/concerns/hyrax/with_file_sets.rb +0 -17
  479. data/app/services/hyrax/analytics/ga4.rb +0 -204
  480. data/app/services/hyrax/file_set_file_service.rb +0 -55
  481. data/app/services/hyrax/work_resource_query_service.rb +0 -45
  482. data/app/views/hyrax/admin/workflows/_tabs.html.erb +0 -9
  483. data/app/views/shared/_ga4.html.erb +0 -10
  484. data/config/metadata/file_set_metadata.yaml +0 -130
  485. data/lib/hyrax/transactions/create_work.rb +0 -65
  486. data/lib/hyrax/transactions/destroy_work.rb +0 -28
  487. data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +0 -34
  488. data/lib/hyrax/transactions/steps/apply_permission_template.rb +0 -32
  489. data/lib/hyrax/transactions/steps/apply_visibility.rb +0 -41
  490. data/lib/hyrax/transactions/steps/destroy_work.rb +0 -27
  491. data/lib/hyrax/transactions/steps/ensure_permission_template.rb +0 -29
  492. data/lib/hyrax/transactions/steps/save_work.rb +0 -38
  493. data/lib/hyrax/transactions/update_work.rb +0 -19
  494. data/lib/wings/services/file_converter_service.rb +0 -19
  495. data/lib/wings/services/file_metadata_builder.rb +0 -94
  496. data/vendor/assets/javascripts/handlebars-v4.0.5.js +0 -4612
  497. data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +0 -2
@@ -1,4612 +0,0 @@
1
- /* Note this has been modified from it's original in order to work around
2
- https://github.com/wycats/handlebars.js/issues/1335
3
- /*
4
-
5
- /*!
6
-
7
- handlebars v4.0.5
8
-
9
- Copyright (C) 2011-2015 by Yehuda Katz
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in
19
- all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
- THE SOFTWARE.
28
-
29
- @license
30
- */
31
- (function webpackUniversalModuleDefinition(root, factory) {
32
- if(typeof exports === 'object' && typeof module === 'object')
33
- module.exports = factory();
34
- else if(typeof define === 'function' && define.amd)
35
- define('handlebars', [], factory);
36
- else if(typeof exports === 'object')
37
- exports["Handlebars"] = factory();
38
- else
39
- root["Handlebars"] = factory();
40
- })(this, function() {
41
- return /******/ (function(modules) { // webpackBootstrap
42
- /******/ // The module cache
43
- /******/ var installedModules = {};
44
-
45
- /******/ // The require function
46
- /******/ function __webpack_require__(moduleId) {
47
-
48
- /******/ // Check if module is in cache
49
- /******/ if(installedModules[moduleId])
50
- /******/ return installedModules[moduleId].exports;
51
-
52
- /******/ // Create a new module (and put it into the cache)
53
- /******/ var module = installedModules[moduleId] = {
54
- /******/ exports: {},
55
- /******/ id: moduleId,
56
- /******/ loaded: false
57
- /******/ };
58
-
59
- /******/ // Execute the module function
60
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
61
-
62
- /******/ // Flag the module as loaded
63
- /******/ module.loaded = true;
64
-
65
- /******/ // Return the exports of the module
66
- /******/ return module.exports;
67
- /******/ }
68
-
69
-
70
- /******/ // expose the modules object (__webpack_modules__)
71
- /******/ __webpack_require__.m = modules;
72
-
73
- /******/ // expose the module cache
74
- /******/ __webpack_require__.c = installedModules;
75
-
76
- /******/ // __webpack_public_path__
77
- /******/ __webpack_require__.p = "";
78
-
79
- /******/ // Load entry module and return exports
80
- /******/ return __webpack_require__(0);
81
- /******/ })
82
- /************************************************************************/
83
- /******/ ([
84
- /* 0 */
85
- /***/ function(module, exports, __webpack_require__) {
86
-
87
- 'use strict';
88
-
89
- var _interopRequireDefault = __webpack_require__(1)['default'];
90
-
91
- exports.__esModule = true;
92
-
93
- var _handlebarsRuntime = __webpack_require__(2);
94
-
95
- var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime);
96
-
97
- // Compiler imports
98
-
99
- var _handlebarsCompilerAst = __webpack_require__(21);
100
-
101
- var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst);
102
-
103
- var _handlebarsCompilerBase = __webpack_require__(22);
104
-
105
- var _handlebarsCompilerCompiler = __webpack_require__(27);
106
-
107
- var _handlebarsCompilerJavascriptCompiler = __webpack_require__(28);
108
-
109
- var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler);
110
-
111
- var _handlebarsCompilerVisitor = __webpack_require__(25);
112
-
113
- var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor);
114
-
115
- var _handlebarsNoConflict = __webpack_require__(20);
116
-
117
- var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
118
-
119
- var _create = _handlebarsRuntime2['default'].create;
120
- function create() {
121
- var hb = _create();
122
-
123
- hb.compile = function (input, options) {
124
- return _handlebarsCompilerCompiler.compile(input, options, hb);
125
- };
126
- hb.precompile = function (input, options) {
127
- return _handlebarsCompilerCompiler.precompile(input, options, hb);
128
- };
129
-
130
- hb.AST = _handlebarsCompilerAst2['default'];
131
- hb.Compiler = _handlebarsCompilerCompiler.Compiler;
132
- hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default'];
133
- hb.Parser = _handlebarsCompilerBase.parser;
134
- hb.parse = _handlebarsCompilerBase.parse;
135
-
136
- return hb;
137
- }
138
-
139
- var inst = create();
140
- inst.create = create;
141
-
142
- _handlebarsNoConflict2['default'](inst);
143
-
144
- inst.Visitor = _handlebarsCompilerVisitor2['default'];
145
-
146
- inst['default'] = inst;
147
-
148
- exports['default'] = inst;
149
- module.exports = exports['default'];
150
-
151
- /***/ },
152
- /* 1 */
153
- /***/ function(module, exports) {
154
-
155
- "use strict";
156
-
157
- exports["default"] = function (obj) {
158
- return obj && obj.__esModule ? obj : {
159
- "default": obj
160
- };
161
- };
162
-
163
- exports.__esModule = true;
164
-
165
- /***/ },
166
- /* 2 */
167
- /***/ function(module, exports, __webpack_require__) {
168
-
169
- 'use strict';
170
-
171
- var _interopRequireWildcard = __webpack_require__(3)['default'];
172
-
173
- var _interopRequireDefault = __webpack_require__(1)['default'];
174
-
175
- exports.__esModule = true;
176
-
177
- var _handlebarsBase = __webpack_require__(4);
178
-
179
- var base = _interopRequireWildcard(_handlebarsBase);
180
-
181
- // Each of these augment the Handlebars object. No need to setup here.
182
- // (This is done to easily share code between commonjs and browse envs)
183
-
184
- var _handlebarsSafeString = __webpack_require__(18);
185
-
186
- var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
187
-
188
- var _handlebarsException = __webpack_require__(6);
189
-
190
- var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
191
-
192
- var _handlebarsUtils = __webpack_require__(5);
193
-
194
- var Utils = _interopRequireWildcard(_handlebarsUtils);
195
-
196
- var _handlebarsRuntime = __webpack_require__(19);
197
-
198
- var runtime = _interopRequireWildcard(_handlebarsRuntime);
199
-
200
- var _handlebarsNoConflict = __webpack_require__(20);
201
-
202
- var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
203
-
204
- // For compatibility and usage outside of module systems, make the Handlebars object a namespace
205
- function create() {
206
- var hb = new base.HandlebarsEnvironment();
207
-
208
- Utils.extend(hb, base);
209
- hb.SafeString = _handlebarsSafeString2['default'];
210
- hb.Exception = _handlebarsException2['default'];
211
- hb.Utils = Utils;
212
- hb.escapeExpression = Utils.escapeExpression;
213
-
214
- hb.VM = runtime;
215
- hb.template = function (spec) {
216
- return runtime.template(spec, hb);
217
- };
218
-
219
- return hb;
220
- }
221
-
222
- var inst = create();
223
- inst.create = create;
224
-
225
- _handlebarsNoConflict2['default'](inst);
226
-
227
- inst['default'] = inst;
228
-
229
- exports['default'] = inst;
230
- module.exports = exports['default'];
231
-
232
- /***/ },
233
- /* 3 */
234
- /***/ function(module, exports) {
235
-
236
- "use strict";
237
-
238
- exports["default"] = function (obj) {
239
- if (obj && obj.__esModule) {
240
- return obj;
241
- } else {
242
- var newObj = {};
243
-
244
- if (obj != null) {
245
- for (var key in obj) {
246
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
247
- }
248
- }
249
-
250
- newObj["default"] = obj;
251
- return newObj;
252
- }
253
- };
254
-
255
- exports.__esModule = true;
256
-
257
- /***/ },
258
- /* 4 */
259
- /***/ function(module, exports, __webpack_require__) {
260
-
261
- 'use strict';
262
-
263
- var _interopRequireDefault = __webpack_require__(1)['default'];
264
-
265
- exports.__esModule = true;
266
- exports.HandlebarsEnvironment = HandlebarsEnvironment;
267
-
268
- var _utils = __webpack_require__(5);
269
-
270
- var _exception = __webpack_require__(6);
271
-
272
- var _exception2 = _interopRequireDefault(_exception);
273
-
274
- var _helpers = __webpack_require__(7);
275
-
276
- var _decorators = __webpack_require__(15);
277
-
278
- var _logger = __webpack_require__(17);
279
-
280
- var _logger2 = _interopRequireDefault(_logger);
281
-
282
- var VERSION = '4.0.5';
283
- exports.VERSION = VERSION;
284
- var COMPILER_REVISION = 7;
285
-
286
- exports.COMPILER_REVISION = COMPILER_REVISION;
287
- var REVISION_CHANGES = {
288
- 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
289
- 2: '== 1.0.0-rc.3',
290
- 3: '== 1.0.0-rc.4',
291
- 4: '== 1.x.x',
292
- 5: '== 2.0.0-alpha.x',
293
- 6: '>= 2.0.0-beta.1',
294
- 7: '>= 4.0.0'
295
- };
296
-
297
- exports.REVISION_CHANGES = REVISION_CHANGES;
298
- var objectType = '[object Object]';
299
-
300
- function HandlebarsEnvironment(helpers, partials, decorators) {
301
- this.helpers = helpers || {};
302
- this.partials = partials || {};
303
- this.decorators = decorators || {};
304
-
305
- _helpers.registerDefaultHelpers(this);
306
- _decorators.registerDefaultDecorators(this);
307
- }
308
-
309
- HandlebarsEnvironment.prototype = {
310
- constructor: HandlebarsEnvironment,
311
-
312
- logger: _logger2['default'],
313
- log: _logger2['default'].log,
314
-
315
- registerHelper: function registerHelper(name, fn) {
316
- if (_utils.toString.call(name) === objectType) {
317
- if (fn) {
318
- throw new _exception2['default']('Arg not supported with multiple helpers');
319
- }
320
- _utils.extend(this.helpers, name);
321
- } else {
322
- this.helpers[name] = fn;
323
- }
324
- },
325
- unregisterHelper: function unregisterHelper(name) {
326
- delete this.helpers[name];
327
- },
328
-
329
- registerPartial: function registerPartial(name, partial) {
330
- if (_utils.toString.call(name) === objectType) {
331
- _utils.extend(this.partials, name);
332
- } else {
333
- if (typeof partial === 'undefined') {
334
- throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined');
335
- }
336
- this.partials[name] = partial;
337
- }
338
- },
339
- unregisterPartial: function unregisterPartial(name) {
340
- delete this.partials[name];
341
- },
342
-
343
- registerDecorator: function registerDecorator(name, fn) {
344
- if (_utils.toString.call(name) === objectType) {
345
- if (fn) {
346
- throw new _exception2['default']('Arg not supported with multiple decorators');
347
- }
348
- _utils.extend(this.decorators, name);
349
- } else {
350
- this.decorators[name] = fn;
351
- }
352
- },
353
- unregisterDecorator: function unregisterDecorator(name) {
354
- delete this.decorators[name];
355
- }
356
- };
357
-
358
- var log = _logger2['default'].log;
359
-
360
- exports.log = log;
361
- exports.createFrame = _utils.createFrame;
362
- exports.logger = _logger2['default'];
363
-
364
- /***/ },
365
- /* 5 */
366
- /***/ function(module, exports) {
367
-
368
- 'use strict';
369
-
370
- exports.__esModule = true;
371
- exports.extend = extend;
372
- exports.indexOf = indexOf;
373
- exports.escapeExpression = escapeExpression;
374
- exports.isEmpty = isEmpty;
375
- exports.createFrame = createFrame;
376
- exports.blockParams = blockParams;
377
- exports.appendContextPath = appendContextPath;
378
- var escape = {
379
- '&': '&amp;',
380
- '<': '&lt;',
381
- '>': '&gt;',
382
- '"': '&quot;',
383
- "'": '&#x27;',
384
- '`': '&#x60;',
385
- '=': '&#x3D;'
386
- };
387
-
388
- var badChars = /[&<>"'`=]/g,
389
- possible = /[&<>"'`=]/;
390
-
391
- function escapeChar(chr) {
392
- return escape[chr];
393
- }
394
-
395
- function extend(obj /* , ...source */) {
396
- for (var i = 1; i < arguments.length; i++) {
397
- for (var key in arguments[i]) {
398
- if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
399
- obj[key] = arguments[i][key];
400
- }
401
- }
402
- }
403
-
404
- return obj;
405
- }
406
-
407
- var toString = Object.prototype.toString;
408
-
409
- exports.toString = toString;
410
- // Sourced from lodash
411
- // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
412
- /* eslint-disable func-style */
413
- var isFunction = function isFunction(value) {
414
- return typeof value === 'function';
415
- };
416
- // fallback for older versions of Chrome and Safari
417
- /* istanbul ignore next */
418
- if (isFunction(/x/)) {
419
- exports.isFunction = isFunction = function (value) {
420
- return typeof value === 'function' && toString.call(value) === '[object Function]';
421
- };
422
- }
423
- exports.isFunction = isFunction;
424
-
425
- /* eslint-enable func-style */
426
-
427
- /* istanbul ignore next */
428
- var isArray = Array.isArray || function (value) {
429
- return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
430
- };
431
-
432
- exports.isArray = isArray;
433
- // Older IE versions do not directly support indexOf so we must implement our own, sadly.
434
-
435
- function indexOf(array, value) {
436
- for (var i = 0, len = array.length; i < len; i++) {
437
- if (array[i] === value) {
438
- return i;
439
- }
440
- }
441
- return -1;
442
- }
443
-
444
- function escapeExpression(string) {
445
- if (typeof string !== 'string') {
446
- // don't escape SafeStrings, since they're already safe
447
- if (string && string.toHTML) {
448
- return string.toHTML();
449
- } else if (string == null) {
450
- return '';
451
- } else if (!string) {
452
- return string + '';
453
- }
454
-
455
- // Force a string conversion as this will be done by the append regardless and
456
- // the regex test will do this transparently behind the scenes, causing issues if
457
- // an object's to string has escaped characters in it.
458
- string = '' + string;
459
- }
460
-
461
- if (!possible.test(string)) {
462
- return string;
463
- }
464
- return string.replace(badChars, escapeChar);
465
- }
466
-
467
- function isEmpty(value) {
468
- if (!value && value !== 0) {
469
- return true;
470
- } else if (isArray(value) && value.length === 0) {
471
- return true;
472
- } else {
473
- return false;
474
- }
475
- }
476
-
477
- function createFrame(object) {
478
- var frame = extend({}, object);
479
- frame._parent = object;
480
- return frame;
481
- }
482
-
483
- function blockParams(params, ids) {
484
- params.path = ids;
485
- return params;
486
- }
487
-
488
- function appendContextPath(contextPath, id) {
489
- return (contextPath ? contextPath + '.' : '') + id;
490
- }
491
-
492
- /***/ },
493
- /* 6 */
494
- /***/ function(module, exports) {
495
-
496
- 'use strict';
497
-
498
- exports.__esModule = true;
499
-
500
- var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
501
-
502
- function Exception(message, node) {
503
- var loc = node && node.loc,
504
- line = undefined,
505
- column = undefined;
506
- if (loc) {
507
- line = loc.start.line;
508
- column = loc.start.column;
509
-
510
- message += ' - ' + line + ':' + column;
511
- }
512
-
513
- var tmp = Error.prototype.constructor.call(this, message);
514
-
515
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
516
- for (var idx = 0; idx < errorProps.length; idx++) {
517
- this[errorProps[idx]] = tmp[errorProps[idx]];
518
- }
519
-
520
- /* istanbul ignore else */
521
- if (Error.captureStackTrace) {
522
- Error.captureStackTrace(this, Exception);
523
- }
524
-
525
- if (loc) {
526
- this.lineNumber = line;
527
- this.column = column;
528
- }
529
- }
530
-
531
- Exception.prototype = new Error();
532
-
533
- exports['default'] = Exception;
534
- module.exports = exports['default'];
535
-
536
- /***/ },
537
- /* 7 */
538
- /***/ function(module, exports, __webpack_require__) {
539
-
540
- 'use strict';
541
-
542
- var _interopRequireDefault = __webpack_require__(1)['default'];
543
-
544
- exports.__esModule = true;
545
- exports.registerDefaultHelpers = registerDefaultHelpers;
546
-
547
- var _helpersBlockHelperMissing = __webpack_require__(8);
548
-
549
- var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing);
550
-
551
- var _helpersEach = __webpack_require__(9);
552
-
553
- var _helpersEach2 = _interopRequireDefault(_helpersEach);
554
-
555
- var _helpersHelperMissing = __webpack_require__(10);
556
-
557
- var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing);
558
-
559
- var _helpersIf = __webpack_require__(11);
560
-
561
- var _helpersIf2 = _interopRequireDefault(_helpersIf);
562
-
563
- var _helpersLog = __webpack_require__(12);
564
-
565
- var _helpersLog2 = _interopRequireDefault(_helpersLog);
566
-
567
- var _helpersLookup = __webpack_require__(13);
568
-
569
- var _helpersLookup2 = _interopRequireDefault(_helpersLookup);
570
-
571
- var _helpersWith = __webpack_require__(14);
572
-
573
- var _helpersWith2 = _interopRequireDefault(_helpersWith);
574
-
575
- function registerDefaultHelpers(instance) {
576
- _helpersBlockHelperMissing2['default'](instance);
577
- _helpersEach2['default'](instance);
578
- _helpersHelperMissing2['default'](instance);
579
- _helpersIf2['default'](instance);
580
- _helpersLog2['default'](instance);
581
- _helpersLookup2['default'](instance);
582
- _helpersWith2['default'](instance);
583
- }
584
-
585
- /***/ },
586
- /* 8 */
587
- /***/ function(module, exports, __webpack_require__) {
588
-
589
- 'use strict';
590
-
591
- exports.__esModule = true;
592
-
593
- var _utils = __webpack_require__(5);
594
-
595
- exports['default'] = function (instance) {
596
- instance.registerHelper('blockHelperMissing', function (context, options) {
597
- var inverse = options.inverse,
598
- fn = options.fn;
599
-
600
- if (context === true) {
601
- return fn(this);
602
- } else if (context === false || context == null) {
603
- return inverse(this);
604
- } else if (_utils.isArray(context)) {
605
- if (context.length > 0) {
606
- if (options.ids) {
607
- options.ids = [options.name];
608
- }
609
-
610
- return instance.helpers.each(context, options);
611
- } else {
612
- return inverse(this);
613
- }
614
- } else {
615
- if (options.data && options.ids) {
616
- var data = _utils.createFrame(options.data);
617
- data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
618
- options = { data: data };
619
- }
620
-
621
- return fn(context, options);
622
- }
623
- });
624
- };
625
-
626
- module.exports = exports['default'];
627
-
628
- /***/ },
629
- /* 9 */
630
- /***/ function(module, exports, __webpack_require__) {
631
-
632
- 'use strict';
633
-
634
- var _interopRequireDefault = __webpack_require__(1)['default'];
635
-
636
- exports.__esModule = true;
637
-
638
- var _utils = __webpack_require__(5);
639
-
640
- var _exception = __webpack_require__(6);
641
-
642
- var _exception2 = _interopRequireDefault(_exception);
643
-
644
- exports['default'] = function (instance) {
645
- instance.registerHelper('each', function (context, options) {
646
- if (!options) {
647
- throw new _exception2['default']('Must pass iterator to #each');
648
- }
649
-
650
- var fn = options.fn,
651
- inverse = options.inverse,
652
- i = 0,
653
- ret = '',
654
- data = undefined,
655
- contextPath = undefined;
656
-
657
- if (options.data && options.ids) {
658
- contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
659
- }
660
-
661
- if (_utils.isFunction(context)) {
662
- context = context.call(this);
663
- }
664
-
665
- if (options.data) {
666
- data = _utils.createFrame(options.data);
667
- }
668
-
669
- function execIteration(field, index, last) {
670
- if (data) {
671
- data.key = field;
672
- data.index = index;
673
- data.first = index === 0;
674
- data.last = !!last;
675
-
676
- if (contextPath) {
677
- data.contextPath = contextPath + field;
678
- }
679
- }
680
-
681
- ret = ret + fn(context[field], {
682
- data: data,
683
- blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
684
- });
685
- }
686
-
687
- if (context && typeof context === 'object') {
688
- if (_utils.isArray(context)) {
689
- for (var j = context.length; i < j; i++) {
690
- if (i in context) {
691
- execIteration(i, i, i === context.length - 1);
692
- }
693
- }
694
- } else {
695
- var priorKey = undefined;
696
-
697
- for (var key in context) {
698
- if (context.hasOwnProperty(key)) {
699
- // We're running the iterations one step out of sync so we can detect
700
- // the last iteration without have to scan the object twice and create
701
- // an itermediate keys array.
702
- if (priorKey !== undefined) {
703
- execIteration(priorKey, i - 1);
704
- }
705
- priorKey = key;
706
- i++;
707
- }
708
- }
709
- if (priorKey !== undefined) {
710
- execIteration(priorKey, i - 1, true);
711
- }
712
- }
713
- }
714
-
715
- if (i === 0) {
716
- ret = inverse(this);
717
- }
718
-
719
- return ret;
720
- });
721
- };
722
-
723
- module.exports = exports['default'];
724
-
725
- /***/ },
726
- /* 10 */
727
- /***/ function(module, exports, __webpack_require__) {
728
-
729
- 'use strict';
730
-
731
- var _interopRequireDefault = __webpack_require__(1)['default'];
732
-
733
- exports.__esModule = true;
734
-
735
- var _exception = __webpack_require__(6);
736
-
737
- var _exception2 = _interopRequireDefault(_exception);
738
-
739
- exports['default'] = function (instance) {
740
- instance.registerHelper('helperMissing', function () /* [args, ]options */{
741
- if (arguments.length === 1) {
742
- // A missing field in a {{foo}} construct.
743
- return undefined;
744
- } else {
745
- // Someone is actually trying to call something, blow up.
746
- throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
747
- }
748
- });
749
- };
750
-
751
- module.exports = exports['default'];
752
-
753
- /***/ },
754
- /* 11 */
755
- /***/ function(module, exports, __webpack_require__) {
756
-
757
- 'use strict';
758
-
759
- exports.__esModule = true;
760
-
761
- var _utils = __webpack_require__(5);
762
-
763
- exports['default'] = function (instance) {
764
- instance.registerHelper('if', function (conditional, options) {
765
- if (_utils.isFunction(conditional)) {
766
- conditional = conditional.call(this);
767
- }
768
-
769
- // Default behavior is to render the positive path if the value is truthy and not empty.
770
- // The `includeZero` option may be set to treat the condtional as purely not empty based on the
771
- // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
772
- if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
773
- return options.inverse(this);
774
- } else {
775
- return options.fn(this);
776
- }
777
- });
778
-
779
- instance.registerHelper('unless', function (conditional, options) {
780
- return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
781
- });
782
- };
783
-
784
- module.exports = exports['default'];
785
-
786
- /***/ },
787
- /* 12 */
788
- /***/ function(module, exports) {
789
-
790
- 'use strict';
791
-
792
- exports.__esModule = true;
793
-
794
- exports['default'] = function (instance) {
795
- instance.registerHelper('log', function () /* message, options */{
796
- var args = [undefined],
797
- options = arguments[arguments.length - 1];
798
- for (var i = 0; i < arguments.length - 1; i++) {
799
- args.push(arguments[i]);
800
- }
801
-
802
- var level = 1;
803
- if (options.hash.level != null) {
804
- level = options.hash.level;
805
- } else if (options.data && options.data.level != null) {
806
- level = options.data.level;
807
- }
808
- args[0] = level;
809
-
810
- instance.log.apply(instance, args);
811
- });
812
- };
813
-
814
- module.exports = exports['default'];
815
-
816
- /***/ },
817
- /* 13 */
818
- /***/ function(module, exports) {
819
-
820
- 'use strict';
821
-
822
- exports.__esModule = true;
823
-
824
- exports['default'] = function (instance) {
825
- instance.registerHelper('lookup', function (obj, field) {
826
- return obj && obj[field];
827
- });
828
- };
829
-
830
- module.exports = exports['default'];
831
-
832
- /***/ },
833
- /* 14 */
834
- /***/ function(module, exports, __webpack_require__) {
835
-
836
- 'use strict';
837
-
838
- exports.__esModule = true;
839
-
840
- var _utils = __webpack_require__(5);
841
-
842
- exports['default'] = function (instance) {
843
- instance.registerHelper('with', function (context, options) {
844
- if (_utils.isFunction(context)) {
845
- context = context.call(this);
846
- }
847
-
848
- var fn = options.fn;
849
-
850
- if (!_utils.isEmpty(context)) {
851
- var data = options.data;
852
- if (options.data && options.ids) {
853
- data = _utils.createFrame(options.data);
854
- data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
855
- }
856
-
857
- return fn(context, {
858
- data: data,
859
- blockParams: _utils.blockParams([context], [data && data.contextPath])
860
- });
861
- } else {
862
- return options.inverse(this);
863
- }
864
- });
865
- };
866
-
867
- module.exports = exports['default'];
868
-
869
- /***/ },
870
- /* 15 */
871
- /***/ function(module, exports, __webpack_require__) {
872
-
873
- 'use strict';
874
-
875
- var _interopRequireDefault = __webpack_require__(1)['default'];
876
-
877
- exports.__esModule = true;
878
- exports.registerDefaultDecorators = registerDefaultDecorators;
879
-
880
- var _decoratorsInline = __webpack_require__(16);
881
-
882
- var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline);
883
-
884
- function registerDefaultDecorators(instance) {
885
- _decoratorsInline2['default'](instance);
886
- }
887
-
888
- /***/ },
889
- /* 16 */
890
- /***/ function(module, exports, __webpack_require__) {
891
-
892
- 'use strict';
893
-
894
- exports.__esModule = true;
895
-
896
- var _utils = __webpack_require__(5);
897
-
898
- exports['default'] = function (instance) {
899
- instance.registerDecorator('inline', function (fn, props, container, options) {
900
- var ret = fn;
901
- if (!props.partials) {
902
- props.partials = {};
903
- ret = function (context, options) {
904
- // Create a new partials stack frame prior to exec.
905
- var original = container.partials;
906
- container.partials = _utils.extend({}, original, props.partials);
907
- var ret = fn(context, options);
908
- container.partials = original;
909
- return ret;
910
- };
911
- }
912
-
913
- props.partials[options.args[0]] = options.fn;
914
-
915
- return ret;
916
- });
917
- };
918
-
919
- module.exports = exports['default'];
920
-
921
- /***/ },
922
- /* 17 */
923
- /***/ function(module, exports, __webpack_require__) {
924
-
925
- 'use strict';
926
-
927
- exports.__esModule = true;
928
-
929
- var _utils = __webpack_require__(5);
930
-
931
- var logger = {
932
- methodMap: ['debug', 'info', 'warn', 'error'],
933
- level: 'info',
934
-
935
- // Maps a given level value to the `methodMap` indexes above.
936
- lookupLevel: function lookupLevel(level) {
937
- if (typeof level === 'string') {
938
- var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
939
- if (levelMap >= 0) {
940
- level = levelMap;
941
- } else {
942
- level = parseInt(level, 10);
943
- }
944
- }
945
-
946
- return level;
947
- },
948
-
949
- // Can be overridden in the host environment
950
- log: function log(level) {
951
- level = logger.lookupLevel(level);
952
-
953
- if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
954
- var method = logger.methodMap[level];
955
- if (!console[method]) {
956
- // eslint-disable-line no-console
957
- method = 'log';
958
- }
959
-
960
- for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
961
- message[_key - 1] = arguments[_key];
962
- }
963
-
964
- console[method].apply(console, message); // eslint-disable-line no-console
965
- }
966
- }
967
- };
968
-
969
- exports['default'] = logger;
970
- module.exports = exports['default'];
971
-
972
- /***/ },
973
- /* 18 */
974
- /***/ function(module, exports) {
975
-
976
- // Build out our basic SafeString type
977
- 'use strict';
978
-
979
- exports.__esModule = true;
980
- function SafeString(string) {
981
- this.string = string;
982
- }
983
-
984
- SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
985
- return '' + this.string;
986
- };
987
-
988
- exports['default'] = SafeString;
989
- module.exports = exports['default'];
990
-
991
- /***/ },
992
- /* 19 */
993
- /***/ function(module, exports, __webpack_require__) {
994
-
995
- 'use strict';
996
-
997
- var _interopRequireWildcard = __webpack_require__(3)['default'];
998
-
999
- var _interopRequireDefault = __webpack_require__(1)['default'];
1000
-
1001
- exports.__esModule = true;
1002
- exports.checkRevision = checkRevision;
1003
- exports.template = template;
1004
- exports.wrapProgram = wrapProgram;
1005
- exports.resolvePartial = resolvePartial;
1006
- exports.invokePartial = invokePartial;
1007
- exports.noop = noop;
1008
-
1009
- var _utils = __webpack_require__(5);
1010
-
1011
- var Utils = _interopRequireWildcard(_utils);
1012
-
1013
- var _exception = __webpack_require__(6);
1014
-
1015
- var _exception2 = _interopRequireDefault(_exception);
1016
-
1017
- var _base = __webpack_require__(4);
1018
-
1019
- function checkRevision(compilerInfo) {
1020
- var compilerRevision = compilerInfo && compilerInfo[0] || 1,
1021
- currentRevision = _base.COMPILER_REVISION;
1022
-
1023
- if (compilerRevision !== currentRevision) {
1024
- if (compilerRevision < currentRevision) {
1025
- var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
1026
- compilerVersions = _base.REVISION_CHANGES[compilerRevision];
1027
- throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
1028
- } else {
1029
- // Use the embedded version info since the runtime doesn't know about this revision yet
1030
- throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
1031
- }
1032
- }
1033
- }
1034
-
1035
- function template(templateSpec, env) {
1036
- /* istanbul ignore next */
1037
- if (!env) {
1038
- throw new _exception2['default']('No environment passed to template');
1039
- }
1040
- if (!templateSpec || !templateSpec.main) {
1041
- throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
1042
- }
1043
-
1044
- templateSpec.main.decorator = templateSpec.main_d;
1045
-
1046
- // Note: Using env.VM references rather than local var references throughout this section to allow
1047
- // for external users to override these as psuedo-supported APIs.
1048
- env.VM.checkRevision(templateSpec.compiler);
1049
-
1050
- function invokePartialWrapper(partial, context, options) {
1051
- if (options.hash) {
1052
- context = Utils.extend({}, context, options.hash);
1053
- if (options.ids) {
1054
- options.ids[0] = true;
1055
- }
1056
- }
1057
-
1058
- partial = env.VM.resolvePartial.call(this, partial, context, options);
1059
- var result = env.VM.invokePartial.call(this, partial, context, options);
1060
-
1061
- if (result == null && env.compile) {
1062
- options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
1063
- result = options.partials[options.name](context, options);
1064
- }
1065
- if (result != null) {
1066
- if (options.indent) {
1067
- var lines = result.split('\n');
1068
- for (var i = 0, l = lines.length; i < l; i++) {
1069
- if (!lines[i] && i + 1 === l) {
1070
- break;
1071
- }
1072
-
1073
- lines[i] = options.indent + lines[i];
1074
- }
1075
- result = lines.join('\n');
1076
- }
1077
- return result;
1078
- } else {
1079
- throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
1080
- }
1081
- }
1082
-
1083
- // Just add water
1084
- var container = {
1085
- strict: function strict(obj, name) {
1086
- if (!(name in obj)) {
1087
- throw new _exception2['default']('"' + name + '" not defined in ' + obj);
1088
- }
1089
- return obj[name];
1090
- },
1091
- lookup: function lookup(depths, name) {
1092
- var len = depths.length;
1093
- for (var i = 0; i < len; i++) {
1094
- if (depths[i] && depths[i][name] != null) {
1095
- return depths[i][name];
1096
- }
1097
- }
1098
- },
1099
- lambda: function lambda(current, context) {
1100
- return typeof current === 'function' ? current.call(context) : current;
1101
- },
1102
-
1103
- escapeExpression: Utils.escapeExpression,
1104
- invokePartial: invokePartialWrapper,
1105
-
1106
- fn: function fn(i) {
1107
- var ret = templateSpec[i];
1108
- ret.decorator = templateSpec[i + '_d'];
1109
- return ret;
1110
- },
1111
-
1112
- programs: [],
1113
- program: function program(i, data, declaredBlockParams, blockParams, depths) {
1114
- var programWrapper = this.programs[i],
1115
- fn = this.fn(i);
1116
- if (data || depths || blockParams || declaredBlockParams) {
1117
- programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
1118
- } else if (!programWrapper) {
1119
- programWrapper = this.programs[i] = wrapProgram(this, i, fn);
1120
- }
1121
- return programWrapper;
1122
- },
1123
-
1124
- data: function data(value, depth) {
1125
- while (value && depth--) {
1126
- value = value._parent;
1127
- }
1128
- return value;
1129
- },
1130
- merge: function merge(param, common) {
1131
- var obj = param || common;
1132
-
1133
- if (param && common && param !== common) {
1134
- obj = Utils.extend({}, common, param);
1135
- }
1136
-
1137
- return obj;
1138
- },
1139
-
1140
- noop: env.VM.noop,
1141
- compilerInfo: templateSpec.compiler
1142
- };
1143
-
1144
- function ret(context) {
1145
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1146
-
1147
- var data = options.data;
1148
-
1149
- ret._setup(options);
1150
- if (!options.partial && templateSpec.useData) {
1151
- data = initData(context, data);
1152
- }
1153
- var depths = undefined,
1154
- blockParams = templateSpec.useBlockParams ? [] : undefined;
1155
- if (templateSpec.useDepths) {
1156
- if (options.depths) {
1157
- depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths;
1158
- } else {
1159
- depths = [context];
1160
- }
1161
- }
1162
-
1163
- function main(context /*, options*/) {
1164
- return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
1165
- }
1166
- main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
1167
- return main(context, options);
1168
- }
1169
- ret.isTop = true;
1170
-
1171
- ret._setup = function (options) {
1172
- if (!options.partial) {
1173
- container.helpers = container.merge(options.helpers, env.helpers);
1174
-
1175
- if (templateSpec.usePartial) {
1176
- container.partials = container.merge(options.partials, env.partials);
1177
- }
1178
- if (templateSpec.usePartial || templateSpec.useDecorators) {
1179
- container.decorators = container.merge(options.decorators, env.decorators);
1180
- }
1181
- } else {
1182
- container.helpers = options.helpers;
1183
- container.partials = options.partials;
1184
- container.decorators = options.decorators;
1185
- }
1186
- };
1187
-
1188
- ret._child = function (i, data, blockParams, depths) {
1189
- if (templateSpec.useBlockParams && !blockParams) {
1190
- throw new _exception2['default']('must pass block params');
1191
- }
1192
- if (templateSpec.useDepths && !depths) {
1193
- throw new _exception2['default']('must pass parent depths');
1194
- }
1195
-
1196
- return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
1197
- };
1198
- return ret;
1199
- }
1200
-
1201
- function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
1202
- function prog(context) {
1203
- var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1204
-
1205
- var currentDepths = depths;
1206
- if (depths && context !== depths[0]) {
1207
- currentDepths = [context].concat(depths);
1208
- }
1209
-
1210
- return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths);
1211
- }
1212
-
1213
- prog = executeDecorators(fn, prog, container, depths, data, blockParams);
1214
-
1215
- prog.program = i;
1216
- prog.depth = depths ? depths.length : 0;
1217
- prog.blockParams = declaredBlockParams || 0;
1218
- return prog;
1219
- }
1220
-
1221
- function resolvePartial(partial, context, options) {
1222
- if (!partial) {
1223
- if (options.name === '@partial-block') {
1224
- partial = options.data['partial-block'];
1225
- } else {
1226
- partial = options.partials[options.name];
1227
- }
1228
- } else if (!partial.call && !options.name) {
1229
- // This is a dynamic partial that returned a string
1230
- options.name = partial;
1231
- partial = options.partials[partial];
1232
- }
1233
- return partial;
1234
- }
1235
-
1236
- function invokePartial(partial, context, options) {
1237
- options.partial = true;
1238
- if (options.ids) {
1239
- options.data.contextPath = options.ids[0] || options.data.contextPath;
1240
- }
1241
-
1242
- var partialBlock = undefined;
1243
- if (options.fn && options.fn !== noop) {
1244
- options.data = _base.createFrame(options.data);
1245
- partialBlock = options.data['partial-block'] = options.fn;
1246
-
1247
- if (partialBlock.partials) {
1248
- options.partials = Utils.extend({}, options.partials, partialBlock.partials);
1249
- }
1250
- }
1251
-
1252
- if (partial === undefined && partialBlock) {
1253
- partial = partialBlock;
1254
- }
1255
-
1256
- if (partial === undefined) {
1257
- throw new _exception2['default']('The partial ' + options.name + ' could not be found');
1258
- } else if (partial instanceof Function) {
1259
- return partial(context, options);
1260
- }
1261
- }
1262
-
1263
- function noop() {
1264
- return '';
1265
- }
1266
-
1267
- function initData(context, data) {
1268
- if (!data || !('root' in data)) {
1269
- data = data ? _base.createFrame(data) : {};
1270
- data.root = context;
1271
- }
1272
- return data;
1273
- }
1274
-
1275
- function executeDecorators(fn, prog, container, depths, data, blockParams) {
1276
- if (fn.decorator) {
1277
- var props = {};
1278
- prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths);
1279
- Utils.extend(prog, props);
1280
- }
1281
- return prog;
1282
- }
1283
-
1284
- /***/ },
1285
- /* 20 */
1286
- /***/ function(module, exports) {
1287
-
1288
- /* WEBPACK VAR INJECTION */(function(global) {/* global window */
1289
- 'use strict';
1290
-
1291
- exports.__esModule = true;
1292
-
1293
- exports['default'] = function (Handlebars) {
1294
- /* istanbul ignore next */
1295
- var root = typeof global !== 'undefined' ? global : window,
1296
- $Handlebars = root.Handlebars;
1297
- /* istanbul ignore next */
1298
- Handlebars.noConflict = function () {
1299
- if (root.Handlebars === Handlebars) {
1300
- root.Handlebars = $Handlebars;
1301
- }
1302
- return Handlebars;
1303
- };
1304
- };
1305
-
1306
- module.exports = exports['default'];
1307
- /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
1308
-
1309
- /***/ },
1310
- /* 21 */
1311
- /***/ function(module, exports) {
1312
-
1313
- 'use strict';
1314
-
1315
- exports.__esModule = true;
1316
- var AST = {
1317
- // Public API used to evaluate derived attributes regarding AST nodes
1318
- helpers: {
1319
- // a mustache is definitely a helper if:
1320
- // * it is an eligible helper, and
1321
- // * it has at least one parameter or hash segment
1322
- helperExpression: function helperExpression(node) {
1323
- return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash);
1324
- },
1325
-
1326
- scopedId: function scopedId(path) {
1327
- return (/^\.|this\b/.test(path.original)
1328
- );
1329
- },
1330
-
1331
- // an ID is simple if it only has one part, and that part is not
1332
- // `..` or `this`.
1333
- simpleId: function simpleId(path) {
1334
- return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
1335
- }
1336
- }
1337
- };
1338
-
1339
- // Must be exported as an object rather than the root of the module as the jison lexer
1340
- // must modify the object to operate properly.
1341
- exports['default'] = AST;
1342
- module.exports = exports['default'];
1343
-
1344
- /***/ },
1345
- /* 22 */
1346
- /***/ function(module, exports, __webpack_require__) {
1347
-
1348
- 'use strict';
1349
-
1350
- var _interopRequireDefault = __webpack_require__(1)['default'];
1351
-
1352
- var _interopRequireWildcard = __webpack_require__(3)['default'];
1353
-
1354
- exports.__esModule = true;
1355
- exports.parse = parse;
1356
-
1357
- var _parser = __webpack_require__(23);
1358
-
1359
- var _parser2 = _interopRequireDefault(_parser);
1360
-
1361
- var _whitespaceControl = __webpack_require__(24);
1362
-
1363
- var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl);
1364
-
1365
- var _helpers = __webpack_require__(26);
1366
-
1367
- var Helpers = _interopRequireWildcard(_helpers);
1368
-
1369
- var _utils = __webpack_require__(5);
1370
-
1371
- exports.parser = _parser2['default'];
1372
-
1373
- var yy = {};
1374
- _utils.extend(yy, Helpers);
1375
-
1376
- function parse(input, options) {
1377
- // Just return if an already-compiled AST was passed in.
1378
- if (input.type === 'Program') {
1379
- return input;
1380
- }
1381
-
1382
- _parser2['default'].yy = yy;
1383
-
1384
- // Altering the shared object here, but this is ok as parser is a sync operation
1385
- yy.locInfo = function (locInfo) {
1386
- return new yy.SourceLocation(options && options.srcName, locInfo);
1387
- };
1388
-
1389
- var strip = new _whitespaceControl2['default'](options);
1390
- return strip.accept(_parser2['default'].parse(input));
1391
- }
1392
-
1393
- /***/ },
1394
- /* 23 */
1395
- /***/ function(module, exports) {
1396
-
1397
- /* istanbul ignore next */
1398
- /* Jison generated parser */
1399
- "use strict";
1400
-
1401
- var handlebars = (function () {
1402
- var parser = { trace: function trace() {},
1403
- yy: {},
1404
- symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 },
1405
- terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" },
1406
- productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]],
1407
- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$
1408
- /**/) {
1409
-
1410
- var $0 = $$.length - 1;
1411
- switch (yystate) {
1412
- case 1:
1413
- return $$[$0 - 1];
1414
- break;
1415
- case 2:
1416
- this.$ = yy.prepareProgram($$[$0]);
1417
- break;
1418
- case 3:
1419
- this.$ = $$[$0];
1420
- break;
1421
- case 4:
1422
- this.$ = $$[$0];
1423
- break;
1424
- case 5:
1425
- this.$ = $$[$0];
1426
- break;
1427
- case 6:
1428
- this.$ = $$[$0];
1429
- break;
1430
- case 7:
1431
- this.$ = $$[$0];
1432
- break;
1433
- case 8:
1434
- this.$ = $$[$0];
1435
- break;
1436
- case 9:
1437
- this.$ = {
1438
- type: 'CommentStatement',
1439
- value: yy.stripComment($$[$0]),
1440
- strip: yy.stripFlags($$[$0], $$[$0]),
1441
- loc: yy.locInfo(this._$)
1442
- };
1443
-
1444
- break;
1445
- case 10:
1446
- this.$ = {
1447
- type: 'ContentStatement',
1448
- original: $$[$0],
1449
- value: $$[$0],
1450
- loc: yy.locInfo(this._$)
1451
- };
1452
-
1453
- break;
1454
- case 11:
1455
- this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
1456
- break;
1457
- case 12:
1458
- this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] };
1459
- break;
1460
- case 13:
1461
- this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$);
1462
- break;
1463
- case 14:
1464
- this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$);
1465
- break;
1466
- case 15:
1467
- this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
1468
- break;
1469
- case 16:
1470
- this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
1471
- break;
1472
- case 17:
1473
- this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) };
1474
- break;
1475
- case 18:
1476
- this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] };
1477
- break;
1478
- case 19:
1479
- var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$),
1480
- program = yy.prepareProgram([inverse], $$[$0 - 1].loc);
1481
- program.chained = true;
1482
-
1483
- this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true };
1484
-
1485
- break;
1486
- case 20:
1487
- this.$ = $$[$0];
1488
- break;
1489
- case 21:
1490
- this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) };
1491
- break;
1492
- case 22:
1493
- this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
1494
- break;
1495
- case 23:
1496
- this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$);
1497
- break;
1498
- case 24:
1499
- this.$ = {
1500
- type: 'PartialStatement',
1501
- name: $$[$0 - 3],
1502
- params: $$[$0 - 2],
1503
- hash: $$[$0 - 1],
1504
- indent: '',
1505
- strip: yy.stripFlags($$[$0 - 4], $$[$0]),
1506
- loc: yy.locInfo(this._$)
1507
- };
1508
-
1509
- break;
1510
- case 25:
1511
- this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$);
1512
- break;
1513
- case 26:
1514
- this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) };
1515
- break;
1516
- case 27:
1517
- this.$ = $$[$0];
1518
- break;
1519
- case 28:
1520
- this.$ = $$[$0];
1521
- break;
1522
- case 29:
1523
- this.$ = {
1524
- type: 'SubExpression',
1525
- path: $$[$0 - 3],
1526
- params: $$[$0 - 2],
1527
- hash: $$[$0 - 1],
1528
- loc: yy.locInfo(this._$)
1529
- };
1530
-
1531
- break;
1532
- case 30:
1533
- this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) };
1534
- break;
1535
- case 31:
1536
- this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) };
1537
- break;
1538
- case 32:
1539
- this.$ = yy.id($$[$0 - 1]);
1540
- break;
1541
- case 33:
1542
- this.$ = $$[$0];
1543
- break;
1544
- case 34:
1545
- this.$ = $$[$0];
1546
- break;
1547
- case 35:
1548
- this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) };
1549
- break;
1550
- case 36:
1551
- this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) };
1552
- break;
1553
- case 37:
1554
- this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) };
1555
- break;
1556
- case 38:
1557
- this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) };
1558
- break;
1559
- case 39:
1560
- this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) };
1561
- break;
1562
- case 40:
1563
- this.$ = $$[$0];
1564
- break;
1565
- case 41:
1566
- this.$ = $$[$0];
1567
- break;
1568
- case 42:
1569
- this.$ = yy.preparePath(true, $$[$0], this._$);
1570
- break;
1571
- case 43:
1572
- this.$ = yy.preparePath(false, $$[$0], this._$);
1573
- break;
1574
- case 44:
1575
- $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2];
1576
- break;
1577
- case 45:
1578
- this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }];
1579
- break;
1580
- case 46:
1581
- this.$ = [];
1582
- break;
1583
- case 47:
1584
- $$[$0 - 1].push($$[$0]);
1585
- break;
1586
- case 48:
1587
- this.$ = [$$[$0]];
1588
- break;
1589
- case 49:
1590
- $$[$0 - 1].push($$[$0]);
1591
- break;
1592
- case 50:
1593
- this.$ = [];
1594
- break;
1595
- case 51:
1596
- $$[$0 - 1].push($$[$0]);
1597
- break;
1598
- case 58:
1599
- this.$ = [];
1600
- break;
1601
- case 59:
1602
- $$[$0 - 1].push($$[$0]);
1603
- break;
1604
- case 64:
1605
- this.$ = [];
1606
- break;
1607
- case 65:
1608
- $$[$0 - 1].push($$[$0]);
1609
- break;
1610
- case 70:
1611
- this.$ = [];
1612
- break;
1613
- case 71:
1614
- $$[$0 - 1].push($$[$0]);
1615
- break;
1616
- case 78:
1617
- this.$ = [];
1618
- break;
1619
- case 79:
1620
- $$[$0 - 1].push($$[$0]);
1621
- break;
1622
- case 82:
1623
- this.$ = [];
1624
- break;
1625
- case 83:
1626
- $$[$0 - 1].push($$[$0]);
1627
- break;
1628
- case 86:
1629
- this.$ = [];
1630
- break;
1631
- case 87:
1632
- $$[$0 - 1].push($$[$0]);
1633
- break;
1634
- case 90:
1635
- this.$ = [];
1636
- break;
1637
- case 91:
1638
- $$[$0 - 1].push($$[$0]);
1639
- break;
1640
- case 94:
1641
- this.$ = [];
1642
- break;
1643
- case 95:
1644
- $$[$0 - 1].push($$[$0]);
1645
- break;
1646
- case 98:
1647
- this.$ = [$$[$0]];
1648
- break;
1649
- case 99:
1650
- $$[$0 - 1].push($$[$0]);
1651
- break;
1652
- case 100:
1653
- this.$ = [$$[$0]];
1654
- break;
1655
- case 101:
1656
- $$[$0 - 1].push($$[$0]);
1657
- break;
1658
- }
1659
- },
1660
- table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }],
1661
- defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137: [2, 32] },
1662
- parseError: function parseError(str, hash) {
1663
- throw new Error(str);
1664
- },
1665
- parse: function parse(input) {
1666
- var self = this,
1667
- stack = [0],
1668
- vstack = [null],
1669
- lstack = [],
1670
- table = this.table,
1671
- yytext = "",
1672
- yylineno = 0,
1673
- yyleng = 0,
1674
- recovering = 0,
1675
- TERROR = 2,
1676
- EOF = 1;
1677
- this.lexer.setInput(input);
1678
- this.lexer.yy = this.yy;
1679
- this.yy.lexer = this.lexer;
1680
- this.yy.parser = this;
1681
- if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {};
1682
- var yyloc = this.lexer.yylloc;
1683
- lstack.push(yyloc);
1684
- var ranges = this.lexer.options && this.lexer.options.ranges;
1685
- if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError;
1686
- function popStack(n) {
1687
- stack.length = stack.length - 2 * n;
1688
- vstack.length = vstack.length - n;
1689
- lstack.length = lstack.length - n;
1690
- }
1691
- function lex() {
1692
- var token;
1693
- token = self.lexer.lex() || 1;
1694
- if (typeof token !== "number") {
1695
- token = self.symbols_[token] || token;
1696
- }
1697
- return token;
1698
- }
1699
- var symbol,
1700
- preErrorSymbol,
1701
- state,
1702
- action,
1703
- a,
1704
- r,
1705
- yyval = {},
1706
- p,
1707
- len,
1708
- newState,
1709
- expected;
1710
- while (true) {
1711
- state = stack[stack.length - 1];
1712
- if (this.defaultActions[state]) {
1713
- action = this.defaultActions[state];
1714
- } else {
1715
- if (symbol === null || typeof symbol == "undefined") {
1716
- symbol = lex();
1717
- }
1718
- action = table[state] && table[state][symbol];
1719
- }
1720
- if (typeof action === "undefined" || !action.length || !action[0]) {
1721
- var errStr = "";
1722
- if (!recovering) {
1723
- expected = [];
1724
- for (p in table[state]) if (this.terminals_[p] && p > 2) {
1725
- expected.push("'" + this.terminals_[p] + "'");
1726
- }
1727
- if (this.lexer.showPosition) {
1728
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
1729
- } else {
1730
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
1731
- }
1732
- this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected });
1733
- }
1734
- }
1735
- if (action[0] instanceof Array && action.length > 1) {
1736
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
1737
- }
1738
- switch (action[0]) {
1739
- case 1:
1740
- stack.push(symbol);
1741
- vstack.push(this.lexer.yytext);
1742
- lstack.push(this.lexer.yylloc);
1743
- stack.push(action[1]);
1744
- symbol = null;
1745
- if (!preErrorSymbol) {
1746
- yyleng = this.lexer.yyleng;
1747
- yytext = this.lexer.yytext;
1748
- yylineno = this.lexer.yylineno;
1749
- yyloc = this.lexer.yylloc;
1750
- if (recovering > 0) recovering--;
1751
- } else {
1752
- symbol = preErrorSymbol;
1753
- preErrorSymbol = null;
1754
- }
1755
- break;
1756
- case 2:
1757
- len = this.productions_[action[1]][1];
1758
- yyval.$ = vstack[vstack.length - len];
1759
- yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column };
1760
- if (ranges) {
1761
- yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
1762
- }
1763
- r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
1764
- if (typeof r !== "undefined") {
1765
- return r;
1766
- }
1767
- if (len) {
1768
- stack = stack.slice(0, -1 * len * 2);
1769
- vstack = vstack.slice(0, -1 * len);
1770
- lstack = lstack.slice(0, -1 * len);
1771
- }
1772
- stack.push(this.productions_[action[1]][0]);
1773
- vstack.push(yyval.$);
1774
- lstack.push(yyval._$);
1775
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
1776
- stack.push(newState);
1777
- break;
1778
- case 3:
1779
- return true;
1780
- }
1781
- }
1782
- return true;
1783
- }
1784
- };
1785
- /* Jison generated lexer */
1786
- var lexer = (function () {
1787
- var lexer = { EOF: 1,
1788
- parseError: function parseError(str, hash) {
1789
- if (this.yy.parser) {
1790
- this.yy.parser.parseError(str, hash);
1791
- } else {
1792
- throw new Error(str);
1793
- }
1794
- },
1795
- setInput: function setInput(input) {
1796
- this._input = input;
1797
- this._more = this._less = this.done = false;
1798
- this.yylineno = this.yyleng = 0;
1799
- this.yytext = this.matched = this.match = '';
1800
- this.conditionStack = ['INITIAL'];
1801
- this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 };
1802
- if (this.options.ranges) this.yylloc.range = [0, 0];
1803
- this.offset = 0;
1804
- return this;
1805
- },
1806
- input: function input() {
1807
- var ch = this._input[0];
1808
- this.yytext += ch;
1809
- this.yyleng++;
1810
- this.offset++;
1811
- this.match += ch;
1812
- this.matched += ch;
1813
- var lines = ch.match(/(?:\r\n?|\n).*/g);
1814
- if (lines) {
1815
- this.yylineno++;
1816
- this.yylloc.last_line++;
1817
- } else {
1818
- this.yylloc.last_column++;
1819
- }
1820
- if (this.options.ranges) this.yylloc.range[1]++;
1821
-
1822
- this._input = this._input.slice(1);
1823
- return ch;
1824
- },
1825
- unput: function unput(ch) {
1826
- var len = ch.length;
1827
- var lines = ch.split(/(?:\r\n?|\n)/g);
1828
-
1829
- this._input = ch + this._input;
1830
- this.yytext = this.yytext.substr(0, this.yytext.length - len - 1);
1831
- //this.yyleng -= len;
1832
- this.offset -= len;
1833
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
1834
- this.match = this.match.substr(0, this.match.length - 1);
1835
- this.matched = this.matched.substr(0, this.matched.length - 1);
1836
-
1837
- if (lines.length - 1) this.yylineno -= lines.length - 1;
1838
- var r = this.yylloc.range;
1839
-
1840
- this.yylloc = { first_line: this.yylloc.first_line,
1841
- last_line: this.yylineno + 1,
1842
- first_column: this.yylloc.first_column,
1843
- last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
1844
- };
1845
-
1846
- if (this.options.ranges) {
1847
- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1848
- }
1849
- return this;
1850
- },
1851
- more: function more() {
1852
- this._more = true;
1853
- return this;
1854
- },
1855
- less: function less(n) {
1856
- this.unput(this.match.slice(n));
1857
- },
1858
- pastInput: function pastInput() {
1859
- var past = this.matched.substr(0, this.matched.length - this.match.length);
1860
- return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, "");
1861
- },
1862
- upcomingInput: function upcomingInput() {
1863
- var next = this.match;
1864
- if (next.length < 20) {
1865
- next += this._input.substr(0, 20 - next.length);
1866
- }
1867
- return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
1868
- },
1869
- showPosition: function showPosition() {
1870
- var pre = this.pastInput();
1871
- var c = new Array(pre.length + 1).join("-");
1872
- return pre + this.upcomingInput() + "\n" + c + "^";
1873
- },
1874
- next: function next() {
1875
- if (this.done) {
1876
- return this.EOF;
1877
- }
1878
- if (!this._input) this.done = true;
1879
-
1880
- var token, match, tempMatch, index, col, lines;
1881
- if (!this._more) {
1882
- this.yytext = '';
1883
- this.match = '';
1884
- }
1885
- var rules = this._currentRules();
1886
- for (var i = 0; i < rules.length; i++) {
1887
- tempMatch = this._input.match(this.rules[rules[i]]);
1888
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1889
- match = tempMatch;
1890
- index = i;
1891
- if (!this.options.flex) break;
1892
- }
1893
- }
1894
- if (match) {
1895
- lines = match[0].match(/(?:\r\n?|\n).*/g);
1896
- if (lines) this.yylineno += lines.length;
1897
- this.yylloc = { first_line: this.yylloc.last_line,
1898
- last_line: this.yylineno + 1,
1899
- first_column: this.yylloc.last_column,
1900
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length };
1901
- this.yytext += match[0];
1902
- this.match += match[0];
1903
- this.matches = match;
1904
- this.yyleng = this.yytext.length;
1905
- if (this.options.ranges) {
1906
- this.yylloc.range = [this.offset, this.offset += this.yyleng];
1907
- }
1908
- this._more = false;
1909
- this._input = this._input.slice(match[0].length);
1910
- this.matched += match[0];
1911
- token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]);
1912
- if (this.done && this._input) this.done = false;
1913
- if (token) return token;else return;
1914
- }
1915
- if (this._input === "") {
1916
- return this.EOF;
1917
- } else {
1918
- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno });
1919
- }
1920
- },
1921
- lex: function lex() {
1922
- var r = this.next();
1923
- if (typeof r !== 'undefined') {
1924
- return r;
1925
- } else {
1926
- return this.lex();
1927
- }
1928
- },
1929
- begin: function begin(condition) {
1930
- this.conditionStack.push(condition);
1931
- },
1932
- popState: function popState() {
1933
- return this.conditionStack.pop();
1934
- },
1935
- _currentRules: function _currentRules() {
1936
- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1937
- },
1938
- topState: function topState() {
1939
- return this.conditionStack[this.conditionStack.length - 2];
1940
- },
1941
- pushState: function begin(condition) {
1942
- this.begin(condition);
1943
- } };
1944
- lexer.options = {};
1945
- lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START
1946
- /**/) {
1947
-
1948
- function strip(start, end) {
1949
- return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end);
1950
- }
1951
-
1952
- var YYSTATE = YY_START;
1953
- switch ($avoiding_name_collisions) {
1954
- case 0:
1955
- if (yy_.yytext.slice(-2) === "\\\\") {
1956
- strip(0, 1);
1957
- this.begin("mu");
1958
- } else if (yy_.yytext.slice(-1) === "\\") {
1959
- strip(0, 1);
1960
- this.begin("emu");
1961
- } else {
1962
- this.begin("mu");
1963
- }
1964
- if (yy_.yytext) return 15;
1965
-
1966
- break;
1967
- case 1:
1968
- return 15;
1969
- break;
1970
- case 2:
1971
- this.popState();
1972
- return 15;
1973
-
1974
- break;
1975
- case 3:
1976
- this.begin('raw');return 15;
1977
- break;
1978
- case 4:
1979
- this.popState();
1980
- // Should be using `this.topState()` below, but it currently
1981
- // returns the second top instead of the first top. Opened an
1982
- // issue about it at https://github.com/zaach/jison/issues/291
1983
- if (this.conditionStack[this.conditionStack.length - 1] === 'raw') {
1984
- return 15;
1985
- } else {
1986
- yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9);
1987
- return 'END_RAW_BLOCK';
1988
- }
1989
-
1990
- break;
1991
- case 5:
1992
- return 15;
1993
- break;
1994
- case 6:
1995
- this.popState();
1996
- return 14;
1997
-
1998
- break;
1999
- case 7:
2000
- return 65;
2001
- break;
2002
- case 8:
2003
- return 68;
2004
- break;
2005
- case 9:
2006
- return 19;
2007
- break;
2008
- case 10:
2009
- this.popState();
2010
- this.begin('raw');
2011
- return 23;
2012
-
2013
- break;
2014
- case 11:
2015
- return 55;
2016
- break;
2017
- case 12:
2018
- return 60;
2019
- break;
2020
- case 13:
2021
- return 29;
2022
- break;
2023
- case 14:
2024
- return 47;
2025
- break;
2026
- case 15:
2027
- this.popState();return 44;
2028
- break;
2029
- case 16:
2030
- this.popState();return 44;
2031
- break;
2032
- case 17:
2033
- return 34;
2034
- break;
2035
- case 18:
2036
- return 39;
2037
- break;
2038
- case 19:
2039
- return 51;
2040
- break;
2041
- case 20:
2042
- return 48;
2043
- break;
2044
- case 21:
2045
- this.unput(yy_.yytext);
2046
- this.popState();
2047
- this.begin('com');
2048
-
2049
- break;
2050
- case 22:
2051
- this.popState();
2052
- return 14;
2053
-
2054
- break;
2055
- case 23:
2056
- return 48;
2057
- break;
2058
- case 24:
2059
- return 73;
2060
- break;
2061
- case 25:
2062
- return 72;
2063
- break;
2064
- case 26:
2065
- return 72;
2066
- break;
2067
- case 27:
2068
- return 87;
2069
- break;
2070
- case 28:
2071
- // ignore whitespace
2072
- break;
2073
- case 29:
2074
- this.popState();return 54;
2075
- break;
2076
- case 30:
2077
- this.popState();return 33;
2078
- break;
2079
- case 31:
2080
- yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80;
2081
- break;
2082
- case 32:
2083
- yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80;
2084
- break;
2085
- case 33:
2086
- return 85;
2087
- break;
2088
- case 34:
2089
- return 82;
2090
- break;
2091
- case 35:
2092
- return 82;
2093
- break;
2094
- case 36:
2095
- return 83;
2096
- break;
2097
- case 37:
2098
- return 84;
2099
- break;
2100
- case 38:
2101
- return 81;
2102
- break;
2103
- case 39:
2104
- return 75;
2105
- break;
2106
- case 40:
2107
- return 77;
2108
- break;
2109
- case 41:
2110
- return 72;
2111
- break;
2112
- case 42:
2113
- yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72;
2114
- break;
2115
- case 43:
2116
- return 'INVALID';
2117
- break;
2118
- case 44:
2119
- return 5;
2120
- break;
2121
- }
2122
- };
2123
- lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
2124
- lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } };
2125
- return lexer;
2126
- })();
2127
- parser.lexer = lexer;
2128
- function Parser() {
2129
- this.yy = {};
2130
- }Parser.prototype = parser;parser.Parser = Parser;
2131
- return new Parser();
2132
- })();exports.__esModule = true;
2133
- exports['default'] = handlebars;
2134
-
2135
- /***/ },
2136
- /* 24 */
2137
- /***/ function(module, exports, __webpack_require__) {
2138
-
2139
- 'use strict';
2140
-
2141
- var _interopRequireDefault = __webpack_require__(1)['default'];
2142
-
2143
- exports.__esModule = true;
2144
-
2145
- var _visitor = __webpack_require__(25);
2146
-
2147
- var _visitor2 = _interopRequireDefault(_visitor);
2148
-
2149
- function WhitespaceControl() {
2150
- var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
2151
-
2152
- this.options = options;
2153
- }
2154
- WhitespaceControl.prototype = new _visitor2['default']();
2155
-
2156
- WhitespaceControl.prototype.Program = function (program) {
2157
- var doStandalone = !this.options.ignoreStandalone;
2158
-
2159
- var isRoot = !this.isRootSeen;
2160
- this.isRootSeen = true;
2161
-
2162
- var body = program.body;
2163
- for (var i = 0, l = body.length; i < l; i++) {
2164
- var current = body[i],
2165
- strip = this.accept(current);
2166
-
2167
- if (!strip) {
2168
- continue;
2169
- }
2170
-
2171
- var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
2172
- _isNextWhitespace = isNextWhitespace(body, i, isRoot),
2173
- openStandalone = strip.openStandalone && _isPrevWhitespace,
2174
- closeStandalone = strip.closeStandalone && _isNextWhitespace,
2175
- inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
2176
-
2177
- if (strip.close) {
2178
- omitRight(body, i, true);
2179
- }
2180
- if (strip.open) {
2181
- omitLeft(body, i, true);
2182
- }
2183
-
2184
- if (doStandalone && inlineStandalone) {
2185
- omitRight(body, i);
2186
-
2187
- if (omitLeft(body, i)) {
2188
- // If we are on a standalone node, save the indent info for partials
2189
- if (current.type === 'PartialStatement') {
2190
- // Pull out the whitespace from the final line
2191
- current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1];
2192
- }
2193
- }
2194
- }
2195
- if (doStandalone && openStandalone) {
2196
- omitRight((current.program || current.inverse).body);
2197
-
2198
- // Strip out the previous content node if it's whitespace only
2199
- omitLeft(body, i);
2200
- }
2201
- if (doStandalone && closeStandalone) {
2202
- // Always strip the next node
2203
- omitRight(body, i);
2204
-
2205
- omitLeft((current.inverse || current.program).body);
2206
- }
2207
- }
2208
-
2209
- return program;
2210
- };
2211
-
2212
- WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) {
2213
- this.accept(block.program);
2214
- this.accept(block.inverse);
2215
-
2216
- // Find the inverse program that is involed with whitespace stripping.
2217
- var program = block.program || block.inverse,
2218
- inverse = block.program && block.inverse,
2219
- firstInverse = inverse,
2220
- lastInverse = inverse;
2221
-
2222
- if (inverse && inverse.chained) {
2223
- firstInverse = inverse.body[0].program;
2224
-
2225
- // Walk the inverse chain to find the last inverse that is actually in the chain.
2226
- while (lastInverse.chained) {
2227
- lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
2228
- }
2229
- }
2230
-
2231
- var strip = {
2232
- open: block.openStrip.open,
2233
- close: block.closeStrip.close,
2234
-
2235
- // Determine the standalone candiacy. Basically flag our content as being possibly standalone
2236
- // so our parent can determine if we actually are standalone
2237
- openStandalone: isNextWhitespace(program.body),
2238
- closeStandalone: isPrevWhitespace((firstInverse || program).body)
2239
- };
2240
-
2241
- if (block.openStrip.close) {
2242
- omitRight(program.body, null, true);
2243
- }
2244
-
2245
- if (inverse) {
2246
- var inverseStrip = block.inverseStrip;
2247
-
2248
- if (inverseStrip.open) {
2249
- omitLeft(program.body, null, true);
2250
- }
2251
-
2252
- if (inverseStrip.close) {
2253
- omitRight(firstInverse.body, null, true);
2254
- }
2255
- if (block.closeStrip.open) {
2256
- omitLeft(lastInverse.body, null, true);
2257
- }
2258
-
2259
- // Find standalone else statments
2260
- if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) {
2261
- omitLeft(program.body);
2262
- omitRight(firstInverse.body);
2263
- }
2264
- } else if (block.closeStrip.open) {
2265
- omitLeft(program.body, null, true);
2266
- }
2267
-
2268
- return strip;
2269
- };
2270
-
2271
- WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) {
2272
- return mustache.strip;
2273
- };
2274
-
2275
- WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) {
2276
- /* istanbul ignore next */
2277
- var strip = node.strip || {};
2278
- return {
2279
- inlineStandalone: true,
2280
- open: strip.open,
2281
- close: strip.close
2282
- };
2283
- };
2284
-
2285
- function isPrevWhitespace(body, i, isRoot) {
2286
- if (i === undefined) {
2287
- i = body.length;
2288
- }
2289
-
2290
- // Nodes that end with newlines are considered whitespace (but are special
2291
- // cased for strip operations)
2292
- var prev = body[i - 1],
2293
- sibling = body[i - 2];
2294
- if (!prev) {
2295
- return isRoot;
2296
- }
2297
-
2298
- if (prev.type === 'ContentStatement') {
2299
- return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original);
2300
- }
2301
- }
2302
- function isNextWhitespace(body, i, isRoot) {
2303
- if (i === undefined) {
2304
- i = -1;
2305
- }
2306
-
2307
- var next = body[i + 1],
2308
- sibling = body[i + 2];
2309
- if (!next) {
2310
- return isRoot;
2311
- }
2312
-
2313
- if (next.type === 'ContentStatement') {
2314
- return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original);
2315
- }
2316
- }
2317
-
2318
- // Marks the node to the right of the position as omitted.
2319
- // I.e. {{foo}}' ' will mark the ' ' node as omitted.
2320
- //
2321
- // If i is undefined, then the first child will be marked as such.
2322
- //
2323
- // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
2324
- // content is met.
2325
- function omitRight(body, i, multiple) {
2326
- var current = body[i == null ? 0 : i + 1];
2327
- if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) {
2328
- return;
2329
- }
2330
-
2331
- var original = current.value;
2332
- current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, '');
2333
- current.rightStripped = current.value !== original;
2334
- }
2335
-
2336
- // Marks the node to the left of the position as omitted.
2337
- // I.e. ' '{{foo}} will mark the ' ' node as omitted.
2338
- //
2339
- // If i is undefined then the last child will be marked as such.
2340
- //
2341
- // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
2342
- // content is met.
2343
- function omitLeft(body, i, multiple) {
2344
- var current = body[i == null ? body.length - 1 : i - 1];
2345
- if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) {
2346
- return;
2347
- }
2348
-
2349
- // We omit the last node if it's whitespace only and not preceeded by a non-content node.
2350
- var original = current.value;
2351
- current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, '');
2352
- current.leftStripped = current.value !== original;
2353
- return current.leftStripped;
2354
- }
2355
-
2356
- exports['default'] = WhitespaceControl;
2357
- module.exports = exports['default'];
2358
-
2359
- /***/ },
2360
- /* 25 */
2361
- /***/ function(module, exports, __webpack_require__) {
2362
-
2363
- 'use strict';
2364
-
2365
- var _interopRequireDefault = __webpack_require__(1)['default'];
2366
-
2367
- exports.__esModule = true;
2368
-
2369
- var _exception = __webpack_require__(6);
2370
-
2371
- var _exception2 = _interopRequireDefault(_exception);
2372
-
2373
- function Visitor() {
2374
- this.parents = [];
2375
- }
2376
-
2377
- Visitor.prototype = {
2378
- constructor: Visitor,
2379
- mutating: false,
2380
-
2381
- // Visits a given value. If mutating, will replace the value if necessary.
2382
- acceptKey: function acceptKey(node, name) {
2383
- var value = this.accept(node[name]);
2384
- if (this.mutating) {
2385
- // Hacky sanity check: This may have a few false positives for type for the helper
2386
- // methods but will generally do the right thing without a lot of overhead.
2387
- if (value && !Visitor.prototype[value.type]) {
2388
- throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
2389
- }
2390
- node[name] = value;
2391
- }
2392
- },
2393
-
2394
- // Performs an accept operation with added sanity check to ensure
2395
- // required keys are not removed.
2396
- acceptRequired: function acceptRequired(node, name) {
2397
- this.acceptKey(node, name);
2398
-
2399
- if (!node[name]) {
2400
- throw new _exception2['default'](node.type + ' requires ' + name);
2401
- }
2402
- },
2403
-
2404
- // Traverses a given array. If mutating, empty respnses will be removed
2405
- // for child elements.
2406
- acceptArray: function acceptArray(array) {
2407
- for (var i = 0, l = array.length; i < l; i++) {
2408
- this.acceptKey(array, i);
2409
-
2410
- if (!array[i]) {
2411
- array.splice(i, 1);
2412
- i--;
2413
- l--;
2414
- }
2415
- }
2416
- },
2417
-
2418
- accept: function accept(object) {
2419
- if (!object) {
2420
- return;
2421
- }
2422
-
2423
- /* istanbul ignore next: Sanity code */
2424
- if (!this[object.type]) {
2425
- throw new _exception2['default']('Unknown type: ' + object.type, object);
2426
- }
2427
-
2428
- if (this.current) {
2429
- this.parents.unshift(this.current);
2430
- }
2431
- this.current = object;
2432
-
2433
- var ret = this[object.type](object);
2434
-
2435
- this.current = this.parents.shift();
2436
-
2437
- if (!this.mutating || ret) {
2438
- return ret;
2439
- } else if (ret !== false) {
2440
- return object;
2441
- }
2442
- },
2443
-
2444
- Program: function Program(program) {
2445
- this.acceptArray(program.body);
2446
- },
2447
-
2448
- MustacheStatement: visitSubExpression,
2449
- Decorator: visitSubExpression,
2450
-
2451
- BlockStatement: visitBlock,
2452
- DecoratorBlock: visitBlock,
2453
-
2454
- PartialStatement: visitPartial,
2455
- PartialBlockStatement: function PartialBlockStatement(partial) {
2456
- visitPartial.call(this, partial);
2457
-
2458
- this.acceptKey(partial, 'program');
2459
- },
2460
-
2461
- ContentStatement: function ContentStatement() /* content */{},
2462
- CommentStatement: function CommentStatement() /* comment */{},
2463
-
2464
- SubExpression: visitSubExpression,
2465
-
2466
- PathExpression: function PathExpression() /* path */{},
2467
-
2468
- StringLiteral: function StringLiteral() /* string */{},
2469
- NumberLiteral: function NumberLiteral() /* number */{},
2470
- BooleanLiteral: function BooleanLiteral() /* bool */{},
2471
- UndefinedLiteral: function UndefinedLiteral() /* literal */{},
2472
- NullLiteral: function NullLiteral() /* literal */{},
2473
-
2474
- Hash: function Hash(hash) {
2475
- this.acceptArray(hash.pairs);
2476
- },
2477
- HashPair: function HashPair(pair) {
2478
- this.acceptRequired(pair, 'value');
2479
- }
2480
- };
2481
-
2482
- function visitSubExpression(mustache) {
2483
- this.acceptRequired(mustache, 'path');
2484
- this.acceptArray(mustache.params);
2485
- this.acceptKey(mustache, 'hash');
2486
- }
2487
- function visitBlock(block) {
2488
- visitSubExpression.call(this, block);
2489
-
2490
- this.acceptKey(block, 'program');
2491
- this.acceptKey(block, 'inverse');
2492
- }
2493
- function visitPartial(partial) {
2494
- this.acceptRequired(partial, 'name');
2495
- this.acceptArray(partial.params);
2496
- this.acceptKey(partial, 'hash');
2497
- }
2498
-
2499
- exports['default'] = Visitor;
2500
- module.exports = exports['default'];
2501
-
2502
- /***/ },
2503
- /* 26 */
2504
- /***/ function(module, exports, __webpack_require__) {
2505
-
2506
- 'use strict';
2507
-
2508
- var _interopRequireDefault = __webpack_require__(1)['default'];
2509
-
2510
- exports.__esModule = true;
2511
- exports.SourceLocation = SourceLocation;
2512
- exports.id = id;
2513
- exports.stripFlags = stripFlags;
2514
- exports.stripComment = stripComment;
2515
- exports.preparePath = preparePath;
2516
- exports.prepareMustache = prepareMustache;
2517
- exports.prepareRawBlock = prepareRawBlock;
2518
- exports.prepareBlock = prepareBlock;
2519
- exports.prepareProgram = prepareProgram;
2520
- exports.preparePartialBlock = preparePartialBlock;
2521
-
2522
- var _exception = __webpack_require__(6);
2523
-
2524
- var _exception2 = _interopRequireDefault(_exception);
2525
-
2526
- function validateClose(open, close) {
2527
- close = close.path ? close.path.original : close;
2528
-
2529
- if (open.path.original !== close) {
2530
- var errorNode = { loc: open.path.loc };
2531
-
2532
- throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode);
2533
- }
2534
- }
2535
-
2536
- function SourceLocation(source, locInfo) {
2537
- this.source = source;
2538
- this.start = {
2539
- line: locInfo.first_line,
2540
- column: locInfo.first_column
2541
- };
2542
- this.end = {
2543
- line: locInfo.last_line,
2544
- column: locInfo.last_column
2545
- };
2546
- }
2547
-
2548
- function id(token) {
2549
- if (/^\[.*\]$/.test(token)) {
2550
- return token.substr(1, token.length - 2);
2551
- } else {
2552
- return token;
2553
- }
2554
- }
2555
-
2556
- function stripFlags(open, close) {
2557
- return {
2558
- open: open.charAt(2) === '~',
2559
- close: close.charAt(close.length - 3) === '~'
2560
- };
2561
- }
2562
-
2563
- function stripComment(comment) {
2564
- return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, '');
2565
- }
2566
-
2567
- function preparePath(data, parts, loc) {
2568
- loc = this.locInfo(loc);
2569
-
2570
- var original = data ? '@' : '',
2571
- dig = [],
2572
- depth = 0,
2573
- depthString = '';
2574
-
2575
- for (var i = 0, l = parts.length; i < l; i++) {
2576
- var part = parts[i].part,
2577
-
2578
- // If we have [] syntax then we do not treat path references as operators,
2579
- // i.e. foo.[this] resolves to approximately context.foo['this']
2580
- isLiteral = parts[i].original !== part;
2581
- original += (parts[i].separator || '') + part;
2582
-
2583
- if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {
2584
- if (dig.length > 0) {
2585
- throw new _exception2['default']('Invalid path: ' + original, { loc: loc });
2586
- } else if (part === '..') {
2587
- depth++;
2588
- depthString += '../';
2589
- }
2590
- } else {
2591
- dig.push(part);
2592
- }
2593
- }
2594
-
2595
- return {
2596
- type: 'PathExpression',
2597
- data: data,
2598
- depth: depth,
2599
- parts: dig,
2600
- original: original,
2601
- loc: loc
2602
- };
2603
- }
2604
-
2605
- function prepareMustache(path, params, hash, open, strip, locInfo) {
2606
- // Must use charAt to support IE pre-10
2607
- var escapeFlag = open.charAt(3) || open.charAt(2),
2608
- escaped = escapeFlag !== '{' && escapeFlag !== '&';
2609
-
2610
- var decorator = /\*/.test(open);
2611
- return {
2612
- type: decorator ? 'Decorator' : 'MustacheStatement',
2613
- path: path,
2614
- params: params,
2615
- hash: hash,
2616
- escaped: escaped,
2617
- strip: strip,
2618
- loc: this.locInfo(locInfo)
2619
- };
2620
- }
2621
-
2622
- function prepareRawBlock(openRawBlock, contents, close, locInfo) {
2623
- validateClose(openRawBlock, close);
2624
-
2625
- locInfo = this.locInfo(locInfo);
2626
- var program = {
2627
- type: 'Program',
2628
- body: contents,
2629
- strip: {},
2630
- loc: locInfo
2631
- };
2632
-
2633
- return {
2634
- type: 'BlockStatement',
2635
- path: openRawBlock.path,
2636
- params: openRawBlock.params,
2637
- hash: openRawBlock.hash,
2638
- program: program,
2639
- openStrip: {},
2640
- inverseStrip: {},
2641
- closeStrip: {},
2642
- loc: locInfo
2643
- };
2644
- }
2645
-
2646
- function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
2647
- if (close && close.path) {
2648
- validateClose(openBlock, close);
2649
- }
2650
-
2651
- var decorator = /\*/.test(openBlock.open);
2652
-
2653
- program.blockParams = openBlock.blockParams;
2654
-
2655
- var inverse = undefined,
2656
- inverseStrip = undefined;
2657
-
2658
- if (inverseAndProgram) {
2659
- if (decorator) {
2660
- throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram);
2661
- }
2662
-
2663
- if (inverseAndProgram.chain) {
2664
- inverseAndProgram.program.body[0].closeStrip = close.strip;
2665
- }
2666
-
2667
- inverseStrip = inverseAndProgram.strip;
2668
- inverse = inverseAndProgram.program;
2669
- }
2670
-
2671
- if (inverted) {
2672
- inverted = inverse;
2673
- inverse = program;
2674
- program = inverted;
2675
- }
2676
-
2677
- return {
2678
- type: decorator ? 'DecoratorBlock' : 'BlockStatement',
2679
- path: openBlock.path,
2680
- params: openBlock.params,
2681
- hash: openBlock.hash,
2682
- program: program,
2683
- inverse: inverse,
2684
- openStrip: openBlock.strip,
2685
- inverseStrip: inverseStrip,
2686
- closeStrip: close && close.strip,
2687
- loc: this.locInfo(locInfo)
2688
- };
2689
- }
2690
-
2691
- function prepareProgram(statements, loc) {
2692
- if (!loc && statements.length) {
2693
- var firstLoc = statements[0].loc,
2694
- lastLoc = statements[statements.length - 1].loc;
2695
-
2696
- /* istanbul ignore else */
2697
- if (firstLoc && lastLoc) {
2698
- loc = {
2699
- source: firstLoc.source,
2700
- start: {
2701
- line: firstLoc.start.line,
2702
- column: firstLoc.start.column
2703
- },
2704
- end: {
2705
- line: lastLoc.end.line,
2706
- column: lastLoc.end.column
2707
- }
2708
- };
2709
- }
2710
- }
2711
-
2712
- return {
2713
- type: 'Program',
2714
- body: statements,
2715
- strip: {},
2716
- loc: loc
2717
- };
2718
- }
2719
-
2720
- function preparePartialBlock(open, program, close, locInfo) {
2721
- validateClose(open, close);
2722
-
2723
- return {
2724
- type: 'PartialBlockStatement',
2725
- name: open.path,
2726
- params: open.params,
2727
- hash: open.hash,
2728
- program: program,
2729
- openStrip: open.strip,
2730
- closeStrip: close && close.strip,
2731
- loc: this.locInfo(locInfo)
2732
- };
2733
- }
2734
-
2735
- /***/ },
2736
- /* 27 */
2737
- /***/ function(module, exports, __webpack_require__) {
2738
-
2739
- /* eslint-disable new-cap */
2740
-
2741
- 'use strict';
2742
-
2743
- var _interopRequireDefault = __webpack_require__(1)['default'];
2744
-
2745
- exports.__esModule = true;
2746
- exports.Compiler = Compiler;
2747
- exports.precompile = precompile;
2748
- exports.compile = compile;
2749
-
2750
- var _exception = __webpack_require__(6);
2751
-
2752
- var _exception2 = _interopRequireDefault(_exception);
2753
-
2754
- var _utils = __webpack_require__(5);
2755
-
2756
- var _ast = __webpack_require__(21);
2757
-
2758
- var _ast2 = _interopRequireDefault(_ast);
2759
-
2760
- var slice = [].slice;
2761
-
2762
- function Compiler() {}
2763
-
2764
- // the foundHelper register will disambiguate helper lookup from finding a
2765
- // function in a context. This is necessary for mustache compatibility, which
2766
- // requires that context functions in blocks are evaluated by blockHelperMissing,
2767
- // and then proceed as if the resulting value was provided to blockHelperMissing.
2768
-
2769
- Compiler.prototype = {
2770
- compiler: Compiler,
2771
-
2772
- equals: function equals(other) {
2773
- var len = this.opcodes.length;
2774
- if (other.opcodes.length !== len) {
2775
- return false;
2776
- }
2777
-
2778
- for (var i = 0; i < len; i++) {
2779
- var opcode = this.opcodes[i],
2780
- otherOpcode = other.opcodes[i];
2781
- if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {
2782
- return false;
2783
- }
2784
- }
2785
-
2786
- // We know that length is the same between the two arrays because they are directly tied
2787
- // to the opcode behavior above.
2788
- len = this.children.length;
2789
- for (var i = 0; i < len; i++) {
2790
- if (!this.children[i].equals(other.children[i])) {
2791
- return false;
2792
- }
2793
- }
2794
-
2795
- return true;
2796
- },
2797
-
2798
- guid: 0,
2799
-
2800
- compile: function compile(program, options) {
2801
- this.sourceNode = [];
2802
- this.opcodes = [];
2803
- this.children = [];
2804
- this.options = options;
2805
- this.stringParams = options.stringParams;
2806
- this.trackIds = options.trackIds;
2807
-
2808
- options.blockParams = options.blockParams || [];
2809
-
2810
- // These changes will propagate to the other compiler components
2811
- var knownHelpers = options.knownHelpers;
2812
- options.knownHelpers = {
2813
- 'helperMissing': true,
2814
- 'blockHelperMissing': true,
2815
- 'each': true,
2816
- 'if': true,
2817
- 'unless': true,
2818
- 'with': true,
2819
- 'log': true,
2820
- 'lookup': true
2821
- };
2822
- if (knownHelpers) {
2823
- for (var _name in knownHelpers) {
2824
- /* istanbul ignore else */
2825
- if (_name in knownHelpers) {
2826
- options.knownHelpers[_name] = knownHelpers[_name];
2827
- }
2828
- }
2829
- }
2830
-
2831
- return this.accept(program);
2832
- },
2833
-
2834
- compileProgram: function compileProgram(program) {
2835
- var childCompiler = new this.compiler(),
2836
- // eslint-disable-line new-cap
2837
- result = childCompiler.compile(program, this.options),
2838
- guid = this.guid++;
2839
-
2840
- this.usePartial = this.usePartial || result.usePartial;
2841
-
2842
- this.children[guid] = result;
2843
- this.useDepths = this.useDepths || result.useDepths;
2844
-
2845
- return guid;
2846
- },
2847
-
2848
- accept: function accept(node) {
2849
- /* istanbul ignore next: Sanity code */
2850
- if (!this[node.type]) {
2851
- throw new _exception2['default']('Unknown type: ' + node.type, node);
2852
- }
2853
-
2854
- this.sourceNode.unshift(node);
2855
- var ret = this[node.type](node);
2856
- this.sourceNode.shift();
2857
- return ret;
2858
- },
2859
-
2860
- Program: function Program(program) {
2861
- this.options.blockParams.unshift(program.blockParams);
2862
-
2863
- var body = program.body,
2864
- bodyLength = body.length;
2865
- for (var i = 0; i < bodyLength; i++) {
2866
- this.accept(body[i]);
2867
- }
2868
-
2869
- this.options.blockParams.shift();
2870
-
2871
- this.isSimple = bodyLength === 1;
2872
- this.blockParams = program.blockParams ? program.blockParams.length : 0;
2873
-
2874
- return this;
2875
- },
2876
-
2877
- BlockStatement: function BlockStatement(block) {
2878
- transformLiteralToPath(block);
2879
-
2880
- var program = block.program,
2881
- inverse = block.inverse;
2882
-
2883
- program = program && this.compileProgram(program);
2884
- inverse = inverse && this.compileProgram(inverse);
2885
-
2886
- var type = this.classifySexpr(block);
2887
-
2888
- if (type === 'helper') {
2889
- this.helperSexpr(block, program, inverse);
2890
- } else if (type === 'simple') {
2891
- this.simpleSexpr(block);
2892
-
2893
- // now that the simple mustache is resolved, we need to
2894
- // evaluate it by executing `blockHelperMissing`
2895
- this.opcode('pushProgram', program);
2896
- this.opcode('pushProgram', inverse);
2897
- this.opcode('emptyHash');
2898
- this.opcode('blockValue', block.path.original);
2899
- } else {
2900
- this.ambiguousSexpr(block, program, inverse);
2901
-
2902
- // now that the simple mustache is resolved, we need to
2903
- // evaluate it by executing `blockHelperMissing`
2904
- this.opcode('pushProgram', program);
2905
- this.opcode('pushProgram', inverse);
2906
- this.opcode('emptyHash');
2907
- this.opcode('ambiguousBlockValue');
2908
- }
2909
-
2910
- this.opcode('append');
2911
- },
2912
-
2913
- DecoratorBlock: function DecoratorBlock(decorator) {
2914
- var program = decorator.program && this.compileProgram(decorator.program);
2915
- var params = this.setupFullMustacheParams(decorator, program, undefined),
2916
- path = decorator.path;
2917
-
2918
- this.useDecorators = true;
2919
- this.opcode('registerDecorator', params.length, path.original);
2920
- },
2921
-
2922
- PartialStatement: function PartialStatement(partial) {
2923
- this.usePartial = true;
2924
-
2925
- var program = partial.program;
2926
- if (program) {
2927
- program = this.compileProgram(partial.program);
2928
- }
2929
-
2930
- var params = partial.params;
2931
- if (params.length > 1) {
2932
- throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial);
2933
- } else if (!params.length) {
2934
- if (this.options.explicitPartialContext) {
2935
- this.opcode('pushLiteral', 'undefined');
2936
- } else {
2937
- params.push({ type: 'PathExpression', parts: [], depth: 0 });
2938
- }
2939
- }
2940
-
2941
- var partialName = partial.name.original,
2942
- isDynamic = partial.name.type === 'SubExpression';
2943
- if (isDynamic) {
2944
- this.accept(partial.name);
2945
- }
2946
-
2947
- this.setupFullMustacheParams(partial, program, undefined, true);
2948
-
2949
- var indent = partial.indent || '';
2950
- if (this.options.preventIndent && indent) {
2951
- this.opcode('appendContent', indent);
2952
- indent = '';
2953
- }
2954
-
2955
- this.opcode('invokePartial', isDynamic, partialName, indent);
2956
- this.opcode('append');
2957
- },
2958
- PartialBlockStatement: function PartialBlockStatement(partialBlock) {
2959
- this.PartialStatement(partialBlock);
2960
- },
2961
-
2962
- MustacheStatement: function MustacheStatement(mustache) {
2963
- this.SubExpression(mustache);
2964
-
2965
- if (mustache.escaped && !this.options.noEscape) {
2966
- this.opcode('appendEscaped');
2967
- } else {
2968
- this.opcode('append');
2969
- }
2970
- },
2971
- Decorator: function Decorator(decorator) {
2972
- this.DecoratorBlock(decorator);
2973
- },
2974
-
2975
- ContentStatement: function ContentStatement(content) {
2976
- if (content.value) {
2977
- this.opcode('appendContent', content.value);
2978
- }
2979
- },
2980
-
2981
- CommentStatement: function CommentStatement() {},
2982
-
2983
- SubExpression: function SubExpression(sexpr) {
2984
- transformLiteralToPath(sexpr);
2985
- var type = this.classifySexpr(sexpr);
2986
-
2987
- if (type === 'simple') {
2988
- this.simpleSexpr(sexpr);
2989
- } else if (type === 'helper') {
2990
- this.helperSexpr(sexpr);
2991
- } else {
2992
- this.ambiguousSexpr(sexpr);
2993
- }
2994
- },
2995
- ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
2996
- var path = sexpr.path,
2997
- name = path.parts[0],
2998
- isBlock = program != null || inverse != null;
2999
-
3000
- this.opcode('getContext', path.depth);
3001
-
3002
- this.opcode('pushProgram', program);
3003
- this.opcode('pushProgram', inverse);
3004
-
3005
- path.strict = true;
3006
- this.accept(path);
3007
-
3008
- this.opcode('invokeAmbiguous', name, isBlock);
3009
- },
3010
-
3011
- simpleSexpr: function simpleSexpr(sexpr) {
3012
- var path = sexpr.path;
3013
- path.strict = true;
3014
- this.accept(path);
3015
- this.opcode('resolvePossibleLambda');
3016
- },
3017
-
3018
- helperSexpr: function helperSexpr(sexpr, program, inverse) {
3019
- var params = this.setupFullMustacheParams(sexpr, program, inverse),
3020
- path = sexpr.path,
3021
- name = path.parts[0];
3022
-
3023
- if (this.options.knownHelpers[name]) {
3024
- this.opcode('invokeKnownHelper', params.length, name);
3025
- } else if (this.options.knownHelpersOnly) {
3026
- throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
3027
- } else {
3028
- path.strict = true;
3029
- path.falsy = true;
3030
-
3031
- this.accept(path);
3032
- this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path));
3033
- }
3034
- },
3035
-
3036
- PathExpression: function PathExpression(path) {
3037
- this.addDepth(path.depth);
3038
- this.opcode('getContext', path.depth);
3039
-
3040
- var name = path.parts[0],
3041
- scoped = _ast2['default'].helpers.scopedId(path),
3042
- blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
3043
-
3044
- if (blockParamId) {
3045
- this.opcode('lookupBlockParam', blockParamId, path.parts);
3046
- } else if (!name) {
3047
- // Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
3048
- this.opcode('pushContext');
3049
- } else if (path.data) {
3050
- this.options.data = true;
3051
- this.opcode('lookupData', path.depth, path.parts, path.strict);
3052
- } else {
3053
- this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped);
3054
- }
3055
- },
3056
-
3057
- StringLiteral: function StringLiteral(string) {
3058
- this.opcode('pushString', string.value);
3059
- },
3060
-
3061
- NumberLiteral: function NumberLiteral(number) {
3062
- this.opcode('pushLiteral', number.value);
3063
- },
3064
-
3065
- BooleanLiteral: function BooleanLiteral(bool) {
3066
- this.opcode('pushLiteral', bool.value);
3067
- },
3068
-
3069
- UndefinedLiteral: function UndefinedLiteral() {
3070
- this.opcode('pushLiteral', 'undefined');
3071
- },
3072
-
3073
- NullLiteral: function NullLiteral() {
3074
- this.opcode('pushLiteral', 'null');
3075
- },
3076
-
3077
- Hash: function Hash(hash) {
3078
- var pairs = hash.pairs,
3079
- i = 0,
3080
- l = pairs.length;
3081
-
3082
- this.opcode('pushHash');
3083
-
3084
- for (; i < l; i++) {
3085
- this.pushParam(pairs[i].value);
3086
- }
3087
- while (i--) {
3088
- this.opcode('assignToHash', pairs[i].key);
3089
- }
3090
- this.opcode('popHash');
3091
- },
3092
-
3093
- // HELPERS
3094
- opcode: function opcode(name) {
3095
- this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
3096
- },
3097
-
3098
- addDepth: function addDepth(depth) {
3099
- if (!depth) {
3100
- return;
3101
- }
3102
-
3103
- this.useDepths = true;
3104
- },
3105
-
3106
- classifySexpr: function classifySexpr(sexpr) {
3107
- var isSimple = _ast2['default'].helpers.simpleId(sexpr.path);
3108
-
3109
- var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
3110
-
3111
- // a mustache is an eligible helper if:
3112
- // * its id is simple (a single part, not `this` or `..`)
3113
- var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr);
3114
-
3115
- // if a mustache is an eligible helper but not a definite
3116
- // helper, it is ambiguous, and will be resolved in a later
3117
- // pass or at runtime.
3118
- var isEligible = !isBlockParam && (isHelper || isSimple);
3119
-
3120
- // if ambiguous, we can possibly resolve the ambiguity now
3121
- // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
3122
- if (isEligible && !isHelper) {
3123
- var _name2 = sexpr.path.parts[0],
3124
- options = this.options;
3125
-
3126
- if (options.knownHelpers[_name2]) {
3127
- isHelper = true;
3128
- } else if (options.knownHelpersOnly) {
3129
- isEligible = false;
3130
- }
3131
- }
3132
-
3133
- if (isHelper) {
3134
- return 'helper';
3135
- } else if (isEligible) {
3136
- return 'ambiguous';
3137
- } else {
3138
- return 'simple';
3139
- }
3140
- },
3141
-
3142
- pushParams: function pushParams(params) {
3143
- for (var i = 0, l = params.length; i < l; i++) {
3144
- this.pushParam(params[i]);
3145
- }
3146
- },
3147
-
3148
- pushParam: function pushParam(val) {
3149
- var value = val.value != null ? val.value : val.original || '';
3150
-
3151
- if (this.stringParams) {
3152
- if (value.replace) {
3153
- value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.');
3154
- }
3155
-
3156
- if (val.depth) {
3157
- this.addDepth(val.depth);
3158
- }
3159
- this.opcode('getContext', val.depth || 0);
3160
- this.opcode('pushStringParam', value, val.type);
3161
-
3162
- if (val.type === 'SubExpression') {
3163
- // SubExpressions get evaluated and passed in
3164
- // in string params mode.
3165
- this.accept(val);
3166
- }
3167
- } else {
3168
- if (this.trackIds) {
3169
- var blockParamIndex = undefined;
3170
- if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) {
3171
- blockParamIndex = this.blockParamIndex(val.parts[0]);
3172
- }
3173
- if (blockParamIndex) {
3174
- var blockParamChild = val.parts.slice(1).join('.');
3175
- this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
3176
- } else {
3177
- value = val.original || value;
3178
- if (value.replace) {
3179
- value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, '');
3180
- }
3181
-
3182
- this.opcode('pushId', val.type, value);
3183
- }
3184
- }
3185
- this.accept(val);
3186
- }
3187
- },
3188
-
3189
- setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) {
3190
- var params = sexpr.params;
3191
- this.pushParams(params);
3192
-
3193
- this.opcode('pushProgram', program);
3194
- this.opcode('pushProgram', inverse);
3195
-
3196
- if (sexpr.hash) {
3197
- this.accept(sexpr.hash);
3198
- } else {
3199
- this.opcode('emptyHash', omitEmpty);
3200
- }
3201
-
3202
- return params;
3203
- },
3204
-
3205
- blockParamIndex: function blockParamIndex(name) {
3206
- for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
3207
- var blockParams = this.options.blockParams[depth],
3208
- param = blockParams && _utils.indexOf(blockParams, name);
3209
- if (blockParams && param >= 0) {
3210
- return [depth, param];
3211
- }
3212
- }
3213
- }
3214
- };
3215
-
3216
- function precompile(input, options, env) {
3217
- if (input == null || typeof input !== 'string' && input.type !== 'Program') {
3218
- throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input);
3219
- }
3220
-
3221
- options = options || {};
3222
- if (!('data' in options)) {
3223
- options.data = true;
3224
- }
3225
- if (options.compat) {
3226
- options.useDepths = true;
3227
- }
3228
-
3229
- var ast = env.parse(input, options),
3230
- environment = new env.Compiler().compile(ast, options);
3231
- return new env.JavaScriptCompiler().compile(environment, options);
3232
- }
3233
-
3234
- function compile(input, options, env) {
3235
- if (options === undefined) options = {};
3236
-
3237
- if (input == null || typeof input !== 'string' && input.type !== 'Program') {
3238
- throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input);
3239
- }
3240
-
3241
- if (!('data' in options)) {
3242
- options.data = true;
3243
- }
3244
- if (options.compat) {
3245
- options.useDepths = true;
3246
- }
3247
-
3248
- var compiled = undefined;
3249
-
3250
- function compileInput() {
3251
- var ast = env.parse(input, options),
3252
- environment = new env.Compiler().compile(ast, options),
3253
- templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
3254
- return env.template(templateSpec);
3255
- }
3256
-
3257
- // Template is only compiled on first use and cached after that point.
3258
- function ret(context, execOptions) {
3259
- if (!compiled) {
3260
- compiled = compileInput();
3261
- }
3262
- return compiled.call(this, context, execOptions);
3263
- }
3264
- ret._setup = function (setupOptions) {
3265
- if (!compiled) {
3266
- compiled = compileInput();
3267
- }
3268
- return compiled._setup(setupOptions);
3269
- };
3270
- ret._child = function (i, data, blockParams, depths) {
3271
- if (!compiled) {
3272
- compiled = compileInput();
3273
- }
3274
- return compiled._child(i, data, blockParams, depths);
3275
- };
3276
- return ret;
3277
- }
3278
-
3279
- function argEquals(a, b) {
3280
- if (a === b) {
3281
- return true;
3282
- }
3283
-
3284
- if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) {
3285
- for (var i = 0; i < a.length; i++) {
3286
- if (!argEquals(a[i], b[i])) {
3287
- return false;
3288
- }
3289
- }
3290
- return true;
3291
- }
3292
- }
3293
-
3294
- function transformLiteralToPath(sexpr) {
3295
- if (!sexpr.path.parts) {
3296
- var literal = sexpr.path;
3297
- // Casting to string here to make false and 0 literal values play nicely with the rest
3298
- // of the system.
3299
- sexpr.path = {
3300
- type: 'PathExpression',
3301
- data: false,
3302
- depth: 0,
3303
- parts: [literal.original + ''],
3304
- original: literal.original + '',
3305
- loc: literal.loc
3306
- };
3307
- }
3308
- }
3309
-
3310
- /***/ },
3311
- /* 28 */
3312
- /***/ function(module, exports, __webpack_require__) {
3313
-
3314
- 'use strict';
3315
-
3316
- var _interopRequireDefault = __webpack_require__(1)['default'];
3317
-
3318
- exports.__esModule = true;
3319
-
3320
- var _base = __webpack_require__(4);
3321
-
3322
- var _exception = __webpack_require__(6);
3323
-
3324
- var _exception2 = _interopRequireDefault(_exception);
3325
-
3326
- var _utils = __webpack_require__(5);
3327
-
3328
- var _codeGen = __webpack_require__(29);
3329
-
3330
- var _codeGen2 = _interopRequireDefault(_codeGen);
3331
-
3332
- function Literal(value) {
3333
- this.value = value;
3334
- }
3335
-
3336
- function JavaScriptCompiler() {}
3337
-
3338
- JavaScriptCompiler.prototype = {
3339
- // PUBLIC API: You can override these methods in a subclass to provide
3340
- // alternative compiled forms for name lookup and buffering semantics
3341
- nameLookup: function nameLookup(parent, name /* , type*/) {
3342
- if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
3343
- return [parent, '.', name];
3344
- } else {
3345
- return [parent, '[', JSON.stringify(name), ']'];
3346
- }
3347
- },
3348
- depthedLookup: function depthedLookup(name) {
3349
- return [this.aliasable('container.lookup'), '(depths, "', name, '")'];
3350
- },
3351
-
3352
- compilerInfo: function compilerInfo() {
3353
- var revision = _base.COMPILER_REVISION,
3354
- versions = _base.REVISION_CHANGES[revision];
3355
- return [revision, versions];
3356
- },
3357
-
3358
- appendToBuffer: function appendToBuffer(source, location, explicit) {
3359
- // Force a source as this simplifies the merge logic.
3360
- if (!_utils.isArray(source)) {
3361
- source = [source];
3362
- }
3363
- source = this.source.wrap(source, location);
3364
-
3365
- if (this.environment.isSimple) {
3366
- return ['return ', source, ';'];
3367
- } else if (explicit) {
3368
- // This is a case where the buffer operation occurs as a child of another
3369
- // construct, generally braces. We have to explicitly output these buffer
3370
- // operations to ensure that the emitted code goes in the correct location.
3371
- return ['buffer += ', source, ';'];
3372
- } else {
3373
- source.appendToBuffer = true;
3374
- return source;
3375
- }
3376
- },
3377
-
3378
- initializeBuffer: function initializeBuffer() {
3379
- return this.quotedString('');
3380
- },
3381
- // END PUBLIC API
3382
-
3383
- compile: function compile(environment, options, context, asObject) {
3384
- this.environment = environment;
3385
- this.options = options;
3386
- this.stringParams = this.options.stringParams;
3387
- this.trackIds = this.options.trackIds;
3388
- this.precompile = !asObject;
3389
-
3390
- this.name = this.environment.name;
3391
- this.isChild = !!context;
3392
- this.context = context || {
3393
- decorators: [],
3394
- programs: [],
3395
- environments: []
3396
- };
3397
-
3398
- this.preamble();
3399
-
3400
- this.stackSlot = 0;
3401
- this.stackVars = [];
3402
- this.aliases = {};
3403
- this.registers = { list: [] };
3404
- this.hashes = [];
3405
- this.compileStack = [];
3406
- this.inlineStack = [];
3407
- this.blockParams = [];
3408
-
3409
- this.compileChildren(environment, options);
3410
-
3411
- this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat;
3412
- this.useBlockParams = this.useBlockParams || environment.useBlockParams;
3413
-
3414
- var opcodes = environment.opcodes,
3415
- opcode = undefined,
3416
- firstLoc = undefined,
3417
- i = undefined,
3418
- l = undefined;
3419
-
3420
- for (i = 0, l = opcodes.length; i < l; i++) {
3421
- opcode = opcodes[i];
3422
-
3423
- this.source.currentLocation = opcode.loc;
3424
- firstLoc = firstLoc || opcode.loc;
3425
- this[opcode.opcode].apply(this, opcode.args);
3426
- }
3427
-
3428
- // Flush any trailing content that might be pending.
3429
- this.source.currentLocation = firstLoc;
3430
- this.pushSource('');
3431
-
3432
- /* istanbul ignore next */
3433
- if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
3434
- throw new _exception2['default']('Compile completed with content left on stack');
3435
- }
3436
-
3437
- if (!this.decorators.isEmpty()) {
3438
- this.useDecorators = true;
3439
-
3440
- this.decorators.prepend('var decorators = container.decorators;\n');
3441
- this.decorators.push('return fn;');
3442
-
3443
- if (asObject) {
3444
- this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]);
3445
- } else {
3446
- this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n');
3447
- this.decorators.push('}\n');
3448
- this.decorators = this.decorators.merge();
3449
- }
3450
- } else {
3451
- this.decorators = undefined;
3452
- }
3453
-
3454
- var fn = this.createFunctionContext(asObject);
3455
- if (!this.isChild) {
3456
- var ret = {
3457
- compiler: this.compilerInfo(),
3458
- main: fn
3459
- };
3460
-
3461
- if (this.decorators) {
3462
- ret.main_d = this.decorators; // eslint-disable-line camelcase
3463
- ret.useDecorators = true;
3464
- }
3465
-
3466
- var _context = this.context;
3467
- var programs = _context.programs;
3468
- var decorators = _context.decorators;
3469
-
3470
- for (i = 0, l = programs.length; i < l; i++) {
3471
- if (programs[i]) {
3472
- ret[i] = programs[i];
3473
- if (decorators[i]) {
3474
- ret[i + '_d'] = decorators[i];
3475
- ret.useDecorators = true;
3476
- }
3477
- }
3478
- }
3479
-
3480
- if (this.environment.usePartial) {
3481
- ret.usePartial = true;
3482
- }
3483
- if (this.options.data) {
3484
- ret.useData = true;
3485
- }
3486
- if (this.useDepths) {
3487
- ret.useDepths = true;
3488
- }
3489
- if (this.useBlockParams) {
3490
- ret.useBlockParams = true;
3491
- }
3492
- if (this.options.compat) {
3493
- ret.compat = true;
3494
- }
3495
-
3496
- if (!asObject) {
3497
- ret.compiler = JSON.stringify(ret.compiler);
3498
-
3499
- this.source.currentLocation = { start: { line: 1, column: 0 } };
3500
- ret = this.objectLiteral(ret);
3501
-
3502
- if (options.srcName) {
3503
- ret = ret.toStringWithSourceMap({ file: options.destName });
3504
- ret.map = ret.map && ret.map.toString();
3505
- } else {
3506
- ret = ret.toString();
3507
- }
3508
- } else {
3509
- ret.compilerOptions = this.options;
3510
- }
3511
-
3512
- return ret;
3513
- } else {
3514
- return fn;
3515
- }
3516
- },
3517
-
3518
- preamble: function preamble() {
3519
- // track the last context pushed into place to allow skipping the
3520
- // getContext opcode when it would be a noop
3521
- this.lastContext = 0;
3522
- this.source = new _codeGen2['default'](this.options.srcName);
3523
- this.decorators = new _codeGen2['default'](this.options.srcName);
3524
- },
3525
-
3526
- createFunctionContext: function createFunctionContext(asObject) {
3527
- var varDeclarations = '';
3528
-
3529
- var locals = this.stackVars.concat(this.registers.list);
3530
- if (locals.length > 0) {
3531
- varDeclarations += ', ' + locals.join(', ');
3532
- }
3533
-
3534
- // Generate minimizer alias mappings
3535
- //
3536
- // When using true SourceNodes, this will update all references to the given alias
3537
- // as the source nodes are reused in situ. For the non-source node compilation mode,
3538
- // aliases will not be used, but this case is already being run on the client and
3539
- // we aren't concern about minimizing the template size.
3540
- var aliasCount = 0;
3541
- for (var alias in this.aliases) {
3542
- // eslint-disable-line guard-for-in
3543
- var node = this.aliases[alias];
3544
-
3545
- if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
3546
- varDeclarations += ', alias' + ++aliasCount + '=' + alias;
3547
- node.children[0] = 'alias' + aliasCount;
3548
- }
3549
- }
3550
-
3551
- var params = ['container', 'depth0', 'helpers', 'partials', 'data'];
3552
-
3553
- if (this.useBlockParams || this.useDepths) {
3554
- params.push('blockParams');
3555
- }
3556
- if (this.useDepths) {
3557
- params.push('depths');
3558
- }
3559
-
3560
- // Perform a second pass over the output to merge content when possible
3561
- var source = this.mergeSource(varDeclarations);
3562
-
3563
- if (asObject) {
3564
- params.push(source);
3565
-
3566
- return Function.apply(this, params);
3567
- } else {
3568
- return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
3569
- }
3570
- },
3571
- mergeSource: function mergeSource(varDeclarations) {
3572
- var isSimple = this.environment.isSimple,
3573
- appendOnly = !this.forceBuffer,
3574
- appendFirst = undefined,
3575
- sourceSeen = undefined,
3576
- bufferStart = undefined,
3577
- bufferEnd = undefined;
3578
- this.source.each(function (line) {
3579
- if (line.appendToBuffer) {
3580
- if (bufferStart) {
3581
- line.prepend(' + ');
3582
- } else {
3583
- bufferStart = line;
3584
- }
3585
- bufferEnd = line;
3586
- } else {
3587
- if (bufferStart) {
3588
- if (!sourceSeen) {
3589
- appendFirst = true;
3590
- } else {
3591
- bufferStart.prepend('buffer += ');
3592
- }
3593
- bufferEnd.add(';');
3594
- bufferStart = bufferEnd = undefined;
3595
- }
3596
-
3597
- sourceSeen = true;
3598
- if (!isSimple) {
3599
- appendOnly = false;
3600
- }
3601
- }
3602
- });
3603
-
3604
- if (appendOnly) {
3605
- if (bufferStart) {
3606
- bufferStart.prepend('return ');
3607
- bufferEnd.add(';');
3608
- } else if (!sourceSeen) {
3609
- this.source.push('return "";');
3610
- }
3611
- } else {
3612
- varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer());
3613
-
3614
- if (bufferStart) {
3615
- bufferStart.prepend('return buffer + ');
3616
- bufferEnd.add(';');
3617
- } else {
3618
- this.source.push('return buffer;');
3619
- }
3620
- }
3621
-
3622
- if (varDeclarations) {
3623
- this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
3624
- }
3625
-
3626
- return this.source.merge();
3627
- },
3628
-
3629
- // [blockValue]
3630
- //
3631
- // On stack, before: hash, inverse, program, value
3632
- // On stack, after: return value of blockHelperMissing
3633
- //
3634
- // The purpose of this opcode is to take a block of the form
3635
- // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
3636
- // replace it on the stack with the result of properly
3637
- // invoking blockHelperMissing.
3638
- blockValue: function blockValue(name) {
3639
- var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
3640
- params = [this.contextName(0)];
3641
- this.setupHelperArgs(name, 0, params);
3642
-
3643
- var blockName = this.popStack();
3644
- params.splice(1, 0, blockName);
3645
-
3646
- this.push(this.source.functionCall(blockHelperMissing, 'call', params));
3647
- },
3648
-
3649
- // [ambiguousBlockValue]
3650
- //
3651
- // On stack, before: hash, inverse, program, value
3652
- // Compiler value, before: lastHelper=value of last found helper, if any
3653
- // On stack, after, if no lastHelper: same as [blockValue]
3654
- // On stack, after, if lastHelper: value
3655
- ambiguousBlockValue: function ambiguousBlockValue() {
3656
- // We're being a bit cheeky and reusing the options value from the prior exec
3657
- var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
3658
- params = [this.contextName(0)];
3659
- this.setupHelperArgs('', 0, params, true);
3660
-
3661
- this.flushInline();
3662
-
3663
- var current = this.topStack();
3664
- params.splice(1, 0, current);
3665
-
3666
- this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']);
3667
- },
3668
-
3669
- // [appendContent]
3670
- //
3671
- // On stack, before: ...
3672
- // On stack, after: ...
3673
- //
3674
- // Appends the string value of `content` to the current buffer
3675
- appendContent: function appendContent(content) {
3676
- if (this.pendingContent) {
3677
- content = this.pendingContent + content;
3678
- } else {
3679
- this.pendingLocation = this.source.currentLocation;
3680
- }
3681
-
3682
- this.pendingContent = content;
3683
- },
3684
-
3685
- // [append]
3686
- //
3687
- // On stack, before: value, ...
3688
- // On stack, after: ...
3689
- //
3690
- // Coerces `value` to a String and appends it to the current buffer.
3691
- //
3692
- // If `value` is truthy, or 0, it is coerced into a string and appended
3693
- // Otherwise, the empty string is appended
3694
- append: function append() {
3695
- if (this.isInline()) {
3696
- this.replaceStack(function (current) {
3697
- return [' != null ? ', current, ' : ""'];
3698
- });
3699
-
3700
- this.pushSource(this.appendToBuffer(this.popStack()));
3701
- } else {
3702
- var local = this.popStack();
3703
- this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
3704
- if (this.environment.isSimple) {
3705
- this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
3706
- }
3707
- }
3708
- },
3709
-
3710
- // [appendEscaped]
3711
- //
3712
- // On stack, before: value, ...
3713
- // On stack, after: ...
3714
- //
3715
- // Escape `value` and append it to the buffer
3716
- appendEscaped: function appendEscaped() {
3717
- this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')']));
3718
- },
3719
-
3720
- // [getContext]
3721
- //
3722
- // On stack, before: ...
3723
- // On stack, after: ...
3724
- // Compiler value, after: lastContext=depth
3725
- //
3726
- // Set the value of the `lastContext` compiler value to the depth
3727
- getContext: function getContext(depth) {
3728
- this.lastContext = depth;
3729
- },
3730
-
3731
- // [pushContext]
3732
- //
3733
- // On stack, before: ...
3734
- // On stack, after: currentContext, ...
3735
- //
3736
- // Pushes the value of the current context onto the stack.
3737
- pushContext: function pushContext() {
3738
- this.pushStackLiteral(this.contextName(this.lastContext));
3739
- },
3740
-
3741
- // [lookupOnContext]
3742
- //
3743
- // On stack, before: ...
3744
- // On stack, after: currentContext[name], ...
3745
- //
3746
- // Looks up the value of `name` on the current context and pushes
3747
- // it onto the stack.
3748
- lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) {
3749
- var i = 0;
3750
-
3751
- if (!scoped && this.options.compat && !this.lastContext) {
3752
- // The depthed query is expected to handle the undefined logic for the root level that
3753
- // is implemented below, so we evaluate that directly in compat mode
3754
- this.push(this.depthedLookup(parts[i++]));
3755
- } else {
3756
- this.pushContext();
3757
- }
3758
-
3759
- this.resolvePath('context', parts, i, falsy, strict);
3760
- },
3761
-
3762
- // [lookupBlockParam]
3763
- //
3764
- // On stack, before: ...
3765
- // On stack, after: blockParam[name], ...
3766
- //
3767
- // Looks up the value of `parts` on the given block param and pushes
3768
- // it onto the stack.
3769
- lookupBlockParam: function lookupBlockParam(blockParamId, parts) {
3770
- this.useBlockParams = true;
3771
-
3772
- this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
3773
- this.resolvePath('context', parts, 1);
3774
- },
3775
-
3776
- // [lookupData]
3777
- //
3778
- // On stack, before: ...
3779
- // On stack, after: data, ...
3780
- //
3781
- // Push the data lookup operator
3782
- lookupData: function lookupData(depth, parts, strict) {
3783
- if (!depth) {
3784
- this.pushStackLiteral('data');
3785
- } else {
3786
- this.pushStackLiteral('container.data(data, ' + depth + ')');
3787
- }
3788
-
3789
- this.resolvePath('data', parts, 0, true, strict);
3790
- },
3791
-
3792
- resolvePath: function resolvePath(type, parts, i, falsy, strict) {
3793
- // istanbul ignore next
3794
-
3795
- var _this = this;
3796
-
3797
- if (this.options.strict || this.options.assumeObjects) {
3798
- this.push(strictLookup(this.options.strict && strict, this, parts, type));
3799
- return;
3800
- }
3801
-
3802
- var len = parts.length;
3803
- for (; i < len; i++) {
3804
- /* eslint-disable no-loop-func */
3805
- this.replaceStack(function (current) {
3806
- var lookup = _this.nameLookup(current, parts[i], type);
3807
- // We want to ensure that zero and false are handled properly if the context (falsy flag)
3808
- // needs to have the special handling for these values.
3809
- if (!falsy) {
3810
- return [' != null ? ', lookup, ' : ', current];
3811
- } else {
3812
- // Otherwise we can use generic falsy handling
3813
- return [' && ', lookup];
3814
- }
3815
- });
3816
- /* eslint-enable no-loop-func */
3817
- }
3818
- },
3819
-
3820
- // [resolvePossibleLambda]
3821
- //
3822
- // On stack, before: value, ...
3823
- // On stack, after: resolved value, ...
3824
- //
3825
- // If the `value` is a lambda, replace it on the stack by
3826
- // the return value of the lambda
3827
- resolvePossibleLambda: function resolvePossibleLambda() {
3828
- this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
3829
- },
3830
-
3831
- // [pushStringParam]
3832
- //
3833
- // On stack, before: ...
3834
- // On stack, after: string, currentContext, ...
3835
- //
3836
- // This opcode is designed for use in string mode, which
3837
- // provides the string value of a parameter along with its
3838
- // depth rather than resolving it immediately.
3839
- pushStringParam: function pushStringParam(string, type) {
3840
- this.pushContext();
3841
- this.pushString(type);
3842
-
3843
- // If it's a subexpression, the string result
3844
- // will be pushed after this opcode.
3845
- if (type !== 'SubExpression') {
3846
- if (typeof string === 'string') {
3847
- this.pushString(string);
3848
- } else {
3849
- this.pushStackLiteral(string);
3850
- }
3851
- }
3852
- },
3853
-
3854
- emptyHash: function emptyHash(omitEmpty) {
3855
- if (this.trackIds) {
3856
- this.push('{}'); // hashIds
3857
- }
3858
- if (this.stringParams) {
3859
- this.push('{}'); // hashContexts
3860
- this.push('{}'); // hashTypes
3861
- }
3862
- this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
3863
- },
3864
- pushHash: function pushHash() {
3865
- if (this.hash) {
3866
- this.hashes.push(this.hash);
3867
- }
3868
- this.hash = { values: [], types: [], contexts: [], ids: [] };
3869
- },
3870
- popHash: function popHash() {
3871
- var hash = this.hash;
3872
- this.hash = this.hashes.pop();
3873
-
3874
- if (this.trackIds) {
3875
- this.push(this.objectLiteral(hash.ids));
3876
- }
3877
- if (this.stringParams) {
3878
- this.push(this.objectLiteral(hash.contexts));
3879
- this.push(this.objectLiteral(hash.types));
3880
- }
3881
-
3882
- this.push(this.objectLiteral(hash.values));
3883
- },
3884
-
3885
- // [pushString]
3886
- //
3887
- // On stack, before: ...
3888
- // On stack, after: quotedString(string), ...
3889
- //
3890
- // Push a quoted version of `string` onto the stack
3891
- pushString: function pushString(string) {
3892
- this.pushStackLiteral(this.quotedString(string));
3893
- },
3894
-
3895
- // [pushLiteral]
3896
- //
3897
- // On stack, before: ...
3898
- // On stack, after: value, ...
3899
- //
3900
- // Pushes a value onto the stack. This operation prevents
3901
- // the compiler from creating a temporary variable to hold
3902
- // it.
3903
- pushLiteral: function pushLiteral(value) {
3904
- this.pushStackLiteral(value);
3905
- },
3906
-
3907
- // [pushProgram]
3908
- //
3909
- // On stack, before: ...
3910
- // On stack, after: program(guid), ...
3911
- //
3912
- // Push a program expression onto the stack. This takes
3913
- // a compile-time guid and converts it into a runtime-accessible
3914
- // expression.
3915
- pushProgram: function pushProgram(guid) {
3916
- if (guid != null) {
3917
- this.pushStackLiteral(this.programExpression(guid));
3918
- } else {
3919
- this.pushStackLiteral(null);
3920
- }
3921
- },
3922
-
3923
- // [registerDecorator]
3924
- //
3925
- // On stack, before: hash, program, params..., ...
3926
- // On stack, after: ...
3927
- //
3928
- // Pops off the decorator's parameters, invokes the decorator,
3929
- // and inserts the decorator into the decorators list.
3930
- registerDecorator: function registerDecorator(paramSize, name) {
3931
- var foundDecorator = this.nameLookup('decorators', name, 'decorator'),
3932
- options = this.setupHelperArgs(name, paramSize);
3933
-
3934
- this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']);
3935
- },
3936
-
3937
- // [invokeHelper]
3938
- //
3939
- // On stack, before: hash, inverse, program, params..., ...
3940
- // On stack, after: result of helper invocation
3941
- //
3942
- // Pops off the helper's parameters, invokes the helper,
3943
- // and pushes the helper's return value onto the stack.
3944
- //
3945
- // If the helper is not found, `helperMissing` is called.
3946
- invokeHelper: function invokeHelper(paramSize, name, isSimple) {
3947
- var nonHelper = this.popStack(),
3948
- helper = this.setupHelper(paramSize, name),
3949
- simple = isSimple ? [helper.name, ' || '] : '';
3950
-
3951
- var lookup = ['('].concat(simple, nonHelper);
3952
- if (!this.options.strict) {
3953
- lookup.push(' || ', this.aliasable('helpers.helperMissing'));
3954
- }
3955
- lookup.push(')');
3956
-
3957
- this.push(this.source.functionCall(lookup, 'call', helper.callParams));
3958
- },
3959
-
3960
- // [invokeKnownHelper]
3961
- //
3962
- // On stack, before: hash, inverse, program, params..., ...
3963
- // On stack, after: result of helper invocation
3964
- //
3965
- // This operation is used when the helper is known to exist,
3966
- // so a `helperMissing` fallback is not required.
3967
- invokeKnownHelper: function invokeKnownHelper(paramSize, name) {
3968
- var helper = this.setupHelper(paramSize, name);
3969
- this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
3970
- },
3971
-
3972
- // [invokeAmbiguous]
3973
- //
3974
- // On stack, before: hash, inverse, program, params..., ...
3975
- // On stack, after: result of disambiguation
3976
- //
3977
- // This operation is used when an expression like `{{foo}}`
3978
- // is provided, but we don't know at compile-time whether it
3979
- // is a helper or a path.
3980
- //
3981
- // This operation emits more code than the other options,
3982
- // and can be avoided by passing the `knownHelpers` and
3983
- // `knownHelpersOnly` flags at compile-time.
3984
- invokeAmbiguous: function invokeAmbiguous(name, helperCall) {
3985
- this.useRegister('helper');
3986
-
3987
- var nonHelper = this.popStack();
3988
-
3989
- this.emptyHash();
3990
- var helper = this.setupHelper(0, name, helperCall);
3991
-
3992
- var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
3993
-
3994
- var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
3995
- if (!this.options.strict) {
3996
- lookup[0] = '(helper = ';
3997
- lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing'));
3998
- }
3999
-
4000
- this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']);
4001
- },
4002
-
4003
- // [invokePartial]
4004
- //
4005
- // On stack, before: context, ...
4006
- // On stack after: result of partial invocation
4007
- //
4008
- // This operation pops off a context, invokes a partial with that context,
4009
- // and pushes the result of the invocation back.
4010
- invokePartial: function invokePartial(isDynamic, name, indent) {
4011
- var params = [],
4012
- options = this.setupParams(name, 1, params);
4013
-
4014
- if (isDynamic) {
4015
- name = this.popStack();
4016
- delete options.name;
4017
- }
4018
-
4019
- if (indent) {
4020
- options.indent = JSON.stringify(indent);
4021
- }
4022
- options.helpers = 'helpers';
4023
- options.partials = 'partials';
4024
- options.decorators = 'container.decorators';
4025
-
4026
- if (!isDynamic) {
4027
- params.unshift(this.nameLookup('partials', name, 'partial'));
4028
- } else {
4029
- params.unshift(name);
4030
- }
4031
-
4032
- if (this.options.compat) {
4033
- options.depths = 'depths';
4034
- }
4035
- options = this.objectLiteral(options);
4036
- params.push(options);
4037
-
4038
- this.push(this.source.functionCall('container.invokePartial', '', params));
4039
- },
4040
-
4041
- // [assignToHash]
4042
- //
4043
- // On stack, before: value, ..., hash, ...
4044
- // On stack, after: ..., hash, ...
4045
- //
4046
- // Pops a value off the stack and assigns it to the current hash
4047
- assignToHash: function assignToHash(key) {
4048
- var value = this.popStack(),
4049
- context = undefined,
4050
- type = undefined,
4051
- id = undefined;
4052
-
4053
- if (this.trackIds) {
4054
- id = this.popStack();
4055
- }
4056
- if (this.stringParams) {
4057
- type = this.popStack();
4058
- context = this.popStack();
4059
- }
4060
-
4061
- var hash = this.hash;
4062
- if (context) {
4063
- hash.contexts[key] = context;
4064
- }
4065
- if (type) {
4066
- hash.types[key] = type;
4067
- }
4068
- if (id) {
4069
- hash.ids[key] = id;
4070
- }
4071
- hash.values[key] = value;
4072
- },
4073
-
4074
- pushId: function pushId(type, name, child) {
4075
- if (type === 'BlockParam') {
4076
- this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : ''));
4077
- } else if (type === 'PathExpression') {
4078
- this.pushString(name);
4079
- } else if (type === 'SubExpression') {
4080
- this.pushStackLiteral('true');
4081
- } else {
4082
- this.pushStackLiteral('null');
4083
- }
4084
- },
4085
-
4086
- // HELPERS
4087
-
4088
- compiler: JavaScriptCompiler,
4089
-
4090
- compileChildren: function compileChildren(environment, options) {
4091
- var children = environment.children,
4092
- child = undefined,
4093
- compiler = undefined;
4094
-
4095
- for (var i = 0, l = children.length; i < l; i++) {
4096
- child = children[i];
4097
- compiler = new this.compiler(); // eslint-disable-line new-cap
4098
-
4099
- var index = this.matchExistingProgram(child);
4100
-
4101
- if (index == null) {
4102
- this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
4103
- index = this.context.programs.length;
4104
- child.index = index;
4105
- child.name = 'program' + index;
4106
- this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
4107
- this.context.decorators[index] = compiler.decorators;
4108
- this.context.environments[index] = child;
4109
-
4110
- this.useDepths = this.useDepths || compiler.useDepths;
4111
- this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
4112
- } else {
4113
- child.index = index;
4114
- child.name = 'program' + index;
4115
-
4116
- this.useDepths = this.useDepths || child.useDepths;
4117
- this.useBlockParams = this.useBlockParams || child.useBlockParams;
4118
- }
4119
- }
4120
- },
4121
- matchExistingProgram: function matchExistingProgram(child) {
4122
- for (var i = 0, len = this.context.environments.length; i < len; i++) {
4123
- var environment = this.context.environments[i];
4124
- if (environment && environment.equals(child)) {
4125
- return i;
4126
- }
4127
- }
4128
- },
4129
-
4130
- programExpression: function programExpression(guid) {
4131
- var child = this.environment.children[guid],
4132
- programParams = [child.index, 'data', child.blockParams];
4133
-
4134
- if (this.useBlockParams || this.useDepths) {
4135
- programParams.push('blockParams');
4136
- }
4137
- if (this.useDepths) {
4138
- programParams.push('depths');
4139
- }
4140
-
4141
- return 'container.program(' + programParams.join(', ') + ')';
4142
- },
4143
-
4144
- useRegister: function useRegister(name) {
4145
- if (!this.registers[name]) {
4146
- this.registers[name] = true;
4147
- this.registers.list.push(name);
4148
- }
4149
- },
4150
-
4151
- push: function push(expr) {
4152
- if (!(expr instanceof Literal)) {
4153
- expr = this.source.wrap(expr);
4154
- }
4155
-
4156
- this.inlineStack.push(expr);
4157
- return expr;
4158
- },
4159
-
4160
- pushStackLiteral: function pushStackLiteral(item) {
4161
- this.push(new Literal(item));
4162
- },
4163
-
4164
- pushSource: function pushSource(source) {
4165
- if (this.pendingContent) {
4166
- this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
4167
- this.pendingContent = undefined;
4168
- }
4169
-
4170
- if (source) {
4171
- this.source.push(source);
4172
- }
4173
- },
4174
-
4175
- replaceStack: function replaceStack(callback) {
4176
- var prefix = ['('],
4177
- stack = undefined,
4178
- createdStack = undefined,
4179
- usedLiteral = undefined;
4180
-
4181
- /* istanbul ignore next */
4182
- if (!this.isInline()) {
4183
- throw new _exception2['default']('replaceStack on non-inline');
4184
- }
4185
-
4186
- // We want to merge the inline statement into the replacement statement via ','
4187
- var top = this.popStack(true);
4188
-
4189
- if (top instanceof Literal) {
4190
- // Literals do not need to be inlined
4191
- stack = [top.value];
4192
- prefix = ['(', stack];
4193
- usedLiteral = true;
4194
- } else {
4195
- // Get or create the current stack name for use by the inline
4196
- createdStack = true;
4197
- var _name = this.incrStack();
4198
-
4199
- prefix = ['((', this.push(_name), ' = ', top, ')'];
4200
- stack = this.topStack();
4201
- }
4202
-
4203
- var item = callback.call(this, stack);
4204
-
4205
- if (!usedLiteral) {
4206
- this.popStack();
4207
- }
4208
- if (createdStack) {
4209
- this.stackSlot--;
4210
- }
4211
- this.push(prefix.concat(item, ')'));
4212
- },
4213
-
4214
- incrStack: function incrStack() {
4215
- this.stackSlot++;
4216
- if (this.stackSlot > this.stackVars.length) {
4217
- this.stackVars.push('stack' + this.stackSlot);
4218
- }
4219
- return this.topStackName();
4220
- },
4221
- topStackName: function topStackName() {
4222
- return 'stack' + this.stackSlot;
4223
- },
4224
- flushInline: function flushInline() {
4225
- var inlineStack = this.inlineStack;
4226
- this.inlineStack = [];
4227
- for (var i = 0, len = inlineStack.length; i < len; i++) {
4228
- var entry = inlineStack[i];
4229
- /* istanbul ignore if */
4230
- if (entry instanceof Literal) {
4231
- this.compileStack.push(entry);
4232
- } else {
4233
- var stack = this.incrStack();
4234
- this.pushSource([stack, ' = ', entry, ';']);
4235
- this.compileStack.push(stack);
4236
- }
4237
- }
4238
- },
4239
- isInline: function isInline() {
4240
- return this.inlineStack.length;
4241
- },
4242
-
4243
- popStack: function popStack(wrapped) {
4244
- var inline = this.isInline(),
4245
- item = (inline ? this.inlineStack : this.compileStack).pop();
4246
-
4247
- if (!wrapped && item instanceof Literal) {
4248
- return item.value;
4249
- } else {
4250
- if (!inline) {
4251
- /* istanbul ignore next */
4252
- if (!this.stackSlot) {
4253
- throw new _exception2['default']('Invalid stack pop');
4254
- }
4255
- this.stackSlot--;
4256
- }
4257
- return item;
4258
- }
4259
- },
4260
-
4261
- topStack: function topStack() {
4262
- var stack = this.isInline() ? this.inlineStack : this.compileStack,
4263
- item = stack[stack.length - 1];
4264
-
4265
- /* istanbul ignore if */
4266
- if (item instanceof Literal) {
4267
- return item.value;
4268
- } else {
4269
- return item;
4270
- }
4271
- },
4272
-
4273
- contextName: function contextName(context) {
4274
- if (this.useDepths && context) {
4275
- return 'depths[' + context + ']';
4276
- } else {
4277
- return 'depth' + context;
4278
- }
4279
- },
4280
-
4281
- quotedString: function quotedString(str) {
4282
- return this.source.quotedString(str);
4283
- },
4284
-
4285
- objectLiteral: function objectLiteral(obj) {
4286
- return this.source.objectLiteral(obj);
4287
- },
4288
-
4289
- aliasable: function aliasable(name) {
4290
- var ret = this.aliases[name];
4291
- if (ret) {
4292
- ret.referenceCount++;
4293
- return ret;
4294
- }
4295
-
4296
- ret = this.aliases[name] = this.source.wrap(name);
4297
- ret.aliasable = true;
4298
- ret.referenceCount = 1;
4299
-
4300
- return ret;
4301
- },
4302
-
4303
- setupHelper: function setupHelper(paramSize, name, blockHelper) {
4304
- var params = [],
4305
- paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
4306
- var foundHelper = this.nameLookup('helpers', name, 'helper'),
4307
- callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : {}');
4308
-
4309
- return {
4310
- params: params,
4311
- paramsInit: paramsInit,
4312
- name: foundHelper,
4313
- callParams: [callContext].concat(params)
4314
- };
4315
- },
4316
-
4317
- setupParams: function setupParams(helper, paramSize, params) {
4318
- var options = {},
4319
- contexts = [],
4320
- types = [],
4321
- ids = [],
4322
- objectArgs = !params,
4323
- param = undefined;
4324
-
4325
- if (objectArgs) {
4326
- params = [];
4327
- }
4328
-
4329
- options.name = this.quotedString(helper);
4330
- options.hash = this.popStack();
4331
-
4332
- if (this.trackIds) {
4333
- options.hashIds = this.popStack();
4334
- }
4335
- if (this.stringParams) {
4336
- options.hashTypes = this.popStack();
4337
- options.hashContexts = this.popStack();
4338
- }
4339
-
4340
- var inverse = this.popStack(),
4341
- program = this.popStack();
4342
-
4343
- // Avoid setting fn and inverse if neither are set. This allows
4344
- // helpers to do a check for `if (options.fn)`
4345
- if (program || inverse) {
4346
- options.fn = program || 'container.noop';
4347
- options.inverse = inverse || 'container.noop';
4348
- }
4349
-
4350
- // The parameters go on to the stack in order (making sure that they are evaluated in order)
4351
- // so we need to pop them off the stack in reverse order
4352
- var i = paramSize;
4353
- while (i--) {
4354
- param = this.popStack();
4355
- params[i] = param;
4356
-
4357
- if (this.trackIds) {
4358
- ids[i] = this.popStack();
4359
- }
4360
- if (this.stringParams) {
4361
- types[i] = this.popStack();
4362
- contexts[i] = this.popStack();
4363
- }
4364
- }
4365
-
4366
- if (objectArgs) {
4367
- options.args = this.source.generateArray(params);
4368
- }
4369
-
4370
- if (this.trackIds) {
4371
- options.ids = this.source.generateArray(ids);
4372
- }
4373
- if (this.stringParams) {
4374
- options.types = this.source.generateArray(types);
4375
- options.contexts = this.source.generateArray(contexts);
4376
- }
4377
-
4378
- if (this.options.data) {
4379
- options.data = 'data';
4380
- }
4381
- if (this.useBlockParams) {
4382
- options.blockParams = 'blockParams';
4383
- }
4384
- return options;
4385
- },
4386
-
4387
- setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) {
4388
- var options = this.setupParams(helper, paramSize, params);
4389
- options = this.objectLiteral(options);
4390
- if (useRegister) {
4391
- this.useRegister('options');
4392
- params.push('options');
4393
- return ['options=', options];
4394
- } else if (params) {
4395
- params.push(options);
4396
- return '';
4397
- } else {
4398
- return options;
4399
- }
4400
- }
4401
- };
4402
-
4403
- (function () {
4404
- var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' ');
4405
-
4406
- var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
4407
-
4408
- for (var i = 0, l = reservedWords.length; i < l; i++) {
4409
- compilerWords[reservedWords[i]] = true;
4410
- }
4411
- })();
4412
-
4413
- JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
4414
- return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
4415
- };
4416
-
4417
- function strictLookup(requireTerminal, compiler, parts, type) {
4418
- var stack = compiler.popStack(),
4419
- i = 0,
4420
- len = parts.length;
4421
- if (requireTerminal) {
4422
- len--;
4423
- }
4424
-
4425
- for (; i < len; i++) {
4426
- stack = compiler.nameLookup(stack, parts[i], type);
4427
- }
4428
-
4429
- if (requireTerminal) {
4430
- return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
4431
- } else {
4432
- return stack;
4433
- }
4434
- }
4435
-
4436
- exports['default'] = JavaScriptCompiler;
4437
- module.exports = exports['default'];
4438
-
4439
- /***/ },
4440
- /* 29 */
4441
- /***/ function(module, exports, __webpack_require__) {
4442
-
4443
- /* global define */
4444
- 'use strict';
4445
-
4446
- exports.__esModule = true;
4447
-
4448
- var _utils = __webpack_require__(5);
4449
-
4450
- var SourceNode = undefined;
4451
-
4452
- try {
4453
- /* istanbul ignore next */
4454
- if (false) {
4455
- // We don't support this in AMD environments. For these environments, we asusme that
4456
- // they are running on the browser and thus have no need for the source-map library.
4457
- var SourceMap = require('source-map');
4458
- SourceNode = SourceMap.SourceNode;
4459
- }
4460
- } catch (err) {}
4461
- /* NOP */
4462
-
4463
- /* istanbul ignore if: tested but not covered in istanbul due to dist build */
4464
- if (!SourceNode) {
4465
- SourceNode = function (line, column, srcFile, chunks) {
4466
- this.src = '';
4467
- if (chunks) {
4468
- this.add(chunks);
4469
- }
4470
- };
4471
- /* istanbul ignore next */
4472
- SourceNode.prototype = {
4473
- add: function add(chunks) {
4474
- if (_utils.isArray(chunks)) {
4475
- chunks = chunks.join('');
4476
- }
4477
- this.src += chunks;
4478
- },
4479
- prepend: function prepend(chunks) {
4480
- if (_utils.isArray(chunks)) {
4481
- chunks = chunks.join('');
4482
- }
4483
- this.src = chunks + this.src;
4484
- },
4485
- toStringWithSourceMap: function toStringWithSourceMap() {
4486
- return { code: this.toString() };
4487
- },
4488
- toString: function toString() {
4489
- return this.src;
4490
- }
4491
- };
4492
- }
4493
-
4494
- function castChunk(chunk, codeGen, loc) {
4495
- if (_utils.isArray(chunk)) {
4496
- var ret = [];
4497
-
4498
- for (var i = 0, len = chunk.length; i < len; i++) {
4499
- ret.push(codeGen.wrap(chunk[i], loc));
4500
- }
4501
- return ret;
4502
- } else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
4503
- // Handle primitives that the SourceNode will throw up on
4504
- return chunk + '';
4505
- }
4506
- return chunk;
4507
- }
4508
-
4509
- function CodeGen(srcFile) {
4510
- this.srcFile = srcFile;
4511
- this.source = [];
4512
- }
4513
-
4514
- CodeGen.prototype = {
4515
- isEmpty: function isEmpty() {
4516
- return !this.source.length;
4517
- },
4518
- prepend: function prepend(source, loc) {
4519
- this.source.unshift(this.wrap(source, loc));
4520
- },
4521
- push: function push(source, loc) {
4522
- this.source.push(this.wrap(source, loc));
4523
- },
4524
-
4525
- merge: function merge() {
4526
- var source = this.empty();
4527
- this.each(function (line) {
4528
- source.add([' ', line, '\n']);
4529
- });
4530
- return source;
4531
- },
4532
-
4533
- each: function each(iter) {
4534
- for (var i = 0, len = this.source.length; i < len; i++) {
4535
- iter(this.source[i]);
4536
- }
4537
- },
4538
-
4539
- empty: function empty() {
4540
- var loc = this.currentLocation || { start: {} };
4541
- return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
4542
- },
4543
- wrap: function wrap(chunk) {
4544
- var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1];
4545
-
4546
- if (chunk instanceof SourceNode) {
4547
- return chunk;
4548
- }
4549
-
4550
- chunk = castChunk(chunk, this, loc);
4551
-
4552
- return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
4553
- },
4554
-
4555
- functionCall: function functionCall(fn, type, params) {
4556
- params = this.generateList(params);
4557
- return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
4558
- },
4559
-
4560
- quotedString: function quotedString(str) {
4561
- return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
4562
- .replace(/\u2029/g, '\\u2029') + '"';
4563
- },
4564
-
4565
- objectLiteral: function objectLiteral(obj) {
4566
- var pairs = [];
4567
-
4568
- for (var key in obj) {
4569
- if (obj.hasOwnProperty(key)) {
4570
- var value = castChunk(obj[key], this);
4571
- if (value !== 'undefined') {
4572
- pairs.push([this.quotedString(key), ':', value]);
4573
- }
4574
- }
4575
- }
4576
-
4577
- var ret = this.generateList(pairs);
4578
- ret.prepend('{');
4579
- ret.add('}');
4580
- return ret;
4581
- },
4582
-
4583
- generateList: function generateList(entries) {
4584
- var ret = this.empty();
4585
-
4586
- for (var i = 0, len = entries.length; i < len; i++) {
4587
- if (i) {
4588
- ret.add(',');
4589
- }
4590
-
4591
- ret.add(castChunk(entries[i], this));
4592
- }
4593
-
4594
- return ret;
4595
- },
4596
-
4597
- generateArray: function generateArray(entries) {
4598
- var ret = this.generateList(entries);
4599
- ret.prepend('[');
4600
- ret.add(']');
4601
-
4602
- return ret;
4603
- }
4604
- };
4605
-
4606
- exports['default'] = CodeGen;
4607
- module.exports = exports['default'];
4608
-
4609
- /***/ }
4610
- /******/ ])
4611
- });
4612
- ;