spree_admin 5.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (795) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +13 -0
  3. data/README.md +4 -0
  4. data/Rakefile +15 -0
  5. data/app/assets/config/spree_admin_manifest.js +10 -0
  6. data/app/assets/images/favicon_256x256.png +0 -0
  7. data/app/assets/stylesheets/spree/admin/actiontext.css +36 -0
  8. data/app/assets/stylesheets/spree/admin/application.scss +43 -0
  9. data/app/assets/stylesheets/spree/admin/components/_alerts.scss +48 -0
  10. data/app/assets/stylesheets/spree/admin/components/_badges.scss +117 -0
  11. data/app/assets/stylesheets/spree/admin/components/_bulk_panel.scss +31 -0
  12. data/app/assets/stylesheets/spree/admin/components/_buttons.scss +198 -0
  13. data/app/assets/stylesheets/spree/admin/components/_cards.scss +126 -0
  14. data/app/assets/stylesheets/spree/admin/components/_dropdowns.scss +148 -0
  15. data/app/assets/stylesheets/spree/admin/components/_filters.scss +41 -0
  16. data/app/assets/stylesheets/spree/admin/components/_line_items_form.scss +32 -0
  17. data/app/assets/stylesheets/spree/admin/components/_main.scss +148 -0
  18. data/app/assets/stylesheets/spree/admin/components/_media_form.scss +91 -0
  19. data/app/assets/stylesheets/spree/admin/components/_modals.scss +42 -0
  20. data/app/assets/stylesheets/spree/admin/components/_navbar.scss +10 -0
  21. data/app/assets/stylesheets/spree/admin/components/_navigation.scss +53 -0
  22. data/app/assets/stylesheets/spree/admin/components/_offcanvas.scss +26 -0
  23. data/app/assets/stylesheets/spree/admin/components/_search_picker.scss +55 -0
  24. data/app/assets/stylesheets/spree/admin/components/_seo_form.scss +16 -0
  25. data/app/assets/stylesheets/spree/admin/components/_sortable_tree.scss +58 -0
  26. data/app/assets/stylesheets/spree/admin/components/_tables.scss +187 -0
  27. data/app/assets/stylesheets/spree/admin/components/_variants_form.scss +203 -0
  28. data/app/assets/stylesheets/spree/admin/global/_variables.scss +190 -0
  29. data/app/assets/stylesheets/spree/admin/plugins/_dropdown.scss +102 -0
  30. data/app/assets/stylesheets/spree/admin/plugins/_items.scss +115 -0
  31. data/app/assets/stylesheets/spree/admin/plugins/_tinymce_custom.scss +74 -0
  32. data/app/assets/stylesheets/spree/admin/plugins/_trix_custom.scss +110 -0
  33. data/app/assets/stylesheets/spree/admin/plugins/flatfile.scss +4 -0
  34. data/app/assets/stylesheets/spree/admin/plugins/plugins/checkbox_options.scss +5 -0
  35. data/app/assets/stylesheets/spree/admin/plugins/plugins/clear_button.scss +30 -0
  36. data/app/assets/stylesheets/spree/admin/plugins/plugins/drag_drop.scss +16 -0
  37. data/app/assets/stylesheets/spree/admin/plugins/plugins/dropdown_header.scss +23 -0
  38. data/app/assets/stylesheets/spree/admin/plugins/plugins/dropdown_input.scss +47 -0
  39. data/app/assets/stylesheets/spree/admin/plugins/plugins/input_autogrow.scss +18 -0
  40. data/app/assets/stylesheets/spree/admin/plugins/plugins/optgroup_columns.scss +23 -0
  41. data/app/assets/stylesheets/spree/admin/plugins/plugins/remove_button.scss +44 -0
  42. data/app/assets/stylesheets/spree/admin/plugins/tom-select.bootstrap4.scss +219 -0
  43. data/app/assets/stylesheets/spree/admin/plugins/tom-select.bootstrap5.scss +274 -0
  44. data/app/assets/stylesheets/spree/admin/plugins/tom-select.default.scss +87 -0
  45. data/app/assets/stylesheets/spree/admin/plugins/tom-select.scss +175 -0
  46. data/app/assets/stylesheets/spree/admin/plugins/uppy_fixes.scss +25 -0
  47. data/app/assets/stylesheets/spree/admin/shared/_base.scss +674 -0
  48. data/app/assets/stylesheets/spree/admin/shared/_forms.scss +184 -0
  49. data/app/assets/stylesheets/spree/admin/views/_dashboard.scss +34 -0
  50. data/app/assets/stylesheets/spree/admin/views/_page_builder.scss +237 -0
  51. data/app/controllers/concerns/spree/admin/analytics_concern.rb +51 -0
  52. data/app/controllers/concerns/spree/admin/bulk_operations_concern.rb +38 -0
  53. data/app/controllers/concerns/spree/admin/order_concern.rb +24 -0
  54. data/app/controllers/concerns/spree/admin/page_builder_concern.rb +44 -0
  55. data/app/controllers/spree/admin/action_text/video_embeds_controller.rb +44 -0
  56. data/app/controllers/spree/admin/addresses_controller.rb +86 -0
  57. data/app/controllers/spree/admin/assets_controller.rb +70 -0
  58. data/app/controllers/spree/admin/base_controller.rb +131 -0
  59. data/app/controllers/spree/admin/checkouts_controller.rb +23 -0
  60. data/app/controllers/spree/admin/classifications_controller.rb +74 -0
  61. data/app/controllers/spree/admin/coupon_codes_controller.rb +21 -0
  62. data/app/controllers/spree/admin/custom_domains_controller.rb +19 -0
  63. data/app/controllers/spree/admin/customer_returns_controller.rb +20 -0
  64. data/app/controllers/spree/admin/dashboard_controller.rb +145 -0
  65. data/app/controllers/spree/admin/digital_assets_controller.rb +45 -0
  66. data/app/controllers/spree/admin/errors_controller.rb +11 -0
  67. data/app/controllers/spree/admin/exports_controller.rb +48 -0
  68. data/app/controllers/spree/admin/line_items_controller.rb +121 -0
  69. data/app/controllers/spree/admin/oauth_applications_controller.rb +27 -0
  70. data/app/controllers/spree/admin/option_types_controller.rb +23 -0
  71. data/app/controllers/spree/admin/option_values_controller.rb +21 -0
  72. data/app/controllers/spree/admin/orders/billing_address_controller.rb +103 -0
  73. data/app/controllers/spree/admin/orders/contact_information_controller.rb +45 -0
  74. data/app/controllers/spree/admin/orders/customer_returns_controller.rb +81 -0
  75. data/app/controllers/spree/admin/orders/payment_links_controller.rb +33 -0
  76. data/app/controllers/spree/admin/orders/return_authorizations_controller.rb +90 -0
  77. data/app/controllers/spree/admin/orders/shipping_address_controller.rb +85 -0
  78. data/app/controllers/spree/admin/orders/user_controller.rb +94 -0
  79. data/app/controllers/spree/admin/orders_controller.rb +87 -0
  80. data/app/controllers/spree/admin/page_blocks_controller.rb +40 -0
  81. data/app/controllers/spree/admin/page_links_controller.rb +43 -0
  82. data/app/controllers/spree/admin/page_sections_controller.rb +57 -0
  83. data/app/controllers/spree/admin/pages_controller.rb +40 -0
  84. data/app/controllers/spree/admin/payment_methods_controller.rb +45 -0
  85. data/app/controllers/spree/admin/payments_controller.rb +122 -0
  86. data/app/controllers/spree/admin/post_categories_controller.rb +6 -0
  87. data/app/controllers/spree/admin/posts_controller.rb +23 -0
  88. data/app/controllers/spree/admin/products_controller.rb +366 -0
  89. data/app/controllers/spree/admin/profile_controller.rb +31 -0
  90. data/app/controllers/spree/admin/promotion_actions_controller.rb +47 -0
  91. data/app/controllers/spree/admin/promotion_rules_controller.rb +39 -0
  92. data/app/controllers/spree/admin/promotions_controller.rb +61 -0
  93. data/app/controllers/spree/admin/properties_controller.rb +23 -0
  94. data/app/controllers/spree/admin/refund_reasons_controller.rb +6 -0
  95. data/app/controllers/spree/admin/refunds_controller.rb +43 -0
  96. data/app/controllers/spree/admin/reimbursement_types_controller.rb +6 -0
  97. data/app/controllers/spree/admin/reimbursements_controller.rb +47 -0
  98. data/app/controllers/spree/admin/reports_controller.rb +52 -0
  99. data/app/controllers/spree/admin/resource_controller.rb +325 -0
  100. data/app/controllers/spree/admin/return_authorization_reasons_controller.rb +6 -0
  101. data/app/controllers/spree/admin/return_authorizations_controller.rb +29 -0
  102. data/app/controllers/spree/admin/return_items_controller.rb +9 -0
  103. data/app/controllers/spree/admin/roles_controller.rb +6 -0
  104. data/app/controllers/spree/admin/shipments_controller.rb +102 -0
  105. data/app/controllers/spree/admin/shipping_categories_controller.rb +6 -0
  106. data/app/controllers/spree/admin/shipping_methods_controller.rb +29 -0
  107. data/app/controllers/spree/admin/stock_items_controller.rb +25 -0
  108. data/app/controllers/spree/admin/stock_locations_controller.rb +24 -0
  109. data/app/controllers/spree/admin/stock_transfers_controller.rb +48 -0
  110. data/app/controllers/spree/admin/store_credit_categories_controller.rb +6 -0
  111. data/app/controllers/spree/admin/store_credits_controller.rb +93 -0
  112. data/app/controllers/spree/admin/storefront_controller.rb +38 -0
  113. data/app/controllers/spree/admin/stores_controller.rb +87 -0
  114. data/app/controllers/spree/admin/tax_categories_controller.rb +6 -0
  115. data/app/controllers/spree/admin/tax_rates_controller.rb +20 -0
  116. data/app/controllers/spree/admin/taxonomies_controller.rb +21 -0
  117. data/app/controllers/spree/admin/taxons_controller.rb +98 -0
  118. data/app/controllers/spree/admin/themes_controller.rb +75 -0
  119. data/app/controllers/spree/admin/translations_controller.rb +74 -0
  120. data/app/controllers/spree/admin/users_controller.rb +91 -0
  121. data/app/controllers/spree/admin/variants_controller.rb +90 -0
  122. data/app/controllers/spree/admin/webhooks_subscribers_controller.rb +48 -0
  123. data/app/controllers/spree/admin/zones_controller.rb +37 -0
  124. data/app/helpers/spree/admin/base_helper.rb +246 -0
  125. data/app/helpers/spree/admin/custom_domains_helper.rb +9 -0
  126. data/app/helpers/spree/admin/customer_returns_helper.rb +18 -0
  127. data/app/helpers/spree/admin/flash_helper.rb +15 -0
  128. data/app/helpers/spree/admin/navigation_helper.rb +195 -0
  129. data/app/helpers/spree/admin/onboarding_helper.rb +18 -0
  130. data/app/helpers/spree/admin/orders_filters_helper.rb +68 -0
  131. data/app/helpers/spree/admin/orders_helper.rb +179 -0
  132. data/app/helpers/spree/admin/page_builder_helper.rb +130 -0
  133. data/app/helpers/spree/admin/payments_helper.rb +24 -0
  134. data/app/helpers/spree/admin/posts_helper.rb +9 -0
  135. data/app/helpers/spree/admin/products_helper.rb +127 -0
  136. data/app/helpers/spree/admin/promotion_actions_helper.rb +10 -0
  137. data/app/helpers/spree/admin/promotion_rules_helper.rb +17 -0
  138. data/app/helpers/spree/admin/promotions_helper.rb +25 -0
  139. data/app/helpers/spree/admin/reimbursement_type_helper.rb +9 -0
  140. data/app/helpers/spree/admin/session_assets_helper.rb +24 -0
  141. data/app/helpers/spree/admin/shipment_helper.rb +27 -0
  142. data/app/helpers/spree/admin/sortable_tree_helper.rb +31 -0
  143. data/app/helpers/spree/admin/stock_locations_helper.rb +22 -0
  144. data/app/helpers/spree/admin/store_helper.rb +46 -0
  145. data/app/helpers/spree/admin/stores_helper.rb +86 -0
  146. data/app/helpers/spree/admin/tags_helper.rb +35 -0
  147. data/app/helpers/spree/admin/taxons_helper.rb +27 -0
  148. data/app/helpers/spree/admin/themes_helper.rb +9 -0
  149. data/app/helpers/spree/admin/translations_helper.rb +14 -0
  150. data/app/helpers/spree/admin/turbo_helper.rb +41 -0
  151. data/app/helpers/spree/admin/users_helper.rb +37 -0
  152. data/app/helpers/spree/admin/webhooks_subscribers_helper.rb +31 -0
  153. data/app/helpers/tom_select_helper.rb +42 -0
  154. data/app/javascript/spree/admin/application.js +157 -0
  155. data/app/javascript/spree/admin/controllers/active_storage_upload_controller.js +168 -0
  156. data/app/javascript/spree/admin/controllers/address_form_controller.js +98 -0
  157. data/app/javascript/spree/admin/controllers/asset_uploader_controller.js +58 -0
  158. data/app/javascript/spree/admin/controllers/autocomplete_select_controller.js +36 -0
  159. data/app/javascript/spree/admin/controllers/better_slider_controller.js +23 -0
  160. data/app/javascript/spree/admin/controllers/block_form_controller.js +11 -0
  161. data/app/javascript/spree/admin/controllers/bootstrap_tabs_controller.js +9 -0
  162. data/app/javascript/spree/admin/controllers/bulk_operation_controller.js +78 -0
  163. data/app/javascript/spree/admin/controllers/calculator_fields_controller.js +24 -0
  164. data/app/javascript/spree/admin/controllers/calendar_range_controller.js +52 -0
  165. data/app/javascript/spree/admin/controllers/clipboard_controller.js +17 -0
  166. data/app/javascript/spree/admin/controllers/color_palette_controller.js +22 -0
  167. data/app/javascript/spree/admin/controllers/color_picker_controller.js +52 -0
  168. data/app/javascript/spree/admin/controllers/enable_button_controller.js +29 -0
  169. data/app/javascript/spree/admin/controllers/filters_controller.js +66 -0
  170. data/app/javascript/spree/admin/controllers/font_picker_controller.js +55 -0
  171. data/app/javascript/spree/admin/controllers/media_form_controller.js +38 -0
  172. data/app/javascript/spree/admin/controllers/multi_input_controller.js +75 -0
  173. data/app/javascript/spree/admin/controllers/multi_tom_select_controller.js +80 -0
  174. data/app/javascript/spree/admin/controllers/order_billing_address_controller.js +39 -0
  175. data/app/javascript/spree/admin/controllers/page_builder_controller.js +316 -0
  176. data/app/javascript/spree/admin/controllers/password_toggle_controller.js +14 -0
  177. data/app/javascript/spree/admin/controllers/product_form_controller.js +70 -0
  178. data/app/javascript/spree/admin/controllers/range_input_controller.js +9 -0
  179. data/app/javascript/spree/admin/controllers/replace_controller.js +15 -0
  180. data/app/javascript/spree/admin/controllers/return_items_controller.js +47 -0
  181. data/app/javascript/spree/admin/controllers/row_link_controller.js +18 -0
  182. data/app/javascript/spree/admin/controllers/rule_form_controller.js +17 -0
  183. data/app/javascript/spree/admin/controllers/search_picker_controller.js +38 -0
  184. data/app/javascript/spree/admin/controllers/section_form_controller.js +14 -0
  185. data/app/javascript/spree/admin/controllers/select_controller.js +117 -0
  186. data/app/javascript/spree/admin/controllers/seo_form_controller.js +116 -0
  187. data/app/javascript/spree/admin/controllers/slug_form_controller.js +17 -0
  188. data/app/javascript/spree/admin/controllers/sortable_tree_controller.js +55 -0
  189. data/app/javascript/spree/admin/controllers/stock_transfer_controller.js +87 -0
  190. data/app/javascript/spree/admin/controllers/store_form_controller.js +17 -0
  191. data/app/javascript/spree/admin/controllers/unit_system_controller.js +27 -0
  192. data/app/javascript/spree/admin/controllers/variants_form_controller.js +1048 -0
  193. data/app/javascript/spree/admin/controllers/webhook_subscriber_events_controller.js +19 -0
  194. data/app/javascript/spree/admin/helpers/bootstrap.js +49 -0
  195. data/app/javascript/spree/admin/helpers/canvas.js +29 -0
  196. data/app/javascript/spree/admin/helpers/index.js +0 -0
  197. data/app/javascript/spree/admin/helpers/tinymce.js +65 -0
  198. data/app/javascript/spree/admin/helpers/trix/video_embed.js +182 -0
  199. data/app/javascript/spree/admin/helpers/uppy_active_storage.js +210 -0
  200. data/app/models/spree/admin/resource.rb +36 -0
  201. data/app/models/spree/admin/updater.rb +42 -0
  202. data/app/views/active_storage/_upload_form.html.erb +65 -0
  203. data/app/views/kaminari/admin-twitter-bootstrap-4/_first_page.html.erb +13 -0
  204. data/app/views/kaminari/admin-twitter-bootstrap-4/_gap.html.erb +12 -0
  205. data/app/views/kaminari/admin-twitter-bootstrap-4/_last_page.html.erb +13 -0
  206. data/app/views/kaminari/admin-twitter-bootstrap-4/_next_page.html.erb +13 -0
  207. data/app/views/kaminari/admin-twitter-bootstrap-4/_page.html.erb +18 -0
  208. data/app/views/kaminari/admin-twitter-bootstrap-4/_paginator.html.erb +17 -0
  209. data/app/views/kaminari/admin-twitter-bootstrap-4/_prev_page.html.erb +13 -0
  210. data/app/views/layouts/spree/admin.html.erb +21 -0
  211. data/app/views/layouts/spree/page_builder.html.erb +45 -0
  212. data/app/views/spree/admin/addresses/edit.html.erb +12 -0
  213. data/app/views/spree/admin/addresses/new.html.erb +16 -0
  214. data/app/views/spree/admin/assets/bulk_destroy.turbo_stream.erb +3 -0
  215. data/app/views/spree/admin/assets/create.turbo_stream.erb +5 -0
  216. data/app/views/spree/admin/assets/destroy.turbo_stream.erb +4 -0
  217. data/app/views/spree/admin/assets/edit.html.erb +27 -0
  218. data/app/views/spree/admin/assets/update.turbo_stream.erb +7 -0
  219. data/app/views/spree/admin/classifications/_classification.html.erb +38 -0
  220. data/app/views/spree/admin/classifications/create.turbo_stream.erb +7 -0
  221. data/app/views/spree/admin/classifications/destroy.turbo_stream.erb +2 -0
  222. data/app/views/spree/admin/classifications/index.html.erb +20 -0
  223. data/app/views/spree/admin/classifications/new.html.erb +1 -0
  224. data/app/views/spree/admin/coupon_codes/_coupon_code.html.erb +12 -0
  225. data/app/views/spree/admin/coupon_codes/index.csv.erb +14 -0
  226. data/app/views/spree/admin/coupon_codes/index.html.erb +70 -0
  227. data/app/views/spree/admin/custom_domains/_custom_domain.html.erb +13 -0
  228. data/app/views/spree/admin/custom_domains/_custom_domains.html.erb +24 -0
  229. data/app/views/spree/admin/custom_domains/_form.html.erb +19 -0
  230. data/app/views/spree/admin/custom_domains/create.turbo_stream.erb +3 -0
  231. data/app/views/spree/admin/custom_domains/edit.html.erb +15 -0
  232. data/app/views/spree/admin/custom_domains/index.html.erb +50 -0
  233. data/app/views/spree/admin/custom_domains/new.html.erb +15 -0
  234. data/app/views/spree/admin/customer_returns/_customer_return.html.erb +31 -0
  235. data/app/views/spree/admin/customer_returns/index.html.erb +57 -0
  236. data/app/views/spree/admin/dashboard/_analytics.html.erb +3 -0
  237. data/app/views/spree/admin/dashboard/_setup_progress.html.erb +17 -0
  238. data/app/views/spree/admin/dashboard/_setup_tasks.html.erb +24 -0
  239. data/app/views/spree/admin/dashboard/_store_preview.html.erb +45 -0
  240. data/app/views/spree/admin/dashboard/_top_products.html.erb +71 -0
  241. data/app/views/spree/admin/dashboard/_updater.html.erb +9 -0
  242. data/app/views/spree/admin/dashboard/_visits.html.erb +112 -0
  243. data/app/views/spree/admin/dashboard/analytics.html.erb +118 -0
  244. data/app/views/spree/admin/dashboard/getting_started.html.erb +22 -0
  245. data/app/views/spree/admin/dashboard/setup_tasks/_add_products.html.erb +22 -0
  246. data/app/views/spree/admin/dashboard/setup_tasks/_set_customer_support_email.html.erb +23 -0
  247. data/app/views/spree/admin/dashboard/setup_tasks/_setup_payment_method.html.erb +6 -0
  248. data/app/views/spree/admin/dashboard/setup_tasks/_setup_taxes_collection.html.erb +6 -0
  249. data/app/views/spree/admin/dashboard/show.html.erb +33 -0
  250. data/app/views/spree/admin/digital_assets/_digital_asset.html.erb +30 -0
  251. data/app/views/spree/admin/digital_assets/_form.html.erb +18 -0
  252. data/app/views/spree/admin/digital_assets/_table.html.erb +40 -0
  253. data/app/views/spree/admin/digital_assets/create.turbo_stream.erb +2 -0
  254. data/app/views/spree/admin/digital_assets/edit.html.erb +22 -0
  255. data/app/views/spree/admin/digital_assets/index.html.erb +27 -0
  256. data/app/views/spree/admin/digital_assets/new.html.erb +22 -0
  257. data/app/views/spree/admin/digital_assets/update.turbo_stream.erb +2 -0
  258. data/app/views/spree/admin/exports/_export.html.erb +42 -0
  259. data/app/views/spree/admin/exports/create.turbo_stream.erb +2 -0
  260. data/app/views/spree/admin/exports/index.html.erb +30 -0
  261. data/app/views/spree/admin/exports/new.html.erb +42 -0
  262. data/app/views/spree/admin/line_items/edit.html.erb +20 -0
  263. data/app/views/spree/admin/line_items/new.html.erb +32 -0
  264. data/app/views/spree/admin/oauth_applications/_form.html.erb +11 -0
  265. data/app/views/spree/admin/oauth_applications/create.turbo_stream.erb +41 -0
  266. data/app/views/spree/admin/oauth_applications/edit.html.erb +19 -0
  267. data/app/views/spree/admin/oauth_applications/index.html.erb +75 -0
  268. data/app/views/spree/admin/oauth_applications/new.html.erb +25 -0
  269. data/app/views/spree/admin/option_types/_filter.html.erb +7 -0
  270. data/app/views/spree/admin/option_types/_form.html.erb +87 -0
  271. data/app/views/spree/admin/option_types/_option_type.html.erb +19 -0
  272. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +29 -0
  273. data/app/views/spree/admin/option_types/edit.html.erb +11 -0
  274. data/app/views/spree/admin/option_types/index.html.erb +63 -0
  275. data/app/views/spree/admin/option_types/new.html.erb +11 -0
  276. data/app/views/spree/admin/option_types/update.turbo_stream.erb +1 -0
  277. data/app/views/spree/admin/option_values/destroy.turbo_stream.erb +1 -0
  278. data/app/views/spree/admin/orders/_body_custom.html.erb +0 -0
  279. data/app/views/spree/admin/orders/_customer.html.erb +79 -0
  280. data/app/views/spree/admin/orders/_customer_returns.html.erb +26 -0
  281. data/app/views/spree/admin/orders/_customer_summary.html.erb +22 -0
  282. data/app/views/spree/admin/orders/_extra_filters.html.erb +0 -0
  283. data/app/views/spree/admin/orders/_filters.html.erb +106 -0
  284. data/app/views/spree/admin/orders/_header.html.erb +76 -0
  285. data/app/views/spree/admin/orders/_header_custom.html.erb +0 -0
  286. data/app/views/spree/admin/orders/_line_item.html.erb +61 -0
  287. data/app/views/spree/admin/orders/_line_items.html.erb +68 -0
  288. data/app/views/spree/admin/orders/_list.html.erb +30 -0
  289. data/app/views/spree/admin/orders/_order.html.erb +28 -0
  290. data/app/views/spree/admin/orders/_payments.html.erb +35 -0
  291. data/app/views/spree/admin/orders/_refunds.html.erb +49 -0
  292. data/app/views/spree/admin/orders/_return_authorizations.html.erb +26 -0
  293. data/app/views/spree/admin/orders/_risk_analysis.html.erb +26 -0
  294. data/app/views/spree/admin/orders/_shipment.html.erb +104 -0
  295. data/app/views/spree/admin/orders/_shipment_manifest_item.html.erb +17 -0
  296. data/app/views/spree/admin/orders/_shipments.html.erb +22 -0
  297. data/app/views/spree/admin/orders/_summary.html.erb +100 -0
  298. data/app/views/spree/admin/orders/_summary_custom.html.erb +0 -0
  299. data/app/views/spree/admin/orders/_table_filter_dropdown.html.erb +34 -0
  300. data/app/views/spree/admin/orders/_tax_lines.html.erb +11 -0
  301. data/app/views/spree/admin/orders/_user_overview.html.erb +13 -0
  302. data/app/views/spree/admin/orders/billing_address/_form.html.erb +14 -0
  303. data/app/views/spree/admin/orders/billing_address/create.turbo_stream.erb +35 -0
  304. data/app/views/spree/admin/orders/billing_address/edit.html.erb +42 -0
  305. data/app/views/spree/admin/orders/billing_address/new.html.erb +35 -0
  306. data/app/views/spree/admin/orders/billing_address/update.turbo_stream.erb +35 -0
  307. data/app/views/spree/admin/orders/contact_information/edit.html.erb +20 -0
  308. data/app/views/spree/admin/orders/customer_returns/_customer_return.html.erb +70 -0
  309. data/app/views/spree/admin/orders/customer_returns/_reimbursements_table.html.erb +40 -0
  310. data/app/views/spree/admin/orders/customer_returns/_return_item_decision.html.erb +54 -0
  311. data/app/views/spree/admin/orders/customer_returns/_return_item_selection.html.erb +72 -0
  312. data/app/views/spree/admin/orders/customer_returns/edit.html.erb +144 -0
  313. data/app/views/spree/admin/orders/customer_returns/new.html.erb +67 -0
  314. data/app/views/spree/admin/orders/edit.html.erb +23 -0
  315. data/app/views/spree/admin/orders/index.html.erb +23 -0
  316. data/app/views/spree/admin/orders/return_authorizations/_form.html.erb +176 -0
  317. data/app/views/spree/admin/orders/return_authorizations/_return_authorization.html.erb +36 -0
  318. data/app/views/spree/admin/orders/return_authorizations/edit.html.erb +44 -0
  319. data/app/views/spree/admin/orders/return_authorizations/new.html.erb +13 -0
  320. data/app/views/spree/admin/orders/return_authorizations/show.html.erb +128 -0
  321. data/app/views/spree/admin/orders/shipping_address/_form.html.erb +13 -0
  322. data/app/views/spree/admin/orders/shipping_address/create.turbo_stream.erb +17 -0
  323. data/app/views/spree/admin/orders/shipping_address/edit.html.erb +17 -0
  324. data/app/views/spree/admin/orders/shipping_address/new.html.erb +17 -0
  325. data/app/views/spree/admin/orders/shipping_address/update.turbo_stream.erb +17 -0
  326. data/app/views/spree/admin/orders/user/create.turbo_stream.erb +12 -0
  327. data/app/views/spree/admin/orders/user/edit.html.erb +3 -0
  328. data/app/views/spree/admin/orders/user/new.html.erb +30 -0
  329. data/app/views/spree/admin/orders/user/update.turbo_stream.erb +5 -0
  330. data/app/views/spree/admin/page_blocks/_form_tab_buttons.html.erb +7 -0
  331. data/app/views/spree/admin/page_blocks/create.turbo_stream.erb +4 -0
  332. data/app/views/spree/admin/page_blocks/destroy.turbo_stream.erb +9 -0
  333. data/app/views/spree/admin/page_blocks/edit.html.erb +48 -0
  334. data/app/views/spree/admin/page_blocks/forms/_brand.html.erb +15 -0
  335. data/app/views/spree/admin/page_blocks/forms/_brand_logo.html.erb +4 -0
  336. data/app/views/spree/admin/page_blocks/forms/_buttons.html.erb +13 -0
  337. data/app/views/spree/admin/page_blocks/forms/_buy_buttons.html.erb +10 -0
  338. data/app/views/spree/admin/page_blocks/forms/_heading.html.erb +28 -0
  339. data/app/views/spree/admin/page_blocks/forms/_image.html.erb +1 -0
  340. data/app/views/spree/admin/page_blocks/forms/_link.html.erb +19 -0
  341. data/app/views/spree/admin/page_blocks/forms/_mega_nav.html.erb +14 -0
  342. data/app/views/spree/admin/page_blocks/forms/_mega_nav_with_subcategories.html.erb +9 -0
  343. data/app/views/spree/admin/page_blocks/forms/_nav.html.erb +6 -0
  344. data/app/views/spree/admin/page_blocks/forms/_newsletter_form.html.erb +20 -0
  345. data/app/views/spree/admin/page_blocks/forms/_price.html.erb +15 -0
  346. data/app/views/spree/admin/page_blocks/forms/_quantity_selector.html.erb +10 -0
  347. data/app/views/spree/admin/page_blocks/forms/_share.html.erb +5 -0
  348. data/app/views/spree/admin/page_blocks/forms/_subheading.html.erb +26 -0
  349. data/app/views/spree/admin/page_blocks/forms/_text.html.erb +21 -0
  350. data/app/views/spree/admin/page_blocks/forms/_title.html.erb +20 -0
  351. data/app/views/spree/admin/page_blocks/forms/_variant_picker.html.erb +10 -0
  352. data/app/views/spree/admin/page_blocks/move_higher.turbo_stream.erb +4 -0
  353. data/app/views/spree/admin/page_blocks/move_lower.turbo_stream.erb +4 -0
  354. data/app/views/spree/admin/page_blocks/show.html.erb +1 -0
  355. data/app/views/spree/admin/page_blocks/update.turbo_stream.erb +6 -0
  356. data/app/views/spree/admin/page_builder/_add_block.html.erb +20 -0
  357. data/app/views/spree/admin/page_builder/_color_palette.html.erb +17 -0
  358. data/app/views/spree/admin/page_builder/_color_picker.html.erb +26 -0
  359. data/app/views/spree/admin/page_builder/_header.html.erb +99 -0
  360. data/app/views/spree/admin/page_builder/_labeled_range_input.html.erb +10 -0
  361. data/app/views/spree/admin/page_builder/_pages_dropdown.html.erb +23 -0
  362. data/app/views/spree/admin/page_builder/_range_input.html.erb +12 -0
  363. data/app/views/spree/admin/page_builder/_sidebar.html.erb +14 -0
  364. data/app/views/spree/admin/page_builder/_sidebar_block.html.erb +29 -0
  365. data/app/views/spree/admin/page_builder/_sidebar_colors.html.erb +84 -0
  366. data/app/views/spree/admin/page_builder/_sidebar_fonts.html.erb +85 -0
  367. data/app/views/spree/admin/page_builder/_sidebar_section.html.erb +46 -0
  368. data/app/views/spree/admin/page_builder/_sidebar_sections.html.erb +33 -0
  369. data/app/views/spree/admin/page_builder/_sidebar_sections_toolbar.html.erb +65 -0
  370. data/app/views/spree/admin/page_links/_form.html.erb +19 -0
  371. data/app/views/spree/admin/page_links/_linkable_type_dropdown.html.erb +15 -0
  372. data/app/views/spree/admin/page_links/_list.html.erb +36 -0
  373. data/app/views/spree/admin/page_links/_refresh_theme_preview.turbo_stream.erb +5 -0
  374. data/app/views/spree/admin/page_links/create.turbo_stream.erb +4 -0
  375. data/app/views/spree/admin/page_links/destroy.turbo_stream.erb +11 -0
  376. data/app/views/spree/admin/page_links/edit.html.erb +18 -0
  377. data/app/views/spree/admin/page_links/update.turbo_stream.erb +6 -0
  378. data/app/views/spree/admin/page_sections/_form_tab_buttons.html.erb +12 -0
  379. data/app/views/spree/admin/page_sections/create.turbo_stream.erb +11 -0
  380. data/app/views/spree/admin/page_sections/destroy.turbo_stream.erb +16 -0
  381. data/app/views/spree/admin/page_sections/edit.html.erb +42 -0
  382. data/app/views/spree/admin/page_sections/fields/_background_color.html.erb +6 -0
  383. data/app/views/spree/admin/page_sections/fields/_border_bottom_width.html.erb +5 -0
  384. data/app/views/spree/admin/page_sections/fields/_border_color.html.erb +7 -0
  385. data/app/views/spree/admin/page_sections/fields/_border_top_width.html.erb +6 -0
  386. data/app/views/spree/admin/page_sections/fields/_bottom_padding.html.erb +5 -0
  387. data/app/views/spree/admin/page_sections/fields/_button.html.erb +15 -0
  388. data/app/views/spree/admin/page_sections/fields/_header_layout.html.erb +26 -0
  389. data/app/views/spree/admin/page_sections/fields/_height.html.erb +6 -0
  390. data/app/views/spree/admin/page_sections/fields/_text_color.html.erb +7 -0
  391. data/app/views/spree/admin/page_sections/fields/_top_padding.html.erb +6 -0
  392. data/app/views/spree/admin/page_sections/forms/_announcement_bar.html.erb +5 -0
  393. data/app/views/spree/admin/page_sections/forms/_brand_story.html.erb +0 -0
  394. data/app/views/spree/admin/page_sections/forms/_collection_banner.html.erb +0 -0
  395. data/app/views/spree/admin/page_sections/forms/_custom_code.html.erb +4 -0
  396. data/app/views/spree/admin/page_sections/forms/_featured_posts.html.erb +38 -0
  397. data/app/views/spree/admin/page_sections/forms/_featured_product.html.erb +4 -0
  398. data/app/views/spree/admin/page_sections/forms/_featured_taxon.html.erb +59 -0
  399. data/app/views/spree/admin/page_sections/forms/_featured_taxons.html.erb +13 -0
  400. data/app/views/spree/admin/page_sections/forms/_footer.html.erb +20 -0
  401. data/app/views/spree/admin/page_sections/forms/_header.html.erb +14 -0
  402. data/app/views/spree/admin/page_sections/forms/_image_banner.html.erb +13 -0
  403. data/app/views/spree/admin/page_sections/forms/_image_with_text.html.erb +31 -0
  404. data/app/views/spree/admin/page_sections/forms/_main_password_footer.html.erb +9 -0
  405. data/app/views/spree/admin/page_sections/forms/_main_password_header.erb +13 -0
  406. data/app/views/spree/admin/page_sections/forms/_newsletter.html.erb +15 -0
  407. data/app/views/spree/admin/page_sections/forms/_page_title.html.erb +4 -0
  408. data/app/views/spree/admin/page_sections/forms/_post_details.html.erb +0 -0
  409. data/app/views/spree/admin/page_sections/forms/_post_grid.html.erb +0 -0
  410. data/app/views/spree/admin/page_sections/forms/_product_details.html.erb +1 -0
  411. data/app/views/spree/admin/page_sections/forms/_product_grid.html.erb +1 -0
  412. data/app/views/spree/admin/page_sections/forms/_related_products.html.erb +32 -0
  413. data/app/views/spree/admin/page_sections/forms/_rich_text.html.erb +0 -0
  414. data/app/views/spree/admin/page_sections/forms/_taxon_banner.html.erb +0 -0
  415. data/app/views/spree/admin/page_sections/forms/_taxon_grid.html.erb +5 -0
  416. data/app/views/spree/admin/page_sections/forms/_video.html.erb +15 -0
  417. data/app/views/spree/admin/page_sections/move_higher.turbo_stream.erb +7 -0
  418. data/app/views/spree/admin/page_sections/move_lower.turbo_stream.erb +7 -0
  419. data/app/views/spree/admin/page_sections/new.html.erb +28 -0
  420. data/app/views/spree/admin/page_sections/remove_attachment.turbo_stream.erb +4 -0
  421. data/app/views/spree/admin/page_sections/restore_design_settings_to_defaults.turbo_stream.erb +4 -0
  422. data/app/views/spree/admin/page_sections/show.html.erb +1 -0
  423. data/app/views/spree/admin/page_sections/update.turbo_stream.erb +10 -0
  424. data/app/views/spree/admin/pages/_filters.html.erb +7 -0
  425. data/app/views/spree/admin/pages/_form.html.erb +29 -0
  426. data/app/views/spree/admin/pages/_page.erb +8 -0
  427. data/app/views/spree/admin/pages/edit.html.erb +18 -0
  428. data/app/views/spree/admin/pages/index.html.erb +28 -0
  429. data/app/views/spree/admin/pages/new.html.erb +11 -0
  430. data/app/views/spree/admin/payment_methods/_available_payment_method.html.erb +21 -0
  431. data/app/views/spree/admin/payment_methods/_check.html.erb +0 -0
  432. data/app/views/spree/admin/payment_methods/_form.html.erb +71 -0
  433. data/app/views/spree/admin/payment_methods/_payment_method.html.erb +38 -0
  434. data/app/views/spree/admin/payment_methods/descriptions/_check.html.erb +0 -0
  435. data/app/views/spree/admin/payment_methods/descriptions/_gateway.html.erb +1 -0
  436. data/app/views/spree/admin/payment_methods/descriptions/_store_credit.html.erb +1 -0
  437. data/app/views/spree/admin/payment_methods/edit.html.erb +10 -0
  438. data/app/views/spree/admin/payment_methods/index.html.erb +38 -0
  439. data/app/views/spree/admin/payment_methods/new.html.erb +12 -0
  440. data/app/views/spree/admin/payment_methods/update.turbo_stream.erb +1 -0
  441. data/app/views/spree/admin/payments/_payment.html.erb +89 -0
  442. data/app/views/spree/admin/payments/new.html.erb +64 -0
  443. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +54 -0
  444. data/app/views/spree/admin/payments/source_forms/_previous_cards.html.erb +21 -0
  445. data/app/views/spree/admin/payments/source_forms/_spree_stripe.html.erb +7 -0
  446. data/app/views/spree/admin/payments/source_forms/_store_credit.html.erb +22 -0
  447. data/app/views/spree/admin/payments/source_views/_check.html.erb +0 -0
  448. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +22 -0
  449. data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +31 -0
  450. data/app/views/spree/admin/post_categories/_form.html.erb +15 -0
  451. data/app/views/spree/admin/post_categories/_post_category.html.erb +6 -0
  452. data/app/views/spree/admin/post_categories/edit.html.erb +15 -0
  453. data/app/views/spree/admin/post_categories/index.html.erb +27 -0
  454. data/app/views/spree/admin/post_categories/new.html.erb +15 -0
  455. data/app/views/spree/admin/posts/_extra_actions.html.erb +0 -0
  456. data/app/views/spree/admin/posts/_filters.html.erb +40 -0
  457. data/app/views/spree/admin/posts/_form.html.erb +81 -0
  458. data/app/views/spree/admin/posts/_post.html.erb +32 -0
  459. data/app/views/spree/admin/posts/edit.html.erb +15 -0
  460. data/app/views/spree/admin/posts/index.html.erb +36 -0
  461. data/app/views/spree/admin/posts/new.html.erb +11 -0
  462. data/app/views/spree/admin/preferences/_password_field.html.erb +26 -0
  463. data/app/views/spree/admin/products/_bulk_operations.html.erb +122 -0
  464. data/app/views/spree/admin/products/_edit_page_title.html.erb +3 -0
  465. data/app/views/spree/admin/products/_empty_list.html.erb +1 -0
  466. data/app/views/spree/admin/products/_filters.html.erb +60 -0
  467. data/app/views/spree/admin/products/_form.html.erb +29 -0
  468. data/app/views/spree/admin/products/_import_button.html.erb +0 -0
  469. data/app/views/spree/admin/products/_index_header.html.erb +7 -0
  470. data/app/views/spree/admin/products/_list.html.erb +50 -0
  471. data/app/views/spree/admin/products/_product.html.erb +30 -0
  472. data/app/views/spree/admin/products/_product_status.html.erb +3 -0
  473. data/app/views/spree/admin/products/_search_result.html.erb +9 -0
  474. data/app/views/spree/admin/products/_search_results.html.erb +9 -0
  475. data/app/views/spree/admin/products/_table_filter_dropdown.html.erb +42 -0
  476. data/app/views/spree/admin/products/bulk_modal.html.erb +23 -0
  477. data/app/views/spree/admin/products/bulk_status_update.turbo_stream.erb +7 -0
  478. data/app/views/spree/admin/products/edit.html.erb +38 -0
  479. data/app/views/spree/admin/products/form/_base.html.erb +16 -0
  480. data/app/views/spree/admin/products/form/_categorization.html.erb +35 -0
  481. data/app/views/spree/admin/products/form/_extra_filters.html.erb +0 -0
  482. data/app/views/spree/admin/products/form/_extra_form.html.erb +0 -0
  483. data/app/views/spree/admin/products/form/_extra_form_sidebar.erb +0 -0
  484. data/app/views/spree/admin/products/form/_inventory.html.erb +63 -0
  485. data/app/views/spree/admin/products/form/_properties.html.erb +46 -0
  486. data/app/views/spree/admin/products/form/_shipping.html.erb +16 -0
  487. data/app/views/spree/admin/products/form/_status.html.erb +52 -0
  488. data/app/views/spree/admin/products/form/_stores.html.erb +27 -0
  489. data/app/views/spree/admin/products/form/_variants.html.erb +171 -0
  490. data/app/views/spree/admin/products/form/variants/_option_template.html.erb +59 -0
  491. data/app/views/spree/admin/products/form/variants/_variant_template.html.erb +44 -0
  492. data/app/views/spree/admin/products/index.html.erb +18 -0
  493. data/app/views/spree/admin/products/new.html.erb +9 -0
  494. data/app/views/spree/admin/profile/edit.html.erb +79 -0
  495. data/app/views/spree/admin/promotion_actions/_promotion_action.html.erb +45 -0
  496. data/app/views/spree/admin/promotion_actions/edit.html.erb +17 -0
  497. data/app/views/spree/admin/promotion_actions/forms/_create_adjustment.html.erb +1 -0
  498. data/app/views/spree/admin/promotion_actions/forms/_create_item_adjustments.html.erb +1 -0
  499. data/app/views/spree/admin/promotion_actions/forms/_create_line_items.html.erb +35 -0
  500. data/app/views/spree/admin/promotion_actions/forms/_create_line_items_row.html.erb +28 -0
  501. data/app/views/spree/admin/promotion_actions/forms/_free_shipping.html.erb +0 -0
  502. data/app/views/spree/admin/promotion_actions/new.html.erb +48 -0
  503. data/app/views/spree/admin/promotion_rules/_promotion_rule.html.erb +53 -0
  504. data/app/views/spree/admin/promotion_rules/edit.html.erb +17 -0
  505. data/app/views/spree/admin/promotion_rules/forms/_country.html.erb +7 -0
  506. data/app/views/spree/admin/promotion_rules/forms/_currency.html.erb +10 -0
  507. data/app/views/spree/admin/promotion_rules/forms/_first_order.html.erb +0 -0
  508. data/app/views/spree/admin/promotion_rules/forms/_item_total.html.erb +26 -0
  509. data/app/views/spree/admin/promotion_rules/forms/_one_use_per_user.html.erb +0 -0
  510. data/app/views/spree/admin/promotion_rules/forms/_option_value.html.erb +9 -0
  511. data/app/views/spree/admin/promotion_rules/forms/_product.html.erb +9 -0
  512. data/app/views/spree/admin/promotion_rules/forms/_taxon.html.erb +9 -0
  513. data/app/views/spree/admin/promotion_rules/forms/_user.html.erb +7 -0
  514. data/app/views/spree/admin/promotion_rules/forms/_user_logged_in.html.erb +0 -0
  515. data/app/views/spree/admin/promotion_rules/new.html.erb +48 -0
  516. data/app/views/spree/admin/promotions/_actions.html.erb +30 -0
  517. data/app/views/spree/admin/promotions/_form.html.erb +47 -0
  518. data/app/views/spree/admin/promotions/_header.html.erb +16 -0
  519. data/app/views/spree/admin/promotions/_promotion.html.erb +34 -0
  520. data/app/views/spree/admin/promotions/_rules.html.erb +44 -0
  521. data/app/views/spree/admin/promotions/_sidebar.html.erb +117 -0
  522. data/app/views/spree/admin/promotions/_status.html.erb +16 -0
  523. data/app/views/spree/admin/promotions/_table_filter_dropdown.html.erb +17 -0
  524. data/app/views/spree/admin/promotions/_usage_limit.html.erb +13 -0
  525. data/app/views/spree/admin/promotions/edit.html.erb +59 -0
  526. data/app/views/spree/admin/promotions/form/_kind.html.erb +57 -0
  527. data/app/views/spree/admin/promotions/form/_settings.html.erb +24 -0
  528. data/app/views/spree/admin/promotions/index.html.erb +62 -0
  529. data/app/views/spree/admin/promotions/new.html.erb +11 -0
  530. data/app/views/spree/admin/promotions/show.html.erb +12 -0
  531. data/app/views/spree/admin/properties/_form.html.erb +22 -0
  532. data/app/views/spree/admin/properties/_property.html.erb +25 -0
  533. data/app/views/spree/admin/properties/edit.html.erb +15 -0
  534. data/app/views/spree/admin/properties/index.html.erb +53 -0
  535. data/app/views/spree/admin/properties/new.html.erb +14 -0
  536. data/app/views/spree/admin/properties/update.turbo_stream.erb +1 -0
  537. data/app/views/spree/admin/refund_reasons/edit.html.erb +3 -0
  538. data/app/views/spree/admin/refund_reasons/index.html.erb +40 -0
  539. data/app/views/spree/admin/refund_reasons/new.html.erb +4 -0
  540. data/app/views/spree/admin/refunds/_form.html.erb +17 -0
  541. data/app/views/spree/admin/refunds/edit.html.erb +20 -0
  542. data/app/views/spree/admin/refunds/new.html.erb +29 -0
  543. data/app/views/spree/admin/reimbursement_types/_form.html.erb +30 -0
  544. data/app/views/spree/admin/reimbursement_types/edit.html.erb +15 -0
  545. data/app/views/spree/admin/reimbursement_types/index.html.erb +44 -0
  546. data/app/views/spree/admin/reimbursement_types/new.html.erb +16 -0
  547. data/app/views/spree/admin/reimbursements/edit.html.erb +130 -0
  548. data/app/views/spree/admin/reimbursements/show.html.erb +113 -0
  549. data/app/views/spree/admin/reports/_report.html.erb +22 -0
  550. data/app/views/spree/admin/reports/create.turbo_stream.erb +1 -0
  551. data/app/views/spree/admin/reports/index.html.erb +28 -0
  552. data/app/views/spree/admin/reports/new.html.erb +39 -0
  553. data/app/views/spree/admin/return_authorization_reasons/edit.html.erb +3 -0
  554. data/app/views/spree/admin/return_authorization_reasons/index.html.erb +45 -0
  555. data/app/views/spree/admin/return_authorization_reasons/new.html.erb +4 -0
  556. data/app/views/spree/admin/return_authorizations/_filters.html.erb +39 -0
  557. data/app/views/spree/admin/return_authorizations/_list.html.erb +30 -0
  558. data/app/views/spree/admin/return_authorizations/_return_authorization.html.erb +40 -0
  559. data/app/views/spree/admin/return_authorizations/index.html.erb +14 -0
  560. data/app/views/spree/admin/roles/_form.html.erb +6 -0
  561. data/app/views/spree/admin/roles/edit.html.erb +13 -0
  562. data/app/views/spree/admin/roles/index.html.erb +32 -0
  563. data/app/views/spree/admin/roles/new.html.erb +15 -0
  564. data/app/views/spree/admin/shared/_address.html.erb +42 -0
  565. data/app/views/spree/admin/shared/_alerts.html.erb +22 -0
  566. data/app/views/spree/admin/shared/_analytics_loader_skeleton.html.erb +76 -0
  567. data/app/views/spree/admin/shared/_audit_nav.html.erb +3 -0
  568. data/app/views/spree/admin/shared/_bulk_modal.html.erb +21 -0
  569. data/app/views/spree/admin/shared/_calculator_fields.html.erb +34 -0
  570. data/app/views/spree/admin/shared/_calendar_range_picker.html.erb +28 -0
  571. data/app/views/spree/admin/shared/_close_bulk_modal.turbo_stream.erb +2 -0
  572. data/app/views/spree/admin/shared/_content_header.html.erb +81 -0
  573. data/app/views/spree/admin/shared/_custom_head.html.erb +0 -0
  574. data/app/views/spree/admin/shared/_developers_nav.html.erb +7 -0
  575. data/app/views/spree/admin/shared/_edit_resource_links.html.erb +6 -0
  576. data/app/views/spree/admin/shared/_error_messages.html.erb +22 -0
  577. data/app/views/spree/admin/shared/_filter_badge_template.erb +3 -0
  578. data/app/views/spree/admin/shared/_filters_button.html.erb +8 -0
  579. data/app/views/spree/admin/shared/_filters_search_bar.html.erb +15 -0
  580. data/app/views/spree/admin/shared/_footer.html.erb +2 -0
  581. data/app/views/spree/admin/shared/_growth_rate_badge.html.erb +17 -0
  582. data/app/views/spree/admin/shared/_head.html.erb +52 -0
  583. data/app/views/spree/admin/shared/_header.html.erb +28 -0
  584. data/app/views/spree/admin/shared/_index_table_options.html.erb +22 -0
  585. data/app/views/spree/admin/shared/_map.html.erb +9 -0
  586. data/app/views/spree/admin/shared/_modal.html.erb +37 -0
  587. data/app/views/spree/admin/shared/_multi_product_picker.html.erb +26 -0
  588. data/app/views/spree/admin/shared/_new_resource_links.html.erb +3 -0
  589. data/app/views/spree/admin/shared/_no_image.html.erb +6 -0
  590. data/app/views/spree/admin/shared/_no_resource_found.html.erb +6 -0
  591. data/app/views/spree/admin/shared/_offcanvas_nav.html.erb +25 -0
  592. data/app/views/spree/admin/shared/_page_section_image.html.erb +1 -0
  593. data/app/views/spree/admin/shared/_page_section_logo.html.erb +1 -0
  594. data/app/views/spree/admin/shared/_posts_tabs.html.erb +8 -0
  595. data/app/views/spree/admin/shared/_preferences.html.erb +9 -0
  596. data/app/views/spree/admin/shared/_product_image.html.erb +21 -0
  597. data/app/views/spree/admin/shared/_refunds.html.erb +30 -0
  598. data/app/views/spree/admin/shared/_returns_and_refunds_nav.html.erb +9 -0
  599. data/app/views/spree/admin/shared/_seo.html.erb +39 -0
  600. data/app/views/spree/admin/shared/_shipping_nav.html.erb +4 -0
  601. data/app/views/spree/admin/shared/_sidebar.html.erb +15 -0
  602. data/app/views/spree/admin/shared/_spinner.html.erb +7 -0
  603. data/app/views/spree/admin/shared/_stock_nav.html.erb +4 -0
  604. data/app/views/spree/admin/shared/_tax_nav.html.erb +4 -0
  605. data/app/views/spree/admin/shared/_user.html.erb +24 -0
  606. data/app/views/spree/admin/shared/_user_dropdown.html.erb +41 -0
  607. data/app/views/spree/admin/shared/named_types/_edit.html.erb +15 -0
  608. data/app/views/spree/admin/shared/named_types/_form.html.erb +15 -0
  609. data/app/views/spree/admin/shared/named_types/_new.html.erb +15 -0
  610. data/app/views/spree/admin/shared/sidebar/_custom_nav.html.erb +0 -0
  611. data/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erb +10 -0
  612. data/app/views/spree/admin/shared/sidebar/_integrations_nav.html.erb +7 -0
  613. data/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb +35 -0
  614. data/app/views/spree/admin/shared/sidebar/_products_nav.html.erb +41 -0
  615. data/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb +20 -0
  616. data/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb +67 -0
  617. data/app/views/spree/admin/shared/sidebar/_store_nav.html.erb +176 -0
  618. data/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb +29 -0
  619. data/app/views/spree/admin/shared/sidebar/_vendors_nav.html.erb +8 -0
  620. data/app/views/spree/admin/shared/sortable_tree/_taxonomy.html.erb +66 -0
  621. data/app/views/spree/admin/shipments/edit.html.erb +28 -0
  622. data/app/views/spree/admin/shipments/split.html.erb +16 -0
  623. data/app/views/spree/admin/shipping_categories/_form.html.erb +9 -0
  624. data/app/views/spree/admin/shipping_categories/edit.html.erb +11 -0
  625. data/app/views/spree/admin/shipping_categories/index.html.erb +36 -0
  626. data/app/views/spree/admin/shipping_categories/new.html.erb +13 -0
  627. data/app/views/spree/admin/shipping_methods/_actions.html.erb +5 -0
  628. data/app/views/spree/admin/shipping_methods/_form.html.erb +141 -0
  629. data/app/views/spree/admin/shipping_methods/_shipping_method.html.erb +33 -0
  630. data/app/views/spree/admin/shipping_methods/edit.html.erb +12 -0
  631. data/app/views/spree/admin/shipping_methods/index.html.erb +34 -0
  632. data/app/views/spree/admin/shipping_methods/new.html.erb +13 -0
  633. data/app/views/spree/admin/shipping_methods/update.turbo_stream.erb +1 -0
  634. data/app/views/spree/admin/stock_items/_filters.html.erb +39 -0
  635. data/app/views/spree/admin/stock_items/_stock_item.html.erb +43 -0
  636. data/app/views/spree/admin/stock_items/index.html.erb +38 -0
  637. data/app/views/spree/admin/stock_items/update.turbo_stream.erb +1 -0
  638. data/app/views/spree/admin/stock_locations/_form.html.erb +56 -0
  639. data/app/views/spree/admin/stock_locations/_stock_location.html.erb +30 -0
  640. data/app/views/spree/admin/stock_locations/edit.html.erb +9 -0
  641. data/app/views/spree/admin/stock_locations/index.html.erb +26 -0
  642. data/app/views/spree/admin/stock_locations/new.html.erb +11 -0
  643. data/app/views/spree/admin/stock_transfers/_destination_movement_form.html.erb +36 -0
  644. data/app/views/spree/admin/stock_transfers/_filters.html.erb +46 -0
  645. data/app/views/spree/admin/stock_transfers/_new_variant_modal.html.erb +30 -0
  646. data/app/views/spree/admin/stock_transfers/_new_variant_template.html.erb +8 -0
  647. data/app/views/spree/admin/stock_transfers/_source_movement_form.html.erb +8 -0
  648. data/app/views/spree/admin/stock_transfers/_stock_movement.html.erb +5 -0
  649. data/app/views/spree/admin/stock_transfers/_stock_transfer.html.erb +11 -0
  650. data/app/views/spree/admin/stock_transfers/index.html.erb +38 -0
  651. data/app/views/spree/admin/stock_transfers/new.html.erb +85 -0
  652. data/app/views/spree/admin/stock_transfers/show.html.erb +58 -0
  653. data/app/views/spree/admin/store_credit_categories/_form.html.erb +5 -0
  654. data/app/views/spree/admin/store_credit_categories/edit.html.erb +13 -0
  655. data/app/views/spree/admin/store_credit_categories/index.html.erb +32 -0
  656. data/app/views/spree/admin/store_credit_categories/new.html.erb +15 -0
  657. data/app/views/spree/admin/store_credits/_form.html.erb +24 -0
  658. data/app/views/spree/admin/store_credits/_list.html.erb +41 -0
  659. data/app/views/spree/admin/store_credits/edit.html.erb +36 -0
  660. data/app/views/spree/admin/store_credits/index.html.erb +20 -0
  661. data/app/views/spree/admin/store_credits/new.html.erb +26 -0
  662. data/app/views/spree/admin/storefront/edit.html.erb +146 -0
  663. data/app/views/spree/admin/stores/create.turbo_stream.erb +5 -0
  664. data/app/views/spree/admin/stores/edit.html.erb +13 -0
  665. data/app/views/spree/admin/stores/edit_emails.html.erb +11 -0
  666. data/app/views/spree/admin/stores/form/_basic.html.erb +160 -0
  667. data/app/views/spree/admin/stores/form/_buttons.html.erb +3 -0
  668. data/app/views/spree/admin/stores/form/_checkout.html.erb +50 -0
  669. data/app/views/spree/admin/stores/form/_custom.html.erb +0 -0
  670. data/app/views/spree/admin/stores/form/_emails.html.erb +59 -0
  671. data/app/views/spree/admin/stores/form/_policies.html.erb +85 -0
  672. data/app/views/spree/admin/stores/new.html.erb +135 -0
  673. data/app/views/spree/admin/stores/new.turbo_stream.erb +1 -0
  674. data/app/views/spree/admin/stores/update.turbo_stream.erb +11 -0
  675. data/app/views/spree/admin/tax_categories/_form.html.erb +25 -0
  676. data/app/views/spree/admin/tax_categories/_tax_category.html.erb +13 -0
  677. data/app/views/spree/admin/tax_categories/edit.html.erb +11 -0
  678. data/app/views/spree/admin/tax_categories/index.html.erb +30 -0
  679. data/app/views/spree/admin/tax_categories/new.html.erb +11 -0
  680. data/app/views/spree/admin/tax_rates/_form.html.erb +48 -0
  681. data/app/views/spree/admin/tax_rates/_tax_rate.html.erb +15 -0
  682. data/app/views/spree/admin/tax_rates/edit.html.erb +11 -0
  683. data/app/views/spree/admin/tax_rates/index.html.erb +32 -0
  684. data/app/views/spree/admin/tax_rates/new.html.erb +14 -0
  685. data/app/views/spree/admin/taxonomies/_taxonomy.html.erb +16 -0
  686. data/app/views/spree/admin/taxonomies/edit.html.erb +28 -0
  687. data/app/views/spree/admin/taxonomies/index.html.erb +40 -0
  688. data/app/views/spree/admin/taxonomies/new.html.erb +23 -0
  689. data/app/views/spree/admin/taxonomies/show.html.erb +28 -0
  690. data/app/views/spree/admin/taxons/_form.html.erb +148 -0
  691. data/app/views/spree/admin/taxons/_rule_form.html.erb +24 -0
  692. data/app/views/spree/admin/taxons/_rules_form.html.erb +34 -0
  693. data/app/views/spree/admin/taxons/destroy.turbo_stream.erb +1 -0
  694. data/app/views/spree/admin/taxons/edit.html.erb +19 -0
  695. data/app/views/spree/admin/taxons/new.html.erb +12 -0
  696. data/app/views/spree/admin/taxons/rule_forms/_available_on.html.erb +4 -0
  697. data/app/views/spree/admin/taxons/rule_forms/_sale.html.erb +4 -0
  698. data/app/views/spree/admin/taxons/rule_forms/_tag.html.erb +1 -0
  699. data/app/views/spree/admin/themes/_theme.html.erb +53 -0
  700. data/app/views/spree/admin/themes/_theme_preview_image.html.erb +24 -0
  701. data/app/views/spree/admin/themes/edit.html.erb +14 -0
  702. data/app/views/spree/admin/themes/index.html.erb +79 -0
  703. data/app/views/spree/admin/themes/update.turbo_stream.erb +1 -0
  704. data/app/views/spree/admin/translations/_translations_unavailable.html.erb +10 -0
  705. data/app/views/spree/admin/translations/edit.html.erb +47 -0
  706. data/app/views/spree/admin/translations/products/_form.html.erb +23 -0
  707. data/app/views/spree/admin/translations/stores/_form.html.erb +23 -0
  708. data/app/views/spree/admin/translations/taxonomies/_form.html.erb +20 -0
  709. data/app/views/spree/admin/translations/taxons/_form.html.erb +37 -0
  710. data/app/views/spree/admin/users/_billing.html.erb +78 -0
  711. data/app/views/spree/admin/users/_details.html.erb +52 -0
  712. data/app/views/spree/admin/users/_extra_actions.html.erb +0 -0
  713. data/app/views/spree/admin/users/_filters.html.erb +85 -0
  714. data/app/views/spree/admin/users/_form.html.erb +36 -0
  715. data/app/views/spree/admin/users/_last_order.html.erb +33 -0
  716. data/app/views/spree/admin/users/_last_order_line_item.html.erb +19 -0
  717. data/app/views/spree/admin/users/_lifetime_stats.html.erb +65 -0
  718. data/app/views/spree/admin/users/_shipping.html.erb +33 -0
  719. data/app/views/spree/admin/users/_tabs.html.erb +74 -0
  720. data/app/views/spree/admin/users/_user.html.erb +20 -0
  721. data/app/views/spree/admin/users/bulk_modal.html.erb +21 -0
  722. data/app/views/spree/admin/users/edit.html.erb +17 -0
  723. data/app/views/spree/admin/users/index.csv.erb +43 -0
  724. data/app/views/spree/admin/users/index.html.erb +102 -0
  725. data/app/views/spree/admin/users/new.html.erb +14 -0
  726. data/app/views/spree/admin/users/show.html.erb +38 -0
  727. data/app/views/spree/admin/variants/_search_result.html.erb +28 -0
  728. data/app/views/spree/admin/variants/_search_results.html.erb +9 -0
  729. data/app/views/spree/admin/variants/_variant.html.erb +13 -0
  730. data/app/views/spree/admin/variants/edit.html.erb +20 -0
  731. data/app/views/spree/admin/variants/form/_basic.html.erb +31 -0
  732. data/app/views/spree/admin/variants/form/_dimensions.html.erb +33 -0
  733. data/app/views/spree/admin/variants/form/_inventory.html.erb +45 -0
  734. data/app/views/spree/admin/variants/form/_media.html.erb +32 -0
  735. data/app/views/spree/admin/variants/form/_media_asset.html.erb +21 -0
  736. data/app/views/spree/admin/variants/form/_pricing.html.erb +48 -0
  737. data/app/views/spree/admin/webhook_events/_webhook_event.html.erb +17 -0
  738. data/app/views/spree/admin/webhooks_subscribers/_form.html.erb +66 -0
  739. data/app/views/spree/admin/webhooks_subscribers/_webhooks_subscriber.html.erb +16 -0
  740. data/app/views/spree/admin/webhooks_subscribers/edit.html.erb +9 -0
  741. data/app/views/spree/admin/webhooks_subscribers/index.html.erb +26 -0
  742. data/app/views/spree/admin/webhooks_subscribers/new.html.erb +11 -0
  743. data/app/views/spree/admin/webhooks_subscribers/show.html.erb +54 -0
  744. data/app/views/spree/admin/zones/_country_members.html.erb +16 -0
  745. data/app/views/spree/admin/zones/_form.html.erb +52 -0
  746. data/app/views/spree/admin/zones/_state_members.html.erb +21 -0
  747. data/app/views/spree/admin/zones/edit.html.erb +12 -0
  748. data/app/views/spree/admin/zones/index.html.erb +45 -0
  749. data/app/views/spree/admin/zones/new.html.erb +11 -0
  750. data/config/i18n-tasks.yml +190 -0
  751. data/config/importmap.rb +149 -0
  752. data/config/initializers/action_text.rb +8 -0
  753. data/config/initializers/assets.rb +1 -0
  754. data/config/initializers/chartkick.rb +5 -0
  755. data/config/initializers/dartsass.rb +3 -0
  756. data/config/initializers/form_builder.rb +10 -0
  757. data/config/initializers/ransack.rb +19 -0
  758. data/config/locales/en.yml +304 -0
  759. data/config/routes.rb +240 -0
  760. data/lib/generators/spree/admin/install/install_generator.rb +42 -0
  761. data/lib/generators/spree/admin/install/templates/dev +16 -0
  762. data/lib/spree/admin/action_callbacks.rb +27 -0
  763. data/lib/spree/admin/callbacks.rb +51 -0
  764. data/lib/spree/admin/engine.rb +51 -0
  765. data/lib/spree/admin/runtime_configuration.rb +12 -0
  766. data/lib/spree/admin/testing_support/capybara_utils.rb +45 -0
  767. data/lib/spree/admin.rb +23 -0
  768. data/lib/spree_admin.rb +18 -0
  769. data/vendor/javascript/@easepick--base-plugin.js +4 -0
  770. data/vendor/javascript/@easepick--core.js +4 -0
  771. data/vendor/javascript/@easepick--datetime.js +4 -0
  772. data/vendor/javascript/@easepick--preset-plugin.js +4 -0
  773. data/vendor/javascript/@easepick--range-plugin.js +4 -0
  774. data/vendor/javascript/@orchidjs--sifter.js +17 -0
  775. data/vendor/javascript/@orchidjs--unicode-variants.js +11 -0
  776. data/vendor/javascript/@rails--actiontext@7.2.201.js +4 -0
  777. data/vendor/javascript/@simonwep--pickr.js +4 -0
  778. data/vendor/javascript/@stimulus-components--rails-nested-form.js +4 -0
  779. data/vendor/javascript/bootstrap--dist--js--bootstrap.bundle.min.js.js +8 -0
  780. data/vendor/javascript/dompurify.js +139 -0
  781. data/vendor/javascript/hotkeys-js.js +4 -0
  782. data/vendor/javascript/jquery.min.js +2 -0
  783. data/vendor/javascript/local-time.js +4 -0
  784. data/vendor/javascript/sortablejs.js +136 -0
  785. data/vendor/javascript/stimulus-checkbox-select-all.js +4 -0
  786. data/vendor/javascript/stimulus-clipboard.js +4 -0
  787. data/vendor/javascript/stimulus-notification.js +4 -0
  788. data/vendor/javascript/stimulus-password-visibility.js +4 -0
  789. data/vendor/javascript/stimulus-reveal-controller.js +4 -0
  790. data/vendor/javascript/stimulus-sortable.js +4 -0
  791. data/vendor/javascript/stimulus-textarea-autogrow.js +4 -0
  792. data/vendor/javascript/stimulus-use.js +4 -0
  793. data/vendor/javascript/tom-select--dist--esm--tom-select.complete.js.js +32 -0
  794. data/vendor/javascript/trix@2.1.12.js +5 -0
  795. metadata +1084 -0
@@ -0,0 +1,5 @@
1
+ // trix@2.1.12 downloaded from https://ga.jspm.io/npm:trix@2.1.12/dist/trix.esm.min.js
2
+
3
+ var o="2.1.12";const s="[data-trix-attachment]",a={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},l={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,htmlAttributes:["language"],text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test(o){return r(o.parentNode)===l[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(o){return r(o.parentNode)===l[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},r=o=>{var s;return null==o||null===(s=o.tagName)||void 0===s?void 0:s.toLowerCase()},c=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),h=c&&parseInt(c[1]);var d={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:h&&h>12,samsungAndroid:h&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:"undefined"!=typeof InputEvent&&["data","getTargetRanges","inputType"].every((o=>o in InputEvent.prototype))},g={ADD_ATTR:["language"],SAFE_FOR_XML:!1,RETURN_DOM:!0},p={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption…",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL…",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"};const f=[p.bytes,p.KB,p.MB,p.GB,p.TB,p.PB];var w={prefix:"IEC",precision:2,formatter(o){switch(o){case 0:return"0 ".concat(p.bytes);case 1:return"1 ".concat(p.byte);default:let s;"SI"===this.prefix?s=1e3:"IEC"===this.prefix&&(s=1024);const a=Math.floor(Math.log(o)/Math.log(s)),l=(o/Math.pow(s,a)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(l," ").concat(f[a])}}};const _="\ufeff",j=" ",m=function(o){for(const s in o){const a=o[s];this[s]=a}return this},W=document.documentElement,U=W.matches,b=function(o){let{onElement:s,matchingSelector:a,withCallback:l,inPhase:c,preventDefault:h,times:d}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const g=s||W,p=a,f="capturing"===c,u=function(o){null!=d&&0==--d&&u.destroy();const s=y(o.target,{matchingSelector:p});null!=s&&(null==l||l.call(s,o,s),h&&o.preventDefault())};return u.destroy=()=>g.removeEventListener(o,u,f),g.addEventListener(o,u,f),u},v=function(o){let{onElement:s,bubbles:a,cancelable:l,attributes:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const h=null!=s?s:W;a=!1!==a,l=!1!==l;const d=document.createEvent("Events");return d.initEvent(o,a,l),null!=c&&m.call(d,c),h.dispatchEvent(d)},A=function(o,s){if(1===(null==o?void 0:o.nodeType))return U.call(o,s)},y=function(o){let{matchingSelector:s,untilNode:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.parentNode;if(null!=o){if(null==s)return o;if(o.closest&&null==a)return o.closest(s);for(;o&&o!==a;){if(A(o,s))return o;o=o.parentNode}}},x=o=>document.activeElement!==o&&C(o,document.activeElement),C=function(o,s){if(o&&s)for(;s;){if(s===o)return!0;s=s.parentNode}},E=function(o){var s;if(null===(s=o)||void 0===s||!s.parentNode)return;let a=0;for(o=o.previousSibling;o;)a++,o=o.previousSibling;return a},S=o=>{var s;return null==o||null===(s=o.parentNode)||void 0===s?void 0:s.removeChild(o)},R=function(o){let{onlyNodesOfType:s,usingFilter:a,expandEntityReferences:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const c=(()=>{switch(s){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}})();return document.createTreeWalker(o,c,null!=a?a:null,!0===l)},k=o=>{var s;return null==o||null===(s=o.tagName)||void 0===s?void 0:s.toLowerCase()},T=function(o){let s,a,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"==typeof o?(l=o,o=l.tagName):l={attributes:l};const c=document.createElement(o);if(null!=l.editable&&(null==l.attributes&&(l.attributes={}),l.attributes.contenteditable=l.editable),l.attributes)for(s in l.attributes)a=l.attributes[s],c.setAttribute(s,a);if(l.style)for(s in l.style)a=l.style[s],c.style[s]=a;if(l.data)for(s in l.data)a=l.data[s],c.dataset[s]=a;return l.className&&l.className.split(" ").forEach((o=>{c.classList.add(o)})),l.textContent&&(c.textContent=l.textContent),l.childNodes&&[].concat(l.childNodes).forEach((o=>{c.appendChild(o)})),c};let V;const L=function(){if(null!=V)return V;V=[];for(const o in l){const s=l[o];s.tagName&&V.push(s.tagName)}return V},D=o=>I(null==o?void 0:o.firstChild),N=function(o){let{strict:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{strict:!0};return s?I(o):I(o)||!I(o.firstChild)&&function(o){return L().includes(k(o))&&!L().includes(k(o.firstChild))}(o)},I=o=>O(o)&&"block"===(null==o?void 0:o.data),O=o=>(null==o?void 0:o.nodeType)===Node.COMMENT_NODE,F=function(o){let{name:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o)return B(o)?o.data===_?!s||o.parentNode.dataset.trixCursorTarget===s:void 0:F(o.firstChild)},P=o=>A(o,s),M=o=>B(o)&&""===(null==o?void 0:o.data),B=o=>(null==o?void 0:o.nodeType)===Node.TEXT_NODE,z={level2Enabled:!0,getLevel(){return this.level2Enabled&&d.supportsInputEvents?2:0},pickFiles(o){const s=T("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});s.addEventListener("change",(()=>{o(s.files),S(s)})),S(document.getElementById(this.fileInputId)),document.body.appendChild(s),s.click()}};var K={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:"\n"},J={bold:{tagName:"strong",inheritable:!0,parser(o){const s=window.getComputedStyle(o);return"bold"===s.fontWeight||s.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:o=>"italic"===window.getComputedStyle(o).fontStyle},href:{groupTagName:"a",parser(o){const a="a:not(".concat(s,")"),l=o.closest(a);if(l)return l.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},G={getDefaultHTML:()=>'<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="'.concat(p.bold,'" tabindex="-1">').concat(p.bold,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="').concat(p.italic,'" tabindex="-1">').concat(p.italic,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="').concat(p.strike,'" tabindex="-1">').concat(p.strike,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="').concat(p.link,'" tabindex="-1">').concat(p.link,'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="').concat(p.heading1,'" tabindex="-1">').concat(p.heading1,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="').concat(p.quote,'" tabindex="-1">').concat(p.quote,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="').concat(p.code,'" tabindex="-1">').concat(p.code,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="').concat(p.bullets,'" tabindex="-1">').concat(p.bullets,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="').concat(p.numbers,'" tabindex="-1">').concat(p.numbers,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="').concat(p.outdent,'" tabindex="-1">').concat(p.outdent,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="').concat(p.indent,'" tabindex="-1">').concat(p.indent,'</button>\n </span>\n\n <span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="').concat(p.attachFiles,'" tabindex="-1">').concat(p.attachFiles,'</button>\n </span>\n\n <span class="trix-button-group-spacer"></span>\n\n <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="').concat(p.undo,'" tabindex="-1">').concat(p.undo,'</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="').concat(p.redo,'" tabindex="-1">').concat(p.redo,'</button>\n </span>\n </div>\n\n <div class="trix-dialogs" data-trix-dialogs>\n <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">\n <div class="trix-dialog__link-fields">\n <input type="url" name="href" class="trix-input trix-input--dialog" placeholder="').concat(p.urlPlaceholder,'" aria-label="').concat(p.url,'" data-trix-validate-href required data-trix-input>\n <div class="trix-button-group">\n <input type="button" class="trix-button trix-button--dialog" value="').concat(p.link,'" data-trix-method="setAttribute">\n <input type="button" class="trix-button trix-button--dialog" value="').concat(p.unlink,'" data-trix-method="removeAttribute">\n </div>\n </div>\n </div>\n </div>')};const Y={interval:5e3};var $=Object.freeze({__proto__:null,attachments:a,blockAttributes:l,browser:d,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},dompurify:g,fileSize:w,input:z,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:p,parser:K,textAttributes:J,toolbar:G,undo:Y});class q{static proxyMethod(o){const{name:s,toMethod:a,toProperty:l,optional:c}=H(o);this.prototype[s]=function(){let o,h;var d,g;a?h=c?null===(d=this[a])||void 0===d?void 0:d.call(this):this[a]():l&&(h=this[l]);return c?(o=null===(g=h)||void 0===g?void 0:g[s],o?Q.call(o,h,arguments):void 0):(o=h[s],Q.call(o,h,arguments))}}}const H=function(o){const s=o.match(Z);if(!s)throw new Error("can't parse @proxyMethod expression: ".concat(o));const a={name:s[4]};return null!=s[2]?a.toMethod=s[1]:a.toProperty=s[1],null!=s[3]&&(a.optional=!0),a},{apply:Q}=Function.prototype,Z=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var tt,et,it;class X extends q{static box(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o instanceof this?o:this.fromUCS2String(null==o?void 0:o.toString())}static fromUCS2String(o){return new this(o,ct(o))}static fromCodepoints(o){return new this(ut(o),o)}constructor(o,s){super(...arguments),this.ucs2String=o,this.codepoints=s,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(o){return ut(this.codepoints.slice(0,Math.max(0,o))).length}offsetFromUCS2Offset(o){return ct(this.ucs2String.slice(0,Math.max(0,o))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(o){return this.slice(o,o+1)}isEqualTo(o){return this.constructor.box(o).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const nt=1===(null===(tt=Array.from)||void 0===tt?void 0:tt.call(Array,"👼").length),at=null!=(null===(et=" ".codePointAt)||void 0===et?void 0:et.call(" ",0)),lt=" 👼"===(null===(it=String.fromCodePoint)||void 0===it?void 0:it.call(String,32,128124));let ct,ut;ct=nt&&at?o=>Array.from(o).map((o=>o.codePointAt(0))):function(o){const s=[];let a=0;const{length:l}=o;for(;a<l;){let c=o.charCodeAt(a++);if(55296<=c&&c<=56319&&a<l){const s=o.charCodeAt(a++);56320==(64512&s)?c=((1023&c)<<10)+(1023&s)+65536:a--}s.push(c)}return s},ut=lt?o=>String.fromCodePoint(...Array.from(o||[])):function(o){return(()=>{const s=[];return Array.from(o).forEach((o=>{let a="";o>65535&&(o-=65536,a+=String.fromCharCode(o>>>10&1023|55296),o=56320|1023&o),s.push(a+String.fromCharCode(o))})),s})().join("")};let ht=0;class rt extends q{static fromJSONString(o){return this.fromJSON(JSON.parse(o))}constructor(){super(...arguments),this.id=++ht}hasSameConstructorAs(o){return this.constructor===(null==o?void 0:o.constructor)}isEqualTo(o){return this===o}inspect(){const o=[],s=this.contentsForInspection()||{};for(const a in s){const l=s[a];o.push("".concat(a,"=").concat(l))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(o.length?" ".concat(o.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return X.box(this)}getCacheKey(){return this.id.toString()}}const ot=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(o.length!==s.length)return!1;for(let a=0;a<o.length;a++)if(o[a]!==s[a])return!1;return!0},st=function(o){const s=o.slice(0);for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return s.splice(...l),s},dt=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,Ct=function(){const o=T("input",{dir:"auto",name:"x",dirName:"x.dir"}),s=T("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),a=T("form");a.appendChild(o),a.appendChild(s);const l=function(){try{return new FormData(a).has(s.dirName)}catch(o){return!1}}(),c=function(){try{return o.matches(":dir(ltr),:dir(rtl)")}catch(o){return!1}}();return l?function(o){return s.value=o,new FormData(a).get(s.dirName)}:c?function(s){return o.value=s,o.matches(":dir(rtl)")?"rtl":"ltr"}:function(o){const s=o.trim().charAt(0);return dt.test(s)?"rtl":"ltr"}}();let St=null,re=null,oe=null,se=null;const gt=()=>(St||(St=bt().concat(pt())),St),mt=o=>l[o],pt=()=>(re||(re=Object.keys(l)),re),ft=o=>J[o],bt=()=>(oe||(oe=Object.keys(J)),oe),vt=function(o,s){At(o).textContent=s.replace(/%t/g,o)},At=function(o){const s=document.createElement("style");s.setAttribute("type","text/css"),s.setAttribute("data-tag-name",o.toLowerCase());const a=yt();return a&&s.setAttribute("nonce",a),document.head.insertBefore(s,document.head.firstChild),s},yt=function(){const o=xt("trix-csp-nonce")||xt("csp-nonce");if(o){const{nonce:s,content:a}=o;return""==s?a:s}},xt=o=>document.head.querySelector("meta[name=".concat(o,"]")),ae={"application/x-trix-feature-detection":"test"},Et=function(o){const s=o.getData("text/plain"),a=o.getData("text/html");if(!s||!a)return null==s?void 0:s.length;{const{body:o}=(new DOMParser).parseFromString(a,"text/html");if(o.textContent===s)return!o.querySelector("*")}},le=/Mac|^iP/.test(navigator.platform)?o=>o.metaKey:o=>o.ctrlKey;const Rt=o=>setTimeout(o,1),kt=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s={};for(const a in o){const l=o[a];s[a]=l}return s},Tt=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.keys(o).length!==Object.keys(s).length)return!1;for(const a in o)if(o[a]!==s[a])return!1;return!0},wt=function(o){if(null!=o)return Array.isArray(o)||(o=[o,o]),[Nt(o[0]),Nt(null!=o[1]?o[1]:o[0])]},Lt=function(o){if(null==o)return;const[s,a]=wt(o);return It(s,a)},Dt=function(o,s){if(null==o||null==s)return;const[a,l]=wt(o),[c,h]=wt(s);return It(a,c)&&It(l,h)},Nt=function(o){return"number"==typeof o?o:kt(o)},It=function(o,s){return"number"==typeof o?o===s:Tt(o,s)};class Ot extends q{constructor(){super(...arguments),this.update=this.update.bind(this),this.selectionManagers=[]}start(){this.started||(this.started=!0,document.addEventListener("selectionchange",this.update,!0))}stop(){if(this.started)return this.started=!1,document.removeEventListener("selectionchange",this.update,!0)}registerSelectionManager(o){if(!this.selectionManagers.includes(o))return this.selectionManagers.push(o),this.start()}unregisterSelectionManager(o){if(this.selectionManagers=this.selectionManagers.filter((s=>s!==o)),0===this.selectionManagers.length)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map((o=>o.selectionDidChange()))}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}}const ce=new Ot,Pt=function(){const o=window.getSelection();if(o.rangeCount>0)return o},Mt=function(){var o;const s=null===(o=Pt())||void 0===o?void 0:o.getRangeAt(0);if(s&&!_t(s))return s},Bt=function(o){const s=window.getSelection();return s.removeAllRanges(),s.addRange(o),ce.update()},_t=o=>jt(o.startContainer)||jt(o.endContainer),jt=o=>!Object.getPrototypeOf(o),Wt=o=>o.replace(new RegExp("".concat(_),"g"),"").replace(new RegExp("".concat(j),"g")," "),ue=new RegExp("[^\\S".concat(j,"]")),Vt=o=>o.replace(new RegExp("".concat(ue.source),"g")," ").replace(/\ {2,}/g," "),zt=function(o,s){if(o.isEqualTo(s))return["",""];const a=qt(o,s),{length:l}=a.utf16String;let c;if(l){const{offset:h}=a,d=o.codepoints.slice(0,h).concat(o.codepoints.slice(h+l));c=qt(s,X.fromCodepoints(d))}else c=qt(s,o);return[a.utf16String.toString(),c.utf16String.toString()]},qt=function(o,s){let a=0,l=o.length,c=s.length;for(;a<l&&o.charAt(a).isEqualTo(s.charAt(a));)a++;for(;l>a+1&&o.charAt(l-1).isEqualTo(s.charAt(c-1));)l--,c--;return{utf16String:o.slice(a,l),offset:a}};class Ht extends rt{static fromCommonAttributesOfObjects(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!o.length)return new this;let s=Yt(o[0]),a=s.getKeys();return o.slice(1).forEach((o=>{a=s.getKeysCommonToHash(Yt(o)),s=s.slice(a)})),s}static box(o){return Yt(o)}constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(...arguments),this.values=Gt(o)}add(o,s){return this.merge(Jt(o,s))}remove(o){return new Ht(Gt(this.values,o))}get(o){return this.values[o]}has(o){return o in this.values}merge(o){return new Ht(Kt(this.values,$t(o)))}slice(o){const s={};return Array.from(o).forEach((o=>{this.has(o)&&(s[o]=this.values[o])})),new Ht(s)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(o){return o=Yt(o),this.getKeys().filter((s=>this.values[s]===o.values[s]))}isEqualTo(o){return ot(this.toArray(),Yt(o).toArray())}isEmpty(){return 0===this.getKeys().length}toArray(){if(!this.array){const o=[];for(const s in this.values){const a=this.values[s];o.push(o.push(s,a))}this.array=o.slice(0)}return this.array}toObject(){return Gt(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}}const Jt=function(o,s){const a={};return a[o]=s,a},Kt=function(o,s){const a=Gt(o);for(const o in s){const l=s[o];a[o]=l}return a},Gt=function(o,s){const a={};return Object.keys(o).sort().forEach((l=>{l!==s&&(a[l]=o[l])})),a},Yt=function(o){return o instanceof Ht?o:new Ht(o)},$t=function(o){return o instanceof Ht?o.values:o};class Xt{static groupObjects(){let o,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:a,asTree:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l&&null==a&&(a=0);const c=[];return Array.from(s).forEach((s=>{var h;if(o){var d,g,p;if(null!==(d=s.canBeGrouped)&&void 0!==d&&d.call(s,a)&&null!==(g=(p=o[o.length-1]).canBeGroupedWith)&&void 0!==g&&g.call(p,s,a))return void o.push(s);c.push(new this(o,{depth:a,asTree:l})),o=null}null!==(h=s.canBeGrouped)&&void 0!==h&&h.call(s,a)?o=[s]:c.push(s)})),o&&c.push(new this(o,{depth:a,asTree:l})),c}constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{depth:s,asTree:a}=arguments.length>1?arguments[1]:void 0;this.objects=o,a&&(this.depth=s,this.objects=this.constructor.groupObjects(this.objects,{asTree:a,depth:this.depth+1}))}getObjects(){return this.objects}getDepth(){return this.depth}getCacheKey(){const o=["objectGroup"];return Array.from(this.getObjects()).forEach((s=>{o.push(s.getCacheKey())})),o.join("/")}}class Zt extends q{constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.objects={},Array.from(o).forEach((o=>{const s=JSON.stringify(o);null==this.objects[s]&&(this.objects[s]=o)}))}find(o){const s=JSON.stringify(o);return this.objects[s]}}class Qt{constructor(o){this.reset(o)}add(o){const s=te(o);this.elements[s]=o}remove(o){const s=te(o),a=this.elements[s];if(a)return delete this.elements[s],a}reset(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.elements={},Array.from(o).forEach((o=>{this.add(o)})),o}}const te=o=>o.dataset.trixStoreKey;class ee extends q{isPerforming(){return!0===this.performing}hasPerformed(){return!0===this.performed}hasSucceeded(){return this.performed&&this.succeeded}hasFailed(){return this.performed&&!this.succeeded}getPromise(){return this.promise||(this.promise=new Promise(((o,s)=>(this.performing=!0,this.perform(((a,l)=>{this.succeeded=a,this.performing=!1,this.performed=!0,this.succeeded?o(l):s(l)})))))),this.promise}perform(o){return o(!1)}release(){var o,s;null===(o=this.promise)||void 0===o||null===(s=o.cancel)||void 0===s||s.call(o),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}}ee.proxyMethod("getPromise().then"),ee.proxyMethod("getPromise().catch");class ie extends q{constructor(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.object=o,this.options=s,this.childViews=[],this.rootView=this}getNodes(){return this.nodes||(this.nodes=this.createNodes()),this.nodes.map((o=>o.cloneNode(!0)))}invalidate(){var o;return this.nodes=null,this.childViews=[],null===(o=this.parentView)||void 0===o?void 0:o.invalidate()}invalidateViewForObject(o){var s;return null===(s=this.findViewForObject(o))||void 0===s?void 0:s.invalidate()}findOrCreateCachedChildView(o,s,a){let l=this.getCachedViewForObject(s);return l?this.recordChildView(l):(l=this.createChildView(...arguments),this.cacheViewForObject(l,s)),l}createChildView(o,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s instanceof Xt&&(a.viewClass=o,o=ne);const l=new o(s,a);return this.recordChildView(l)}recordChildView(o){return o.parentView=this,o.rootView=this.rootView,this.childViews.push(o),o}getAllChildViews(){let o=[];return this.childViews.forEach((s=>{o.push(s),o=o.concat(s.getAllChildViews())})),o}findElement(){return this.findElementForObject(this.object)}findElementForObject(o){const s=null==o?void 0:o.id;if(s)return this.rootView.element.querySelector("[data-trix-id='".concat(s,"']"))}findViewForObject(o){for(const s of this.getAllChildViews())if(s.object===o)return s}getViewCache(){return this.rootView!==this?this.rootView.getViewCache():this.isViewCachingEnabled()?(this.viewCache||(this.viewCache={}),this.viewCache):void 0}isViewCachingEnabled(){return!1!==this.shouldCacheViews}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(o){var s;return null===(s=this.getViewCache())||void 0===s?void 0:s[o.getCacheKey()]}cacheViewForObject(o,s){const a=this.getViewCache();a&&(a[s.getCacheKey()]=o)}garbageCollectCachedViews(){const o=this.getViewCache();if(o){const s=this.getAllChildViews().concat(this).map((o=>o.object.getCacheKey()));for(const a in o)s.includes(a)||delete o[a]}}}class ne extends ie{constructor(){super(...arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}getChildViews(){return this.childViews.length||Array.from(this.objectGroup.getObjects()).forEach((o=>{this.findOrCreateCachedChildView(this.viewClass,o,this.options)})),this.childViews}createNodes(){const o=this.createContainerElement();return this.getChildViews().forEach((s=>{Array.from(s.getNodes()).forEach((s=>{o.appendChild(s)}))})),[o]}createContainerElement(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(o)}}
4
+ /*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:he,setPrototypeOf:de,isFrozen:ge,getPrototypeOf:me,getOwnPropertyDescriptor:pe}=Object;let{freeze:fe,seal:be,create:ve}=Object,{apply:Ae,construct:ye}="undefined"!=typeof Reflect&&Reflect;fe||(fe=function(o){return o}),be||(be=function(o){return o}),Ae||(Ae=function(o,s,a){return o.apply(s,a)}),ye||(ye=function(o,s){return new o(...s)});const xe=Te(Array.prototype.forEach),Ce=Te(Array.prototype.pop),Ee=Te(Array.prototype.push),Se=Te(String.prototype.toLowerCase),ke=Te(String.prototype.toString),Re=Te(String.prototype.match),Ie=Te(String.prototype.replace),Oe=Te(String.prototype.indexOf),Pe=Te(String.prototype.trim),Fe=Te(Object.prototype.hasOwnProperty),Me=Te(RegExp.prototype.test),Be=(_e=TypeError,function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return ye(_e,s)});var _e;function Te(o){return function(s){for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return Ae(o,s,l)}}function we(o,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Se;de&&de(o,null);let l=s.length;for(;l--;){let c=s[l];if("string"==typeof c){const o=a(c);o!==c&&(ge(s)||(s[l]=o),c=o)}o[c]=!0}return o}function Le(o){for(let s=0;s<o.length;s++)Fe(o,s)||(o[s]=null);return o}function De(o){const s=ve(null);for(const[a,l]of he(o))Fe(o,a)&&(Array.isArray(l)?s[a]=Le(l):l&&"object"==typeof l&&l.constructor===Object?s[a]=De(l):s[a]=l);return s}function Ne(o,s){for(;null!==o;){const a=pe(o,s);if(a){if(a.get)return Te(a.get);if("function"==typeof a.value)return Te(a.value)}o=me(o)}return function(){return null}}const je=fe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),We=fe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ue=fe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),qe=fe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ve=fe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),He=fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ze=fe(["#text"]),Ke=fe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Je=fe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ge=fe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Xe=fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ye=be(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$e=be(/<%[\w\W]*|[\w\W]*%>/gm),Qe=be(/\$\{[\w\W]*}/gm),Ze=be(/^data-[\-\w.\u00B7-\uFFFF]+$/),ti=be(/^aria-[\-\w]+$/),ei=be(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ii=be(/^(?:\w+script|data):/i),ni=be(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ri=be(/^html$/i),si=be(/^[a-z][.\w]*(-[.\w]+)+$/i);var ai=Object.freeze({__proto__:null,ARIA_ATTR:ti,ATTR_WHITESPACE:ni,CUSTOM_ELEMENT:si,DATA_ATTR:Ze,DOCTYPE_NAME:ri,ERB_EXPR:$e,IS_ALLOWED_URI:ei,IS_SCRIPT_OR_DATA:ii,MUSTACHE_EXPR:Ye,TMPLIT_EXPR:Qe});const li=1,ci=3,di=7,yi=8,Xi=9,oi=function(){return"undefined"==typeof window?null:window};var bn=function t(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:oi();const i=o=>t(o);if(i.version="3.2.3",i.removed=[],!o||!o.document||o.document.nodeType!==Xi)return i.isSupported=!1,i;let{document:s}=o;const a=s,l=a.currentScript,{DocumentFragment:c,HTMLTemplateElement:h,Node:d,Element:g,NodeFilter:p,NamedNodeMap:f=o.NamedNodeMap||o.MozNamedAttrMap,HTMLFormElement:w,DOMParser:_,trustedTypes:j}=o,W=g.prototype,U=Ne(W,"cloneNode"),V=Ne(W,"remove"),z=Ne(W,"nextSibling"),K=Ne(W,"childNodes"),J=Ne(W,"parentNode");if("function"==typeof h){const o=s.createElement("template");o.content&&o.content.ownerDocument&&(s=o.content.ownerDocument)}let G,Y="";const{implementation:$,createNodeIterator:Q,createDocumentFragment:Z,getElementsByTagName:tt}=s,{importNode:et}=a;let it={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof he&&"function"==typeof J&&$&&void 0!==$.createHTMLDocument;const{MUSTACHE_EXPR:nt,ERB_EXPR:at,TMPLIT_EXPR:lt,DATA_ATTR:ct,ARIA_ATTR:ut,IS_SCRIPT_OR_DATA:ht,ATTR_WHITESPACE:dt,CUSTOM_ELEMENT:Ct}=ai;let{IS_ALLOWED_URI:St}=ai,re=null;const oe=we({},[...je,...We,...Ue,...Ve,...ze]);let se=null;const ae=we({},[...Ke,...Je,...Ge,...Xe]);let le=Object.seal(ve(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,ue=null,de=!0,ge=!0,me=!1,pe=!0,be=!1,Ae=!0,ye=!1,_e=!1,Ye=!1,$e=!1,Qe=!1,Ze=!1,ti=!0,ii=!1,ni=!0,si=!1,bn={},vn=null;const An=we({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let yn=null;const xn=we({},["audio","video","img","source","image","track"]);let Cn=null;const Ln=we({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),In="http://www.w3.org/1998/Math/MathML",Un="http://www.w3.org/2000/svg",qn="http://www.w3.org/1999/xhtml";let Vn=qn,Hn=!1,zn=null;const Xn=we({},[In,Un,qn],ke);let $n=we({},["mi","mo","mn","ms","mtext"]),Zn=we({},["annotation-xml"]);const rr=we({},["title","style","font","a","script"]);let ar=null;const lr=["application/xhtml+xml","text/html"];let cr=null,ur=null;const gr=s.createElement("form"),Lt=function(o){return o instanceof RegExp||o instanceof Function},Dt=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ur||ur!==o){if(o&&"object"==typeof o||(o={}),o=De(o),ar=-1===lr.indexOf(o.PARSER_MEDIA_TYPE)?"text/html":o.PARSER_MEDIA_TYPE,cr="application/xhtml+xml"===ar?ke:Se,re=Fe(o,"ALLOWED_TAGS")?we({},o.ALLOWED_TAGS,cr):oe,se=Fe(o,"ALLOWED_ATTR")?we({},o.ALLOWED_ATTR,cr):ae,zn=Fe(o,"ALLOWED_NAMESPACES")?we({},o.ALLOWED_NAMESPACES,ke):Xn,Cn=Fe(o,"ADD_URI_SAFE_ATTR")?we(De(Ln),o.ADD_URI_SAFE_ATTR,cr):Ln,yn=Fe(o,"ADD_DATA_URI_TAGS")?we(De(xn),o.ADD_DATA_URI_TAGS,cr):xn,vn=Fe(o,"FORBID_CONTENTS")?we({},o.FORBID_CONTENTS,cr):An,ce=Fe(o,"FORBID_TAGS")?we({},o.FORBID_TAGS,cr):{},ue=Fe(o,"FORBID_ATTR")?we({},o.FORBID_ATTR,cr):{},bn=!!Fe(o,"USE_PROFILES")&&o.USE_PROFILES,de=!1!==o.ALLOW_ARIA_ATTR,ge=!1!==o.ALLOW_DATA_ATTR,me=o.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=!1!==o.ALLOW_SELF_CLOSE_IN_ATTR,be=o.SAFE_FOR_TEMPLATES||!1,Ae=!1!==o.SAFE_FOR_XML,ye=o.WHOLE_DOCUMENT||!1,$e=o.RETURN_DOM||!1,Qe=o.RETURN_DOM_FRAGMENT||!1,Ze=o.RETURN_TRUSTED_TYPE||!1,Ye=o.FORCE_BODY||!1,ti=!1!==o.SANITIZE_DOM,ii=o.SANITIZE_NAMED_PROPS||!1,ni=!1!==o.KEEP_CONTENT,si=o.IN_PLACE||!1,St=o.ALLOWED_URI_REGEXP||ei,Vn=o.NAMESPACE||qn,$n=o.MATHML_TEXT_INTEGRATION_POINTS||$n,Zn=o.HTML_INTEGRATION_POINTS||Zn,le=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Lt(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Lt(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(le.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),be&&(ge=!1),Qe&&($e=!0),bn&&(re=we({},ze),se=[],!0===bn.html&&(we(re,je),we(se,Ke)),!0===bn.svg&&(we(re,We),we(se,Je),we(se,Xe)),!0===bn.svgFilters&&(we(re,Ue),we(se,Je),we(se,Xe)),!0===bn.mathMl&&(we(re,Ve),we(se,Ge),we(se,Xe))),o.ADD_TAGS&&(re===oe&&(re=De(re)),we(re,o.ADD_TAGS,cr)),o.ADD_ATTR&&(se===ae&&(se=De(se)),we(se,o.ADD_ATTR,cr)),o.ADD_URI_SAFE_ATTR&&we(Cn,o.ADD_URI_SAFE_ATTR,cr),o.FORBID_CONTENTS&&(vn===An&&(vn=De(vn)),we(vn,o.FORBID_CONTENTS,cr)),ni&&(re["#text"]=!0),ye&&we(re,["html","head","body"]),re.table&&(we(re,["tbody"]),delete ce.tbody),o.TRUSTED_TYPES_POLICY){if("function"!=typeof o.TRUSTED_TYPES_POLICY.createHTML)throw Be('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof o.TRUSTED_TYPES_POLICY.createScriptURL)throw Be('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');G=o.TRUSTED_TYPES_POLICY,Y=G.createHTML("")}else void 0===G&&(G=function(o,s){if("object"!=typeof o||"function"!=typeof o.createPolicy)return null;let a=null;const l="data-tt-policy-suffix";s&&s.hasAttribute(l)&&(a=s.getAttribute(l));const c="dompurify"+(a?"#"+a:"");try{return o.createPolicy(c,{createHTML:o=>o,createScriptURL:o=>o})}catch(o){return console.warn("TrustedTypes policy "+c+" could not be created."),null}}(j,l)),null!==G&&"string"==typeof Y&&(Y=G.createHTML(""));fe&&fe(o),ur=o}},wr=we({},[...We,...Ue,...qe]),kr=we({},[...Ve,...He]),Ot=function(o){Ee(i.removed,{element:o});try{J(o).removeChild(o)}catch(s){V(o)}},Ft=function(o,s){try{Ee(i.removed,{attribute:s.getAttributeNode(o),from:s})}catch(o){Ee(i.removed,{attribute:null,from:s})}if(s.removeAttribute(o),"is"===o)if($e||Qe)try{Ot(s)}catch(o){}else try{s.setAttribute(o,"")}catch(o){}},Pt=function(o){let a=null,l=null;if(Ye)o="<remove></remove>"+o;else{const s=Re(o,/^[\r\n\t ]+/);l=s&&s[0]}"application/xhtml+xml"===ar&&Vn===qn&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const c=G?G.createHTML(o):o;if(Vn===qn)try{a=(new _).parseFromString(c,ar)}catch(o){}if(!a||!a.documentElement){a=$.createDocument(Vn,"template",null);try{a.documentElement.innerHTML=Hn?Y:c}catch(o){}}const h=a.body||a.documentElement;return o&&l&&h.insertBefore(s.createTextNode(l),h.childNodes[0]||null),Vn===qn?tt.call(a,ye?"html":"body")[0]:ye?a.documentElement:h},Mt=function(o){return Q.call(o.ownerDocument||o,o,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Bt=function(o){return o instanceof w&&("string"!=typeof o.nodeName||"string"!=typeof o.textContent||"function"!=typeof o.removeChild||!(o.attributes instanceof f)||"function"!=typeof o.removeAttribute||"function"!=typeof o.setAttribute||"string"!=typeof o.namespaceURI||"function"!=typeof o.insertBefore||"function"!=typeof o.hasChildNodes)},_t=function(o){return"function"==typeof d&&o instanceof d};function jt(o,s,a){xe(o,(o=>{o.call(i,s,a,ur)}))}const Wt=function(o){let s=null;if(jt(it.beforeSanitizeElements,o,null),Bt(o))return Ot(o),!0;const a=cr(o.nodeName);if(jt(it.uponSanitizeElement,o,{tagName:a,allowedTags:re}),o.hasChildNodes()&&!_t(o.firstElementChild)&&Me(/<[/\w]/g,o.innerHTML)&&Me(/<[/\w]/g,o.textContent))return Ot(o),!0;if(o.nodeType===di)return Ot(o),!0;if(Ae&&o.nodeType===yi&&Me(/<[/\w]/g,o.data))return Ot(o),!0;if(!re[a]||ce[a]){if(!ce[a]&&Vt(a)){if(le.tagNameCheck instanceof RegExp&&Me(le.tagNameCheck,a))return!1;if(le.tagNameCheck instanceof Function&&le.tagNameCheck(a))return!1}if(ni&&!vn[a]){const s=J(o)||o.parentNode,a=K(o)||o.childNodes;if(a&&s)for(let l=a.length-1;l>=0;--l){const c=U(a[l],!0);c.__removalCount=(o.__removalCount||0)+1,s.insertBefore(c,z(o))}}return Ot(o),!0}return o instanceof g&&!function(o){let s=J(o);s&&s.tagName||(s={namespaceURI:Vn,tagName:"template"});const a=Se(o.tagName),l=Se(s.tagName);return!!zn[o.namespaceURI]&&(o.namespaceURI===Un?s.namespaceURI===qn?"svg"===a:s.namespaceURI===In?"svg"===a&&("annotation-xml"===l||$n[l]):Boolean(wr[a]):o.namespaceURI===In?s.namespaceURI===qn?"math"===a:s.namespaceURI===Un?"math"===a&&Zn[l]:Boolean(kr[a]):o.namespaceURI===qn?!(s.namespaceURI===Un&&!Zn[l])&&!(s.namespaceURI===In&&!$n[l])&&!kr[a]&&(rr[a]||!wr[a]):!("application/xhtml+xml"!==ar||!zn[o.namespaceURI]))}(o)?(Ot(o),!0):"noscript"!==a&&"noembed"!==a&&"noframes"!==a||!Me(/<\/no(script|embed|frames)/i,o.innerHTML)?(be&&o.nodeType===ci&&(s=o.textContent,xe([nt,at,lt],(o=>{s=Ie(s,o," ")})),o.textContent!==s&&(Ee(i.removed,{element:o.cloneNode()}),o.textContent=s)),jt(it.afterSanitizeElements,o,null),!1):(Ot(o),!0)},Ut=function(o,a,l){if(ti&&("id"===a||"name"===a)&&(l in s||l in gr))return!1;if(ge&&!ue[a]&&Me(ct,a));else if(de&&Me(ut,a));else if(!se[a]||ue[a]){if(!(Vt(o)&&(le.tagNameCheck instanceof RegExp&&Me(le.tagNameCheck,o)||le.tagNameCheck instanceof Function&&le.tagNameCheck(o))&&(le.attributeNameCheck instanceof RegExp&&Me(le.attributeNameCheck,a)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(a))||"is"===a&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&Me(le.tagNameCheck,l)||le.tagNameCheck instanceof Function&&le.tagNameCheck(l))))return!1}else if(Cn[a]);else if(Me(St,Ie(l,dt,"")));else if("src"!==a&&"xlink:href"!==a&&"href"!==a||"script"===o||0!==Oe(l,"data:")||!yn[o])if(me&&!Me(ht,Ie(l,dt,"")));else if(l)return!1;return!0},Vt=function(o){return"annotation-xml"!==o&&Re(o,Ct)},zt=function(o){jt(it.beforeSanitizeAttributes,o,null);const{attributes:s}=o;if(!s||Bt(o))return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let l=s.length;for(;l--;){const c=s[l],{name:h,namespaceURI:d,value:g}=c,p=cr(h);let f="value"===h?g:Pe(g);if(a.attrName=p,a.attrValue=f,a.keepAttr=!0,a.forceKeepAttr=void 0,jt(it.uponSanitizeAttribute,o,a),f=a.attrValue,!ii||"id"!==p&&"name"!==p||(Ft(h,o),f="user-content-"+f),Ae&&Me(/((--!?|])>)|<\/(style|title)/i,f)){Ft(h,o);continue}if(a.forceKeepAttr)continue;if(Ft(h,o),!a.keepAttr)continue;if(!pe&&Me(/\/>/i,f)){Ft(h,o);continue}be&&xe([nt,at,lt],(o=>{f=Ie(f,o," ")}));const w=cr(o.nodeName);if(Ut(w,p,f)){if(G&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(d);else switch(j.getAttributeType(w,p)){case"TrustedHTML":f=G.createHTML(f);break;case"TrustedScriptURL":f=G.createScriptURL(f)}try{d?o.setAttributeNS(d,h,f):o.setAttribute(h,f),Bt(o)?Ot(o):Ce(i.removed)}catch(o){}}}jt(it.afterSanitizeAttributes,o,null)},Rr=function t(o){let s=null;const a=Mt(o);for(jt(it.beforeSanitizeShadowDOM,o,null);s=a.nextNode();)jt(it.uponSanitizeShadowNode,s,null),Wt(s),zt(s),s.content instanceof c&&t(s.content);jt(it.afterSanitizeShadowDOM,o,null)};return i.sanitize=function(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=null,h=null,g=null,p=null;if(Hn=!o,Hn&&(o="\x3c!--\x3e"),"string"!=typeof o&&!_t(o)){if("function"!=typeof o.toString)throw Be("toString is not a function");if("string"!=typeof(o=o.toString()))throw Be("dirty is not a string, aborting")}if(!i.isSupported)return o;if(_e||Dt(s),i.removed=[],"string"==typeof o&&(si=!1),si){if(o.nodeName){const s=cr(o.nodeName);if(!re[s]||ce[s])throw Be("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof d)l=Pt("\x3c!----\x3e"),h=l.ownerDocument.importNode(o,!0),h.nodeType===li&&"BODY"===h.nodeName||"HTML"===h.nodeName?l=h:l.appendChild(h);else{if(!$e&&!be&&!ye&&-1===o.indexOf("<"))return G&&Ze?G.createHTML(o):o;if(l=Pt(o),!l)return $e?null:Ze?Y:""}l&&Ye&&Ot(l.firstChild);const f=Mt(si?o:l);for(;g=f.nextNode();)Wt(g),zt(g),g.content instanceof c&&Rr(g.content);if(si)return o;if($e){if(Qe)for(p=Z.call(l.ownerDocument);l.firstChild;)p.appendChild(l.firstChild);else p=l;return(se.shadowroot||se.shadowrootmode)&&(p=et.call(a,p,!0)),p}let w=ye?l.outerHTML:l.innerHTML;return ye&&re["!doctype"]&&l.ownerDocument&&l.ownerDocument.doctype&&l.ownerDocument.doctype.name&&Me(ri,l.ownerDocument.doctype.name)&&(w="<!DOCTYPE "+l.ownerDocument.doctype.name+">\n"+w),be&&xe([nt,at,lt],(o=>{w=Ie(w,o," ")})),G&&Ze?G.createHTML(w):w},i.setConfig=function(){Dt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),_e=!0},i.clearConfig=function(){ur=null,_e=!1},i.isValidAttribute=function(o,s,a){ur||Dt({});const l=cr(o),c=cr(s);return Ut(l,c,a)},i.addHook=function(o,s){"function"==typeof s&&Ee(it[o],s)},i.removeHook=function(o){return Ce(it[o])},i.removeHooks=function(o){it[o]=[]},i.removeAllHooks=function(){it={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();bn.addHook("uponSanitizeAttribute",(function(o,s){/^data-trix-/.test(s.attrName)&&(s.forceKeepAttr=!0)}));const vn="style href src width height language class".split(" "),An="javascript:".split(" "),yn="script iframe form noscript".split(" ");class ui extends q{static setHTML(o,s){const a=new this(s).sanitize(),l=a.getHTML?a.getHTML():a.outerHTML;o.innerHTML=l}static sanitize(o,s){const a=new this(o,s);return a.sanitize(),a}constructor(o){let{allowedAttributes:s,forbiddenProtocols:a,forbiddenElements:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.allowedAttributes=s||vn,this.forbiddenProtocols=a||An,this.forbiddenElements=l||yn,this.body=hi(o)}sanitize(){return this.sanitizeElements(),this.normalizeListElementNesting(),bn.setConfig(g),this.body=bn.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){const o=R(this.body),s=[];for(;o.nextNode();){const a=o.currentNode;switch(a.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(a)?s.push(a):this.sanitizeElement(a);break;case Node.COMMENT_NODE:s.push(a)}}return s.forEach((o=>S(o))),this.body}sanitizeElement(o){return o.hasAttribute("href")&&this.forbiddenProtocols.includes(o.protocol)&&o.removeAttribute("href"),Array.from(o.attributes).forEach((s=>{let{name:a}=s;this.allowedAttributes.includes(a)||0===a.indexOf("data-trix")||o.removeAttribute(a)})),o}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach((o=>{const s=o.previousElementSibling;s&&"li"===k(s)&&s.appendChild(o)})),this.body}elementIsRemovable(o){if((null==o?void 0:o.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(o)||this.elementIsntSerializable(o)}elementIsForbidden(o){return this.forbiddenElements.includes(k(o))}elementIsntSerializable(o){return"false"===o.getAttribute("data-trix-serialize")&&!P(o)}}const hi=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";o=o.replace(/<\/html[^>]*>[^]*$/i,"</html>");const s=document.implementation.createHTMLDocument("");return s.documentElement.innerHTML=o,Array.from(s.head.querySelectorAll("style")).forEach((o=>{s.body.appendChild(o)})),s.body},{css:xn}=$;class gi extends ie{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let o;const s=o=T({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),a=this.getHref();return a&&(o=T({tagName:"a",editable:!1,attributes:{href:a,tabindex:-1}}),s.appendChild(o)),this.attachment.hasContent()?ui.setHTML(o,this.attachment.getContent()):this.createContentNodes().forEach((s=>{o.appendChild(s)})),o.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=T({tagName:"progress",attributes:{class:xn.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),s.appendChild(this.progressElement)),[mi("left"),s,mi("right")]}createCaptionElement(){const o=T({tagName:"figcaption",className:xn.attachmentCaption}),s=this.attachmentPiece.getCaption();if(s)o.classList.add("".concat(xn.attachmentCaption,"--edited")),o.textContent=s;else{let s,a;const l=this.getCaptionConfig();if(l.name&&(s=this.attachment.getFilename()),l.size&&(a=this.attachment.getFormattedFilesize()),s){const a=T({tagName:"span",className:xn.attachmentName,textContent:s});o.appendChild(a)}if(a){s&&o.appendChild(document.createTextNode(" "));const l=T({tagName:"span",className:xn.attachmentSize,textContent:a});o.appendChild(l)}}return o}getClassName(){const o=[xn.attachment,"".concat(xn.attachment,"--").concat(this.attachment.getType())],s=this.attachment.getExtension();return s&&o.push("".concat(xn.attachment,"--").concat(s)),o.join(" ")}getData(){const o={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},{attributes:s}=this.attachmentPiece;return s.isEmpty()||(o.trixAttributes=JSON.stringify(s)),this.attachment.isPending()&&(o.trixSerialize=!1),o}getHref(){if(!pi(this.attachment.getContent(),"a"))return this.attachment.getHref()}getCaptionConfig(){var o;const s=this.attachment.getType(),l=kt(null===(o=a[s])||void 0===o?void 0:o.caption);return"file"===s&&(l.name=!0),l}findProgressElement(){var o;return null===(o=this.findElement())||void 0===o?void 0:o.querySelector("progress")}attachmentDidChangeUploadProgress(){const o=this.attachment.getUploadProgress(),s=this.findProgressElement();s&&(s.value=o)}}const mi=o=>T({tagName:"span",textContent:_,data:{trixCursorTarget:o,trixSerialize:!1}}),pi=function(o,s){const a=T("div");return ui.setHTML(a,o||""),a.querySelector(s)};class fi extends gi{constructor(){super(...arguments),this.attachment.previewDelegate=this}createContentNodes(){return this.image=T({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]}createCaptionElement(){const o=super.createCaptionElement(...arguments);return o.textContent||o.setAttribute("data-trix-placeholder",p.captionPlaceholder),o}refresh(o){var s;o||(o=null===(s=this.findElement())||void 0===s?void 0:s.querySelector("img"));if(o)return this.updateAttributesForImage(o)}updateAttributesForImage(o){const s=this.attachment.getURL(),a=this.attachment.getPreviewURL();if(o.src=a||s,a===s)o.removeAttribute("data-trix-serialized-attributes");else{const a=JSON.stringify({src:s});o.setAttribute("data-trix-serialized-attributes",a)}const l=this.attachment.getWidth(),c=this.attachment.getHeight();null!=l&&(o.width=l),null!=c&&(o.height=c);const h=["imageElement",this.attachment.id,o.src,o.width,o.height].join("/");o.dataset.trixStoreKey=h}attachmentDidChangeAttributes(){return this.refresh(this.image),this.refresh()}}class bi extends ie{constructor(){super(...arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),this.textConfig=this.options.textConfig,this.context=this.options.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}createNodes(){let o=this.attachment?this.createAttachmentNodes():this.createStringNodes();const s=this.createElement();if(s){const a=function(o){for(;null!==(s=o)&&void 0!==s&&s.firstElementChild;){var s;o=o.firstElementChild}return o}(s);Array.from(o).forEach((o=>{a.appendChild(o)})),o=[s]}return o}createAttachmentNodes(){const o=this.attachment.isPreviewable()?fi:gi;return this.createChildView(o,this.piece.attachment,{piece:this.piece}).getNodes()}createStringNodes(){var o;if(null!==(o=this.textConfig)&&void 0!==o&&o.plaintext)return[document.createTextNode(this.string)];{const o=[],s=this.string.split("\n");for(let a=0;a<s.length;a++){const l=s[a];if(a>0){const s=T("br");o.push(s)}if(l.length){const s=document.createTextNode(this.preserveSpaces(l));o.push(s)}}return o}}createElement(){let o,s,a;const l={};for(s in this.attributes){a=this.attributes[s];const h=ft(s);if(h){if(h.tagName){var c;const s=T(h.tagName);c?(c.appendChild(s),c=s):o=c=s}if(h.styleProperty&&(l[h.styleProperty]=a),h.style)for(s in h.style)a=h.style[s],l[s]=a}}if(Object.keys(l).length)for(s in o||(o=T("span")),l)a=l[s],o.style[s]=a;return o}createContainerElement(){for(const o in this.attributes){const s=this.attributes[o],a=ft(o);if(a&&a.groupTagName){const l={};return l[o]=s,T(a.groupTagName,l)}}}preserveSpaces(o){return this.context.isLast&&(o=o.replace(/\ $/,j)),o=o.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(j," $2")).replace(/\ {2}/g,"".concat(j," ")).replace(/\ {2}/g," ".concat(j)),(this.context.isFirst||this.context.followsWhitespace)&&(o=o.replace(/^\ /,j)),o}}class vi extends ie{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const o=[],s=Xt.groupObjects(this.getPieces()),a=s.length-1;for(let c=0;c<s.length;c++){const h=s[c],d={};0===c&&(d.isFirst=!0),c===a&&(d.isLast=!0),Ai(l)&&(d.followsWhitespace=!0);const g=this.findOrCreateCachedChildView(bi,h,{textConfig:this.textConfig,context:d});o.push(...Array.from(g.getNodes()||[]));var l=h}return o}getPieces(){return Array.from(this.text.getPieces()).filter((o=>!o.hasAttribute("blockBreak")))}}const Ai=o=>/\s$/.test(null==o?void 0:o.toString()),{css:Cn}=$;class xi extends ie{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){const o=[document.createComment("block")];if(this.block.isEmpty())o.push(T("br"));else{var s;const a=null===(s=mt(this.block.getLastAttribute()))||void 0===s?void 0:s.text,l=this.findOrCreateCachedChildView(vi,this.block.text,{textConfig:a});o.push(...Array.from(l.getNodes()||[])),this.shouldAddExtraNewlineElement()&&o.push(T("br"))}if(this.attributes.length)return o;{let s;const{tagName:a}=l.default;this.block.isRTL()&&(s={dir:"rtl"});const c=T({tagName:a,attributes:s});return o.forEach((o=>c.appendChild(o))),[c]}}createContainerElement(o){const s={};let a;const l=this.attributes[o],{tagName:c,htmlAttributes:h=[]}=mt(l);if(0===o&&this.block.isRTL()&&Object.assign(s,{dir:"rtl"}),"attachmentGallery"===l){const o=this.block.getBlockBreakPosition();a="".concat(Cn.attachmentGallery," ").concat(Cn.attachmentGallery,"--").concat(o)}return Object.entries(this.block.htmlAttributes).forEach((o=>{let[a,l]=o;h.includes(a)&&(s[a]=l)})),T({tagName:c,className:a,attributes:s})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class Ci extends ie{static render(o){const s=T("div"),a=new this(o,{element:s});return a.render(),a.sync(),s}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new Qt,this.setDocument(this.object)}setDocument(o){o.isEqualTo(this.document)||(this.document=this.object=o)}render(){if(this.childViews=[],this.shadowElement=T("div"),!this.document.isEmpty()){const o=Xt.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(o).forEach((o=>{const s=this.findOrCreateCachedChildView(xi,o);Array.from(s.getNodes()).map((o=>this.shadowElement.appendChild(o)))}))}}isSynced(){return Si(this.shadowElement,this.element)}sync(){const o=this.createDocumentFragmentForSync();for(;this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(o),this.didSync()}didSync(){return this.elementStore.reset(Ei(this.element)),Rt((()=>this.garbageCollectCachedViews()))}createDocumentFragmentForSync(){const o=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach((s=>{o.appendChild(s.cloneNode(!0))})),Array.from(Ei(o)).forEach((o=>{const s=this.elementStore.remove(o);s&&o.parentNode.replaceChild(s,o)})),o}}const Ei=o=>o.querySelectorAll("[data-trix-store-key]"),Si=(o,s)=>Ri(o.innerHTML)===Ri(s.innerHTML),Ri=o=>o.replace(/&nbsp;/g," ");function ki(o){var s,a;function n(s,a){try{var l=o[s](a),c=l.value,h=c instanceof Ti;Promise.resolve(h?c.v:c).then((function(a){if(h){var d="return"===s?"return":"next";if(!c.k||a.done)return n(d,a);a=o[d](a).value}r(l.done?"return":"normal",a)}),(function(o){n("throw",o)}))}catch(o){r("throw",o)}}function r(o,l){switch(o){case"return":s.resolve({value:l,done:!0});break;case"throw":s.reject(l);break;default:s.resolve({value:l,done:!1})}(s=s.next)?n(s.key,s.arg):a=null}this._invoke=function(o,l){return new Promise((function(c,h){var d={key:o,arg:l,resolve:c,reject:h,next:null};a?a=a.next=d:(s=a=d,n(o,l))}))},"function"!=typeof o.return&&(this.return=void 0)}function Ti(o,s){this.v=o,this.k=s}function wi(o,s,a){return(s=Li(s))in o?Object.defineProperty(o,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[s]=a,o}function Li(o){var s=function(o,s){if("object"!=typeof o||null===o)return o;var a=o[Symbol.toPrimitive];if(void 0!==a){var l=a.call(o,s||"default");if("object"!=typeof l)return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===s?String:Number)(o)}(o,"string");return"symbol"==typeof s?s:String(s)}ki.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ki.prototype.next=function(o){return this._invoke("next",o)},ki.prototype.throw=function(o){return this._invoke("throw",o)},ki.prototype.return=function(o){return this._invoke("return",o)};function Di(o,s){return Oi(o,Ii(o,s,"get"))}function Ni(o,s,a){return Fi(o,Ii(o,s,"set"),a),a}function Ii(o,s,a){if(!s.has(o))throw new TypeError("attempted to "+a+" private field on non-instance");return s.get(o)}function Oi(o,s){return s.get?s.get.call(o):s.value}function Fi(o,s,a){if(s.set)s.set.call(o,a);else{if(!s.writable)throw new TypeError("attempted to set read only private field");s.value=a}}function Pi(o,s,a){if(!s.has(o))throw new TypeError("attempted to get private field on non-instance");return a}function Mi(o,s){if(s.has(o))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Bi(o,s,a){Mi(o,s),s.set(o,a)}class _i extends rt{static registerType(o,s){s.type=o,this.types[o]=s}static fromJSON(o){const s=this.types[o.type];if(s)return s.fromJSON(o)}constructor(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.attributes=Ht.box(s)}copyWithAttributes(o){return new this.constructor(this.getValue(),o)}copyWithAdditionalAttributes(o){return this.copyWithAttributes(this.attributes.merge(o))}copyWithoutAttribute(o){return this.copyWithAttributes(this.attributes.remove(o))}copy(){return this.copyWithAttributes(this.attributes)}getAttribute(o){return this.attributes.get(o)}getAttributesHash(){return this.attributes}getAttributes(){return this.attributes.toObject()}hasAttribute(o){return this.attributes.has(o)}hasSameStringValueAsPiece(o){return o&&this.toString()===o.toString()}hasSameAttributesAsPiece(o){return o&&(this.attributes===o.attributes||this.attributes.isEqualTo(o.attributes))}isBlockBreak(){return!1}isEqualTo(o){return super.isEqualTo(...arguments)||this.hasSameConstructorAs(o)&&this.hasSameStringValueAsPiece(o)&&this.hasSameAttributesAsPiece(o)}isEmpty(){return 0===this.length}isSerializable(){return!0}toJSON(){return{type:this.constructor.type,attributes:this.getAttributes()}}contentsForInspection(){return{type:this.constructor.type,attributes:this.attributes.inspect()}}canBeGrouped(){return this.hasAttribute("href")}canBeGroupedWith(o){return this.getAttribute("href")===o.getAttribute("href")}getLength(){return this.length}canBeConsolidatedWith(o){return!1}}wi(_i,"types",{});class ji extends ee{constructor(o){super(...arguments),this.url=o}perform(o){const s=new Image;s.onload=()=>(s.width=this.width=s.naturalWidth,s.height=this.height=s.naturalHeight,o(!0,s)),s.onerror=()=>o(!1),s.src=this.url}}class Wi extends rt{static attachmentForFile(o){const s=new this(this.attributesForFile(o));return s.setFile(o),s}static attributesForFile(o){return new Ht({filename:o.name,filesize:o.size,contentType:o.type})}static fromJSON(o){return new this(o)}constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(o),this.releaseFile=this.releaseFile.bind(this),this.attributes=Ht.box(o),this.didChangeAttributes()}getAttribute(o){return this.attributes.get(o)}hasAttribute(o){return this.attributes.has(o)}getAttributes(){return this.attributes.toObject()}setAttributes(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.attributes.merge(o);var a,l,c,h;if(!this.attributes.isEqualTo(s))return this.attributes=s,this.didChangeAttributes(),null===(a=this.previewDelegate)||void 0===a||null===(l=a.attachmentDidChangeAttributes)||void 0===l||l.call(a,this),null===(c=this.delegate)||void 0===c||null===(h=c.attachmentDidChangeAttributes)||void 0===h?void 0:h.call(c,this)}didChangeAttributes(){if(this.isPreviewable())return this.preloadURL()}isPending(){return null!=this.file&&!(this.getURL()||this.getHref())}isPreviewable(){return this.attributes.has("previewable")?this.attributes.get("previewable"):Wi.previewablePattern.test(this.getContentType())}getType(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"}getURL(){return this.attributes.get("url")}getHref(){return this.attributes.get("href")}getFilename(){return this.attributes.get("filename")||""}getFilesize(){return this.attributes.get("filesize")}getFormattedFilesize(){const o=this.attributes.get("filesize");return"number"==typeof o?w.formatter(o):""}getExtension(){var o;return null===(o=this.getFilename().match(/\.(\w+)$/))||void 0===o?void 0:o[1].toLowerCase()}getContentType(){return this.attributes.get("contentType")}hasContent(){return this.attributes.has("content")}getContent(){return this.attributes.get("content")}getWidth(){return this.attributes.get("width")}getHeight(){return this.attributes.get("height")}getFile(){return this.file}setFile(o){if(this.file=o,this.isPreviewable())return this.preloadFile()}releaseFile(){this.releasePreloadedFile(),this.file=null}getUploadProgress(){return null!=this.uploadProgress?this.uploadProgress:0}setUploadProgress(o){var s,a;if(this.uploadProgress!==o)return this.uploadProgress=o,null===(s=this.uploadProgressDelegate)||void 0===s||null===(a=s.attachmentDidChangeUploadProgress)||void 0===a?void 0:a.call(s,this)}toJSON(){return this.getAttributes()}getCacheKey(){return[super.getCacheKey(...arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")}getPreviewURL(){return this.previewURL||this.preloadingURL}setPreviewURL(o){var s,a,l,c;if(o!==this.getPreviewURL())return this.previewURL=o,null===(s=this.previewDelegate)||void 0===s||null===(a=s.attachmentDidChangeAttributes)||void 0===a||a.call(s,this),null===(l=this.delegate)||void 0===l||null===(c=l.attachmentDidChangePreviewURL)||void 0===c?void 0:c.call(l,this)}preloadURL(){return this.preload(this.getURL(),this.releaseFile)}preloadFile(){if(this.file)return this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)}releasePreloadedFile(){this.fileObjectURL&&(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null)}preload(o,s){if(o&&o!==this.getPreviewURL()){this.preloadingURL=o;return new ji(o).then((a=>{let{width:l,height:c}=a;return this.getWidth()&&this.getHeight()||this.setAttributes({width:l,height:c}),this.preloadingURL=null,this.setPreviewURL(o),null==s?void 0:s()})).catch((()=>(this.preloadingURL=null,null==s?void 0:s())))}}}wi(Wi,"previewablePattern",/^image(\/(gif|png|webp|jpe?g)|$)/);class Ui extends _i{static fromJSON(o){return new this(Wi.fromJSON(o.attachment),o.attributes)}constructor(o){super(...arguments),this.attachment=o,this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}ensureAttachmentExclusivelyHasAttribute(o){this.hasAttribute(o)&&(this.attachment.hasAttribute(o)||this.attachment.setAttributes(this.attributes.slice([o])),this.attributes=this.attributes.remove(o))}removeProhibitedAttributes(){const o=this.attributes.slice(Ui.permittedAttributes);o.isEqualTo(this.attributes)||(this.attributes=o)}getValue(){return this.attachment}isSerializable(){return!this.attachment.isPending()}getCaption(){return this.attributes.get("caption")||""}isEqualTo(o){var s;return super.isEqualTo(o)&&this.attachment.id===(null==o||null===(s=o.attachment)||void 0===s?void 0:s.id)}toString(){return""}toJSON(){const o=super.toJSON(...arguments);return o.attachment=this.attachment,o}getCacheKey(){return[super.getCacheKey(...arguments),this.attachment.getCacheKey()].join("/")}toConsole(){return JSON.stringify(this.toString())}}wi(Ui,"permittedAttributes",["caption","presentation"]),_i.registerType("attachment",Ui);class Vi extends _i{static fromJSON(o){return new this(o.string,o.attributes)}constructor(o){super(...arguments),this.string=(o=>o.replace(/\r\n?/g,"\n"))(o),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return"\n"===this.toString()&&!0===this.getAttribute("blockBreak")}toJSON(){const o=super.toJSON(...arguments);return o.string=this.string,o}canBeConsolidatedWith(o){return o&&this.hasSameConstructorAs(o)&&this.hasSameAttributesAsPiece(o)}consolidateWith(o){return new this.constructor(this.toString()+o.toString(),this.attributes)}splitAtOffset(o){let s,a;return 0===o?(s=null,a=this):o===this.length?(s=this,a=null):(s=new this.constructor(this.string.slice(0,o),this.attributes),a=new this.constructor(this.string.slice(o),this.attributes)),[s,a]}toConsole(){let{string:o}=this;return o.length>15&&(o=o.slice(0,14)+"…"),JSON.stringify(o.toString())}}_i.registerType("string",Vi);class zi extends rt{static box(o){return o instanceof this?o:new this(o)}constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.objects=o.slice(0),this.length=this.objects.length}indexOf(o){return this.objects.indexOf(o)}splice(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return new this.constructor(st(this.objects,...s))}eachObject(o){return this.objects.map(((s,a)=>o(s,a)))}insertObjectAtIndex(o,s){return this.splice(s,0,o)}insertSplittableListAtIndex(o,s){return this.splice(s,0,...o.objects)}insertSplittableListAtPosition(o,s){const[a,l]=this.splitObjectAtPosition(s);return new this.constructor(a).insertSplittableListAtIndex(o,l)}editObjectAtIndex(o,s){return this.replaceObjectAtIndex(s(this.objects[o]),o)}replaceObjectAtIndex(o,s){return this.splice(s,1,o)}removeObjectAtIndex(o){return this.splice(o,1)}getObjectAtIndex(o){return this.objects[o]}getSplittableListInRange(o){const[s,a,l]=this.splitObjectsAtRange(o);return new this.constructor(s.slice(a,l+1))}selectSplittableList(o){const s=this.objects.filter((s=>o(s)));return new this.constructor(s)}removeObjectsInRange(o){const[s,a,l]=this.splitObjectsAtRange(o);return new this.constructor(s).splice(a,l-a+1)}transformObjectsInRange(o,s){const[a,l,c]=this.splitObjectsAtRange(o),h=a.map(((o,a)=>l<=a&&a<=c?s(o):o));return new this.constructor(h)}splitObjectsAtRange(o){let s,[a,l,c]=this.splitObjectAtPosition(Hi(o));return[a,s]=new this.constructor(a).splitObjectAtPosition(Ji(o)+c),[a,l,s-1]}getObjectAtPosition(o){const{index:s}=this.findIndexAndOffsetAtPosition(o);return this.objects[s]}splitObjectAtPosition(o){let s,a;const{index:l,offset:c}=this.findIndexAndOffsetAtPosition(o),h=this.objects.slice(0);if(null!=l)if(0===c)s=l,a=0;else{const o=this.getObjectAtIndex(l),[d,g]=o.splitAtOffset(c);h.splice(l,1,d,g),s=l+1,a=d.getLength()-c}else s=h.length,a=0;return[h,s,a]}consolidate(){const o=[];let s=this.objects[0];return this.objects.slice(1).forEach((a=>{var l,c;null!==(l=(c=s).canBeConsolidatedWith)&&void 0!==l&&l.call(c,a)?s=s.consolidateWith(a):(o.push(s),s=a)})),s&&o.push(s),new this.constructor(o)}consolidateFromIndexToIndex(o,s){const a=this.objects.slice(0).slice(o,s+1),l=new this.constructor(a).consolidate().toArray();return this.splice(o,a.length,...l)}findIndexAndOffsetAtPosition(o){let s,a=0;for(s=0;s<this.objects.length;s++){const l=a+this.objects[s].getLength();if(a<=o&&o<l)return{index:s,offset:o-a};a=l}return{index:null,offset:null}}findPositionAtIndexAndOffset(o,s){let a=0;for(let l=0;l<this.objects.length;l++){const c=this.objects[l];if(l<o)a+=c.getLength();else if(l===o){a+=s;break}}return a}getEndPosition(){return null==this.endPosition&&(this.endPosition=0,this.objects.forEach((o=>this.endPosition+=o.getLength()))),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(o){return super.isEqualTo(...arguments)||qi(this.objects,null==o?void 0:o.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map((o=>o.inspect())).join(", "),"]")}}}const qi=function(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(o.length!==s.length)return!1;let a=!0;for(let l=0;l<o.length;l++){const c=o[l];a&&!c.isEqualTo(s[l])&&(a=!1)}return a},Hi=o=>o[0],Ji=o=>o[1];class Ki extends rt{static textForAttachmentWithAttributes(o,s){return new this([new Ui(o,s)])}static textForStringWithAttributes(o,s){return new this([new Vi(o,s)])}static fromJSON(o){return new this(Array.from(o).map((o=>_i.fromJSON(o))))}constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments);const s=o.filter((o=>!o.isEmpty()));this.pieceList=new zi(s)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(o){return new this.constructor(o.consolidate().toArray())}copyUsingObjectMap(o){const s=this.getPieces().map((s=>o.find(s)||s));return new this.constructor(s)}appendText(o){return this.insertTextAtPosition(o,this.getLength())}insertTextAtPosition(o,s){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(o.pieceList,s))}removeTextAtRange(o){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(o))}replaceTextAtRange(o,s){return this.removeTextAtRange(s).insertTextAtPosition(o,s[0])}moveTextFromRangeToPosition(o,s){if(o[0]<=s&&s<=o[1])return;const a=this.getTextAtRange(o),l=a.getLength();return o[0]<s&&(s-=l),this.removeTextAtRange(o).insertTextAtPosition(a,s)}addAttributeAtRange(o,s,a){const l={};return l[o]=s,this.addAttributesAtRange(l,a)}addAttributesAtRange(o,s){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(s,(s=>s.copyWithAdditionalAttributes(o))))}removeAttributeAtRange(o,s){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(s,(s=>s.copyWithoutAttribute(o))))}setAttributesAtRange(o,s){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(s,(s=>s.copyWithAttributes(o))))}getAttributesAtPosition(o){var s;return(null===(s=this.pieceList.getObjectAtPosition(o))||void 0===s?void 0:s.getAttributes())||{}}getCommonAttributes(){const o=Array.from(this.pieceList.toArray()).map((o=>o.getAttributes()));return Ht.fromCommonAttributesOfObjects(o).toObject()}getCommonAttributesAtRange(o){return this.getTextAtRange(o).getCommonAttributes()||{}}getExpandedRangeForAttributeAtOffset(o,s){let a,l=a=s;const c=this.getLength();for(;l>0&&this.getCommonAttributesAtRange([l-1,a])[o];)l--;for(;a<c&&this.getCommonAttributesAtRange([s,a+1])[o];)a++;return[l,a]}getTextAtRange(o){return this.copyWithPieceList(this.pieceList.getSplittableListInRange(o))}getStringAtRange(o){return this.pieceList.getSplittableListInRange(o).toString()}getStringAtPosition(o){return this.getStringAtRange([o,o+1])}startsWithString(o){return this.getStringAtRange([0,o.length])===o}endsWithString(o){const s=this.getLength();return this.getStringAtRange([s-o.length,s])===o}getAttachmentPieces(){return this.pieceList.toArray().filter((o=>!!o.attachment))}getAttachments(){return this.getAttachmentPieces().map((o=>o.attachment))}getAttachmentAndPositionById(o){let s=0;for(const l of this.pieceList.toArray()){var a;if((null===(a=l.attachment)||void 0===a?void 0:a.id)===o)return{attachment:l.attachment,position:s};s+=l.length}return{attachment:null,position:null}}getAttachmentById(o){const{attachment:s}=this.getAttachmentAndPositionById(o);return s}getRangeOfAttachment(o){const s=this.getAttachmentAndPositionById(o.id),a=s.position;if(o=s.attachment)return[a,a+1]}updateAttributesForAttachment(o,s){const a=this.getRangeOfAttachment(s);return a?this.addAttributesAtRange(o,a):this}getLength(){return this.pieceList.getEndPosition()}isEmpty(){return 0===this.getLength()}isEqualTo(o){var s;return super.isEqualTo(o)||(null==o||null===(s=o.pieceList)||void 0===s?void 0:s.isEqualTo(this.pieceList))}isBlockBreak(){return 1===this.getLength()&&this.pieceList.getObjectAtIndex(0).isBlockBreak()}eachPiece(o){return this.pieceList.eachObject(o)}getPieces(){return this.pieceList.toArray()}getPieceAtPosition(o){return this.pieceList.getObjectAtPosition(o)}contentsForInspection(){return{pieceList:this.pieceList.inspect()}}toSerializableText(){const o=this.pieceList.selectSplittableList((o=>o.isSerializable()));return this.copyWithPieceList(o)}toString(){return this.pieceList.toString()}toJSON(){return this.pieceList.toJSON()}toConsole(){return JSON.stringify(this.pieceList.toArray().map((o=>JSON.parse(o.toConsole()))))}getDirection(){return Ct(this.toString())}isRTL(){return"rtl"===this.getDirection()}}class Gi extends rt{static fromJSON(o){return new this(Ki.fromJSON(o.text),o.attributes,o.htmlAttributes)}constructor(o,s,a){super(...arguments),this.text=Yi(o||new Ki),this.attributes=s||[],this.htmlAttributes=a||{}}isEmpty(){return this.text.isBlockBreak()}isEqualTo(o){return!!super.isEqualTo(o)||this.text.isEqualTo(null==o?void 0:o.text)&&ot(this.attributes,null==o?void 0:o.attributes)&&Tt(this.htmlAttributes,null==o?void 0:o.htmlAttributes)}copyWithText(o){return new Gi(o,this.attributes,this.htmlAttributes)}copyWithoutText(){return this.copyWithText(null)}copyWithAttributes(o){return new Gi(this.text,o,this.htmlAttributes)}copyWithoutAttributes(){return this.copyWithAttributes(null)}copyUsingObjectMap(o){const s=o.find(this.text);return s?this.copyWithText(s):this.copyWithText(this.text.copyUsingObjectMap(o))}addAttribute(o){const s=this.attributes.concat(en(o));return this.copyWithAttributes(s)}addHTMLAttribute(o,s){const a=Object.assign({},this.htmlAttributes,{[o]:s});return new Gi(this.text,this.attributes,a)}removeAttribute(o){const{listAttribute:s}=mt(o),a=rn(rn(this.attributes,o),s);return this.copyWithAttributes(a)}removeLastAttribute(){return this.removeAttribute(this.getLastAttribute())}getLastAttribute(){return nn(this.attributes)}getAttributes(){return this.attributes.slice(0)}getAttributeLevel(){return this.attributes.length}getAttributeAtLevel(o){return this.attributes[o-1]}hasAttribute(o){return this.attributes.includes(o)}hasAttributes(){return this.getAttributeLevel()>0}getLastNestableAttribute(){return nn(this.getNestableAttributes())}getNestableAttributes(){return this.attributes.filter((o=>mt(o).nestable))}getNestingLevel(){return this.getNestableAttributes().length}decreaseNestingLevel(){const o=this.getLastNestableAttribute();return o?this.removeAttribute(o):this}increaseNestingLevel(){const o=this.getLastNestableAttribute();if(o){const s=this.attributes.lastIndexOf(o),a=st(this.attributes,s+1,0,...en(o));return this.copyWithAttributes(a)}return this}getListItemAttributes(){return this.attributes.filter((o=>mt(o).listAttribute))}isListItem(){var o;return null===(o=mt(this.getLastAttribute()))||void 0===o?void 0:o.listAttribute}isTerminalBlock(){var o;return null===(o=mt(this.getLastAttribute()))||void 0===o?void 0:o.terminal}breaksOnReturn(){var o;return null===(o=mt(this.getLastAttribute()))||void 0===o?void 0:o.breakOnReturn}findLineBreakInDirectionFromPosition(o,s){const a=this.toString();let l;switch(o){case"forward":l=a.indexOf("\n",s);break;case"backward":l=a.slice(0,s).lastIndexOf("\n")}if(-1!==l)return l}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(o){return!this.hasAttributes()&&!o.hasAttributes()&&this.getDirection()===o.getDirection()}consolidateWith(o){const s=Ki.textForStringWithAttributes("\n"),a=this.getTextWithoutBlockBreak().appendText(s);return this.copyWithText(a.appendText(o.text))}splitAtOffset(o){let s,a;return 0===o?(s=null,a=this):o===this.getLength()?(s=this,a=null):(s=this.copyWithText(this.text.getTextAtRange([0,o])),a=this.copyWithText(this.text.getTextAtRange([o,this.getLength()]))),[s,a]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return Qi(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(o){return this.attributes[o]}canBeGroupedWith(o,s){const a=o.getAttributes(),c=a[s],h=this.attributes[s];return h===c&&!(!1===mt(h).group&&!(()=>{if(!se){se=[];for(const o in l){const{listAttribute:s}=l[o];null!=s&&se.push(s)}}return se})().includes(a[s+1]))&&(this.getDirection()===o.getDirection()||o.isEmpty())}}const Yi=function(o){return o=$i(o),Zi(o)},$i=function(o){let s=!1;const a=o.getPieces();let l=a.slice(0,a.length-1);const c=a[a.length-1];return c?(l=l.map((o=>o.isBlockBreak()?(s=!0,tn(o)):o)),s?new Ki([...l,c]):o):o},Ln=Ki.textForStringWithAttributes("\n",{blockBreak:!0}),Zi=function(o){return Qi(o)?o:o.appendText(Ln)},Qi=function(o){const s=o.getLength();return 0!==s&&o.getTextAtRange([s-1,s]).isBlockBreak()},tn=o=>o.copyWithoutAttribute("blockBreak"),en=function(o){const{listAttribute:s}=mt(o);return s?[s,o]:[o]},nn=o=>o.slice(-1)[0],rn=function(o,s){const a=o.lastIndexOf(s);return-1===a?o:st(o,a,1)};class on extends rt{static fromJSON(o){return new this(Array.from(o).map((o=>Gi.fromJSON(o))))}static fromString(o,s){const a=Ki.textForStringWithAttributes(o,s);return new this([new Gi(a)])}constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),0===o.length&&(o=[new Gi]),this.blockList=zi.box(o)}isEmpty(){const o=this.getBlockAtIndex(0);return 1===this.blockList.length&&o.isEmpty()&&!o.hasAttributes()}copy(){const o=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(o)}copyUsingObjectsFromDocument(o){const s=new Zt(o.getObjects());return this.copyUsingObjectMap(s)}copyUsingObjectMap(o){const s=this.getBlocks().map((s=>o.find(s)||s.copyUsingObjectMap(o)));return new this.constructor(s)}copyWithBaseBlockAttributes(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const s=this.getBlocks().map((s=>{const a=o.concat(s.getAttributes());return s.copyWithAttributes(a)}));return new this.constructor(s)}replaceBlock(o,s){const a=this.blockList.indexOf(o);return-1===a?this:new this.constructor(this.blockList.replaceObjectAtIndex(s,a))}insertDocumentAtRange(o,s){const{blockList:a}=o;s=wt(s);let[l]=s;const{index:c,offset:h}=this.locationFromPosition(l);let d=this;const g=this.getBlockAtPosition(l);return Lt(s)&&g.isEmpty()&&!g.hasAttributes()?d=new this.constructor(d.blockList.removeObjectAtIndex(c)):g.getBlockBreakPosition()===h&&l++,d=d.removeTextAtRange(s),new this.constructor(d.blockList.insertSplittableListAtPosition(a,l))}mergeDocumentAtRange(o,s){let a,l;s=wt(s);const[c]=s,h=this.locationFromPosition(c),d=this.getBlockAtIndex(h.index).getAttributes(),g=o.getBaseBlockAttributes(),p=d.slice(-g.length);if(ot(g,p)){const s=d.slice(0,-g.length);a=o.copyWithBaseBlockAttributes(s)}else a=o.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(d);const f=a.getBlockCount(),w=a.getBlockAtIndex(0);if(ot(d,w.getAttributes())){const o=w.getTextWithoutBlockBreak();if(l=this.insertTextAtRange(o,s),f>1){a=new this.constructor(a.getBlocks().slice(1));const s=c+o.getLength();l=l.insertDocumentAtRange(a,s)}}else l=this.insertDocumentAtRange(a,s);return l}insertTextAtRange(o,s){s=wt(s);const[a]=s,{index:l,offset:c}=this.locationFromPosition(a),h=this.removeTextAtRange(s);return new this.constructor(h.blockList.editObjectAtIndex(l,(s=>s.copyWithText(s.text.insertTextAtPosition(o,c)))))}removeTextAtRange(o){let s;o=wt(o);const[a,l]=o;if(Lt(o))return this;const[c,h]=Array.from(this.locationRangeFromRange(o)),d=c.index,g=c.offset,p=this.getBlockAtIndex(d),f=h.index,w=h.offset,_=this.getBlockAtIndex(f);if(l-a==1&&p.getBlockBreakPosition()===g&&_.getBlockBreakPosition()!==w&&"\n"===_.text.getStringAtPosition(w))s=this.blockList.editObjectAtIndex(f,(o=>o.copyWithText(o.text.removeTextAtRange([w,w+1]))));else{let o;const a=p.text.getTextAtRange([0,g]),l=_.text.getTextAtRange([w,_.getLength()]),c=a.appendText(l);o=d!==f&&0===g&&p.getAttributeLevel()>=_.getAttributeLevel()?_.copyWithText(c):p.copyWithText(c);const h=f+1-d;s=this.blockList.splice(d,h,o)}return new this.constructor(s)}moveTextFromRangeToPosition(o,s){let a;o=wt(o);const[l,c]=o;if(l<=s&&s<=c)return this;let h=this.getDocumentAtRange(o),d=this.removeTextAtRange(o);const g=l<s;g&&(s-=h.getLength());const[p,...f]=h.getBlocks();return 0===f.length?(a=p.getTextWithoutBlockBreak(),g&&(s+=1)):a=p.text,d=d.insertTextAtRange(a,s),0===f.length?d:(h=new this.constructor(f),s+=a.getLength(),d.insertDocumentAtRange(h,s))}addAttributeAtRange(o,s,a){let{blockList:l}=this;return this.eachBlockAtRange(a,((a,c,h)=>l=l.editObjectAtIndex(h,(function(){return mt(o)?a.addAttribute(o,s):c[0]===c[1]?a:a.copyWithText(a.text.addAttributeAtRange(o,s,c))})))),new this.constructor(l)}addAttribute(o,s){let{blockList:a}=this;return this.eachBlock(((l,c)=>a=a.editObjectAtIndex(c,(()=>l.addAttribute(o,s))))),new this.constructor(a)}removeAttributeAtRange(o,s){let{blockList:a}=this;return this.eachBlockAtRange(s,(function(s,l,c){mt(o)?a=a.editObjectAtIndex(c,(()=>s.removeAttribute(o))):l[0]!==l[1]&&(a=a.editObjectAtIndex(c,(()=>s.copyWithText(s.text.removeAttributeAtRange(o,l)))))})),new this.constructor(a)}updateAttributesForAttachment(o,s){const a=this.getRangeOfAttachment(s),[l]=Array.from(a),{index:c}=this.locationFromPosition(l),h=this.getTextAtIndex(c);return new this.constructor(this.blockList.editObjectAtIndex(c,(a=>a.copyWithText(h.updateAttributesForAttachment(o,s)))))}removeAttributeForAttachment(o,s){const a=this.getRangeOfAttachment(s);return this.removeAttributeAtRange(o,a)}setHTMLAttributeAtPosition(o,s,a){const l=this.getBlockAtPosition(o),c=l.addHTMLAttribute(s,a);return this.replaceBlock(l,c)}insertBlockBreakAtRange(o){let s;o=wt(o);const[a]=o,{offset:l}=this.locationFromPosition(a),c=this.removeTextAtRange(o);return 0===l&&(s=[new Gi]),new this.constructor(c.blockList.insertSplittableListAtPosition(new zi(s),a))}applyBlockAttributeAtRange(o,s,a){const l=this.expandRangeToLineBreaksAndSplitBlocks(a);let c=l.document;a=l.range;const h=mt(o);if(h.listAttribute){c=c.removeLastListAttributeAtRange(a,{exceptAttributeName:o});const s=c.convertLineBreaksToBlockBreaksInRange(a);c=s.document,a=s.range}else c=h.exclusive?c.removeBlockAttributesAtRange(a):h.terminal?c.removeLastTerminalAttributeAtRange(a):c.consolidateBlocksAtRange(a);return c.addAttributeAtRange(o,s,a)}removeLastListAttributeAtRange(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{blockList:a}=this;return this.eachBlockAtRange(o,(function(o,l,c){const h=o.getLastAttribute();h&&mt(h).listAttribute&&h!==s.exceptAttributeName&&(a=a.editObjectAtIndex(c,(()=>o.removeAttribute(h))))})),new this.constructor(a)}removeLastTerminalAttributeAtRange(o){let{blockList:s}=this;return this.eachBlockAtRange(o,(function(o,a,l){const c=o.getLastAttribute();c&&mt(c).terminal&&(s=s.editObjectAtIndex(l,(()=>o.removeAttribute(c))))})),new this.constructor(s)}removeBlockAttributesAtRange(o){let{blockList:s}=this;return this.eachBlockAtRange(o,(function(o,a,l){o.hasAttributes()&&(s=s.editObjectAtIndex(l,(()=>o.copyWithoutAttributes())))})),new this.constructor(s)}expandRangeToLineBreaksAndSplitBlocks(o){let s;o=wt(o);let[a,l]=o;const c=this.locationFromPosition(a),h=this.locationFromPosition(l);let d=this;const g=d.getBlockAtIndex(c.index);if(c.offset=g.findLineBreakInDirectionFromPosition("backward",c.offset),null!=c.offset&&(s=d.positionFromLocation(c),d=d.insertBlockBreakAtRange([s,s+1]),h.index+=1,h.offset-=d.getBlockAtIndex(c.index).getLength(),c.index+=1),c.offset=0,0===h.offset&&h.index>c.index)h.index-=1,h.offset=d.getBlockAtIndex(h.index).getBlockBreakPosition();else{const o=d.getBlockAtIndex(h.index);"\n"===o.text.getStringAtRange([h.offset-1,h.offset])?h.offset-=1:h.offset=o.findLineBreakInDirectionFromPosition("forward",h.offset),h.offset!==o.getBlockBreakPosition()&&(s=d.positionFromLocation(h),d=d.insertBlockBreakAtRange([s,s+1]))}return a=d.positionFromLocation(c),l=d.positionFromLocation(h),{document:d,range:o=wt([a,l])}}convertLineBreaksToBlockBreaksInRange(o){o=wt(o);let[s]=o;const a=this.getStringAtRange(o).slice(0,-1);let l=this;return a.replace(/.*?\n/g,(function(o){s+=o.length,l=l.insertBlockBreakAtRange([s-1,s])})),{document:l,range:o}}consolidateBlocksAtRange(o){o=wt(o);const[s,a]=o,l=this.locationFromPosition(s).index,c=this.locationFromPosition(a).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(l,c))}getDocumentAtRange(o){o=wt(o);const s=this.blockList.getSplittableListInRange(o).toArray();return new this.constructor(s)}getStringAtRange(o){let s;const a=o=wt(o);return a[a.length-1]!==this.getLength()&&(s=-1),this.getDocumentAtRange(o).toString().slice(0,s)}getBlockAtIndex(o){return this.blockList.getObjectAtIndex(o)}getBlockAtPosition(o){const{index:s}=this.locationFromPosition(o);return this.getBlockAtIndex(s)}getTextAtIndex(o){var s;return null===(s=this.getBlockAtIndex(o))||void 0===s?void 0:s.text}getTextAtPosition(o){const{index:s}=this.locationFromPosition(o);return this.getTextAtIndex(s)}getPieceAtPosition(o){const{index:s,offset:a}=this.locationFromPosition(o);return this.getTextAtIndex(s).getPieceAtPosition(a)}getCharacterAtPosition(o){const{index:s,offset:a}=this.locationFromPosition(o);return this.getTextAtIndex(s).getStringAtRange([a,a+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(o){return this.blockList.eachObject(o)}eachBlockAtRange(o,s){let a,l;o=wt(o);const[c,h]=o,d=this.locationFromPosition(c),g=this.locationFromPosition(h);if(d.index===g.index)return a=this.getBlockAtIndex(d.index),l=[d.offset,g.offset],s(a,l,d.index);for(let o=d.index;o<=g.index;o++)if(a=this.getBlockAtIndex(o),a){switch(o){case d.index:l=[d.offset,a.text.getLength()];break;case g.index:l=[0,g.offset];break;default:l=[0,a.text.getLength()]}s(a,l,o)}}getCommonAttributesAtRange(o){o=wt(o);const[s]=o;if(Lt(o))return this.getCommonAttributesAtPosition(s);{const s=[],a=[];return this.eachBlockAtRange(o,(function(o,l){if(l[0]!==l[1])return s.push(o.text.getCommonAttributesAtRange(l)),a.push(sn(o))})),Ht.fromCommonAttributesOfObjects(s).merge(Ht.fromCommonAttributesOfObjects(a)).toObject()}}getCommonAttributesAtPosition(o){let s,a;const{index:l,offset:c}=this.locationFromPosition(o),h=this.getBlockAtIndex(l);if(!h)return{};const d=sn(h),g=h.text.getAttributesAtPosition(c),p=h.text.getAttributesAtPosition(c-1),f=Object.keys(J).filter((o=>J[o].inheritable));for(s in p)a=p[s],(a===g[s]||f.includes(s))&&(d[s]=a);return d}getRangeOfCommonAttributeAtPosition(o,s){const{index:a,offset:l}=this.locationFromPosition(s),c=this.getTextAtIndex(a),[h,d]=Array.from(c.getExpandedRangeForAttributeAtOffset(o,l)),g=this.positionFromLocation({index:a,offset:h}),p=this.positionFromLocation({index:a,offset:d});return wt([g,p])}getBaseBlockAttributes(){let o=this.getBlockAtIndex(0).getAttributes();for(let s=1;s<this.getBlockCount();s++){const a=this.getBlockAtIndex(s).getAttributes(),l=Math.min(o.length,a.length);o=(()=>{const s=[];for(let c=0;c<l&&a[c]===o[c];c++)s.push(a[c]);return s})()}return o}getAttachmentById(o){for(const s of this.getAttachments())if(s.id===o)return s}getAttachmentPieces(){let o=[];return this.blockList.eachObject((s=>{let{text:a}=s;return o=o.concat(a.getAttachmentPieces())})),o}getAttachments(){return this.getAttachmentPieces().map((o=>o.attachment))}getRangeOfAttachment(o){let s=0;const a=this.blockList.toArray();for(let l=0;l<a.length;l++){const{text:c}=a[l],h=c.getRangeOfAttachment(o);if(h)return wt([s+h[0],s+h[1]]);s+=c.getLength()}}getLocationRangeOfAttachment(o){const s=this.getRangeOfAttachment(o);return this.locationRangeFromRange(s)}getAttachmentPieceForAttachment(o){for(const s of this.getAttachmentPieces())if(s.attachment===o)return s}findRangesForBlockAttribute(o){let s=0;const a=[];return this.getBlocks().forEach((l=>{const c=l.getLength();l.hasAttribute(o)&&a.push([s,s+c]),s+=c})),a}findRangesForTextAttribute(o){let{withValue:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=0,l=[];const c=[];return this.getPieces().forEach((h=>{const d=h.getLength();(function(a){return s?a.getAttribute(o)===s:a.hasAttribute(o)})(h)&&(l[1]===a?l[1]=a+d:c.push(l=[a,a+d])),a+=d})),c}locationFromPosition(o){const s=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,o));if(null!=s.index)return s;{const o=this.getBlocks();return{index:o.length-1,offset:o[o.length-1].getLength()}}}positionFromLocation(o){return this.blockList.findPositionAtIndexAndOffset(o.index,o.offset)}locationRangeFromPosition(o){return wt(this.locationFromPosition(o))}locationRangeFromRange(o){if(!(o=wt(o)))return;const[s,a]=Array.from(o),l=this.locationFromPosition(s),c=this.locationFromPosition(a);return wt([l,c])}rangeFromLocationRange(o){let s;o=wt(o);const a=this.positionFromLocation(o[0]);return Lt(o)||(s=this.positionFromLocation(o[1])),wt([a,s])}isEqualTo(o){return this.blockList.isEqualTo(null==o?void 0:o.blockList)}getTexts(){return this.getBlocks().map((o=>o.text))}getPieces(){const o=[];return Array.from(this.getTexts()).forEach((s=>{o.push(...Array.from(s.getPieces()||[]))})),o}getObjects(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())}toSerializableDocument(){const o=[];return this.blockList.eachObject((s=>o.push(s.copyWithText(s.text.toSerializableText())))),new this.constructor(o)}toString(){return this.blockList.toString()}toJSON(){return this.blockList.toJSON()}toConsole(){return JSON.stringify(this.blockList.toArray().map((o=>JSON.parse(o.text.toConsole()))))}}const sn=function(o){const s={},a=o.getLastAttribute();return a&&(s[a]=!0),s},an=function(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{string:o=Wt(o),attributes:s,type:"string"}},ln=(o,s)=>{try{return JSON.parse(o.getAttribute("data-trix-".concat(s)))}catch(o){return{}}};class cn extends q{static parse(o,s){const a=new this(o,s);return a.parse(),a}constructor(o){let{referenceElement:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(...arguments),this.html=o,this.referenceElement=s,this.blocks=[],this.blockElements=[],this.processedElements=[]}getDocument(){return on.fromJSON(this.blocks)}parse(){try{this.createHiddenContainer(),ui.setHTML(this.containerElement,this.html);const o=R(this.containerElement,{usingFilter:gn});for(;o.nextNode();)this.processNode(o.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}}createHiddenContainer(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=T({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))}removeHiddenContainer(){return S(this.containerElement)}processNode(o){switch(o.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(o))return this.appendBlockForTextNode(o),this.processTextNode(o);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(o),this.processElement(o)}}appendBlockForTextNode(o){const s=o.parentNode;if(s===this.currentBlockElement&&this.isBlockElement(o.previousSibling))return this.appendStringWithAttributes("\n");if(s===this.containerElement||this.isBlockElement(s)){var a;const o=this.getBlockAttributes(s),l=this.getBlockHTMLAttributes(s);ot(o,null===(a=this.currentBlock)||void 0===a?void 0:a.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(o,s,l),this.currentBlockElement=s)}}appendBlockForElement(o){const s=this.isBlockElement(o),a=C(this.currentBlockElement,o);if(s&&!this.isBlockElement(o.firstChild)){if(!this.isInsignificantTextNode(o.firstChild)||!this.isBlockElement(o.firstElementChild)){const s=this.getBlockAttributes(o),l=this.getBlockHTMLAttributes(o);if(o.firstChild){if(a&&ot(s,this.currentBlock.attributes))return this.appendStringWithAttributes("\n");this.currentBlock=this.appendBlockForAttributesWithElement(s,o,l),this.currentBlockElement=o}}}else if(this.currentBlockElement&&!a&&!s){const s=this.findParentBlockElement(o);if(s)return this.appendBlockForElement(s);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(o){let{parentElement:s}=o;for(;s&&s!==this.containerElement;){if(this.isBlockElement(s)&&this.blockElements.includes(s))return s;s=s.parentElement}return null}processTextNode(o){let s=o.data;var a;un(o.parentNode)||(s=Vt(s),fn(null===(a=o.previousSibling)||void 0===a?void 0:a.textContent)&&(s=mn(s)));return this.appendStringWithAttributes(s,this.getTextAttributes(o.parentNode))}processElement(o){let s;if(P(o)){if(s=ln(o,"attachment"),Object.keys(s).length){const a=this.getTextAttributes(o);this.appendAttachmentWithAttributes(s,a),o.innerHTML=""}return this.processedElements.push(o)}switch(k(o)){case"br":return this.isExtraBR(o)||this.isBlockElement(o.nextSibling)||this.appendStringWithAttributes("\n",this.getTextAttributes(o)),this.processedElements.push(o);case"img":s={url:o.getAttribute("src"),contentType:"image"};const a=(o=>{const s=o.getAttribute("width"),a=o.getAttribute("height"),l={};return s&&(l.width=parseInt(s,10)),a&&(l.height=parseInt(a,10)),l})(o);for(const o in a){const l=a[o];s[o]=l}return this.appendAttachmentWithAttributes(s,this.getTextAttributes(o)),this.processedElements.push(o);case"tr":if(this.needsTableSeparator(o))return this.appendStringWithAttributes(K.tableRowSeparator);break;case"td":if(this.needsTableSeparator(o))return this.appendStringWithAttributes(K.tableCellSeparator)}}appendBlockForAttributesWithElement(o,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.blockElements.push(s);const l=function(){return{text:[],attributes:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},htmlAttributes:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}}}(o,a);return this.blocks.push(l),l}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(o,s){return this.appendPiece(an(o,s))}appendAttachmentWithAttributes(o,s){return this.appendPiece(function(o){return{attachment:o,attributes:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},type:"attachment"}}(o,s))}appendPiece(o){return 0===this.blocks.length&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(o)}appendStringToTextAtIndex(o,s){const{text:a}=this.blocks[s],l=a[a.length-1];if("string"!==(null==l?void 0:l.type))return a.push(an(o));l.string+=o}prependStringToTextAtIndex(o,s){const{text:a}=this.blocks[s],l=a[0];if("string"!==(null==l?void 0:l.type))return a.unshift(an(o));l.string=o+l.string}getTextAttributes(o){let s;const a={};for(const l in J){const c=J[l];if(c.tagName&&y(o,{matchingSelector:c.tagName,untilNode:this.containerElement}))a[l]=!0;else if(c.parser){if(s=c.parser(o),s){let h=!1;for(const a of this.findBlockElementAncestors(o))if(c.parser(a)===s){h=!0;break}h||(a[l]=s)}}else c.styleProperty&&(s=o.style[c.styleProperty],s&&(a[l]=s))}if(P(o)){const l=ln(o,"attributes");for(const o in l)s=l[o],a[o]=s}return a}getBlockAttributes(o){const s=[];for(;o&&o!==this.containerElement;){for(const c in l){const h=l[c];var a;!1!==h.parse&&k(o)===h.tagName&&(null!==(a=h.test)&&void 0!==a&&a.call(h,o)||!h.test)&&(s.push(c),h.listAttribute&&s.push(h.listAttribute))}o=o.parentNode}return s.reverse()}getBlockHTMLAttributes(o){const s={},a=Object.values(l).find((s=>s.tagName===k(o)));return((null==a?void 0:a.htmlAttributes)||[]).forEach((a=>{o.hasAttribute(a)&&(s[a]=o.getAttribute(a))})),s}findBlockElementAncestors(o){const s=[];for(;o&&o!==this.containerElement;){const a=k(o);L().includes(a)&&s.push(o),o=o.parentNode}return s}isBlockElement(o){if((null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&!P(o)&&!y(o,{matchingSelector:"td",untilNode:this.containerElement}))return L().includes(k(o))||"block"===window.getComputedStyle(o).display}isInsignificantTextNode(o){if((null==o?void 0:o.nodeType)!==Node.TEXT_NODE)return;if(!pn(o.data))return;const{parentNode:s,previousSibling:a,nextSibling:l}=o;return hn(s.previousSibling)&&!this.isBlockElement(s.previousSibling)||un(s)?void 0:!a||this.isBlockElement(a)||!l||this.isBlockElement(l)}isExtraBR(o){return"br"===k(o)&&this.isBlockElement(o.parentNode)&&o.parentNode.lastChild===o}needsTableSeparator(o){if(K.removeBlankTableCells){var s;const a=null===(s=o.previousSibling)||void 0===s?void 0:s.textContent;return a&&/\S/.test(a)}return o.previousSibling}translateBlockElementMarginsToNewlines(){const o=this.getMarginOfDefaultBlockElement();for(let s=0;s<this.blocks.length;s++){const a=this.getMarginOfBlockElementAtIndex(s);a&&(a.top>2*o.top&&this.prependStringToTextAtIndex("\n",s),a.bottom>2*o.bottom&&this.appendStringToTextAtIndex("\n",s))}}getMarginOfBlockElementAtIndex(o){const s=this.blockElements[o];if(s&&s.textContent&&!L().includes(k(s))&&!this.processedElements.includes(s))return dn(s)}getMarginOfDefaultBlockElement(){const o=T(l.default.tagName);return this.containerElement.appendChild(o),dn(o)}}const un=function(o){const{whiteSpace:s}=window.getComputedStyle(o);return["pre","pre-wrap","pre-line"].includes(s)},hn=o=>o&&!fn(o.textContent),dn=function(o){const s=window.getComputedStyle(o);if("block"===s.display)return{top:parseInt(s.marginTop),bottom:parseInt(s.marginBottom)}},gn=function(o){return"style"===k(o)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},mn=o=>o.replace(new RegExp("^".concat(ue.source,"+")),""),pn=o=>new RegExp("^".concat(ue.source,"*$")).test(o),fn=o=>/\s$/.test(o),In=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],Un="data-trix-serialized-attributes",qn="[".concat(Un,"]"),Vn=new RegExp("\x3c!--block--\x3e","g"),Hn={"application/json":function(o){let s;if(o instanceof on)s=o;else{if(!(o instanceof HTMLElement))throw new Error("unserializable object");s=cn.parse(o.innerHTML).getDocument()}return s.toSerializableDocument().toJSONString()},"text/html":function(o){let s;if(o instanceof on)s=Ci.render(o);else{if(!(o instanceof HTMLElement))throw new Error("unserializable object");s=o.cloneNode(!0)}return Array.from(s.querySelectorAll("[data-trix-serialize=false]")).forEach((o=>{S(o)})),In.forEach((o=>{Array.from(s.querySelectorAll("[".concat(o,"]"))).forEach((s=>{s.removeAttribute(o)}))})),Array.from(s.querySelectorAll(qn)).forEach((o=>{try{const s=JSON.parse(o.getAttribute(Un));o.removeAttribute(Un);for(const a in s){const l=s[a];o.setAttribute(a,l)}}catch(o){}})),s.innerHTML.replace(Vn,"")}};var zn=Object.freeze({__proto__:null});class En extends q{constructor(o,s){super(...arguments),this.attachmentManager=o,this.attachment=s,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}En.proxyMethod("attachment.getAttribute"),En.proxyMethod("attachment.hasAttribute"),En.proxyMethod("attachment.setAttribute"),En.proxyMethod("attachment.getAttributes"),En.proxyMethod("attachment.setAttributes"),En.proxyMethod("attachment.isPending"),En.proxyMethod("attachment.isPreviewable"),En.proxyMethod("attachment.getURL"),En.proxyMethod("attachment.getHref"),En.proxyMethod("attachment.getFilename"),En.proxyMethod("attachment.getFilesize"),En.proxyMethod("attachment.getFormattedFilesize"),En.proxyMethod("attachment.getExtension"),En.proxyMethod("attachment.getContentType"),En.proxyMethod("attachment.getFile"),En.proxyMethod("attachment.setFile"),En.proxyMethod("attachment.releaseFile"),En.proxyMethod("attachment.getUploadProgress"),En.proxyMethod("attachment.setUploadProgress");class Sn extends q{constructor(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(o).forEach((o=>{this.manageAttachment(o)}))}getAttachments(){const o=[];for(const s in this.managedAttachments){const a=this.managedAttachments[s];o.push(a)}return o}manageAttachment(o){return this.managedAttachments[o.id]||(this.managedAttachments[o.id]=new En(this,o)),this.managedAttachments[o.id]}attachmentIsManaged(o){return o.id in this.managedAttachments}requestRemovalOfAttachment(o){var s,a;if(this.attachmentIsManaged(o))return null===(s=this.delegate)||void 0===s||null===(a=s.attachmentManagerDidRequestRemovalOfAttachment)||void 0===a?void 0:a.call(s,o)}unmanageAttachment(o){const s=this.managedAttachments[o.id];return delete this.managedAttachments[o.id],s}}class Rn{constructor(o){this.composition=o,this.document=this.composition.document;const s=this.composition.getSelectedRange();this.startPosition=s[0],this.endPosition=s[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?0!==this.startLocation.offset:this.breaksOnReturn&&"\n"!==this.nextCharacter}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&"\n"===this.nextCharacter||"\n"===this.previousCharacter)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&0===this.startLocation.offset&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class kn extends q{constructor(){super(...arguments),this.document=new on,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(o){var s,a;if(!o.isEqualTo(this.document))return this.document=o,this.refreshAttachments(),this.revision++,null===(s=this.delegate)||void 0===s||null===(a=s.compositionDidChangeDocument)||void 0===a?void 0:a.call(s,o)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(o){var s,a,l,c;let{document:h,selectedRange:d}=o;return null===(s=this.delegate)||void 0===s||null===(a=s.compositionWillLoadSnapshot)||void 0===a||a.call(s),this.setDocument(null!=h?h:new on),this.setSelection(null!=d?d:[0,0]),null===(l=this.delegate)||void 0===l||null===(c=l.compositionDidLoadSnapshot)||void 0===c?void 0:c.call(l)}insertText(o){let{updatePosition:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{updatePosition:!0};const a=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(o,a));const l=a[0],c=l+o.getLength();return s&&this.setSelection(c),this.notifyDelegateOfInsertionAtRange([l,c])}insertBlock(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Gi;const s=new on([o]);return this.insertDocument(s)}insertDocument(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new on;const s=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(o,s));const a=s[0],l=a+o.getLength();return this.setSelection(l),this.notifyDelegateOfInsertionAtRange([a,l])}insertString(o,s){const a=this.getCurrentTextAttributes(),l=Ki.textForStringWithAttributes(o,a);return this.insertText(l,s)}insertBlockBreak(){const o=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(o));const s=o[0],a=s+1;return this.setSelection(a),this.notifyDelegateOfInsertionAtRange([s,a])}insertLineBreak(){const o=new Rn(this);if(o.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(o.startPosition);if(o.shouldPrependListItem()){const s=new on([o.block.copyWithoutText()]);return this.insertDocument(s)}return o.shouldInsertBlockBreak()?this.insertBlockBreak():o.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():o.shouldBreakFormattedBlock()?this.breakFormattedBlock(o):this.insertString("\n")}insertHTML(o){const s=cn.parse(o).getDocument(),a=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(s,a));const l=a[0],c=l+s.getLength()-1;return this.setSelection(c),this.notifyDelegateOfInsertionAtRange([l,c])}replaceHTML(o){const s=cn.parse(o).getDocument().copyUsingObjectsFromDocument(this.document),a=this.getLocationRange({strict:!1}),l=this.document.rangeFromLocationRange(a);return this.setDocument(s),this.setSelection(l)}insertFile(o){return this.insertFiles([o])}insertFiles(o){const s=[];return Array.from(o).forEach((o=>{var a;if(null!==(a=this.delegate)&&void 0!==a&&a.compositionShouldAcceptFile(o)){const a=Wi.attachmentForFile(o);s.push(a)}})),this.insertAttachments(s)}insertAttachment(o){return this.insertAttachments([o])}insertAttachments(o){let s=new Ki;return Array.from(o).forEach((o=>{var l;const c=o.getType(),h=null===(l=a[c])||void 0===l?void 0:l.presentation,d=this.getCurrentTextAttributes();h&&(d.presentation=h);const g=Ki.textForAttachmentWithAttributes(o,d);s=s.appendText(g)})),this.insertText(s)}shouldManageDeletingInDirection(o){const s=this.getLocationRange();if(Lt(s)){if("backward"===o&&0===s[0].offset)return!0;if(this.shouldManageMovingCursorInDirection(o))return!0}else if(s[0].index!==s[1].index)return!0;return!1}deleteInDirection(o){let s,a,l,{length:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const h=this.getLocationRange();let d=this.getSelectedRange();const g=Lt(d);if(g?a="backward"===o&&0===h[0].offset:l=h[0].index!==h[1].index,a&&this.canDecreaseBlockAttributeLevel()){const o=this.getBlock();if(o.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(d[0]),o.isEmpty())return!1}return g&&(d=this.getExpandedRangeInDirection(o,{length:c}),"backward"===o&&(s=this.getAttachmentAtRange(d))),s?(this.editAttachment(s),!1):(this.setDocument(this.document.removeTextAtRange(d)),this.setSelection(d[0]),!a&&!l&&void 0)}moveTextFromRange(o){const[s]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(o,s)),this.setSelection(s)}removeAttachment(o){const s=this.document.getRangeOfAttachment(o);if(s)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(s)),this.setSelection(s[0])}removeLastBlockAttribute(){const[o,s]=Array.from(this.getSelectedRange()),a=this.document.getBlockAtPosition(s);return this.removeCurrentAttribute(a.getLastAttribute()),this.setSelection(o)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(null!=this.placeholderPosition)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(o){const s=this.currentAttributes[o];return null!=s&&!1!==s}toggleCurrentAttribute(o){const s=!this.currentAttributes[o];return s?this.setCurrentAttribute(o,s):this.removeCurrentAttribute(o)}canSetCurrentAttribute(o){return mt(o)?this.canSetCurrentBlockAttribute(o):this.canSetCurrentTextAttribute(o)}canSetCurrentTextAttribute(o){const s=this.getSelectedDocument();if(s){for(const o of Array.from(s.getAttachments()))if(!o.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(o){const s=this.getBlock();if(s)return!s.isTerminalBlock()}setCurrentAttribute(o,s){return mt(o)?this.setBlockAttribute(o,s):(this.setTextAttribute(o,s),this.currentAttributes[o]=s,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(o,s,a){var l;const c=this.document.getBlockAtPosition(o),h=null===(l=mt(c.getLastAttribute()))||void 0===l?void 0:l.htmlAttributes;if(c&&null!=h&&h.includes(s)){const l=this.document.setHTMLAttributeAtPosition(o,s,a);this.setDocument(l)}}setTextAttribute(o,s){const a=this.getSelectedRange();if(!a)return;const[l,c]=Array.from(a);if(l!==c)return this.setDocument(this.document.addAttributeAtRange(o,s,a));if("href"===o){const o=Ki.textForStringWithAttributes(s,{href:s});return this.insertText(o)}}setBlockAttribute(o,s){const a=this.getSelectedRange();if(this.canSetCurrentAttribute(o))return this.setDocument(this.document.applyBlockAttributeAtRange(o,s,a)),this.setSelection(a)}removeCurrentAttribute(o){return mt(o)?(this.removeBlockAttribute(o),this.updateCurrentAttributes()):(this.removeTextAttribute(o),delete this.currentAttributes[o],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(o){const s=this.getSelectedRange();if(s)return this.setDocument(this.document.removeAttributeAtRange(o,s))}removeBlockAttribute(o){const s=this.getSelectedRange();if(s)return this.setDocument(this.document.removeAttributeAtRange(o,s))}canDecreaseNestingLevel(){var o;return(null===(o=this.getBlock())||void 0===o?void 0:o.getNestingLevel())>0}canIncreaseNestingLevel(){var o;const s=this.getBlock();if(s){if(null===(o=mt(s.getLastNestableAttribute()))||void 0===o||!o.listAttribute)return s.getNestingLevel()>0;{const o=this.getPreviousBlock();if(o)return function(){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return ot((arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).slice(0,o.length),o)}(o.getListItemAttributes(),s.getListItemAttributes())}}}decreaseNestingLevel(){const o=this.getBlock();if(o)return this.setDocument(this.document.replaceBlock(o,o.decreaseNestingLevel()))}increaseNestingLevel(){const o=this.getBlock();if(o)return this.setDocument(this.document.replaceBlock(o,o.increaseNestingLevel()))}canDecreaseBlockAttributeLevel(){var o;return(null===(o=this.getBlock())||void 0===o?void 0:o.getAttributeLevel())>0}decreaseBlockAttributeLevel(){var o;const s=null===(o=this.getBlock())||void 0===o?void 0:o.getLastAttribute();if(s)return this.removeCurrentAttribute(s)}decreaseListLevel(){let[o]=Array.from(this.getSelectedRange());const{index:s}=this.document.locationFromPosition(o);let a=s;const l=this.getBlock().getAttributeLevel();let c=this.document.getBlockAtIndex(a+1);for(;c&&c.isListItem()&&!(c.getAttributeLevel()<=l);)a++,c=this.document.getBlockAtIndex(a+1);o=this.document.positionFromLocation({index:s,offset:0});const h=this.document.positionFromLocation({index:a,offset:0});return this.setDocument(this.document.removeLastListAttributeAtRange([o,h]))}updateCurrentAttributes(){const o=this.getSelectedRange({ignoreLock:!0});if(o){const s=this.document.getCommonAttributesAtRange(o);if(Array.from(gt()).forEach((o=>{s[o]||this.canSetCurrentAttribute(o)||(s[o]=!1)})),!Tt(s,this.currentAttributes))return this.currentAttributes=s,this.notifyDelegateOfCurrentAttributesChange()}}getCurrentAttributes(){return m.call({},this.currentAttributes)}getCurrentTextAttributes(){const o={};for(const s in this.currentAttributes){const a=this.currentAttributes[s];!1!==a&&ft(s)&&(o[s]=a)}return o}freezeSelection(){return this.setCurrentAttribute("frozen",!0)}thawSelection(){return this.removeCurrentAttribute("frozen")}hasFrozenSelection(){return this.hasCurrentAttribute("frozen")}setSelection(o){var s;const a=this.document.locationRangeFromRange(o);return null===(s=this.delegate)||void 0===s?void 0:s.compositionDidRequestChangingSelectionToLocationRange(a)}getSelectedRange(){const o=this.getLocationRange();if(o)return this.document.rangeFromLocationRange(o)}setSelectedRange(o){const s=this.document.locationRangeFromRange(o);return this.getSelectionManager().setLocationRange(s)}getPosition(){const o=this.getLocationRange();if(o)return this.document.positionFromLocation(o[0])}getLocationRange(o){return this.targetLocationRange?this.targetLocationRange:this.getSelectionManager().getLocationRange(o)||wt({index:0,offset:0})}withTargetLocationRange(o,s){let a;this.targetLocationRange=o;try{a=s()}finally{this.targetLocationRange=null}return a}withTargetRange(o,s){const a=this.document.locationRangeFromRange(o);return this.withTargetLocationRange(a,s)}withTargetDOMRange(o,s){const a=this.createLocationRangeFromDOMRange(o,{strict:!1});return this.withTargetLocationRange(a,s)}getExpandedRangeInDirection(o){let{length:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[a,l]=Array.from(this.getSelectedRange());return"backward"===o?s?a-=s:a=this.translateUTF16PositionFromOffset(a,-1):s?l+=s:l=this.translateUTF16PositionFromOffset(l,1),wt([a,l])}shouldManageMovingCursorInDirection(o){if(this.editingAttachment)return!0;const s=this.getExpandedRangeInDirection(o);return null!=this.getAttachmentAtRange(s)}moveCursorInDirection(o){let s,a;if(this.editingAttachment)a=this.document.getRangeOfAttachment(this.editingAttachment);else{const l=this.getSelectedRange();a=this.getExpandedRangeInDirection(o),s=!Dt(l,a)}if("backward"===o?this.setSelectedRange(a[0]):this.setSelectedRange(a[1]),s){const o=this.getAttachmentAtRange(a);if(o)return this.editAttachment(o)}}expandSelectionInDirection(o){let{length:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=this.getExpandedRangeInDirection(o,{length:s});return this.setSelectedRange(a)}expandSelectionForEditing(){if(this.hasCurrentAttribute("href"))return this.expandSelectionAroundCommonAttribute("href")}expandSelectionAroundCommonAttribute(o){const s=this.getPosition(),a=this.document.getRangeOfCommonAttributeAtPosition(o,s);return this.setSelectedRange(a)}selectionContainsAttachments(){var o;return(null===(o=this.getSelectedAttachments())||void 0===o?void 0:o.length)>0}selectionIsInCursorTarget(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())}positionIsCursorTarget(o){const s=this.document.locationFromPosition(o);if(s)return this.locationIsCursorTarget(s)}positionIsBlockBreak(o){var s;return null===(s=this.document.getPieceAtPosition(o))||void 0===s?void 0:s.isBlockBreak()}getSelectedDocument(){const o=this.getSelectedRange();if(o)return this.document.getDocumentAtRange(o)}getSelectedAttachments(){var o;return null===(o=this.getSelectedDocument())||void 0===o?void 0:o.getAttachments()}getAttachments(){return this.attachments.slice(0)}refreshAttachments(){const o=this.document.getAttachments(),{added:s,removed:a}=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const a=[],l=[],c=new Set;o.forEach((o=>{c.add(o)}));const h=new Set;return s.forEach((o=>{h.add(o),c.has(o)||a.push(o)})),o.forEach((o=>{h.has(o)||l.push(o)})),{added:a,removed:l}}(this.attachments,o);return this.attachments=o,Array.from(a).forEach((o=>{var s,a;o.delegate=null,null===(s=this.delegate)||void 0===s||null===(a=s.compositionDidRemoveAttachment)||void 0===a||a.call(s,o)})),(()=>{const o=[];return Array.from(s).forEach((s=>{var a,l;s.delegate=this,o.push(null===(a=this.delegate)||void 0===a||null===(l=a.compositionDidAddAttachment)||void 0===l?void 0:l.call(a,s))})),o})()}attachmentDidChangeAttributes(o){var s,a;return this.revision++,null===(s=this.delegate)||void 0===s||null===(a=s.compositionDidEditAttachment)||void 0===a?void 0:a.call(s,o)}attachmentDidChangePreviewURL(o){var s,a;return this.revision++,null===(s=this.delegate)||void 0===s||null===(a=s.compositionDidChangeAttachmentPreviewURL)||void 0===a?void 0:a.call(s,o)}editAttachment(o,s){var a,l;if(o!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=o,null===(a=this.delegate)||void 0===a||null===(l=a.compositionDidStartEditingAttachment)||void 0===l?void 0:l.call(a,this.editingAttachment,s)}stopEditingAttachment(){var o,s;this.editingAttachment&&(null===(o=this.delegate)||void 0===o||null===(s=o.compositionDidStopEditingAttachment)||void 0===s||s.call(o,this.editingAttachment),this.editingAttachment=null)}updateAttributesForAttachment(o,s){return this.setDocument(this.document.updateAttributesForAttachment(o,s))}removeAttributeForAttachment(o,s){return this.setDocument(this.document.removeAttributeForAttachment(o,s))}breakFormattedBlock(o){let{document:s}=o;const{block:a}=o;let l=o.startPosition,c=[l-1,l];a.getBlockBreakPosition()===o.startLocation.offset?(a.breaksOnReturn()&&"\n"===o.nextCharacter?l+=1:s=s.removeTextAtRange(c),c=[l,l]):"\n"===o.nextCharacter?"\n"===o.previousCharacter?c=[l-1,l+1]:(c=[l,l+1],l+=1):o.startLocation.offset-1!=0&&(l+=1);const h=new on([a.removeLastAttribute().copyWithoutText()]);return this.setDocument(s.insertDocumentAtRange(h,c)),this.setSelection(l)}getPreviousBlock(){const o=this.getLocationRange();if(o){const{index:s}=o[0];if(s>0)return this.document.getBlockAtIndex(s-1)}}getBlock(){const o=this.getLocationRange();if(o)return this.document.getBlockAtIndex(o[0].index)}getAttachmentAtRange(o){const s=this.document.getDocumentAtRange(o);if(s.toString()==="".concat("","\n"))return s.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var o,s;return null===(o=this.delegate)||void 0===o||null===(s=o.compositionDidChangeCurrentAttributes)||void 0===s?void 0:s.call(o,this.currentAttributes)}notifyDelegateOfInsertionAtRange(o){var s,a;return null===(s=this.delegate)||void 0===s||null===(a=s.compositionDidPerformInsertionAtRange)||void 0===a?void 0:a.call(s,o)}translateUTF16PositionFromOffset(o,s){const a=this.document.toUTF16String(),l=a.offsetFromUCS2Offset(o);return a.offsetToUCS2Offset(l+s)}}kn.proxyMethod("getSelectionManager().getPointRange"),kn.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),kn.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),kn.proxyMethod("getSelectionManager().locationIsCursorTarget"),kn.proxyMethod("getSelectionManager().selectionIsExpanded"),kn.proxyMethod("delegate?.getSelectionManager");class Tn extends q{constructor(o){super(...arguments),this.composition=o,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(o){let{context:s,consolidatable:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const l=this.undoEntries.slice(-1)[0];if(!a||!wn(l,o,s)){const a=this.createEntry({description:o,context:s});this.undoEntries.push(a),this.redoEntries=[]}}undo(){const o=this.undoEntries.pop();if(o){const s=this.createEntry(o);return this.redoEntries.push(s),this.composition.loadSnapshot(o.snapshot)}}redo(){const o=this.redoEntries.pop();if(o){const s=this.createEntry(o);return this.undoEntries.push(s),this.composition.loadSnapshot(o.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:o,context:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{description:null==o?void 0:o.toString(),context:JSON.stringify(s),snapshot:this.composition.getSnapshot()}}}const wn=(o,s,a)=>(null==o?void 0:o.description)===(null==s?void 0:s.toString())&&(null==o?void 0:o.context)===JSON.stringify(a),Xn="attachmentGallery";class Dn{constructor(o){this.document=o.document,this.selectedRange=o.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map((o=>this.document=this.document.removeAttributeAtRange(Xn,o)))}applyBlockAttribute(){let o=0;this.findRangesOfPieces().forEach((s=>{s[1]-s[0]>1&&(s[0]+=o,s[1]+=o,"\n"!==this.document.getCharacterAtPosition(s[1])&&(this.document=this.document.insertBlockBreakAtRange(s[1]),s[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),s[1]++,o++),0!==s[0]&&"\n"!==this.document.getCharacterAtPosition(s[0]-1)&&(this.document=this.document.insertBlockBreakAtRange(s[0]),s[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),s[0]++,o++),this.document=this.document.applyBlockAttributeAtRange(Xn,!0,s))}))}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(Xn)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}const Nn=function(o){const s=new Dn(o);return s.perform(),s.getSnapshot()},$n=[Nn];class On{constructor(o,s,a){this.insertFiles=this.insertFiles.bind(this),this.composition=o,this.selectionManager=s,this.element=a,this.undoManager=new Tn(this.composition),this.filters=$n.slice(0)}loadDocument(o){return this.loadSnapshot({document:o,selectedRange:[0,0]})}loadHTML(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const s=cn.parse(o,{referenceElement:this.element}).getDocument();return this.loadDocument(s)}loadJSON(o){let{document:s,selectedRange:a}=o;return s=on.fromJSON(s),this.loadSnapshot({document:s,selectedRange:a})}loadSnapshot(o){return this.undoManager=new Tn(this.composition),this.composition.loadSnapshot(o)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(o){return this.composition.deleteInDirection(o)}insertAttachment(o){return this.composition.insertAttachment(o)}insertAttachments(o){return this.composition.insertAttachments(o)}insertDocument(o){return this.composition.insertDocument(o)}insertFile(o){return this.composition.insertFile(o)}insertFiles(o){return this.composition.insertFiles(o)}insertHTML(o){return this.composition.insertHTML(o)}insertString(o){return this.composition.insertString(o)}insertText(o){return this.composition.insertText(o)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(o){const s=this.getDocument().locationRangeFromRange([o,o+1]);return this.selectionManager.getClientRectAtLocationRange(s)}expandSelectionInDirection(o){return this.composition.expandSelectionInDirection(o)}moveCursorInDirection(o){return this.composition.moveCursorInDirection(o)}setSelectedRange(o){return this.composition.setSelectedRange(o)}activateAttribute(o){let s=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.composition.setCurrentAttribute(o,s)}attributeIsActive(o){return this.composition.hasCurrentAttribute(o)}canActivateAttribute(o){return this.composition.canSetCurrentAttribute(o)}deactivateAttribute(o){return this.composition.removeCurrentAttribute(o)}setHTMLAtributeAtPosition(o,s,a){this.composition.setHTMLAtributeAtPosition(o,s,a)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(o){let{context:s,consolidatable:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.undoManager.recordUndoEntry(o,{context:s,consolidatable:a})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class Fn{constructor(o){this.element=o}findLocationFromContainerAndOffset(o,s){let{strict:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{strict:!0},l=0,c=!1;const h={index:0,offset:0},d=this.findAttachmentElementParentForNode(o);d&&(o=d.parentNode,s=E(d));const g=R(this.element,{usingFilter:_n});for(;g.nextNode();){const d=g.currentNode;if(d===o&&B(o)){F(d)||(h.offset+=s);break}if(d.parentNode===o){if(l++===s)break}else if(!C(o,d)&&l>0)break;N(d,{strict:a})?(c&&h.index++,h.offset=0,c=!0):h.offset+=Pn(d)}return h}findContainerAndOffsetFromLocation(o){let s,a;if(0===o.index&&0===o.offset){for(s=this.element,a=0;s.firstChild;)if(s=s.firstChild,D(s)){a=1;break}return[s,a]}let[l,c]=this.findNodeAndOffsetFromLocation(o);if(l){if(B(l))0===Pn(l)?(s=l.parentNode.parentNode,a=E(l.parentNode),F(l,{name:"right"})&&a++):(s=l,a=o.offset-c);else{if(s=l.parentNode,!N(l.previousSibling)&&!D(s))for(;l===s.lastChild&&(l=s,s=s.parentNode,!D(s)););a=E(l),0!==o.offset&&a++}return[s,a]}}findNodeAndOffsetFromLocation(o){let s,a,l=0;for(const c of this.getSignificantNodesForIndex(o.index)){const h=Pn(c);if(o.offset<=l+h)if(B(c)){if(s=c,a=l,o.offset===a&&F(s))break}else s||(s=c,a=l);if(l+=h,l>o.offset)break}return[s,a]}findAttachmentElementParentForNode(o){for(;o&&o!==this.element;){if(P(o))return o;o=o.parentNode}}getSignificantNodesForIndex(o){const s=[],a=R(this.element,{usingFilter:Mn});let l=!1;for(;a.nextNode();){const h=a.currentNode;var c;if(I(h)){if(null!=c?c++:c=0,c===o)l=!0;else if(l)break}else l&&s.push(h)}return s}}const Pn=function(o){return o.nodeType===Node.TEXT_NODE?F(o)?0:o.textContent.length:"br"===k(o)||P(o)?1:0},Mn=function(o){return Bn(o)===NodeFilter.FILTER_ACCEPT?_n(o):NodeFilter.FILTER_REJECT},Bn=function(o){return M(o)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},_n=function(o){return P(o.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT};class jn{createDOMRangeFromPoint(o){let s,{x:a,y:l}=o;if(document.caretPositionFromPoint){const{offsetNode:o,offset:c}=document.caretPositionFromPoint(a,l);return s=document.createRange(),s.setStart(o,c),s}if(document.caretRangeFromPoint)return document.caretRangeFromPoint(a,l);if(document.body.createTextRange){const c=Mt();try{const o=document.body.createTextRange();o.moveToPoint(a,l),o.select()}catch(o){}return s=Mt(),Bt(c),s}}getClientRectsForDOMRange(o){const s=Array.from(o.getClientRects());return[s[0],s[s.length-1]]}}class Wn extends q{constructor(o){super(...arguments),this.didMouseDown=this.didMouseDown.bind(this),this.selectionDidChange=this.selectionDidChange.bind(this),this.element=o,this.locationMapper=new Fn(this.element),this.pointMapper=new jn,this.lockCount=0,b("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}getLocationRange(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!1===o.strict?this.createLocationRangeFromDOMRange(Mt()):o.ignoreLock?this.currentLocationRange:this.lockedLocationRange?this.lockedLocationRange:this.currentLocationRange}setLocationRange(o){if(this.lockedLocationRange)return;o=wt(o);const s=this.createDOMRangeFromLocationRange(o);s&&(Bt(s),this.updateCurrentLocationRange(o))}setLocationRangeFromPointRange(o){o=wt(o);const s=this.getLocationAtPoint(o[0]),a=this.getLocationAtPoint(o[1]);this.setLocationRange([s,a])}getClientRectAtLocationRange(o){const s=this.createDOMRangeFromLocationRange(o);if(s)return this.getClientRectsForDOMRange(s)[1]}locationIsCursorTarget(o){const s=Array.from(this.findNodeAndOffsetFromLocation(o))[0];return F(s)}lock(){0==this.lockCount++&&(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange())}unlock(){if(0==--this.lockCount){const{lockedLocationRange:o}=this;if(this.lockedLocationRange=null,null!=o)return this.setLocationRange(o)}}clearSelection(){var o;return null===(o=Pt())||void 0===o?void 0:o.removeAllRanges()}selectionIsCollapsed(){var o;return!0===(null===(o=Mt())||void 0===o?void 0:o.collapsed)}selectionIsExpanded(){return!this.selectionIsCollapsed()}createLocationRangeFromDOMRange(o,s){if(null==o||!this.domRangeWithinElement(o))return;const a=this.findLocationFromContainerAndOffset(o.startContainer,o.startOffset,s);if(!a)return;const l=o.collapsed?void 0:this.findLocationFromContainerAndOffset(o.endContainer,o.endOffset,s);return wt([a,l])}didMouseDown(){return this.pauseTemporarily()}pauseTemporarily(){let o;this.paused=!0;const e=()=>{if(this.paused=!1,clearTimeout(s),Array.from(o).forEach((o=>{o.destroy()})),C(document,this.element))return this.selectionDidChange()},s=setTimeout(e,200);o=["mousemove","keydown"].map((o=>b(o,{onElement:document,withCallback:e})))}selectionDidChange(){if(!this.paused&&!x(this.element))return this.updateCurrentLocationRange()}updateCurrentLocationRange(o){var s,a;if((null!=o?o:o=this.createLocationRangeFromDOMRange(Mt()))&&!Dt(o,this.currentLocationRange))return this.currentLocationRange=o,null===(s=this.delegate)||void 0===s||null===(a=s.locationRangeDidChange)||void 0===a?void 0:a.call(s,this.currentLocationRange.slice(0))}createDOMRangeFromLocationRange(o){const s=this.findContainerAndOffsetFromLocation(o[0]),a=Lt(o)?s:this.findContainerAndOffsetFromLocation(o[1])||s;if(null!=s&&null!=a){const o=document.createRange();return o.setStart(...Array.from(s||[])),o.setEnd(...Array.from(a||[])),o}}getLocationAtPoint(o){const s=this.createDOMRangeFromPoint(o);var a;if(s)return null===(a=this.createLocationRangeFromDOMRange(s))||void 0===a?void 0:a[0]}domRangeWithinElement(o){return o.collapsed?C(this.element,o.startContainer):C(this.element,o.startContainer)&&C(this.element,o.endContainer)}}Wn.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),Wn.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),Wn.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),Wn.proxyMethod("pointMapper.createDOMRangeFromPoint"),Wn.proxyMethod("pointMapper.getClientRectsForDOMRange");var Zn=Object.freeze({__proto__:null,Attachment:Wi,AttachmentManager:Sn,AttachmentPiece:Ui,Block:Gi,Composition:kn,Document:on,Editor:On,HTMLParser:cn,HTMLSanitizer:ui,LineBreakInsertion:Rn,LocationMapper:Fn,ManagedAttachment:En,Piece:_i,PointMapper:jn,SelectionManager:Wn,SplittableList:zi,StringPiece:Vi,Text:Ki,UndoManager:Tn}),rr=Object.freeze({__proto__:null,ObjectView:ie,AttachmentView:gi,BlockView:xi,DocumentView:Ci,PieceView:bi,PreviewableAttachmentView:fi,TextView:vi});const{lang:ar,css:lr,keyNames:cr}=$,Jn=function(o){return function(){const s=o.apply(this,arguments);s.do(),this.undos||(this.undos=[]),this.undos.push(s.undo)}};class Kn extends q{constructor(o,s,a){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(...arguments),wi(this,"makeElementMutable",Jn((()=>({do:()=>{this.element.dataset.trixMutable=!0},undo:()=>delete this.element.dataset.trixMutable})))),wi(this,"addToolbar",Jn((()=>{const o=T({tagName:"div",className:lr.attachmentToolbar,data:{trixMutable:!0},childNodes:T({tagName:"div",className:"trix-button-row",childNodes:T({tagName:"span",className:"trix-button-group trix-button-group--actions",childNodes:T({tagName:"button",className:"trix-button trix-button--remove",textContent:ar.remove,attributes:{title:ar.remove},data:{trixAction:"remove"}})})})});return this.attachment.isPreviewable()&&o.appendChild(T({tagName:"div",className:lr.attachmentMetadataContainer,childNodes:T({tagName:"span",className:lr.attachmentMetadata,childNodes:[T({tagName:"span",className:lr.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),T({tagName:"span",className:lr.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),b("click",{onElement:o,withCallback:this.didClickToolbar}),b("click",{onElement:o,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),v("trix-attachment-before-toolbar",{onElement:this.element,attributes:{toolbar:o,attachment:this.attachment}}),{do:()=>this.element.appendChild(o),undo:()=>S(o)}}))),wi(this,"installCaptionEditor",Jn((()=>{const o=T({tagName:"textarea",className:lr.attachmentCaptionEditor,attributes:{placeholder:ar.captionPlaceholder},data:{trixMutable:!0}});o.value=this.attachmentPiece.getCaption();const s=o.cloneNode();s.classList.add("trix-autoresize-clone"),s.tabIndex=-1;const i=function(){s.value=o.value,o.style.height=s.scrollHeight+"px"};b("input",{onElement:o,withCallback:i}),b("input",{onElement:o,withCallback:this.didInputCaption}),b("keydown",{onElement:o,withCallback:this.didKeyDownCaption}),b("change",{onElement:o,withCallback:this.didChangeCaption}),b("blur",{onElement:o,withCallback:this.didBlurCaption});const a=this.element.querySelector("figcaption"),l=a.cloneNode();return{do:()=>{if(a.style.display="none",l.appendChild(o),l.appendChild(s),l.classList.add("".concat(lr.attachmentCaption,"--editing")),a.parentElement.insertBefore(l,a),i(),this.options.editCaption)return Rt((()=>o.focus()))},undo(){S(l),a.style.display=null}}}))),this.didClickToolbar=this.didClickToolbar.bind(this),this.didClickActionButton=this.didClickActionButton.bind(this),this.didKeyDownCaption=this.didKeyDownCaption.bind(this),this.didInputCaption=this.didInputCaption.bind(this),this.didChangeCaption=this.didChangeCaption.bind(this),this.didBlurCaption=this.didBlurCaption.bind(this),this.attachmentPiece=o,this.element=s,this.container=a,this.options=l,this.attachment=this.attachmentPiece.attachment,"a"===k(this.element)&&(this.element=this.element.firstChild),this.install()}install(){this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()&&this.installCaptionEditor()}uninstall(){var o;let s=this.undos.pop();for(this.savePendingCaption();s;)s(),s=this.undos.pop();null===(o=this.delegate)||void 0===o||o.didUninstallAttachmentEditor(this)}savePendingCaption(){if(null!=this.pendingCaption){const c=this.pendingCaption;var o,s,a,l;this.pendingCaption=null,c?null===(o=this.delegate)||void 0===o||null===(s=o.attachmentEditorDidRequestUpdatingAttributesForAttachment)||void 0===s||s.call(o,{caption:c},this.attachment):null===(a=this.delegate)||void 0===a||null===(l=a.attachmentEditorDidRequestRemovingAttributeForAttachment)||void 0===l||l.call(a,"caption",this.attachment)}}didClickToolbar(o){return o.preventDefault(),o.stopPropagation()}didClickActionButton(o){var s;if("remove"===o.target.getAttribute("data-trix-action"))return null===(s=this.delegate)||void 0===s?void 0:s.attachmentEditorDidRequestRemovalOfAttachment(this.attachment)}didKeyDownCaption(o){var s,a;if("return"===cr[o.keyCode])return o.preventDefault(),this.savePendingCaption(),null===(s=this.delegate)||void 0===s||null===(a=s.attachmentEditorDidRequestDeselectingAttachment)||void 0===a?void 0:a.call(s,this.attachment)}didInputCaption(o){this.pendingCaption=o.target.value.replace(/\s/g," ").trim()}didChangeCaption(o){return this.savePendingCaption()}didBlurCaption(o){return this.savePendingCaption()}}class Gn extends q{constructor(o,a){super(...arguments),this.didFocus=this.didFocus.bind(this),this.didBlur=this.didBlur.bind(this),this.didClickAttachment=this.didClickAttachment.bind(this),this.element=o,this.composition=a,this.documentView=new Ci(this.composition.document,{element:this.element}),b("focus",{onElement:this.element,withCallback:this.didFocus}),b("blur",{onElement:this.element,withCallback:this.didBlur}),b("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),b("mousedown",{onElement:this.element,matchingSelector:s,withCallback:this.didClickAttachment}),b("click",{onElement:this.element,matchingSelector:"a".concat(s),preventDefault:!0})}didFocus(o){var s;const i=()=>{var o,s;if(!this.focused)return this.focused=!0,null===(o=this.delegate)||void 0===o||null===(s=o.compositionControllerDidFocus)||void 0===s?void 0:s.call(o)};return(null===(s=this.blurPromise)||void 0===s?void 0:s.then(i))||i()}didBlur(o){this.blurPromise=new Promise((o=>Rt((()=>{var s,a;x(this.element)||(this.focused=null,null===(s=this.delegate)||void 0===s||null===(a=s.compositionControllerDidBlur)||void 0===a||a.call(s));return this.blurPromise=null,o()}))))}didClickAttachment(o,s){var a,l;const c=this.findAttachmentForElement(s),h=!!y(o.target,{matchingSelector:"figcaption"});return null===(a=this.delegate)||void 0===a||null===(l=a.compositionControllerDidSelectAttachment)||void 0===l?void 0:l.call(a,c,{editCaption:h})}getSerializableElement(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element}render(){var o,s,a,l,c,h;(this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced())&&(null===(a=this.delegate)||void 0===a||null===(l=a.compositionControllerWillSyncDocumentView)||void 0===l||l.call(a),this.documentView.sync(),null===(c=this.delegate)||void 0===c||null===(h=c.compositionControllerDidSyncDocumentView)||void 0===h||h.call(c));return null===(o=this.delegate)||void 0===o||null===(s=o.compositionControllerDidRender)||void 0===s?void 0:s.call(o)}rerenderViewForObject(o){return this.invalidateViewForObject(o),this.render()}invalidateViewForObject(o){return this.documentView.invalidateViewForObject(o)}isViewCachingEnabled(){return this.documentView.isViewCachingEnabled()}enableViewCaching(){return this.documentView.enableViewCaching()}disableViewCaching(){return this.documentView.disableViewCaching()}refreshViewCache(){return this.documentView.garbageCollectCachedViews()}isEditingAttachment(){return!!this.attachmentEditor}installAttachmentEditorForAttachment(o,s){var a;if((null===(a=this.attachmentEditor)||void 0===a?void 0:a.attachment)===o)return;const l=this.documentView.findElementForObject(o);if(!l)return;this.uninstallAttachmentEditor();const c=this.composition.document.getAttachmentPieceForAttachment(o);this.attachmentEditor=new Kn(c,l,this.element,s),this.attachmentEditor.delegate=this}uninstallAttachmentEditor(){var o;return null===(o=this.attachmentEditor)||void 0===o?void 0:o.uninstall()}didUninstallAttachmentEditor(){return this.attachmentEditor=null,this.render()}attachmentEditorDidRequestUpdatingAttributesForAttachment(o,s){var a,l;return null===(a=this.delegate)||void 0===a||null===(l=a.compositionControllerWillUpdateAttachment)||void 0===l||l.call(a,s),this.composition.updateAttributesForAttachment(o,s)}attachmentEditorDidRequestRemovingAttributeForAttachment(o,s){var a,l;return null===(a=this.delegate)||void 0===a||null===(l=a.compositionControllerWillUpdateAttachment)||void 0===l||l.call(a,s),this.composition.removeAttributeForAttachment(o,s)}attachmentEditorDidRequestRemovalOfAttachment(o){var s,a;return null===(s=this.delegate)||void 0===s||null===(a=s.compositionControllerDidRequestRemovalOfAttachment)||void 0===a?void 0:a.call(s,o)}attachmentEditorDidRequestDeselectingAttachment(o){var s,a;return null===(s=this.delegate)||void 0===s||null===(a=s.compositionControllerDidRequestDeselectingAttachment)||void 0===a?void 0:a.call(s,o)}canSyncDocumentView(){return!this.isEditingAttachment()}findAttachmentForElement(o){return this.composition.document.getAttachmentById(parseInt(o.dataset.trixId,10))}}class Yn extends q{}const ur="data-trix-mutable",gr="[".concat(ur,"]"),wr={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0};class Qn extends q{constructor(o){super(o),this.didMutate=this.didMutate.bind(this),this.element=o,this.observer=new window.MutationObserver(this.didMutate),this.start()}start(){return this.reset(),this.observer.observe(this.element,wr)}stop(){return this.observer.disconnect()}didMutate(o){var s,a;if(this.mutations.push(...Array.from(this.findSignificantMutations(o)||[])),this.mutations.length)return null===(s=this.delegate)||void 0===s||null===(a=s.elementDidMutate)||void 0===a||a.call(s,this.getMutationSummary()),this.reset()}reset(){this.mutations=[]}findSignificantMutations(o){return o.filter((o=>this.mutationIsSignificant(o)))}mutationIsSignificant(o){if(this.nodeIsMutable(o.target))return!1;for(const s of Array.from(this.nodesModifiedByMutation(o)))if(this.nodeIsSignificant(s))return!0;return!1}nodeIsSignificant(o){return o!==this.element&&!this.nodeIsMutable(o)&&!M(o)}nodeIsMutable(o){return y(o,{matchingSelector:gr})}nodesModifiedByMutation(o){const s=[];switch(o.type){case"attributes":o.attributeName!==ur&&s.push(o.target);break;case"characterData":s.push(o.target.parentNode),s.push(o.target);break;case"childList":s.push(...Array.from(o.addedNodes||[])),s.push(...Array.from(o.removedNodes||[]))}return s}getMutationSummary(){return this.getTextMutationSummary()}getTextMutationSummary(){const{additions:o,deletions:s}=this.getTextChangesFromCharacterData(),a=this.getTextChangesFromChildList();Array.from(a.additions).forEach((s=>{Array.from(o).includes(s)||o.push(s)})),s.push(...Array.from(a.deletions||[]));const l={},c=o.join("");c&&(l.textAdded=c);const h=s.join("");return h&&(l.textDeleted=h),l}getMutationsByType(o){return Array.from(this.mutations).filter((s=>s.type===o))}getTextChangesFromChildList(){let o,s;const a=[],l=[];Array.from(this.getMutationsByType("childList")).forEach((o=>{a.push(...Array.from(o.addedNodes||[])),l.push(...Array.from(o.removedNodes||[]))}));0===a.length&&1===l.length&&I(l[0])?(o=[],s=["\n"]):(o=tr(a),s=tr(l));const c=o.filter(((o,a)=>o!==s[a])).map(Wt),h=s.filter(((s,a)=>s!==o[a])).map(Wt);return{additions:c,deletions:h}}getTextChangesFromCharacterData(){let o,s;const a=this.getMutationsByType("characterData");if(a.length){const l=a[0],c=a[a.length-1],h=function(o,s){let a,l;return o=X.box(o),(s=X.box(s)).length<o.length?[l,a]=zt(o,s):[a,l]=zt(s,o),{added:a,removed:l}}(Wt(l.oldValue),Wt(c.target.data));o=h.added,s=h.removed}return{additions:o?[o]:[],deletions:s?[s]:[]}}}const tr=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const s=[];for(const a of Array.from(o))switch(a.nodeType){case Node.TEXT_NODE:s.push(a.data);break;case Node.ELEMENT_NODE:"br"===k(a)?s.push("\n"):s.push(...Array.from(tr(a.childNodes)||[]))}return s};class er extends ee{constructor(o){super(...arguments),this.file=o}perform(o){const s=new FileReader;return s.onerror=()=>o(!1),s.onload=()=>{s.onerror=null;try{s.abort()}catch(o){}return o(!0,this.file)},s.readAsArrayBuffer(this.file)}}class ir{constructor(o){this.element=o}shouldIgnore(o){return!!d.samsungAndroid&&(this.previousEvent=this.event,this.event=o,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&nr(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&"insertText"!==this.event.inputType&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var o;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&(null===(o=this.event.data)||void 0===o?void 0:o.length)>50}isBeforeInputInsertText(){return"beforeinput"===this.event.type&&"insertText"===this.event.inputType}previousEventWasUnidentifiedKeydown(){var o,s;return"keydown"===(null===(o=this.previousEvent)||void 0===o?void 0:o.type)&&"Unidentified"===(null===(s=this.previousEvent)||void 0===s?void 0:s.key)}}const nr=(o,s)=>or(o)===or(s),kr=new RegExp("(".concat("","|").concat(_,"|").concat(j,"|\\s)+"),"g"),or=o=>o.replace(kr," ").trim();class sr extends q{constructor(o){super(...arguments),this.element=o,this.mutationObserver=new Qn(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new ir(this.element);for(const o in this.constructor.events)b(o,{onElement:this.element,withCallback:this.handlerFor(o)})}elementDidMutate(o){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var o,s;return null===(o=this.delegate)||void 0===o||null===(s=o.inputControllerDidRequestRender)||void 0===s?void 0:s.call(o)}requestReparse(){var o,s;return null===(o=this.delegate)||void 0===o||null===(s=o.inputControllerDidRequestReparse)||void 0===s||s.call(o),this.requestRender()}attachFiles(o){const s=Array.from(o).map((o=>new er(o)));return Promise.all(s).then((o=>{this.handleInput((function(){var s,a;return null===(s=this.delegate)||void 0===s||s.inputControllerWillAttachFiles(),null===(a=this.responder)||void 0===a||a.insertFiles(o),this.requestRender()}))}))}handlerFor(o){return s=>{s.defaultPrevented||this.handleInput((()=>{if(!x(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(s))return;this.eventName=o,this.constructor.events[o].call(this,s)}}))}}handleInput(o){try{var s;null===(s=this.delegate)||void 0===s||s.inputControllerWillHandleInput(),o.call(this)}finally{var a;null===(a=this.delegate)||void 0===a||a.inputControllerDidHandleInput()}}createLinkHTML(o,s){const a=document.createElement("a");return a.href=o,a.textContent=s||o,a.outerHTML}}var Rr;wi(sr,"events",{});const{browser:Tr,keyNames:Dr}=$;let Lr=0;class hr extends sr{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const s in o){const a=o[s];this.inputSummary[s]=a}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),ce.reset()}elementDidMutate(o){var s,a;return this.isComposing()?null===(s=this.delegate)||void 0===s||null===(a=s.inputControllerDidAllowUnhandledInput)||void 0===a?void 0:a.call(s):this.handleInput((function(){return this.mutationIsSignificant(o)&&(this.mutationIsExpected(o)?this.requestRender():this.requestReparse()),this.reset()}))}mutationIsExpected(o){let{textAdded:s,textDeleted:a}=o;if(this.inputSummary.preferDocument)return!0;const l=null!=s?s===this.inputSummary.textAdded:!this.inputSummary.textAdded,c=null!=a?this.inputSummary.didDelete:!this.inputSummary.didDelete,h=["\n"," \n"].includes(s)&&!l,d="\n"===a&&!c;if(h&&!d||d&&!h){const o=this.getSelectedRange();if(o){var g;const a=h?s.replace(/\n$/,"").length||-1:(null==s?void 0:s.length)||1;if(null!==(g=this.responder)&&void 0!==g&&g.positionIsBlockBreak(o[1]+a))return!0}}return l&&c}mutationIsSignificant(o){var s;const a=Object.keys(o).length>0,l=""===(null===(s=this.compositionInput)||void 0===s?void 0:s.getEndData());return a||!l}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new fr(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(o,s){var a;return!1!==(null===(a=this.responder)||void 0===a?void 0:a.deleteInDirection(o))?this.setInputSummary({didDelete:!0}):s?(s.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(o){var s;if(!function(o){if(null==o||!o.setData)return!1;for(const s in ae){const a=ae[s];try{if(o.setData(s,a),!o.getData(s)===a)return!1}catch(o){return!1}}return!0}(o))return;const a=null===(s=this.responder)||void 0===s?void 0:s.getSelectedDocument().toSerializableDocument();return o.setData("application/x-trix-document",JSON.stringify(a)),o.setData("text/html",Ci.render(a).innerHTML),o.setData("text/plain",a.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(o){const s={};return Array.from((null==o?void 0:o.types)||[]).forEach((o=>{s[o]=!0})),s.Files||s["application/x-trix-document"]||s["text/html"]||s["text/plain"]}getPastedHTMLUsingHiddenElement(o){const s=this.getSelectedRange(),a={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},l=T({style:a,tagName:"div",editable:!0});return document.body.appendChild(l),l.focus(),requestAnimationFrame((()=>{const a=l.innerHTML;return S(l),this.setSelectedRange(s),o(a)}))}}wi(hr,"events",{keydown(o){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const s=Dr[o.keyCode];if(s){var a;let l=this.keys;["ctrl","alt","shift","meta"].forEach((s=>{var a;o["".concat(s,"Key")]&&("ctrl"===s&&(s="control"),l=null===(a=l)||void 0===a?void 0:a[s])})),null!=(null===(a=l)||void 0===a?void 0:a[s])&&(this.setInputSummary({keyName:s}),ce.reset(),l[s].call(this,o))}if(le(o)){const s=String.fromCharCode(o.keyCode).toLowerCase();if(s){var l;const a=["alt","shift"].map((s=>{if(o["".concat(s,"Key")])return s})).filter((o=>o));a.push(s),null!==(l=this.delegate)&&void 0!==l&&l.inputControllerDidReceiveKeyboardCommand(a)&&o.preventDefault()}}},keypress(o){if(null!=this.inputSummary.eventName)return;if(o.metaKey)return;if(o.ctrlKey&&!o.altKey)return;const s=mr(o);var a,l;return s?(null===(a=this.delegate)||void 0===a||a.inputControllerWillPerformTyping(),null===(l=this.responder)||void 0===l||l.insertString(s),this.setInputSummary({textAdded:s,didDelete:this.selectionIsExpanded()})):void 0},textInput(o){const{data:s}=o,{textAdded:a}=this.inputSummary;if(a&&a!==s&&a.toUpperCase()===s){var l;const o=this.getSelectedRange();return this.setSelectedRange([o[0],o[1]+a.length]),null===(l=this.responder)||void 0===l||l.insertString(s),this.setInputSummary({textAdded:s}),this.setSelectedRange(o)}},dragenter(o){o.preventDefault()},dragstart(o){var s,a;return this.serializeSelectionToDataTransfer(o.dataTransfer),this.draggedRange=this.getSelectedRange(),null===(s=this.delegate)||void 0===s||null===(a=s.inputControllerDidStartDrag)||void 0===a?void 0:a.call(s)},dragover(o){if(this.draggedRange||this.canAcceptDataTransfer(o.dataTransfer)){o.preventDefault();const l={x:o.clientX,y:o.clientY};var s,a;if(!Tt(l,this.draggingPoint))return this.draggingPoint=l,null===(s=this.delegate)||void 0===s||null===(a=s.inputControllerDidReceiveDragOverPoint)||void 0===a?void 0:a.call(s,this.draggingPoint)}},dragend(o){var s,a;null===(s=this.delegate)||void 0===s||null===(a=s.inputControllerDidCancelDrag)||void 0===a||a.call(s),this.draggedRange=null,this.draggingPoint=null},drop(o){var s,a;o.preventDefault();const l=null===(s=o.dataTransfer)||void 0===s?void 0:s.files,c=o.dataTransfer.getData("application/x-trix-document"),h={x:o.clientX,y:o.clientY};if(null===(a=this.responder)||void 0===a||a.setLocationRangeFromPointRange(h),null!=l&&l.length)this.attachFiles(l);else if(this.draggedRange){var d,g;null===(d=this.delegate)||void 0===d||d.inputControllerWillMoveText(),null===(g=this.responder)||void 0===g||g.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(c){var p;const o=on.fromJSONString(c);null===(p=this.responder)||void 0===p||p.insertDocument(o),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(o){var s,a;if(null!==(s=this.responder)&&void 0!==s&&s.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(o.clipboardData)&&o.preventDefault(),null===(a=this.delegate)||void 0===a||a.inputControllerWillCutText(),this.deleteInDirection("backward"),o.defaultPrevented))return this.requestRender()},copy(o){var s;null!==(s=this.responder)&&void 0!==s&&s.selectionIsExpanded()&&this.serializeSelectionToDataTransfer(o.clipboardData)&&o.preventDefault()},paste(o){const s=o.clipboardData||o.testClipboardData,a={clipboard:s};if(!s||pr(o))return void this.getPastedHTMLUsingHiddenElement((o=>{var s,l,c;return a.type="text/html",a.html=o,null===(s=this.delegate)||void 0===s||s.inputControllerWillPaste(a),null===(l=this.responder)||void 0===l||l.insertHTML(a.html),this.requestRender(),null===(c=this.delegate)||void 0===c?void 0:c.inputControllerDidPaste(a)}));const l=s.getData("URL"),c=s.getData("text/html"),h=s.getData("public.url-name");if(l){var d,g,p;let o;a.type="text/html",o=h?Vt(h).trim():l,a.html=this.createLinkHTML(l,o),null===(d=this.delegate)||void 0===d||d.inputControllerWillPaste(a),this.setInputSummary({textAdded:o,didDelete:this.selectionIsExpanded()}),null===(g=this.responder)||void 0===g||g.insertHTML(a.html),this.requestRender(),null===(p=this.delegate)||void 0===p||p.inputControllerDidPaste(a)}else if(Et(s)){var f,w,_;a.type="text/plain",a.string=s.getData("text/plain"),null===(f=this.delegate)||void 0===f||f.inputControllerWillPaste(a),this.setInputSummary({textAdded:a.string,didDelete:this.selectionIsExpanded()}),null===(w=this.responder)||void 0===w||w.insertString(a.string),this.requestRender(),null===(_=this.delegate)||void 0===_||_.inputControllerDidPaste(a)}else if(c){var j,W,U;a.type="text/html",a.html=c,null===(j=this.delegate)||void 0===j||j.inputControllerWillPaste(a),null===(W=this.responder)||void 0===W||W.insertHTML(a.html),this.requestRender(),null===(U=this.delegate)||void 0===U||U.inputControllerDidPaste(a)}else if(Array.from(s.types).includes("Files")){var V,z;const o=null===(V=s.items)||void 0===V||null===(V=V[0])||void 0===V||null===(z=V.getAsFile)||void 0===z?void 0:z.call(V);if(o){var K,J,G;const s=dr(o);!o.name&&s&&(o.name="pasted-file-".concat(++Lr,".").concat(s)),a.type="File",a.file=o,null===(K=this.delegate)||void 0===K||K.inputControllerWillAttachFiles(),null===(J=this.responder)||void 0===J||J.insertFile(a.file),this.requestRender(),null===(G=this.delegate)||void 0===G||G.inputControllerDidPaste(a)}}o.preventDefault()},compositionstart(o){return this.getCompositionInput().start(o.data)},compositionupdate(o){return this.getCompositionInput().update(o.data)},compositionend(o){return this.getCompositionInput().end(o.data)},beforeinput(o){this.inputSummary.didInput=!0},input(o){return this.inputSummary.didInput=!0,o.stopPropagation()}}),wi(hr,"keys",{backspace(o){var s;return null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),this.deleteInDirection("backward",o)},delete(o){var s;return null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),this.deleteInDirection("forward",o)},return(o){var s,a;return this.setInputSummary({preferDocument:!0}),null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),null===(a=this.responder)||void 0===a?void 0:a.insertLineBreak()},tab(o){var s,a;null!==(s=this.responder)&&void 0!==s&&s.canIncreaseNestingLevel()&&(null===(a=this.responder)||void 0===a||a.increaseNestingLevel(),this.requestRender(),o.preventDefault())},left(o){var s;if(this.selectionIsInCursorTarget())return o.preventDefault(),null===(s=this.responder)||void 0===s?void 0:s.moveCursorInDirection("backward")},right(o){var s;if(this.selectionIsInCursorTarget())return o.preventDefault(),null===(s=this.responder)||void 0===s?void 0:s.moveCursorInDirection("forward")},control:{d(o){var s;return null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),this.deleteInDirection("forward",o)},h(o){var s;return null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),this.deleteInDirection("backward",o)},o(o){var s,a;return o.preventDefault(),null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),null===(a=this.responder)||void 0===a||a.insertString("\n",{updatePosition:!1}),this.requestRender()}},shift:{return(o){var s,a;null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),null===(a=this.responder)||void 0===a||a.insertString("\n"),this.requestRender(),o.preventDefault()},tab(o){var s,a;null!==(s=this.responder)&&void 0!==s&&s.canDecreaseNestingLevel()&&(null===(a=this.responder)||void 0===a||a.decreaseNestingLevel(),this.requestRender(),o.preventDefault())},left(o){if(this.selectionIsInCursorTarget())return o.preventDefault(),this.expandSelectionInDirection("backward")},right(o){if(this.selectionIsInCursorTarget())return o.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(o){var s;return this.setInputSummary({preferDocument:!1}),null===(s=this.delegate)||void 0===s?void 0:s.inputControllerWillPerformTyping()}},meta:{backspace(o){var s;return this.setInputSummary({preferDocument:!1}),null===(s=this.delegate)||void 0===s?void 0:s.inputControllerWillPerformTyping()}}}),hr.proxyMethod("responder?.getSelectedRange"),hr.proxyMethod("responder?.setSelectedRange"),hr.proxyMethod("responder?.expandSelectionInDirection"),hr.proxyMethod("responder?.selectionIsInCursorTarget"),hr.proxyMethod("responder?.selectionIsExpanded");const dr=o=>{var s;return null===(s=o.type)||void 0===s||null===(s=s.match(/\/(\w+)$/))||void 0===s?void 0:s[1]},Nr=!(null===(Rr=" ".codePointAt)||void 0===Rr||!Rr.call(" ",0)),mr=function(o){if(o.key&&Nr&&o.key.codePointAt(0)===o.keyCode)return o.key;{let s;if(null===o.which?s=o.keyCode:0!==o.which&&0!==o.charCode&&(s=o.charCode),null!=s&&"escape"!==Dr[s])return X.fromCodepoints([s]).toString()}},pr=function(o){const s=o.clipboardData;if(s){if(s.types.includes("text/html")){for(const o of s.types){const a=/^CorePasteboardFlavorType/.test(o),l=/^dyn\./.test(o)&&s.getData(o);if(a||l)return!0}return!1}{const o=s.types.includes("com.apple.webarchive"),a=s.types.includes("com.apple.flat-rtfd");return o||a}}};class fr extends q{constructor(o){super(...arguments),this.inputController=o,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(o){if(this.data.start=o,this.isSignificant()){var s,a;"keypress"===this.inputSummary.eventName&&this.inputSummary.textAdded&&(null===(a=this.responder)||void 0===a||a.deleteInDirection("left"));this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=null===(s=this.responder)||void 0===s?void 0:s.getSelectedRange()}}update(o){if(this.data.update=o,this.isSignificant()){const o=this.selectPlaceholder();o&&(this.forgetPlaceholder(),this.range=o)}}end(o){return this.data.end=o,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),null===(a=this.responder)||void 0===a||a.setSelectedRange(this.range),null===(l=this.responder)||void 0===l||l.insertString(this.data.end),null===(c=this.responder)||void 0===c?void 0:c.setSelectedRange(this.range[0]+this.data.end.length)):null!=this.data.start||null!=this.data.update?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var s,a,l,c}getEndData(){return this.data.end}isEnded(){return null!=this.getEndData()}isSignificant(){return!Tr.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var o,s;return 0===(null===(o=this.data.start)||void 0===o?void 0:o.length)&&(null===(s=this.data.end)||void 0===s?void 0:s.length)>0&&this.range}}fr.proxyMethod("inputController.setInputSummary"),fr.proxyMethod("inputController.requestRender"),fr.proxyMethod("inputController.requestReparse"),fr.proxyMethod("responder?.selectionIsExpanded"),fr.proxyMethod("responder?.insertPlaceholder"),fr.proxyMethod("responder?.selectPlaceholder"),fr.proxyMethod("responder?.forgetPlaceholder");class br extends sr{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?null===(o=this.delegate)||void 0===o||null===(s=o.inputControllerDidAllowUnhandledInput)||void 0===s?void 0:s.call(o):void 0:this.reparse();var o,s}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var o,s;(cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing)||null===(s=this.delegate)||void 0===s||s.render();null===(o=this.afterRender)||void 0===o||o.call(this),this.afterRender=null}reparse(){var o;return null===(o=this.delegate)||void 0===o?void 0:o.reparse()}insertString(){var o;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;return null===(o=this.delegate)||void 0===o||o.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.insertString(s,a)}))}toggleAttributeIfSupported(o){var s;if(gt().includes(o))return null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformFormatting(o),this.withTargetDOMRange((function(){var s;return null===(s=this.responder)||void 0===s?void 0:s.toggleCurrentAttribute(o)}))}activateAttributeIfSupported(o,s){var a;if(gt().includes(o))return null===(a=this.delegate)||void 0===a||a.inputControllerWillPerformFormatting(o),this.withTargetDOMRange((function(){var a;return null===(a=this.responder)||void 0===a?void 0:a.setCurrentAttribute(o,s)}))}deleteInDirection(o){let{recordUndoEntry:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{recordUndoEntry:!0};var a;s&&(null===(a=this.delegate)||void 0===a||a.inputControllerWillPerformTyping());const n=()=>{var s;return null===(s=this.responder)||void 0===s?void 0:s.deleteInDirection(o)},l=this.getTargetDOMRange({minLength:this.composing?1:2});return l?this.withTargetDOMRange(l,n):n()}withTargetDOMRange(o,s){var a;return"function"==typeof o&&(s=o,o=this.getTargetDOMRange()),o?null===(a=this.responder)||void 0===a?void 0:a.withTargetDOMRange(o,s.bind(this)):(ce.reset(),s.call(this))}getTargetDOMRange(){var o,s;let{minLength:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{minLength:0};const l=null===(o=(s=this.event).getTargetRanges)||void 0===o?void 0:o.call(s);if(l&&l.length){const o=vr(l[0]);if(0===a||o.toString().length>=a)return o}}withEvent(o,s){let a;this.event=o;try{a=s.call(this)}finally{this.event=null}return a}}wi(br,"events",{keydown(o){if(le(o)){var s;const a=Er(o);null!==(s=this.delegate)&&void 0!==s&&s.inputControllerDidReceiveKeyboardCommand(a)&&o.preventDefault()}else{let s=o.key;o.altKey&&(s+="+Alt"),o.shiftKey&&(s+="+Shift");const a=this.constructor.keys[s];if(a)return this.withEvent(o,a)}},paste(o){var s;let a;const l=null===(s=o.clipboardData)||void 0===s?void 0:s.getData("URL");return xr(o)?(o.preventDefault(),this.attachFiles(o.clipboardData.files)):Cr(o)?(o.preventDefault(),a={type:"text/plain",string:o.clipboardData.getData("text/plain")},null===(c=this.delegate)||void 0===c||c.inputControllerWillPaste(a),null===(h=this.responder)||void 0===h||h.insertString(a.string),this.render(),null===(d=this.delegate)||void 0===d?void 0:d.inputControllerDidPaste(a)):l?(o.preventDefault(),a={type:"text/html",html:this.createLinkHTML(l)},null===(g=this.delegate)||void 0===g||g.inputControllerWillPaste(a),null===(p=this.responder)||void 0===p||p.insertHTML(a.html),this.render(),null===(f=this.delegate)||void 0===f?void 0:f.inputControllerDidPaste(a)):void 0;var c,h,d,g,p,f},beforeinput(o){const s=this.constructor.inputTypes[o.inputType],a=(l=o,!(!/iPhone|iPad/.test(navigator.userAgent)||l.inputType&&"insertParagraph"!==l.inputType));var l;s&&(this.withEvent(o,s),a||this.scheduleRender()),a&&this.render()},input(o){ce.reset()},dragstart(o){var s,a;null!==(s=this.responder)&&void 0!==s&&s.selectionContainsAttachments()&&(o.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:null===(a=this.responder)||void 0===a?void 0:a.getSelectedRange(),point:Sr(o)})},dragenter(o){Ar(o)&&o.preventDefault()},dragover(o){if(this.dragging){o.preventDefault();const a=Sr(o);var s;if(!Tt(a,this.dragging.point))return this.dragging.point=a,null===(s=this.responder)||void 0===s?void 0:s.setLocationRangeFromPointRange(a)}else Ar(o)&&o.preventDefault()},drop(o){var s,a;if(this.dragging)return o.preventDefault(),null===(s=this.delegate)||void 0===s||s.inputControllerWillMoveText(),null===(a=this.responder)||void 0===a||a.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender();if(Ar(o)){var l;o.preventDefault();const s=Sr(o);return null===(l=this.responder)||void 0===l||l.setLocationRangeFromPointRange(s),this.attachFiles(o.dataTransfer.files)}},dragend(){var o;this.dragging&&(null===(o=this.responder)||void 0===o||o.setSelectedRange(this.dragging.range),this.dragging=null)},compositionend(o){this.composing&&(this.composing=!1,d.recentAndroid||this.scheduleRender())}}),wi(br,"keys",{ArrowLeft(){var o,s;if(null!==(o=this.responder)&&void 0!==o&&o.shouldManageMovingCursorInDirection("backward"))return this.event.preventDefault(),null===(s=this.responder)||void 0===s?void 0:s.moveCursorInDirection("backward")},ArrowRight(){var o,s;if(null!==(o=this.responder)&&void 0!==o&&o.shouldManageMovingCursorInDirection("forward"))return this.event.preventDefault(),null===(s=this.responder)||void 0===s?void 0:s.moveCursorInDirection("forward")},Backspace(){var o,s,a;if(null!==(o=this.responder)&&void 0!==o&&o.shouldManageDeletingInDirection("backward"))return this.event.preventDefault(),null===(s=this.delegate)||void 0===s||s.inputControllerWillPerformTyping(),null===(a=this.responder)||void 0===a||a.deleteInDirection("backward"),this.render()},Tab(){var o,s;if(null!==(o=this.responder)&&void 0!==o&&o.canIncreaseNestingLevel())return this.event.preventDefault(),null===(s=this.responder)||void 0===s||s.increaseNestingLevel(),this.render()},"Tab+Shift"(){var o,s;if(null!==(o=this.responder)&&void 0!==o&&o.canDecreaseNestingLevel())return this.event.preventDefault(),null===(s=this.responder)||void 0===s||s.decreaseNestingLevel(),this.render()}}),wi(br,"inputTypes",{deleteByComposition(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut(){return this.deleteInDirection("backward")},deleteByDrag(){return this.event.preventDefault(),this.withTargetDOMRange((function(){var o;this.deleteByDragRange=null===(o=this.responder)||void 0===o?void 0:o.getSelectedRange()}))},deleteCompositionText(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent(){return this.deleteInDirection("backward")},deleteContentBackward(){return this.deleteInDirection("backward")},deleteContentForward(){return this.deleteInDirection("forward")},deleteEntireSoftLine(){return this.deleteInDirection("forward")},deleteHardLineBackward(){return this.deleteInDirection("backward")},deleteHardLineForward(){return this.deleteInDirection("forward")},deleteSoftLineBackward(){return this.deleteInDirection("backward")},deleteSoftLineForward(){return this.deleteInDirection("forward")},deleteWordBackward(){return this.deleteInDirection("backward")},deleteWordForward(){return this.deleteInDirection("forward")},formatBackColor(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold(){return this.toggleAttributeIfSupported("bold")},formatFontColor(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent(){var o;if(null!==(o=this.responder)&&void 0!==o&&o.canIncreaseNestingLevel())return this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.increaseNestingLevel()}))},formatItalic(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent(){var o;if(null!==(o=this.responder)&&void 0!==o&&o.canDecreaseNestingLevel())return this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.decreaseNestingLevel()}))},formatRemove(){this.withTargetDOMRange((function(){for(const a in null===(o=this.responder)||void 0===o?void 0:o.getCurrentAttributes()){var o,s;null===(s=this.responder)||void 0===s||s.removeCurrentAttribute(a)}}))},formatSetBlockTextDirection(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough(){return this.toggleAttributeIfSupported("strike")},formatSubscript(){return this.toggleAttributeIfSupported("sub")},formatSuperscript(){return this.toggleAttributeIfSupported("sup")},formatUnderline(){return this.toggleAttributeIfSupported("underline")},historyRedo(){var o;return null===(o=this.delegate)||void 0===o?void 0:o.inputControllerWillPerformRedo()},historyUndo(){var o;return null===(o=this.delegate)||void 0===o?void 0:o.inputControllerWillPerformUndo()},insertCompositionText(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop(){const o=this.deleteByDragRange;var s;if(o)return this.deleteByDragRange=null,null===(s=this.delegate)||void 0===s||s.inputControllerWillMoveText(),this.withTargetDOMRange((function(){var s;return null===(s=this.responder)||void 0===s?void 0:s.moveTextFromRange(o)}))},insertFromPaste(){const{dataTransfer:o}=this.event,s={dataTransfer:o},a=o.getData("URL"),l=o.getData("text/html");if(a){var c;let l;this.event.preventDefault(),s.type="text/html";const h=o.getData("public.url-name");l=h?Vt(h).trim():a,s.html=this.createLinkHTML(a,l),null===(c=this.delegate)||void 0===c||c.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.insertHTML(s.html)})),this.afterRender=()=>{var o;return null===(o=this.delegate)||void 0===o?void 0:o.inputControllerDidPaste(s)}}else if(Et(o)){var h;s.type="text/plain",s.string=o.getData("text/plain"),null===(h=this.delegate)||void 0===h||h.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.insertString(s.string)})),this.afterRender=()=>{var o;return null===(o=this.delegate)||void 0===o?void 0:o.inputControllerDidPaste(s)}}else if(yr(this.event)){var d;s.type="File",s.file=o.files[0],null===(d=this.delegate)||void 0===d||d.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.insertFile(s.file)})),this.afterRender=()=>{var o;return null===(o=this.delegate)||void 0===o?void 0:o.inputControllerDidPaste(s)}}else if(l){var g;this.event.preventDefault(),s.type="text/html",s.html=l,null===(g=this.delegate)||void 0===g||g.inputControllerWillPaste(s),this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.insertHTML(s.html)})),this.afterRender=()=>{var o;return null===(o=this.delegate)||void 0===o?void 0:o.inputControllerDidPaste(s)}}},insertFromYank(){return this.insertString(this.event.data)},insertLineBreak(){return this.insertString("\n")},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var o;return null===(o=this.delegate)||void 0===o||o.inputControllerWillPerformTyping(),this.withTargetDOMRange((function(){var o;return null===(o=this.responder)||void 0===o?void 0:o.insertLineBreak()}))},insertReplacementText(){const o=this.event.dataTransfer.getData("text/plain"),s=this.event.getTargetRanges()[0];this.withTargetDOMRange(s,(()=>{this.insertString(o,{updatePosition:!1})}))},insertText(){var o;return this.insertString(this.event.data||(null===(o=this.event.dataTransfer)||void 0===o?void 0:o.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});const vr=function(o){const s=document.createRange();return s.setStart(o.startContainer,o.startOffset),s.setEnd(o.endContainer,o.endOffset),s},Ar=o=>{var s;return Array.from((null===(s=o.dataTransfer)||void 0===s?void 0:s.types)||[]).includes("Files")},yr=o=>{var s;return(null===(s=o.dataTransfer.files)||void 0===s?void 0:s[0])&&!xr(o)&&!(o=>{let{dataTransfer:s}=o;return s.types.includes("Files")&&s.types.includes("text/html")&&s.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(o)},xr=function(o){const s=o.clipboardData;if(s)return Array.from(s.types).filter((o=>o.match(/file/i))).length===s.types.length&&s.files.length>=1},Cr=function(o){const s=o.clipboardData;if(s)return s.types.includes("text/plain")&&1===s.types.length},Er=function(o){const s=[];return o.altKey&&s.push("alt"),o.shiftKey&&s.push("shift"),s.push(o.key),s},Sr=o=>({x:o.clientX,y:o.clientY}),Br="[data-trix-attribute]",_r="[data-trix-action]",jr="".concat(Br,", ").concat(_r),Ur="[data-trix-dialog]",Kr="".concat(Ur,"[data-trix-active]"),Jr="".concat(Ur," [data-trix-method]"),Gr="".concat(Ur," [data-trix-input]"),Ir=(o,s)=>(s||(s=Fr(o)),o.querySelector("[data-trix-input][name='".concat(s,"']"))),Or=o=>o.getAttribute("data-trix-action"),Fr=o=>o.getAttribute("data-trix-attribute")||o.getAttribute("data-trix-dialog-attribute");class Pr extends q{constructor(o){super(o),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=o,this.attributes={},this.actions={},this.resetDialogInputs(),b("mousedown",{onElement:this.element,matchingSelector:_r,withCallback:this.didClickActionButton}),b("mousedown",{onElement:this.element,matchingSelector:Br,withCallback:this.didClickAttributeButton}),b("click",{onElement:this.element,matchingSelector:jr,preventDefault:!0}),b("click",{onElement:this.element,matchingSelector:Jr,withCallback:this.didClickDialogButton}),b("keydown",{onElement:this.element,matchingSelector:Gr,withCallback:this.didKeyDownDialogInput})}didClickActionButton(o,s){var a;null===(a=this.delegate)||void 0===a||a.toolbarDidClickButton(),o.preventDefault();const l=Or(s);return this.getDialog(l)?this.toggleDialog(l):null===(c=this.delegate)||void 0===c?void 0:c.toolbarDidInvokeAction(l,s);var c}didClickAttributeButton(o,s){var a;null===(a=this.delegate)||void 0===a||a.toolbarDidClickButton(),o.preventDefault();const l=Fr(s);var c;this.getDialog(l)?this.toggleDialog(l):null===(c=this.delegate)||void 0===c||c.toolbarDidToggleAttribute(l);return this.refreshAttributeButtons()}didClickDialogButton(o,s){const a=y(s,{matchingSelector:Ur});return this[s.getAttribute("data-trix-method")].call(this,a)}didKeyDownDialogInput(o,s){if(13===o.keyCode){o.preventDefault();const a=s.getAttribute("name"),l=this.getDialog(a);this.setAttribute(l)}if(27===o.keyCode)return o.preventDefault(),this.hideDialog()}updateActions(o){return this.actions=o,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton(((o,s)=>{o.disabled=!1===this.actions[s]}))}eachActionButton(o){return Array.from(this.element.querySelectorAll(_r)).map((s=>o(s,Or(s))))}updateAttributes(o){return this.attributes=o,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton(((o,s)=>(o.disabled=!1===this.attributes[s],this.attributes[s]||this.dialogIsVisible(s)?(o.setAttribute("data-trix-active",""),o.classList.add("trix-active")):(o.removeAttribute("data-trix-active"),o.classList.remove("trix-active")))))}eachAttributeButton(o){return Array.from(this.element.querySelectorAll(Br)).map((s=>o(s,Fr(s))))}applyKeyboardCommand(o){const s=JSON.stringify(o.sort());for(const o of Array.from(this.element.querySelectorAll("[data-trix-key]"))){const a=o.getAttribute("data-trix-key").split("+");if(JSON.stringify(a.sort())===s)return v("mousedown",{onElement:o}),!0}return!1}dialogIsVisible(o){const s=this.getDialog(o);if(s)return s.hasAttribute("data-trix-active")}toggleDialog(o){return this.dialogIsVisible(o)?this.hideDialog():this.showDialog(o)}showDialog(o){var s,a;this.hideDialog(),null===(s=this.delegate)||void 0===s||s.toolbarWillShowDialog();const l=this.getDialog(o);l.setAttribute("data-trix-active",""),l.classList.add("trix-active"),Array.from(l.querySelectorAll("input[disabled]")).forEach((o=>{o.removeAttribute("disabled")}));const c=Fr(l);if(c){const s=Ir(l,o);s&&(s.value=this.attributes[c]||"",s.select())}return null===(a=this.delegate)||void 0===a?void 0:a.toolbarDidShowDialog(o)}setAttribute(o){var s;const a=Fr(o),l=Ir(o,a);return!l.willValidate||(l.setCustomValidity(""),l.checkValidity()&&this.isSafeAttribute(l))?(null===(s=this.delegate)||void 0===s||s.toolbarDidUpdateAttribute(a,l.value),this.hideDialog()):(l.setCustomValidity("Invalid value"),l.setAttribute("data-trix-validate",""),l.classList.add("trix-validate"),l.focus())}isSafeAttribute(o){return!o.hasAttribute("data-trix-validate-href")||bn.isValidAttribute("a","href",o.value)}removeAttribute(o){var s;const a=Fr(o);return null===(s=this.delegate)||void 0===s||s.toolbarDidRemoveAttribute(a),this.hideDialog()}hideDialog(){const o=this.element.querySelector(Kr);var s;if(o)return o.removeAttribute("data-trix-active"),o.classList.remove("trix-active"),this.resetDialogInputs(),null===(s=this.delegate)||void 0===s?void 0:s.toolbarDidHideDialog((o=>o.getAttribute("data-trix-dialog"))(o))}resetDialogInputs(){Array.from(this.element.querySelectorAll(Gr)).forEach((o=>{o.setAttribute("disabled","disabled"),o.removeAttribute("data-trix-validate"),o.classList.remove("trix-validate")}))}getDialog(o){return this.element.querySelector("[data-trix-dialog=".concat(o,"]"))}}class Mr extends Yn{constructor(o){let{editorElement:s,document:a,html:l}=o;super(...arguments),this.editorElement=s,this.selectionManager=new Wn(this.editorElement),this.selectionManager.delegate=this,this.composition=new kn,this.composition.delegate=this,this.attachmentManager=new Sn(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=2===z.getLevel()?new br(this.editorElement):new hr(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new Gn(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new Pr(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new On(this.composition,this.selectionManager,this.editorElement),a?this.editor.loadDocument(a):this.editor.loadHTML(l)}registerSelectionManager(){return ce.registerSelectionManager(this.selectionManager)}unregisterSelectionManager(){return ce.unregisterSelectionManager(this.selectionManager)}render(){return this.compositionController.render()}reparse(){return this.composition.replaceHTML(this.editorElement.innerHTML)}compositionDidChangeDocument(o){if(this.notifyEditorElement("document-change"),!this.handlingInput)return this.render()}compositionDidChangeCurrentAttributes(o){return this.currentAttributes=o,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})}compositionDidPerformInsertionAtRange(o){this.pasting&&(this.pastedRange=o)}compositionShouldAcceptFile(o){return this.notifyEditorElement("file-accept",{file:o})}compositionDidAddAttachment(o){const s=this.attachmentManager.manageAttachment(o);return this.notifyEditorElement("attachment-add",{attachment:s})}compositionDidEditAttachment(o){this.compositionController.rerenderViewForObject(o);const s=this.attachmentManager.manageAttachment(o);return this.notifyEditorElement("attachment-edit",{attachment:s}),this.notifyEditorElement("change")}compositionDidChangeAttachmentPreviewURL(o){return this.compositionController.invalidateViewForObject(o),this.notifyEditorElement("change")}compositionDidRemoveAttachment(o){const s=this.attachmentManager.unmanageAttachment(o);return this.notifyEditorElement("attachment-remove",{attachment:s})}compositionDidStartEditingAttachment(o,s){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(o),this.compositionController.installAttachmentEditorForAttachment(o,s),this.selectionManager.setLocationRange(this.attachmentLocationRange)}compositionDidStopEditingAttachment(o){this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null}compositionDidRequestChangingSelectionToLocationRange(o){if(!this.loadingSnapshot||this.isFocused())return this.requestedLocationRange=o,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,this.handlingInput?void 0:this.render()}compositionWillLoadSnapshot(){this.loadingSnapshot=!0}compositionDidLoadSnapshot(){this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1}getSelectionManager(){return this.selectionManager}attachmentManagerDidRequestRemovalOfAttachment(o){return this.removeAttachment(o)}compositionControllerWillSyncDocumentView(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()}compositionControllerDidSyncDocumentView(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")}compositionControllerDidRender(){this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision}compositionControllerDidFocus(){return this.isFocusedInvisibly()&&this.setLocationRange({index:0,offset:0}),this.toolbarController.hideDialog(),this.notifyEditorElement("focus")}compositionControllerDidBlur(){return this.notifyEditorElement("blur")}compositionControllerDidSelectAttachment(o,s){return this.toolbarController.hideDialog(),this.composition.editAttachment(o,s)}compositionControllerDidRequestDeselectingAttachment(o){const s=this.attachmentLocationRange||this.composition.document.getLocationRangeOfAttachment(o);return this.selectionManager.setLocationRange(s[1])}compositionControllerWillUpdateAttachment(o){return this.editor.recordUndoEntry("Edit Attachment",{context:o.id,consolidatable:!0})}compositionControllerDidRequestRemovalOfAttachment(o){return this.removeAttachment(o)}inputControllerWillHandleInput(){this.handlingInput=!0,this.requestedRender=!1}inputControllerDidRequestRender(){this.requestedRender=!0}inputControllerDidHandleInput(){if(this.handlingInput=!1,this.requestedRender)return this.requestedRender=!1,this.render()}inputControllerDidAllowUnhandledInput(){return this.notifyEditorElement("change")}inputControllerDidRequestReparse(){return this.reparse()}inputControllerWillPerformTyping(){return this.recordTypingUndoEntry()}inputControllerWillPerformFormatting(o){return this.recordFormattingUndoEntry(o)}inputControllerWillCutText(){return this.editor.recordUndoEntry("Cut")}inputControllerWillPaste(o){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:o})}inputControllerDidPaste(o){return o.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:o})}inputControllerWillMoveText(){return this.editor.recordUndoEntry("Move")}inputControllerWillAttachFiles(){return this.editor.recordUndoEntry("Drop Files")}inputControllerWillPerformUndo(){return this.editor.undo()}inputControllerWillPerformRedo(){return this.editor.redo()}inputControllerDidReceiveKeyboardCommand(o){return this.toolbarController.applyKeyboardCommand(o)}inputControllerDidStartDrag(){this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()}inputControllerDidReceiveDragOverPoint(o){return this.selectionManager.setLocationRangeFromPointRange(o)}inputControllerDidCancelDrag(){this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null}locationRangeDidChange(o){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!Dt(this.attachmentLocationRange,o)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")}toolbarDidClickButton(){if(!this.getLocationRange())return this.setLocationRange({index:0,offset:0})}toolbarDidInvokeAction(o,s){return this.invokeAction(o,s)}toolbarDidToggleAttribute(o){if(this.recordFormattingUndoEntry(o),this.composition.toggleCurrentAttribute(o),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidUpdateAttribute(o,s){if(this.recordFormattingUndoEntry(o),this.composition.setCurrentAttribute(o,s),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidRemoveAttribute(o){if(this.recordFormattingUndoEntry(o),this.composition.removeCurrentAttribute(o),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarWillShowDialog(o){return this.composition.expandSelectionForEditing(),this.freezeSelection()}toolbarDidShowDialog(o){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:o})}toolbarDidHideDialog(o){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:o})}freezeSelection(){if(!this.selectionFrozen)return this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render()}thawSelection(){if(this.selectionFrozen)return this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()}canInvokeAction(o){return!!this.actionIsExternal(o)||!(null===(s=this.actions[o])||void 0===s||null===(s=s.test)||void 0===s||!s.call(this));var s}invokeAction(o,s){return this.actionIsExternal(o)?this.notifyEditorElement("action-invoke",{actionName:o,invokingElement:s}):null===(a=this.actions[o])||void 0===a||null===(a=a.perform)||void 0===a?void 0:a.call(this);var a}actionIsExternal(o){return/^x-./.test(o)}getCurrentActions(){const o={};for(const s in this.actions)o[s]=this.canInvokeAction(s);return o}updateCurrentActions(){const o=this.getCurrentActions();if(!Tt(o,this.currentActions))return this.currentActions=o,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions})}runEditorFilters(){let o=this.composition.getSnapshot();if(Array.from(this.editor.filters).forEach((s=>{const{document:a,selectedRange:l}=o;o=s.call(this.editor,o)||{},o.document||(o.document=a),o.selectedRange||(o.selectedRange=l)})),s=o,a=this.composition.getSnapshot(),!Dt(s.selectedRange,a.selectedRange)||!s.document.isEqualTo(a.document))return this.composition.loadSnapshot(o);var s,a}updateInputElement(){const o=function(o,s){const a=Hn[s];if(a)return a(o);throw new Error("unknown content type: ".concat(s))}(this.compositionController.getSerializableElement(),"text/html");return this.editorElement.setFormValue(o)}notifyEditorElement(o,s){switch(o){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement()}return this.editorElement.notify(o,s)}removeAttachment(o){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(o),this.render()}recordFormattingUndoEntry(o){const s=mt(o),a=this.selectionManager.getLocationRange();if(s||!Lt(a))return this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0})}recordTypingUndoEntry(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})}getUndoContext(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return[this.getLocationContext(),this.getTimeContext(),...Array.from(s)]}getLocationContext(){const o=this.selectionManager.getLocationRange();return Lt(o)?o[0].index:o}getTimeContext(){return Y.interval>0?Math.floor((new Date).getTime()/Y.interval):0}isFocused(){var o;return this.editorElement===(null===(o=this.editorElement.ownerDocument)||void 0===o?void 0:o.activeElement)}isFocusedInvisibly(){return this.isFocused()&&!this.getLocationRange()}get actions(){return this.constructor.actions}}wi(Mr,"actions",{undo:{test(){return this.editor.canUndo()},perform(){return this.editor.undo()}},redo:{test(){return this.editor.canRedo()},perform(){return this.editor.redo()}},link:{test(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test(){return this.editor.canIncreaseNestingLevel()},perform(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test(){return this.editor.canDecreaseNestingLevel()},perform(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test:()=>!0,perform(){return z.pickFiles(this.editor.insertFiles)}}}),Mr.proxyMethod("getSelectionManager().setLocationRange"),Mr.proxyMethod("getSelectionManager().getLocationRange");var Xr=Object.freeze({__proto__:null,AttachmentEditorController:Kn,CompositionController:Gn,Controller:Yn,EditorController:Mr,InputController:sr,Level0InputController:hr,Level2InputController:br,ToolbarController:Pr}),Qr=Object.freeze({__proto__:null,MutationObserver:Qn,SelectionChangeObserver:Ot}),Zr=Object.freeze({__proto__:null,FileVerificationOperation:er,ImagePreloadOperation:ji});vt("trix-toolbar","%t {\n display: block;\n}\n\n%t {\n white-space: nowrap;\n}\n\n%t [data-trix-dialog] {\n display: none;\n}\n\n%t [data-trix-dialog][data-trix-active] {\n display: block;\n}\n\n%t [data-trix-dialog] [data-trix-validate]:invalid {\n background-color: #ffdddd;\n}");class Wr extends HTMLElement{connectedCallback(){""===this.innerHTML&&(this.innerHTML=G.getDefaultHTML())}}let eo=0;const Vr=function(o){if(!o.hasAttribute("contenteditable"))return o.setAttribute("contenteditable",""),function(o){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s.times=1,b(o,s)}("focus",{onElement:o,withCallback:()=>zr(o)})},zr=function(o){return qr(o),Hr(o)},qr=function(o){var s,a;if(null!==(s=(a=document).queryCommandSupported)&&void 0!==s&&s.call(a,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),b("mscontrolselect",{onElement:o,preventDefault:!0})},Hr=function(o){var s,a;if(null!==(s=(a=document).queryCommandSupported)&&void 0!==s&&s.call(a,"DefaultParagraphSeparator")){const{tagName:o}=l.default;if(["div","p"].includes(o))return document.execCommand("DefaultParagraphSeparator",!1,o)}},no=d.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};vt("trix-editor","%t {\n display: block;\n}\n\n%t:empty::before {\n content: attr(placeholder);\n color: graytext;\n cursor: text;\n pointer-events: none;\n white-space: pre-line;\n}\n\n%t a[contenteditable=false] {\n cursor: text;\n}\n\n%t img {\n max-width: 100%;\n height: auto;\n}\n\n%t ".concat(s," figcaption textarea {\n resize: none;\n}\n\n%t ").concat(s," figcaption textarea.trix-autoresize-clone {\n position: absolute;\n left: -9999px;\n max-height: 0px;\n}\n\n%t ").concat(s," figcaption[data-trix-placeholder]:empty::before {\n content: attr(data-trix-placeholder);\n color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n display: ").concat(no.display," !important;\n width: ").concat(no.width," !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n vertical-align: top !important;\n margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n vertical-align: bottom !important;\n margin-right: -1px !important;\n}"));var ro=new WeakMap,oo=new WeakSet;class Yr{constructor(o){var s,a;Mi(s=this,a=oo),a.add(s),Bi(this,ro,{writable:!0,value:void 0}),this.element=o,Ni(this,ro,o.attachInternals())}connectedCallback(){Pi(this,oo,$r).call(this)}disconnectedCallback(){}get labels(){return Di(this,ro).labels}get disabled(){var o;return null===(o=this.element.inputElement)||void 0===o?void 0:o.disabled}set disabled(o){this.element.toggleAttribute("disabled",o)}get required(){return this.element.hasAttribute("required")}set required(o){this.element.toggleAttribute("required",o),Pi(this,oo,$r).call(this)}get validity(){return Di(this,ro).validity}get validationMessage(){return Di(this,ro).validationMessage}get willValidate(){return Di(this,ro).willValidate}setFormValue(o){Pi(this,oo,$r).call(this)}checkValidity(){return Di(this,ro).checkValidity()}reportValidity(){return Di(this,ro).reportValidity()}setCustomValidity(o){Pi(this,oo,$r).call(this,o)}}function $r(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{required:s,value:a}=this.element,l=s&&!a,c=!!o,h=T("input",{required:s}),d=o||h.validationMessage;Di(this,ro).setValidity({valueMissing:l,customError:c},d)}var so=new WeakMap,ao=new WeakMap,lo=new WeakMap;class to{constructor(o){Bi(this,so,{writable:!0,value:void 0}),Bi(this,ao,{writable:!0,value:o=>{o.defaultPrevented||o.target===this.element.form&&this.element.reset()}}),Bi(this,lo,{writable:!0,value:o=>{if(o.defaultPrevented)return;if(this.element.contains(o.target))return;const s=y(o.target,{matchingSelector:"label"});s&&Array.from(this.labels).includes(s)&&this.element.focus()}}),this.element=o}connectedCallback(){Ni(this,so,function(o){if(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"))return;const e=function(){const s=Array.from(o.labels).map((s=>{if(!s.contains(o))return s.textContent})).filter((o=>o)),a=s.join(" ");return a?o.setAttribute("aria-label",a):o.removeAttribute("aria-label")};return e(),b("focus",{onElement:o,withCallback:e})}(this.element)),window.addEventListener("reset",Di(this,ao),!1),window.addEventListener("click",Di(this,lo),!1)}disconnectedCallback(){var o;null===(o=Di(this,so))||void 0===o||o.destroy(),window.removeEventListener("reset",Di(this,ao),!1),window.removeEventListener("click",Di(this,lo),!1)}get labels(){const o=[];this.element.id&&this.element.ownerDocument&&o.push(...Array.from(this.element.ownerDocument.querySelectorAll("label[for='".concat(this.element.id,"']"))||[]));const s=y(this.element,{matchingSelector:"label"});return s&&[this.element,null].includes(s.control)&&o.push(s),o}get disabled(){return console.warn("This browser does not support the [disabled] attribute for trix-editor elements."),!1}set disabled(o){console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")}get required(){return console.warn("This browser does not support the [required] attribute for trix-editor elements."),!1}set required(o){console.warn("This browser does not support the [required] attribute for trix-editor elements.")}get validity(){return console.warn("This browser does not support the validity property for trix-editor elements."),null}get validationMessage(){return console.warn("This browser does not support the validationMessage property for trix-editor elements."),""}get willValidate(){return console.warn("This browser does not support the willValidate property for trix-editor elements."),!1}setFormValue(o){}checkValidity(){return console.warn("This browser does not support checkValidity() for trix-editor elements."),!0}reportValidity(){return console.warn("This browser does not support reportValidity() for trix-editor elements."),!0}setCustomValidity(o){console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")}}var co=new WeakMap;class io extends HTMLElement{constructor(){super(),Bi(this,co,{writable:!0,value:void 0}),Ni(this,co,this.constructor.formAssociated?new Yr(this):new to(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++eo),this.trixId)}get labels(){return Di(this,co).labels}get disabled(){return Di(this,co).disabled}set disabled(o){Di(this,co).disabled=o}get required(){return Di(this,co).required}set required(o){Di(this,co).required=o}get validity(){return Di(this,co).validity}get validationMessage(){return Di(this,co).validationMessage}get willValidate(){return Di(this,co).willValidate}get type(){return this.localName}get toolbarElement(){var o;if(this.hasAttribute("toolbar"))return null===(o=this.ownerDocument)||void 0===o?void 0:o.getElementById(this.getAttribute("toolbar"));if(this.parentNode){const o="trix-toolbar-".concat(this.trixId);this.setAttribute("toolbar",o);const s=T("trix-toolbar",{id:o});return this.parentNode.insertBefore(s,this),s}}get form(){var o;return null===(o=this.inputElement)||void 0===o?void 0:o.form}get inputElement(){var o;if(this.hasAttribute("input"))return null===(o=this.ownerDocument)||void 0===o?void 0:o.getElementById(this.getAttribute("input"));if(this.parentNode){const o="trix-input-".concat(this.trixId);this.setAttribute("input",o);const s=T("input",{type:"hidden",id:o});return this.parentNode.insertBefore(s,this.nextElementSibling),s}}get editor(){var o;return null===(o=this.editorController)||void 0===o?void 0:o.editor}get name(){var o;return null===(o=this.inputElement)||void 0===o?void 0:o.name}get value(){var o;return null===(o=this.inputElement)||void 0===o?void 0:o.value}set value(o){var s;this.defaultValue=o,null===(s=this.editor)||void 0===s||s.loadHTML(this.defaultValue)}notify(o,s){if(this.editorController)return v("trix-".concat(o),{onElement:this,attributes:s})}setFormValue(o){this.inputElement&&(this.inputElement.value=o,Di(this,co).setFormValue(o))}connectedCallback(){this.hasAttribute("data-trix-internal")||(Vr(this),function(o){o.hasAttribute("role")||o.setAttribute("role","textbox")}(this),this.editorController||(v("trix-before-initialize",{onElement:this}),this.editorController=new Mr({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame((()=>v("trix-initialize",{onElement:this})))),this.editorController.registerSelectionManager(),Di(this,co).connectedCallback(),function(o){!document.querySelector(":focus")&&o.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===o&&o.focus()}(this))}disconnectedCallback(){var o;null===(o=this.editorController)||void 0===o||o.unregisterSelectionManager(),Di(this,co).disconnectedCallback()}checkValidity(){return Di(this,co).checkValidity()}reportValidity(){return Di(this,co).reportValidity()}setCustomValidity(o){Di(this,co).setCustomValidity(o)}formDisabledCallback(o){this.inputElement&&(this.inputElement.disabled=o),this.toggleAttribute("contenteditable",!o)}formResetCallback(){this.reset()}reset(){this.value=this.defaultValue}}wi(io,"formAssociated","ElementInternals"in window);const uo={VERSION:o,config:$,core:zn,models:Zn,views:rr,controllers:Xr,observers:Qr,operations:Zr,elements:Object.freeze({__proto__:null,TrixEditorElement:io,TrixToolbarElement:Wr}),filters:Object.freeze({__proto__:null,Filter:Dn,attachmentGalleryFilter:Nn})};Object.assign(uo,Zn),window.Trix=uo,setTimeout((function(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",Wr),customElements.get("trix-editor")||customElements.define("trix-editor",io)}),0);export{uo as default};
5
+