plutonium 0.62.2 → 0.63.0

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 (255) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/skills/plutonium/SKILL.md +44 -0
  3. data/.claude/skills/plutonium-app/SKILL.md +3 -3
  4. data/.claude/skills/plutonium-async-interactions/SKILL.md +191 -0
  5. data/.claude/skills/plutonium-auth/SKILL.md +36 -0
  6. data/.claude/skills/plutonium-behavior/SKILL.md +121 -24
  7. data/.claude/skills/plutonium-kanban/SKILL.md +17 -3
  8. data/.claude/skills/plutonium-resource/SKILL.md +259 -12
  9. data/.claude/skills/plutonium-tenancy/SKILL.md +32 -3
  10. data/.claude/skills/plutonium-ui/SKILL.md +115 -14
  11. data/.claude/skills/plutonium-wizard/SKILL.md +73 -4
  12. data/CHANGELOG.md +67 -0
  13. data/CLAUDE.md +87 -0
  14. data/Rakefile +34 -0
  15. data/SECURITY.md +1 -1
  16. data/app/assets/plutonium.css +1 -1
  17. data/app/assets/plutonium.js +685 -102
  18. data/app/assets/plutonium.js.map +4 -4
  19. data/app/assets/plutonium.min.js +53 -53
  20. data/app/assets/plutonium.min.js.map +4 -4
  21. data/app/views/rodauth/_login_form.html.erb +13 -0
  22. data/db/migrate/async_interactions/20260817000001_create_plutonium_async_runs.rb +170 -0
  23. data/docs/.vitepress/config.ts +81 -3
  24. data/docs/.vitepress/theme/blog.data.ts +44 -0
  25. data/docs/.vitepress/theme/components/BlogIndex.vue +87 -0
  26. data/docs/.vitepress/theme/components/BlogMeta.vue +47 -0
  27. data/docs/.vitepress/theme/components/HomeFeatureTour.vue +293 -0
  28. data/docs/.vitepress/theme/components/HomeHero.vue +3 -3
  29. data/docs/.vitepress/theme/components/HomeInTheBox.vue +8 -0
  30. data/docs/.vitepress/theme/components/HomeStopWriting.vue +1 -0
  31. data/docs/.vitepress/theme/components/HomeWhyPlutonium.vue +84 -0
  32. data/docs/.vitepress/theme/index.ts +8 -4
  33. data/docs/blog/association-inputs-post-signed-ids.md +70 -0
  34. data/docs/blog/fix-the-model-not-the-policy.md +122 -0
  35. data/docs/blog/fractional-ordering-runs-out-of-room.md +67 -0
  36. data/docs/blog/half-finished-forms-are-pii.md +76 -0
  37. data/docs/blog/index.md +13 -0
  38. data/docs/blog/interactions-are-presentation-objects.md +152 -0
  39. data/docs/blog/introducing-plutonium.md +253 -0
  40. data/docs/blog/jobs-are-not-permission-snapshots.md +100 -0
  41. data/docs/blog/plutonium-and-ai-agents.md +48 -0
  42. data/docs/blog/realtime-is-one-line-and-four-dependencies.md +70 -0
  43. data/docs/blog/two-forms-one-dom-id.md +69 -0
  44. data/docs/blog/whats-new-async-kanban-wizards.md +130 -0
  45. data/docs/getting-started/tutorial/04-authorization.md +12 -3
  46. data/docs/getting-started/tutorial/06-nested-resources.md +3 -1
  47. data/docs/getting-started/tutorial/07-author-portal.md +2 -2
  48. data/docs/guides/authentication.md +73 -0
  49. data/docs/guides/authorization.md +2 -0
  50. data/docs/guides/creating-packages.md +5 -3
  51. data/docs/guides/custom-actions.md +74 -12
  52. data/docs/guides/customizing-ui.md +9 -2
  53. data/docs/guides/index.md +1 -0
  54. data/docs/guides/kanban.md +7 -5
  55. data/docs/guides/nested-resources.md +11 -1
  56. data/docs/guides/performance.md +104 -0
  57. data/docs/guides/user-invites.md +1 -1
  58. data/docs/guides/wizards.md +9 -1
  59. data/docs/index.md +3 -3
  60. data/docs/public/images/home/tour-actions.png +0 -0
  61. data/docs/public/images/home/tour-async.png +0 -0
  62. data/docs/public/images/home/tour-kanban.png +0 -0
  63. data/docs/public/images/home/tour-tenancy.png +0 -0
  64. data/docs/public/images/home/tour-wizard.png +0 -0
  65. data/docs/public/images/reference/async-progress-page.png +0 -0
  66. data/docs/public/images/reference/async-running-banner.png +0 -0
  67. data/docs/public/templates/experimental.rb +34 -0
  68. data/docs/public/templates/pluton8.rb +14 -0
  69. data/docs/reference/app/portals.md +15 -3
  70. data/docs/reference/auth/accounts.md +19 -0
  71. data/docs/reference/behavior/async-interactions.md +295 -0
  72. data/docs/reference/behavior/controllers.md +17 -4
  73. data/docs/reference/behavior/index.md +7 -1
  74. data/docs/reference/behavior/interactions.md +152 -22
  75. data/docs/reference/configuration.md +5 -0
  76. data/docs/reference/index.md +1 -0
  77. data/docs/reference/kanban/dsl.md +7 -4
  78. data/docs/reference/kanban/index.md +1 -1
  79. data/docs/reference/kanban/positioning.md +26 -4
  80. data/docs/reference/positioning.md +568 -0
  81. data/docs/reference/resource/actions.md +97 -4
  82. data/docs/reference/resource/definition.md +181 -9
  83. data/docs/reference/tenancy/invites.md +1 -1
  84. data/docs/reference/tenancy/nested-resources.md +60 -2
  85. data/docs/reference/ui/assets.md +4 -0
  86. data/docs/reference/ui/components.md +57 -4
  87. data/docs/reference/ui/displays.md +20 -10
  88. data/docs/reference/ui/index.md +1 -1
  89. data/docs/reference/wizard/dsl.md +33 -0
  90. data/docs/reference/wizard/storage-config.md +1 -0
  91. data/docs/superpowers/plans/2026-07-16-homepage-depth-upgrade.md +624 -0
  92. data/docs/superpowers/plans/2026-07-16-homepage-depth-upgrade.md.tasks.json +32 -0
  93. data/docs/superpowers/plans/2026-07-31-positioned-drag-and-drop.md +1787 -0
  94. data/docs/superpowers/plans/2026-07-31-positioned-drag-and-drop.md.tasks.json +91 -0
  95. data/docs/superpowers/plans/2026-08-17-async-interactions.md +1414 -0
  96. data/docs/superpowers/plans/2026-08-17-async-interactions.md.tasks.json +66 -0
  97. data/docs/superpowers/specs/2026-07-16-homepage-depth-upgrade-design.md +111 -0
  98. data/docs/superpowers/specs/2026-07-17-action-html-attributes-design.md +124 -0
  99. data/docs/superpowers/specs/2026-07-31-positioned-drag-and-drop-design.md +506 -0
  100. data/docs/superpowers/specs/2026-08-17-async-interactions-design.md +185 -0
  101. data/gemfiles/postgres.gemfile.lock +85 -85
  102. data/gemfiles/rails_7.gemfile.lock +322 -140
  103. data/gemfiles/rails_8.0.gemfile.lock +125 -115
  104. data/gemfiles/rails_8.1.gemfile.lock +126 -116
  105. data/lib/generators/pu/async_interactions/install_generator.rb +111 -0
  106. data/lib/generators/pu/async_interactions/templates/app/controllers/async_runs_controller.rb.tt +15 -0
  107. data/lib/generators/pu/core/typespec/typespec_generator.rb +7 -4
  108. data/lib/generators/pu/invites/install_generator.rb +3 -3
  109. data/lib/generators/pu/invites/templates/packages/invites/app/views/layouts/invites/invitation.html.erb.tt +2 -2
  110. data/lib/generators/pu/lib/plutonium_generators/concerns/mounts_engines.rb +47 -2
  111. data/lib/generators/pu/lib/plutonium_generators/concerns/resource_registration.rb +41 -0
  112. data/lib/generators/pu/lite/litestream/litestream_generator.rb +1 -1
  113. data/lib/generators/pu/lite/solid_queue/solid_queue_generator.rb +1 -1
  114. data/lib/generators/pu/res/conn/conn_generator.rb +19 -39
  115. data/lib/generators/pu/res/conn/templates/app/controllers/resource_controller.rb.tt +4 -0
  116. data/lib/generators/pu/rodauth/templates/app/rodauth/account_rodauth_plugin.rb.tt +15 -6
  117. data/lib/generators/pu/rodauth/templates/app/rodauth/rodauth_plugin.rb.tt +7 -0
  118. data/lib/generators/pu/saas/welcome/templates/app/views/layouts/welcome.html.erb.tt +2 -2
  119. data/lib/generators/pu/wizards/install_generator.rb +78 -0
  120. data/lib/plutonium/action/base.rb +71 -9
  121. data/lib/plutonium/action/interactive.rb +9 -0
  122. data/lib/plutonium/attachments.rb +254 -0
  123. data/lib/plutonium/configuration.rb +82 -1
  124. data/lib/plutonium/core/controller.rb +50 -7
  125. data/lib/plutonium/core/controllers/authorizable.rb +16 -0
  126. data/lib/plutonium/core/controllers/entity_scoping.rb +12 -2
  127. data/lib/plutonium/definition/base.rb +51 -0
  128. data/lib/plutonium/definition/display_layout.rb +112 -0
  129. data/lib/plutonium/definition/index_views.rb +8 -7
  130. data/lib/plutonium/definition/input_aliases.rb +38 -0
  131. data/lib/plutonium/definition/page_widths.rb +65 -0
  132. data/lib/plutonium/definition/positioning.rb +126 -0
  133. data/lib/plutonium/definition/sorting.rb +17 -2
  134. data/lib/plutonium/helpers/turbo_helper.rb +7 -0
  135. data/lib/plutonium/interaction/README.md +61 -24
  136. data/lib/plutonium/interaction/async/configuration.rb +38 -0
  137. data/lib/plutonium/interaction/async/context.rb +419 -0
  138. data/lib/plutonium/interaction/async/executor.rb +422 -0
  139. data/lib/plutonium/interaction/async/job.rb +80 -0
  140. data/lib/plutonium/interaction/async/reap_job.rb +81 -0
  141. data/lib/plutonium/interaction/async/run.rb +394 -0
  142. data/lib/plutonium/interaction/async/run_definition.rb +155 -0
  143. data/lib/plutonium/interaction/async/run_policy.rb +86 -0
  144. data/lib/plutonium/interaction/base.rb +34 -7
  145. data/lib/plutonium/interaction/concerns/dispatchable.rb +518 -0
  146. data/lib/plutonium/interaction/concerns/scoping.rb +70 -9
  147. data/lib/plutonium/interaction/response/redirect.rb +11 -3
  148. data/lib/plutonium/kanban/board.rb +14 -0
  149. data/lib/plutonium/kanban/column.rb +4 -2
  150. data/lib/plutonium/kanban/dsl.rb +4 -1
  151. data/lib/plutonium/kanban/grouping.rb +9 -22
  152. data/lib/plutonium/kanban/positioning.rb +5 -65
  153. data/lib/plutonium/positioning/config.rb +94 -0
  154. data/lib/plutonium/positioning/model.rb +128 -0
  155. data/lib/plutonium/positioning.rb +25 -86
  156. data/lib/plutonium/railtie.rb +1 -0
  157. data/lib/plutonium/resource/controller.rb +118 -38
  158. data/lib/plutonium/resource/controllers/crud_actions/index_action.rb +32 -2
  159. data/lib/plutonium/resource/controllers/crud_actions.rb +30 -2
  160. data/lib/plutonium/resource/controllers/eager_loading.rb +87 -0
  161. data/lib/plutonium/resource/controllers/export_csv.rb +10 -1
  162. data/lib/plutonium/resource/controllers/kanban_actions.rb +53 -14
  163. data/lib/plutonium/resource/controllers/position_actions.rb +390 -0
  164. data/lib/plutonium/resource/controllers/presentable.rb +19 -13
  165. data/lib/plutonium/resource/controllers/queryable.rb +5 -1
  166. data/lib/plutonium/resource/controllers/wizard_actions.rb +21 -0
  167. data/lib/plutonium/resource/policy.rb +33 -0
  168. data/lib/plutonium/resource/query_object.rb +36 -0
  169. data/lib/plutonium/routing/mapper_extensions.rb +100 -8
  170. data/lib/plutonium/routing/route_set_extensions.rb +15 -1
  171. data/lib/plutonium/routing/wizard_registration.rb +4 -0
  172. data/lib/plutonium/testing/resource_policy.rb +6 -2
  173. data/lib/plutonium/ui/action_button.rb +12 -7
  174. data/lib/plutonium/ui/actions_dropdown.rb +1 -1
  175. data/lib/plutonium/ui/block.rb +21 -1
  176. data/lib/plutonium/ui/breadcrumbs.rb +187 -55
  177. data/lib/plutonium/ui/component/methods.rb +5 -0
  178. data/lib/plutonium/ui/component/positionable.rb +112 -0
  179. data/lib/plutonium/ui/component/resolves_tags.rb +57 -0
  180. data/lib/plutonium/ui/component/section.rb +185 -0
  181. data/lib/plutonium/ui/display/base.rb +13 -1
  182. data/lib/plutonium/ui/display/components/formatted_value.rb +26 -0
  183. data/lib/plutonium/ui/display/components/section.rb +18 -0
  184. data/lib/plutonium/ui/display/resource.rb +141 -22
  185. data/lib/plutonium/ui/display/theme.rb +20 -1
  186. data/lib/plutonium/ui/export_button.rb +1 -1
  187. data/lib/plutonium/ui/form/base.rb +8 -7
  188. data/lib/plutonium/ui/form/components/intl_tel_input.rb +1 -1
  189. data/lib/plutonium/ui/form/components/section.rb +7 -62
  190. data/lib/plutonium/ui/form/components/uppy.rb +12 -1
  191. data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +16 -3
  192. data/lib/plutonium/ui/form/concerns/renders_structured_inputs.rb +5 -1
  193. data/lib/plutonium/ui/form/query.rb +2 -4
  194. data/lib/plutonium/ui/form/resource.rb +92 -15
  195. data/lib/plutonium/ui/form/theme.rb +17 -0
  196. data/lib/plutonium/ui/form/wizard.rb +25 -1
  197. data/lib/plutonium/ui/grid/card.rb +79 -11
  198. data/lib/plutonium/ui/grid/resource.rb +47 -5
  199. data/lib/plutonium/ui/interaction/async/run_progress.rb +227 -0
  200. data/lib/plutonium/ui/interaction/async/running_banner.rb +65 -0
  201. data/lib/plutonium/ui/kanban/card.rb +2 -1
  202. data/lib/plutonium/ui/kanban/column.rb +12 -6
  203. data/lib/plutonium/ui/kanban/resource.rb +6 -7
  204. data/lib/plutonium/ui/layout/base.rb +10 -3
  205. data/lib/plutonium/ui/nav_grid_menu.rb +1 -0
  206. data/lib/plutonium/ui/page/base.rb +19 -0
  207. data/lib/plutonium/ui/page/edit.rb +4 -1
  208. data/lib/plutonium/ui/page/index.rb +69 -18
  209. data/lib/plutonium/ui/page/interactive_action.rb +5 -1
  210. data/lib/plutonium/ui/page/new.rb +4 -1
  211. data/lib/plutonium/ui/page/show.rb +27 -10
  212. data/lib/plutonium/ui/page/wizard.rb +10 -1
  213. data/lib/plutonium/ui/page/wizard_chooser.rb +36 -11
  214. data/lib/plutonium/ui/page_width.rb +58 -0
  215. data/lib/plutonium/ui/table/base.rb +34 -1
  216. data/lib/plutonium/ui/table/components/attachment.rb +1 -1
  217. data/lib/plutonium/ui/table/components/bulk_actions_toolbar.rb +32 -8
  218. data/lib/plutonium/ui/table/components/drag_handle.rb +120 -0
  219. data/lib/plutonium/ui/table/components/filter_form.rb +1 -4
  220. data/lib/plutonium/ui/table/components/filter_pills.rb +1 -1
  221. data/lib/plutonium/ui/table/components/row_actions_dropdown.rb +1 -1
  222. data/lib/plutonium/ui/table/resource.rb +50 -5
  223. data/lib/plutonium/ui/table/theme.rb +59 -2
  224. data/lib/plutonium/ui/wizard/review.rb +4 -2
  225. data/lib/plutonium/ui/wizard/summary_display.rb +42 -14
  226. data/lib/plutonium/version.rb +1 -1
  227. data/lib/plutonium/wizard/attachments.rb +32 -197
  228. data/lib/plutonium/wizard/base.rb +6 -1
  229. data/lib/plutonium/wizard/configuration.rb +12 -0
  230. data/lib/plutonium/wizard/controller.rb +14 -0
  231. data/lib/plutonium/wizard/driving.rb +99 -15
  232. data/lib/plutonium/wizard/dsl.rb +23 -0
  233. data/lib/plutonium/wizard/resume.rb +127 -49
  234. data/lib/plutonium/wizard/runner.rb +46 -2
  235. data/lib/plutonium/wizard/step_adapter.rb +1 -1
  236. data/lib/plutonium/wizard/sweep_job.rb +16 -0
  237. data/lib/plutonium.rb +21 -0
  238. data/lib/rodauth/features/session_isolation.rb +92 -0
  239. data/lib/rodauth/plugins.rb +1 -0
  240. data/package.json +2 -1
  241. data/plutonium.gemspec +29 -11
  242. data/src/css/components.css +89 -1
  243. data/src/css/slim_select.css +20 -0
  244. data/src/js/controllers/breadcrumbs_controller.js +112 -0
  245. data/src/js/controllers/bulk_actions_controller.js +10 -2
  246. data/src/js/controllers/kanban_controller.js +30 -21
  247. data/src/js/controllers/positioned_controller.js +452 -0
  248. data/src/js/controllers/register_controllers.js +6 -0
  249. data/src/js/controllers/resource_drop_down_controller.js +5 -0
  250. data/src/js/controllers/run_progress_controller.js +73 -0
  251. data/src/js/drag/sortable.js +186 -0
  252. data/yarn.lock +108 -63
  253. metadata +103 -16
  254. data/docs/.vitepress/theme/components/HomeAudienceSplit.vue +0 -53
  255. data/docs/.vitepress/theme/components/HomePillars.vue +0 -42
@@ -1,7 +1,7 @@
1
- (()=>{var ub=Object.create;var Ih=Object.defineProperty;var hb=Object.getOwnPropertyDescriptor;var db=Object.getOwnPropertyNames;var pb=Object.getPrototypeOf,fb=Object.prototype.hasOwnProperty;var Se=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var mb=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of db(e))!fb.call(i,s)&&s!==t&&Ih(i,s,{get:()=>e[s],enumerable:!(r=hb(e,s))||r.enumerable});return i};var be=(i,e,t)=>(t=i!=null?ub(pb(i)):{},mb(e||!i||!i.__esModule?Ih(t,"default",{value:i,enumerable:!0}):t,i));var Xo=Se(($A,wf)=>{function qw(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}wf.exports=qw});var Ef=Se((VA,Sf)=>{var $w=typeof global=="object"&&global&&global.Object===Object&&global;Sf.exports=$w});var pu=Se((WA,Tf)=>{var Vw=Ef(),Ww=typeof self=="object"&&self&&self.Object===Object&&self,Gw=Vw||Ww||Function("return this")();Tf.exports=Gw});var kf=Se((GA,xf)=>{var Kw=pu(),Yw=function(){return Kw.Date.now()};xf.exports=Yw});var Cf=Se((KA,_f)=>{var Xw=/\s/;function Zw(i){for(var e=i.length;e--&&Xw.test(i.charAt(e)););return e}_f.exports=Zw});var Pf=Se((YA,Af)=>{var Qw=Cf(),Jw=/^\s+/;function e1(i){return i&&i.slice(0,Qw(i)+1).replace(Jw,"")}Af.exports=e1});var fu=Se((XA,Ff)=>{var t1=pu(),i1=t1.Symbol;Ff.exports=i1});var Mf=Se((ZA,Rf)=>{var Of=fu(),Lf=Object.prototype,r1=Lf.hasOwnProperty,s1=Lf.toString,Js=Of?Of.toStringTag:void 0;function n1(i){var e=r1.call(i,Js),t=i[Js];try{i[Js]=void 0;var r=!0}catch{}var s=s1.call(i);return r&&(e?i[Js]=t:delete i[Js]),s}Rf.exports=n1});var Df=Se((QA,If)=>{var o1=Object.prototype,a1=o1.toString;function l1(i){return a1.call(i)}If.exports=l1});var zf=Se((JA,Uf)=>{var Nf=fu(),c1=Mf(),u1=Df(),h1="[object Null]",d1="[object Undefined]",Bf=Nf?Nf.toStringTag:void 0;function p1(i){return i==null?i===void 0?d1:h1:Bf&&Bf in Object(i)?c1(i):u1(i)}Uf.exports=p1});var jf=Se((e5,Hf)=>{function f1(i){return i!=null&&typeof i=="object"}Hf.exports=f1});var $f=Se((t5,qf)=>{var m1=zf(),g1=jf(),b1="[object Symbol]";function y1(i){return typeof i=="symbol"||g1(i)&&m1(i)==b1}qf.exports=y1});var Kf=Se((i5,Gf)=>{var v1=Pf(),Vf=Xo(),w1=$f(),Wf=NaN,S1=/^[-+]0x[0-9a-f]+$/i,E1=/^0b[01]+$/i,T1=/^0o[0-7]+$/i,x1=parseInt;function k1(i){if(typeof i=="number")return i;if(w1(i))return Wf;if(Vf(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Vf(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=v1(i);var t=E1.test(i);return t||T1.test(i)?x1(i.slice(2),t?2:8):S1.test(i)?Wf:+i}Gf.exports=k1});var gu=Se((r5,Xf)=>{var _1=Xo(),mu=kf(),Yf=Kf(),C1="Expected a function",A1=Math.max,P1=Math.min;function F1(i,e,t){var r,s,n,o,a,l,h=0,m=!1,g=!1,E=!0;if(typeof i!="function")throw new TypeError(C1);e=Yf(e)||0,_1(t)&&(m=!!t.leading,g="maxWait"in t,n=g?A1(Yf(t.maxWait)||0,e):n,E="trailing"in t?!!t.trailing:E);function w(P){var I=r,B=s;return r=s=void 0,h=P,o=i.apply(B,I),o}function F(P){return h=P,a=setTimeout(D,e),m?w(P):o}function L(P){var I=P-l,B=P-h,U=e-I;return g?P1(U,n-B):U}function M(P){var I=P-l,B=P-h;return l===void 0||I>=e||I<0||g&&B>=n}function D(){var P=mu();if(M(P))return A(P);a=setTimeout(D,L(P))}function A(P){return a=void 0,E&&r?w(P):(r=s=void 0,o)}function R(){a!==void 0&&clearTimeout(a),h=0,r=l=s=a=void 0}function T(){return a===void 0?o:A(mu())}function x(){var P=mu(),I=M(P);if(r=arguments,s=this,l=P,I){if(a===void 0)return F(l);if(g)return clearTimeout(a),a=setTimeout(D,e),w(l)}return a===void 0&&(a=setTimeout(D,e)),o}return x.cancel=R,x.flush=T,x}Xf.exports=F1});var Qf=Se((s5,Zf)=>{var O1=gu(),L1=Xo(),R1="Expected a function";function M1(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(R1);return L1(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),O1(i,e,{leading:r,maxWait:e,trailing:s})}Zf.exports=M1});var em=Se((n5,Jf)=>{Jf.exports=function(){var e={},t=e._fns={};e.emit=function(o,a,l,h,m,g,E){var w=r(o);w.length&&s(o,w,[a,l,h,m,g,E])},e.on=function(o,a){t[o]||(t[o]=[]),t[o].push(a)},e.once=function(o,a){function l(){a.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,a){var l=[];if(o&&a){var h=this._fns[o],m=0,g=h?h.length:0;for(m;m<g;m++)h[m]!==a&&l.push(h[m])}l.length?this._fns[o]=l:delete this._fns[o]};function r(n){var o=t[n]?t[n]:[],a=n.indexOf(":"),l=a===-1?[n]:[n.substring(0,a),n.substring(a+1)],h=Object.keys(t),m=0,g=h.length;for(m;m<g;m++){var E=h[m];if(E==="*"&&(o=o.concat(t[E])),l.length===2&&l[0]===E){o=o.concat(t[E]);break}}return o}function s(n,o,a){var l=0,h=o.length;for(l;l<h&&o[l];l++)o[l].event=n,o[l].apply(o[l],a)}return e}});var Zo=Se((u5,rm)=>{"use strict";rm.exports=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=Math.abs(e);if(t&&(r=-r),r===0)return"0 B";let s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(r)/Math.log(1024)),s.length-1),o=Number(r/1024**n),a=s[n];return`${o>=10||o%1===0?Math.round(o):o.toFixed(1)} ${a}`}});var om=Se((h5,nm)=>{"use strict";function sm(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}sm.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};nm.exports=function(i,e,t){var r=new sm(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var lm=Se((d5,am)=>{var N1=om(),B1=/[\/\+\.]/;am.exports=function(i,e){function t(r){var s=N1(r,i,B1);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var nt=Se((S2,ra)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(s=r(s,t(o)))}return s}function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var o in s)i.call(s,o)&&s[o]&&(n=r(n,o));return n}function r(s,n){return n?s?s+" "+n:s+n:s}typeof ra<"u"&&ra.exports?(e.default=e,ra.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Em=Se((aP,xu)=>{"use strict";var hS=Object.prototype.hasOwnProperty,ot="~";function on(){}Object.create&&(on.prototype=Object.create(null),new on().__proto__||(ot=!1));function dS(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function Sm(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new dS(t,r||i,s),o=ot?ot+e:e;return i._events[o]?i._events[o].fn?i._events[o]=[i._events[o],n]:i._events[o].push(n):(i._events[o]=n,i._eventsCount++),i}function ha(i,e){--i._eventsCount===0?i._events=new on:delete i._events[e]}function Je(){this._events=new on,this._eventsCount=0}Je.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)hS.call(t,r)&&e.push(ot?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Je.prototype.listeners=function(e){var t=ot?ot+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,o=new Array(n);s<n;s++)o[s]=r[s].fn;return o};Je.prototype.listenerCount=function(e){var t=ot?ot+e:e,r=this._events[t];return r?r.fn?1:r.length:0};Je.prototype.emit=function(e,t,r,s,n,o){var a=ot?ot+e:e;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,m,g;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,s),!0;case 5:return l.fn.call(l.context,t,r,s,n),!0;case 6:return l.fn.call(l.context,t,r,s,n,o),!0}for(g=1,m=new Array(h-1);g<h;g++)m[g-1]=arguments[g];l.fn.apply(l.context,m)}else{var E=l.length,w;for(g=0;g<E;g++)switch(l[g].once&&this.removeListener(e,l[g].fn,void 0,!0),h){case 1:l[g].fn.call(l[g].context);break;case 2:l[g].fn.call(l[g].context,t);break;case 3:l[g].fn.call(l[g].context,t,r);break;case 4:l[g].fn.call(l[g].context,t,r,s);break;default:if(!m)for(w=1,m=new Array(h-1);w<h;w++)m[w-1]=arguments[w];l[g].fn.apply(l[g].context,m)}}return!0};Je.prototype.on=function(e,t,r){return Sm(this,e,t,r,!1)};Je.prototype.once=function(e,t,r){return Sm(this,e,t,r,!0)};Je.prototype.removeListener=function(e,t,r,s){var n=ot?ot+e:e;if(!this._events[n])return this;if(!t)return ha(this,n),this;var o=this._events[n];if(o.fn)o.fn===t&&(!s||o.once)&&(!r||o.context===r)&&ha(this,n);else{for(var a=0,l=[],h=o.length;a<h;a++)(o[a].fn!==t||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:ha(this,n)}return this};Je.prototype.removeAllListeners=function(e){var t;return e?(t=ot?ot+e:e,this._events[t]&&ha(this,t)):(this._events=new on,this._eventsCount=0),this};Je.prototype.off=Je.prototype.removeListener;Je.prototype.addListener=Je.prototype.on;Je.prefixed=ot;Je.EventEmitter=Je;typeof xu<"u"&&(xu.exports=Je)});var jg=Se((Sh,Eh)=>{(function(i,e){typeof Sh=="object"&&typeof Eh<"u"?Eh.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(Sh,(function(){"use strict";function i(y,u){var f=Object.keys(y);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(y);u&&(p=p.filter(function(k){return Object.getOwnPropertyDescriptor(y,k).enumerable})),f.push.apply(f,p)}return f}function e(y){for(var u=1;u<arguments.length;u++){var f=arguments[u]!=null?arguments[u]:{};u%2?i(Object(f),!0).forEach(function(p){l(y,p,f[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(f)):i(Object(f)).forEach(function(p){Object.defineProperty(y,p,Object.getOwnPropertyDescriptor(f,p))})}return y}function t(y,u){if(typeof y!="object"||!y)return y;var f=y[Symbol.toPrimitive];if(f!==void 0){var p=f.call(y,u||"default");if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(y)}function r(y){var u=t(y,"string");return typeof u=="symbol"?u:u+""}function s(y){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},s(y)}function n(y,u){if(!(y instanceof u))throw new TypeError("Cannot call a class as a function")}function o(y,u){for(var f=0;f<u.length;f++){var p=u[f];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(y,r(p.key),p)}}function a(y,u,f){return u&&o(y.prototype,u),f&&o(y,f),Object.defineProperty(y,"prototype",{writable:!1}),y}function l(y,u,f){return u=r(u),u in y?Object.defineProperty(y,u,{value:f,enumerable:!0,configurable:!0,writable:!0}):y[u]=f,y}function h(y){return m(y)||g(y)||E(y)||F()}function m(y){if(Array.isArray(y))return w(y)}function g(y){if(typeof Symbol<"u"&&y[Symbol.iterator]!=null||y["@@iterator"]!=null)return Array.from(y)}function E(y,u){if(y){if(typeof y=="string")return w(y,u);var f=Object.prototype.toString.call(y).slice(8,-1);if(f==="Object"&&y.constructor&&(f=y.constructor.name),f==="Map"||f==="Set")return Array.from(y);if(f==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return w(y,u)}}function w(y,u){(u==null||u>y.length)&&(u=y.length);for(var f=0,p=new Array(u);f<u;f++)p[f]=y[f];return p}function F(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var L=typeof window<"u"&&typeof window.document<"u",M=L?window:{},D=L&&M.document.documentElement?"ontouchstart"in M.document.documentElement:!1,A=L?"PointerEvent"in M:!1,R="cropper",T="all",x="crop",P="move",I="zoom",B="e",U="w",j="s",q="n",W="ne",te="nw",ae="se",xe="sw",he="".concat(R,"-crop"),Ce="".concat(R,"-disabled"),pe="".concat(R,"-hidden"),et="".concat(R,"-hide"),Ot="".concat(R,"-invisible"),ee="".concat(R,"-modal"),mt="".concat(R,"-move"),lt="".concat(R,"Action"),Qe="".concat(R,"Preview"),tt="crop",Lt="move",Wt="none",Me="crop",ti="cropend",bi="cropmove",ie="cropstart",Hi="dblclick",ce=D?"touchstart":"mousedown",Sr=D?"touchmove":"mousemove",ue=D?"touchend touchcancel":"mouseup",Rt=A?"pointerdown":ce,yi=A?"pointermove":Sr,gt=A?"pointerup pointercancel":ue,ji="ready",ct="resize",Gt="wheel",ii="zoom",ut="image/jpeg",Mt=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Tt=/^data:/,vi=/^data:image\/jpeg;base64,/,wi=/^img|canvas$/i,ri=200,Er=100,si={viewMode:0,dragMode:tt,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:ri,minContainerHeight:Er,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Tr='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',xr=Number.isNaN||M.isNaN;function Y(y){return typeof y=="number"&&!xr(y)}var us=function(u){return u>0&&u<1/0};function kr(y){return typeof y>"u"}function It(y){return s(y)==="object"&&y!==null}var hs=Object.prototype.hasOwnProperty;function bt(y){if(!It(y))return!1;try{var u=y.constructor,f=u.prototype;return u&&f&&hs.call(f,"isPrototypeOf")}catch{return!1}}function de(y){return typeof y=="function"}var ds=Array.prototype.slice;function ps(y){return Array.from?Array.from(y):ds.call(y)}function me(y,u){return y&&de(u)&&(Array.isArray(y)||Y(y.length)?ps(y).forEach(function(f,p){u.call(y,f,p,y)}):It(y)&&Object.keys(y).forEach(function(f){u.call(y,y[f],f,y)})),y}var le=Object.assign||function(u){for(var f=arguments.length,p=new Array(f>1?f-1:0),k=1;k<f;k++)p[k-1]=arguments[k];return It(u)&&p.length>0&&p.forEach(function(S){It(S)&&Object.keys(S).forEach(function(b){u[b]=S[b]})}),u},Mn=/\.\d*(?:0|9){12}\d*$/;function Dt(y){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Mn.test(y)?Math.round(y*u)/u:y}var _r=/^width|height|left|top|marginLeft|marginTop$/;function Ie(y,u){var f=y.style;me(u,function(p,k){_r.test(k)&&Y(p)&&(p="".concat(p,"px")),f[k]=p})}function Si(y,u){return y.classList?y.classList.contains(u):y.className.indexOf(u)>-1}function we(y,u){if(u){if(Y(y.length)){me(y,function(p){we(p,u)});return}if(y.classList){y.classList.add(u);return}var f=y.className.trim();f?f.indexOf(u)<0&&(y.className="".concat(f," ").concat(u)):y.className=u}}function ht(y,u){if(u){if(Y(y.length)){me(y,function(f){ht(f,u)});return}if(y.classList){y.classList.remove(u);return}y.className.indexOf(u)>=0&&(y.className=y.className.replace(u,""))}}function Ei(y,u,f){if(u){if(Y(y.length)){me(y,function(p){Ei(p,u,f)});return}f?we(y,u):ht(y,u)}}var In=/([a-z\d])([A-Z])/g;function qi(y){return y.replace(In,"$1-$2").toLowerCase()}function Cr(y,u){return It(y[u])?y[u]:y.dataset?y.dataset[u]:y.getAttribute("data-".concat(qi(u)))}function ni(y,u,f){It(f)?y[u]=f:y.dataset?y.dataset[u]=f:y.setAttribute("data-".concat(qi(u)),f)}function nl(y,u){if(It(y[u]))try{delete y[u]}catch{y[u]=void 0}else if(y.dataset)try{delete y.dataset[u]}catch{y.dataset[u]=void 0}else y.removeAttribute("data-".concat(qi(u)))}var Ti=/\s\s*/,Dn=(function(){var y=!1;if(L){var u=!1,f=function(){},p=Object.defineProperty({},"once",{get:function(){return y=!0,u},set:function(S){u=S}});M.addEventListener("test",f,p),M.removeEventListener("test",f,p)}return y})();function yt(y,u,f){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},k=f;u.trim().split(Ti).forEach(function(S){if(!Dn){var b=y.listeners;b&&b[S]&&b[S][f]&&(k=b[S][f],delete b[S][f],Object.keys(b[S]).length===0&&delete b[S],Object.keys(b).length===0&&delete y.listeners)}y.removeEventListener(S,k,p)})}function Z(y,u,f){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},k=f;u.trim().split(Ti).forEach(function(S){if(p.once&&!Dn){var b=y.listeners,d=b===void 0?{}:b;k=function(){delete d[S][f],y.removeEventListener(S,k,p);for(var _=arguments.length,C=new Array(_),O=0;O<_;O++)C[O]=arguments[O];f.apply(y,C)},d[S]||(d[S]={}),d[S][f]&&y.removeEventListener(S,d[S][f],p),d[S][f]=k,y.listeners=d}y.addEventListener(S,k,p)})}function vt(y,u,f){var p;return de(Event)&&de(CustomEvent)?p=new CustomEvent(u,{detail:f,bubbles:!0,cancelable:!0}):(p=document.createEvent("CustomEvent"),p.initCustomEvent(u,!0,!0,f)),y.dispatchEvent(p)}function Nn(y){var u=y.getBoundingClientRect();return{left:u.left+(window.pageXOffset-document.documentElement.clientLeft),top:u.top+(window.pageYOffset-document.documentElement.clientTop)}}var Ar=M.location,fs=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function ms(y){var u=y.match(fs);return u!==null&&(u[1]!==Ar.protocol||u[2]!==Ar.hostname||u[3]!==Ar.port)}function gs(y){var u="timestamp=".concat(new Date().getTime());return y+(y.indexOf("?")===-1?"?":"&")+u}function $i(y){var u=y.rotate,f=y.scaleX,p=y.scaleY,k=y.translateX,S=y.translateY,b=[];Y(k)&&k!==0&&b.push("translateX(".concat(k,"px)")),Y(S)&&S!==0&&b.push("translateY(".concat(S,"px)")),Y(u)&&u!==0&&b.push("rotate(".concat(u,"deg)")),Y(f)&&f!==1&&b.push("scaleX(".concat(f,")")),Y(p)&&p!==1&&b.push("scaleY(".concat(p,")"));var d=b.length?b.join(" "):"none";return{WebkitTransform:d,msTransform:d,transform:d}}function ol(y){var u=e({},y),f=0;return me(y,function(p,k){delete u[k],me(u,function(S){var b=Math.abs(p.startX-S.startX),d=Math.abs(p.startY-S.startY),v=Math.abs(p.endX-S.endX),_=Math.abs(p.endY-S.endY),C=Math.sqrt(b*b+d*d),O=Math.sqrt(v*v+_*_),N=(O-C)/C;Math.abs(N)>Math.abs(f)&&(f=N)})}),f}function Pr(y,u){var f=y.pageX,p=y.pageY,k={endX:f,endY:p};return u?k:e({startX:f,startY:p},k)}function al(y){var u=0,f=0,p=0;return me(y,function(k){var S=k.startX,b=k.startY;u+=S,f+=b,p+=1}),u/=p,f/=p,{pageX:u,pageY:f}}function $e(y){var u=y.aspectRatio,f=y.height,p=y.width,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",S=us(p),b=us(f);if(S&&b){var d=f*u;k==="contain"&&d>p||k==="cover"&&d<p?f=p/u:p=f*u}else S?f=p/u:b&&(p=f*u);return{width:p,height:f}}function Bn(y){var u=y.width,f=y.height,p=y.degree;if(p=Math.abs(p)%180,p===90)return{width:f,height:u};var k=p%90*Math.PI/180,S=Math.sin(k),b=Math.cos(k),d=u*b+f*S,v=u*S+f*b;return p>90?{width:v,height:d}:{width:d,height:v}}function oi(y,u,f,p){var k=u.aspectRatio,S=u.naturalWidth,b=u.naturalHeight,d=u.rotate,v=d===void 0?0:d,_=u.scaleX,C=_===void 0?1:_,O=u.scaleY,N=O===void 0?1:O,V=f.aspectRatio,$=f.naturalWidth,X=f.naturalHeight,K=p.fillColor,ge=K===void 0?"transparent":K,Q=p.imageSmoothingEnabled,Ae=Q===void 0?!0:Q,ai=p.imageSmoothingQuality,wt=ai===void 0?"low":ai,z=p.maxWidth,re=z===void 0?1/0:z,De=p.maxHeight,xt=De===void 0?1/0:De,li=p.minWidth,Wi=li===void 0?0:li,Gi=p.minHeight,ki=Gi===void 0?0:Gi,Kt=document.createElement("canvas"),dt=Kt.getContext("2d"),Ki=$e({aspectRatio:V,width:re,height:xt}),Vn=$e({aspectRatio:V,width:Wi,height:ki},"cover"),hl=Math.min(Ki.width,Math.max(Vn.width,$)),dl=Math.min(Ki.height,Math.max(Vn.height,X)),Oh=$e({aspectRatio:k,width:re,height:xt}),Lh=$e({aspectRatio:k,width:Wi,height:ki},"cover"),Rh=Math.min(Oh.width,Math.max(Lh.width,S)),Mh=Math.min(Oh.height,Math.max(Lh.height,b)),lb=[-Rh/2,-Mh/2,Rh,Mh];return Kt.width=Dt(hl),Kt.height=Dt(dl),dt.fillStyle=ge,dt.fillRect(0,0,hl,dl),dt.save(),dt.translate(hl/2,dl/2),dt.rotate(v*Math.PI/180),dt.scale(C,N),dt.imageSmoothingEnabled=Ae,dt.imageSmoothingQuality=wt,dt.drawImage.apply(dt,[y].concat(h(lb.map(function(cb){return Math.floor(Dt(cb))})))),dt.restore(),Kt}var Un=String.fromCharCode;function ll(y,u,f){var p="";f+=u;for(var k=u;k<f;k+=1)p+=Un(y.getUint8(k));return p}var zn=/^data:.*,/;function Hn(y){var u=y.replace(zn,""),f=atob(u),p=new ArrayBuffer(f.length),k=new Uint8Array(p);return me(k,function(S,b){k[b]=f.charCodeAt(b)}),p}function Fr(y,u){for(var f=[],p=8192,k=new Uint8Array(y);k.length>0;)f.push(Un.apply(null,ps(k.subarray(0,p)))),k=k.subarray(p);return"data:".concat(u,";base64,").concat(btoa(f.join("")))}function bs(y){var u=new DataView(y),f;try{var p,k,S;if(u.getUint8(0)===255&&u.getUint8(1)===216)for(var b=u.byteLength,d=2;d+1<b;){if(u.getUint8(d)===255&&u.getUint8(d+1)===225){k=d;break}d+=1}if(k){var v=k+4,_=k+10;if(ll(u,v,4)==="Exif"){var C=u.getUint16(_);if(p=C===18761,(p||C===19789)&&u.getUint16(_+2,p)===42){var O=u.getUint32(_+4,p);O>=8&&(S=_+O)}}}if(S){var N=u.getUint16(S,p),V,$;for($=0;$<N;$+=1)if(V=S+$*12+2,u.getUint16(V,p)===274){V+=8,f=u.getUint16(V,p),u.setUint16(V,1,p);break}}}catch{f=1}return f}function Or(y){var u=0,f=1,p=1;switch(y){case 2:f=-1;break;case 3:u=-180;break;case 4:p=-1;break;case 5:u=90,p=-1;break;case 6:u=90;break;case 7:u=90,f=-1;break;case 8:u=-90;break}return{rotate:u,scaleX:f,scaleY:p}}var xi={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var u=this.element,f=this.options,p=this.container,k=this.cropper,S=Number(f.minContainerWidth),b=Number(f.minContainerHeight);we(k,pe),ht(u,pe);var d={width:Math.max(p.offsetWidth,S>=0?S:ri),height:Math.max(p.offsetHeight,b>=0?b:Er)};this.containerData=d,Ie(k,{width:d.width,height:d.height}),we(u,pe),ht(k,pe)},initCanvas:function(){var u=this.containerData,f=this.imageData,p=this.options.viewMode,k=Math.abs(f.rotate)%180===90,S=k?f.naturalHeight:f.naturalWidth,b=k?f.naturalWidth:f.naturalHeight,d=S/b,v=u.width,_=u.height;u.height*d>u.width?p===3?v=u.height*d:_=u.width/d:p===3?_=u.width/d:v=u.height*d;var C={aspectRatio:d,naturalWidth:S,naturalHeight:b,width:v,height:_};this.canvasData=C,this.limited=p===1||p===2,this.limitCanvas(!0,!0),C.width=Math.min(Math.max(C.width,C.minWidth),C.maxWidth),C.height=Math.min(Math.max(C.height,C.minHeight),C.maxHeight),C.left=(u.width-C.width)/2,C.top=(u.height-C.height)/2,C.oldLeft=C.left,C.oldTop=C.top,this.initialCanvasData=le({},C)},limitCanvas:function(u,f){var p=this.options,k=this.containerData,S=this.canvasData,b=this.cropBoxData,d=p.viewMode,v=S.aspectRatio,_=this.cropped&&b;if(u){var C=Number(p.minCanvasWidth)||0,O=Number(p.minCanvasHeight)||0;d>1?(C=Math.max(C,k.width),O=Math.max(O,k.height),d===3&&(O*v>C?C=O*v:O=C/v)):d>0&&(C?C=Math.max(C,_?b.width:0):O?O=Math.max(O,_?b.height:0):_&&(C=b.width,O=b.height,O*v>C?C=O*v:O=C/v));var N=$e({aspectRatio:v,width:C,height:O});C=N.width,O=N.height,S.minWidth=C,S.minHeight=O,S.maxWidth=1/0,S.maxHeight=1/0}if(f)if(d>(_?0:1)){var V=k.width-S.width,$=k.height-S.height;S.minLeft=Math.min(0,V),S.minTop=Math.min(0,$),S.maxLeft=Math.max(0,V),S.maxTop=Math.max(0,$),_&&this.limited&&(S.minLeft=Math.min(b.left,b.left+(b.width-S.width)),S.minTop=Math.min(b.top,b.top+(b.height-S.height)),S.maxLeft=b.left,S.maxTop=b.top,d===2&&(S.width>=k.width&&(S.minLeft=Math.min(0,V),S.maxLeft=Math.max(0,V)),S.height>=k.height&&(S.minTop=Math.min(0,$),S.maxTop=Math.max(0,$))))}else S.minLeft=-S.width,S.minTop=-S.height,S.maxLeft=k.width,S.maxTop=k.height},renderCanvas:function(u,f){var p=this.canvasData,k=this.imageData;if(f){var S=Bn({width:k.naturalWidth*Math.abs(k.scaleX||1),height:k.naturalHeight*Math.abs(k.scaleY||1),degree:k.rotate||0}),b=S.width,d=S.height,v=p.width*(b/p.naturalWidth),_=p.height*(d/p.naturalHeight);p.left-=(v-p.width)/2,p.top-=(_-p.height)/2,p.width=v,p.height=_,p.aspectRatio=b/d,p.naturalWidth=b,p.naturalHeight=d,this.limitCanvas(!0,!1)}(p.width>p.maxWidth||p.width<p.minWidth)&&(p.left=p.oldLeft),(p.height>p.maxHeight||p.height<p.minHeight)&&(p.top=p.oldTop),p.width=Math.min(Math.max(p.width,p.minWidth),p.maxWidth),p.height=Math.min(Math.max(p.height,p.minHeight),p.maxHeight),this.limitCanvas(!1,!0),p.left=Math.min(Math.max(p.left,p.minLeft),p.maxLeft),p.top=Math.min(Math.max(p.top,p.minTop),p.maxTop),p.oldLeft=p.left,p.oldTop=p.top,Ie(this.canvas,le({width:p.width,height:p.height},$i({translateX:p.left,translateY:p.top}))),this.renderImage(u),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(u){var f=this.canvasData,p=this.imageData,k=p.naturalWidth*(f.width/f.naturalWidth),S=p.naturalHeight*(f.height/f.naturalHeight);le(p,{width:k,height:S,left:(f.width-k)/2,top:(f.height-S)/2}),Ie(this.image,le({width:p.width,height:p.height},$i(le({translateX:p.left,translateY:p.top},p)))),u&&this.output()},initCropBox:function(){var u=this.options,f=this.canvasData,p=u.aspectRatio||u.initialAspectRatio,k=Number(u.autoCropArea)||.8,S={width:f.width,height:f.height};p&&(f.height*p>f.width?S.height=S.width/p:S.width=S.height*p),this.cropBoxData=S,this.limitCropBox(!0,!0),S.width=Math.min(Math.max(S.width,S.minWidth),S.maxWidth),S.height=Math.min(Math.max(S.height,S.minHeight),S.maxHeight),S.width=Math.max(S.minWidth,S.width*k),S.height=Math.max(S.minHeight,S.height*k),S.left=f.left+(f.width-S.width)/2,S.top=f.top+(f.height-S.height)/2,S.oldLeft=S.left,S.oldTop=S.top,this.initialCropBoxData=le({},S)},limitCropBox:function(u,f){var p=this.options,k=this.containerData,S=this.canvasData,b=this.cropBoxData,d=this.limited,v=p.aspectRatio;if(u){var _=Number(p.minCropBoxWidth)||0,C=Number(p.minCropBoxHeight)||0,O=d?Math.min(k.width,S.width,S.width+S.left,k.width-S.left):k.width,N=d?Math.min(k.height,S.height,S.height+S.top,k.height-S.top):k.height;_=Math.min(_,k.width),C=Math.min(C,k.height),v&&(_&&C?C*v>_?C=_/v:_=C*v:_?C=_/v:C&&(_=C*v),N*v>O?N=O/v:O=N*v),b.minWidth=Math.min(_,O),b.minHeight=Math.min(C,N),b.maxWidth=O,b.maxHeight=N}f&&(d?(b.minLeft=Math.max(0,S.left),b.minTop=Math.max(0,S.top),b.maxLeft=Math.min(k.width,S.left+S.width)-b.width,b.maxTop=Math.min(k.height,S.top+S.height)-b.height):(b.minLeft=0,b.minTop=0,b.maxLeft=k.width-b.width,b.maxTop=k.height-b.height))},renderCropBox:function(){var u=this.options,f=this.containerData,p=this.cropBoxData;(p.width>p.maxWidth||p.width<p.minWidth)&&(p.left=p.oldLeft),(p.height>p.maxHeight||p.height<p.minHeight)&&(p.top=p.oldTop),p.width=Math.min(Math.max(p.width,p.minWidth),p.maxWidth),p.height=Math.min(Math.max(p.height,p.minHeight),p.maxHeight),this.limitCropBox(!1,!0),p.left=Math.min(Math.max(p.left,p.minLeft),p.maxLeft),p.top=Math.min(Math.max(p.top,p.minTop),p.maxTop),p.oldLeft=p.left,p.oldTop=p.top,u.movable&&u.cropBoxMovable&&ni(this.face,lt,p.width>=f.width&&p.height>=f.height?P:T),Ie(this.cropBox,le({width:p.width,height:p.height},$i({translateX:p.left,translateY:p.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),vt(this.element,Me,this.getData())}},Vi={initPreview:function(){var u=this.element,f=this.crossOrigin,p=this.options.preview,k=f?this.crossOriginUrl:this.url,S=u.alt||"The image to preview",b=document.createElement("img");if(f&&(b.crossOrigin=f),b.src=k,b.alt=S,this.viewBox.appendChild(b),this.viewBoxImage=b,!!p){var d=p;typeof p=="string"?d=u.ownerDocument.querySelectorAll(p):p.querySelector&&(d=[p]),this.previews=d,me(d,function(v){var _=document.createElement("img");ni(v,Qe,{width:v.offsetWidth,height:v.offsetHeight,html:v.innerHTML}),f&&(_.crossOrigin=f),_.src=k,_.alt=S,_.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',v.innerHTML="",v.appendChild(_)})}},resetPreview:function(){me(this.previews,function(u){var f=Cr(u,Qe);Ie(u,{width:f.width,height:f.height}),u.innerHTML=f.html,nl(u,Qe)})},preview:function(){var u=this.imageData,f=this.canvasData,p=this.cropBoxData,k=p.width,S=p.height,b=u.width,d=u.height,v=p.left-f.left-u.left,_=p.top-f.top-u.top;!this.cropped||this.disabled||(Ie(this.viewBoxImage,le({width:b,height:d},$i(le({translateX:-v,translateY:-_},u)))),me(this.previews,function(C){var O=Cr(C,Qe),N=O.width,V=O.height,$=N,X=V,K=1;k&&(K=N/k,X=S*K),S&&X>V&&(K=V/S,$=k*K,X=V),Ie(C,{width:$,height:X}),Ie(C.getElementsByTagName("img")[0],le({width:b*K,height:d*K},$i(le({translateX:-v*K,translateY:-_*K},u))))}))}},Nt={bind:function(){var u=this.element,f=this.options,p=this.cropper;de(f.cropstart)&&Z(u,ie,f.cropstart),de(f.cropmove)&&Z(u,bi,f.cropmove),de(f.cropend)&&Z(u,ti,f.cropend),de(f.crop)&&Z(u,Me,f.crop),de(f.zoom)&&Z(u,ii,f.zoom),Z(p,Rt,this.onCropStart=this.cropStart.bind(this)),f.zoomable&&f.zoomOnWheel&&Z(p,Gt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),f.toggleDragModeOnDblclick&&Z(p,Hi,this.onDblclick=this.dblclick.bind(this)),Z(u.ownerDocument,yi,this.onCropMove=this.cropMove.bind(this)),Z(u.ownerDocument,gt,this.onCropEnd=this.cropEnd.bind(this)),f.responsive&&Z(window,ct,this.onResize=this.resize.bind(this))},unbind:function(){var u=this.element,f=this.options,p=this.cropper;de(f.cropstart)&&yt(u,ie,f.cropstart),de(f.cropmove)&&yt(u,bi,f.cropmove),de(f.cropend)&&yt(u,ti,f.cropend),de(f.crop)&&yt(u,Me,f.crop),de(f.zoom)&&yt(u,ii,f.zoom),yt(p,Rt,this.onCropStart),f.zoomable&&f.zoomOnWheel&&yt(p,Gt,this.onWheel,{passive:!1,capture:!0}),f.toggleDragModeOnDblclick&&yt(p,Hi,this.onDblclick),yt(u.ownerDocument,yi,this.onCropMove),yt(u.ownerDocument,gt,this.onCropEnd),f.responsive&&yt(window,ct,this.onResize)}},cl={resize:function(){if(!this.disabled){var u=this.options,f=this.container,p=this.containerData,k=f.offsetWidth/p.width,S=f.offsetHeight/p.height,b=Math.abs(k-1)>Math.abs(S-1)?k:S;if(b!==1){var d,v;u.restore&&(d=this.getCanvasData(),v=this.getCropBoxData()),this.render(),u.restore&&(this.setCanvasData(me(d,function(_,C){d[C]=_*b})),this.setCropBoxData(me(v,function(_,C){v[C]=_*b})))}}},dblclick:function(){this.disabled||this.options.dragMode===Wt||this.setDragMode(Si(this.dragBox,he)?Lt:tt)},wheel:function(u){var f=this,p=Number(this.options.wheelZoomRatio)||.1,k=1;this.disabled||(u.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){f.wheeling=!1},50),u.deltaY?k=u.deltaY>0?1:-1:u.wheelDelta?k=-u.wheelDelta/120:u.detail&&(k=u.detail>0?1:-1),this.zoom(-k*p,u)))},cropStart:function(u){var f=u.buttons,p=u.button;if(!(this.disabled||(u.type==="mousedown"||u.type==="pointerdown"&&u.pointerType==="mouse")&&(Y(f)&&f!==1||Y(p)&&p!==0||u.ctrlKey))){var k=this.options,S=this.pointers,b;u.changedTouches?me(u.changedTouches,function(d){S[d.identifier]=Pr(d)}):S[u.pointerId||0]=Pr(u),Object.keys(S).length>1&&k.zoomable&&k.zoomOnTouch?b=I:b=Cr(u.target,lt),Mt.test(b)&&vt(this.element,ie,{originalEvent:u,action:b})!==!1&&(u.preventDefault(),this.action=b,this.cropping=!1,b===x&&(this.cropping=!0,we(this.dragBox,ee)))}},cropMove:function(u){var f=this.action;if(!(this.disabled||!f)){var p=this.pointers;u.preventDefault(),vt(this.element,bi,{originalEvent:u,action:f})!==!1&&(u.changedTouches?me(u.changedTouches,function(k){le(p[k.identifier]||{},Pr(k,!0))}):le(p[u.pointerId||0]||{},Pr(u,!0)),this.change(u))}},cropEnd:function(u){if(!this.disabled){var f=this.action,p=this.pointers;u.changedTouches?me(u.changedTouches,function(k){delete p[k.identifier]}):delete p[u.pointerId||0],f&&(u.preventDefault(),Object.keys(p).length||(this.action=""),this.cropping&&(this.cropping=!1,Ei(this.dragBox,ee,this.cropped&&this.options.modal)),vt(this.element,ti,{originalEvent:u,action:f}))}}},ul={change:function(u){var f=this.options,p=this.canvasData,k=this.containerData,S=this.cropBoxData,b=this.pointers,d=this.action,v=f.aspectRatio,_=S.left,C=S.top,O=S.width,N=S.height,V=_+O,$=C+N,X=0,K=0,ge=k.width,Q=k.height,Ae=!0,ai;!v&&u.shiftKey&&(v=O&&N?O/N:1),this.limited&&(X=S.minLeft,K=S.minTop,ge=X+Math.min(k.width,p.width,p.left+p.width),Q=K+Math.min(k.height,p.height,p.top+p.height));var wt=b[Object.keys(b)[0]],z={x:wt.endX-wt.startX,y:wt.endY-wt.startY},re=function(xt){switch(xt){case B:V+z.x>ge&&(z.x=ge-V);break;case U:_+z.x<X&&(z.x=X-_);break;case q:C+z.y<K&&(z.y=K-C);break;case j:$+z.y>Q&&(z.y=Q-$);break}};switch(d){case T:_+=z.x,C+=z.y;break;case B:if(z.x>=0&&(V>=ge||v&&(C<=K||$>=Q))){Ae=!1;break}re(B),O+=z.x,O<0&&(d=U,O=-O,_-=O),v&&(N=O/v,C+=(S.height-N)/2);break;case q:if(z.y<=0&&(C<=K||v&&(_<=X||V>=ge))){Ae=!1;break}re(q),N-=z.y,C+=z.y,N<0&&(d=j,N=-N,C-=N),v&&(O=N*v,_+=(S.width-O)/2);break;case U:if(z.x<=0&&(_<=X||v&&(C<=K||$>=Q))){Ae=!1;break}re(U),O-=z.x,_+=z.x,O<0&&(d=B,O=-O,_-=O),v&&(N=O/v,C+=(S.height-N)/2);break;case j:if(z.y>=0&&($>=Q||v&&(_<=X||V>=ge))){Ae=!1;break}re(j),N+=z.y,N<0&&(d=q,N=-N,C-=N),v&&(O=N*v,_+=(S.width-O)/2);break;case W:if(v){if(z.y<=0&&(C<=K||V>=ge)){Ae=!1;break}re(q),N-=z.y,C+=z.y,O=N*v}else re(q),re(B),z.x>=0?V<ge?O+=z.x:z.y<=0&&C<=K&&(Ae=!1):O+=z.x,z.y<=0?C>K&&(N-=z.y,C+=z.y):(N-=z.y,C+=z.y);O<0&&N<0?(d=xe,N=-N,O=-O,C-=N,_-=O):O<0?(d=te,O=-O,_-=O):N<0&&(d=ae,N=-N,C-=N);break;case te:if(v){if(z.y<=0&&(C<=K||_<=X)){Ae=!1;break}re(q),N-=z.y,C+=z.y,O=N*v,_+=S.width-O}else re(q),re(U),z.x<=0?_>X?(O-=z.x,_+=z.x):z.y<=0&&C<=K&&(Ae=!1):(O-=z.x,_+=z.x),z.y<=0?C>K&&(N-=z.y,C+=z.y):(N-=z.y,C+=z.y);O<0&&N<0?(d=ae,N=-N,O=-O,C-=N,_-=O):O<0?(d=W,O=-O,_-=O):N<0&&(d=xe,N=-N,C-=N);break;case xe:if(v){if(z.x<=0&&(_<=X||$>=Q)){Ae=!1;break}re(U),O-=z.x,_+=z.x,N=O/v}else re(j),re(U),z.x<=0?_>X?(O-=z.x,_+=z.x):z.y>=0&&$>=Q&&(Ae=!1):(O-=z.x,_+=z.x),z.y>=0?$<Q&&(N+=z.y):N+=z.y;O<0&&N<0?(d=W,N=-N,O=-O,C-=N,_-=O):O<0?(d=ae,O=-O,_-=O):N<0&&(d=te,N=-N,C-=N);break;case ae:if(v){if(z.x>=0&&(V>=ge||$>=Q)){Ae=!1;break}re(B),O+=z.x,N=O/v}else re(j),re(B),z.x>=0?V<ge?O+=z.x:z.y>=0&&$>=Q&&(Ae=!1):O+=z.x,z.y>=0?$<Q&&(N+=z.y):N+=z.y;O<0&&N<0?(d=te,N=-N,O=-O,C-=N,_-=O):O<0?(d=xe,O=-O,_-=O):N<0&&(d=W,N=-N,C-=N);break;case P:this.move(z.x,z.y),Ae=!1;break;case I:this.zoom(ol(b),u),Ae=!1;break;case x:if(!z.x||!z.y){Ae=!1;break}ai=Nn(this.cropper),_=wt.startX-ai.left,C=wt.startY-ai.top,O=S.minWidth,N=S.minHeight,z.x>0?d=z.y>0?ae:W:z.x<0&&(_-=O,d=z.y>0?xe:te),z.y<0&&(C-=N),this.cropped||(ht(this.cropBox,pe),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Ae&&(S.width=O,S.height=N,S.left=_,S.top=C,this.action=d,this.renderCropBox()),me(b,function(De){De.startX=De.endX,De.startY=De.endY})}},jn={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&we(this.dragBox,ee),ht(this.cropBox,pe),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=le({},this.initialImageData),this.canvasData=le({},this.initialCanvasData),this.cropBoxData=le({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(le(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),ht(this.dragBox,ee),we(this.cropBox,pe)),this},replace:function(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&u&&(this.isImg&&(this.element.src=u),f?(this.url=u,this.image.src=u,this.ready&&(this.viewBoxImage.src=u,me(this.previews,function(p){p.getElementsByTagName("img")[0].src=u}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(u))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,ht(this.cropper,Ce)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,we(this.cropper,Ce)),this},destroy:function(){var u=this.element;return u[R]?(u[R]=void 0,this.isImg&&this.replaced&&(u.src=this.originalUrl),this.uncreate(),this):this},move:function(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,p=this.canvasData,k=p.left,S=p.top;return this.moveTo(kr(u)?u:k+Number(u),kr(f)?f:S+Number(f))},moveTo:function(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,p=this.canvasData,k=!1;return u=Number(u),f=Number(f),this.ready&&!this.disabled&&this.options.movable&&(Y(u)&&(p.left=u,k=!0),Y(f)&&(p.top=f,k=!0),k&&this.renderCanvas(!0)),this},zoom:function(u,f){var p=this.canvasData;return u=Number(u),u<0?u=1/(1-u):u=1+u,this.zoomTo(p.width*u/p.naturalWidth,null,f)},zoomTo:function(u,f,p){var k=this.options,S=this.canvasData,b=S.width,d=S.height,v=S.naturalWidth,_=S.naturalHeight;if(u=Number(u),u>=0&&this.ready&&!this.disabled&&k.zoomable){var C=v*u,O=_*u;if(vt(this.element,ii,{ratio:u,oldRatio:b/v,originalEvent:p})===!1)return this;if(p){var N=this.pointers,V=Nn(this.cropper),$=N&&Object.keys(N).length?al(N):{pageX:p.pageX,pageY:p.pageY};S.left-=(C-b)*(($.pageX-V.left-S.left)/b),S.top-=(O-d)*(($.pageY-V.top-S.top)/d)}else bt(f)&&Y(f.x)&&Y(f.y)?(S.left-=(C-b)*((f.x-S.left)/b),S.top-=(O-d)*((f.y-S.top)/d)):(S.left-=(C-b)/2,S.top-=(O-d)/2);S.width=C,S.height=O,this.renderCanvas(!0)}return this},rotate:function(u){return this.rotateTo((this.imageData.rotate||0)+Number(u))},rotateTo:function(u){return u=Number(u),Y(u)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=u%360,this.renderCanvas(!0,!0)),this},scaleX:function(u){var f=this.imageData.scaleY;return this.scale(u,Y(f)?f:1)},scaleY:function(u){var f=this.imageData.scaleX;return this.scale(Y(f)?f:1,u)},scale:function(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,p=this.imageData,k=!1;return u=Number(u),f=Number(f),this.ready&&!this.disabled&&this.options.scalable&&(Y(u)&&(p.scaleX=u,k=!0),Y(f)&&(p.scaleY=f,k=!0),k&&this.renderCanvas(!0,!0)),this},getData:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,f=this.options,p=this.imageData,k=this.canvasData,S=this.cropBoxData,b;if(this.ready&&this.cropped){b={x:S.left-k.left,y:S.top-k.top,width:S.width,height:S.height};var d=p.width/p.naturalWidth;if(me(b,function(C,O){b[O]=C/d}),u){var v=Math.round(b.y+b.height),_=Math.round(b.x+b.width);b.x=Math.round(b.x),b.y=Math.round(b.y),b.width=_-b.x,b.height=v-b.y}}else b={x:0,y:0,width:0,height:0};return f.rotatable&&(b.rotate=p.rotate||0),f.scalable&&(b.scaleX=p.scaleX||1,b.scaleY=p.scaleY||1),b},setData:function(u){var f=this.options,p=this.imageData,k=this.canvasData,S={};if(this.ready&&!this.disabled&&bt(u)){var b=!1;f.rotatable&&Y(u.rotate)&&u.rotate!==p.rotate&&(p.rotate=u.rotate,b=!0),f.scalable&&(Y(u.scaleX)&&u.scaleX!==p.scaleX&&(p.scaleX=u.scaleX,b=!0),Y(u.scaleY)&&u.scaleY!==p.scaleY&&(p.scaleY=u.scaleY,b=!0)),b&&this.renderCanvas(!0,!0);var d=p.width/p.naturalWidth;Y(u.x)&&(S.left=u.x*d+k.left),Y(u.y)&&(S.top=u.y*d+k.top),Y(u.width)&&(S.width=u.width*d),Y(u.height)&&(S.height=u.height*d),this.setCropBoxData(S)}return this},getContainerData:function(){return this.ready?le({},this.containerData):{}},getImageData:function(){return this.sized?le({},this.imageData):{}},getCanvasData:function(){var u=this.canvasData,f={};return this.ready&&me(["left","top","width","height","naturalWidth","naturalHeight"],function(p){f[p]=u[p]}),f},setCanvasData:function(u){var f=this.canvasData,p=f.aspectRatio;return this.ready&&!this.disabled&&bt(u)&&(Y(u.left)&&(f.left=u.left),Y(u.top)&&(f.top=u.top),Y(u.width)?(f.width=u.width,f.height=u.width/p):Y(u.height)&&(f.height=u.height,f.width=u.height*p),this.renderCanvas(!0)),this},getCropBoxData:function(){var u=this.cropBoxData,f;return this.ready&&this.cropped&&(f={left:u.left,top:u.top,width:u.width,height:u.height}),f||{}},setCropBoxData:function(u){var f=this.cropBoxData,p=this.options.aspectRatio,k,S;return this.ready&&this.cropped&&!this.disabled&&bt(u)&&(Y(u.left)&&(f.left=u.left),Y(u.top)&&(f.top=u.top),Y(u.width)&&u.width!==f.width&&(k=!0,f.width=u.width),Y(u.height)&&u.height!==f.height&&(S=!0,f.height=u.height),p&&(k?f.height=f.width/p:S&&(f.width=f.height*p)),this.renderCropBox()),this},getCroppedCanvas:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var f=this.canvasData,p=oi(this.image,this.imageData,f,u);if(!this.cropped)return p;var k=this.getData(u.rounded),S=k.x,b=k.y,d=k.width,v=k.height,_=p.width/Math.floor(f.naturalWidth);_!==1&&(S*=_,b*=_,d*=_,v*=_);var C=d/v,O=$e({aspectRatio:C,width:u.maxWidth||1/0,height:u.maxHeight||1/0}),N=$e({aspectRatio:C,width:u.minWidth||0,height:u.minHeight||0},"cover"),V=$e({aspectRatio:C,width:u.width||(_!==1?p.width:d),height:u.height||(_!==1?p.height:v)}),$=V.width,X=V.height;$=Math.min(O.width,Math.max(N.width,$)),X=Math.min(O.height,Math.max(N.height,X));var K=document.createElement("canvas"),ge=K.getContext("2d");K.width=Dt($),K.height=Dt(X),ge.fillStyle=u.fillColor||"transparent",ge.fillRect(0,0,$,X);var Q=u.imageSmoothingEnabled,Ae=Q===void 0?!0:Q,ai=u.imageSmoothingQuality;ge.imageSmoothingEnabled=Ae,ai&&(ge.imageSmoothingQuality=ai);var wt=p.width,z=p.height,re=S,De=b,xt,li,Wi,Gi,ki,Kt;re<=-d||re>wt?(re=0,xt=0,Wi=0,ki=0):re<=0?(Wi=-re,re=0,xt=Math.min(wt,d+re),ki=xt):re<=wt&&(Wi=0,xt=Math.min(d,wt-re),ki=xt),xt<=0||De<=-v||De>z?(De=0,li=0,Gi=0,Kt=0):De<=0?(Gi=-De,De=0,li=Math.min(z,v+De),Kt=li):De<=z&&(Gi=0,li=Math.min(v,z-De),Kt=li);var dt=[re,De,xt,li];if(ki>0&&Kt>0){var Ki=$/d;dt.push(Wi*Ki,Gi*Ki,ki*Ki,Kt*Ki)}return ge.drawImage.apply(ge,[p].concat(h(dt.map(function(Vn){return Math.floor(Dt(Vn))})))),K},setAspectRatio:function(u){var f=this.options;return!this.disabled&&!kr(u)&&(f.aspectRatio=Math.max(0,u)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(u){var f=this.options,p=this.dragBox,k=this.face;if(this.ready&&!this.disabled){var S=u===tt,b=f.movable&&u===Lt;u=S||b?u:Wt,f.dragMode=u,ni(p,lt,u),Ei(p,he,S),Ei(p,mt,b),f.cropBoxMovable||(ni(k,lt,u),Ei(k,he,S),Ei(k,mt,b))}return this}},qn=M.Cropper,$n=(function(){function y(u){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,y),!u||!wi.test(u.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=u,this.options=le({},si,bt(f)&&f),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return a(y,[{key:"init",value:function(){var f=this.element,p=f.tagName.toLowerCase(),k;if(!f[R]){if(f[R]=this,p==="img"){if(this.isImg=!0,k=f.getAttribute("src")||"",this.originalUrl=k,!k)return;k=f.src}else p==="canvas"&&window.HTMLCanvasElement&&(k=f.toDataURL());this.load(k)}}},{key:"load",value:function(f){var p=this;if(f){this.url=f,this.imageData={};var k=this.element,S=this.options;if(!S.rotatable&&!S.scalable&&(S.checkOrientation=!1),!S.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Tt.test(f)){vi.test(f)?this.read(Hn(f)):this.clone();return}var b=new XMLHttpRequest,d=this.clone.bind(this);this.reloading=!0,this.xhr=b,b.onabort=d,b.onerror=d,b.ontimeout=d,b.onprogress=function(){b.getResponseHeader("content-type")!==ut&&b.abort()},b.onload=function(){p.read(b.response)},b.onloadend=function(){p.reloading=!1,p.xhr=null},S.checkCrossOrigin&&ms(f)&&k.crossOrigin&&(f=gs(f)),b.open("GET",f,!0),b.responseType="arraybuffer",b.withCredentials=k.crossOrigin==="use-credentials",b.send()}}},{key:"read",value:function(f){var p=this.options,k=this.imageData,S=bs(f),b=0,d=1,v=1;if(S>1){this.url=Fr(f,ut);var _=Or(S);b=_.rotate,d=_.scaleX,v=_.scaleY}p.rotatable&&(k.rotate=b),p.scalable&&(k.scaleX=d,k.scaleY=v),this.clone()}},{key:"clone",value:function(){var f=this.element,p=this.url,k=f.crossOrigin,S=p;this.options.checkCrossOrigin&&ms(p)&&(k||(k="anonymous"),S=gs(p)),this.crossOrigin=k,this.crossOriginUrl=S;var b=document.createElement("img");k&&(b.crossOrigin=k),b.src=S||p,b.alt=f.alt||"The image to crop",this.image=b,b.onload=this.start.bind(this),b.onerror=this.stop.bind(this),we(b,et),f.parentNode.insertBefore(b,f.nextSibling)}},{key:"start",value:function(){var f=this,p=this.image;p.onload=null,p.onerror=null,this.sizing=!0;var k=M.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(M.navigator.userAgent),S=function(_,C){le(f.imageData,{naturalWidth:_,naturalHeight:C,aspectRatio:_/C}),f.initialImageData=le({},f.imageData),f.sizing=!1,f.sized=!0,f.build()};if(p.naturalWidth&&!k){S(p.naturalWidth,p.naturalHeight);return}var b=document.createElement("img"),d=document.body||document.documentElement;this.sizingImage=b,b.onload=function(){S(b.width,b.height),k||d.removeChild(b)},b.src=p.src,k||(b.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",d.appendChild(b))}},{key:"stop",value:function(){var f=this.image;f.onload=null,f.onerror=null,f.parentNode.removeChild(f),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var f=this.element,p=this.options,k=this.image,S=f.parentNode,b=document.createElement("div");b.innerHTML=Tr;var d=b.querySelector(".".concat(R,"-container")),v=d.querySelector(".".concat(R,"-canvas")),_=d.querySelector(".".concat(R,"-drag-box")),C=d.querySelector(".".concat(R,"-crop-box")),O=C.querySelector(".".concat(R,"-face"));this.container=S,this.cropper=d,this.canvas=v,this.dragBox=_,this.cropBox=C,this.viewBox=d.querySelector(".".concat(R,"-view-box")),this.face=O,v.appendChild(k),we(f,pe),S.insertBefore(d,f.nextSibling),ht(k,et),this.initPreview(),this.bind(),p.initialAspectRatio=Math.max(0,p.initialAspectRatio)||NaN,p.aspectRatio=Math.max(0,p.aspectRatio)||NaN,p.viewMode=Math.max(0,Math.min(3,Math.round(p.viewMode)))||0,we(C,pe),p.guides||we(C.getElementsByClassName("".concat(R,"-dashed")),pe),p.center||we(C.getElementsByClassName("".concat(R,"-center")),pe),p.background&&we(d,"".concat(R,"-bg")),p.highlight||we(O,Ot),p.cropBoxMovable&&(we(O,mt),ni(O,lt,T)),p.cropBoxResizable||(we(C.getElementsByClassName("".concat(R,"-line")),pe),we(C.getElementsByClassName("".concat(R,"-point")),pe)),this.render(),this.ready=!0,this.setDragMode(p.dragMode),p.autoCrop&&this.crop(),this.setData(p.data),de(p.ready)&&Z(f,ji,p.ready,{once:!0}),vt(f,ji)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var f=this.cropper.parentNode;f&&f.removeChild(this.cropper),ht(this.element,pe)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=qn,y}},{key:"setDefaults",value:function(f){le(si,bt(f)&&f)}}])})();return le($n.prototype,xi,Vi,Nt,cl,ul,jn),$n}))});var Rr={eager:"eager",lazy:"lazy"},_t=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return gb(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function gb(i){return i.toLowerCase()==="lazy"?Rr.lazy:Rr.eager}var bb={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function ws(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=Gh();return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,yb(e,i),e}}function yb(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function vb(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function ye(i,{target:e,cancelable:t,detail:r}={}){let s=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function Dh(i){i.preventDefault(),i.stopImmediatePropagation()}function ys(){return document.visibilityState==="hidden"?qh():jh()}function jh(){return new Promise(i=>requestAnimationFrame(()=>i()))}function qh(){return new Promise(i=>setTimeout(()=>i(),0))}function $h(i=""){return new DOMParser().parseFromString(i,"text/html")}function Vh(i,...e){let t=wb(i,e).replace(/^\n/,"").split(`
1
+ (()=>{var xb=Object.create;var Vh=Object.defineProperty;var kb=Object.getOwnPropertyDescriptor;var _b=Object.getOwnPropertyNames;var Cb=Object.getPrototypeOf,Ab=Object.prototype.hasOwnProperty;var _e=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var Pb=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _b(e))!Ab.call(i,s)&&s!==t&&Vh(i,s,{get:()=>e[s],enumerable:!(r=kb(e,s))||r.enumerable});return i};var Te=(i,e,t)=>(t=i!=null?xb(Cb(i)):{},Pb(e||!i||!i.__esModule?Vh(t,"default",{value:i,enumerable:!0}):t,i));var Jo=_e((o5,Lf)=>{function s1(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}Lf.exports=s1});var Mf=_e((a5,Rf)=>{var n1=typeof global=="object"&&global&&global.Object===Object&&global;Rf.exports=n1});var Eu=_e((l5,Df)=>{var o1=Mf(),a1=typeof self=="object"&&self&&self.Object===Object&&self,l1=o1||a1||Function("return this")();Df.exports=l1});var Nf=_e((c5,If)=>{var c1=Eu(),u1=function(){return c1.Date.now()};If.exports=u1});var Uf=_e((u5,Bf)=>{var h1=/\s/;function d1(i){for(var e=i.length;e--&&h1.test(i.charAt(e)););return e}Bf.exports=d1});var Hf=_e((h5,zf)=>{var p1=Uf(),f1=/^\s+/;function m1(i){return i&&i.slice(0,p1(i)+1).replace(f1,"")}zf.exports=m1});var Tu=_e((d5,jf)=>{var g1=Eu(),b1=g1.Symbol;jf.exports=b1});var Wf=_e((p5,Vf)=>{var qf=Tu(),$f=Object.prototype,y1=$f.hasOwnProperty,v1=$f.toString,rn=qf?qf.toStringTag:void 0;function w1(i){var e=y1.call(i,rn),t=i[rn];try{i[rn]=void 0;var r=!0}catch{}var s=v1.call(i);return r&&(e?i[rn]=t:delete i[rn]),s}Vf.exports=w1});var Kf=_e((f5,Gf)=>{var S1=Object.prototype,E1=S1.toString;function T1(i){return E1.call(i)}Gf.exports=T1});var Qf=_e((m5,Zf)=>{var Yf=Tu(),x1=Wf(),k1=Kf(),_1="[object Null]",C1="[object Undefined]",Xf=Yf?Yf.toStringTag:void 0;function A1(i){return i==null?i===void 0?C1:_1:Xf&&Xf in Object(i)?x1(i):k1(i)}Zf.exports=A1});var em=_e((g5,Jf)=>{function P1(i){return i!=null&&typeof i=="object"}Jf.exports=P1});var im=_e((b5,tm)=>{var F1=Qf(),O1=em(),L1="[object Symbol]";function R1(i){return typeof i=="symbol"||O1(i)&&F1(i)==L1}tm.exports=R1});var om=_e((y5,nm)=>{var M1=Hf(),rm=Jo(),D1=im(),sm=NaN,I1=/^[-+]0x[0-9a-f]+$/i,N1=/^0b[01]+$/i,B1=/^0o[0-7]+$/i,U1=parseInt;function z1(i){if(typeof i=="number")return i;if(D1(i))return sm;if(rm(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=rm(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=M1(i);var t=N1.test(i);return t||B1.test(i)?U1(i.slice(2),t?2:8):I1.test(i)?sm:+i}nm.exports=z1});var ku=_e((v5,lm)=>{var H1=Jo(),xu=Nf(),am=om(),j1="Expected a function",q1=Math.max,$1=Math.min;function V1(i,e,t){var r,s,n,o,a,l,h=0,f=!1,m=!1,w=!0;if(typeof i!="function")throw new TypeError(j1);e=am(e)||0,H1(t)&&(f=!!t.leading,m="maxWait"in t,n=m?q1(am(t.maxWait)||0,e):n,w="trailing"in t?!!t.trailing:w);function y(A){var L=r,H=s;return r=s=void 0,h=A,o=i.apply(H,L),o}function _(A){return h=A,a=setTimeout(R,e),f?y(A):o}function P(A){var L=A-l,H=A-h,j=e-L;return m?$1(j,n-H):j}function O(A){var L=A-l,H=A-h;return l===void 0||L>=e||L<0||m&&H>=n}function R(){var A=xu();if(O(A))return C(A);a=setTimeout(R,P(A))}function C(A){return a=void 0,w&&r?y(A):(r=s=void 0,o)}function F(){a!==void 0&&clearTimeout(a),h=0,r=l=s=a=void 0}function k(){return a===void 0?o:C(xu())}function S(){var A=xu(),L=O(A);if(r=arguments,s=this,l=A,L){if(a===void 0)return _(l);if(m)return clearTimeout(a),a=setTimeout(R,e),y(l)}return a===void 0&&(a=setTimeout(R,e)),o}return S.cancel=F,S.flush=k,S}lm.exports=V1});var um=_e((w5,cm)=>{var W1=ku(),G1=Jo(),K1="Expected a function";function Y1(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(K1);return G1(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),W1(i,e,{leading:r,maxWait:e,trailing:s})}cm.exports=Y1});var dm=_e((S5,hm)=>{hm.exports=function(){var e={},t=e._fns={};e.emit=function(o,a,l,h,f,m,w){var y=r(o);y.length&&s(o,y,[a,l,h,f,m,w])},e.on=function(o,a){t[o]||(t[o]=[]),t[o].push(a)},e.once=function(o,a){function l(){a.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,a){var l=[];if(o&&a){var h=this._fns[o],f=0,m=h?h.length:0;for(f;f<m;f++)h[f]!==a&&l.push(h[f])}l.length?this._fns[o]=l:delete this._fns[o]};function r(n){var o=t[n]?t[n]:[],a=n.indexOf(":"),l=a===-1?[n]:[n.substring(0,a),n.substring(a+1)],h=Object.keys(t),f=0,m=h.length;for(f;f<m;f++){var w=h[f];if(w==="*"&&(o=o.concat(t[w])),l.length===2&&l[0]===w){o=o.concat(t[w]);break}}return o}function s(n,o,a){var l=0,h=o.length;for(l;l<h&&o[l];l++)o[l].event=n,o[l].apply(o[l],a)}return e}});var ea=_e((_5,mm)=>{"use strict";mm.exports=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=Math.abs(e);if(t&&(r=-r),r===0)return"0 B";let s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(r)/Math.log(1024)),s.length-1),o=Number(r/1024**n),a=s[n];return`${o>=10||o%1===0?Math.round(o):o.toFixed(1)} ${a}`}});var ym=_e((C5,bm)=>{"use strict";function gm(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}gm.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};bm.exports=function(i,e,t){var r=new gm(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var wm=_e((A5,vm)=>{var Q1=ym(),J1=/[\/\+\.]/;vm.exports=function(i,e){function t(r){var s=Q1(r,i,J1);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var at=_e((N2,oa)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(s=r(s,t(o)))}return s}function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var o in s)i.call(s,o)&&s[o]&&(n=r(n,o));return n}function r(s,n){return n?s?s+" "+n:s+n:s}typeof oa<"u"&&oa.exports?(e.default=e,oa.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Mm=_e((TP,Ru)=>{"use strict";var _S=Object.prototype.hasOwnProperty,lt="~";function cn(){}Object.create&&(cn.prototype=Object.create(null),new cn().__proto__||(lt=!1));function CS(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function Rm(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new CS(t,r||i,s),o=lt?lt+e:e;return i._events[o]?i._events[o].fn?i._events[o]=[i._events[o],n]:i._events[o].push(n):(i._events[o]=n,i._eventsCount++),i}function fa(i,e){--i._eventsCount===0?i._events=new cn:delete i._events[e]}function it(){this._events=new cn,this._eventsCount=0}it.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)_S.call(t,r)&&e.push(lt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};it.prototype.listeners=function(e){var t=lt?lt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,o=new Array(n);s<n;s++)o[s]=r[s].fn;return o};it.prototype.listenerCount=function(e){var t=lt?lt+e:e,r=this._events[t];return r?r.fn?1:r.length:0};it.prototype.emit=function(e,t,r,s,n,o){var a=lt?lt+e:e;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,f,m;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,s),!0;case 5:return l.fn.call(l.context,t,r,s,n),!0;case 6:return l.fn.call(l.context,t,r,s,n,o),!0}for(m=1,f=new Array(h-1);m<h;m++)f[m-1]=arguments[m];l.fn.apply(l.context,f)}else{var w=l.length,y;for(m=0;m<w;m++)switch(l[m].once&&this.removeListener(e,l[m].fn,void 0,!0),h){case 1:l[m].fn.call(l[m].context);break;case 2:l[m].fn.call(l[m].context,t);break;case 3:l[m].fn.call(l[m].context,t,r);break;case 4:l[m].fn.call(l[m].context,t,r,s);break;default:if(!f)for(y=1,f=new Array(h-1);y<h;y++)f[y-1]=arguments[y];l[m].fn.apply(l[m].context,f)}}return!0};it.prototype.on=function(e,t,r){return Rm(this,e,t,r,!1)};it.prototype.once=function(e,t,r){return Rm(this,e,t,r,!0)};it.prototype.removeListener=function(e,t,r,s){var n=lt?lt+e:e;if(!this._events[n])return this;if(!t)return fa(this,n),this;var o=this._events[n];if(o.fn)o.fn===t&&(!s||o.once)&&(!r||o.context===r)&&fa(this,n);else{for(var a=0,l=[],h=o.length;a<h;a++)(o[a].fn!==t||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:fa(this,n)}return this};it.prototype.removeAllListeners=function(e){var t;return e?(t=lt?lt+e:e,this._events[t]&&fa(this,t)):(this._events=new cn,this._eventsCount=0),this};it.prototype.off=it.prototype.removeListener;it.prototype.addListener=it.prototype.on;it.prefixed=lt;it.EventEmitter=it;typeof Ru<"u"&&(Ru.exports=it)});var eb=_e((Fh,Oh)=>{(function(i,e){typeof Fh=="object"&&typeof Oh<"u"?Oh.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(Fh,(function(){"use strict";function i(b,u){var p=Object.keys(b);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(b);u&&(d=d.filter(function(x){return Object.getOwnPropertyDescriptor(b,x).enumerable})),p.push.apply(p,d)}return p}function e(b){for(var u=1;u<arguments.length;u++){var p=arguments[u]!=null?arguments[u]:{};u%2?i(Object(p),!0).forEach(function(d){l(b,d,p[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(p)):i(Object(p)).forEach(function(d){Object.defineProperty(b,d,Object.getOwnPropertyDescriptor(p,d))})}return b}function t(b,u){if(typeof b!="object"||!b)return b;var p=b[Symbol.toPrimitive];if(p!==void 0){var d=p.call(b,u||"default");if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(b)}function r(b){var u=t(b,"string");return typeof u=="symbol"?u:u+""}function s(b){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},s(b)}function n(b,u){if(!(b instanceof u))throw new TypeError("Cannot call a class as a function")}function o(b,u){for(var p=0;p<u.length;p++){var d=u[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(b,r(d.key),d)}}function a(b,u,p){return u&&o(b.prototype,u),p&&o(b,p),Object.defineProperty(b,"prototype",{writable:!1}),b}function l(b,u,p){return u=r(u),u in b?Object.defineProperty(b,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):b[u]=p,b}function h(b){return f(b)||m(b)||w(b)||_()}function f(b){if(Array.isArray(b))return y(b)}function m(b){if(typeof Symbol<"u"&&b[Symbol.iterator]!=null||b["@@iterator"]!=null)return Array.from(b)}function w(b,u){if(b){if(typeof b=="string")return y(b,u);var p=Object.prototype.toString.call(b).slice(8,-1);if(p==="Object"&&b.constructor&&(p=b.constructor.name),p==="Map"||p==="Set")return Array.from(b);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return y(b,u)}}function y(b,u){(u==null||u>b.length)&&(u=b.length);for(var p=0,d=new Array(u);p<u;p++)d[p]=b[p];return d}function _(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var P=typeof window<"u"&&typeof window.document<"u",O=P?window:{},R=P&&O.document.documentElement?"ontouchstart"in O.document.documentElement:!1,C=P?"PointerEvent"in O:!1,F="cropper",k="all",S="crop",A="move",L="zoom",H="e",j="w",G="s",K="n",ee="ne",se="nw",ae="se",ve="sw",we="".concat(F,"-crop"),Ne="".concat(F,"-disabled"),pe="".concat(F,"-hidden"),Ye="".concat(F,"-hide"),Ct="".concat(F,"-invisible"),mt="".concat(F,"-modal"),gt="".concat(F,"-move"),ut="".concat(F,"Action"),te="".concat(F,"Preview"),rt="crop",Dt="move",Gt="none",He="crop",si="cropend",qi="cropmove",Kt="cropstart",_r="dblclick",$i=R?"touchstart":"mousedown",de=R?"touchmove":"mousemove",Vi=R?"touchend touchcancel":"mouseup",le=C?"pointerdown":$i,ni=C?"pointermove":de,st=C?"pointerup pointercancel":Vi,Yt="ready",bt="resize",et="wheel",oi="zoom",ai="image/jpeg",Si=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Wi=/^data:/,yt=/^data:image\/jpeg;base64,/,At=/^img|canvas$/i,vt=200,Cr=100,Gi={viewMode:0,dragMode:rt,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:vt,minContainerHeight:Cr,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Ar='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',ps=Number.isNaN||O.isNaN;function J(b){return typeof b=="number"&&!ps(b)}var Ki=function(u){return u>0&&u<1/0};function Ei(b){return typeof b>"u"}function Xt(b){return s(b)==="object"&&b!==null}var Bn=Object.prototype.hasOwnProperty;function li(b){if(!Xt(b))return!1;try{var u=b.constructor,p=u.prototype;return u&&p&&Bn.call(p,"isPrototypeOf")}catch{return!1}}function je(b){return typeof b=="function"}var fs=Array.prototype.slice;function ci(b){return Array.from?Array.from(b):fs.call(b)}function fe(b,u){return b&&je(u)&&(Array.isArray(b)||J(b.length)?ci(b).forEach(function(p,d){u.call(b,p,d,b)}):Xt(b)&&Object.keys(b).forEach(function(p){u.call(b,b[p],p,b)})),b}var me=Object.assign||function(u){for(var p=arguments.length,d=new Array(p>1?p-1:0),x=1;x<p;x++)d[x-1]=arguments[x];return Xt(u)&&d.length>0&&d.forEach(function(v){Xt(v)&&Object.keys(v).forEach(function(T){u[T]=v[T]})}),u},Un=/\.\d*(?:0|9){12}\d*$/;function ui(b){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Un.test(b)?Math.round(b*u)/u:b}var zn=/^width|height|left|top|marginLeft|marginTop$/;function It(b,u){var p=b.style;fe(u,function(d,x){zn.test(x)&&J(d)&&(d="".concat(d,"px")),p[x]=d})}function Pr(b,u){return b.classList?b.classList.contains(u):b.className.indexOf(u)>-1}function Se(b,u){if(u){if(J(b.length)){fe(b,function(d){Se(d,u)});return}if(b.classList){b.classList.add(u);return}var p=b.className.trim();p?p.indexOf(u)<0&&(b.className="".concat(p," ").concat(u)):b.className=u}}function Pe(b,u){if(u){if(J(b.length)){fe(b,function(p){Pe(p,u)});return}if(b.classList){b.classList.remove(u);return}b.className.indexOf(u)>=0&&(b.className=b.className.replace(u,""))}}function wt(b,u,p){if(u){if(J(b.length)){fe(b,function(d){wt(d,u,p)});return}p?Se(b,u):Pe(b,u)}}var ms=/([a-z\d])([A-Z])/g;function Yi(b){return b.replace(ms,"$1-$2").toLowerCase()}function gs(b,u){return Xt(b[u])?b[u]:b.dataset?b.dataset[u]:b.getAttribute("data-".concat(Yi(u)))}function Ti(b,u,p){Xt(p)?b[u]=p:b.dataset?b.dataset[u]=p:b.setAttribute("data-".concat(Yi(u)),p)}function bs(b,u){if(Xt(b[u]))try{delete b[u]}catch{b[u]=void 0}else if(b.dataset)try{delete b.dataset[u]}catch{b.dataset[u]=void 0}else b.removeAttribute("data-".concat(Yi(u)))}var ys=/\s\s*/,Fr=(function(){var b=!1;if(P){var u=!1,p=function(){},d=Object.defineProperty({},"once",{get:function(){return b=!0,u},set:function(v){u=v}});O.addEventListener("test",p,d),O.removeEventListener("test",p,d)}return b})();function St(b,u,p){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},x=p;u.trim().split(ys).forEach(function(v){if(!Fr){var T=b.listeners;T&&T[v]&&T[v][p]&&(x=T[v][p],delete T[v][p],Object.keys(T[v]).length===0&&delete T[v],Object.keys(T).length===0&&delete b.listeners)}b.removeEventListener(v,x,d)})}function qe(b,u,p){var d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},x=p;u.trim().split(ys).forEach(function(v){if(d.once&&!Fr){var T=b.listeners,M=T===void 0?{}:T;x=function(){delete M[v][p],b.removeEventListener(v,x,d);for(var z=arguments.length,I=new Array(z),N=0;N<z;N++)I[N]=arguments[N];p.apply(b,I)},M[v]||(M[v]={}),M[v][p]&&b.removeEventListener(v,M[v][p],d),M[v][p]=x,b.listeners=M}b.addEventListener(v,x,d)})}function xi(b,u,p){var d;return je(Event)&&je(CustomEvent)?d=new CustomEvent(u,{detail:p,bubbles:!0,cancelable:!0}):(d=document.createEvent("CustomEvent"),d.initCustomEvent(u,!0,!0,p)),b.dispatchEvent(d)}function Hn(b){var u=b.getBoundingClientRect();return{left:u.left+(window.pageXOffset-document.documentElement.clientLeft),top:u.top+(window.pageYOffset-document.documentElement.clientTop)}}var be=O.location,ki=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function jn(b){var u=b.match(ki);return u!==null&&(u[1]!==be.protocol||u[2]!==be.hostname||u[3]!==be.port)}function vs(b){var u="timestamp=".concat(new Date().getTime());return b+(b.indexOf("?")===-1?"?":"&")+u}function hi(b){var u=b.rotate,p=b.scaleX,d=b.scaleY,x=b.translateX,v=b.translateY,T=[];J(x)&&x!==0&&T.push("translateX(".concat(x,"px)")),J(v)&&v!==0&&T.push("translateY(".concat(v,"px)")),J(u)&&u!==0&&T.push("rotate(".concat(u,"deg)")),J(p)&&p!==1&&T.push("scaleX(".concat(p,")")),J(d)&&d!==1&&T.push("scaleY(".concat(d,")"));var M=T.length?T.join(" "):"none";return{WebkitTransform:M,msTransform:M,transform:M}}function qn(b){var u=e({},b),p=0;return fe(b,function(d,x){delete u[x],fe(u,function(v){var T=Math.abs(d.startX-v.startX),M=Math.abs(d.startY-v.startY),$=Math.abs(d.endX-v.endX),z=Math.abs(d.endY-v.endY),I=Math.sqrt(T*T+M*M),N=Math.sqrt($*$+z*z),q=(N-I)/I;Math.abs(q)>Math.abs(p)&&(p=q)})}),p}function Xi(b,u){var p=b.pageX,d=b.pageY,x={endX:p,endY:d};return u?x:e({startX:p,startY:d},x)}function fl(b){var u=0,p=0,d=0;return fe(b,function(x){var v=x.startX,T=x.startY;u+=v,p+=T,d+=1}),u/=d,p/=d,{pageX:u,pageY:p}}function Zt(b){var u=b.aspectRatio,p=b.height,d=b.width,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",v=Ki(d),T=Ki(p);if(v&&T){var M=p*u;x==="contain"&&M>d||x==="cover"&&M<d?p=d/u:d=p*u}else v?p=d/u:T&&(d=p*u);return{width:d,height:p}}function ml(b){var u=b.width,p=b.height,d=b.degree;if(d=Math.abs(d)%180,d===90)return{width:p,height:u};var x=d%90*Math.PI/180,v=Math.sin(x),T=Math.cos(x),M=u*T+p*v,$=u*v+p*T;return d>90?{width:$,height:M}:{width:M,height:$}}function gl(b,u,p,d){var x=u.aspectRatio,v=u.naturalWidth,T=u.naturalHeight,M=u.rotate,$=M===void 0?0:M,z=u.scaleX,I=z===void 0?1:z,N=u.scaleY,q=N===void 0?1:N,ie=p.aspectRatio,re=p.naturalWidth,B=p.naturalHeight,g=d.fillColor,E=g===void 0?"transparent":g,D=d.imageSmoothingEnabled,V=D===void 0?!0:D,Y=d.imageSmoothingQuality,X=Y===void 0?"low":Y,U=d.maxWidth,Z=U===void 0?1/0:U,ne=d.maxHeight,ge=ne===void 0?1/0:ne,Et=d.minWidth,Ee=Et===void 0?0:Et,Zi=d.minHeight,Ai=Zi===void 0?0:Zi,Qt=document.createElement("canvas"),ht=Qt.getContext("2d"),Qi=Zt({aspectRatio:ie,width:Z,height:ge}),Kn=Zt({aspectRatio:ie,width:Ee,height:Ai},"cover"),vl=Math.min(Qi.width,Math.max(Kn.width,re)),wl=Math.min(Qi.height,Math.max(Kn.height,B)),Hh=Zt({aspectRatio:x,width:Z,height:ge}),jh=Zt({aspectRatio:x,width:Ee,height:Ai},"cover"),qh=Math.min(Hh.width,Math.max(jh.width,v)),$h=Math.min(Hh.height,Math.max(jh.height,T)),Eb=[-qh/2,-$h/2,qh,$h];return Qt.width=ui(vl),Qt.height=ui(wl),ht.fillStyle=E,ht.fillRect(0,0,vl,wl),ht.save(),ht.translate(vl/2,wl/2),ht.rotate($*Math.PI/180),ht.scale(I,q),ht.imageSmoothingEnabled=V,ht.imageSmoothingQuality=X,ht.drawImage.apply(ht,[b].concat(h(Eb.map(function(Tb){return Math.floor(ui(Tb))})))),ht.restore(),Qt}var Nt=String.fromCharCode;function $n(b,u,p){var d="";p+=u;for(var x=u;x<p;x+=1)d+=Nt(b.getUint8(x));return d}var Or=/^data:.*,/;function di(b){var u=b.replace(Or,""),p=atob(u),d=new ArrayBuffer(p.length),x=new Uint8Array(d);return fe(x,function(v,T){x[T]=p.charCodeAt(T)}),d}function bl(b,u){for(var p=[],d=8192,x=new Uint8Array(b);x.length>0;)p.push(Nt.apply(null,ci(x.subarray(0,d)))),x=x.subarray(d);return"data:".concat(u,";base64,").concat(btoa(p.join("")))}function Lr(b){var u=new DataView(b),p;try{var d,x,v;if(u.getUint8(0)===255&&u.getUint8(1)===216)for(var T=u.byteLength,M=2;M+1<T;){if(u.getUint8(M)===255&&u.getUint8(M+1)===225){x=M;break}M+=1}if(x){var $=x+4,z=x+10;if($n(u,$,4)==="Exif"){var I=u.getUint16(z);if(d=I===18761,(d||I===19789)&&u.getUint16(z+2,d)===42){var N=u.getUint32(z+4,d);N>=8&&(v=z+N)}}}if(v){var q=u.getUint16(v,d),ie,re;for(re=0;re<q;re+=1)if(ie=v+re*12+2,u.getUint16(ie,d)===274){ie+=8,p=u.getUint16(ie,d),u.setUint16(ie,1,d);break}}}catch{p=1}return p}function Vn(b){var u=0,p=1,d=1;switch(b){case 2:p=-1;break;case 3:u=-180;break;case 4:d=-1;break;case 5:u=90,d=-1;break;case 6:u=90;break;case 7:u=90,p=-1;break;case 8:u=-90;break}return{rotate:u,scaleX:p,scaleY:d}}var yl={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var u=this.element,p=this.options,d=this.container,x=this.cropper,v=Number(p.minContainerWidth),T=Number(p.minContainerHeight);Se(x,pe),Pe(u,pe);var M={width:Math.max(d.offsetWidth,v>=0?v:vt),height:Math.max(d.offsetHeight,T>=0?T:Cr)};this.containerData=M,It(x,{width:M.width,height:M.height}),Se(u,pe),Pe(x,pe)},initCanvas:function(){var u=this.containerData,p=this.imageData,d=this.options.viewMode,x=Math.abs(p.rotate)%180===90,v=x?p.naturalHeight:p.naturalWidth,T=x?p.naturalWidth:p.naturalHeight,M=v/T,$=u.width,z=u.height;u.height*M>u.width?d===3?$=u.height*M:z=u.width/M:d===3?z=u.width/M:$=u.height*M;var I={aspectRatio:M,naturalWidth:v,naturalHeight:T,width:$,height:z};this.canvasData=I,this.limited=d===1||d===2,this.limitCanvas(!0,!0),I.width=Math.min(Math.max(I.width,I.minWidth),I.maxWidth),I.height=Math.min(Math.max(I.height,I.minHeight),I.maxHeight),I.left=(u.width-I.width)/2,I.top=(u.height-I.height)/2,I.oldLeft=I.left,I.oldTop=I.top,this.initialCanvasData=me({},I)},limitCanvas:function(u,p){var d=this.options,x=this.containerData,v=this.canvasData,T=this.cropBoxData,M=d.viewMode,$=v.aspectRatio,z=this.cropped&&T;if(u){var I=Number(d.minCanvasWidth)||0,N=Number(d.minCanvasHeight)||0;M>1?(I=Math.max(I,x.width),N=Math.max(N,x.height),M===3&&(N*$>I?I=N*$:N=I/$)):M>0&&(I?I=Math.max(I,z?T.width:0):N?N=Math.max(N,z?T.height:0):z&&(I=T.width,N=T.height,N*$>I?I=N*$:N=I/$));var q=Zt({aspectRatio:$,width:I,height:N});I=q.width,N=q.height,v.minWidth=I,v.minHeight=N,v.maxWidth=1/0,v.maxHeight=1/0}if(p)if(M>(z?0:1)){var ie=x.width-v.width,re=x.height-v.height;v.minLeft=Math.min(0,ie),v.minTop=Math.min(0,re),v.maxLeft=Math.max(0,ie),v.maxTop=Math.max(0,re),z&&this.limited&&(v.minLeft=Math.min(T.left,T.left+(T.width-v.width)),v.minTop=Math.min(T.top,T.top+(T.height-v.height)),v.maxLeft=T.left,v.maxTop=T.top,M===2&&(v.width>=x.width&&(v.minLeft=Math.min(0,ie),v.maxLeft=Math.max(0,ie)),v.height>=x.height&&(v.minTop=Math.min(0,re),v.maxTop=Math.max(0,re))))}else v.minLeft=-v.width,v.minTop=-v.height,v.maxLeft=x.width,v.maxTop=x.height},renderCanvas:function(u,p){var d=this.canvasData,x=this.imageData;if(p){var v=ml({width:x.naturalWidth*Math.abs(x.scaleX||1),height:x.naturalHeight*Math.abs(x.scaleY||1),degree:x.rotate||0}),T=v.width,M=v.height,$=d.width*(T/d.naturalWidth),z=d.height*(M/d.naturalHeight);d.left-=($-d.width)/2,d.top-=(z-d.height)/2,d.width=$,d.height=z,d.aspectRatio=T/M,d.naturalWidth=T,d.naturalHeight=M,this.limitCanvas(!0,!1)}(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCanvas(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,It(this.canvas,me({width:d.width,height:d.height},hi({translateX:d.left,translateY:d.top}))),this.renderImage(u),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(u){var p=this.canvasData,d=this.imageData,x=d.naturalWidth*(p.width/p.naturalWidth),v=d.naturalHeight*(p.height/p.naturalHeight);me(d,{width:x,height:v,left:(p.width-x)/2,top:(p.height-v)/2}),It(this.image,me({width:d.width,height:d.height},hi(me({translateX:d.left,translateY:d.top},d)))),u&&this.output()},initCropBox:function(){var u=this.options,p=this.canvasData,d=u.aspectRatio||u.initialAspectRatio,x=Number(u.autoCropArea)||.8,v={width:p.width,height:p.height};d&&(p.height*d>p.width?v.height=v.width/d:v.width=v.height*d),this.cropBoxData=v,this.limitCropBox(!0,!0),v.width=Math.min(Math.max(v.width,v.minWidth),v.maxWidth),v.height=Math.min(Math.max(v.height,v.minHeight),v.maxHeight),v.width=Math.max(v.minWidth,v.width*x),v.height=Math.max(v.minHeight,v.height*x),v.left=p.left+(p.width-v.width)/2,v.top=p.top+(p.height-v.height)/2,v.oldLeft=v.left,v.oldTop=v.top,this.initialCropBoxData=me({},v)},limitCropBox:function(u,p){var d=this.options,x=this.containerData,v=this.canvasData,T=this.cropBoxData,M=this.limited,$=d.aspectRatio;if(u){var z=Number(d.minCropBoxWidth)||0,I=Number(d.minCropBoxHeight)||0,N=M?Math.min(x.width,v.width,v.width+v.left,x.width-v.left):x.width,q=M?Math.min(x.height,v.height,v.height+v.top,x.height-v.top):x.height;z=Math.min(z,x.width),I=Math.min(I,x.height),$&&(z&&I?I*$>z?I=z/$:z=I*$:z?I=z/$:I&&(z=I*$),q*$>N?q=N/$:N=q*$),T.minWidth=Math.min(z,N),T.minHeight=Math.min(I,q),T.maxWidth=N,T.maxHeight=q}p&&(M?(T.minLeft=Math.max(0,v.left),T.minTop=Math.max(0,v.top),T.maxLeft=Math.min(x.width,v.left+v.width)-T.width,T.maxTop=Math.min(x.height,v.top+v.height)-T.height):(T.minLeft=0,T.minTop=0,T.maxLeft=x.width-T.width,T.maxTop=x.height-T.height))},renderCropBox:function(){var u=this.options,p=this.containerData,d=this.cropBoxData;(d.width>d.maxWidth||d.width<d.minWidth)&&(d.left=d.oldLeft),(d.height>d.maxHeight||d.height<d.minHeight)&&(d.top=d.oldTop),d.width=Math.min(Math.max(d.width,d.minWidth),d.maxWidth),d.height=Math.min(Math.max(d.height,d.minHeight),d.maxHeight),this.limitCropBox(!1,!0),d.left=Math.min(Math.max(d.left,d.minLeft),d.maxLeft),d.top=Math.min(Math.max(d.top,d.minTop),d.maxTop),d.oldLeft=d.left,d.oldTop=d.top,u.movable&&u.cropBoxMovable&&Ti(this.face,ut,d.width>=p.width&&d.height>=p.height?A:k),It(this.cropBox,me({width:d.width,height:d.height},hi({translateX:d.left,translateY:d.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),xi(this.element,He,this.getData())}},Wn={initPreview:function(){var u=this.element,p=this.crossOrigin,d=this.options.preview,x=p?this.crossOriginUrl:this.url,v=u.alt||"The image to preview",T=document.createElement("img");if(p&&(T.crossOrigin=p),T.src=x,T.alt=v,this.viewBox.appendChild(T),this.viewBoxImage=T,!!d){var M=d;typeof d=="string"?M=u.ownerDocument.querySelectorAll(d):d.querySelector&&(M=[d]),this.previews=M,fe(M,function($){var z=document.createElement("img");Ti($,te,{width:$.offsetWidth,height:$.offsetHeight,html:$.innerHTML}),p&&(z.crossOrigin=p),z.src=x,z.alt=v,z.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',$.innerHTML="",$.appendChild(z)})}},resetPreview:function(){fe(this.previews,function(u){var p=gs(u,te);It(u,{width:p.width,height:p.height}),u.innerHTML=p.html,bs(u,te)})},preview:function(){var u=this.imageData,p=this.canvasData,d=this.cropBoxData,x=d.width,v=d.height,T=u.width,M=u.height,$=d.left-p.left-u.left,z=d.top-p.top-u.top;!this.cropped||this.disabled||(It(this.viewBoxImage,me({width:T,height:M},hi(me({translateX:-$,translateY:-z},u)))),fe(this.previews,function(I){var N=gs(I,te),q=N.width,ie=N.height,re=q,B=ie,g=1;x&&(g=q/x,B=v*g),v&&B>ie&&(g=ie/v,re=x*g,B=ie),It(I,{width:re,height:B}),It(I.getElementsByTagName("img")[0],me({width:T*g,height:M*g},hi(me({translateX:-$*g,translateY:-z*g},u))))}))}},Gn={bind:function(){var u=this.element,p=this.options,d=this.cropper;je(p.cropstart)&&qe(u,Kt,p.cropstart),je(p.cropmove)&&qe(u,qi,p.cropmove),je(p.cropend)&&qe(u,si,p.cropend),je(p.crop)&&qe(u,He,p.crop),je(p.zoom)&&qe(u,oi,p.zoom),qe(d,le,this.onCropStart=this.cropStart.bind(this)),p.zoomable&&p.zoomOnWheel&&qe(d,et,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),p.toggleDragModeOnDblclick&&qe(d,_r,this.onDblclick=this.dblclick.bind(this)),qe(u.ownerDocument,ni,this.onCropMove=this.cropMove.bind(this)),qe(u.ownerDocument,st,this.onCropEnd=this.cropEnd.bind(this)),p.responsive&&qe(window,bt,this.onResize=this.resize.bind(this))},unbind:function(){var u=this.element,p=this.options,d=this.cropper;je(p.cropstart)&&St(u,Kt,p.cropstart),je(p.cropmove)&&St(u,qi,p.cropmove),je(p.cropend)&&St(u,si,p.cropend),je(p.crop)&&St(u,He,p.crop),je(p.zoom)&&St(u,oi,p.zoom),St(d,le,this.onCropStart),p.zoomable&&p.zoomOnWheel&&St(d,et,this.onWheel,{passive:!1,capture:!0}),p.toggleDragModeOnDblclick&&St(d,_r,this.onDblclick),St(u.ownerDocument,ni,this.onCropMove),St(u.ownerDocument,st,this.onCropEnd),p.responsive&&St(window,bt,this.onResize)}},Rr={resize:function(){if(!this.disabled){var u=this.options,p=this.container,d=this.containerData,x=p.offsetWidth/d.width,v=p.offsetHeight/d.height,T=Math.abs(x-1)>Math.abs(v-1)?x:v;if(T!==1){var M,$;u.restore&&(M=this.getCanvasData(),$=this.getCropBoxData()),this.render(),u.restore&&(this.setCanvasData(fe(M,function(z,I){M[I]=z*T})),this.setCropBoxData(fe($,function(z,I){$[I]=z*T})))}}},dblclick:function(){this.disabled||this.options.dragMode===Gt||this.setDragMode(Pr(this.dragBox,we)?Dt:rt)},wheel:function(u){var p=this,d=Number(this.options.wheelZoomRatio)||.1,x=1;this.disabled||(u.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){p.wheeling=!1},50),u.deltaY?x=u.deltaY>0?1:-1:u.wheelDelta?x=-u.wheelDelta/120:u.detail&&(x=u.detail>0?1:-1),this.zoom(-x*d,u)))},cropStart:function(u){var p=u.buttons,d=u.button;if(!(this.disabled||(u.type==="mousedown"||u.type==="pointerdown"&&u.pointerType==="mouse")&&(J(p)&&p!==1||J(d)&&d!==0||u.ctrlKey))){var x=this.options,v=this.pointers,T;u.changedTouches?fe(u.changedTouches,function(M){v[M.identifier]=Xi(M)}):v[u.pointerId||0]=Xi(u),Object.keys(v).length>1&&x.zoomable&&x.zoomOnTouch?T=L:T=gs(u.target,ut),Si.test(T)&&xi(this.element,Kt,{originalEvent:u,action:T})!==!1&&(u.preventDefault(),this.action=T,this.cropping=!1,T===S&&(this.cropping=!0,Se(this.dragBox,mt)))}},cropMove:function(u){var p=this.action;if(!(this.disabled||!p)){var d=this.pointers;u.preventDefault(),xi(this.element,qi,{originalEvent:u,action:p})!==!1&&(u.changedTouches?fe(u.changedTouches,function(x){me(d[x.identifier]||{},Xi(x,!0))}):me(d[u.pointerId||0]||{},Xi(u,!0)),this.change(u))}},cropEnd:function(u){if(!this.disabled){var p=this.action,d=this.pointers;u.changedTouches?fe(u.changedTouches,function(x){delete d[x.identifier]}):delete d[u.pointerId||0],p&&(u.preventDefault(),Object.keys(d).length||(this.action=""),this.cropping&&(this.cropping=!1,wt(this.dragBox,mt,this.cropped&&this.options.modal)),xi(this.element,si,{originalEvent:u,action:p}))}}},ws={change:function(u){var p=this.options,d=this.canvasData,x=this.containerData,v=this.cropBoxData,T=this.pointers,M=this.action,$=p.aspectRatio,z=v.left,I=v.top,N=v.width,q=v.height,ie=z+N,re=I+q,B=0,g=0,E=x.width,D=x.height,V=!0,Y;!$&&u.shiftKey&&($=N&&q?N/q:1),this.limited&&(B=v.minLeft,g=v.minTop,E=B+Math.min(x.width,d.width,d.left+d.width),D=g+Math.min(x.height,d.height,d.top+d.height));var X=T[Object.keys(T)[0]],U={x:X.endX-X.startX,y:X.endY-X.startY},Z=function(ge){switch(ge){case H:ie+U.x>E&&(U.x=E-ie);break;case j:z+U.x<B&&(U.x=B-z);break;case K:I+U.y<g&&(U.y=g-I);break;case G:re+U.y>D&&(U.y=D-re);break}};switch(M){case k:z+=U.x,I+=U.y;break;case H:if(U.x>=0&&(ie>=E||$&&(I<=g||re>=D))){V=!1;break}Z(H),N+=U.x,N<0&&(M=j,N=-N,z-=N),$&&(q=N/$,I+=(v.height-q)/2);break;case K:if(U.y<=0&&(I<=g||$&&(z<=B||ie>=E))){V=!1;break}Z(K),q-=U.y,I+=U.y,q<0&&(M=G,q=-q,I-=q),$&&(N=q*$,z+=(v.width-N)/2);break;case j:if(U.x<=0&&(z<=B||$&&(I<=g||re>=D))){V=!1;break}Z(j),N-=U.x,z+=U.x,N<0&&(M=H,N=-N,z-=N),$&&(q=N/$,I+=(v.height-q)/2);break;case G:if(U.y>=0&&(re>=D||$&&(z<=B||ie>=E))){V=!1;break}Z(G),q+=U.y,q<0&&(M=K,q=-q,I-=q),$&&(N=q*$,z+=(v.width-N)/2);break;case ee:if($){if(U.y<=0&&(I<=g||ie>=E)){V=!1;break}Z(K),q-=U.y,I+=U.y,N=q*$}else Z(K),Z(H),U.x>=0?ie<E?N+=U.x:U.y<=0&&I<=g&&(V=!1):N+=U.x,U.y<=0?I>g&&(q-=U.y,I+=U.y):(q-=U.y,I+=U.y);N<0&&q<0?(M=ve,q=-q,N=-N,I-=q,z-=N):N<0?(M=se,N=-N,z-=N):q<0&&(M=ae,q=-q,I-=q);break;case se:if($){if(U.y<=0&&(I<=g||z<=B)){V=!1;break}Z(K),q-=U.y,I+=U.y,N=q*$,z+=v.width-N}else Z(K),Z(j),U.x<=0?z>B?(N-=U.x,z+=U.x):U.y<=0&&I<=g&&(V=!1):(N-=U.x,z+=U.x),U.y<=0?I>g&&(q-=U.y,I+=U.y):(q-=U.y,I+=U.y);N<0&&q<0?(M=ae,q=-q,N=-N,I-=q,z-=N):N<0?(M=ee,N=-N,z-=N):q<0&&(M=ve,q=-q,I-=q);break;case ve:if($){if(U.x<=0&&(z<=B||re>=D)){V=!1;break}Z(j),N-=U.x,z+=U.x,q=N/$}else Z(G),Z(j),U.x<=0?z>B?(N-=U.x,z+=U.x):U.y>=0&&re>=D&&(V=!1):(N-=U.x,z+=U.x),U.y>=0?re<D&&(q+=U.y):q+=U.y;N<0&&q<0?(M=ee,q=-q,N=-N,I-=q,z-=N):N<0?(M=ae,N=-N,z-=N):q<0&&(M=se,q=-q,I-=q);break;case ae:if($){if(U.x>=0&&(ie>=E||re>=D)){V=!1;break}Z(H),N+=U.x,q=N/$}else Z(G),Z(H),U.x>=0?ie<E?N+=U.x:U.y>=0&&re>=D&&(V=!1):N+=U.x,U.y>=0?re<D&&(q+=U.y):q+=U.y;N<0&&q<0?(M=se,q=-q,N=-N,I-=q,z-=N):N<0?(M=ve,N=-N,z-=N):q<0&&(M=ee,q=-q,I-=q);break;case A:this.move(U.x,U.y),V=!1;break;case L:this.zoom(qn(T),u),V=!1;break;case S:if(!U.x||!U.y){V=!1;break}Y=Hn(this.cropper),z=X.startX-Y.left,I=X.startY-Y.top,N=v.minWidth,q=v.minHeight,U.x>0?M=U.y>0?ae:ee:U.x<0&&(z-=N,M=U.y>0?ve:se),U.y<0&&(I-=q),this.cropped||(Pe(this.cropBox,pe),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}V&&(v.width=N,v.height=q,v.left=z,v.top=I,this.action=M,this.renderCropBox()),fe(T,function(ne){ne.startX=ne.endX,ne.startY=ne.endY})}},Mr={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Se(this.dragBox,mt),Pe(this.cropBox,pe),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=me({},this.initialImageData),this.canvasData=me({},this.initialCanvasData),this.cropBoxData=me({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(me(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Pe(this.dragBox,mt),Se(this.cropBox,pe)),this},replace:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&u&&(this.isImg&&(this.element.src=u),p?(this.url=u,this.image.src=u,this.ready&&(this.viewBoxImage.src=u,fe(this.previews,function(d){d.getElementsByTagName("img")[0].src=u}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(u))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Pe(this.cropper,Ne)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Se(this.cropper,Ne)),this},destroy:function(){var u=this.element;return u[F]?(u[F]=void 0,this.isImg&&this.replaced&&(u.src=this.originalUrl),this.uncreate(),this):this},move:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,d=this.canvasData,x=d.left,v=d.top;return this.moveTo(Ei(u)?u:x+Number(u),Ei(p)?p:v+Number(p))},moveTo:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,d=this.canvasData,x=!1;return u=Number(u),p=Number(p),this.ready&&!this.disabled&&this.options.movable&&(J(u)&&(d.left=u,x=!0),J(p)&&(d.top=p,x=!0),x&&this.renderCanvas(!0)),this},zoom:function(u,p){var d=this.canvasData;return u=Number(u),u<0?u=1/(1-u):u=1+u,this.zoomTo(d.width*u/d.naturalWidth,null,p)},zoomTo:function(u,p,d){var x=this.options,v=this.canvasData,T=v.width,M=v.height,$=v.naturalWidth,z=v.naturalHeight;if(u=Number(u),u>=0&&this.ready&&!this.disabled&&x.zoomable){var I=$*u,N=z*u;if(xi(this.element,oi,{ratio:u,oldRatio:T/$,originalEvent:d})===!1)return this;if(d){var q=this.pointers,ie=Hn(this.cropper),re=q&&Object.keys(q).length?fl(q):{pageX:d.pageX,pageY:d.pageY};v.left-=(I-T)*((re.pageX-ie.left-v.left)/T),v.top-=(N-M)*((re.pageY-ie.top-v.top)/M)}else li(p)&&J(p.x)&&J(p.y)?(v.left-=(I-T)*((p.x-v.left)/T),v.top-=(N-M)*((p.y-v.top)/M)):(v.left-=(I-T)/2,v.top-=(N-M)/2);v.width=I,v.height=N,this.renderCanvas(!0)}return this},rotate:function(u){return this.rotateTo((this.imageData.rotate||0)+Number(u))},rotateTo:function(u){return u=Number(u),J(u)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=u%360,this.renderCanvas(!0,!0)),this},scaleX:function(u){var p=this.imageData.scaleY;return this.scale(u,J(p)?p:1)},scaleY:function(u){var p=this.imageData.scaleX;return this.scale(J(p)?p:1,u)},scale:function(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,d=this.imageData,x=!1;return u=Number(u),p=Number(p),this.ready&&!this.disabled&&this.options.scalable&&(J(u)&&(d.scaleX=u,x=!0),J(p)&&(d.scaleY=p,x=!0),x&&this.renderCanvas(!0,!0)),this},getData:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,p=this.options,d=this.imageData,x=this.canvasData,v=this.cropBoxData,T;if(this.ready&&this.cropped){T={x:v.left-x.left,y:v.top-x.top,width:v.width,height:v.height};var M=d.width/d.naturalWidth;if(fe(T,function(I,N){T[N]=I/M}),u){var $=Math.round(T.y+T.height),z=Math.round(T.x+T.width);T.x=Math.round(T.x),T.y=Math.round(T.y),T.width=z-T.x,T.height=$-T.y}}else T={x:0,y:0,width:0,height:0};return p.rotatable&&(T.rotate=d.rotate||0),p.scalable&&(T.scaleX=d.scaleX||1,T.scaleY=d.scaleY||1),T},setData:function(u){var p=this.options,d=this.imageData,x=this.canvasData,v={};if(this.ready&&!this.disabled&&li(u)){var T=!1;p.rotatable&&J(u.rotate)&&u.rotate!==d.rotate&&(d.rotate=u.rotate,T=!0),p.scalable&&(J(u.scaleX)&&u.scaleX!==d.scaleX&&(d.scaleX=u.scaleX,T=!0),J(u.scaleY)&&u.scaleY!==d.scaleY&&(d.scaleY=u.scaleY,T=!0)),T&&this.renderCanvas(!0,!0);var M=d.width/d.naturalWidth;J(u.x)&&(v.left=u.x*M+x.left),J(u.y)&&(v.top=u.y*M+x.top),J(u.width)&&(v.width=u.width*M),J(u.height)&&(v.height=u.height*M),this.setCropBoxData(v)}return this},getContainerData:function(){return this.ready?me({},this.containerData):{}},getImageData:function(){return this.sized?me({},this.imageData):{}},getCanvasData:function(){var u=this.canvasData,p={};return this.ready&&fe(["left","top","width","height","naturalWidth","naturalHeight"],function(d){p[d]=u[d]}),p},setCanvasData:function(u){var p=this.canvasData,d=p.aspectRatio;return this.ready&&!this.disabled&&li(u)&&(J(u.left)&&(p.left=u.left),J(u.top)&&(p.top=u.top),J(u.width)?(p.width=u.width,p.height=u.width/d):J(u.height)&&(p.height=u.height,p.width=u.height*d),this.renderCanvas(!0)),this},getCropBoxData:function(){var u=this.cropBoxData,p;return this.ready&&this.cropped&&(p={left:u.left,top:u.top,width:u.width,height:u.height}),p||{}},setCropBoxData:function(u){var p=this.cropBoxData,d=this.options.aspectRatio,x,v;return this.ready&&this.cropped&&!this.disabled&&li(u)&&(J(u.left)&&(p.left=u.left),J(u.top)&&(p.top=u.top),J(u.width)&&u.width!==p.width&&(x=!0,p.width=u.width),J(u.height)&&u.height!==p.height&&(v=!0,p.height=u.height),d&&(x?p.height=p.width/d:v&&(p.width=p.height*d)),this.renderCropBox()),this},getCroppedCanvas:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var p=this.canvasData,d=gl(this.image,this.imageData,p,u);if(!this.cropped)return d;var x=this.getData(u.rounded),v=x.x,T=x.y,M=x.width,$=x.height,z=d.width/Math.floor(p.naturalWidth);z!==1&&(v*=z,T*=z,M*=z,$*=z);var I=M/$,N=Zt({aspectRatio:I,width:u.maxWidth||1/0,height:u.maxHeight||1/0}),q=Zt({aspectRatio:I,width:u.minWidth||0,height:u.minHeight||0},"cover"),ie=Zt({aspectRatio:I,width:u.width||(z!==1?d.width:M),height:u.height||(z!==1?d.height:$)}),re=ie.width,B=ie.height;re=Math.min(N.width,Math.max(q.width,re)),B=Math.min(N.height,Math.max(q.height,B));var g=document.createElement("canvas"),E=g.getContext("2d");g.width=ui(re),g.height=ui(B),E.fillStyle=u.fillColor||"transparent",E.fillRect(0,0,re,B);var D=u.imageSmoothingEnabled,V=D===void 0?!0:D,Y=u.imageSmoothingQuality;E.imageSmoothingEnabled=V,Y&&(E.imageSmoothingQuality=Y);var X=d.width,U=d.height,Z=v,ne=T,ge,Et,Ee,Zi,Ai,Qt;Z<=-M||Z>X?(Z=0,ge=0,Ee=0,Ai=0):Z<=0?(Ee=-Z,Z=0,ge=Math.min(X,M+Z),Ai=ge):Z<=X&&(Ee=0,ge=Math.min(M,X-Z),Ai=ge),ge<=0||ne<=-$||ne>U?(ne=0,Et=0,Zi=0,Qt=0):ne<=0?(Zi=-ne,ne=0,Et=Math.min(U,$+ne),Qt=Et):ne<=U&&(Zi=0,Et=Math.min($,U-ne),Qt=Et);var ht=[Z,ne,ge,Et];if(Ai>0&&Qt>0){var Qi=re/M;ht.push(Ee*Qi,Zi*Qi,Ai*Qi,Qt*Qi)}return E.drawImage.apply(E,[d].concat(h(ht.map(function(Kn){return Math.floor(ui(Kn))})))),g},setAspectRatio:function(u){var p=this.options;return!this.disabled&&!Ei(u)&&(p.aspectRatio=Math.max(0,u)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(u){var p=this.options,d=this.dragBox,x=this.face;if(this.ready&&!this.disabled){var v=u===rt,T=p.movable&&u===Dt;u=v||T?u:Gt,p.dragMode=u,Ti(d,ut,u),wt(d,we,v),wt(d,gt,T),p.cropBoxMovable||(Ti(x,ut,u),wt(x,we,v),wt(x,gt,T))}return this}},_i=O.Cropper,Ci=(function(){function b(u){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,b),!u||!At.test(u.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=u,this.options=me({},Gi,li(p)&&p),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return a(b,[{key:"init",value:function(){var p=this.element,d=p.tagName.toLowerCase(),x;if(!p[F]){if(p[F]=this,d==="img"){if(this.isImg=!0,x=p.getAttribute("src")||"",this.originalUrl=x,!x)return;x=p.src}else d==="canvas"&&window.HTMLCanvasElement&&(x=p.toDataURL());this.load(x)}}},{key:"load",value:function(p){var d=this;if(p){this.url=p,this.imageData={};var x=this.element,v=this.options;if(!v.rotatable&&!v.scalable&&(v.checkOrientation=!1),!v.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Wi.test(p)){yt.test(p)?this.read(di(p)):this.clone();return}var T=new XMLHttpRequest,M=this.clone.bind(this);this.reloading=!0,this.xhr=T,T.onabort=M,T.onerror=M,T.ontimeout=M,T.onprogress=function(){T.getResponseHeader("content-type")!==ai&&T.abort()},T.onload=function(){d.read(T.response)},T.onloadend=function(){d.reloading=!1,d.xhr=null},v.checkCrossOrigin&&jn(p)&&x.crossOrigin&&(p=vs(p)),T.open("GET",p,!0),T.responseType="arraybuffer",T.withCredentials=x.crossOrigin==="use-credentials",T.send()}}},{key:"read",value:function(p){var d=this.options,x=this.imageData,v=Lr(p),T=0,M=1,$=1;if(v>1){this.url=bl(p,ai);var z=Vn(v);T=z.rotate,M=z.scaleX,$=z.scaleY}d.rotatable&&(x.rotate=T),d.scalable&&(x.scaleX=M,x.scaleY=$),this.clone()}},{key:"clone",value:function(){var p=this.element,d=this.url,x=p.crossOrigin,v=d;this.options.checkCrossOrigin&&jn(d)&&(x||(x="anonymous"),v=vs(d)),this.crossOrigin=x,this.crossOriginUrl=v;var T=document.createElement("img");x&&(T.crossOrigin=x),T.src=v||d,T.alt=p.alt||"The image to crop",this.image=T,T.onload=this.start.bind(this),T.onerror=this.stop.bind(this),Se(T,Ye),p.parentNode.insertBefore(T,p.nextSibling)}},{key:"start",value:function(){var p=this,d=this.image;d.onload=null,d.onerror=null,this.sizing=!0;var x=O.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(O.navigator.userAgent),v=function(z,I){me(p.imageData,{naturalWidth:z,naturalHeight:I,aspectRatio:z/I}),p.initialImageData=me({},p.imageData),p.sizing=!1,p.sized=!0,p.build()};if(d.naturalWidth&&!x){v(d.naturalWidth,d.naturalHeight);return}var T=document.createElement("img"),M=document.body||document.documentElement;this.sizingImage=T,T.onload=function(){v(T.width,T.height),x||M.removeChild(T)},T.src=d.src,x||(T.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",M.appendChild(T))}},{key:"stop",value:function(){var p=this.image;p.onload=null,p.onerror=null,p.parentNode.removeChild(p),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var p=this.element,d=this.options,x=this.image,v=p.parentNode,T=document.createElement("div");T.innerHTML=Ar;var M=T.querySelector(".".concat(F,"-container")),$=M.querySelector(".".concat(F,"-canvas")),z=M.querySelector(".".concat(F,"-drag-box")),I=M.querySelector(".".concat(F,"-crop-box")),N=I.querySelector(".".concat(F,"-face"));this.container=v,this.cropper=M,this.canvas=$,this.dragBox=z,this.cropBox=I,this.viewBox=M.querySelector(".".concat(F,"-view-box")),this.face=N,$.appendChild(x),Se(p,pe),v.insertBefore(M,p.nextSibling),Pe(x,Ye),this.initPreview(),this.bind(),d.initialAspectRatio=Math.max(0,d.initialAspectRatio)||NaN,d.aspectRatio=Math.max(0,d.aspectRatio)||NaN,d.viewMode=Math.max(0,Math.min(3,Math.round(d.viewMode)))||0,Se(I,pe),d.guides||Se(I.getElementsByClassName("".concat(F,"-dashed")),pe),d.center||Se(I.getElementsByClassName("".concat(F,"-center")),pe),d.background&&Se(M,"".concat(F,"-bg")),d.highlight||Se(N,Ct),d.cropBoxMovable&&(Se(N,gt),Ti(N,ut,k)),d.cropBoxResizable||(Se(I.getElementsByClassName("".concat(F,"-line")),pe),Se(I.getElementsByClassName("".concat(F,"-point")),pe)),this.render(),this.ready=!0,this.setDragMode(d.dragMode),d.autoCrop&&this.crop(),this.setData(d.data),je(d.ready)&&qe(p,Yt,d.ready,{once:!0}),xi(p,Yt)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var p=this.cropper.parentNode;p&&p.removeChild(this.cropper),Pe(this.element,pe)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=_i,b}},{key:"setDefaults",value:function(p){me(Gi,li(p)&&p)}}])})();return me(Ci.prototype,yl,Wn,Gn,Rr,ws,Mr),Ci}))});var Ir={eager:"eager",lazy:"lazy"},Ft=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return Fb(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function Fb(i){return i.toLowerCase()==="lazy"?Ir.lazy:Ir.eager}var Ob={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function Ts(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=rd();return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,Lb(e,i),e}}function Lb(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function Rb(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function xe(i,{target:e,cancelable:t,detail:r}={}){let s=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function Wh(i){i.preventDefault(),i.stopImmediatePropagation()}function Ss(){return document.visibilityState==="hidden"?Jh():Qh()}function Qh(){return new Promise(i=>requestAnimationFrame(()=>i()))}function Jh(){return new Promise(i=>setTimeout(()=>i(),0))}function ed(i=""){return new DOMParser().parseFromString(i,"text/html")}function td(i,...e){let t=Mb(i,e).replace(/^\n/,"").split(`
3
3
  `),r=t[0].match(/^\s+/),s=r?r[0].length:0;return t.map(n=>n.slice(s)).join(`
4
- `)}function wb(i,e){return i.reduce((t,r,s)=>{let n=e[s]==null?"":e[s];return t+r+n},"")}function Ci(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*16).toString(16)).join("")}function Kn(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function Sb(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function Yn(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Xn(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Eb(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function Wh(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Tb(i){return i=="advance"||i=="replace"||i=="restore"}function Zi(...i){let e=Kn("data-turbo-action",...i);return Tb(e)?e:null}function ql(i){return document.querySelector(`meta[name="${i}"]`)}function Zn(i){let e=ql(i);return e&&e.content}function Gh(){let i=ql("csp-nonce");if(i){let{nonce:e,content:t}=i;return e==""?t:e}}function xb(i,e){let t=ql(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function Ir(i,e){if(i instanceof Element)return i.closest(e)||Ir(i.assignedSlot||i.getRootNode()?.host,e)}function $l(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function Kh(i){return Array.from(i.querySelectorAll("[autofocus]")).find($l)}async function kb(i,e){let t=e();i(),await jh();let r=e();return[t,r]}function Yh(i){if(i==="_blank")return!1;if(i){for(let e of document.getElementsByName(i))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Xh(i){let e=Ir(i,"a[href], a[xlink\\:href]");if(!e||e.href.startsWith("#")||e.hasAttribute("download"))return null;let t=e.getAttribute("target");return t&&t!=="_self"?null:e}function _b(i,e){let t=null;return(...r)=>{let s=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(s,e)}}var Cb={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",Dh)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",Dh)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},pl=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=Cb[e]||e}},Ab=new pl({mode:"on",submitter:"disabled"}),Ue={drive:bb,forms:Ab};function Ve(i){return new URL(i.toString(),document.baseURI)}function vs(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function Vl(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return Ve(t)}function Pb(i){return(Rb(i).match(/\.[^.]*$/)||[])[0]||""}function Fb(i,e){let t=Nh(e.origin+e.pathname);return Nh(i.href)===t||i.href.startsWith(t)}function _i(i,e){return Fb(i,e)&&!Ue.drive.unvisitableExtensions.has(Pb(i))}function Zh(i){return Ve(i.getAttribute("href")||"")}function Ob(i){let e=vs(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function Gn(i){return Ob(i)}function Qh(i,e){return Ve(i).href==Ve(e).href}function Lb(i){return i.pathname.split("/").slice(1)}function Rb(i){return Lb(i).slice(-1)[0]}function Nh(i){return i.endsWith("/")?i:i+"/"}var Ss=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return Ve(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},fl=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Jh=new fl(20);function ed(i,e={}){let t=new Headers(e.headers||{}),r=Ci();return Jh.add(r),t.append("X-Turbo-Request-Id",r),window.fetch(i,{...e,headers:t})}function Wl(i){switch(i.toLowerCase()){case"get":return kt.get;case"post":return kt.post;case"put":return kt.put;case"patch":return kt.patch;case"delete":return kt.delete}}var kt={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Mb(i){switch(i.toLowerCase()){case Xi.multipart:return Xi.multipart;case Xi.plain:return Xi.plain;default:return Xi.urlEncoded}}var Xi={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Qi=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=Xi.urlEncoded){let[a,l]=Bh(Ve(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Wl(e)||kt.get;this.url.search="";let[s,n]=Bh(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=ed(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Ss(e);return ye("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Gl(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),r=ye("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!ye("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function Gl(i){return Wl(i)==kt.get}function Bh(i,e,t,r){let s=Array.from(t).length>0?new URLSearchParams(td(t)):i.searchParams;return Gl(e)?[Ib(i,s),null]:r==Xi.urlEncoded?[i,s]:[i,t]}function td(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function Ib(i,e){let t=new URLSearchParams(td(e));return i.search=t.toString(),i}var ml=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},Ai=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(vb(e)):e}constructor(e){this.fragment=Db(e)}};function Db(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(ws(r));e.replaceWith(t)}return i}var Nb=i=>i,Qn=class{keys=[];entries={};#e;constructor(e,t=Nb){this.size=e,this.#e=t}has(e){return this.#e(e)in this.entries}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){for(let e of Object.keys(this.entries))this.evict(e)}read(e){return this.entries[this.#e(e)]}write(e,t){this.entries[this.#e(e)]=t}touch(e){e=this.#e(e);let t=this.keys.indexOf(e);t>-1&&this.keys.splice(t,1),this.keys.unshift(e),this.trim()}trim(){for(let e of this.keys.splice(this.size))this.evict(e)}evict(e){delete this.entries[e]}},Bb=100,gl=class extends Qn{#e=null;#t={};constructor(e=1,t=Bb){super(e,Gn),this.prefetchDelay=t}putLater(e,t,r){this.#e=setTimeout(()=>{t.perform(),this.put(e,t,r),this.#e=null},this.prefetchDelay)}put(e,t,r=id){super.put(e,t),this.#t[Gn(e)]=new Date(new Date().getTime()+r)}clear(){super.clear(),this.#e&&clearTimeout(this.#e)}evict(e){super.evict(e),delete this.#t[e]}has(e){if(super.has(e)){let t=this.#t[Gn(e)];return t&&t>Date.now()}else return!1}},id=10*1e3,Mr=new gl,Lr={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Jn=class i{state=Lr.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=$b(t,r),o=qb(jb(t,r),n),a=Ub(t,r),l=Vb(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new Qi(this,n,o,a,t,l),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=Ve(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Lr,r=Kn("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof Ue.forms.confirm=="function"?Ue.forms.confirm:i.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Lr;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=zb(Zn("csrf-param"))||Zn("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(Ai.contentType)}requestStarted(e){this.state=Lr.waiting,this.submitter&&Ue.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Yn(this.formElement),ye("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Mr.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Mr.clear(),this.requestMustRedirect(e)&&Hb(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=Lr.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=Lr.stopped,this.submitter&&Ue.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),Xn(this.formElement),ye("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Sb("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Ub(i,e){let t=new FormData(i),r=e?.getAttribute("name"),s=e?.getAttribute("value");return r&&t.append(r,s||""),t}function zb(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Hb(i){return i.statusCode==200&&!i.redirected}function jb(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function qb(i,e){let t=Ve(i);return Gl(e)&&(t.search=""),t}function $b(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return Wl(t.toLowerCase())||kt.get}function Vb(i,e){return Mb(e?.getAttribute("formenctype")||i.enctype)}var Nr=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Kh(this.element)}get permanentElements(){return sd(this.element)}getPermanentElementById(e){return rd(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,n=e.getPermanentElementById(s);n&&(t[s]=[r,n])}return t}};function rd(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function sd(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var Es=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Wb(t,r)&&Gb(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Wb(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function Gb(i,e){let t=e?.getAttribute("formtarget")||i.getAttribute("target");return Yh(t)}var eo=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.focusElement(t),this.scrollToElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(vs(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:n}=e,o=s;if(r)try{this.renderPromise=new Promise(m=>this.#e=m),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(m=>this.#t=m),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},bl=class extends eo{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new Nr(this.element)}},to=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=Xh(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},io=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=Xh(t);if(r&&Yh(r.target)){let s=Zh(r);this.delegate.willFollowLinkToLocation(r,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},ro=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new io(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),s="hidden";for(let[g,E]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:s,name:g,value:E}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=Zi(e);l&&r.setAttribute("data-turbo-action",l);let h=e.getAttribute("data-turbo-confirm");h&&r.setAttribute("data-turbo-confirm",h),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},so=class{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Kb(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Kb(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var Ts=class{#e=null;static renderElement(e,t){}constructor(e,t,r,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await so.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},xs=class extends Ts{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,r,s,n,o=!0){super(t,r,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await ys(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await ys(),this.focusFirstAutofocusableElement(),await ys(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Yb(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=Xb(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=ws(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Yb(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function Xb(i,e){return i=="auto"||i=="smooth"?i:e}var Zb=(function(){let i=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:i,afterNodeAdded:i,beforeNodeMorphed:i,afterNodeMorphed:i,beforeNodeRemoved:i,afterNodeRemoved:i,beforeAttributeUpdated:i},head:{style:"merge",shouldPreserve:E=>E.getAttribute("im-preserve")==="true",shouldReAppend:E=>E.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function t(E,w,F={}){E=m(E);let L=g(w),M=h(E,L,F),D=s(M,()=>a(M,E,L,A=>A.morphStyle==="innerHTML"?(n(A,E,L),Array.from(E.childNodes)):r(A,E,L)));return M.pantry.remove(),D}function r(E,w,F){let L=g(w);return n(E,L,F,w,w.nextSibling),Array.from(L.childNodes)}function s(E,w){if(!E.config.restoreFocus)return w();let F=document.activeElement;if(!(F instanceof HTMLInputElement||F instanceof HTMLTextAreaElement))return w();let{id:L,selectionStart:M,selectionEnd:D}=F,A=w();return L&&L!==document.activeElement?.getAttribute("id")&&(F=E.target.querySelector(`[id="${L}"]`),F?.focus()),F&&!F.selectionEnd&&D&&F.setSelectionRange(M,D),A}let n=(function(){function E(T,x,P,I=null,B=null){x instanceof HTMLTemplateElement&&P instanceof HTMLTemplateElement&&(x=x.content,P=P.content),I||=x.firstChild;for(let U of P.childNodes){if(I&&I!=B){let q=F(T,U,I,B);if(q){q!==I&&M(T,I,q),o(q,U,T),I=q.nextSibling;continue}}if(U instanceof Element){let q=U.getAttribute("id");if(T.persistentIds.has(q)){let W=D(x,q,I,T);o(W,U,T),I=W.nextSibling;continue}}let j=w(x,U,I,T);j&&(I=j.nextSibling)}for(;I&&I!=B;){let U=I;I=I.nextSibling,L(T,U)}}function w(T,x,P,I){if(I.callbacks.beforeNodeAdded(x)===!1)return null;if(I.idMap.has(x)){let B=document.createElement(x.tagName);return T.insertBefore(B,P),o(B,x,I),I.callbacks.afterNodeAdded(B),B}else{let B=document.importNode(x,!0);return T.insertBefore(B,P),I.callbacks.afterNodeAdded(B),B}}let F=(function(){function T(I,B,U,j){let q=null,W=B.nextSibling,te=0,ae=U;for(;ae&&ae!=j;){if(P(ae,B)){if(x(I,ae,B))return ae;q===null&&(I.idMap.has(ae)||(q=ae))}if(q===null&&W&&P(ae,W)&&(te++,W=W.nextSibling,te>=2&&(q=void 0)),I.activeElementAndParents.includes(ae))break;ae=ae.nextSibling}return q||null}function x(I,B,U){let j=I.idMap.get(B),q=I.idMap.get(U);if(!q||!j)return!1;for(let W of j)if(q.has(W))return!0;return!1}function P(I,B){let U=I,j=B;return U.nodeType===j.nodeType&&U.tagName===j.tagName&&(!U.getAttribute?.("id")||U.getAttribute?.("id")===j.getAttribute?.("id"))}return T})();function L(T,x){if(T.idMap.has(x))R(T.pantry,x,null);else{if(T.callbacks.beforeNodeRemoved(x)===!1)return;x.parentNode?.removeChild(x),T.callbacks.afterNodeRemoved(x)}}function M(T,x,P){let I=x;for(;I&&I!==P;){let B=I;I=I.nextSibling,L(T,B)}return I}function D(T,x,P,I){let B=I.target.getAttribute?.("id")===x&&I.target||I.target.querySelector(`[id="${x}"]`)||I.pantry.querySelector(`[id="${x}"]`);return A(B,I),R(T,B,P),B}function A(T,x){let P=T.getAttribute("id");for(;T=T.parentNode;){let I=x.idMap.get(T);I&&(I.delete(P),I.size||x.idMap.delete(T))}}function R(T,x,P){if(T.moveBefore)try{T.moveBefore(x,P)}catch{T.insertBefore(x,P)}else T.insertBefore(x,P)}return E})(),o=(function(){function E(A,R,T){return T.ignoreActive&&A===document.activeElement?null:(T.callbacks.beforeNodeMorphed(A,R)===!1||(A instanceof HTMLHeadElement&&T.head.ignore||(A instanceof HTMLHeadElement&&T.head.style!=="morph"?l(A,R,T):(w(A,R,T),D(A,T)||n(T,A,R))),T.callbacks.afterNodeMorphed(A,R)),A)}function w(A,R,T){let x=R.nodeType;if(x===1){let P=A,I=R,B=P.attributes,U=I.attributes;for(let j of U)M(j.name,P,"update",T)||P.getAttribute(j.name)!==j.value&&P.setAttribute(j.name,j.value);for(let j=B.length-1;0<=j;j--){let q=B[j];if(q&&!I.hasAttribute(q.name)){if(M(q.name,P,"remove",T))continue;P.removeAttribute(q.name)}}D(P,T)||F(P,I,T)}(x===8||x===3)&&A.nodeValue!==R.nodeValue&&(A.nodeValue=R.nodeValue)}function F(A,R,T){if(A instanceof HTMLInputElement&&R instanceof HTMLInputElement&&R.type!=="file"){let x=R.value,P=A.value;L(A,R,"checked",T),L(A,R,"disabled",T),R.hasAttribute("value")?P!==x&&(M("value",A,"update",T)||(A.setAttribute("value",x),A.value=x)):M("value",A,"remove",T)||(A.value="",A.removeAttribute("value"))}else if(A instanceof HTMLOptionElement&&R instanceof HTMLOptionElement)L(A,R,"selected",T);else if(A instanceof HTMLTextAreaElement&&R instanceof HTMLTextAreaElement){let x=R.value,P=A.value;if(M("value",A,"update",T))return;x!==P&&(A.value=x),A.firstChild&&A.firstChild.nodeValue!==x&&(A.firstChild.nodeValue=x)}}function L(A,R,T,x){let P=R[T],I=A[T];if(P!==I){let B=M(T,A,"update",x);B||(A[T]=R[T]),P?B||A.setAttribute(T,""):M(T,A,"remove",x)||A.removeAttribute(T)}}function M(A,R,T,x){return A==="value"&&x.ignoreActiveValue&&R===document.activeElement?!0:x.callbacks.beforeAttributeUpdated(A,R,T)===!1}function D(A,R){return!!R.ignoreActiveValue&&A===document.activeElement&&A!==document.body}return E})();function a(E,w,F,L){if(E.head.block){let M=w.querySelector("head"),D=F.querySelector("head");if(M&&D){let A=l(M,D,E);return Promise.all(A).then(()=>{let R=Object.assign(E,{head:{block:!1,ignore:!0}});return L(R)})}}return L(E)}function l(E,w,F){let L=[],M=[],D=[],A=[],R=new Map;for(let x of w.children)R.set(x.outerHTML,x);for(let x of E.children){let P=R.has(x.outerHTML),I=F.head.shouldReAppend(x),B=F.head.shouldPreserve(x);P||B?I?M.push(x):(R.delete(x.outerHTML),D.push(x)):F.head.style==="append"?I&&(M.push(x),A.push(x)):F.head.shouldRemove(x)!==!1&&M.push(x)}A.push(...R.values());let T=[];for(let x of A){let P=document.createRange().createContextualFragment(x.outerHTML).firstChild;if(F.callbacks.beforeNodeAdded(P)!==!1){if("href"in P&&P.href||"src"in P&&P.src){let I,B=new Promise(function(U){I=U});P.addEventListener("load",function(){I()}),T.push(B)}E.appendChild(P),F.callbacks.afterNodeAdded(P),L.push(P)}}for(let x of M)F.callbacks.beforeNodeRemoved(x)!==!1&&(E.removeChild(x),F.callbacks.afterNodeRemoved(x));return F.head.afterHeadMorphed(E,{added:L,kept:D,removed:M}),T}let h=(function(){function E(T,x,P){let{persistentIds:I,idMap:B}=A(T,x),U=w(P),j=U.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(j))throw`Do not understand how to morph style ${j}`;return{target:T,newContent:x,config:U,morphStyle:j,ignoreActive:U.ignoreActive,ignoreActiveValue:U.ignoreActiveValue,restoreFocus:U.restoreFocus,idMap:B,persistentIds:I,pantry:F(),activeElementAndParents:L(T),callbacks:U.callbacks,head:U.head}}function w(T){let x=Object.assign({},e);return Object.assign(x,T),x.callbacks=Object.assign({},e.callbacks,T.callbacks),x.head=Object.assign({},e.head,T.head),x}function F(){let T=document.createElement("div");return T.hidden=!0,document.body.insertAdjacentElement("afterend",T),T}function L(T){let x=[],P=document.activeElement;if(P?.tagName!=="BODY"&&T.contains(P))for(;P&&(x.push(P),P!==T);)P=P.parentElement;return x}function M(T){let x=Array.from(T.querySelectorAll("[id]"));return T.getAttribute?.("id")&&x.push(T),x}function D(T,x,P,I){for(let B of I){let U=B.getAttribute("id");if(x.has(U)){let j=B;for(;j;){let q=T.get(j);if(q==null&&(q=new Set,T.set(j,q)),q.add(U),j===P)break;j=j.parentElement}}}}function A(T,x){let P=M(T),I=M(x),B=R(P,I),U=new Map;D(U,B,T,P);let j=x.__idiomorphRoot||x;return D(U,B,j,I),{persistentIds:B,idMap:U}}function R(T,x){let P=new Set,I=new Map;for(let{id:U,tagName:j}of T)I.has(U)?P.add(U):I.set(U,j);let B=new Set;for(let{id:U,tagName:j}of x)B.has(U)?P.add(U):I.get(U)===j&&B.add(U);for(let U of P)B.delete(U);return B}return E})(),{normalizeElement:m,normalizeParent:g}=(function(){let E=new WeakSet;function w(D){return D instanceof Document?D.documentElement:D}function F(D){if(D==null)return document.createElement("div");if(typeof D=="string")return F(M(D));if(E.has(D))return D;if(D instanceof Node){if(D.parentNode)return new L(D);{let A=document.createElement("div");return A.append(D),A}}else{let A=document.createElement("div");for(let R of[...D])A.append(R);return A}}class L{constructor(A){this.originalNode=A,this.realParentNode=A.parentNode,this.previousSibling=A.previousSibling,this.nextSibling=A.nextSibling}get childNodes(){let A=[],R=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;R&&R!=this.nextSibling;)A.push(R),R=R.nextSibling;return A}querySelectorAll(A){return this.childNodes.reduce((R,T)=>{if(T instanceof Element){T.matches(A)&&R.push(T);let x=T.querySelectorAll(A);for(let P=0;P<x.length;P++)R.push(x[P])}return R},[])}insertBefore(A,R){return this.realParentNode.insertBefore(A,R)}moveBefore(A,R){return this.realParentNode.moveBefore(A,R)}get __idiomorphRoot(){return this.originalNode}}function M(D){let A=new DOMParser,R=D.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(R.match(/<\/html>/)||R.match(/<\/head>/)||R.match(/<\/body>/)){let T=A.parseFromString(D,"text/html");if(R.match(/<\/html>/))return E.add(T),T;{let x=T.firstChild;return x&&E.add(x),x}}else{let x=A.parseFromString("<body><template>"+D+"</template></body>","text/html").body.querySelector("template").content;return E.add(x),x}}return{normalizeElement:w,normalizeParent:F}})();return{morph:t,defaults:e}})();function ao(i,e,{callbacks:t,...r}={}){Zb.morph(i,e,{...r,callbacks:new yl(t)})}function Kl(i,e,t={}){ao(i,e.childNodes,{...t,morphStyle:"innerHTML"})}function nd(i,e){return i instanceof _t&&i.shouldReloadWithMorph&&(!e||Qb(i,e))&&!i.closest("[data-turbo-permanent]")}function Qb(i,e){return e instanceof Element&&e.nodeName==="TURBO-FRAME"&&i.id===e.id&&(!e.getAttribute("src")||Qh(i.src,e.getAttribute("src")))}function od(i){return i.parentElement.closest("turbo-frame[src][refresh=morph]")}var yl=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!ye("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!ye("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&ye("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},no=class extends xs{static renderElement(e,t){ye("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Kl(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>nd(r,s)&&od(r)===e?(r.reload(),!1):!0}})}async preservingPermanentElements(e){return await e()}},vl=class i{static animationDuration=300;static get defaultCSS(){return Vh`
4
+ `)}function Mb(i,e){return i.reduce((t,r,s)=>{let n=e[s]==null?"":e[s];return t+r+n},"")}function Fi(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*16).toString(16)).join("")}function Zn(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function Db(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function Qn(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Jn(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ib(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function id(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Nb(i){return i=="advance"||i=="replace"||i=="restore"}function tr(...i){let e=Zn("data-turbo-action",...i);return Nb(e)?e:null}function Zl(i){return document.querySelector(`meta[name="${i}"]`)}function eo(i){let e=Zl(i);return e&&e.content}function rd(){let i=Zl("csp-nonce");if(i){let{nonce:e,content:t}=i;return e==""?t:e}}function Bb(i,e){let t=Zl(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function Br(i,e){if(i instanceof Element)return i.closest(e)||Br(i.assignedSlot||i.getRootNode()?.host,e)}function Ql(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function sd(i){return Array.from(i.querySelectorAll("[autofocus]")).find(Ql)}async function Ub(i,e){let t=e();i(),await Qh();let r=e();return[t,r]}function nd(i){if(i==="_blank")return!1;if(i){for(let e of document.getElementsByName(i))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function od(i){let e=Br(i,"a[href], a[xlink\\:href]");if(!e||e.href.startsWith("#")||e.hasAttribute("download"))return null;let t=e.getAttribute("target");return t&&t!=="_self"?null:e}function zb(i,e){let t=null;return(...r)=>{let s=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(s,e)}}var Hb={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",Wh)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",Wh)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},Sl=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=Hb[e]||e}},jb=new Sl({mode:"on",submitter:"disabled"}),$e={drive:Ob,forms:jb};function Xe(i){return new URL(i.toString(),document.baseURI)}function Es(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function Jl(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return Xe(t)}function qb(i){return(Gb(i).match(/\.[^.]*$/)||[])[0]||""}function $b(i,e){let t=Gh(e.origin+e.pathname);return Gh(i.href)===t||i.href.startsWith(t)}function Pi(i,e){return $b(i,e)&&!$e.drive.unvisitableExtensions.has(qb(i))}function ad(i){return Xe(i.getAttribute("href")||"")}function Vb(i){let e=Es(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function Xn(i){return Vb(i)}function ld(i,e){return Xe(i).href==Xe(e).href}function Wb(i){return i.pathname.split("/").slice(1)}function Gb(i){return Wb(i).slice(-1)[0]}function Gh(i){return i.endsWith("/")?i:i+"/"}var xs=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return Xe(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},El=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},cd=new El(20);function ud(i,e={}){let t=new Headers(e.headers||{}),r=Fi();return cd.add(r),t.append("X-Turbo-Request-Id",r),window.fetch(i,{...e,headers:t})}function ec(i){switch(i.toLowerCase()){case"get":return Pt.get;case"post":return Pt.post;case"put":return Pt.put;case"patch":return Pt.patch;case"delete":return Pt.delete}}var Pt={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Kb(i){switch(i.toLowerCase()){case er.multipart:return er.multipart;case er.plain:return er.plain;default:return er.urlEncoded}}var er={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},ir=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=er.urlEncoded){let[a,l]=Kh(Xe(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=ec(e)||Pt.get;this.url.search="";let[s,n]=Kh(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=ud(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new xs(e);return xe("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return tc(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),r=xe("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!xe("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function tc(i){return ec(i)==Pt.get}function Kh(i,e,t,r){let s=Array.from(t).length>0?new URLSearchParams(hd(t)):i.searchParams;return tc(e)?[Yb(i,s),null]:r==er.urlEncoded?[i,s]:[i,t]}function hd(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function Yb(i,e){let t=new URLSearchParams(hd(e));return i.search=t.toString(),i}var Tl=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},Oi=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(Rb(e)):e}constructor(e){this.fragment=Xb(e)}};function Xb(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(Ts(r));e.replaceWith(t)}return i}var Zb=i=>i,to=class{keys=[];entries={};#e;constructor(e,t=Zb){this.size=e,this.#e=t}has(e){return this.#e(e)in this.entries}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){for(let e of Object.keys(this.entries))this.evict(e)}read(e){return this.entries[this.#e(e)]}write(e,t){this.entries[this.#e(e)]=t}touch(e){e=this.#e(e);let t=this.keys.indexOf(e);t>-1&&this.keys.splice(t,1),this.keys.unshift(e),this.trim()}trim(){for(let e of this.keys.splice(this.size))this.evict(e)}evict(e){delete this.entries[e]}},Qb=100,xl=class extends to{#e=null;#t={};constructor(e=1,t=Qb){super(e,Xn),this.prefetchDelay=t}putLater(e,t,r){this.#e=setTimeout(()=>{t.perform(),this.put(e,t,r),this.#e=null},this.prefetchDelay)}put(e,t,r=dd){super.put(e,t),this.#t[Xn(e)]=new Date(new Date().getTime()+r)}clear(){super.clear(),this.#e&&clearTimeout(this.#e)}evict(e){super.evict(e),delete this.#t[e]}has(e){if(super.has(e)){let t=this.#t[Xn(e)];return t&&t>Date.now()}else return!1}},dd=10*1e3,Nr=new xl,Dr={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},io=class i{state=Dr.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=sy(t,r),o=ry(iy(t,r),n),a=Jb(t,r),l=ny(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new ir(this,n,o,a,t,l),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=Xe(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Dr,r=Zn("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof $e.forms.confirm=="function"?$e.forms.confirm:i.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Dr;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=ey(eo("csrf-param"))||eo("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(Oi.contentType)}requestStarted(e){this.state=Dr.waiting,this.submitter&&$e.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Qn(this.formElement),xe("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Nr.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Nr.clear(),this.requestMustRedirect(e)&&ty(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=Dr.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=Dr.stopped,this.submitter&&$e.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),Jn(this.formElement),xe("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Db("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Jb(i,e){let t=new FormData(i),r=e?.getAttribute("name"),s=e?.getAttribute("value");return r&&t.append(r,s||""),t}function ey(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function ty(i){return i.statusCode==200&&!i.redirected}function iy(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function ry(i,e){let t=Xe(i);return tc(e)&&(t.search=""),t}function sy(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return ec(t.toLowerCase())||Pt.get}function ny(i,e){return Kb(e?.getAttribute("formenctype")||i.enctype)}var zr=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return sd(this.element)}get permanentElements(){return fd(this.element)}getPermanentElementById(e){return pd(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,n=e.getPermanentElementById(s);n&&(t[s]=[r,n])}return t}};function pd(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function fd(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var ks=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&oy(t,r)&&ay(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function oy(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function ay(i,e){let t=e?.getAttribute("formtarget")||i.getAttribute("target");return nd(t)}var ro=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.focusElement(t),this.scrollToElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(Es(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:n}=e,o=s;if(r)try{this.renderPromise=new Promise(f=>this.#e=f),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(f=>this.#t=f),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},kl=class extends ro{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new zr(this.element)}},so=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=od(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},no=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=od(t);if(r&&nd(r.target)){let s=ad(r);this.delegate.willFollowLinkToLocation(r,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},oo=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new no(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),s="hidden";for(let[m,w]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:s,name:m,value:w}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=tr(e);l&&r.setAttribute("data-turbo-action",l);let h=e.getAttribute("data-turbo-confirm");h&&r.setAttribute("data-turbo-confirm",h),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},ao=class{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=ly(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function ly(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var _s=class{#e=null;static renderElement(e,t){}constructor(e,t,r,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await ao.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},Cs=class extends _s{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,r,s,n,o=!0){super(t,r,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await Ss(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Ss(),this.focusFirstAutofocusableElement(),await Ss(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=cy(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=uy(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=Ts(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function cy(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function uy(i,e){return i=="auto"||i=="smooth"?i:e}var hy=(function(){let i=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:i,afterNodeAdded:i,beforeNodeMorphed:i,afterNodeMorphed:i,beforeNodeRemoved:i,afterNodeRemoved:i,beforeAttributeUpdated:i},head:{style:"merge",shouldPreserve:w=>w.getAttribute("im-preserve")==="true",shouldReAppend:w=>w.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function t(w,y,_={}){w=f(w);let P=m(y),O=h(w,P,_),R=s(O,()=>a(O,w,P,C=>C.morphStyle==="innerHTML"?(n(C,w,P),Array.from(w.childNodes)):r(C,w,P)));return O.pantry.remove(),R}function r(w,y,_){let P=m(y);return n(w,P,_,y,y.nextSibling),Array.from(P.childNodes)}function s(w,y){if(!w.config.restoreFocus)return y();let _=document.activeElement;if(!(_ instanceof HTMLInputElement||_ instanceof HTMLTextAreaElement))return y();let{id:P,selectionStart:O,selectionEnd:R}=_,C=y();return P&&P!==document.activeElement?.getAttribute("id")&&(_=w.target.querySelector(`[id="${P}"]`),_?.focus()),_&&!_.selectionEnd&&R&&_.setSelectionRange(O,R),C}let n=(function(){function w(k,S,A,L=null,H=null){S instanceof HTMLTemplateElement&&A instanceof HTMLTemplateElement&&(S=S.content,A=A.content),L||=S.firstChild;for(let j of A.childNodes){if(L&&L!=H){let K=_(k,j,L,H);if(K){K!==L&&O(k,L,K),o(K,j,k),L=K.nextSibling;continue}}if(j instanceof Element){let K=j.getAttribute("id");if(k.persistentIds.has(K)){let ee=R(S,K,L,k);o(ee,j,k),L=ee.nextSibling;continue}}let G=y(S,j,L,k);G&&(L=G.nextSibling)}for(;L&&L!=H;){let j=L;L=L.nextSibling,P(k,j)}}function y(k,S,A,L){if(L.callbacks.beforeNodeAdded(S)===!1)return null;if(L.idMap.has(S)){let H=document.createElement(S.tagName);return k.insertBefore(H,A),o(H,S,L),L.callbacks.afterNodeAdded(H),H}else{let H=document.importNode(S,!0);return k.insertBefore(H,A),L.callbacks.afterNodeAdded(H),H}}let _=(function(){function k(L,H,j,G){let K=null,ee=H.nextSibling,se=0,ae=j;for(;ae&&ae!=G;){if(A(ae,H)){if(S(L,ae,H))return ae;K===null&&(L.idMap.has(ae)||(K=ae))}if(K===null&&ee&&A(ae,ee)&&(se++,ee=ee.nextSibling,se>=2&&(K=void 0)),L.activeElementAndParents.includes(ae))break;ae=ae.nextSibling}return K||null}function S(L,H,j){let G=L.idMap.get(H),K=L.idMap.get(j);if(!K||!G)return!1;for(let ee of G)if(K.has(ee))return!0;return!1}function A(L,H){let j=L,G=H;return j.nodeType===G.nodeType&&j.tagName===G.tagName&&(!j.getAttribute?.("id")||j.getAttribute?.("id")===G.getAttribute?.("id"))}return k})();function P(k,S){if(k.idMap.has(S))F(k.pantry,S,null);else{if(k.callbacks.beforeNodeRemoved(S)===!1)return;S.parentNode?.removeChild(S),k.callbacks.afterNodeRemoved(S)}}function O(k,S,A){let L=S;for(;L&&L!==A;){let H=L;L=L.nextSibling,P(k,H)}return L}function R(k,S,A,L){let H=L.target.getAttribute?.("id")===S&&L.target||L.target.querySelector(`[id="${S}"]`)||L.pantry.querySelector(`[id="${S}"]`);return C(H,L),F(k,H,A),H}function C(k,S){let A=k.getAttribute("id");for(;k=k.parentNode;){let L=S.idMap.get(k);L&&(L.delete(A),L.size||S.idMap.delete(k))}}function F(k,S,A){if(k.moveBefore)try{k.moveBefore(S,A)}catch{k.insertBefore(S,A)}else k.insertBefore(S,A)}return w})(),o=(function(){function w(C,F,k){return k.ignoreActive&&C===document.activeElement?null:(k.callbacks.beforeNodeMorphed(C,F)===!1||(C instanceof HTMLHeadElement&&k.head.ignore||(C instanceof HTMLHeadElement&&k.head.style!=="morph"?l(C,F,k):(y(C,F,k),R(C,k)||n(k,C,F))),k.callbacks.afterNodeMorphed(C,F)),C)}function y(C,F,k){let S=F.nodeType;if(S===1){let A=C,L=F,H=A.attributes,j=L.attributes;for(let G of j)O(G.name,A,"update",k)||A.getAttribute(G.name)!==G.value&&A.setAttribute(G.name,G.value);for(let G=H.length-1;0<=G;G--){let K=H[G];if(K&&!L.hasAttribute(K.name)){if(O(K.name,A,"remove",k))continue;A.removeAttribute(K.name)}}R(A,k)||_(A,L,k)}(S===8||S===3)&&C.nodeValue!==F.nodeValue&&(C.nodeValue=F.nodeValue)}function _(C,F,k){if(C instanceof HTMLInputElement&&F instanceof HTMLInputElement&&F.type!=="file"){let S=F.value,A=C.value;P(C,F,"checked",k),P(C,F,"disabled",k),F.hasAttribute("value")?A!==S&&(O("value",C,"update",k)||(C.setAttribute("value",S),C.value=S)):O("value",C,"remove",k)||(C.value="",C.removeAttribute("value"))}else if(C instanceof HTMLOptionElement&&F instanceof HTMLOptionElement)P(C,F,"selected",k);else if(C instanceof HTMLTextAreaElement&&F instanceof HTMLTextAreaElement){let S=F.value,A=C.value;if(O("value",C,"update",k))return;S!==A&&(C.value=S),C.firstChild&&C.firstChild.nodeValue!==S&&(C.firstChild.nodeValue=S)}}function P(C,F,k,S){let A=F[k],L=C[k];if(A!==L){let H=O(k,C,"update",S);H||(C[k]=F[k]),A?H||C.setAttribute(k,""):O(k,C,"remove",S)||C.removeAttribute(k)}}function O(C,F,k,S){return C==="value"&&S.ignoreActiveValue&&F===document.activeElement?!0:S.callbacks.beforeAttributeUpdated(C,F,k)===!1}function R(C,F){return!!F.ignoreActiveValue&&C===document.activeElement&&C!==document.body}return w})();function a(w,y,_,P){if(w.head.block){let O=y.querySelector("head"),R=_.querySelector("head");if(O&&R){let C=l(O,R,w);return Promise.all(C).then(()=>{let F=Object.assign(w,{head:{block:!1,ignore:!0}});return P(F)})}}return P(w)}function l(w,y,_){let P=[],O=[],R=[],C=[],F=new Map;for(let S of y.children)F.set(S.outerHTML,S);for(let S of w.children){let A=F.has(S.outerHTML),L=_.head.shouldReAppend(S),H=_.head.shouldPreserve(S);A||H?L?O.push(S):(F.delete(S.outerHTML),R.push(S)):_.head.style==="append"?L&&(O.push(S),C.push(S)):_.head.shouldRemove(S)!==!1&&O.push(S)}C.push(...F.values());let k=[];for(let S of C){let A=document.createRange().createContextualFragment(S.outerHTML).firstChild;if(_.callbacks.beforeNodeAdded(A)!==!1){if("href"in A&&A.href||"src"in A&&A.src){let L,H=new Promise(function(j){L=j});A.addEventListener("load",function(){L()}),k.push(H)}w.appendChild(A),_.callbacks.afterNodeAdded(A),P.push(A)}}for(let S of O)_.callbacks.beforeNodeRemoved(S)!==!1&&(w.removeChild(S),_.callbacks.afterNodeRemoved(S));return _.head.afterHeadMorphed(w,{added:P,kept:R,removed:O}),k}let h=(function(){function w(k,S,A){let{persistentIds:L,idMap:H}=C(k,S),j=y(A),G=j.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(G))throw`Do not understand how to morph style ${G}`;return{target:k,newContent:S,config:j,morphStyle:G,ignoreActive:j.ignoreActive,ignoreActiveValue:j.ignoreActiveValue,restoreFocus:j.restoreFocus,idMap:H,persistentIds:L,pantry:_(),activeElementAndParents:P(k),callbacks:j.callbacks,head:j.head}}function y(k){let S=Object.assign({},e);return Object.assign(S,k),S.callbacks=Object.assign({},e.callbacks,k.callbacks),S.head=Object.assign({},e.head,k.head),S}function _(){let k=document.createElement("div");return k.hidden=!0,document.body.insertAdjacentElement("afterend",k),k}function P(k){let S=[],A=document.activeElement;if(A?.tagName!=="BODY"&&k.contains(A))for(;A&&(S.push(A),A!==k);)A=A.parentElement;return S}function O(k){let S=Array.from(k.querySelectorAll("[id]"));return k.getAttribute?.("id")&&S.push(k),S}function R(k,S,A,L){for(let H of L){let j=H.getAttribute("id");if(S.has(j)){let G=H;for(;G;){let K=k.get(G);if(K==null&&(K=new Set,k.set(G,K)),K.add(j),G===A)break;G=G.parentElement}}}}function C(k,S){let A=O(k),L=O(S),H=F(A,L),j=new Map;R(j,H,k,A);let G=S.__idiomorphRoot||S;return R(j,H,G,L),{persistentIds:H,idMap:j}}function F(k,S){let A=new Set,L=new Map;for(let{id:j,tagName:G}of k)L.has(j)?A.add(j):L.set(j,G);let H=new Set;for(let{id:j,tagName:G}of S)H.has(j)?A.add(j):L.get(j)===G&&H.add(j);for(let j of A)H.delete(j);return H}return w})(),{normalizeElement:f,normalizeParent:m}=(function(){let w=new WeakSet;function y(R){return R instanceof Document?R.documentElement:R}function _(R){if(R==null)return document.createElement("div");if(typeof R=="string")return _(O(R));if(w.has(R))return R;if(R instanceof Node){if(R.parentNode)return new P(R);{let C=document.createElement("div");return C.append(R),C}}else{let C=document.createElement("div");for(let F of[...R])C.append(F);return C}}class P{constructor(C){this.originalNode=C,this.realParentNode=C.parentNode,this.previousSibling=C.previousSibling,this.nextSibling=C.nextSibling}get childNodes(){let C=[],F=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;F&&F!=this.nextSibling;)C.push(F),F=F.nextSibling;return C}querySelectorAll(C){return this.childNodes.reduce((F,k)=>{if(k instanceof Element){k.matches(C)&&F.push(k);let S=k.querySelectorAll(C);for(let A=0;A<S.length;A++)F.push(S[A])}return F},[])}insertBefore(C,F){return this.realParentNode.insertBefore(C,F)}moveBefore(C,F){return this.realParentNode.moveBefore(C,F)}get __idiomorphRoot(){return this.originalNode}}function O(R){let C=new DOMParser,F=R.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(F.match(/<\/html>/)||F.match(/<\/head>/)||F.match(/<\/body>/)){let k=C.parseFromString(R,"text/html");if(F.match(/<\/html>/))return w.add(k),k;{let S=k.firstChild;return S&&w.add(S),S}}else{let S=C.parseFromString("<body><template>"+R+"</template></body>","text/html").body.querySelector("template").content;return w.add(S),S}}return{normalizeElement:y,normalizeParent:_}})();return{morph:t,defaults:e}})();function uo(i,e,{callbacks:t,...r}={}){hy.morph(i,e,{...r,callbacks:new _l(t)})}function ic(i,e,t={}){uo(i,e.childNodes,{...t,morphStyle:"innerHTML"})}function md(i,e){return i instanceof Ft&&i.shouldReloadWithMorph&&(!e||dy(i,e))&&!i.closest("[data-turbo-permanent]")}function dy(i,e){return e instanceof Element&&e.nodeName==="TURBO-FRAME"&&i.id===e.id&&(!e.getAttribute("src")||ld(i.src,e.getAttribute("src")))}function gd(i){return i.parentElement.closest("turbo-frame[src][refresh=morph]")}var _l=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!xe("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!xe("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&xe("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},lo=class extends Cs{static renderElement(e,t){xe("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),ic(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>md(r,s)&&gd(r)===e?(r.reload(),!1):!0}})}async preservingPermanentElements(e){return await e()}},Cl=class i{static animationDuration=300;static get defaultCSS(){return td`
5
5
  .turbo-progress-bar {
6
6
  position: fixed;
7
7
  display: block;
@@ -15,7 +15,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
15
15
  opacity ${i.animationDuration/2}ms ${i.animationDuration/2}ms ease-in;
16
16
  transform: translate3d(0, 0, 0);
17
17
  }
18
- `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Gh();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},wl=class extends Nr{detailsByOuterHTML=this.children.filter(e=>!iy(e)).map(e=>ny(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:Jb(t),tracked:ey(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return sy(s,e)?s:t},void 0|void 0)}};function Jb(i){if(ty(i))return"script";if(ry(i))return"stylesheet"}function ey(i){return i.getAttribute("data-turbo-track")=="reload"}function ty(i){return i.localName=="script"}function iy(i){return i.localName=="noscript"}function ry(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function sy(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function ny(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var Bt=class i extends Nr{static fromHTMLString(e=""){return this.fromDocument($h(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new wl(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";for(let s of e.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Ve(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Sl=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},oy={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},Wn={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},ci={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Dr={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},ay={advance:"forward",restore:"back",replace:"none"},El=class{identifier=Ci();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=ci.initialized;viewTransitioner=new Sl;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||Ci();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:h,response:m,visitCachedSnapshot:g,willRender:E,updateHistory:w,shouldCacheSnapshot:F,acceptsStreamResponse:L,direction:M,refresh:D}={...oy,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=h,this.response=m,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=g,this.willRender=E,this.updateHistory=w,this.scrolled=!E,this.shouldCacheSnapshot=F,this.acceptsStreamResponse=L,this.direction=M||ay[n],this.refresh=D}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==ci.initialized&&(this.recordTimingMetric(Wn.visitStart),this.state=ci.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==ci.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=ci.canceled)}complete(){this.state==ci.started&&(this.recordTimingMetric(Wn.visitEnd),this.adapter.visitCompleted(this),this.state=ci.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==ci.started&&(this.state=ci.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Wh(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Qi(this,kt.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Wn.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Uh(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Wn.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Uh(e)&&t!=null){let r=Bt.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Bt.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!vs(this.location)||e.hasAnchor(vs(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Bt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Ai.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Dr.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Dr.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:Dr.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=vs(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Uh(i){return i>=200&&i<300}var Tl=class{progressBar=new vl;constructor(e){this.session=e}visitProposedToLocation(e,t){_i(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Ci(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case Dr.networkFailure:case Dr.timeoutFailure:case Dr.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){ye("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},xl=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},kl=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new to(this,t),this.formSubmitObserver=new Es(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Vl(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Ve(s?.content??"/");return this.#t(e,t)&&_i(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof _t)return s}}},_l=class{location;restorationIdentifier=Ci();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=Ci()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},Cl=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#o,!0),this.started=!0};#i=e=>{if(Zn("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#l(t)){let s=t,n=Zh(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new Qi(this,kt.get,n,new URLSearchParams,t);o.fetchOptions.priority="low",Mr.putLater(n,o,this.#s)}}};#r=e=>{e.target===this.#e&&this.#n()};#n=()=>{Mr.clear(),this.#e=null};#o=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Mr.get(e.detail.url);t&&(e.detail.fetchRequest=t),Mr.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#s(){return Number(Zn("turbo-prefetch-cache-time"))||id}#l(e){return!(!e.getAttribute("href")||ly(e)||cy(e)||uy(e)||hy(e)||py(e))}},ly=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),cy=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),uy=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=Ir(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},hy=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||dy(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},dy=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),py=i=>ye("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,Al=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new El(this,Ve(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Jn(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=Bt.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return Zi(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},Yi={initial:0,loading:1,interactive:2,complete:3},Pl=class{stage=Yi.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==Yi.initial&&(this.stage=Yi.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Yi.loading&&(this.stage=Yi.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Yi.interactive&&(this.stage=Yi.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},Fl=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},Ol=class{render({fragment:e}){so.preservingPermanentElements(this,fy(e),()=>{my(e,()=>{gy(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function fy(i){let e=sd(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=rd(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function my(i,e){let t=`turbo-stream-autofocus-${Ci()}`,r=i.querySelectorAll("turbo-stream"),s=by(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await ys(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);$l(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function gy(i){let[e,t]=await kb(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);$l(s)&&s!=t&&s.focus()}}function by(i){for(let e of i){let t=Kh(e.templateElement.content);if(t)return t}return null}var Ll=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=yy(e);t&&vy(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Ai.wrap(e))}};function yy(i){let e=i.detail?.fetchResponse;if(e instanceof Ss)return e}function vy(i){return(i.contentType??"").startsWith(Ai.contentType)}var Rl=class extends Ts{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=ws(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},ks=class extends Ts{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Eb(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(ws(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=ws(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},oo=class extends ks{static renderElement(e,t){ao(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>nd(r,s)&&!od(r)?(r.reload(),!1):!0}}),ye("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},Ml=class extends Qn{constructor(e){super(e,Gn)}get snapshots(){return this.entries}},Il=class extends eo{snapshotCache=new Ml(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?oo:ks,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new Rl(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await qh();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return Bt.fromElement(this.element)}},Dl=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Qi(this,kt.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=Bt.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},Nl=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){xb("turbo-cache-control",e)}},Bl=class{navigator=new Al(this);history=new _l(this);view=new Il(this,document.documentElement);adapter=new Tl(this);pageObserver=new Pl(this);cacheObserver=new xl;linkPrefetchObserver=new Cl(this,document);linkClickObserver=new io(this,window);formSubmitObserver=new Es(this,document);scrollObserver=new Fl(this);streamObserver=new Ll(this);formLinkClickObserver=new ro(this,document.documentElement);frameRedirector=new kl(this,document.documentElement);streamMessageRenderer=new Ol;cache=new Nl(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new Dl(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof _t){let s=t.action||Zi(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Ve(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:s,scroll:n}=t,o=s&&this.recentRequests.has(s),a=e===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Ai.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){Ue.drive.progressBarDelay=e}get progressBarDelay(){return Ue.drive.progressBarDelay}set drive(e){Ue.drive.enabled=e}get drive(){return Ue.drive.enabled}set formMode(e){Ue.forms.mode=e}get formMode(){return Ue.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=_b(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||Ir(e,"turbo-frame:not([disabled])");if(t||r||n instanceof _t)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&_i(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&_i(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&_i(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&_i(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){zh(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Yn(document.documentElement),this.view.markVisitDirection(e.direction)),zh(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Xn(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=Vl(e,t);return this.submissionIsNavigatable(e,t)&&_i(Ve(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return ye("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return ye("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return ye("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return ye("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return ye("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return ye("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return ye("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return ye("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return ye("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(Ue.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return Ue.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Ir(e,"[data-turbo]"),r=Ir(e,"turbo-frame");return Ue.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return Zi(e)||"advance"}get snapshot(){return this.view.snapshot}};function zh(i){Object.defineProperties(i,wy)}var wy={absoluteURL:{get(){return this.toString()}}},Pe=new Bl(Jh),{cache:Sy,navigator:Ey}=Pe;function ad(){Pe.start()}function Ty(i){Pe.registerAdapter(i)}function xy(i,e){Pe.visit(i,e)}function ld(i){Pe.connectStreamSource(i)}function cd(i){Pe.disconnectStreamSource(i)}function ky(i){Pe.renderStreamMessage(i)}function _y(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ue.drive.progressBarDelay=i}function Cy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ue.forms.confirm=i}function Ay(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ue.forms.mode=i}function Py(i,e){oo.renderElement(i,e)}function Yl(i,e){no.renderElement(i,e)}var Fy=Object.freeze({__proto__:null,navigator:Ey,session:Pe,cache:Sy,PageRenderer:ks,PageSnapshot:Bt,FrameRenderer:xs,fetch:ed,config:Ue,start:ad,registerAdapter:Ty,visit:xy,connectStreamSource:ld,disconnectStreamSource:cd,renderStreamMessage:ky,setProgressBarDelay:_y,setConfirmMethod:Cy,setFormMode:Ay,morphBodyElements:Py,morphTurboFrameElements:Yl,morphChildren:Kl,morphElements:ao}),Ul=class extends Error{},zl=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#r=!1;#n=new Set;#o=!1;action=null;constructor(e){this.element=e,this.view=new bl(this,this.element),this.appearanceObserver=new ml(this,this.element),this.formLinkClickObserver=new ro(this,this.element),this.linkInterceptor=new to(this,this.element),this.restorationIdentifier=Ci(),this.formSubmitObserver=new Es(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Rr.lazy?this.appearanceObserver.start():this.#s(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==Rr.eager&&this.#s()}sourceURLChanged(){this.#v("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Rr.eager||this.#r)&&this.#s())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#o=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Rr.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#s())}async#s(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(Ve(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#r=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=$h(t);Bt.fromDocument(r).isVisitable?await this.#l(e,r):await this.#c(e)}}finally{this.#o=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,Zi(e)),this.#s()}willSubmitFormLinkToLocation(e){return this.#m(e)}submittedFormLinkToLocation(e,t,r){let s=this.#h(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#m(e)}linkClickIntercepted(e,t){this.#f(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#m(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Jn(this,e,t);let{fetchRequest:r}=this.formSubmission,s=this.#h(e,t);this.prepareRequest(r,s),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Ai.contentType)}requestStarted(e){Yn(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Xn(this.element)}formSubmissionStarted({formElement:e}){Yn(e,this.#h(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#h(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,Zi(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Pe.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Pe.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Xn(e,this.#h(e))}allowsImmediateRender({element:e},t){let r=ye("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Pe.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#o?no:xs;if(r){let n=new Nr(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Pe.frameRendered(e,this.element),Pe.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#d(e)&&this.#u(e)}async#a(e){let t=new Qi(this,kt.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#f(e,t,r){let s=this.#h(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,Zi(r,e,s)),this.#S(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=Bt.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,m={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(m.action=this.action),Pe.visit(e.src,m)}}}}changeHistory(){if(this.action){let e=Wh(this.action);Pe.history.update(e,Ve(this.element.src||""),this.restorationIdentifier)}}async#c(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#g(e.response)}#d(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#g(n):Pe.visit(n,o)};return!ye("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#p(e)}#p(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Ul(t)}async#g(e){let t=new Ss(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Pe.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#h(e,t){let r=Kn("data-turbo-frame",t,e)||this.element.getAttribute("target"),s=this.#b(r);return s instanceof _t?s:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Hh(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Hh(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new _t}return null}#y(e,t){let r=Vl(e,t);return _i(Ve(r),this.rootLocation)}#m(e,t){let r=Kn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#y(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=this.#b(r);if(s)return!s.disabled;if(r=="_parent")return!1}return!(!Pe.elementIsNavigatable(e)||t&&!Pe.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#T("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Ve(t)}#v(e){return this.#n.has(e)}#T(e,t){this.#n.add(e),t(),this.#n.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#b(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof _t)return t}}};function Hh(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&Qh(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof _t)return i.connectedCallback(),i.disconnectedCallback(),i}}var ud={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?ao(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Kl(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");Pe.refresh(this.baseURI,{method:i,requestId:e,scroll:t})}},Hl=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await ys(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=ud[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},jl=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),ld(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),cd(this.streamSource))}get src(){return this.getAttribute("src")||""}};_t.delegateConstructor=zl;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",_t);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Hl);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",jl);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let e=i.parentElement;for(;e;){if(e==document.body)return console.warn(Vh`
18
+ `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=rd();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},Al=class extends zr{detailsByOuterHTML=this.children.filter(e=>!gy(e)).map(e=>vy(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:py(t),tracked:fy(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return yy(s,e)?s:t},void 0|void 0)}};function py(i){if(my(i))return"script";if(by(i))return"stylesheet"}function fy(i){return i.getAttribute("data-turbo-track")=="reload"}function my(i){return i.localName=="script"}function gy(i){return i.localName=="noscript"}function by(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function yy(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function vy(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var Bt=class i extends zr{static fromHTMLString(e=""){return this.fromDocument(ed(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new Al(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";for(let s of e.querySelectorAll("noscript"))s.remove();return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Xe(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Pl=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},wy={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},Yn={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},pi={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},Ur={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Sy={advance:"forward",restore:"back",replace:"none"},Fl=class{identifier=Fi();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=pi.initialized;viewTransitioner=new Pl;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||Fi();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:h,response:f,visitCachedSnapshot:m,willRender:w,updateHistory:y,shouldCacheSnapshot:_,acceptsStreamResponse:P,direction:O,refresh:R}={...wy,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=h,this.response=f,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=m,this.willRender=w,this.updateHistory=y,this.scrolled=!w,this.shouldCacheSnapshot=_,this.acceptsStreamResponse=P,this.direction=O||Sy[n],this.refresh=R}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==pi.initialized&&(this.recordTimingMetric(Yn.visitStart),this.state=pi.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==pi.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=pi.canceled)}complete(){this.state==pi.started&&(this.recordTimingMetric(Yn.visitEnd),this.adapter.visitCompleted(this),this.state=pi.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==pi.started&&(this.state=pi.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=id(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new ir(this,Pt.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Yn.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Yh(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Yn.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Yh(e)&&t!=null){let r=Bt.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Bt.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Es(this.location)||e.hasAnchor(Es(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return Bt.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(Oi.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Ur.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:Ur.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:Ur.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=Es(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Yh(i){return i>=200&&i<300}var Ol=class{progressBar=new Cl;constructor(e){this.session=e}visitProposedToLocation(e,t){Pi(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||Fi(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case Ur.networkFailure:case Ur.timeoutFailure:case Ur.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){xe("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},Ll=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},Rl=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new so(this,t),this.formSubmitObserver=new ks(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Jl(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Xe(s?.content??"/");return this.#t(e,t)&&Pi(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof Ft)return s}}},Ml=class{location;restorationIdentifier=Fi();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=Fi()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},Dl=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#a,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#r,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#a,!0),this.started=!0};#i=e=>{if(eo("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#l(t)){let s=t,n=ad(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new ir(this,Pt.get,n,new URLSearchParams,t);o.fetchOptions.priority="low",Nr.putLater(n,o,this.#n)}}};#r=e=>{e.target===this.#e&&this.#s()};#s=()=>{Nr.clear(),this.#e=null};#a=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Nr.get(e.detail.url);t&&(e.detail.fetchRequest=t),Nr.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#n(){return Number(eo("turbo-prefetch-cache-time"))||dd}#l(e){return!(!e.getAttribute("href")||Ey(e)||Ty(e)||xy(e)||ky(e)||Cy(e))}},Ey=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),Ty=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),xy=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=Br(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},ky=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||_y(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},_y=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),Cy=i=>xe("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,Il=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new Fl(this,Xe(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new io(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=Bt.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return tr(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},Ji={initial:0,loading:1,interactive:2,complete:3},Nl=class{stage=Ji.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==Ji.initial&&(this.stage=Ji.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Ji.loading&&(this.stage=Ji.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Ji.interactive&&(this.stage=Ji.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},Bl=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},Ul=class{render({fragment:e}){ao.preservingPermanentElements(this,Ay(e),()=>{Py(e,()=>{Fy(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Ay(i){let e=fd(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=pd(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function Py(i,e){let t=`turbo-stream-autofocus-${Fi()}`,r=i.querySelectorAll("turbo-stream"),s=Oy(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await Ss(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Ql(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function Fy(i){let[e,t]=await Ub(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Ql(s)&&s!=t&&s.focus()}}function Oy(i){for(let e of i){let t=sd(e.templateElement.content);if(t)return t}return null}var zl=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=Ly(e);t&&Ry(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(Oi.wrap(e))}};function Ly(i){let e=i.detail?.fetchResponse;if(e instanceof xs)return e}function Ry(i){return(i.contentType??"").startsWith(Oi.contentType)}var Hl=class extends _s{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=Ts(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},As=class extends _s{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Ib(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(Ts(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=Ts(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},co=class extends As{static renderElement(e,t){uo(e,t,{callbacks:{beforeNodeMorphed:(r,s)=>md(r,s)&&!gd(r)?(r.reload(),!1):!0}}),xe("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},jl=class extends to{constructor(e){super(e,Xn)}get snapshots(){return this.entries}},ql=class extends ro{snapshotCache=new jl(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&(s?.refresh?.method||this.snapshot.refreshMethod)==="morph"?co:As,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new Hl(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Jh();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}get snapshot(){return Bt.fromElement(this.element)}},$l=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new ir(this,Pt.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=Bt.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},Vl=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Bb("turbo-cache-control",e)}},Wl=class{navigator=new Il(this);history=new Ml(this);view=new ql(this,document.documentElement);adapter=new Ol(this);pageObserver=new Nl(this);cacheObserver=new Ll;linkPrefetchObserver=new Dl(this,document);linkClickObserver=new no(this,window);formSubmitObserver=new ks(this,document);scrollObserver=new Bl(this);streamObserver=new zl(this);formLinkClickObserver=new oo(this,document.documentElement);frameRedirector=new Rl(this,document.documentElement);streamMessageRenderer=new Ul;cache=new Vl(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new $l(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof Ft){let s=t.action||tr(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Xe(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:s,scroll:n}=t,o=s&&this.recentRequests.has(s),a=e===document.baseURI;!o&&!this.navigator.currentVisit&&a&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(Oi.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){$e.drive.progressBarDelay=e}get progressBarDelay(){return $e.drive.progressBarDelay}set drive(e){$e.drive.enabled=e}get drive(){return $e.drive.enabled}set formMode(e){$e.forms.mode=e}get formMode(){return $e.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=zb(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||Br(e,"turbo-frame:not([disabled])");if(t||r||n instanceof Ft)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&Pi(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&Pi(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&Pi(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&Pi(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Xh(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Qn(document.documentElement),this.view.markVisitDirection(e.direction)),Xh(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Jn(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=Jl(e,t);return this.submissionIsNavigatable(e,t)&&Pi(Xe(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return xe("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return xe("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return xe("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return xe("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return xe("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return xe("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return xe("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return xe("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return xe("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if($e.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return $e.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Br(e,"[data-turbo]"),r=Br(e,"turbo-frame");return $e.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return tr(e)||"advance"}get snapshot(){return this.view.snapshot}};function Xh(i){Object.defineProperties(i,My)}var My={absoluteURL:{get(){return this.toString()}}},Le=new Wl(cd),{cache:Dy,navigator:Iy}=Le;function bd(){Le.start()}function Ny(i){Le.registerAdapter(i)}function By(i,e){Le.visit(i,e)}function yd(i){Le.connectStreamSource(i)}function vd(i){Le.disconnectStreamSource(i)}function Uy(i){Le.renderStreamMessage(i)}function zy(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),$e.drive.progressBarDelay=i}function Hy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),$e.forms.confirm=i}function jy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),$e.forms.mode=i}function qy(i,e){co.renderElement(i,e)}function rc(i,e){lo.renderElement(i,e)}var $y=Object.freeze({__proto__:null,navigator:Iy,session:Le,cache:Dy,PageRenderer:As,PageSnapshot:Bt,FrameRenderer:Cs,fetch:ud,config:$e,start:bd,registerAdapter:Ny,visit:By,connectStreamSource:yd,disconnectStreamSource:vd,renderStreamMessage:Uy,setProgressBarDelay:zy,setConfirmMethod:Hy,setFormMode:jy,morphBodyElements:qy,morphTurboFrameElements:rc,morphChildren:ic,morphElements:uo}),Gl=class extends Error{},Kl=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#r=!1;#s=new Set;#a=!1;action=null;constructor(e){this.element=e,this.view=new kl(this,this.element),this.appearanceObserver=new Tl(this,this.element),this.formLinkClickObserver=new oo(this,this.element),this.linkInterceptor=new so(this,this.element),this.restorationIdentifier=Fi(),this.formSubmitObserver=new ks(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Ir.lazy?this.appearanceObserver.start():this.#n(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==Ir.eager&&this.#n()}sourceURLChanged(){this.#v("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Ir.eager||this.#r)&&this.#n())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#a=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Ir.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#n())}async#n(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#o(Xe(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#r=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=ed(t);Bt.fromDocument(r).isVisitable?await this.#l(e,r):await this.#c(e)}}finally{this.#a=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,tr(e)),this.#n()}willSubmitFormLinkToLocation(e){return this.#g(e)}submittedFormLinkToLocation(e,t,r){let s=this.#d(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#g(e)}linkClickIntercepted(e,t){this.#f(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#g(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new io(this,e,t);let{fetchRequest:r}=this.formSubmission,s=this.#d(e,t);this.prepareRequest(r,s),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(Oi.contentType)}requestStarted(e){Qn(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Jn(this.element)}formSubmissionStarted({formElement:e}){Qn(e,this.#d(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#d(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,tr(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Le.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Le.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Jn(e,this.#d(e))}allowsImmediateRender({element:e},t){let r=xe("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Le.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#a?lo:Cs;if(r){let n=new zr(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Le.frameRendered(e,this.element),Le.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#h(e)&&this.#u(e)}async#o(e){let t=new ir(this,Pt.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#f(e,t,r){let s=this.#d(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,tr(r,e,s)),this.#S(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=Bt.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,f={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(f.action=this.action),Le.visit(e.src,f)}}}}changeHistory(){if(this.action){let e=id(this.action);Le.history.update(e,Xe(this.element.src||""),this.restorationIdentifier)}}async#c(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#m(e.response)}#h(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#m(n):Le.visit(n,o)};return!xe("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#u(e){this.view.missing(),this.#p(e)}#p(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Gl(t)}async#m(e){let t=new xs(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Le.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#d(e,t){let r=Zn("data-turbo-frame",t,e)||this.element.getAttribute("target"),s=this.#b(r);return s instanceof Ft?s:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Zh(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Zh(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new Ft}return null}#y(e,t){let r=Jl(e,t);return Pi(Xe(r),this.rootLocation)}#g(e,t){let r=Zn("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#y(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=this.#b(r);if(s)return!s.disabled;if(r=="_parent")return!1}return!(!Le.elementIsNavigatable(e)||t&&!Le.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#T("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Xe(t)}#v(e){return this.#s.has(e)}#T(e,t){this.#s.add(e),t(),this.#s.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#b(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof Ft)return t}}};function Zh(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&ld(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof Ft)return i.connectedCallback(),i.disconnectedCallback(),i}}var wd={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?uo(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?ic(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let i=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");Le.refresh(this.baseURI,{method:i,requestId:e,scroll:t})}},Yl=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await Ss(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=wd[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},Xl=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),yd(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),vd(this.streamSource))}get src(){return this.getAttribute("src")||""}};Ft.delegateConstructor=Kl;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",Ft);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Yl);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Xl);(()=>{let i=document.currentScript;if(!i||i.hasAttribute("data-turbo-suppress-warning"))return;let e=i.parentElement;for(;e;){if(e==document.body)return console.warn(td`
19
19
  You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
20
20
 
21
21
  Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
@@ -24,39 +24,39 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
24
24
 
25
25
  ——
26
26
  Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
27
- `,i.outerHTML);e=e.parentElement}})();window.Turbo={...Fy,StreamActions:ud};ad();var Xl=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=Oy(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,s=t.index;return r<s?-1:r>s?1:0})}};function Oy(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:e}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Zl=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r),o=s.get(n);return o||(o=this.createEventListener(e,t,r),s.set(n,o)),o}createEventListener(e,t,r){let s=new Xl(e,t,r);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(s=>{r.push(`${t[s]?"":"!"}${s}`)}),r.join(":")}},Ly={stop({event:i,value:e}){return e&&i.stopPropagation(),!0},prevent({event:i,value:e}){return e&&i.preventDefault(),!0},self({event:i,value:e,element:t}){return e?t===i.target:!0}},Ry=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function My(i){let t=i.trim().match(Ry)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:Iy(t[4]),eventName:r,eventOptions:t[7]?Dy(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function Iy(i){if(i=="window")return window;if(i=="document")return document}function Dy(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Ny(i){if(i==window)return"window";if(i==document)return"document"}function vc(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Ql(i){return vc(i.replace(/--/g,"-").replace(/__/g,"_"))}function Cs(i){return i.charAt(0).toUpperCase()+i.slice(1)}function wd(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function By(i){return i.match(/[^\s]+/g)||[]}function hd(i){return i!=null}function Jl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var dd=["meta","ctrl","alt","shift"],ec=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Uy(e)||lo("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||lo("missing identifier"),this.methodName=r.methodName||lo("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,My(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(s=>!dd.includes(s))[0];return r?(Jl(this.keyMappings,r)||lo(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:s}of Array.from(this.element.attributes)){let n=r.match(t),o=n&&n[1];o&&(e[vc(o)]=zy(s))}return e}get eventTargetName(){return Ny(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=dd.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},pd={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Uy(i){let e=i.tagName.toLowerCase();if(e in pd)return pd[e](i)}function lo(i){throw new Error(i)}function zy(i){try{return JSON.parse(i)}catch{return i}}var tc=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in r){let l=r[o];n=n&&l({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:l}=this,h={identifier:n,controller:o,element:a,index:l,event:e};this.context.handleError(s,`invoking action "${this.action}"`,h)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},co=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},uo=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new co(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function Hy(i,e,t){Sd(i,e).add(t)}function jy(i,e,t){Sd(i,e).delete(t),qy(i,e)}function Sd(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function qy(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var ui=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){Hy(this.valuesByKey,e,t)}delete(e,t){jy(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var ic=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new co(e,this),this.delegate=r,this.matchesByElement=new ui}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return r.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let s=this.matchElement(e),n=this.matchesByElement.has(r,e);s&&!n?this.selectorMatched(e,r):!s&&n&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},rc=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(r,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},ho=class{constructor(e,t,r){this.attributeObserver=new uo(e,t,this),this.delegate=r,this.tokensByElement=new ui}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),s=Vy(t,r).findIndex(([n,o])=>!Wy(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return $y(r,e,t)}};function $y(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function Vy(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function Wy(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var po=class{constructor(e,t,r){this.tokenListObserver=new ho(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},sc=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new po(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new tc(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=ec.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},nc=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new rc(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let s=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=r;r&&(l=o.reader(r)),n.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${Cs(t.name)}`;return this.receiver[r]}},oc=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new ui}start(){this.tokenListObserver||(this.tokenListObserver=new ho(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function As(i,e){let t=Ed(i);return Array.from(t.reduce((r,s)=>(Ky(s,e).forEach(n=>r.add(n)),r),new Set))}function Gy(i,e){return Ed(i).reduce((r,s)=>(r.push(...Yy(s,e)),r),[])}function Ed(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function Ky(i,e){let t=i[e];return Array.isArray(t)?t:[]}function Yy(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var ac=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new ui,this.outletElementsByName=new ui,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){let s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?s&&n&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new ic(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new uo(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new ui;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;As(r,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},lc=class{constructor(e,t){this.logDebugActivity=(r,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,r,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new sc(this,this.dispatcher),this.valueObserver=new nc(this,this.controller),this.targetObserver=new oc(this,this),this.outletObserver=new ac(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:s,controller:n,element:o}=this;r=Object.assign({identifier:s,controller:n,element:o},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${Ql(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${Ql(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function Xy(i){return Zy(i,Qy(i))}function Zy(i,e){let t=iv(i),r=Jy(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function Qy(i){return As(i,"blessings").reduce((t,r)=>{let s=r(i);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function Jy(i,e){return tv(e).reduce((t,r)=>{let s=ev(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function ev(i,e,t){let r=Object.getOwnPropertyDescriptor(i,t);if(!(r&&"value"in r)){let n=Object.getOwnPropertyDescriptor(e,t).value;return r&&(n.get=r.get||n.get,n.set=r.set||n.set),n}}var tv=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,iv=(()=>{function i(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=i(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),i}catch{return r=>class extends r{}}})();function rv(i){return{identifier:i.identifier,controllerConstructor:Xy(i.controllerConstructor)}}var cc=class{constructor(e,t){this.application=e,this.definition=rv(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new lc(this,e),this.contextsByScope.set(e,t)),t}},uc=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return By(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},hc=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${wd(e)}`}},dc=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(r,e))}};function pc(i,e){return`[${i}~="${e}"]`}var fc=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return pc(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return pc(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},mc=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,r){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}},gc=class i{constructor(e,t,r,s){this.targets=new fc(this),this.classes=new uc(this),this.data=new hc(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new dc(s),this.outlets=new mc(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return pc(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},bc=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new po(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),s=r.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,s)),s}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},yc=class{constructor(e){this.application=e,this.scopeObserver=new bc(this.element,this.schema,this),this.scopesByIdentifier=new ui,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new cc(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new gc(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},sv={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,e)=>`data-${i}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},fd("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),fd("0123456789".split("").map(i=>[i,i])))};function fd(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var fo=class{constructor(e=document.documentElement,t=sv){this.logger=console,this.debug=!1,this.logDebugActivity=(r,s,n={})=>{this.debug&&this.logFormattedMessage(r,s,n)},this.element=e,this.schema=t,this.dispatcher=new Zl(this),this.router=new yc(this),this.actionDescriptorFilters=Object.assign({},Ly)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await nv(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error(`%s
27
+ `,i.outerHTML);e=e.parentElement}})();window.Turbo={...$y,StreamActions:wd};bd();var sc=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=Vy(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,s=t.index;return r<s?-1:r>s?1:0})}};function Vy(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:e}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var nc=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r),o=s.get(n);return o||(o=this.createEventListener(e,t,r),s.set(n,o)),o}createEventListener(e,t,r){let s=new sc(e,t,r);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(s=>{r.push(`${t[s]?"":"!"}${s}`)}),r.join(":")}},Wy={stop({event:i,value:e}){return e&&i.stopPropagation(),!0},prevent({event:i,value:e}){return e&&i.preventDefault(),!0},self({event:i,value:e,element:t}){return e?t===i.target:!0}},Gy=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Ky(i){let t=i.trim().match(Gy)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:Yy(t[4]),eventName:r,eventOptions:t[7]?Xy(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function Yy(i){if(i=="window")return window;if(i=="document")return document}function Xy(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Zy(i){if(i==window)return"window";if(i==document)return"document"}function Cc(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function oc(i){return Cc(i.replace(/--/g,"-").replace(/__/g,"_"))}function Fs(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Fd(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Qy(i){return i.match(/[^\s]+/g)||[]}function Sd(i){return i!=null}function ac(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var Ed=["meta","ctrl","alt","shift"],lc=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Jy(e)||ho("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||ho("missing identifier"),this.methodName=r.methodName||ho("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,Ky(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(s=>!Ed.includes(s))[0];return r?(ac(this.keyMappings,r)||ho(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:s}of Array.from(this.element.attributes)){let n=r.match(t),o=n&&n[1];o&&(e[Cc(o)]=ev(s))}return e}get eventTargetName(){return Zy(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=Ed.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Td={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Jy(i){let e=i.tagName.toLowerCase();if(e in Td)return Td[e](i)}function ho(i){throw new Error(i)}function ev(i){try{return JSON.parse(i)}catch{return i}}var cc=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in r){let l=r[o];n=n&&l({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:l}=this,h={identifier:n,controller:o,element:a,index:l,event:e};this.context.handleError(s,`invoking action "${this.action}"`,h)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},po=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},fo=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new po(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function tv(i,e,t){Od(i,e).add(t)}function iv(i,e,t){Od(i,e).delete(t),rv(i,e)}function Od(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function rv(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var fi=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){tv(this.valuesByKey,e,t)}delete(e,t){iv(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var uc=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new po(e,this),this.delegate=r,this.matchesByElement=new fi}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return r.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let s=this.matchElement(e),n=this.matchesByElement.has(r,e);s&&!n?this.selectorMatched(e,r):!s&&n&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},hc=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(r,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},mo=class{constructor(e,t,r){this.attributeObserver=new fo(e,t,this),this.delegate=r,this.tokensByElement=new fi}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),s=nv(t,r).findIndex(([n,o])=>!ov(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return sv(r,e,t)}};function sv(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function nv(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function ov(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var go=class{constructor(e,t,r){this.tokenListObserver=new mo(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},dc=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new go(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new cc(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=lc.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},pc=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new hc(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let s=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=r;r&&(l=o.reader(r)),n.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${Fs(t.name)}`;return this.receiver[r]}},fc=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new fi}start(){this.tokenListObserver||(this.tokenListObserver=new mo(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Os(i,e){let t=Ld(i);return Array.from(t.reduce((r,s)=>(lv(s,e).forEach(n=>r.add(n)),r),new Set))}function av(i,e){return Ld(i).reduce((r,s)=>(r.push(...cv(s,e)),r),[])}function Ld(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function lv(i,e){let t=i[e];return Array.isArray(t)?t:[]}function cv(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var mc=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new fi,this.outletElementsByName=new fi,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){let s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?s&&n&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new uc(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new fo(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new fi;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;Os(r,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},gc=class{constructor(e,t){this.logDebugActivity=(r,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,r,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new dc(this,this.dispatcher),this.valueObserver=new pc(this,this.controller),this.targetObserver=new fc(this,this),this.outletObserver=new mc(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:s,controller:n,element:o}=this;r=Object.assign({identifier:s,controller:n,element:o},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${oc(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${oc(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function uv(i){return hv(i,dv(i))}function hv(i,e){let t=gv(i),r=pv(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function dv(i){return Os(i,"blessings").reduce((t,r)=>{let s=r(i);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function pv(i,e){return mv(e).reduce((t,r)=>{let s=fv(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function fv(i,e,t){let r=Object.getOwnPropertyDescriptor(i,t);if(!(r&&"value"in r)){let n=Object.getOwnPropertyDescriptor(e,t).value;return r&&(n.get=r.get||n.get,n.set=r.set||n.set),n}}var mv=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,gv=(()=>{function i(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=i(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),i}catch{return r=>class extends r{}}})();function bv(i){return{identifier:i.identifier,controllerConstructor:uv(i.controllerConstructor)}}var bc=class{constructor(e,t){this.application=e,this.definition=bv(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new gc(this,e),this.contextsByScope.set(e,t)),t}},yc=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return Qy(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},vc=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${Fd(e)}`}},wc=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(r,e))}};function Sc(i,e){return`[${i}~="${e}"]`}var Ec=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return Sc(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return Sc(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Tc=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,r){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}},xc=class i{constructor(e,t,r,s){this.targets=new Ec(this),this.classes=new yc(this),this.data=new vc(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new wc(s),this.outlets=new Tc(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return Sc(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},kc=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new go(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),s=r.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,s)),s}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},_c=class{constructor(e){this.application=e,this.scopeObserver=new kc(this.element,this.schema,this),this.scopesByIdentifier=new fi,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new bc(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new xc(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},yv={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,e)=>`data-${i}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},xd("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),xd("0123456789".split("").map(i=>[i,i])))};function xd(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var bo=class{constructor(e=document.documentElement,t=yv){this.logger=console,this.debug=!1,this.logDebugActivity=(r,s,n={})=>{this.debug&&this.logFormattedMessage(r,s,n)},this.element=e,this.schema=t,this.dispatcher=new nc(this),this.router=new _c(this),this.actionDescriptorFilters=Object.assign({},Wy)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await vv(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error(`%s
28
28
 
29
29
  %o
30
30
 
31
- %o`,t,e,r),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function nv(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function ov(i){return As(i,"classes").reduce((t,r)=>Object.assign(t,av(r)),{})}function av(i){return{[`${i}Class`]:{get(){let{classes:e}=this;if(e.has(i))return e.get(i);{let t=e.getAttributeName(i);throw new Error(`Missing attribute "${t}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${Cs(i)}Class`]:{get(){return this.classes.has(i)}}}}function lv(i){return As(i,"outlets").reduce((t,r)=>Object.assign(t,cv(r)),{})}function md(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function gd(i,e,t){let r=md(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=md(i,e,t),r))return r}function cv(i){let e=Ql(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=gd(this,t,i);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(i);return t.length>0?t.map(r=>{let s=gd(this,r,i);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t)return t;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${Cs(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function uv(i){return As(i,"targets").reduce((t,r)=>Object.assign(t,hv(r)),{})}function hv(i){return{[`${i}Target`]:{get(){let e=this.targets.find(i);if(e)return e;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${Cs(i)}Target`]:{get(){return this.targets.has(i)}}}}function dv(i){let e=Gy(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=Td(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,pv(s)),t)}function pv(i,e){let t=Td(i,e),{key:r,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(r);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${Cs(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function Td([i,e],t){return bv({controller:t,token:i,typeDefinition:e})}function mo(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function _s(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function fv(i){let{controller:e,token:t,typeObject:r}=i,s=hd(r.type),n=hd(r.default),o=s&&n,a=s&&!n,l=!s&&n,h=mo(r.type),m=_s(i.typeObject.default);if(a)return h;if(l)return m;if(h!==m){let g=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${g}" must match the defined type "${h}". The provided default value of "${r.default}" is of type "${m}".`)}if(o)return h}function mv(i){let{controller:e,token:t,typeDefinition:r}=i,n=fv({controller:e,token:t,typeObject:r}),o=_s(r),a=mo(r),l=n||o||a;if(l)return l;let h=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${h}" for "${t}" value`)}function gv(i){let e=mo(i);if(e)return bd[e];let t=Jl(i,"default"),r=Jl(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=mo(n);if(o)return bd[o]}return i}function bv(i){let{token:e,typeDefinition:t}=i,r=`${wd(e)}-value`,s=mv(i);return{type:s,key:r,name:vc(r),get defaultValue(){return gv(t)},get hasCustomDefaultValue(){return _s(t)!==void 0},reader:yv[s],writer:yd[s]||yd.default}}var bd={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},yv={array(i){let e=JSON.parse(i);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${_s(e)}"`);return e},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let e=JSON.parse(i);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${_s(e)}"`);return e},string(i){return i}},yd={default:vv,array:vd,object:vd};function vd(i){return JSON.stringify(i)}function vv(i){return`${i}`}var H=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,l=new CustomEvent(a,{detail:r,bubbles:n,cancelable:o});return t.dispatchEvent(l),l}};H.blessings=[ov,uv,dv,lv];H.targets=[];H.outlets=[];H.values={};var go=class extends H{static targets=["openIcon","closeIcon"];static outlets=["sidebar"];static values={placement:{type:String,default:"left"},bodyScrolling:{type:Boolean,default:!1},backdrop:{type:Boolean,default:!0},edge:{type:Boolean,default:!1},edgeOffset:{type:String,default:"bottom-[60px]"}};static classes={backdrop:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"};initialize(){this.visible=!1,this.handleEscapeKey=this.handleEscapeKey.bind(this)}connect(){document.addEventListener("keydown",this.handleEscapeKey)}sidebarOutletConnected(){this.#e(this.sidebarOutlet.element)}disconnect(){this.#i(),document.removeEventListener("keydown",this.handleEscapeKey),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden")}#e(i){i.setAttribute("aria-hidden","true"),i.classList.add("transition-transform"),this.#r(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#o(`${this.placementValue}-edge`,!0):this.#n(this.placementValue,!0),this.openIconTarget.classList.add("hidden"),this.openIconTarget.setAttribute("aria-hidden","true"),this.closeIconTarget.classList.remove("hidden"),this.closeIconTarget.setAttribute("aria-hidden","false"),this.sidebarOutlet.element.setAttribute("aria-modal","true"),this.sidebarOutlet.element.setAttribute("role","dialog"),this.sidebarOutlet.element.removeAttribute("aria-hidden"),this.bodyScrollingValue||document.body.classList.add("overflow-hidden"),this.backdropValue&&this.#t(),this.visible=!0,this.dispatch("show")}hideDrawer(){this.edgeValue?this.#o(`${this.placementValue}-edge`,!1):this.#n(this.placementValue,!1),this.openIconTarget.classList.remove("hidden"),this.openIconTarget.setAttribute("aria-hidden","false"),this.closeIconTarget.classList.add("hidden"),this.closeIconTarget.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.removeAttribute("aria-modal"),this.sidebarOutlet.element.removeAttribute("role"),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden"),this.backdropValue&&this.#i(),this.visible=!1,this.dispatch("hide")}handleEscapeKey(i){i.key==="Escape"&&this.visible&&this.hideDrawer()}#t(){if(!this.visible){let i=document.createElement("div");i.setAttribute("data-drawer-backdrop",""),i.classList.add(...this.constructor.classes.backdrop.split(" ")),i.addEventListener("click",()=>this.hideDrawer()),document.body.appendChild(i)}}#i(){let i=document.querySelector("[data-drawer-backdrop]");i&&i.remove()}#r(i){let e={top:{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]},right:{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]},bottom:{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]},left:{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]},"bottom-edge":{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this.edgeOffsetValue]}};return e[i]||e.left}#n(i,e){let t=this.#r(i);e?(t.active.forEach(r=>this.sidebarOutlet.element.classList.add(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.remove(r))):(t.active.forEach(r=>this.sidebarOutlet.element.classList.remove(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.add(r)))}#o(i,e){this.#n(i,e)}};var bo=class extends H{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(i){i.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e),this.dispatch("add"),this.updateState()}remove(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);e.dataset.newRecord!==void 0?e.remove():this.toggleRemoved(e,!0),this.dispatch("remove"),this.updateState()}restore(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);this.toggleRemoved(e,!1),this.dispatch("restore"),this.updateState()}toggleRemoved(i,e){i.toggleAttribute("data-removed",e);let t=i.querySelector(":scope > [data-nested-content]"),r=i.querySelector(":scope > [data-nested-removed]");t&&(t.hidden=e),r&&(r.hidden=!e);let s=i.querySelector("input[name*='_destroy']");s&&(s.value=e?"1":"0")}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(`${this.wrapperSelectorValue}:not([data-removed])`).length}};var yo=class extends H{static targets=["content","removed"];remove(i){i.preventDefault(),this.contentTarget.disabled=!0,this.contentTarget.hidden=!0,this.removedTarget.hidden=!1}restore(i){i.preventDefault(),this.contentTarget.disabled=!1,this.contentTarget.hidden=!1,this.removedTarget.hidden=!0}};var vo=class extends H{connect(){}preSubmit(){this.element.querySelectorAll('input[name="pre_submit"]').forEach(e=>e.remove());let i=document.createElement("input");i.type="hidden",i.name="pre_submit",i.value="true",this.element.appendChild(i),this.element.setAttribute("novalidate",""),this.submit()}submit(){this.element.requestSubmit()}};var Ee="top",Ne="bottom",Fe="right",ke="left",wo="auto",Pi=[Ee,Ne,Fe,ke],hi="start",Ji="end",xd="clippingParents",So="viewport",Br="popper",kd="reference",wc=Pi.reduce(function(i,e){return i.concat([e+"-"+hi,e+"-"+Ji])},[]),Eo=[].concat(Pi,[wo]).reduce(function(i,e){return i.concat([e,e+"-"+hi,e+"-"+Ji])},[]),wv="beforeRead",Sv="read",Ev="afterRead",Tv="beforeMain",xv="main",kv="afterMain",_v="beforeWrite",Cv="write",Av="afterWrite",_d=[wv,Sv,Ev,Tv,xv,kv,_v,Cv,Av];function ze(i){return i?(i.nodeName||"").toLowerCase():null}function fe(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function Ct(i){var e=fe(i).Element;return i instanceof e||i instanceof Element}function Be(i){var e=fe(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function Ur(i){if(typeof ShadowRoot>"u")return!1;var e=fe(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function Pv(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!Be(n)||!ze(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function Fv(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,h){return l[h]="",l},{});!Be(s)||!ze(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var Cd={name:"applyStyles",enabled:!0,phase:"write",fn:Pv,effect:Fv,requires:["computeStyles"]};function He(i){return i.split("-")[0]}var Ut=Math.max,er=Math.min,di=Math.round;function zr(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ps(){return!/^((?!chrome|android).)*safari/i.test(zr())}function At(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&Be(i)&&(s=i.offsetWidth>0&&di(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&di(r.height)/i.offsetHeight||1);var o=Ct(i)?fe(i):window,a=o.visualViewport,l=!Ps()&&t,h=(r.left+(l&&a?a.offsetLeft:0))/s,m=(r.top+(l&&a?a.offsetTop:0))/n,g=r.width/s,E=r.height/n;return{width:g,height:E,top:m,right:h+g,bottom:m+E,left:h,x:h,y:m}}function tr(i){var e=At(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function Fs(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&Ur(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function it(i){return fe(i).getComputedStyle(i)}function Sc(i){return["table","td","th"].indexOf(ze(i))>=0}function We(i){return((Ct(i)?i.ownerDocument:i.document)||window.document).documentElement}function pi(i){return ze(i)==="html"?i:i.assignedSlot||i.parentNode||(Ur(i)?i.host:null)||We(i)}function Ad(i){return!Be(i)||it(i).position==="fixed"?null:i.offsetParent}function Ov(i){var e=/firefox/i.test(zr()),t=/Trident/i.test(zr());if(t&&Be(i)){var r=it(i);if(r.position==="fixed")return null}var s=pi(i);for(Ur(s)&&(s=s.host);Be(s)&&["html","body"].indexOf(ze(s))<0;){var n=it(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function zt(i){for(var e=fe(i),t=Ad(i);t&&Sc(t)&&it(t).position==="static";)t=Ad(t);return t&&(ze(t)==="html"||ze(t)==="body"&&it(t).position==="static")?e:t||Ov(i)||e}function ir(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function rr(i,e,t){return Ut(i,er(e,t))}function Pd(i,e,t){var r=rr(i,e,t);return r>t?t:r}function Os(){return{top:0,right:0,bottom:0,left:0}}function Ls(i){return Object.assign({},Os(),i)}function Rs(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var Lv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Ls(typeof e!="number"?e:Rs(e,Pi))};function Rv(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=He(t.placement),l=ir(a),h=[ke,Fe].indexOf(a)>=0,m=h?"height":"width";if(!(!n||!o)){var g=Lv(s.padding,t),E=tr(n),w=l==="y"?Ee:ke,F=l==="y"?Ne:Fe,L=t.rects.reference[m]+t.rects.reference[l]-o[l]-t.rects.popper[m],M=o[l]-t.rects.reference[l],D=zt(n),A=D?l==="y"?D.clientHeight||0:D.clientWidth||0:0,R=L/2-M/2,T=g[w],x=A-E[m]-g[F],P=A/2-E[m]/2+R,I=rr(T,P,x),B=l;t.modifiersData[r]=(e={},e[B]=I,e.centerOffset=I-P,e)}}function Mv(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||Fs(e.elements.popper,s)&&(e.elements.arrow=s))}var Fd={name:"arrow",enabled:!0,phase:"main",fn:Rv,effect:Mv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Pt(i){return i.split("-")[1]}var Iv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Dv(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:di(t*s)/s||0,y:di(r*s)/s||0}}function Od(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,h=i.adaptive,m=i.roundOffsets,g=i.isFixed,E=o.x,w=E===void 0?0:E,F=o.y,L=F===void 0?0:F,M=typeof m=="function"?m({x:w,y:L}):{x:w,y:L};w=M.x,L=M.y;var D=o.hasOwnProperty("x"),A=o.hasOwnProperty("y"),R=ke,T=Ee,x=window;if(h){var P=zt(t),I="clientHeight",B="clientWidth";if(P===fe(t)&&(P=We(t),it(P).position!=="static"&&a==="absolute"&&(I="scrollHeight",B="scrollWidth")),P=P,s===Ee||(s===ke||s===Fe)&&n===Ji){T=Ne;var U=g&&P===x&&x.visualViewport?x.visualViewport.height:P[I];L-=U-r.height,L*=l?1:-1}if(s===ke||(s===Ee||s===Ne)&&n===Ji){R=Fe;var j=g&&P===x&&x.visualViewport?x.visualViewport.width:P[B];w-=j-r.width,w*=l?1:-1}}var q=Object.assign({position:a},h&&Iv),W=m===!0?Dv({x:w,y:L},fe(t)):{x:w,y:L};if(w=W.x,L=W.y,l){var te;return Object.assign({},q,(te={},te[T]=A?"0":"",te[R]=D?"0":"",te.transform=(x.devicePixelRatio||1)<=1?"translate("+w+"px, "+L+"px)":"translate3d("+w+"px, "+L+"px, 0)",te))}return Object.assign({},q,(e={},e[T]=A?L+"px":"",e[R]=D?w+"px":"",e.transform="",e))}function Nv(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,l=a===void 0?!0:a,h={placement:He(e.placement),variation:Pt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Od(Object.assign({},h,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Od(Object.assign({},h,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var Ld={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nv,data:{}};var To={passive:!0};function Bv(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,l=fe(e.elements.popper),h=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&h.forEach(function(m){m.addEventListener("scroll",t.update,To)}),a&&l.addEventListener("resize",t.update,To),function(){n&&h.forEach(function(m){m.removeEventListener("scroll",t.update,To)}),a&&l.removeEventListener("resize",t.update,To)}}var Rd={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Bv,data:{}};var Uv={left:"right",right:"left",bottom:"top",top:"bottom"};function Hr(i){return i.replace(/left|right|bottom|top/g,function(e){return Uv[e]})}var zv={start:"end",end:"start"};function xo(i){return i.replace(/start|end/g,function(e){return zv[e]})}function sr(i){var e=fe(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function nr(i){return At(We(i)).left+sr(i).scrollLeft}function Ec(i,e){var t=fe(i),r=We(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var h=Ps();(h||!h&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+nr(i),y:l}}function Tc(i){var e,t=We(i),r=sr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=Ut(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ut(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+nr(i),l=-r.scrollTop;return it(s||t).direction==="rtl"&&(a+=Ut(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:l}}function or(i){var e=it(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function ko(i){return["html","body","#document"].indexOf(ze(i))>=0?i.ownerDocument.body:Be(i)&&or(i)?i:ko(pi(i))}function Fi(i,e){var t;e===void 0&&(e=[]);var r=ko(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=fe(r),o=s?[n].concat(n.visualViewport||[],or(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(Fi(pi(o)))}function jr(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function Hv(i,e){var t=At(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function Md(i,e,t){return e===So?jr(Ec(i,t)):Ct(e)?Hv(e,t):jr(Tc(We(i)))}function jv(i){var e=Fi(pi(i)),t=["absolute","fixed"].indexOf(it(i).position)>=0,r=t&&Be(i)?zt(i):i;return Ct(r)?e.filter(function(s){return Ct(s)&&Fs(s,r)&&ze(s)!=="body"}):[]}function xc(i,e,t,r){var s=e==="clippingParents"?jv(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,h){var m=Md(i,h,r);return l.top=Ut(m.top,l.top),l.right=er(m.right,l.right),l.bottom=er(m.bottom,l.bottom),l.left=Ut(m.left,l.left),l},Md(i,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ms(i){var e=i.reference,t=i.element,r=i.placement,s=r?He(r):null,n=r?Pt(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case Ee:l={x:o,y:e.y-t.height};break;case Ne:l={x:o,y:e.y+e.height};break;case Fe:l={x:e.x+e.width,y:a};break;case ke:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var h=s?ir(s):null;if(h!=null){var m=h==="y"?"height":"width";switch(n){case hi:l[h]=l[h]-(e[m]/2-t[m]/2);break;case Ji:l[h]=l[h]+(e[m]/2-t[m]/2);break;default:}}return l}function Ht(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,o=n===void 0?i.strategy:n,a=t.boundary,l=a===void 0?xd:a,h=t.rootBoundary,m=h===void 0?So:h,g=t.elementContext,E=g===void 0?Br:g,w=t.altBoundary,F=w===void 0?!1:w,L=t.padding,M=L===void 0?0:L,D=Ls(typeof M!="number"?M:Rs(M,Pi)),A=E===Br?kd:Br,R=i.rects.popper,T=i.elements[F?A:E],x=xc(Ct(T)?T:T.contextElement||We(i.elements.popper),l,m,o),P=At(i.elements.reference),I=Ms({reference:P,element:R,strategy:"absolute",placement:s}),B=jr(Object.assign({},R,I)),U=E===Br?B:P,j={top:x.top-U.top+D.top,bottom:U.bottom-x.bottom+D.bottom,left:x.left-U.left+D.left,right:U.right-x.right+D.right},q=i.modifiersData.offset;if(E===Br&&q){var W=q[s];Object.keys(j).forEach(function(te){var ae=[Fe,Ne].indexOf(te)>=0?1:-1,xe=[Ee,Ne].indexOf(te)>=0?"y":"x";j[te]+=W[xe]*ae})}return j}function kc(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,h=l===void 0?Eo:l,m=Pt(r),g=m?a?wc:wc.filter(function(F){return Pt(F)===m}):Pi,E=g.filter(function(F){return h.indexOf(F)>=0});E.length===0&&(E=g);var w=E.reduce(function(F,L){return F[L]=Ht(i,{placement:L,boundary:s,rootBoundary:n,padding:o})[He(L)],F},{});return Object.keys(w).sort(function(F,L){return w[F]-w[L]})}function qv(i){if(He(i)===wo)return[];var e=Hr(i);return[xo(i),e,xo(e)]}function $v(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,h=t.padding,m=t.boundary,g=t.rootBoundary,E=t.altBoundary,w=t.flipVariations,F=w===void 0?!0:w,L=t.allowedAutoPlacements,M=e.options.placement,D=He(M),A=D===M,R=l||(A||!F?[Hr(M)]:qv(M)),T=[M].concat(R).reduce(function(Qe,tt){return Qe.concat(He(tt)===wo?kc(e,{placement:tt,boundary:m,rootBoundary:g,padding:h,flipVariations:F,allowedAutoPlacements:L}):tt)},[]),x=e.rects.reference,P=e.rects.popper,I=new Map,B=!0,U=T[0],j=0;j<T.length;j++){var q=T[j],W=He(q),te=Pt(q)===hi,ae=[Ee,Ne].indexOf(W)>=0,xe=ae?"width":"height",he=Ht(e,{placement:q,boundary:m,rootBoundary:g,altBoundary:E,padding:h}),Ce=ae?te?Fe:ke:te?Ne:Ee;x[xe]>P[xe]&&(Ce=Hr(Ce));var pe=Hr(Ce),et=[];if(n&&et.push(he[W]<=0),a&&et.push(he[Ce]<=0,he[pe]<=0),et.every(function(Qe){return Qe})){U=q,B=!1;break}I.set(q,et)}if(B)for(var Ot=F?3:1,ee=function(tt){var Lt=T.find(function(Wt){var Me=I.get(Wt);if(Me)return Me.slice(0,tt).every(function(ti){return ti})});if(Lt)return U=Lt,"break"},mt=Ot;mt>0;mt--){var lt=ee(mt);if(lt==="break")break}e.placement!==U&&(e.modifiersData[r]._skip=!0,e.placement=U,e.reset=!0)}}var Id={name:"flip",enabled:!0,phase:"main",fn:$v,requiresIfExists:["offset"],data:{_skip:!1}};function Dd(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function Nd(i){return[Ee,Fe,Ne,ke].some(function(e){return i[e]>=0})}function Vv(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=Ht(e,{elementContext:"reference"}),a=Ht(e,{altBoundary:!0}),l=Dd(o,r),h=Dd(a,s,n),m=Nd(l),g=Nd(h);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:h,isReferenceHidden:m,hasPopperEscaped:g},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":g})}var Bd={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Vv};function Wv(i,e,t){var r=He(i),s=[ke,Ee].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[ke,Fe].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Gv(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=Eo.reduce(function(m,g){return m[g]=Wv(g,e.rects,n),m},{}),a=o[e.placement],l=a.x,h=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=h),e.modifiersData[r]=o}var Ud={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Gv};function Kv(i){var e=i.state,t=i.name;e.modifiersData[t]=Ms({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var zd={name:"popperOffsets",enabled:!0,phase:"read",fn:Kv,data:{}};function _c(i){return i==="x"?"y":"x"}function Yv(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,h=t.rootBoundary,m=t.altBoundary,g=t.padding,E=t.tether,w=E===void 0?!0:E,F=t.tetherOffset,L=F===void 0?0:F,M=Ht(e,{boundary:l,rootBoundary:h,padding:g,altBoundary:m}),D=He(e.placement),A=Pt(e.placement),R=!A,T=ir(D),x=_c(T),P=e.modifiersData.popperOffsets,I=e.rects.reference,B=e.rects.popper,U=typeof L=="function"?L(Object.assign({},e.rects,{placement:e.placement})):L,j=typeof U=="number"?{mainAxis:U,altAxis:U}:Object.assign({mainAxis:0,altAxis:0},U),q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,W={x:0,y:0};if(P){if(n){var te,ae=T==="y"?Ee:ke,xe=T==="y"?Ne:Fe,he=T==="y"?"height":"width",Ce=P[T],pe=Ce+M[ae],et=Ce-M[xe],Ot=w?-B[he]/2:0,ee=A===hi?I[he]:B[he],mt=A===hi?-B[he]:-I[he],lt=e.elements.arrow,Qe=w&&lt?tr(lt):{width:0,height:0},tt=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Os(),Lt=tt[ae],Wt=tt[xe],Me=rr(0,I[he],Qe[he]),ti=R?I[he]/2-Ot-Me-Lt-j.mainAxis:ee-Me-Lt-j.mainAxis,bi=R?-I[he]/2+Ot+Me+Wt+j.mainAxis:mt+Me+Wt+j.mainAxis,ie=e.elements.arrow&&zt(e.elements.arrow),Hi=ie?T==="y"?ie.clientTop||0:ie.clientLeft||0:0,ce=(te=q?.[T])!=null?te:0,Sr=Ce+ti-ce-Hi,ue=Ce+bi-ce,Rt=rr(w?er(pe,Sr):pe,Ce,w?Ut(et,ue):et);P[T]=Rt,W[T]=Rt-Ce}if(a){var yi,gt=T==="x"?Ee:ke,ji=T==="x"?Ne:Fe,ct=P[x],Gt=x==="y"?"height":"width",ii=ct+M[gt],ut=ct-M[ji],Mt=[Ee,ke].indexOf(D)!==-1,Tt=(yi=q?.[x])!=null?yi:0,vi=Mt?ii:ct-I[Gt]-B[Gt]-Tt+j.altAxis,wi=Mt?ct+I[Gt]+B[Gt]-Tt-j.altAxis:ut,ri=w&&Mt?Pd(vi,ct,wi):rr(w?vi:ii,ct,w?wi:ut);P[x]=ri,W[x]=ri-ct}e.modifiersData[r]=W}}var Hd={name:"preventOverflow",enabled:!0,phase:"main",fn:Yv,requiresIfExists:["offset"]};function Cc(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function Ac(i){return i===fe(i)||!Be(i)?sr(i):Cc(i)}function Xv(i){var e=i.getBoundingClientRect(),t=di(e.width)/i.offsetWidth||1,r=di(e.height)/i.offsetHeight||1;return t!==1||r!==1}function Pc(i,e,t){t===void 0&&(t=!1);var r=Be(e),s=Be(e)&&Xv(e),n=We(e),o=At(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((ze(e)!=="body"||or(n))&&(a=Ac(e)),Be(e)?(l=At(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=nr(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Zv(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function Fc(i){var e=Zv(i);return _d.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function Oc(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function Lc(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var jd={placement:"bottom",modifiers:[],strategy:"absolute"};function qd(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function $d(i){i===void 0&&(i={});var e=i,t=e.defaultModifiers,r=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?jd:s;return function(a,l,h){h===void 0&&(h=n);var m={placement:"bottom",orderedModifiers:[],options:Object.assign({},jd,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},g=[],E=!1,w={state:m,setOptions:function(D){var A=typeof D=="function"?D(m.options):D;L(),m.options=Object.assign({},n,m.options,A),m.scrollParents={reference:Ct(a)?Fi(a):a.contextElement?Fi(a.contextElement):[],popper:Fi(l)};var R=Fc(Lc([].concat(r,m.options.modifiers)));return m.orderedModifiers=R.filter(function(T){return T.enabled}),F(),w.update()},forceUpdate:function(){if(!E){var D=m.elements,A=D.reference,R=D.popper;if(qd(A,R)){m.rects={reference:Pc(A,zt(R),m.options.strategy==="fixed"),popper:tr(R)},m.reset=!1,m.placement=m.options.placement,m.orderedModifiers.forEach(function(j){return m.modifiersData[j.name]=Object.assign({},j.data)});for(var T=0;T<m.orderedModifiers.length;T++){if(m.reset===!0){m.reset=!1,T=-1;continue}var x=m.orderedModifiers[T],P=x.fn,I=x.options,B=I===void 0?{}:I,U=x.name;typeof P=="function"&&(m=P({state:m,options:B,name:U,instance:w})||m)}}}},update:Oc(function(){return new Promise(function(M){w.forceUpdate(),M(m)})}),destroy:function(){L(),E=!0}};if(!qd(a,l))return w;w.setOptions(h).then(function(M){!E&&h.onFirstUpdate&&h.onFirstUpdate(M)});function F(){m.orderedModifiers.forEach(function(M){var D=M.name,A=M.options,R=A===void 0?{}:A,T=M.effect;if(typeof T=="function"){var x=T({state:m,name:D,instance:w,options:R}),P=function(){};g.push(x||P)}})}function L(){g.forEach(function(M){return M()}),g=[]}return w}}var Qv=[Rd,zd,Ld,Cd,Ud,Id,Hd,Fd,Bd],Rc=$d({defaultModifiers:Qv});var _o=class extends H{static targets=["trigger","menu"];static values={placement:{type:String,default:"bottom"}};connect(){this.visible=!1,this.initialized=!1,this.options={placement:this.placementValue,triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1},this.init()}init(){this.triggerTarget&&this.menuTarget&&!this.initialized&&(this.menu=this.menuTarget,this.menuHome={parent:this.menu.parentNode,next:this.menu.nextSibling},this.popperInstance=Rc(this.triggerTarget,this.menu,{strategy:"fixed",placement:this.options.placement,modifiers:[{name:"offset",options:{offset:[this.options.offsetSkidding,this.options.offsetDistance]}},{name:"flip",options:{fallbackPlacements:["bottom-end","bottom-start","top","top-end","top-start"],boundary:"viewport"}},{name:"preventOverflow",options:{boundary:"viewport",altAxis:!0,padding:8}}]}),this.setupEventListeners(),this.initialized=!0)}disconnect(){this.initialized&&(this.options.triggerType==="click"&&this.triggerTarget.removeEventListener("click",this.clickHandler),this.options.triggerType==="hover"&&(this.triggerTarget.removeEventListener("mouseenter",this.hoverShowTriggerHandler),this.menu.removeEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.removeEventListener("mouseleave",this.hoverHideHandler),this.menu.removeEventListener("mouseleave",this.hoverHideHandler)),this.removeClickOutsideListener(),this.restoreMenu(),this.menu.parentNode===document.body&&this.menu.remove(),this.popperInstance.destroy(),this.initialized=!1)}teleportMenu(){this.menu.parentNode!==document.body&&document.body.appendChild(this.menu)}restoreMenu(){let i=this.menuHome;i&&i.parent&&i.parent.isConnected&&this.menu.parentNode!==i.parent&&i.parent.insertBefore(this.menu,i.next)}setupEventListeners(){this.clickHandler=this.toggle.bind(this),this.hoverShowTriggerHandler=i=>{i.type==="click"?this.toggle():setTimeout(()=>{this.show()},this.options.delay)},this.hoverShowMenuHandler=()=>{this.show()},this.hoverHideHandler=()=>{setTimeout(()=>{this.menu.matches(":hover")||this.hide()},this.options.delay)},this.options.triggerType==="click"?this.triggerTarget.addEventListener("click",this.clickHandler):this.options.triggerType==="hover"&&(this.triggerTarget.addEventListener("mouseenter",this.hoverShowTriggerHandler),this.menu.addEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.addEventListener("mouseleave",this.hoverHideHandler),this.menu.addEventListener("mouseleave",this.hoverHideHandler))}setupClickOutsideListener(){this.clickOutsideHandler=i=>{let e=i.target,t=this.options.ignoreClickOutsideClass,r=!1;t&&document.querySelectorAll(`.${t}`).forEach(o=>{if(o.contains(e)){r=!0;return}});let s=e.closest(".flatpickr-calendar, .ss-main, .ss-content");e!==this.menu&&!this.menu.contains(e)&&!this.triggerTarget.contains(e)&&!r&&!s&&this.visible&&this.hide()},document.body.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&document.body.removeEventListener("click",this.clickOutsideHandler,!0)}toggle(){this.visible?this.hide():this.show()}show(){this.teleportMenu(),this.menu.classList.remove("hidden"),this.menu.classList.add("block"),this.menu.removeAttribute("aria-hidden"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!0}]})),this.setupClickOutsideListener(),this.popperInstance.update(),this.visible=!0}hide(){this.menu.classList.remove("block"),this.menu.classList.add("hidden"),this.menu.setAttribute("aria-hidden","true"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!1}]})),this.removeClickOutsideListener(),this.restoreMenu(),this.visible=!1}};var Co=class extends H{static targets=["trigger","menu"];connect(){this.element.hasAttribute("data-visible")||this.element.setAttribute("data-visible","false"),this.#e()}toggle(){let i=this.element.getAttribute("data-visible")==="true";this.element.setAttribute("data-visible",(!i).toString()),this.#e()}#e(){this.element.getAttribute("data-visible")==="true"?(this.menuTarget.classList.remove("hidden"),this.triggerTarget.setAttribute("aria-expanded","true"),this.dispatch("expand")):(this.menuTarget.classList.add("hidden"),this.triggerTarget.setAttribute("aria-expanded","false"),this.dispatch("collapse"))}};var Ao=class extends H{static values={after:Number};connect(){this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.dismiss(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.autoDismissTimeout=null}dismiss(){this.element.remove()}};var Po=class extends H{static targets=["frame","refreshButton","backButton","homeButton","maximizeLink"];connect(){this.#t(),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading),this.frameFailed=this.frameFailed.bind(this),this.frameTarget.addEventListener("turbo:fetch-request-error",this.frameFailed)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading),this.frameTarget.removeEventListener("turbo:fetch-request-error",this.frameFailed)}frameLoading(i){if(i){let t=i.target.closest("a, form")?.dataset?.turboFrame;if(t&&t!==this.frameTarget.id)return}this.#t()}frameFailed(i){this.#i()}frameLoaded(i){this.#i();let e=i.target.src;this.#e(e)}refreshButtonClicked(i){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(i){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(i){this.frameLoading(null),this.srcHistory=[this.originalFrameSrc],this.#r(),this._homeRequested=!0,this.frameTarget.src=this.originalFrameSrc,this.frameTarget.reload()}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}#e(i){this._homeRequested?(this._homeRequested=!1,this.srcHistory=[i],this.originalFrameSrc=i):i==this.currentSrc||(i==this.originalFrameSrc?this.srcHistory=[i]:this.srcHistory.push(i)),this.#r(),this.hasMaximizeLinkTarget&&(this.maximizeLinkTarget.href=i)}#t(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}#i(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse")}#r(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var Fo=["auto","light","dark"],Oo=class extends H{static values={current:String};connect(){this.applyMode(this.readMode()),this.handleStorageChange=i=>{i.key==="theme"&&this.applyMode(this.readMode())},window.addEventListener("storage",this.handleStorageChange),this.mq=window.matchMedia("(prefers-color-scheme: dark)"),this.handleMqChange=()=>{this.readMode()==="auto"&&this.applyMode("auto")},this.mq.addEventListener("change",this.handleMqChange)}disconnect(){window.removeEventListener("storage",this.handleStorageChange),this.mq&&this.mq.removeEventListener("change",this.handleMqChange)}toggleMode(){let i=this.readMode(),e=Fo[(Fo.indexOf(i)+1)%Fo.length];this.setMode(e)}setMode(i){localStorage.setItem("theme",i),this.applyMode(i)}applyMode(i){let e=this.effectiveMode(i);document.documentElement.classList.toggle("dark",e==="dark"),this.currentValue=i,this.toggleIcons(i)}readMode(){let i=localStorage.getItem("theme");return Fo.includes(i)?i:"auto"}effectiveMode(i){return i==="light"||i==="dark"?i:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}toggleIcons(i){let e={auto:this.element.querySelector(".color-mode-icon-auto"),light:this.element.querySelector(".color-mode-icon-light"),dark:this.element.querySelector(".color-mode-icon-dark")};for(let[t,r]of Object.entries(e))r&&r.classList.toggle("hidden",t!==i)}};function Vd(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t<e;t++)r[t]=i[t];return r}function Jv(i){if(Array.isArray(i))return i}function e0(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,s,n,o,a=[],l=!0,h=!1;try{if(n=(t=t.call(i)).next,e!==0)for(;!(l=(r=n.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(m){h=!0,s=m}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(h)throw s}}return a}}function t0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
32
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i0(i,e){return Jv(i)||e0(i,e)||r0(i,e)||t0()}function r0(i,e){if(i){if(typeof i=="string")return Vd(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Vd(i,e):void 0}}var np=Object.entries,Wd=Object.setPrototypeOf,s0=Object.isFrozen,n0=Object.getPrototypeOf,o0=Object.getOwnPropertyDescriptor,Ke=Object.freeze,Ye=Object.seal,$r=Object.create,op=typeof Reflect<"u"&&Reflect,Uc=op.apply,zc=op.construct;Ke||(Ke=function(e){return e});Ye||(Ye=function(e){return e});Uc||(Uc=function(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return e.apply(t,s)});zc||(zc=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return new e(...r)});var Is=Oe(Array.prototype.forEach),a0=Oe(Array.prototype.lastIndexOf),Gd=Oe(Array.prototype.pop),qr=Oe(Array.prototype.push),l0=Oe(Array.prototype.splice),Li=Array.isArray,Bs=Oe(String.prototype.toLowerCase),Mc=Oe(String.prototype.toString),Kd=Oe(String.prototype.match),Ds=Oe(String.prototype.replace),Yd=Oe(String.prototype.indexOf),c0=Oe(String.prototype.trim),u0=Oe(Number.prototype.toString),h0=Oe(Boolean.prototype.toString),Xd=typeof BigInt>"u"?null:Oe(BigInt.prototype.toString),Zd=typeof Symbol>"u"?null:Oe(Symbol.prototype.toString),je=Oe(Object.prototype.hasOwnProperty),Ns=Oe(Object.prototype.toString),Ge=Oe(RegExp.prototype.test),ar=d0(TypeError);function Oe(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return Uc(i,e,r)}}function d0(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return zc(i,t)}}function J(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bs;if(Wd&&Wd(i,null),!Li(e))return i;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(s0(e)||(e[r]=n),s=n)}i[s]=!0}return i}function p0(i){for(let e=0;e<i.length;e++)je(i,e)||(i[e]=null);return i}function rt(i){let e=$r(null);for(let r of np(i)){var t=i0(r,2);let s=t[0],n=t[1];je(i,s)&&(Li(n)?e[s]=p0(n):n&&typeof n=="object"&&n.constructor===Object?e[s]=rt(n):e[s]=n)}return e}function f0(i){switch(typeof i){case"string":return i;case"number":return u0(i);case"boolean":return h0(i);case"bigint":return Xd?Xd(i):"0";case"symbol":return Zd?Zd(i):"Symbol()";case"undefined":return Ns(i);case"function":case"object":{if(i===null)return Ns(i);let e=i,t=Xt(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:Ns(r)}return Ns(i)}default:return Ns(i)}}function Xt(i,e){for(;i!==null;){let r=o0(i,e);if(r){if(r.get)return Oe(r.get);if(typeof r.value=="function")return Oe(r.value)}i=n0(i)}function t(){return null}return t}function m0(i){try{return Ge(i,""),!0}catch{return!1}}var Qd=Ke(["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","search","section","select","shadow","slot","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"]),Ic=Ke(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Dc=Ke(["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"]),g0=Ke(["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"]),Nc=Ke(["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"]),b0=Ke(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jd=Ke(["#text"]),ep=Ke(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Bc=Ke(["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","mask-type","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"]),tp=Ke(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Lo=Ke(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),y0=Ye(/{{[\w\W]*|^[\w\W]*}}/g),v0=Ye(/<%[\w\W]*|^[\w\W]*%>/g),w0=Ye(/\${[\w\W]*/g),S0=Ye(/^data-[\-\w.\u00B7-\uFFFF]+$/),E0=Ye(/^aria-[\-\w]+$/),ip=Ye(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T0=Ye(/^(?:\w+script|data):/i),x0=Ye(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),k0=Ye(/^html$/i),_0=Ye(/^[a-z][.\w]*(-[.\w]+)+$/i),rp=Ye(/<[/\w!]/g),C0=Ye(/<[/\w]/g),A0=Ye(/<\/no(script|embed|frames)/i),P0=Ye(/\/>/i),Yt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},F0=function(){return typeof window>"u"?null:window},O0=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(r=t.getAttribute(s));let n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},sp=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Oi=function(e,t,r,s){return je(e,t)&&Li(e[t])?J(s.base?rt(s.base):{},e[t],s.transform):r};function ap(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F0(),e=b=>ap(b);if(e.version="3.4.11",e.removed=[],!i||!i.document||i.document.nodeType!==Yt.document||!i.Element)return e.isSupported=!1,e;let t=i.document,r=t,s=r.currentScript;i.DocumentFragment;let n=i.HTMLTemplateElement,o=i.Node,a=i.Element,l=i.NodeFilter,h=i.NamedNodeMap;h===void 0&&(i.NamedNodeMap||i.MozNamedAttrMap),i.HTMLFormElement;let m=i.DOMParser,g=i.trustedTypes,E=a.prototype,w=Xt(E,"cloneNode"),F=Xt(E,"remove"),L=Xt(E,"nextSibling"),M=Xt(E,"childNodes"),D=Xt(E,"parentNode"),A=Xt(E,"shadowRoot"),R=Xt(E,"attributes"),T=o&&o.prototype?Xt(o.prototype,"nodeType"):null,x=o&&o.prototype?Xt(o.prototype,"nodeName"):null;if(typeof n=="function"){let b=t.createElement("template");b.content&&b.content.ownerDocument&&(t=b.content.ownerDocument)}let P,I="",B,U=!1,j=0,q=function(){if(j>0)throw ar('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},W=function(d){q(),j++;try{return P.createHTML(d)}finally{j--}},te=function(d){q(),j++;try{return P.createScriptURL(d)}finally{j--}},ae=function(){return U||(B=O0(g,s),U=!0),B},xe=t,he=xe.implementation,Ce=xe.createNodeIterator,pe=xe.createDocumentFragment,et=xe.getElementsByTagName,Ot=r.importNode,ee=sp();e.isSupported=typeof np=="function"&&typeof D=="function"&&he&&he.createHTMLDocument!==void 0;let mt=y0,lt=v0,Qe=w0,tt=S0,Lt=E0,Wt=T0,Me=x0,ti=_0,bi=ip,ie=null,Hi=J({},[...Qd,...Ic,...Dc,...Nc,...Jd]),ce=null,Sr=J({},[...ep,...Bc,...tp,...Lo]),ue=Object.seal($r(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}})),Rt=null,yi=null,gt=Object.seal($r(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ji=!0,ct=!0,Gt=!1,ii=!0,ut=!1,Mt=!0,Tt=!1,vi=!1,wi=null,ri=null,Er=!1,si=!1,Tr=!1,xr=!1,Y=!0,us=!1,kr="user-content-",It=!0,hs=!1,bt={},de=null,ds=J({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),ps=null,me=J({},["audio","video","img","source","image","track"]),le=null,Mn=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dt="http://www.w3.org/1998/Math/MathML",_r="http://www.w3.org/2000/svg",Ie="http://www.w3.org/1999/xhtml",Si=Ie,we=!1,ht=null,Ei=J({},[Dt,_r,Ie],Mc),In=Ke(["mi","mo","mn","ms","mtext"]),qi=J({},In),Cr=Ke(["annotation-xml"]),ni=J({},Cr),nl=J({},["title","style","font","a","script"]),Ti=null,Dn=["application/xhtml+xml","text/html"],yt="text/html",Z=null,vt=null,Nn=t.createElement("form"),Ar=function(d){return d instanceof RegExp||d instanceof Function},fs=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(vt&&vt===d)return;(!d||typeof d!="object")&&(d={}),d=rt(d),Ti=Dn.indexOf(d.PARSER_MEDIA_TYPE)===-1?yt:d.PARSER_MEDIA_TYPE,Z=Ti==="application/xhtml+xml"?Mc:Bs,ie=Oi(d,"ALLOWED_TAGS",Hi,{transform:Z}),ce=Oi(d,"ALLOWED_ATTR",Sr,{transform:Z}),ht=Oi(d,"ALLOWED_NAMESPACES",Ei,{transform:Mc}),le=Oi(d,"ADD_URI_SAFE_ATTR",Mn,{transform:Z,base:Mn}),ps=Oi(d,"ADD_DATA_URI_TAGS",me,{transform:Z,base:me}),de=Oi(d,"FORBID_CONTENTS",ds,{transform:Z}),Rt=Oi(d,"FORBID_TAGS",rt({}),{transform:Z}),yi=Oi(d,"FORBID_ATTR",rt({}),{transform:Z}),bt=je(d,"USE_PROFILES")?d.USE_PROFILES&&typeof d.USE_PROFILES=="object"?rt(d.USE_PROFILES):d.USE_PROFILES:!1,ji=d.ALLOW_ARIA_ATTR!==!1,ct=d.ALLOW_DATA_ATTR!==!1,Gt=d.ALLOW_UNKNOWN_PROTOCOLS||!1,ii=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ut=d.SAFE_FOR_TEMPLATES||!1,Mt=d.SAFE_FOR_XML!==!1,Tt=d.WHOLE_DOCUMENT||!1,si=d.RETURN_DOM||!1,Tr=d.RETURN_DOM_FRAGMENT||!1,xr=d.RETURN_TRUSTED_TYPE||!1,Er=d.FORCE_BODY||!1,Y=d.SANITIZE_DOM!==!1,us=d.SANITIZE_NAMED_PROPS||!1,It=d.KEEP_CONTENT!==!1,hs=d.IN_PLACE||!1,bi=m0(d.ALLOWED_URI_REGEXP)?d.ALLOWED_URI_REGEXP:ip,Si=typeof d.NAMESPACE=="string"?d.NAMESPACE:Ie,qi=je(d,"MATHML_TEXT_INTEGRATION_POINTS")&&d.MATHML_TEXT_INTEGRATION_POINTS&&typeof d.MATHML_TEXT_INTEGRATION_POINTS=="object"?rt(d.MATHML_TEXT_INTEGRATION_POINTS):J({},In),ni=je(d,"HTML_INTEGRATION_POINTS")&&d.HTML_INTEGRATION_POINTS&&typeof d.HTML_INTEGRATION_POINTS=="object"?rt(d.HTML_INTEGRATION_POINTS):J({},Cr);let v=je(d,"CUSTOM_ELEMENT_HANDLING")&&d.CUSTOM_ELEMENT_HANDLING&&typeof d.CUSTOM_ELEMENT_HANDLING=="object"?rt(d.CUSTOM_ELEMENT_HANDLING):$r(null);if(ue=$r(null),je(v,"tagNameCheck")&&Ar(v.tagNameCheck)&&(ue.tagNameCheck=v.tagNameCheck),je(v,"attributeNameCheck")&&Ar(v.attributeNameCheck)&&(ue.attributeNameCheck=v.attributeNameCheck),je(v,"allowCustomizedBuiltInElements")&&typeof v.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=v.allowCustomizedBuiltInElements),Ye(ue),ut&&(ct=!1),Tr&&(si=!0),bt&&(ie=J({},Jd),ce=$r(null),bt.html===!0&&(J(ie,Qd),J(ce,ep)),bt.svg===!0&&(J(ie,Ic),J(ce,Bc),J(ce,Lo)),bt.svgFilters===!0&&(J(ie,Dc),J(ce,Bc),J(ce,Lo)),bt.mathMl===!0&&(J(ie,Nc),J(ce,tp),J(ce,Lo))),gt.tagCheck=null,gt.attributeCheck=null,je(d,"ADD_TAGS")&&(typeof d.ADD_TAGS=="function"?gt.tagCheck=d.ADD_TAGS:Li(d.ADD_TAGS)&&(ie===Hi&&(ie=rt(ie)),J(ie,d.ADD_TAGS,Z))),je(d,"ADD_ATTR")&&(typeof d.ADD_ATTR=="function"?gt.attributeCheck=d.ADD_ATTR:Li(d.ADD_ATTR)&&(ce===Sr&&(ce=rt(ce)),J(ce,d.ADD_ATTR,Z))),je(d,"ADD_URI_SAFE_ATTR")&&Li(d.ADD_URI_SAFE_ATTR)&&J(le,d.ADD_URI_SAFE_ATTR,Z),je(d,"FORBID_CONTENTS")&&Li(d.FORBID_CONTENTS)&&(de===ds&&(de=rt(de)),J(de,d.FORBID_CONTENTS,Z)),je(d,"ADD_FORBID_CONTENTS")&&Li(d.ADD_FORBID_CONTENTS)&&(de===ds&&(de=rt(de)),J(de,d.ADD_FORBID_CONTENTS,Z)),It&&(ie["#text"]=!0),Tt&&J(ie,["html","head","body"]),ie.table&&(J(ie,["tbody"]),delete Rt.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let _=P;P=d.TRUSTED_TYPES_POLICY;try{I=W("")}catch(C){throw P=_,C}}else d.TRUSTED_TYPES_POLICY===null?(P=void 0,I=""):(P===void 0&&(P=ae()),P&&typeof I=="string"&&(I=W("")));Ke&&Ke(d),vt=d},ms=J({},[...Ic,...Dc,...g0]),gs=J({},[...Nc,...b0]),$i=function(d,v,_){return v.namespaceURI===Ie?d==="svg":v.namespaceURI===Dt?d==="svg"&&(_==="annotation-xml"||qi[_]):!!ms[d]},ol=function(d,v,_){return v.namespaceURI===Ie?d==="math":v.namespaceURI===_r?d==="math"&&ni[_]:!!gs[d]},Pr=function(d,v,_){return v.namespaceURI===_r&&!ni[_]||v.namespaceURI===Dt&&!qi[_]?!1:!gs[d]&&(nl[d]||!ms[d])},al=function(d){let v=D(d);(!v||!v.tagName)&&(v={namespaceURI:Si,tagName:"template"});let _=Bs(d.tagName),C=Bs(v.tagName);return ht[d.namespaceURI]?d.namespaceURI===_r?$i(_,v,C):d.namespaceURI===Dt?ol(_,v,C):d.namespaceURI===Ie?Pr(_,v,C):!!(Ti==="application/xhtml+xml"&&ht[d.namespaceURI]):!1},$e=function(d){qr(e.removed,{element:d});try{D(d).removeChild(d)}catch{if(F(d),!D(d))throw ar("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Bn=function(d){let v=M(d);if(v){let C=[];Is(v,O=>{qr(C,O)}),Is(C,O=>{try{F(O)}catch{}})}let _=R(d);if(_)for(let C=_.length-1;C>=0;--C){let O=_[C],N=O&&O.name;if(typeof N=="string")try{d.removeAttribute(N)}catch{}}},oi=function(d,v){try{qr(e.removed,{attribute:v.getAttributeNode(d),from:v})}catch{qr(e.removed,{attribute:null,from:v})}if(v.removeAttribute(d),d==="is")if(si||Tr)try{$e(v)}catch{}else try{v.setAttribute(d,"")}catch{}},Un=function(d){let v=R(d);if(v)for(let _=v.length-1;_>=0;--_){let C=v[_],O=C&&C.name;if(!(typeof O!="string"||ce[Z(O)]))try{d.removeAttribute(O)}catch{}}},ll=function(d){let v=[d];for(;v.length>0;){let _=v.pop();(T?T(_):_.nodeType)===Yt.element&&Un(_);let O=M(_);if(O)for(let N=O.length-1;N>=0;--N)v.push(O[N])}},zn=function(d){let v=null,_=null;if(Er)d="<remove></remove>"+d;else{let N=Kd(d,/^[\r\n\t ]+/);_=N&&N[0]}Ti==="application/xhtml+xml"&&Si===Ie&&(d='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+d+"</body></html>");let C=P?W(d):d;if(Si===Ie)try{v=new m().parseFromString(C,Ti)}catch{}if(!v||!v.documentElement){v=he.createDocument(Si,"template",null);try{v.documentElement.innerHTML=we?I:C}catch{}}let O=v.body||v.documentElement;return d&&_&&O.insertBefore(t.createTextNode(_),O.childNodes[0]||null),Si===Ie?et.call(v,Tt?"html":"body")[0]:Tt?v.documentElement:O},Hn=function(d){return Ce.call(d.ownerDocument||d,d,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Fr=function(d){return d=Ds(d,mt," "),d=Ds(d,lt," "),d=Ds(d,Qe," "),d},bs=function(d){var v;d.normalize();let _=Ce.call(d.ownerDocument||d,d,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),C=_.nextNode();for(;C;)C.data=Fr(C.data),C=_.nextNode();let O=(v=d.querySelectorAll)===null||v===void 0?void 0:v.call(d,"template");O&&Is(O,N=>{xi(N.content)&&bs(N.content)})},Or=function(d){let v=x?x(d):null;return typeof v!="string"||Z(v)!=="form"?!1:typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||d.attributes!==R(d)||typeof d.removeAttribute!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function"||d.nodeType!==T(d)||d.childNodes!==M(d)},xi=function(d){if(!T||typeof d!="object"||d===null)return!1;try{return T(d)===Yt.documentFragment}catch{return!1}},Vi=function(d){if(!T||typeof d!="object"||d===null)return!1;try{return typeof T(d)=="number"}catch{return!1}};function Nt(b,d,v){b.length!==0&&Is(b,_=>{_.call(e,d,v,vt)})}let cl=function(d,v){return!!(Mt&&d.hasChildNodes()&&!Vi(d.firstElementChild)&&Ge(rp,d.textContent)&&Ge(rp,d.innerHTML)||Mt&&d.namespaceURI===Ie&&v==="style"&&Vi(d.firstElementChild)||d.nodeType===Yt.processingInstruction||Mt&&d.nodeType===Yt.comment&&Ge(C0,d.data))},ul=function(d,v){if(!Rt[v]&&y(v)&&(ue.tagNameCheck instanceof RegExp&&Ge(ue.tagNameCheck,v)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(v)))return!1;if(It&&!de[v]){let _=D(d),C=M(d);if(C&&_){let O=C.length;for(let N=O-1;N>=0;--N){let V=hs?C[N]:w(C[N],!0);_.insertBefore(V,L(d))}}}return $e(d),!0},jn=function(d){if(Nt(ee.beforeSanitizeElements,d,null),Or(d))return $e(d),!0;let v=Z(x?x(d):d.nodeName);if(Nt(ee.uponSanitizeElement,d,{tagName:v,allowedTags:ie}),cl(d,v))return $e(d),!0;if(Rt[v]||!(gt.tagCheck instanceof Function&&gt.tagCheck(v))&&!ie[v])return ul(d,v);if((T?T(d):d.nodeType)===Yt.element&&!al(d)||(v==="noscript"||v==="noembed"||v==="noframes")&&Ge(A0,d.innerHTML))return $e(d),!0;if(ut&&d.nodeType===Yt.text){let C=Fr(d.textContent);d.textContent!==C&&(qr(e.removed,{element:d.cloneNode()}),d.textContent=C)}return Nt(ee.afterSanitizeElements,d,null),!1},qn=function(d,v,_){if(yi[v]||Y&&(v==="id"||v==="name")&&(_ in t||_ in Nn))return!1;let C=ce[v]||gt.attributeCheck instanceof Function&&gt.attributeCheck(v,d);if(!(ct&&Ge(tt,v))){if(!(ji&&Ge(Lt,v))){if(C){if(!le[v]){if(!Ge(bi,Ds(_,Me,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&d!=="script"&&Yd(_,"data:")===0&&ps[d])){if(!(Gt&&!Ge(Wt,Ds(_,Me,"")))){if(_)return!1}}}}}else if(!(y(d)&&(ue.tagNameCheck instanceof RegExp&&Ge(ue.tagNameCheck,d)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(d))&&(ue.attributeNameCheck instanceof RegExp&&Ge(ue.attributeNameCheck,v)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(v,d))||v==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&Ge(ue.tagNameCheck,_)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(_))))return!1}}return!0},$n=J({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),y=function(d){return!$n[Bs(d)]&&Ge(ti,d)},u=function(d,v,_,C){if(P&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!_)switch(g.getAttributeType(d,v)){case"TrustedHTML":return W(C);case"TrustedScriptURL":return te(C)}return C},f=function(d,v,_,C){try{_?d.setAttributeNS(_,v,C):d.setAttribute(v,C),Or(d)?$e(d):Gd(e.removed)}catch{oi(v,d)}},p=function(d){Nt(ee.beforeSanitizeAttributes,d,null);let v=d.attributes;if(!v||Or(d))return;let _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ce,forceKeepAttr:void 0},C=v.length,O=Z(d.nodeName);for(;C--;){let N=v[C],V=N.name,$=N.namespaceURI,X=N.value,K=Z(V),ge=X,Q=V==="value"?ge:c0(ge);if(_.attrName=K,_.attrValue=Q,_.keepAttr=!0,_.forceKeepAttr=void 0,Nt(ee.uponSanitizeAttribute,d,_),Q=_.attrValue,us&&(K==="id"||K==="name")&&Yd(Q,kr)!==0&&(oi(V,d),Q=kr+Q),Mt&&Ge(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Q)){oi(V,d);continue}if(K==="attributename"&&Kd(Q,"href")){oi(V,d);continue}if(!_.forceKeepAttr){if(!_.keepAttr){oi(V,d);continue}if(!ii&&Ge(P0,Q)){oi(V,d);continue}if(ut&&(Q=Fr(Q)),!qn(O,K,Q)){oi(V,d);continue}Q=u(O,K,$,Q),Q!==ge&&f(d,V,$,Q)}}Nt(ee.afterSanitizeAttributes,d,null)},k=function(d){let v=null,_=Hn(d);for(Nt(ee.beforeSanitizeShadowDOM,d,null);v=_.nextNode();)if(Nt(ee.uponSanitizeShadowNode,v,null),jn(v),p(v),xi(v.content)&&k(v.content),(T?T(v):v.nodeType)===Yt.element){let O=A(v);xi(O)&&(S(O),k(O))}Nt(ee.afterSanitizeShadowDOM,d,null)},S=function(d){let v=[{node:d,shadow:null}];for(;v.length>0;){let _=v.pop();if(_.shadow){k(_.shadow);continue}let C=_.node,N=(T?T(C):C.nodeType)===Yt.element,V=M(C);if(V)for(let $=V.length-1;$>=0;--$)v.push({node:V[$],shadow:null});if(N){let $=x?x(C):null;if(typeof $=="string"&&Z($)==="template"){let X=C.content;xi(X)&&v.push({node:X,shadow:null})}}if(N){let $=A(C);xi($)&&v.push({node:null,shadow:$},{node:$,shadow:null})}}};return e.sanitize=function(b){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,_=null,C=null,O=null;if(we=!b,we&&(b="<!-->"),typeof b!="string"&&!Vi(b)&&(b=f0(b),typeof b!="string"))throw ar("dirty is not a string, aborting");if(!e.isSupported)return b;vi?(ie=wi,ce=ri):fs(d),(ee.uponSanitizeElement.length>0||ee.uponSanitizeAttribute.length>0)&&(ie=rt(ie)),ee.uponSanitizeAttribute.length>0&&(ce=rt(ce)),e.removed=[];let N=hs&&typeof b!="string"&&Vi(b);if(N){let X=x?x(b):b.nodeName;if(typeof X=="string"){let K=Z(X);if(!ie[K]||Rt[K])throw ar("root node is forbidden and cannot be sanitized in-place")}if(Or(b))throw ar("root node is clobbered and cannot be sanitized in-place");try{S(b)}catch(K){throw Bn(b),K}}else if(Vi(b))v=zn("<!---->"),_=v.ownerDocument.importNode(b,!0),_.nodeType===Yt.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?v=_:v.appendChild(_),S(_);else{if(!si&&!ut&&!Tt&&b.indexOf("<")===-1)return P&&xr?W(b):b;if(v=zn(b),!v)return si?null:xr?I:""}v&&Er&&$e(v.firstChild);let V=Hn(N?b:v);try{for(;C=V.nextNode();)jn(C),p(C),xi(C.content)&&k(C.content)}catch(X){throw N&&Bn(b),X}if(N)return Is(e.removed,X=>{X.element&&ll(X.element)}),ut&&bs(b),b;if(si){if(ut&&bs(v),Tr)for(O=pe.call(v.ownerDocument);v.firstChild;)O.appendChild(v.firstChild);else O=v;return(ce.shadowroot||ce.shadowrootmode)&&(O=Ot.call(r,O,!0)),O}let $=Tt?v.outerHTML:v.innerHTML;return Tt&&ie["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&Ge(k0,v.ownerDocument.doctype.name)&&($="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
33
- `+$),ut&&($=Fr($)),P&&xr?W($):$},e.setConfig=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fs(b),vi=!0,wi=ie,ri=ce},e.clearConfig=function(){vt=null,vi=!1,wi=null,ri=null,P=B,I=""},e.isValidAttribute=function(b,d,v){vt||fs({});let _=Z(b),C=Z(d);return qn(_,C,v)},e.addHook=function(b,d){typeof d=="function"&&je(ee,b)&&qr(ee[b],d)},e.removeHook=function(b,d){if(je(ee,b)){if(d!==void 0){let v=a0(ee[b],d);return v===-1?void 0:l0(ee[b],v,1)[0]}return Gd(ee[b])}},e.removeHooks=function(b){je(ee,b)&&(ee[b]=[])},e.removeAllHooks=function(){ee=sp()},e}var Vr=ap();function qc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var cr=qc();function pp(i){cr=i}var Hs={exec:()=>null};function ne(i,e=""){let t=typeof i=="string"?i:i.source,r={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(st.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var st={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},L0=/^(?:[ \t]*(?:\n|$))+/,R0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,M0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qs=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,I0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,$c=/(?:[*+-]|\d{1,9}[.)])/,fp=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,mp=ne(fp).replace(/bull/g,$c).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),D0=ne(fp).replace(/bull/g,$c).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Vc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,N0=/^[^\n]+/,Wc=/(?!\s*\])(?:\\.|[^\[\]\\])+/,B0=ne(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Wc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),U0=ne(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$c).getRegex(),Io="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Gc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,z0=ne("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Gc).replace("tag",Io).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),gp=ne(Vc).replace("hr",qs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Io).getRegex(),H0=ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",gp).getRegex(),Kc={blockquote:H0,code:R0,def:B0,fences:M0,heading:I0,hr:qs,html:z0,lheading:mp,list:U0,newline:L0,paragraph:gp,table:Hs,text:N0},lp=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Io).getRegex(),j0={...Kc,lheading:D0,table:lp,paragraph:ne(Vc).replace("hr",qs).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",lp).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Io).getRegex()},q0={...Kc,html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Gc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Hs,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(Vc).replace("hr",qs).replace("heading",` *#{1,6} *[^
34
- ]`).replace("lheading",mp).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},$0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,V0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bp=/^( {2,}|\\)\n(?!\s*$)/,W0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Do=/[\p{P}\p{S}]/u,Yc=/[\s\p{P}\p{S}]/u,yp=/[^\s\p{P}\p{S}]/u,G0=ne(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Yc).getRegex(),vp=/(?!~)[\p{P}\p{S}]/u,K0=/(?!~)[\s\p{P}\p{S}]/u,Y0=/(?:[^\s\p{P}\p{S}]|~)/u,X0=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,wp=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Z0=ne(wp,"u").replace(/punct/g,Do).getRegex(),Q0=ne(wp,"u").replace(/punct/g,vp).getRegex(),Sp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",J0=ne(Sp,"gu").replace(/notPunctSpace/g,yp).replace(/punctSpace/g,Yc).replace(/punct/g,Do).getRegex(),ew=ne(Sp,"gu").replace(/notPunctSpace/g,Y0).replace(/punctSpace/g,K0).replace(/punct/g,vp).getRegex(),tw=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yp).replace(/punctSpace/g,Yc).replace(/punct/g,Do).getRegex(),iw=ne(/\\(punct)/,"gu").replace(/punct/g,Do).getRegex(),rw=ne(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),sw=ne(Gc).replace("(?:-->|$)","-->").getRegex(),nw=ne("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",sw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mo=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ow=ne(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Mo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ep=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",Mo).replace("ref",Wc).getRegex(),Tp=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",Wc).getRegex(),aw=ne("reflink|nolink(?!\\()","g").replace("reflink",Ep).replace("nolink",Tp).getRegex(),Xc={_backpedal:Hs,anyPunctuation:iw,autolink:rw,blockSkip:X0,br:bp,code:V0,del:Hs,emStrongLDelim:Z0,emStrongRDelimAst:J0,emStrongRDelimUnd:tw,escape:$0,link:ow,nolink:Tp,punctuation:G0,reflink:Ep,reflinkSearch:aw,tag:nw,text:W0,url:Hs},lw={...Xc,link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",Mo).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mo).getRegex()},Hc={...Xc,emStrongRDelimAst:ew,emStrongLDelim:Q0,url:ne(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},cw={...Hc,br:ne(bp).replace("{2,}","*").getRegex(),text:ne(Hc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ro={normal:Kc,gfm:j0,pedantic:q0},Us={normal:Xc,gfm:Hc,breaks:cw,pedantic:lw},uw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},cp=i=>uw[i];function Zt(i,e){if(e){if(st.escapeTest.test(i))return i.replace(st.escapeReplace,cp)}else if(st.escapeTestNoEncode.test(i))return i.replace(st.escapeReplaceNoEncode,cp);return i}function up(i){try{i=encodeURI(i).replace(st.percentDecode,"%")}catch{return null}return i}function hp(i,e){let t=i.replace(st.findPipe,(n,o,a)=>{let l=!1,h=o;for(;--h>=0&&a[h]==="\\";)l=!l;return l?"|":" |"}),r=t.split(st.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(st.slashPipe,"|");return r}function zs(i,e,t){let r=i.length;if(r===0)return"";let s=0;for(;s<r&&i.charAt(r-s-1)===e;)s++;return i.slice(0,r-s)}function hw(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<i.length;r++)if(i[r]==="\\")r++;else if(i[r]===e[0])t++;else if(i[r]===e[1]&&(t--,t<0))return r;return-1}function dp(i,e,t,r,s){let n=e.href,o=e.title||null,a=i[1].replace(s.other.outputLinkReplace,"$1");if(i[0].charAt(0)!=="!"){r.state.inLink=!0;let l={type:"link",raw:t,href:n,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}return{type:"image",raw:t,href:n,title:o,text:a}}function dw(i,e,t){let r=i.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
31
+ %o`,t,e,r),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function vv(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function wv(i){return Os(i,"classes").reduce((t,r)=>Object.assign(t,Sv(r)),{})}function Sv(i){return{[`${i}Class`]:{get(){let{classes:e}=this;if(e.has(i))return e.get(i);{let t=e.getAttributeName(i);throw new Error(`Missing attribute "${t}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${Fs(i)}Class`]:{get(){return this.classes.has(i)}}}}function Ev(i){return Os(i,"outlets").reduce((t,r)=>Object.assign(t,Tv(r)),{})}function kd(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function _d(i,e,t){let r=kd(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=kd(i,e,t),r))return r}function Tv(i){let e=oc(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=_d(this,t,i);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(i);return t.length>0?t.map(r=>{let s=_d(this,r,i);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t)return t;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${Fs(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function xv(i){return Os(i,"targets").reduce((t,r)=>Object.assign(t,kv(r)),{})}function kv(i){return{[`${i}Target`]:{get(){let e=this.targets.find(i);if(e)return e;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${Fs(i)}Target`]:{get(){return this.targets.has(i)}}}}function _v(i){let e=av(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=Rd(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,Cv(s)),t)}function Cv(i,e){let t=Rd(i,e),{key:r,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(r);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${Fs(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function Rd([i,e],t){return Ov({controller:t,token:i,typeDefinition:e})}function yo(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Ps(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function Av(i){let{controller:e,token:t,typeObject:r}=i,s=Sd(r.type),n=Sd(r.default),o=s&&n,a=s&&!n,l=!s&&n,h=yo(r.type),f=Ps(i.typeObject.default);if(a)return h;if(l)return f;if(h!==f){let m=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${m}" must match the defined type "${h}". The provided default value of "${r.default}" is of type "${f}".`)}if(o)return h}function Pv(i){let{controller:e,token:t,typeDefinition:r}=i,n=Av({controller:e,token:t,typeObject:r}),o=Ps(r),a=yo(r),l=n||o||a;if(l)return l;let h=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${h}" for "${t}" value`)}function Fv(i){let e=yo(i);if(e)return Cd[e];let t=ac(i,"default"),r=ac(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=yo(n);if(o)return Cd[o]}return i}function Ov(i){let{token:e,typeDefinition:t}=i,r=`${Fd(e)}-value`,s=Pv(i);return{type:s,key:r,name:Cc(r),get defaultValue(){return Fv(t)},get hasCustomDefaultValue(){return Ps(t)!==void 0},reader:Lv[s],writer:Ad[s]||Ad.default}}var Cd={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Lv={array(i){let e=JSON.parse(i);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${Ps(e)}"`);return e},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let e=JSON.parse(i);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${Ps(e)}"`);return e},string(i){return i}},Ad={default:Rv,array:Pd,object:Pd};function Pd(i){return JSON.stringify(i)}function Rv(i){return`${i}`}var W=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,l=new CustomEvent(a,{detail:r,bubbles:n,cancelable:o});return t.dispatchEvent(l),l}};W.blessings=[wv,xv,_v,Ev];W.targets=[];W.outlets=[];W.values={};var vo=class extends W{static targets=["openIcon","closeIcon"];static outlets=["sidebar"];static values={placement:{type:String,default:"left"},bodyScrolling:{type:Boolean,default:!1},backdrop:{type:Boolean,default:!0},edge:{type:Boolean,default:!1},edgeOffset:{type:String,default:"bottom-[60px]"}};static classes={backdrop:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"};initialize(){this.visible=!1,this.handleEscapeKey=this.handleEscapeKey.bind(this)}connect(){document.addEventListener("keydown",this.handleEscapeKey)}sidebarOutletConnected(){this.#e(this.sidebarOutlet.element)}disconnect(){this.#i(),document.removeEventListener("keydown",this.handleEscapeKey),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden")}#e(i){i.setAttribute("aria-hidden","true"),i.classList.add("transition-transform"),this.#r(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#a(`${this.placementValue}-edge`,!0):this.#s(this.placementValue,!0),this.openIconTarget.classList.add("hidden"),this.openIconTarget.setAttribute("aria-hidden","true"),this.closeIconTarget.classList.remove("hidden"),this.closeIconTarget.setAttribute("aria-hidden","false"),this.sidebarOutlet.element.setAttribute("aria-modal","true"),this.sidebarOutlet.element.setAttribute("role","dialog"),this.sidebarOutlet.element.removeAttribute("aria-hidden"),this.bodyScrollingValue||document.body.classList.add("overflow-hidden"),this.backdropValue&&this.#t(),this.visible=!0,this.dispatch("show")}hideDrawer(){this.edgeValue?this.#a(`${this.placementValue}-edge`,!1):this.#s(this.placementValue,!1),this.openIconTarget.classList.remove("hidden"),this.openIconTarget.setAttribute("aria-hidden","false"),this.closeIconTarget.classList.add("hidden"),this.closeIconTarget.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.removeAttribute("aria-modal"),this.sidebarOutlet.element.removeAttribute("role"),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden"),this.backdropValue&&this.#i(),this.visible=!1,this.dispatch("hide")}handleEscapeKey(i){i.key==="Escape"&&this.visible&&this.hideDrawer()}#t(){if(!this.visible){let i=document.createElement("div");i.setAttribute("data-drawer-backdrop",""),i.classList.add(...this.constructor.classes.backdrop.split(" ")),i.addEventListener("click",()=>this.hideDrawer()),document.body.appendChild(i)}}#i(){let i=document.querySelector("[data-drawer-backdrop]");i&&i.remove()}#r(i){let e={top:{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]},right:{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]},bottom:{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]},left:{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]},"bottom-edge":{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this.edgeOffsetValue]}};return e[i]||e.left}#s(i,e){let t=this.#r(i);e?(t.active.forEach(r=>this.sidebarOutlet.element.classList.add(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.remove(r))):(t.active.forEach(r=>this.sidebarOutlet.element.classList.remove(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.add(r)))}#a(i,e){this.#s(i,e)}};var wo=class extends W{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(i){i.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e),this.dispatch("add"),this.updateState()}remove(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);e.dataset.newRecord!==void 0?e.remove():this.toggleRemoved(e,!0),this.dispatch("remove"),this.updateState()}restore(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);this.toggleRemoved(e,!1),this.dispatch("restore"),this.updateState()}toggleRemoved(i,e){i.toggleAttribute("data-removed",e);let t=i.querySelector(":scope > [data-nested-content]"),r=i.querySelector(":scope > [data-nested-removed]");t&&(t.hidden=e),r&&(r.hidden=!e);let s=i.querySelector("input[name*='_destroy']");s&&(s.value=e?"1":"0")}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(`${this.wrapperSelectorValue}:not([data-removed])`).length}};var So=class extends W{static targets=["content","removed"];remove(i){i.preventDefault(),this.contentTarget.disabled=!0,this.contentTarget.hidden=!0,this.removedTarget.hidden=!1}restore(i){i.preventDefault(),this.contentTarget.disabled=!1,this.contentTarget.hidden=!1,this.removedTarget.hidden=!0}};var Eo=class extends W{connect(){}preSubmit(){this.element.querySelectorAll('input[name="pre_submit"]').forEach(e=>e.remove());let i=document.createElement("input");i.type="hidden",i.name="pre_submit",i.value="true",this.element.appendChild(i),this.element.setAttribute("novalidate",""),this.submit()}submit(){this.element.requestSubmit()}};var Ce="top",Be="bottom",Re="right",Fe="left",To="auto",Li=[Ce,Be,Re,Fe],mi="start",rr="end",Md="clippingParents",xo="viewport",Hr="popper",Dd="reference",Ac=Li.reduce(function(i,e){return i.concat([e+"-"+mi,e+"-"+rr])},[]),ko=[].concat(Li,[To]).reduce(function(i,e){return i.concat([e,e+"-"+mi,e+"-"+rr])},[]),Mv="beforeRead",Dv="read",Iv="afterRead",Nv="beforeMain",Bv="main",Uv="afterMain",zv="beforeWrite",Hv="write",jv="afterWrite",Id=[Mv,Dv,Iv,Nv,Bv,Uv,zv,Hv,jv];function Ve(i){return i?(i.nodeName||"").toLowerCase():null}function ye(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function Ot(i){var e=ye(i).Element;return i instanceof e||i instanceof Element}function Ue(i){var e=ye(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function jr(i){if(typeof ShadowRoot>"u")return!1;var e=ye(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function qv(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!Ue(n)||!Ve(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function $v(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,h){return l[h]="",l},{});!Ue(s)||!Ve(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var Nd={name:"applyStyles",enabled:!0,phase:"write",fn:qv,effect:$v,requires:["computeStyles"]};function We(i){return i.split("-")[0]}var Ut=Math.max,sr=Math.min,gi=Math.round;function qr(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Ls(){return!/^((?!chrome|android).)*safari/i.test(qr())}function Lt(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&Ue(i)&&(s=i.offsetWidth>0&&gi(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&gi(r.height)/i.offsetHeight||1);var o=Ot(i)?ye(i):window,a=o.visualViewport,l=!Ls()&&t,h=(r.left+(l&&a?a.offsetLeft:0))/s,f=(r.top+(l&&a?a.offsetTop:0))/n,m=r.width/s,w=r.height/n;return{width:m,height:w,top:f,right:h+m,bottom:f+w,left:h,x:h,y:f}}function nr(i){var e=Lt(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function Rs(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&jr(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function nt(i){return ye(i).getComputedStyle(i)}function Pc(i){return["table","td","th"].indexOf(Ve(i))>=0}function Ze(i){return((Ot(i)?i.ownerDocument:i.document)||window.document).documentElement}function bi(i){return Ve(i)==="html"?i:i.assignedSlot||i.parentNode||(jr(i)?i.host:null)||Ze(i)}function Bd(i){return!Ue(i)||nt(i).position==="fixed"?null:i.offsetParent}function Vv(i){var e=/firefox/i.test(qr()),t=/Trident/i.test(qr());if(t&&Ue(i)){var r=nt(i);if(r.position==="fixed")return null}var s=bi(i);for(jr(s)&&(s=s.host);Ue(s)&&["html","body"].indexOf(Ve(s))<0;){var n=nt(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function zt(i){for(var e=ye(i),t=Bd(i);t&&Pc(t)&&nt(t).position==="static";)t=Bd(t);return t&&(Ve(t)==="html"||Ve(t)==="body"&&nt(t).position==="static")?e:t||Vv(i)||e}function or(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function ar(i,e,t){return Ut(i,sr(e,t))}function Ud(i,e,t){var r=ar(i,e,t);return r>t?t:r}function Ms(){return{top:0,right:0,bottom:0,left:0}}function Ds(i){return Object.assign({},Ms(),i)}function Is(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var Wv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Ds(typeof e!="number"?e:Is(e,Li))};function Gv(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=We(t.placement),l=or(a),h=[Fe,Re].indexOf(a)>=0,f=h?"height":"width";if(!(!n||!o)){var m=Wv(s.padding,t),w=nr(n),y=l==="y"?Ce:Fe,_=l==="y"?Be:Re,P=t.rects.reference[f]+t.rects.reference[l]-o[l]-t.rects.popper[f],O=o[l]-t.rects.reference[l],R=zt(n),C=R?l==="y"?R.clientHeight||0:R.clientWidth||0:0,F=P/2-O/2,k=m[y],S=C-w[f]-m[_],A=C/2-w[f]/2+F,L=ar(k,A,S),H=l;t.modifiersData[r]=(e={},e[H]=L,e.centerOffset=L-A,e)}}function Kv(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||Rs(e.elements.popper,s)&&(e.elements.arrow=s))}var zd={name:"arrow",enabled:!0,phase:"main",fn:Gv,effect:Kv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Rt(i){return i.split("-")[1]}var Yv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Xv(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:gi(t*s)/s||0,y:gi(r*s)/s||0}}function Hd(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,h=i.adaptive,f=i.roundOffsets,m=i.isFixed,w=o.x,y=w===void 0?0:w,_=o.y,P=_===void 0?0:_,O=typeof f=="function"?f({x:y,y:P}):{x:y,y:P};y=O.x,P=O.y;var R=o.hasOwnProperty("x"),C=o.hasOwnProperty("y"),F=Fe,k=Ce,S=window;if(h){var A=zt(t),L="clientHeight",H="clientWidth";if(A===ye(t)&&(A=Ze(t),nt(A).position!=="static"&&a==="absolute"&&(L="scrollHeight",H="scrollWidth")),A=A,s===Ce||(s===Fe||s===Re)&&n===rr){k=Be;var j=m&&A===S&&S.visualViewport?S.visualViewport.height:A[L];P-=j-r.height,P*=l?1:-1}if(s===Fe||(s===Ce||s===Be)&&n===rr){F=Re;var G=m&&A===S&&S.visualViewport?S.visualViewport.width:A[H];y-=G-r.width,y*=l?1:-1}}var K=Object.assign({position:a},h&&Yv),ee=f===!0?Xv({x:y,y:P},ye(t)):{x:y,y:P};if(y=ee.x,P=ee.y,l){var se;return Object.assign({},K,(se={},se[k]=C?"0":"",se[F]=R?"0":"",se.transform=(S.devicePixelRatio||1)<=1?"translate("+y+"px, "+P+"px)":"translate3d("+y+"px, "+P+"px, 0)",se))}return Object.assign({},K,(e={},e[k]=C?P+"px":"",e[F]=R?y+"px":"",e.transform="",e))}function Zv(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,l=a===void 0?!0:a,h={placement:We(e.placement),variation:Rt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Hd(Object.assign({},h,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Hd(Object.assign({},h,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var jd={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Zv,data:{}};var _o={passive:!0};function Qv(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,l=ye(e.elements.popper),h=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&h.forEach(function(f){f.addEventListener("scroll",t.update,_o)}),a&&l.addEventListener("resize",t.update,_o),function(){n&&h.forEach(function(f){f.removeEventListener("scroll",t.update,_o)}),a&&l.removeEventListener("resize",t.update,_o)}}var qd={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Qv,data:{}};var Jv={left:"right",right:"left",bottom:"top",top:"bottom"};function $r(i){return i.replace(/left|right|bottom|top/g,function(e){return Jv[e]})}var e0={start:"end",end:"start"};function Co(i){return i.replace(/start|end/g,function(e){return e0[e]})}function lr(i){var e=ye(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function cr(i){return Lt(Ze(i)).left+lr(i).scrollLeft}function Fc(i,e){var t=ye(i),r=Ze(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var h=Ls();(h||!h&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+cr(i),y:l}}function Oc(i){var e,t=Ze(i),r=lr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=Ut(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ut(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+cr(i),l=-r.scrollTop;return nt(s||t).direction==="rtl"&&(a+=Ut(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:l}}function ur(i){var e=nt(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function Ao(i){return["html","body","#document"].indexOf(Ve(i))>=0?i.ownerDocument.body:Ue(i)&&ur(i)?i:Ao(bi(i))}function Ri(i,e){var t;e===void 0&&(e=[]);var r=Ao(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=ye(r),o=s?[n].concat(n.visualViewport||[],ur(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(Ri(bi(o)))}function Vr(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function t0(i,e){var t=Lt(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function $d(i,e,t){return e===xo?Vr(Fc(i,t)):Ot(e)?t0(e,t):Vr(Oc(Ze(i)))}function i0(i){var e=Ri(bi(i)),t=["absolute","fixed"].indexOf(nt(i).position)>=0,r=t&&Ue(i)?zt(i):i;return Ot(r)?e.filter(function(s){return Ot(s)&&Rs(s,r)&&Ve(s)!=="body"}):[]}function Lc(i,e,t,r){var s=e==="clippingParents"?i0(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,h){var f=$d(i,h,r);return l.top=Ut(f.top,l.top),l.right=sr(f.right,l.right),l.bottom=sr(f.bottom,l.bottom),l.left=Ut(f.left,l.left),l},$d(i,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ns(i){var e=i.reference,t=i.element,r=i.placement,s=r?We(r):null,n=r?Rt(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case Ce:l={x:o,y:e.y-t.height};break;case Be:l={x:o,y:e.y+e.height};break;case Re:l={x:e.x+e.width,y:a};break;case Fe:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var h=s?or(s):null;if(h!=null){var f=h==="y"?"height":"width";switch(n){case mi:l[h]=l[h]-(e[f]/2-t[f]/2);break;case rr:l[h]=l[h]+(e[f]/2-t[f]/2);break;default:}}return l}function Ht(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,o=n===void 0?i.strategy:n,a=t.boundary,l=a===void 0?Md:a,h=t.rootBoundary,f=h===void 0?xo:h,m=t.elementContext,w=m===void 0?Hr:m,y=t.altBoundary,_=y===void 0?!1:y,P=t.padding,O=P===void 0?0:P,R=Ds(typeof O!="number"?O:Is(O,Li)),C=w===Hr?Dd:Hr,F=i.rects.popper,k=i.elements[_?C:w],S=Lc(Ot(k)?k:k.contextElement||Ze(i.elements.popper),l,f,o),A=Lt(i.elements.reference),L=Ns({reference:A,element:F,strategy:"absolute",placement:s}),H=Vr(Object.assign({},F,L)),j=w===Hr?H:A,G={top:S.top-j.top+R.top,bottom:j.bottom-S.bottom+R.bottom,left:S.left-j.left+R.left,right:j.right-S.right+R.right},K=i.modifiersData.offset;if(w===Hr&&K){var ee=K[s];Object.keys(G).forEach(function(se){var ae=[Re,Be].indexOf(se)>=0?1:-1,ve=[Ce,Be].indexOf(se)>=0?"y":"x";G[se]+=ee[ve]*ae})}return G}function Rc(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,h=l===void 0?ko:l,f=Rt(r),m=f?a?Ac:Ac.filter(function(_){return Rt(_)===f}):Li,w=m.filter(function(_){return h.indexOf(_)>=0});w.length===0&&(w=m);var y=w.reduce(function(_,P){return _[P]=Ht(i,{placement:P,boundary:s,rootBoundary:n,padding:o})[We(P)],_},{});return Object.keys(y).sort(function(_,P){return y[_]-y[P]})}function r0(i){if(We(i)===To)return[];var e=$r(i);return[Co(i),e,Co(e)]}function s0(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,h=t.padding,f=t.boundary,m=t.rootBoundary,w=t.altBoundary,y=t.flipVariations,_=y===void 0?!0:y,P=t.allowedAutoPlacements,O=e.options.placement,R=We(O),C=R===O,F=l||(C||!_?[$r(O)]:r0(O)),k=[O].concat(F).reduce(function(te,rt){return te.concat(We(rt)===To?Rc(e,{placement:rt,boundary:f,rootBoundary:m,padding:h,flipVariations:_,allowedAutoPlacements:P}):rt)},[]),S=e.rects.reference,A=e.rects.popper,L=new Map,H=!0,j=k[0],G=0;G<k.length;G++){var K=k[G],ee=We(K),se=Rt(K)===mi,ae=[Ce,Be].indexOf(ee)>=0,ve=ae?"width":"height",we=Ht(e,{placement:K,boundary:f,rootBoundary:m,altBoundary:w,padding:h}),Ne=ae?se?Re:Fe:se?Be:Ce;S[ve]>A[ve]&&(Ne=$r(Ne));var pe=$r(Ne),Ye=[];if(n&&Ye.push(we[ee]<=0),a&&Ye.push(we[Ne]<=0,we[pe]<=0),Ye.every(function(te){return te})){j=K,H=!1;break}L.set(K,Ye)}if(H)for(var Ct=_?3:1,mt=function(rt){var Dt=k.find(function(Gt){var He=L.get(Gt);if(He)return He.slice(0,rt).every(function(si){return si})});if(Dt)return j=Dt,"break"},gt=Ct;gt>0;gt--){var ut=mt(gt);if(ut==="break")break}e.placement!==j&&(e.modifiersData[r]._skip=!0,e.placement=j,e.reset=!0)}}var Vd={name:"flip",enabled:!0,phase:"main",fn:s0,requiresIfExists:["offset"],data:{_skip:!1}};function Wd(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function Gd(i){return[Ce,Re,Be,Fe].some(function(e){return i[e]>=0})}function n0(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=Ht(e,{elementContext:"reference"}),a=Ht(e,{altBoundary:!0}),l=Wd(o,r),h=Wd(a,s,n),f=Gd(l),m=Gd(h);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:h,isReferenceHidden:f,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}var Kd={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:n0};function o0(i,e,t){var r=We(i),s=[Fe,Ce].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[Fe,Re].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function a0(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=ko.reduce(function(f,m){return f[m]=o0(m,e.rects,n),f},{}),a=o[e.placement],l=a.x,h=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=h),e.modifiersData[r]=o}var Yd={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:a0};function l0(i){var e=i.state,t=i.name;e.modifiersData[t]=Ns({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var Xd={name:"popperOffsets",enabled:!0,phase:"read",fn:l0,data:{}};function Mc(i){return i==="x"?"y":"x"}function c0(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,h=t.rootBoundary,f=t.altBoundary,m=t.padding,w=t.tether,y=w===void 0?!0:w,_=t.tetherOffset,P=_===void 0?0:_,O=Ht(e,{boundary:l,rootBoundary:h,padding:m,altBoundary:f}),R=We(e.placement),C=Rt(e.placement),F=!C,k=or(R),S=Mc(k),A=e.modifiersData.popperOffsets,L=e.rects.reference,H=e.rects.popper,j=typeof P=="function"?P(Object.assign({},e.rects,{placement:e.placement})):P,G=typeof j=="number"?{mainAxis:j,altAxis:j}:Object.assign({mainAxis:0,altAxis:0},j),K=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ee={x:0,y:0};if(A){if(n){var se,ae=k==="y"?Ce:Fe,ve=k==="y"?Be:Re,we=k==="y"?"height":"width",Ne=A[k],pe=Ne+O[ae],Ye=Ne-O[ve],Ct=y?-H[we]/2:0,mt=C===mi?L[we]:H[we],gt=C===mi?-H[we]:-L[we],ut=e.elements.arrow,te=y&&ut?nr(ut):{width:0,height:0},rt=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Ms(),Dt=rt[ae],Gt=rt[ve],He=ar(0,L[we],te[we]),si=F?L[we]/2-Ct-He-Dt-G.mainAxis:mt-He-Dt-G.mainAxis,qi=F?-L[we]/2+Ct+He+Gt+G.mainAxis:gt+He+Gt+G.mainAxis,Kt=e.elements.arrow&&zt(e.elements.arrow),_r=Kt?k==="y"?Kt.clientTop||0:Kt.clientLeft||0:0,$i=(se=K?.[k])!=null?se:0,de=Ne+si-$i-_r,Vi=Ne+qi-$i,le=ar(y?sr(pe,de):pe,Ne,y?Ut(Ye,Vi):Ye);A[k]=le,ee[k]=le-Ne}if(a){var ni,st=k==="x"?Ce:Fe,Yt=k==="x"?Be:Re,bt=A[S],et=S==="y"?"height":"width",oi=bt+O[st],ai=bt-O[Yt],Si=[Ce,Fe].indexOf(R)!==-1,Wi=(ni=K?.[S])!=null?ni:0,yt=Si?oi:bt-L[et]-H[et]-Wi+G.altAxis,At=Si?bt+L[et]+H[et]-Wi-G.altAxis:ai,vt=y&&Si?Ud(yt,bt,At):ar(y?yt:oi,bt,y?At:ai);A[S]=vt,ee[S]=vt-bt}e.modifiersData[r]=ee}}var Zd={name:"preventOverflow",enabled:!0,phase:"main",fn:c0,requiresIfExists:["offset"]};function Dc(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function Ic(i){return i===ye(i)||!Ue(i)?lr(i):Dc(i)}function u0(i){var e=i.getBoundingClientRect(),t=gi(e.width)/i.offsetWidth||1,r=gi(e.height)/i.offsetHeight||1;return t!==1||r!==1}function Nc(i,e,t){t===void 0&&(t=!1);var r=Ue(e),s=Ue(e)&&u0(e),n=Ze(e),o=Lt(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((Ve(e)!=="body"||ur(n))&&(a=Ic(e)),Ue(e)?(l=Lt(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=cr(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function h0(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function Bc(i){var e=h0(i);return Id.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function Uc(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function zc(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var Qd={placement:"bottom",modifiers:[],strategy:"absolute"};function Jd(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function ep(i){i===void 0&&(i={});var e=i,t=e.defaultModifiers,r=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?Qd:s;return function(a,l,h){h===void 0&&(h=n);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},Qd,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},m=[],w=!1,y={state:f,setOptions:function(R){var C=typeof R=="function"?R(f.options):R;P(),f.options=Object.assign({},n,f.options,C),f.scrollParents={reference:Ot(a)?Ri(a):a.contextElement?Ri(a.contextElement):[],popper:Ri(l)};var F=Bc(zc([].concat(r,f.options.modifiers)));return f.orderedModifiers=F.filter(function(k){return k.enabled}),_(),y.update()},forceUpdate:function(){if(!w){var R=f.elements,C=R.reference,F=R.popper;if(Jd(C,F)){f.rects={reference:Nc(C,zt(F),f.options.strategy==="fixed"),popper:nr(F)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(G){return f.modifiersData[G.name]=Object.assign({},G.data)});for(var k=0;k<f.orderedModifiers.length;k++){if(f.reset===!0){f.reset=!1,k=-1;continue}var S=f.orderedModifiers[k],A=S.fn,L=S.options,H=L===void 0?{}:L,j=S.name;typeof A=="function"&&(f=A({state:f,options:H,name:j,instance:y})||f)}}}},update:Uc(function(){return new Promise(function(O){y.forceUpdate(),O(f)})}),destroy:function(){P(),w=!0}};if(!Jd(a,l))return y;y.setOptions(h).then(function(O){!w&&h.onFirstUpdate&&h.onFirstUpdate(O)});function _(){f.orderedModifiers.forEach(function(O){var R=O.name,C=O.options,F=C===void 0?{}:C,k=O.effect;if(typeof k=="function"){var S=k({state:f,name:R,instance:y,options:F}),A=function(){};m.push(S||A)}})}function P(){m.forEach(function(O){return O()}),m=[]}return y}}var d0=[qd,Xd,jd,Nd,Yd,Vd,Zd,zd,Kd],Hc=ep({defaultModifiers:d0});var Po=class extends W{static targets=["trigger","menu"];static values={placement:{type:String,default:"bottom"}};connect(){this.visible=!1,this.initialized=!1,this.options={placement:this.placementValue,triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1},this.init()}init(){this.triggerTarget&&this.menuTarget&&!this.initialized&&(this.menu=this.menuTarget,this.menuHome={parent:this.menu.parentNode,next:this.menu.nextSibling},this.popperInstance=Hc(this.triggerTarget,this.menu,{strategy:"fixed",placement:this.options.placement,modifiers:[{name:"offset",options:{offset:[this.options.offsetSkidding,this.options.offsetDistance]}},{name:"flip",options:{fallbackPlacements:["bottom-end","bottom-start","top","top-end","top-start"],boundary:"viewport"}},{name:"preventOverflow",options:{boundary:"viewport",altAxis:!0,padding:8}}]}),this.setupEventListeners(),this.initialized=!0)}disconnect(){this.initialized&&(this.options.triggerType==="click"&&this.triggerTarget.removeEventListener("click",this.clickHandler),this.options.triggerType==="hover"&&(this.triggerTarget.removeEventListener("mouseenter",this.hoverShowTriggerHandler),this.menu.removeEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.removeEventListener("mouseleave",this.hoverHideHandler),this.menu.removeEventListener("mouseleave",this.hoverHideHandler)),this.removeClickOutsideListener(),this.restoreMenu(),this.menu.parentNode===document.body&&this.menu.remove(),this.popperInstance.destroy(),this.initialized=!1)}teleportMenu(){this.menu.parentNode!==document.body&&document.body.appendChild(this.menu)}restoreMenu(){let i=this.menuHome;i&&i.parent&&i.parent.isConnected&&this.menu.parentNode!==i.parent&&i.parent.insertBefore(this.menu,i.next)}setupEventListeners(){this.clickHandler=this.toggle.bind(this),this.hoverShowTriggerHandler=i=>{i.type==="click"?this.toggle():setTimeout(()=>{this.show()},this.options.delay)},this.hoverShowMenuHandler=()=>{this.show()},this.hoverHideHandler=()=>{setTimeout(()=>{this.menu.matches(":hover")||this.hide()},this.options.delay)},this.options.triggerType==="click"?this.triggerTarget.addEventListener("click",this.clickHandler):this.options.triggerType==="hover"&&(this.triggerTarget.addEventListener("mouseenter",this.hoverShowTriggerHandler),this.menu.addEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.addEventListener("mouseleave",this.hoverHideHandler),this.menu.addEventListener("mouseleave",this.hoverHideHandler))}setupClickOutsideListener(){this.clickOutsideHandler=i=>{let e=i.target,t=this.options.ignoreClickOutsideClass,r=!1;t&&document.querySelectorAll(`.${t}`).forEach(o=>{if(o.contains(e)){r=!0;return}});let s=e.closest(".flatpickr-calendar, .ss-main, .ss-content");e!==this.menu&&!this.menu.contains(e)&&!this.triggerTarget.contains(e)&&!r&&!s&&this.visible&&this.hide()},document.body.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&document.body.removeEventListener("click",this.clickOutsideHandler,!0)}toggle(){this.visible?this.hide():this.show()}show(){this.teleportMenu(),this.menu.classList.remove("hidden"),this.menu.classList.add("block"),this.menu.removeAttribute("aria-hidden"),this.triggerTarget.setAttribute("aria-expanded","true"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!0}]})),this.setupClickOutsideListener(),this.popperInstance.update(),this.visible=!0}hide(){this.menu.classList.remove("block"),this.menu.classList.add("hidden"),this.menu.setAttribute("aria-hidden","true"),this.triggerTarget.setAttribute("aria-expanded","false"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!1}]})),this.removeClickOutsideListener(),this.restoreMenu(),this.visible=!1}};var Fo=class extends W{static targets=["trigger","menu"];connect(){this.element.hasAttribute("data-visible")||this.element.setAttribute("data-visible","false"),this.#e()}toggle(){let i=this.element.getAttribute("data-visible")==="true";this.element.setAttribute("data-visible",(!i).toString()),this.#e()}#e(){this.element.getAttribute("data-visible")==="true"?(this.menuTarget.classList.remove("hidden"),this.triggerTarget.setAttribute("aria-expanded","true"),this.dispatch("expand")):(this.menuTarget.classList.add("hidden"),this.triggerTarget.setAttribute("aria-expanded","false"),this.dispatch("collapse"))}};var Oo=class extends W{static values={after:Number};connect(){this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.dismiss(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.autoDismissTimeout=null}dismiss(){this.element.remove()}};var Lo=class extends W{static targets=["frame","refreshButton","backButton","homeButton","maximizeLink"];connect(){this.#t(),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading),this.frameFailed=this.frameFailed.bind(this),this.frameTarget.addEventListener("turbo:fetch-request-error",this.frameFailed)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading),this.frameTarget.removeEventListener("turbo:fetch-request-error",this.frameFailed)}frameLoading(i){if(i){let t=i.target.closest("a, form")?.dataset?.turboFrame;if(t&&t!==this.frameTarget.id)return}this.#t()}frameFailed(i){this.#i()}frameLoaded(i){this.#i();let e=i.target.src;this.#e(e)}refreshButtonClicked(i){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(i){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(i){this.frameLoading(null),this.srcHistory=[this.originalFrameSrc],this.#r(),this._homeRequested=!0,this.frameTarget.src=this.originalFrameSrc,this.frameTarget.reload()}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}#e(i){this._homeRequested?(this._homeRequested=!1,this.srcHistory=[i],this.originalFrameSrc=i):i==this.currentSrc||(i==this.originalFrameSrc?this.srcHistory=[i]:this.srcHistory.push(i)),this.#r(),this.hasMaximizeLinkTarget&&(this.maximizeLinkTarget.href=i)}#t(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}#i(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse")}#r(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var Ro=["auto","light","dark"],Mo=class extends W{static values={current:String};connect(){this.applyMode(this.readMode()),this.handleStorageChange=i=>{i.key==="theme"&&this.applyMode(this.readMode())},window.addEventListener("storage",this.handleStorageChange),this.mq=window.matchMedia("(prefers-color-scheme: dark)"),this.handleMqChange=()=>{this.readMode()==="auto"&&this.applyMode("auto")},this.mq.addEventListener("change",this.handleMqChange)}disconnect(){window.removeEventListener("storage",this.handleStorageChange),this.mq&&this.mq.removeEventListener("change",this.handleMqChange)}toggleMode(){let i=this.readMode(),e=Ro[(Ro.indexOf(i)+1)%Ro.length];this.setMode(e)}setMode(i){localStorage.setItem("theme",i),this.applyMode(i)}applyMode(i){let e=this.effectiveMode(i);document.documentElement.classList.toggle("dark",e==="dark"),this.currentValue=i,this.toggleIcons(i)}readMode(){let i=localStorage.getItem("theme");return Ro.includes(i)?i:"auto"}effectiveMode(i){return i==="light"||i==="dark"?i:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}toggleIcons(i){let e={auto:this.element.querySelector(".color-mode-icon-auto"),light:this.element.querySelector(".color-mode-icon-light"),dark:this.element.querySelector(".color-mode-icon-dark")};for(let[t,r]of Object.entries(e))r&&r.classList.toggle("hidden",t!==i)}};function tp(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t<e;t++)r[t]=i[t];return r}function p0(i){if(Array.isArray(i))return i}function f0(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r,s,n,o,a=[],l=!0,h=!1;try{if(n=(t=t.call(i)).next,e!==0)for(;!(l=(r=n.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(f){h=!0,s=f}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(h)throw s}}return a}}function m0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
32
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g0(i,e){return p0(i)||f0(i,e)||b0(i,e)||m0()}function b0(i,e){if(i){if(typeof i=="string")return tp(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?tp(i,e):void 0}}var gp=Object.entries,ip=Object.setPrototypeOf,y0=Object.isFrozen,v0=Object.getPrototypeOf,w0=Object.getOwnPropertyDescriptor,ze=Object.freeze,Ge=Object.seal,Wr=Object.create,bp=typeof Reflect<"u"&&Reflect,Kc=bp.apply,Yc=bp.construct;ze||(ze=function(e){return e});Ge||(Ge=function(e){return e});Kc||(Kc=function(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];return e.apply(t,s)});Yc||(Yc=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return new e(...r)});var dr=Me(Array.prototype.forEach),S0=Me(Array.prototype.lastIndexOf),rp=Me(Array.prototype.pop),Bs=Me(Array.prototype.push),E0=Me(Array.prototype.splice),Gr=Array.isArray,Hs=Me(String.prototype.toLowerCase),jc=Me(String.prototype.toString),sp=Me(String.prototype.match),Us=Me(String.prototype.replace),np=Me(String.prototype.indexOf),T0=Me(String.prototype.trim),x0=Me(Number.prototype.toString),k0=Me(Boolean.prototype.toString),op=typeof BigInt>"u"?null:Me(BigInt.prototype.toString),ap=typeof Symbol>"u"?null:Me(Symbol.prototype.toString),dt=Me(Object.prototype.hasOwnProperty),zs=Me(Object.prototype.toString),tt=Me(RegExp.prototype.test),hr=_0(TypeError);function Me(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return Kc(i,e,r)}}function _0(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Yc(i,t)}}function oe(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hs;if(ip&&ip(i,null),!Gr(e))return i;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(y0(e)||(e[r]=n),s=n)}i[s]=!0}return i}function C0(i){for(let e=0;e<i.length;e++)dt(i,e)||(i[e]=null);return i}function xt(i){let e=Wr(null);for(let r of gp(i)){var t=g0(r,2);let s=t[0],n=t[1];dt(i,s)&&(Gr(n)?e[s]=C0(n):n&&typeof n=="object"&&n.constructor===Object?e[s]=xt(n):e[s]=n)}return e}function A0(i){switch(typeof i){case"string":return i;case"number":return x0(i);case"boolean":return k0(i);case"bigint":return op?op(i):"0";case"symbol":return ap?ap(i):"Symbol()";case"undefined":return zs(i);case"function":case"object":{if(i===null)return zs(i);let e=i,t=jt(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:zs(r)}return zs(i)}default:return zs(i)}}function jt(i,e){for(;i!==null;){let r=w0(i,e);if(r){if(r.get)return Me(r.get);if(typeof r.value=="function")return Me(r.value)}i=v0(i)}function t(){return null}return t}function P0(i){try{return tt(i,""),!0}catch{return!1}}var lp=ze(["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","search","section","select","shadow","slot","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"]),qc=ze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$c=ze(["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"]),F0=ze(["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"]),Vc=ze(["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"]),O0=ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cp=ze(["#text"]),up=ze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Wc=ze(["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","dominant-baseline","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","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","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-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),hp=ze(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Do=ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),L0=Ge(/{{[\w\W]*|^[\w\W]*}}/g),R0=Ge(/<%[\w\W]*|^[\w\W]*%>/g),M0=Ge(/\${[\w\W]*/g),D0=Ge(/^data-[\-\w.\u00B7-\uFFFF]+$/),I0=Ge(/^aria-[\-\w]+$/),dp=Ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),N0=Ge(/^(?:\w+script|data):/i),B0=Ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),U0=Ge(/^html$/i),z0=Ge(/^[a-z][.\w]*(-[.\w]+)+$/i),pp=Ge(/<[/\w!]/g),fp=Ge(/<[/\w]/g),H0=Ge(/<\/no(script|embed|frames)/i),j0=Ge(/\/>/i),Tt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},yp=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],q0=ze(oe({},yp)),$0=(function(){let i={};return dr(yp,e=>{i[e]=Ge(new RegExp("</"+e+"(?=[\\t\\n\\f\\r />])","i"))}),ze(i)})(),V0=function(){return typeof window>"u"?null:window},W0=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(r=t.getAttribute(s));let n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},mp=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Mi=function(e,t,r,s){return dt(e,t)&&Gr(e[t])?oe(s.base?xt(s.base):{},e[t],s.transform):r},Gc=function(e,t,r){let s=dt(e,t)?e[t]:void 0;return s&&typeof s=="object"?xt(s):r()};function vp(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V0(),e=B=>vp(B);if(e.version="3.4.14",e.removed=[],!i||!i.document||i.document.nodeType!==Tt.document||!i.Element)return e.isSupported=!1,e;let t=i.document,r=t,s=r.currentScript;i.DocumentFragment;let n=i.HTMLTemplateElement,o=i.Node,a=i.Element,l=i.NodeFilter,h=i.NamedNodeMap;h===void 0&&(i.NamedNodeMap||i.MozNamedAttrMap),i.HTMLFormElement;let f=i.DOMParser,m=i.trustedTypes,w=a.prototype,y=jt(w,"cloneNode"),_=jt(w,"remove"),P=jt(w,"nextSibling"),O=jt(w,"childNodes"),R=jt(w,"parentNode"),C=jt(w,"shadowRoot"),F=jt(w,"attributes"),k=o&&o.prototype?jt(o.prototype,"nodeType"):null,S=o&&o.prototype?jt(o.prototype,"nodeName"):null,A=o&&o.prototype?jt(o.prototype,"ownerDocument"):null,L=function(g){return k?k(g):g.nodeType},H=function(g){return S?S(g):g.nodeName};if(typeof n=="function"){let B=t.createElement("template");B.content&&B.content.ownerDocument&&(t=B.content.ownerDocument)}let j,G="",K,ee=!1,se=0,ae=function(){if(se>0)throw hr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ve=function(g){ae(),se++;try{return j.createHTML(g)}finally{se--}},we=function(g){ae(),se++;try{return j.createScriptURL(g)}finally{se--}},Ne=function(){return ee||(K=W0(m,s),ee=!0),K},pe=t,Ye=pe.implementation,Ct=pe.createNodeIterator,mt=pe.createDocumentFragment,gt=pe.getElementsByTagName,ut=r.importNode,te=mp();e.isSupported=typeof gp=="function"&&typeof R=="function"&&Ye&&Ye.createHTMLDocument!==void 0;let rt=L0,Dt=R0,Gt=M0,He=D0,si=I0,qi=N0,Kt=B0,_r=z0,$i=dp,de=null,Vi=oe({},[...lp,...qc,...$c,...Vc,...cp]),le=null,ni=oe({},[...up,...Wc,...hp,...Do]),st=Object.seal(Wr(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}})),Yt=null,bt=null,et=Object.seal(Wr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),oi=!0,ai=!0,Si=!1,Wi=!0,yt=!1,At=!0,vt=!1,Cr=!1,Gi=null,Ar=null,ps=!1,J=!1,Ki=!1,Ei=!1,Xt=!0,Bn=!1,li="user-content-",je=!0,fs=!1,ci={},fe=null,me=oe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),Un=null,ui=oe({},["audio","video","img","source","image","track"]),zn=null,It=oe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pr="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",Pe="http://www.w3.org/1999/xhtml",wt=Pe,ms=!1,Yi=null,gs=oe({},[Pr,Se,Pe],jc),Ti=ze(["mi","mo","mn","ms","mtext"]),bs=oe({},Ti),ys=ze(["annotation-xml"]),Fr=oe({},ys),St=oe({},["title","style","font","a","script"]),qe=null,xi=["application/xhtml+xml","text/html"],Hn="text/html",be=null,ki=null,jn=t.createElement("form"),vs=function(g){return g instanceof RegExp||g instanceof Function},hi=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ki&&ki===g)return;(!g||typeof g!="object")&&(g={}),g=xt(g),qe=xi.indexOf(g.PARSER_MEDIA_TYPE)===-1?Hn:g.PARSER_MEDIA_TYPE,be=qe==="application/xhtml+xml"?jc:Hs,de=Mi(g,"ALLOWED_TAGS",Vi,{transform:be}),le=Mi(g,"ALLOWED_ATTR",ni,{transform:be}),Yi=Mi(g,"ALLOWED_NAMESPACES",gs,{transform:jc}),zn=Mi(g,"ADD_URI_SAFE_ATTR",It,{transform:be,base:It}),Un=Mi(g,"ADD_DATA_URI_TAGS",ui,{transform:be,base:ui}),fe=Mi(g,"FORBID_CONTENTS",me,{transform:be}),Yt=Mi(g,"FORBID_TAGS",xt({}),{transform:be}),bt=Mi(g,"FORBID_ATTR",xt({}),{transform:be}),ci=dt(g,"USE_PROFILES")?g.USE_PROFILES&&typeof g.USE_PROFILES=="object"?xt(g.USE_PROFILES):g.USE_PROFILES:!1,oi=g.ALLOW_ARIA_ATTR!==!1,ai=g.ALLOW_DATA_ATTR!==!1,Si=g.ALLOW_UNKNOWN_PROTOCOLS||!1,Wi=g.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=g.SAFE_FOR_TEMPLATES||!1,At=g.SAFE_FOR_XML!==!1,vt=g.WHOLE_DOCUMENT||!1,J=g.RETURN_DOM||!1,Ki=g.RETURN_DOM_FRAGMENT||!1,Ei=g.RETURN_TRUSTED_TYPE||!1,ps=g.FORCE_BODY||!1,Xt=g.SANITIZE_DOM!==!1,Bn=g.SANITIZE_NAMED_PROPS||!1,je=g.KEEP_CONTENT!==!1,fs=g.IN_PLACE||!1,$i=P0(g.ALLOWED_URI_REGEXP)?g.ALLOWED_URI_REGEXP:dp,wt=typeof g.NAMESPACE=="string"?g.NAMESPACE:Pe,bs=Gc(g,"MATHML_TEXT_INTEGRATION_POINTS",()=>oe({},Ti)),Fr=Gc(g,"HTML_INTEGRATION_POINTS",()=>oe({},ys));let E=Gc(g,"CUSTOM_ELEMENT_HANDLING",()=>Wr(null));if(st=Wr(null),dt(E,"tagNameCheck")&&vs(E.tagNameCheck)&&(st.tagNameCheck=E.tagNameCheck),dt(E,"attributeNameCheck")&&vs(E.attributeNameCheck)&&(st.attributeNameCheck=E.attributeNameCheck),dt(E,"allowCustomizedBuiltInElements")&&typeof E.allowCustomizedBuiltInElements=="boolean"&&(st.allowCustomizedBuiltInElements=E.allowCustomizedBuiltInElements),Ge(st),yt&&(ai=!1),Ki&&(J=!0),ci&&(de=oe({},cp),le=Wr(null),ci.html===!0&&(oe(de,lp),oe(le,up)),ci.svg===!0&&(oe(de,qc),oe(le,Wc),oe(le,Do)),ci.svgFilters===!0&&(oe(de,$c),oe(le,Wc),oe(le,Do)),ci.mathMl===!0&&(oe(de,Vc),oe(le,hp),oe(le,Do))),et.tagCheck=null,et.attributeCheck=null,dt(g,"ADD_TAGS")&&(typeof g.ADD_TAGS=="function"?et.tagCheck=g.ADD_TAGS:Gr(g.ADD_TAGS)&&(de===Vi&&(de=xt(de)),oe(de,g.ADD_TAGS,be))),dt(g,"ADD_ATTR")&&(typeof g.ADD_ATTR=="function"?et.attributeCheck=g.ADD_ATTR:Gr(g.ADD_ATTR)&&(le===ni&&(le=xt(le)),oe(le,g.ADD_ATTR,be))),dt(g,"ADD_FORBID_CONTENTS")&&Gr(g.ADD_FORBID_CONTENTS)&&(fe===me&&(fe=xt(fe)),oe(fe,g.ADD_FORBID_CONTENTS,be)),je&&(de["#text"]=!0),vt&&oe(de,["html","head","body"]),de.table&&(oe(de,["tbody"]),delete Yt.tbody),g.TRUSTED_TYPES_POLICY){if(typeof g.TRUSTED_TYPES_POLICY.createHTML!="function")throw hr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof g.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw hr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let D=j;j=g.TRUSTED_TYPES_POLICY;try{G=ve("")}catch(V){throw j=D,V}}else g.TRUSTED_TYPES_POLICY===null?(j=void 0,G=""):(j===void 0&&(j=Ne()),j&&typeof G=="string"&&(G=ve("")));ze&&ze(g),ki=g},qn=oe({},[...qc,...$c,...F0]),Xi=oe({},[...Vc,...O0]),fl=function(g,E,D){return E.namespaceURI===Pe?g==="svg":E.namespaceURI===Pr?g==="svg"&&(D==="annotation-xml"||bs[D]):!!qn[g]},Zt=function(g,E,D){return E.namespaceURI===Pe?g==="math":E.namespaceURI===Se?g==="math"&&Fr[D]:!!Xi[g]},ml=function(g,E,D){return E.namespaceURI===Se&&!Fr[D]||E.namespaceURI===Pr&&!bs[D]?!1:!Xi[g]&&(St[g]||!qn[g])},gl=function(g){let E=R(g);(!E||!E.tagName)&&(E={namespaceURI:wt,tagName:"template"});let D=Hs(g.tagName),V=Hs(E.tagName);return Yi[g.namespaceURI]?g.namespaceURI===Se?fl(D,E,V):g.namespaceURI===Pr?Zt(D,E,V):g.namespaceURI===Pe?ml(D,E,V):!!(qe==="application/xhtml+xml"&&Yi[g.namespaceURI]):!1},Nt=function(g){Bs(e.removed,{element:g});try{R(g).removeChild(g)}catch{if(_(g),!R(g))throw hr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},$n=function(g,E,D){try{g.removeAttributeNode(E)}catch{try{g.removeAttribute(D)}catch{}}},Or=function(g){Lr(g);let E=O(g);if(E){let V=[];dr(E,Y=>{Bs(V,Y)}),dr(V,Y=>{try{_(Y)}catch{}})}let D=F(g);if(D)for(let V=D.length-1;V>=0;--V){let Y=D[V],X=Y&&Y.name;typeof X=="string"&&$n(g,Y,X)}},di=function(g,E,D){if(!D)try{D=E.getAttributeNode(g)}catch{D=null}Bs(e.removed,{attribute:D||null,from:E});try{D?E.removeAttributeNode(D):E.removeAttribute(g)}catch{try{E.removeAttribute(g)}catch{}}if(g==="is")if(J||Ki)try{Nt(E)}catch{}else try{E.setAttribute(g,"")}catch{}},bl=function(g){let E=F(g);if(E)for(let D=E.length-1;D>=0;--D){let V=E[D],Y=V&&V.name;typeof Y!="string"||le[be(Y)]||$n(g,V,Y)}},Lr=function(g){let E=[g];for(;E.length>0;){let D=E.pop();L(D)===Tt.element&&bl(D);let Y=O(D);if(Y)for(let X=Y.length-1;X>=0;--X)E.push(Y[X])}},Vn=function(g,E){return At?g==="patchsrc"?!0:g==="for"&&E!=="label"&&E!=="output":!1},yl=function(g){if(!At)return;let E=[g];for(;E.length>0;){let D=E.pop(),V=L(D);if(V===Tt.processingInstruction||V===Tt.comment&&tt(fp,D.data)){try{_(D)}catch{}continue}if(V===Tt.element){let X=D,U=be(H(D));try{X.hasAttribute&&X.hasAttribute("patchsrc")&&X.removeAttribute("patchsrc"),X.hasAttribute&&X.hasAttribute("for")&&Vn("for",U)&&X.removeAttribute("for")}catch{}}let Y=O(D);if(Y)for(let X=Y.length-1;X>=0;--X)E.push(Y[X])}},Wn=function(g){let E=null,D=null;if(ps)g="<remove></remove>"+g;else{let X=sp(g,/^[\r\n\t ]+/);D=X&&X[0]}qe==="application/xhtml+xml"&&wt===Pe&&(g='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+g+"</body></html>");let V=j?ve(g):g;if(wt===Pe)try{E=new f().parseFromString(V,qe)}catch{}if(!E||!E.documentElement){E=Ye.createDocument(wt,"template",null);try{E.documentElement.innerHTML=ms?G:V}catch{}}let Y=E.body||E.documentElement;return g&&D&&Y.insertBefore(t.createTextNode(D),Y.childNodes[0]||null),wt===Pe?gt.call(E,vt?"html":"body")[0]:vt?E.documentElement:Y},Gn=function(g){let E=A?A(g):g.ownerDocument;return Ct.call(E||g,g,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Rr=function(g){return g=Us(g,rt," "),g=Us(g,Dt," "),g=Us(g,Gt," "),g},ws=function(g){var E;g.normalize();let D=A?A(g):g.ownerDocument,V=Ct.call(D||g,g,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),Y=V.nextNode();for(;Y;)Y.data=Rr(Y.data),Y=V.nextNode();let X=(E=g.querySelectorAll)===null||E===void 0?void 0:E.call(g,"template");X&&dr(X,U=>{_i(U.content)&&ws(U.content)})},Mr=function(g){let E=S?S(g):null;return typeof E!="string"||be(E)!=="form"?!1:typeof g.nodeName!="string"||typeof g.textContent!="string"||typeof g.removeChild!="function"||g.attributes!==F(g)||typeof g.removeAttribute!="function"||typeof g.setAttribute!="function"||typeof g.namespaceURI!="string"||typeof g.insertBefore!="function"||typeof g.hasChildNodes!="function"||g.nodeType!==k(g)||g.childNodes!==O(g)},_i=function(g){if(!k||typeof g!="object"||g===null)return!1;try{return k(g)===Tt.documentFragment}catch{return!1}},Ci=function(g){if(!k||typeof g!="object"||g===null)return!1;try{return typeof k(g)=="number"}catch{return!1}};function b(B,g,E){B.length!==0&&dr(B,D=>{D.call(e,g,E,ki)})}let u=function(g,E){return!!(At&&g.hasChildNodes()&&!Ci(g.firstElementChild)&&tt(pp,g.textContent)&&tt(pp,g.innerHTML)||At&&g.namespaceURI===Pe&&q0[E]&&(Ci(g.firstElementChild)||typeof g.textContent=="string"&&tt($0[E],g.textContent))||g.nodeType===Tt.processingInstruction||At&&g.nodeType===Tt.comment&&tt(fp,g.data))},p=function(g,E){if(g instanceof RegExp)return tt(g,E);if(g instanceof Function){for(var D=arguments.length,V=new Array(D>2?D-2:0),Y=2;Y<D;Y++)V[Y-2]=arguments[Y];return!!g(E,...V)}return!1},d=function(g,E,D){if(!Yt[E]&&z(E)&&p(st.tagNameCheck,E))return!1;if(je&&!fe[E]){let V=R(g),Y=O(g);if(Y&&V){let X=Y.length;for(let U=X-1;U>=0;--U){let Z=g===D?y(Y[U],!0):Y[U];V.insertBefore(Z,P(g))}}}return Nt(g),!0},x=function(g,E,D,V){return g.length===0?E:E===D||E===V?xt(E):E},v=function(g,E){return g===E||R(g)!==null?!1:(fs&&Lr(g),!0)},T=function(g,E){if(b(te.beforeSanitizeElements,g,null),v(g,E))return!0;if(Mr(g))return Nt(g),!0;let D=be(H(g));if(de=x(te.uponSanitizeElement,de,Vi,Gi),b(te.uponSanitizeElement,g,{tagName:D,allowedTags:de}),v(g,E))return!0;if(u(g,D))return Nt(g),!0;if(Yt[D]||!(et.tagCheck instanceof Function&&et.tagCheck(D))&&!de[D]){let Y=d(g,D,E);return Y===!1&&b(te.afterSanitizeElements,g,null),Y}if(L(g)===Tt.element&&!gl(g)||(D==="noscript"||D==="noembed"||D==="noframes")&&tt(H0,g.innerHTML))return Nt(g),!0;if(yt&&g.nodeType===Tt.text){let Y=Rr(g.textContent);g.textContent!==Y&&(Bs(e.removed,{element:g.cloneNode()}),g.textContent=Y)}return b(te.afterSanitizeElements,g,null),!1},M=function(g,E,D){if(bt[E]||Vn(E,g)||Xt&&(E==="id"||E==="name")&&(D in t||D in jn))return!1;let V=le[E]||et.attributeCheck instanceof Function&&et.attributeCheck(E,g);return ai&&tt(He,E)||oi&&tt(si,E)?!0:V?zn[E]||tt($i,Us(D,Kt,""))||(E==="src"||E==="xlink:href"||E==="href")&&g!=="script"&&np(D,"data:")===0&&Un[g]||Si&&!tt(qi,Us(D,Kt,""))?!0:!D:z(g)&&p(st.tagNameCheck,g)&&p(st.attributeNameCheck,E,g)||E==="is"&&st.allowCustomizedBuiltInElements&&p(st.tagNameCheck,D)},$=oe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),z=function(g){return!$[Hs(g)]&&tt(_r,g)},I=function(g,E,D,V){if(j&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!D)switch(m.getAttributeType(g,E)){case"TrustedHTML":return ve(V);case"TrustedScriptURL":return we(V)}return V},N=function(g,E,D,V){try{D?g.setAttributeNS(D,E,V):g.setAttribute(E,V),Mr(g)?Nt(g):rp(e.removed)}catch{di(E,g)}},q=function(g){b(te.beforeSanitizeAttributes,g,null);let E=g.attributes;if(!E||Mr(g))return;le=x(te.uponSanitizeAttribute,le,ni,Ar);let D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:le,forceKeepAttr:void 0},V=E.length,Y=be(g.nodeName);for(;V--;){let X=E[V],U=X.name,Z=X.namespaceURI,ne=X.value,ge=be(U),Et=ne,Ee=U==="value"?Et:T0(Et);if(D.attrName=ge,D.attrValue=Ee,D.keepAttr=!0,D.forceKeepAttr=void 0,b(te.uponSanitizeAttribute,g,D),Ee=D.attrValue,Bn&&(ge==="id"||ge==="name")&&np(Ee,li)!==0&&(di(U,g,X),Ee=li+Ee),At&&tt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ee)){di(U,g,X);continue}if(ge==="attributename"&&sp(Ee,"href")){di(U,g,X);continue}if(!D.forceKeepAttr){if(!D.keepAttr){di(U,g,X);continue}if(!Wi&&tt(j0,Ee)){di(U,g,X);continue}if(yt&&(Ee=Rr(Ee)),!M(Y,ge,Ee)){di(U,g,X);continue}Ee=I(Y,ge,Z,Ee),Ee!==Et&&N(g,U,Z,Ee)}}b(te.afterSanitizeAttributes,g,null)},ie=function(g){let E=null,D=Gn(g);for(b(te.beforeSanitizeShadowDOM,g,null);E=D.nextNode();)if(b(te.uponSanitizeShadowNode,E,null),T(E,g),q(E),_i(E.content)&&ie(E.content),L(E)===Tt.element){let V=C(E);_i(V)&&(re(V),ie(V))}b(te.afterSanitizeShadowDOM,g,null)},re=function(g){let E=[{node:g,shadow:null}];for(;E.length>0;){let D=E.pop();if(D.shadow){ie(D.shadow);continue}let V=D.node,X=L(V)===Tt.element,U=O(V);if(U)for(let Z=U.length-1;Z>=0;--Z)E.push({node:U[Z],shadow:null});if(X){let Z=S?S(V):null;if(typeof Z=="string"&&be(Z)==="template"){let ne=V.content;_i(ne)&&E.push({node:ne,shadow:null})}}if(X){let Z=C(V);_i(Z)&&E.push({node:null,shadow:Z},{node:Z,shadow:null})}}};return e.sanitize=function(B){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,D=null,V=null,Y=null;if(ms=!B,ms&&(B="<!-->"),typeof B!="string"&&!Ci(B)&&(B=A0(B),typeof B!="string"))throw hr("dirty is not a string, aborting");if(!e.isSupported)return B;Cr?(de=Gi,le=Ar):hi(g),(te.uponSanitizeElement.length>0||te.uponSanitizeAttribute.length>0)&&(de=xt(de)),te.uponSanitizeAttribute.length>0&&(le=xt(le)),e.removed=[];let X=fs&&typeof B!="string"&&Ci(B);if(X){yl(B);let ne=H(B);if(typeof ne=="string"){let ge=be(ne);if(!de[ge]||Yt[ge])throw Or(B),hr("root node is forbidden and cannot be sanitized in-place")}if(Mr(B))throw Or(B),hr("root node is clobbered and cannot be sanitized in-place");try{re(B)}catch(ge){throw Or(B),ge}}else if(Ci(B))E=Wn("<!---->"),D=E.ownerDocument.importNode(B,!0),D.nodeType===Tt.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?E=D:E.appendChild(D),re(D);else{if(!J&&!yt&&!vt&&B.indexOf("<")===-1)return j&&Ei?ve(B):B;if(E=Wn(B),!E)return J?null:Ei?G:""}E&&ps&&Nt(E.firstChild);let U=X?B:E;try{let ne=Gn(U);for(;V=ne.nextNode();)T(V,U),q(V),_i(V.content)&&ie(V.content)}catch(ne){throw X&&(Or(B),dr(e.removed,ge=>{ge.element&&Lr(ge.element)})),ne}if(X)return dr(e.removed,ne=>{ne.element&&Lr(ne.element)}),yt&&ws(B),B;if(J){if(yt&&ws(E),Ki)for(Y=mt.call(E.ownerDocument);E.firstChild;)Y.appendChild(E.firstChild);else Y=E;return(le.shadowroot||le.shadowrootmode)&&(Y=ut.call(r,Y,!0)),Y}let Z=vt?E.outerHTML:E.innerHTML;return vt&&de["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&tt(U0,E.ownerDocument.doctype.name)&&(Z="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
33
+ `+Z),yt&&(Z=Rr(Z)),j&&Ei?ve(Z):Z},e.setConfig=function(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hi(B),Cr=!0,Gi=de,Ar=le},e.clearConfig=function(){ki=null,Cr=!1,Gi=null,Ar=null,j=K,G=""},e.isValidAttribute=function(B,g,E){ki||hi({});let D=be(B),V=be(g);return M(D,V,E)},e.addHook=function(B,g){typeof g=="function"&&dt(te,B)&&Bs(te[B],g)},e.removeHook=function(B,g){if(dt(te,B)){if(g!==void 0){let E=S0(te[B],g);return E===-1?void 0:E0(te[B],E,1)[0]}return rp(te[B])}},e.removeHooks=function(B){dt(te,B)&&(te[B]=[])},e.removeAllHooks=function(){te=mp()},e}var Kr=vp();function Qc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var fr=Qc();function kp(i){fr=i}var $s={exec:()=>null};function ue(i,e=""){let t=typeof i=="string"?i:i.source,r={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(ot.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var ot={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},G0=/^(?:[ \t]*(?:\n|$))+/,K0=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Y0=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ws=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,X0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Jc=/(?:[*+-]|\d{1,9}[.)])/,_p=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Cp=ue(_p).replace(/bull/g,Jc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Z0=ue(_p).replace(/bull/g,Jc).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),eu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Q0=/^[^\n]+/,tu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,J0=ue(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",tu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ew=ue(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Jc).getRegex(),Bo="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",iu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,tw=ue("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",iu).replace("tag",Bo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ap=ue(eu).replace("hr",Ws).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Bo).getRegex(),iw=ue(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ap).getRegex(),ru={blockquote:iw,code:K0,def:J0,fences:Y0,heading:X0,hr:Ws,html:tw,lheading:Cp,list:ew,newline:G0,paragraph:Ap,table:$s,text:Q0},wp=ue("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ws).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Bo).getRegex(),rw={...ru,lheading:Z0,table:wp,paragraph:ue(eu).replace("hr",Ws).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wp).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Bo).getRegex()},sw={...ru,html:ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",iu).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$s,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ue(eu).replace("hr",Ws).replace("heading",` *#{1,6} *[^
34
+ ]`).replace("lheading",Cp).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nw=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ow=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Pp=/^( {2,}|\\)\n(?!\s*$)/,aw=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Uo=/[\p{P}\p{S}]/u,su=/[\s\p{P}\p{S}]/u,Fp=/[^\s\p{P}\p{S}]/u,lw=ue(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,su).getRegex(),Op=/(?!~)[\p{P}\p{S}]/u,cw=/(?!~)[\s\p{P}\p{S}]/u,uw=/(?:[^\s\p{P}\p{S}]|~)/u,hw=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Lp=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,dw=ue(Lp,"u").replace(/punct/g,Uo).getRegex(),pw=ue(Lp,"u").replace(/punct/g,Op).getRegex(),Rp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fw=ue(Rp,"gu").replace(/notPunctSpace/g,Fp).replace(/punctSpace/g,su).replace(/punct/g,Uo).getRegex(),mw=ue(Rp,"gu").replace(/notPunctSpace/g,uw).replace(/punctSpace/g,cw).replace(/punct/g,Op).getRegex(),gw=ue("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Fp).replace(/punctSpace/g,su).replace(/punct/g,Uo).getRegex(),bw=ue(/\\(punct)/,"gu").replace(/punct/g,Uo).getRegex(),yw=ue(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vw=ue(iu).replace("(?:-->|$)","-->").getRegex(),ww=ue("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",vw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),No=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Sw=ue(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",No).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Mp=ue(/^!?\[(label)\]\[(ref)\]/).replace("label",No).replace("ref",tu).getRegex(),Dp=ue(/^!?\[(ref)\](?:\[\])?/).replace("ref",tu).getRegex(),Ew=ue("reflink|nolink(?!\\()","g").replace("reflink",Mp).replace("nolink",Dp).getRegex(),nu={_backpedal:$s,anyPunctuation:bw,autolink:yw,blockSkip:hw,br:Pp,code:ow,del:$s,emStrongLDelim:dw,emStrongRDelimAst:fw,emStrongRDelimUnd:gw,escape:nw,link:Sw,nolink:Dp,punctuation:lw,reflink:Mp,reflinkSearch:Ew,tag:ww,text:aw,url:$s},Tw={...nu,link:ue(/^!?\[(label)\]\((.*?)\)/).replace("label",No).getRegex(),reflink:ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",No).getRegex()},Xc={...nu,emStrongRDelimAst:mw,emStrongLDelim:pw,url:ue(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},xw={...Xc,br:ue(Pp).replace("{2,}","*").getRegex(),text:ue(Xc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Io={normal:ru,gfm:rw,pedantic:sw},js={normal:nu,gfm:Xc,breaks:xw,pedantic:Tw},kw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sp=i=>kw[i];function Jt(i,e){if(e){if(ot.escapeTest.test(i))return i.replace(ot.escapeReplace,Sp)}else if(ot.escapeTestNoEncode.test(i))return i.replace(ot.escapeReplaceNoEncode,Sp);return i}function Ep(i){try{i=encodeURI(i).replace(ot.percentDecode,"%")}catch{return null}return i}function Tp(i,e){let t=i.replace(ot.findPipe,(n,o,a)=>{let l=!1,h=o;for(;--h>=0&&a[h]==="\\";)l=!l;return l?"|":" |"}),r=t.split(ot.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(ot.slashPipe,"|");return r}function qs(i,e,t){let r=i.length;if(r===0)return"";let s=0;for(;s<r&&i.charAt(r-s-1)===e;)s++;return i.slice(0,r-s)}function _w(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<i.length;r++)if(i[r]==="\\")r++;else if(i[r]===e[0])t++;else if(i[r]===e[1]&&(t--,t<0))return r;return-1}function xp(i,e,t,r,s){let n=e.href,o=e.title||null,a=i[1].replace(s.other.outputLinkReplace,"$1");if(i[0].charAt(0)!=="!"){r.state.inLink=!0;let l={type:"link",raw:t,href:n,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}return{type:"image",raw:t,href:n,title:o,text:a}}function Cw(i,e,t){let r=i.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
35
35
  `).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=s.length?n.slice(s.length):n}).join(`
36
- `)}var Gr=class{options;rules;lexer;constructor(e){this.options=e||cr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:zs(r,`
37
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],s=dw(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let s=zs(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:zs(t[0],`
38
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=zs(t[0],`
36
+ `)}var Xr=class{options;rules;lexer;constructor(e){this.options=e||fr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:qs(r,`
37
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],s=Cw(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let s=qs(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:qs(t[0],`
38
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=qs(t[0],`
39
39
  `).split(`
40
- `),s="",n="",o=[];for(;r.length>0;){let a=!1,l=[],h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))l.push(r[h]),a=!0;else if(!a)l.push(r[h]);else break;r=r.slice(h);let m=l.join(`
41
- `),g=m.replace(this.rules.other.blockquoteSetextReplace,`
40
+ `),s="",n="",o=[];for(;r.length>0;){let a=!1,l=[],h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))l.push(r[h]),a=!0;else if(!a)l.push(r[h]);else break;r=r.slice(h);let f=l.join(`
41
+ `),m=f.replace(this.rules.other.blockquoteSetextReplace,`
42
42
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
43
- ${m}`:m,n=n?`${n}
44
- ${g}`:g;let E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,o,!0),this.lexer.state.top=E,r.length===0)break;let w=o.at(-1);if(w?.type==="code")break;if(w?.type==="blockquote"){let F=w,L=F.raw+`
43
+ ${f}`:f,n=n?`${n}
44
+ ${m}`:m;let w=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=w,r.length===0)break;let y=o.at(-1);if(y?.type==="code")break;if(y?.type==="blockquote"){let _=y,P=_.raw+`
45
45
  `+r.join(`
46
- `),M=this.blockquote(L);o[o.length-1]=M,s=s.substring(0,s.length-F.raw.length)+M.raw,n=n.substring(0,n.length-F.text.length)+M.text;break}else if(w?.type==="list"){let F=w,L=F.raw+`
46
+ `),O=this.blockquote(P);o[o.length-1]=O,s=s.substring(0,s.length-_.raw.length)+O.raw,n=n.substring(0,n.length-_.text.length)+O.text;break}else if(y?.type==="list"){let _=y,P=_.raw+`
47
47
  `+r.join(`
48
- `),M=this.list(L);o[o.length-1]=M,s=s.substring(0,s.length-w.raw.length)+M.raw,n=n.substring(0,n.length-F.raw.length)+M.raw,r=L.substring(o.at(-1).raw.length).split(`
49
- `);continue}}return{type:"blockquote",raw:s,tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),s=r.length>1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let h=!1,m="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;m=t[0],e=e.substring(m.length);let E=t[2].split(`
50
- `,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),w=e.split(`
51
- `,1)[0],F=!E.trim(),L=0;if(this.options.pedantic?(L=2,g=E.trimStart()):F?L=t[1].length+1:(L=t[2].search(this.rules.other.nonSpaceChar),L=L>4?1:L,g=E.slice(L),L+=t[1].length),F&&this.rules.other.blankLine.test(w)&&(m+=w+`
52
- `,e=e.substring(w.length+1),h=!0),!h){let A=this.rules.other.nextBulletRegex(L),R=this.rules.other.hrRegex(L),T=this.rules.other.fencesBeginRegex(L),x=this.rules.other.headingBeginRegex(L),P=this.rules.other.htmlBeginRegex(L);for(;e;){let I=e.split(`
53
- `,1)[0],B;if(w=I,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),B=w):B=w.replace(this.rules.other.tabCharGlobal," "),T.test(w)||x.test(w)||P.test(w)||A.test(w)||R.test(w))break;if(B.search(this.rules.other.nonSpaceChar)>=L||!w.trim())g+=`
54
- `+B.slice(L);else{if(F||E.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(E)||x.test(E)||R.test(E))break;g+=`
55
- `+w}!F&&!w.trim()&&(F=!0),m+=I+`
56
- `,e=e.substring(I.length+1),E=B.slice(L)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(a=!0));let M=null,D;this.options.gfm&&(M=this.rules.other.listIsTask.exec(g),M&&(D=M[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:m,task:!!M,checked:D,loose:!1,text:g,tokens:[]}),n.raw+=m}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let h=0;h<n.items.length;h++)if(this.lexer.state.top=!1,n.items[h].tokens=this.lexer.blockTokens(n.items[h].text,[]),!n.loose){let m=n.items[h].tokens.filter(E=>E.type==="space"),g=m.length>0&&m.some(E=>this.rules.other.anyLine.test(E.raw));n.loose=g}if(n.loose)for(let h=0;h<n.items.length;h++)n.items[h].loose=!0;return n}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:s,title:n}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=hp(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
57
- `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<r.length;a++)o.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:o.align[a]});for(let a of n)o.rows.push(hp(a,o.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[h]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
58
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=zs(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=hw(t[2],"()");if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let s=t[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],n=o[3])}else n=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),dp(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[s.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return dp(r,n,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let o=[...s[0]].length-1,a,l,h=o,m=0,g=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(s=g.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=[...a].length,s[3]||s[4]){h+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){m+=l;continue}if(h-=l,h>0)continue;l=Math.min(l,l+h+m);let E=[...s[0]][0].length,w=e.slice(0,o+s.index+E+l);if(Math.min(o,l)%2){let L=w.slice(1,-1);return{type:"em",raw:w,text:L,tokens:this.lexer.inlineTokens(L)}}let F=w.slice(2,-2);return{type:"strong",raw:w,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,s;return t[2]==="@"?(r=t[1],s="mailto:"+r):(r=t[1],s=r),{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},jt=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||cr,this.options.tokenizer=this.options.tokenizer||new Gr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:st,block:Ro.normal,inline:Us.normal};this.options.pedantic?(t.block=Ro.pedantic,t.inline=Us.pedantic):this.options.gfm&&(t.block=Ro.gfm,this.options.breaks?t.inline=Us.breaks:t.inline=Us.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ro,inline:Us}}static lex(e,t){return new i(t).lex(e)}static lexInline(e,t){return new i(t).inlineTokens(e)}lex(e){e=e.replace(st.carriageReturn,`
59
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(st.tabCharGlobal," ").replace(st.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
48
+ `),O=this.list(P);o[o.length-1]=O,s=s.substring(0,s.length-y.raw.length)+O.raw,n=n.substring(0,n.length-_.raw.length)+O.raw,r=P.substring(o.at(-1).raw.length).split(`
49
+ `);continue}}return{type:"blockquote",raw:s,tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),s=r.length>1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let h=!1,f="",m="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let w=t[2].split(`
50
+ `,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),y=e.split(`
51
+ `,1)[0],_=!w.trim(),P=0;if(this.options.pedantic?(P=2,m=w.trimStart()):_?P=t[1].length+1:(P=t[2].search(this.rules.other.nonSpaceChar),P=P>4?1:P,m=w.slice(P),P+=t[1].length),_&&this.rules.other.blankLine.test(y)&&(f+=y+`
52
+ `,e=e.substring(y.length+1),h=!0),!h){let C=this.rules.other.nextBulletRegex(P),F=this.rules.other.hrRegex(P),k=this.rules.other.fencesBeginRegex(P),S=this.rules.other.headingBeginRegex(P),A=this.rules.other.htmlBeginRegex(P);for(;e;){let L=e.split(`
53
+ `,1)[0],H;if(y=L,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),H=y):H=y.replace(this.rules.other.tabCharGlobal," "),k.test(y)||S.test(y)||A.test(y)||C.test(y)||F.test(y))break;if(H.search(this.rules.other.nonSpaceChar)>=P||!y.trim())m+=`
54
+ `+H.slice(P);else{if(_||w.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(w)||S.test(w)||F.test(w))break;m+=`
55
+ `+y}!_&&!y.trim()&&(_=!0),f+=L+`
56
+ `,e=e.substring(L.length+1),w=H.slice(P)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0));let O=null,R;this.options.gfm&&(O=this.rules.other.listIsTask.exec(m),O&&(R=O[0]!=="[ ] ",m=m.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:f,task:!!O,checked:R,loose:!1,text:m,tokens:[]}),n.raw+=f}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let h=0;h<n.items.length;h++)if(this.lexer.state.top=!1,n.items[h].tokens=this.lexer.blockTokens(n.items[h].text,[]),!n.loose){let f=n.items[h].tokens.filter(w=>w.type==="space"),m=f.length>0&&f.some(w=>this.rules.other.anyLine.test(w.raw));n.loose=m}if(n.loose)for(let h=0;h<n.items.length;h++)n.items[h].loose=!0;return n}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:s,title:n}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=Tp(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
57
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<r.length;a++)o.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:o.align[a]});for(let a of n)o.rows.push(Tp(a,o.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[h]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
58
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=qs(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=_w(t[2],"()");if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let s=t[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],n=o[3])}else n=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),xp(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[s.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return xp(r,n,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let o=[...s[0]].length-1,a,l,h=o,f=0,m=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(s=m.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=[...a].length,s[3]||s[4]){h+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){f+=l;continue}if(h-=l,h>0)continue;l=Math.min(l,l+h+f);let w=[...s[0]][0].length,y=e.slice(0,o+s.index+w+l);if(Math.min(o,l)%2){let P=y.slice(1,-1);return{type:"em",raw:y,text:P,tokens:this.lexer.inlineTokens(P)}}let _=y.slice(2,-2);return{type:"strong",raw:y,text:_,tokens:this.lexer.inlineTokens(_)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,s;return t[2]==="@"?(r=t[1],s="mailto:"+r):(r=t[1],s=r),{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},qt=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||fr,this.options.tokenizer=this.options.tokenizer||new Xr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ot,block:Io.normal,inline:js.normal};this.options.pedantic?(t.block=Io.pedantic,t.inline=js.pedantic):this.options.gfm&&(t.block=Io.gfm,this.options.breaks?t.inline=js.breaks:t.inline=js.gfm),this.tokenizer.rules=t}static get rules(){return{block:Io,inline:js}}static lex(e,t){return new i(t).lex(e)}static lexInline(e,t){return new i(t).inlineTokens(e)}lex(e){e=e.replace(ot.carriageReturn,`
59
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(ot.tabCharGlobal," ").replace(ot.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
60
60
  `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
61
61
  `+s.raw,o.text+=`
62
62
  `+s.text,this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
@@ -65,16 +65,16 @@ ${g}`:g;let E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
65
65
  `+s.raw,o.text+=`
66
66
  `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s),r=n.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=`
67
67
  `+s.raw,o.text+=`
68
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,o="";for(;e;){n||(o=""),n=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let h=t.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,r,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let h=1/0,m=e.slice(1),g;this.options.extensions.startInline.forEach(E=>{g=E.call({lexer:this},m),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),n=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}},Kr=class{options;parser;constructor(e){this.options=e||cr}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(st.notSpaceStart)?.[0],n=e.replace(st.endingNewline,"")+`
69
- `;return s?'<pre><code class="language-'+Zt(s)+'">'+(r?n:Zt(n,!0))+`</code></pre>
70
- `:"<pre><code>"+(r?n:Zt(n,!0))+`</code></pre>
68
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,o="";for(;e;){n||(o=""),n=!1;let a;if(this.options.extensions?.inline?.some(h=>(a=h.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let h=t.at(-1);a.type==="text"&&h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,r,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let h=1/0,f=e.slice(1),m;this.options.extensions.startInline.forEach(w=>{m=w.call({lexer:this},f),typeof m=="number"&&m>=0&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),n=!0;let h=t.at(-1);h?.type==="text"?(h.raw+=a.raw,h.text+=a.text):t.push(a);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}},Zr=class{options;parser;constructor(e){this.options=e||fr}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(ot.notSpaceStart)?.[0],n=e.replace(ot.endingNewline,"")+`
69
+ `;return s?'<pre><code class="language-'+Jt(s)+'">'+(r?n:Jt(n,!0))+`</code></pre>
70
+ `:"<pre><code>"+(r?n:Jt(n,!0))+`</code></pre>
71
71
  `}blockquote({tokens:e}){return`<blockquote>
72
72
  ${this.parser.parse(e)}</blockquote>
73
73
  `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
74
74
  `}hr(e){return`<hr>
75
75
  `}list(e){let t=e.ordered,r=e.start,s="";for(let a=0;a<e.items.length;a++){let l=e.items[a];s+=this.listitem(l)}let n=t?"ol":"ul",o=t&&r!==1?' start="'+r+'"':"";return"<"+n+o+`>
76
76
  `+s+"</"+n+`>
77
- `}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+Zt(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
77
+ `}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+Jt(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
78
78
  `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
79
79
  `}table(e){let t="",r="";for(let n=0;n<e.header.length;n++)r+=this.tablecell(e.header[n]);t+=this.tablerow({text:r});let s="";for(let n=0;n<e.rows.length;n++){let o=e.rows[n];r="";for(let a=0;a<o.length;a++)r+=this.tablecell(o[a]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
80
80
  <thead>
@@ -83,26 +83,26 @@ ${this.parser.parse(e)}</blockquote>
83
83
  `}tablerow({text:e}){return`<tr>
84
84
  ${e}</tr>
85
85
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
86
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Zt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=up(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+Zt(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=up(e);if(s===null)return Zt(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${Zt(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Zt(e.text)}},js=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},qt=class i{options;renderer;textRenderer;constructor(e){this.options=e||cr,this.options.renderer=this.options.renderer||new Kr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new js}static parse(e,t){return new i(t).parse(e)}static parseInline(e,t){return new i(t).parseInline(e)}parse(e,t=!0){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=n;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
87
- `+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Wr=class{options;block;constructor(e){this.options=e||cr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?jt.lex:jt.lexInline}provideParser(){return this.block?qt.parse:qt.parseInline}},jc=class{defaults=qc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=qt;Renderer=Kr;TextRenderer=js;Lexer=jt;Tokenizer=Gr;Hooks=Wr;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of n.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,t));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let a=n[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),r.renderer){let n=this.defaults.renderer||new Kr(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],h=n[a];n[a]=(...m)=>{let g=l.apply(n,m);return g===!1&&(g=h.apply(n,m)),g||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Gr(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],h=n[a];n[a]=(...m)=>{let g=l.apply(n,m);return g===!1&&(g=h.apply(n,m)),g}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Wr;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],h=n[a];Wr.passThroughHooks.has(o)?n[a]=m=>{if(this.defaults.async)return Promise.resolve(l.call(n,m)).then(E=>h.call(n,E));let g=l.call(n,m);return h.call(n,g)}:n[a]=(...m)=>{let g=l.apply(n,m);return g===!1&&(g=h.apply(n,m)),g}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return jt.lex(e,t??this.defaults)}parser(e,t){return qt.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{let n={...s},o={...this.defaults,...n},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?jt.lex:jt.lexInline,h=o.hooks?o.hooks.provideParser():e?qt.parse:qt.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(m=>l(m,o)).then(m=>o.hooks?o.hooks.processAllTokens(m):m).then(m=>o.walkTokens?Promise.all(this.walkTokens(m,o.walkTokens)).then(()=>m):m).then(m=>h(m,o)).then(m=>o.hooks?o.hooks.postprocess(m):m).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let m=l(r,o);o.hooks&&(m=o.hooks.processAllTokens(m)),o.walkTokens&&this.walkTokens(m,o.walkTokens);let g=h(m,o);return o.hooks&&(g=o.hooks.postprocess(g)),g}catch(m){return a(m)}}}onError(e,t){return r=>{if(r.message+=`
88
- Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Zt(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},lr=new jc;function se(i,e){return lr.parse(i,e)}se.options=se.setOptions=function(i){return lr.setOptions(i),se.defaults=lr.defaults,pp(se.defaults),se};se.getDefaults=qc;se.defaults=cr;se.use=function(...i){return lr.use(...i),se.defaults=lr.defaults,pp(se.defaults),se};se.walkTokens=function(i,e){return lr.walkTokens(i,e)};se.parseInline=lr.parseInline;se.Parser=qt;se.parser=qt.parse;se.Renderer=Kr;se.TextRenderer=js;se.Lexer=jt;se.lexer=jt.lex;se.Tokenizer=Gr;se.Hooks=Wr;se.parse=se;var FC=se.options,OC=se.setOptions,LC=se.use,RC=se.walkTokens,MC=se.parseInline;var IC=qt.parse,DC=jt.lex;var No=class extends H{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Vr.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=se(t);return Vr.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var Bo=class extends H{static values={typeaheadUrl:String,typeaheadDebounceMs:{type:Number,default:200}};connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#r(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let r=this.element.parentNode;getComputedStyle(r).position==="static"&&(r.style.position="relative",this.modifiedSelectWrapper=r),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}let t={};this.hasTypeaheadUrlValue&&this.typeaheadUrlValue&&(t.search=(r,s)=>this.#t(r,s)),this.slimSelect=new SlimSelect({select:this.element,settings:i,events:t}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#n()}#t(i,e){return this._typeaheadDebounce&&clearTimeout(this._typeaheadDebounce),this._typeaheadAbort&&this._typeaheadAbort.abort(),new Promise(t=>{this._typeaheadDebounce=setTimeout(()=>{this._typeaheadAbort=new AbortController,this.#i(i,this._typeaheadAbort.signal).then(t)},this.typeaheadDebounceMsValue)})}async#i(i,e){let t=new URL(this.typeaheadUrlValue,window.location.origin);t.searchParams.set("q",i||"");try{let r=await fetch(t.toString(),{headers:{Accept:"application/json"},signal:e});if(!r.ok)return"Search failed";let s=await r.json();return(Array.isArray(s.results)?s.results:[]).map(o=>({value:String(o.value??""),text:String(o.label??"")}))}catch(r){return r.name==="AbortError"?[]:(console.warn("[slim-select] typeahead error",r),"Search failed")}}#r(){this.element.isConnected&&(this.#n(),this.#e())}#n(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var Uo=class extends H{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),this.modal&&(i.appendTo=this.modal,i.position=e=>{let r=(e.altInput||e.input).getBoundingClientRect(),s=this.modal.getBoundingClientRect(),n=e.calendarContainer,o=n.offsetHeight,l=window.innerHeight-r.bottom<o&&r.top>o,h=l?r.top-s.top-o-2:r.bottom-s.top+2;n.style.top=`${h}px`,n.style.left=`${r.left-s.left}px`,n.style.right="auto",n.classList.toggle("arrowTop",!l),n.classList.toggle("arrowBottom",l)}),i}};var zo=class extends H{static targets=["input"];static values={options:Object};connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js",...this.optionsValue}}};var Ho=class extends H{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var jo=class extends H{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[];let e=this.#t()||this.defaultTabValue||this.btnTargets[0]?.id;this.#e(e,{skipFocus:!0,skipHashUpdate:!0}),this._syncFromHash=this._syncFromHash.bind(this),window.addEventListener("hashchange",this._syncFromHash),document.addEventListener("turbo:load",this._syncFromHash)}disconnect(){this._syncFromHash&&(window.removeEventListener("hashchange",this._syncFromHash),document.removeEventListener("turbo:load",this._syncFromHash))}_syncFromHash(){let i=this.#t();i&&this.#e(i,{skipFocus:!0,skipHashUpdate:!0})}select(i){this.#e(i.currentTarget.id)}#e(i,e={}){let t=this.btnTargets.find(s=>s.id===i);if(!t){console.error(`Tab Button with id "${i}" not found`);return}let r=this.tabTargets.find(s=>s.id===t.dataset.target);if(!r){console.error(`Tab Panel with id "${t.dataset.target}" not found`);return}this.tabTargets.forEach(s=>{s.hidden=!0,s.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(s=>{s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","-1"),s.classList.remove(...this.activeClasses),s.classList.add(...this.inActiveClasses)}),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),t.classList.remove(...this.inActiveClasses),t.classList.add(...this.activeClasses),r.hidden=!1,r.setAttribute("aria-hidden","false"),e.skipHashUpdate||this.#i(i),!e.skipFocus&&t!==document.activeElement&&t.focus()}#t(){let i=window.location.hash.replace(/^#/,"");if(!i)return null;let e=`${i}-tab`;return this.btnTargets.some(r=>r.id===e)?e:null}#i(i){let t=`#${i.replace(/-tab$/,"")}`;window.location.hash!==t&&history.replaceState(null,"",t)}};function pw(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o<a.length-1&&r.push(t)})),r}function xp(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=pw(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var fw=i=>{throw new Error(`missing string: ${i}`)},ur=class{locale;constructor(e,{onMissingKey:t=fw}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return xp(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return xp(r,t)}};var Ri=class{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new ur([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function Zc(i){return i<10?`0${i}`:i.toString()}function Yr(){let i=new Date,e=Zc(i.getHours()),t=Zc(i.getMinutes()),r=Zc(i.getSeconds());return`${e}:${t}:${r}`}var kp={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Yr()}]`,...i)},_p={debug:(...i)=>console.debug(`[Uppy] [${Yr()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Yr()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Yr()}]`,...i)};function $s(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function mw(i,e=document){return typeof i=="string"?e.querySelector(i):$s(i)?i:null}var Cp=mw;function gw(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}var qo=gw;var Gs,G,Lp,bw,hr,Ap,Rp,Mp,Ip,tu,Qc,Jc,yw,Ws={},Dp=[],vw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ks=Array.isArray;function Qt(i,e){for(var t in e)i[t]=e[t];return i}function iu(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function fi(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Gs.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return Vs(i,o,r,s,null)}function Vs(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Lp,__i:-1,__u:0};return s==null&&G.vnode!=null&&G.vnode(n),n}function Wo(){return{current:null}}function Te(i){return i.children}function ve(i,e){this.props=i,this.context=e}function Xr(i,e){if(e==null)return i.__?Xr(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Xr(i):null}function Np(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return Np(i)}}function Pp(i){(!i.__d&&(i.__d=!0)&&hr.push(i)&&!Vo.__r++||Ap!=G.debounceRendering)&&((Ap=G.debounceRendering)||Rp)(Vo)}function Vo(){for(var i,e,t,r,s,n,o,a=1;hr.length;)hr.length>a&&hr.sort(Mp),i=hr.shift(),a=hr.length,i.__d&&(t=void 0,r=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=Qt({},r)).__v=r.__v+1,G.vnode&&G.vnode(t),ru(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Xr(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,zp(n,t,o),r.__e=r.__=null,t.__e!=s&&Np(t)));Vo.__r=0}function Bp(i,e,t,r,s,n,o,a,l,h,m){var g,E,w,F,L,M,D,A=r&&r.__k||Dp,R=e.length;for(l=ww(t,e,A,l,R),g=0;g<R;g++)(w=t.__k[g])!=null&&(E=w.__i==-1?Ws:A[w.__i]||Ws,w.__i=g,M=ru(i,w,E,s,n,o,a,l,h,m),F=w.__e,w.ref&&E.ref!=w.ref&&(E.ref&&su(E.ref,null,w),m.push(w.ref,w.__c||F,w)),L==null&&F!=null&&(L=F),(D=!!(4&w.__u))||E.__k===w.__k?l=Up(w,l,i,D):typeof w.type=="function"&&M!==void 0?l=M:F&&(l=F.nextSibling),w.__u&=-7);return t.__e=L,l}function ww(i,e,t,r,s){var n,o,a,l,h,m=t.length,g=m,E=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[n]=Vs(null,o,null,null,null):Ks(o)?o=i.__k[n]=Vs(Te,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[n]=Vs(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[n]=o,l=n+E,o.__=i,o.__b=i.__b+1,a=null,(h=o.__i=Sw(o,t,l,g))!=-1&&(g--,(a=t[h])&&(a.__u|=2)),a==null||a.__v==null?(h==-1&&(s>m?E--:s<m&&E++),typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?E--:h==l+1?E++:(h>l?E--:E++,o.__u|=4))):i.__k[n]=null;if(g)for(n=0;n<m;n++)(a=t[n])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=Xr(a)),jp(a,a));return r}function Up(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=Up(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=Xr(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function pt(i,e){return e=e||[],i==null||typeof i=="boolean"||(Ks(i)?i.some(function(t){pt(t,e)}):e.push(i)),e}function Sw(i,e,t,r){var s,n,o,a=i.key,l=i.type,h=e[t],m=h!=null&&(2&h.__u)==0;if(h===null&&a==null||m&&a==h.key&&l==h.type)return t;if(r>(m?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((h=e[o=s>=0?s--:n++])!=null&&(2&h.__u)==0&&a==h.key&&l==h.type)return o}return-1}function Fp(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||vw.test(e)?t:t+"px"}function $o(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||Fp(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||Fp(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Ip,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=tu,i.addEventListener(e,n?Jc:Qc,n)):i.removeEventListener(e,n?Jc:Qc,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Op(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=tu++;else if(e.t<t.u)return;return t(G.event?G.event(e):e)}}}function ru(i,e,t,r,s,n,o,a,l,h){var m,g,E,w,F,L,M,D,A,R,T,x,P,I,B,U,j,q=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(m=G.__b)&&m(e);e:if(typeof q=="function")try{if(D=e.props,A="prototype"in q&&q.prototype.render,R=(m=q.contextType)&&r[m.__c],T=m?R?R.props.value:m.__:r,t.__c?M=(g=e.__c=t.__c).__=g.__E:(A?e.__c=g=new q(D,T):(e.__c=g=new ve(D,T),g.constructor=q,g.render=Tw),R&&R.sub(g),g.state||(g.state={}),g.__n=r,E=g.__d=!0,g.__h=[],g._sb=[]),A&&g.__s==null&&(g.__s=g.state),A&&q.getDerivedStateFromProps!=null&&(g.__s==g.state&&(g.__s=Qt({},g.__s)),Qt(g.__s,q.getDerivedStateFromProps(D,g.__s))),w=g.props,F=g.state,g.__v=e,E)A&&q.getDerivedStateFromProps==null&&g.componentWillMount!=null&&g.componentWillMount(),A&&g.componentDidMount!=null&&g.__h.push(g.componentDidMount);else{if(A&&q.getDerivedStateFromProps==null&&D!==w&&g.componentWillReceiveProps!=null&&g.componentWillReceiveProps(D,T),e.__v==t.__v||!g.__e&&g.shouldComponentUpdate!=null&&g.shouldComponentUpdate(D,g.__s,T)===!1){for(e.__v!=t.__v&&(g.props=D,g.state=g.__s,g.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(W){W&&(W.__=e)}),x=0;x<g._sb.length;x++)g.__h.push(g._sb[x]);g._sb=[],g.__h.length&&o.push(g);break e}g.componentWillUpdate!=null&&g.componentWillUpdate(D,g.__s,T),A&&g.componentDidUpdate!=null&&g.__h.push(function(){g.componentDidUpdate(w,F,L)})}if(g.context=T,g.props=D,g.__P=i,g.__e=!1,P=G.__r,I=0,A){for(g.state=g.__s,g.__d=!1,P&&P(e),m=g.render(g.props,g.state,g.context),B=0;B<g._sb.length;B++)g.__h.push(g._sb[B]);g._sb=[]}else do g.__d=!1,P&&P(e),m=g.render(g.props,g.state,g.context),g.state=g.__s;while(g.__d&&++I<25);g.state=g.__s,g.getChildContext!=null&&(r=Qt(Qt({},r),g.getChildContext())),A&&!E&&g.getSnapshotBeforeUpdate!=null&&(L=g.getSnapshotBeforeUpdate(w,F)),U=m,m!=null&&m.type===Te&&m.key==null&&(U=Hp(m.props.children)),a=Bp(i,Ks(U)?U:[U],e,t,r,s,n,o,a,l,h),g.base=e.__e,e.__u&=-161,g.__h.length&&o.push(g),M&&(g.__E=g.__=null)}catch(W){if(e.__v=null,l||n!=null)if(W.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else{for(j=n.length;j--;)iu(n[j]);eu(e)}else e.__e=t.__e,e.__k=t.__k,W.then||eu(e);G.__e(W,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=Ew(t.__e,e,t,r,s,n,o,l,h);return(m=G.diffed)&&m(e),128&e.__u?void 0:a}function eu(i){i&&i.__c&&(i.__c.__e=!0),i&&i.__k&&i.__k.forEach(eu)}function zp(i,e,t){for(var r=0;r<t.length;r++)su(t[r],t[++r],t[++r]);G.__c&&G.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){G.__e(n,s.__v)}})}function Hp(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Ks(i)?i.map(Hp):Qt({},i)}function Ew(i,e,t,r,s,n,o,a,l){var h,m,g,E,w,F,L,M=t.props||Ws,D=e.props,A=e.type;if(A=="svg"?s="http://www.w3.org/2000/svg":A=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(h=0;h<n.length;h++)if((w=n[h])&&"setAttribute"in w==!!A&&(A?w.localName==A:w.nodeType==3)){i=w,n[h]=null;break}}if(i==null){if(A==null)return document.createTextNode(D);i=document.createElementNS(s,A,D.is&&D),a&&(G.__m&&G.__m(e,n),a=!1),n=null}if(A==null)M===D||a&&i.data==D||(i.data=D);else{if(n=n&&Gs.call(i.childNodes),!a&&n!=null)for(M={},h=0;h<i.attributes.length;h++)M[(w=i.attributes[h]).name]=w.value;for(h in M)if(w=M[h],h!="children"){if(h=="dangerouslySetInnerHTML")g=w;else if(!(h in D)){if(h=="value"&&"defaultValue"in D||h=="checked"&&"defaultChecked"in D)continue;$o(i,h,null,w,s)}}for(h in D)w=D[h],h=="children"?E=w:h=="dangerouslySetInnerHTML"?m=w:h=="value"?F=w:h=="checked"?L=w:a&&typeof w!="function"||M[h]===w||$o(i,h,w,M[h],s);if(m)a||g&&(m.__html==g.__html||m.__html==i.innerHTML)||(i.innerHTML=m.__html),e.__k=[];else if(g&&(i.innerHTML=""),Bp(e.type=="template"?i.content:i,Ks(E)?E:[E],e,t,r,A=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&Xr(t,0),a,l),n!=null)for(h=n.length;h--;)iu(n[h]);a||(h="value",A=="progress"&&F==null?i.removeAttribute("value"):F!=null&&(F!==i[h]||A=="progress"&&!F||A=="option"&&F!=M[h])&&$o(i,h,F,M[h],s),h="checked",L!=null&&L!=i[h]&&$o(i,h,L,M[h],s))}return i}function su(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){G.__e(s,t)}}function jp(i,e,t){var r,s;if(G.unmount&&G.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||su(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){G.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&jp(r[s],e,t||typeof i.type!="function");t||iu(i.__e),i.__c=i.__=i.__e=void 0}function Tw(i,e,t){return this.constructor(i,t)}function qp(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),G.__&&G.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],ru(e,i=(!r&&t||e).__k=fi(Te,null,[i]),s||Ws,Ws,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Gs.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),zp(n,i,o)}function Ys(i,e,t){var r,s,n,o,a=Qt({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Gs.call(arguments,2):t),Vs(i.type,a,r||i.key,s||i.ref,null)}Gs=Dp.slice,G={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},Lp=0,bw=function(i){return i!=null&&i.constructor===void 0},ve.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Qt({},this.state),typeof i=="function"&&(i=i(Qt({},t),this.props)),i&&Qt(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Pp(this))},ve.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Pp(this))},ve.prototype.render=Te,hr=[],Rp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mp=function(i,e){return i.__v.__b-e.__v.__b},Vo.__r=0,Ip=/(PointerCapture)$|Capture$/i,tu=0,Qc=Op(!1),Jc=Op(!0),yw=0;var Xs,_e,nu,$p,Zs=0,Qp=[],Le=G,Vp=Le.__b,Wp=Le.__r,Gp=Le.diffed,Kp=Le.__c,Yp=Le.unmount,Xp=Le.__;function au(i,e){Le.__h&&Le.__h(_e,i,Zs||e),Zs=0;var t=_e.__H||(_e.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Ft(i){return Zs=1,Jp(tf,i)}function Jp(i,e,t){var r=au(Xs++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):tf(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],h=r.t(l,a);l!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=_e,!_e.__f)){var s=function(a,l,h){if(!r.__c.__H)return!0;var m=r.__c.__H.__.filter(function(E){return!!E.__c});if(m.every(function(E){return!E.__N}))return!n||n.call(this,a,l,h);var g=r.__c.props!==a;return m.forEach(function(E){if(E.__N){var w=E.__[0];E.__=E.__N,E.__N=void 0,w!==E.__[0]&&(g=!0)}}),n&&n.call(this,a,l,h)||g};_e.__f=!0;var n=_e.shouldComponentUpdate,o=_e.componentWillUpdate;_e.componentWillUpdate=function(a,l,h){if(this.__e){var m=n;n=void 0,s(a,l,h),n=m}o&&o.call(this,a,l,h)},_e.shouldComponentUpdate=s}return r.__N||r.__}function $t(i,e){var t=au(Xs++,3);!Le.__s&&ef(t.__H,e)&&(t.__=i,t.u=e,_e.__H.__h.push(t))}function Mi(i){return Zs=5,Ii(function(){return{current:i}},[])}function Ii(i,e){var t=au(Xs++,7);return ef(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Di(i,e){return Zs=8,Ii(function(){return i},e)}function xw(){for(var i;i=Qp.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Go),i.__H.__h.forEach(ou),i.__H.__h=[]}catch(e){i.__H.__h=[],Le.__e(e,i.__v)}}Le.__b=function(i){_e=null,Vp&&Vp(i)},Le.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Xp&&Xp(i,e)},Le.__r=function(i){Wp&&Wp(i),Xs=0;var e=(_e=i.__c).__H;e&&(nu===_e?(e.__h=[],_e.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Go),e.__h.forEach(ou),e.__h=[],Xs=0)),nu=_e},Le.diffed=function(i){Gp&&Gp(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Qp.push(e)!==1&&$p===Le.requestAnimationFrame||(($p=Le.requestAnimationFrame)||kw)(xw)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),nu=_e=null},Le.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Go),t.__h=t.__h.filter(function(r){return!r.__||ou(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Le.__e(r,t.__v)}}),Kp&&Kp(i,e)},Le.unmount=function(i){Yp&&Yp(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{Go(r)}catch(s){e=s}}),t.__H=void 0,e&&Le.__e(e,t.__v))};var Zp=typeof requestAnimationFrame=="function";function kw(i){var e,t=function(){clearTimeout(r),Zp&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);Zp&&(e=requestAnimationFrame(t))}function Go(i){var e=_e,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),_e=e}function ou(i){var e=_e;i.__c=i.__(),_e=e}function ef(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function tf(i,e){return typeof e=="function"?e(i):e}function Cw(i,e){for(var t in e)i[t]=e[t];return i}function rf(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function sf(i,e){this.props=i,this.context=e}(sf.prototype=new ve).isPureReactComponent=!0,sf.prototype.shouldComponentUpdate=function(i,e){return rf(this.props,i)||rf(this.state,e)};var nf=G.__b;G.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),nf&&nf(i)};var kA=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Aw=G.__e;G.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}Aw(i,e,t,r)};var of=G.unmount;function df(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=Cw({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return df(r,e,t)})),i}function pf(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return pf(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function lu(){this.__u=0,this.o=null,this.__b=null}function ff(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Ko(){this.i=null,this.l=null}G.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),of&&of(i)},(lu.prototype=new ve).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=ff(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=pf(l,l.__c.__P,l.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},lu.prototype.componentWillUnmount=function(){this.o=[]},lu.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=df(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&fi(Te,null,i.fallback);return s&&(s.__u&=-33),[fi(Te,null,e.__a?null:i.children),s]};var af=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Ko.prototype=new ve).__a=function(i){var e=this,t=ff(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),af(e,i,r)):s()};t?t(n):n()}},Ko.prototype.render=function(i){this.i=null,this.l=new Map;var e=pt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Ko.prototype.componentDidUpdate=Ko.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){af(i,t,e)})};var Pw=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Fw=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ow=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Lw=/[A-Z0-9]/g,Rw=typeof document<"u",Mw=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function cu(i,e,t){return e.__k==null&&(e.textContent=""),qp(i,e),typeof t=="function"&&t(),i?i.__c:null}ve.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(ve.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var lf=G.event;function Iw(){}function Dw(){return this.cancelBubble}function Nw(){return this.defaultPrevented}G.event=function(i){return lf&&(i=lf(i)),i.persist=Iw,i.isPropagationStopped=Dw,i.isDefaultPrevented=Nw,i.nativeEvent=i};var mf,Bw={enumerable:!1,configurable:!0,get:function(){return this.class}},cf=G.vnode;G.vnode=function(i){typeof i.type=="string"&&(function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Rw&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||Mw(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Ow.test(o)&&(o=l):l=o="oninput":n&&Fw.test(o)?o=o.replace(Lw,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=pt(t.children).forEach(function(h){h.props.selected=s.value.indexOf(h.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=pt(t.children).forEach(function(h){h.props.selected=s.multiple?s.defaultValue.indexOf(h.props.value)!=-1:s.defaultValue==h.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Bw)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=Pw,cf&&cf(i)};var uf=G.__r;G.__r=function(i){uf&&uf(i),mf=i.__c};var hf=G.diffed;G.diffed=function(i){hf&&hf(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),mf=null};function Uw(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}var uu=class i extends Ri{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=Cp(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),this.#e=Uw(l=>{this.uppy.getPlugin(this.id)&&(cu(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),cu(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||qo(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},Vt=uu;var gf={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"]};var hu=class{static VERSION=gf.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},bf=hu;function dr(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var du={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Qs(i){if(i.type)return i.type;let e=i.name?dr(i.name).extension?.toLowerCase():null;return e&&e in du?du[e]:"application/octet-stream"}function Hw(i){return i.charCodeAt(0).toString(32)}function yf(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Hw(t)}`,"/"))+e}function vf(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${yf(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${yf(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function jw(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Yo(i,e){if(jw(i))return i.id;let t=Qs(i);return vf({...i,type:t},e)}var hm=be(Qf(),1),dm=be(em(),1);var I1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ni=(i=21)=>{let e="",t=i|0;for(;t--;)e+=I1[Math.random()*64|0];return e};var tm={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^4.3.2","@uppy/utils":"^6.2.2",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function bu(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}var im={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var en=be(Zo(),1),cm=be(lm(),1),um={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},ft=class extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},Qo=class{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new ft(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>o+(a.size??0),0);if(n>r)throw new ft(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,en.default)(r),size:(0,en.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(o=>o.includes("/")?e.type?(0,cm.default)(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){let o=s.join(", ");throw new ft(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new ft(this.getI18n()("exceedsSize",{size:(0,en.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new ft(this.getI18n()("inferiorSize",{size:(0,en.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new ft(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new ft(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function yu(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}var Jo={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},vu=class i{static VERSION=tm.version;#e=Object.create(null);#t;#i;#r=(0,dm.default)();#n=new Set;#o=new Set;#s=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=im;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:um,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new bf,logger:kp,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=_p),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Jo,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:yu(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new Qo(()=>this.opts,()=>this.i18n),this.#i=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new ur([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Jo})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Jo,files:{}})}addPreProcessor(e){this.#n.add(e)}removePreProcessor(e){return this.#n.delete(e)}addPostProcessor(e){this.#s.add(e)}removePostProcessor(e){return this.#s.delete(e)}addUploader(e){this.#o.add(e)}removeUploader(e){return this.#o.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],h=[],m=[],g=[],E=[],w=[];for(let F of s){let{progress:L}=F;!L.uploadComplete&&L.uploadStarted&&(n.push(F),F.isPaused||E.push(F)),L.uploadStarted||o.push(F),(L.uploadStarted||L.preprocess||L.postprocess)&&a.push(F),L.uploadStarted&&l.push(F),F.isPaused&&h.push(F),L.uploadComplete&&m.push(F),F.error&&g.push(F),(L.preprocess||L.postprocess)&&w.push(F)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:h,completeFiles:m,erroredFiles:g,inProgressFiles:n,inProgressNotPausedFiles:E,processingFiles:w,isUploadStarted:l.length>0,isAllComplete:t===100&&m.length===s.length&&w.length===0,isAllErrored:!!r&&g.length===s.length,isAllPaused:n.length!==0&&h.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(F=>F.isGhost)}}#l(e){for(let o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");let t=e.filter(o=>o.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#a(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#f(e){let t=!0;for(let r of Object.values(e))this.#a(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new ft(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#l([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#d(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=Qs(t),s=bu(r,t),n=dr(s).extension,o=Yo(t,this.getID()),a=t.meta||{};a.name=s,a.type=r;let l=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:o,name:s,extension:n||"",meta:{...this.getState().meta,...a},type:r,data:t.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote,preview:t.preview}}#u(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#p(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let o of e)try{let a=this.#d(o),l=t[a.id]?.isGhost;l&&(a={...t[a.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`));let h=this.opts.onBeforeFileAdded(a,r);if(t=this.getState().files,r={...t,...r},!h&&this.checkIfFileAlreadyExists(a.id))throw new ft(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:o});if(h===!1&&!l)throw new ft("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof h=="object"&&h!==null&&(a=h),this.#t.validateSingleFile(a),r[a.id]=a,s.push(a)}catch(a){n.push(a)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(o){return n.push(o),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){this.#c(e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p([e]),n=s.filter(a=>a.isRestriction);if(this.#l(n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),this.#u(),o.id}addFiles(e){this.#c();let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p(e),n=s.filter(a=>a.isRestriction);this.#l(n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
86
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Jt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=Ep(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+Jt(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=Ep(e);if(s===null)return Jt(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${Jt(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Jt(e.text)}},Vs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},$t=class i{options;renderer;textRenderer;constructor(e){this.options=e||fr,this.options.renderer=this.options.renderer||new Zr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vs}static parse(e,t){return new i(t).parse(e)}static parseInline(e,t){return new i(t).parseInline(e)}parse(e,t=!0){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=n;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
87
+ `+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Yr=class{options;block;constructor(e){this.options=e||fr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?qt.lex:qt.lexInline}provideParser(){return this.block?$t.parse:$t.parseInline}},Zc=class{defaults=Qc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$t;Renderer=Zr;TextRenderer=Vs;Lexer=qt;Tokenizer=Xr;Hooks=Yr;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of n.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,t));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{let a=n[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),r.renderer){let n=this.defaults.renderer||new Zr(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],h=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new Xr(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],h=n[a];n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Yr;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],h=n[a];Yr.passThroughHooks.has(o)?n[a]=f=>{if(this.defaults.async)return Promise.resolve(l.call(n,f)).then(w=>h.call(n,w));let m=l.call(n,f);return h.call(n,m)}:n[a]=(...f)=>{let m=l.apply(n,f);return m===!1&&(m=h.apply(n,f)),m}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qt.lex(e,t??this.defaults)}parser(e,t){return $t.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{let n={...s},o={...this.defaults,...n},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?qt.lex:qt.lexInline,h=o.hooks?o.hooks.provideParser():e?$t.parse:$t.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(f=>l(f,o)).then(f=>o.hooks?o.hooks.processAllTokens(f):f).then(f=>o.walkTokens?Promise.all(this.walkTokens(f,o.walkTokens)).then(()=>f):f).then(f=>h(f,o)).then(f=>o.hooks?o.hooks.postprocess(f):f).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let f=l(r,o);o.hooks&&(f=o.hooks.processAllTokens(f)),o.walkTokens&&this.walkTokens(f,o.walkTokens);let m=h(f,o);return o.hooks&&(m=o.hooks.postprocess(m)),m}catch(f){return a(f)}}}onError(e,t){return r=>{if(r.message+=`
88
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Jt(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},pr=new Zc;function ce(i,e){return pr.parse(i,e)}ce.options=ce.setOptions=function(i){return pr.setOptions(i),ce.defaults=pr.defaults,kp(ce.defaults),ce};ce.getDefaults=Qc;ce.defaults=fr;ce.use=function(...i){return pr.use(...i),ce.defaults=pr.defaults,kp(ce.defaults),ce};ce.walkTokens=function(i,e){return pr.walkTokens(i,e)};ce.parseInline=pr.parseInline;ce.Parser=$t;ce.parser=$t.parse;ce.Renderer=Zr;ce.TextRenderer=Vs;ce.Lexer=qt;ce.lexer=qt.lex;ce.Tokenizer=Xr;ce.Hooks=Yr;ce.parse=ce;var WC=ce.options,GC=ce.setOptions,KC=ce.use,YC=ce.walkTokens,XC=ce.parseInline;var ZC=$t.parse,QC=qt.lex;var zo=class extends W{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Kr.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=ce(t);return Kr.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var Ho=class extends W{static values={typeaheadUrl:String,typeaheadDebounceMs:{type:Number,default:200}};connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#r(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let r=this.element.parentNode;getComputedStyle(r).position==="static"&&(r.style.position="relative",this.modifiedSelectWrapper=r),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}let t={};this.hasTypeaheadUrlValue&&this.typeaheadUrlValue&&(t.search=(r,s)=>this.#t(r,s)),this.slimSelect=new SlimSelect({select:this.element,settings:i,events:t}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#s()}#t(i,e){return this._typeaheadDebounce&&clearTimeout(this._typeaheadDebounce),this._typeaheadAbort&&this._typeaheadAbort.abort(),new Promise(t=>{this._typeaheadDebounce=setTimeout(()=>{this._typeaheadAbort=new AbortController,this.#i(i,this._typeaheadAbort.signal).then(t)},this.typeaheadDebounceMsValue)})}async#i(i,e){let t=new URL(this.typeaheadUrlValue,window.location.origin);t.searchParams.set("q",i||"");try{let r=await fetch(t.toString(),{headers:{Accept:"application/json"},signal:e});if(!r.ok)return"Search failed";let s=await r.json();return(Array.isArray(s.results)?s.results:[]).map(o=>({value:String(o.value??""),text:String(o.label??"")}))}catch(r){return r.name==="AbortError"?[]:(console.warn("[slim-select] typeahead error",r),"Search failed")}}#r(){this.element.isConnected&&(this.#s(),this.#e())}#s(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var jo=class extends W{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),this.modal&&(i.appendTo=this.modal,i.position=e=>{let r=(e.altInput||e.input).getBoundingClientRect(),s=this.modal.getBoundingClientRect(),n=e.calendarContainer,o=n.offsetHeight,l=window.innerHeight-r.bottom<o&&r.top>o,h=l?r.top-s.top-o-2:r.bottom-s.top+2;n.style.top=`${h}px`,n.style.left=`${r.left-s.left}px`,n.style.right="auto",n.classList.toggle("arrowTop",!l),n.classList.toggle("arrowBottom",l)}),i}};var qo=class extends W{static targets=["input"];static values={options:Object};connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js",...this.optionsValue}}};var $o=class extends W{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var Vo=class extends W{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[];let e=this.#t()||this.defaultTabValue||this.btnTargets[0]?.id;this.#e(e,{skipFocus:!0,skipHashUpdate:!0}),this._syncFromHash=this._syncFromHash.bind(this),window.addEventListener("hashchange",this._syncFromHash),document.addEventListener("turbo:load",this._syncFromHash)}disconnect(){this._syncFromHash&&(window.removeEventListener("hashchange",this._syncFromHash),document.removeEventListener("turbo:load",this._syncFromHash))}_syncFromHash(){let i=this.#t();i&&this.#e(i,{skipFocus:!0,skipHashUpdate:!0})}select(i){this.#e(i.currentTarget.id)}#e(i,e={}){let t=this.btnTargets.find(s=>s.id===i);if(!t){console.error(`Tab Button with id "${i}" not found`);return}let r=this.tabTargets.find(s=>s.id===t.dataset.target);if(!r){console.error(`Tab Panel with id "${t.dataset.target}" not found`);return}this.tabTargets.forEach(s=>{s.hidden=!0,s.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(s=>{s.setAttribute("aria-selected","false"),s.setAttribute("tabindex","-1"),s.classList.remove(...this.activeClasses),s.classList.add(...this.inActiveClasses)}),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),t.classList.remove(...this.inActiveClasses),t.classList.add(...this.activeClasses),r.hidden=!1,r.setAttribute("aria-hidden","false"),e.skipHashUpdate||this.#i(i),!e.skipFocus&&t!==document.activeElement&&t.focus()}#t(){let i=window.location.hash.replace(/^#/,"");if(!i)return null;let e=`${i}-tab`;return this.btnTargets.some(r=>r.id===e)?e:null}#i(i){let t=`#${i.replace(/-tab$/,"")}`;window.location.hash!==t&&history.replaceState(null,"",t)}};function Aw(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o<a.length-1&&r.push(t)})),r}function Ip(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=Aw(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var Pw=i=>{throw new Error(`missing string: ${i}`)},mr=class{locale;constructor(e,{onMissingKey:t=Pw}={}){this.locale={strings:{},pluralize(r){return r===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;let t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(this.#e(e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return Ip(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return Ip(r,t)}};var Di=class{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new mr([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function ou(i){return i<10?`0${i}`:i.toString()}function Qr(){let i=new Date,e=ou(i.getHours()),t=ou(i.getMinutes()),r=ou(i.getSeconds());return`${e}:${t}:${r}`}var Np={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Qr()}]`,...i)},Bp={debug:(...i)=>console.debug(`[Uppy] [${Qr()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Qr()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Qr()}]`,...i)};function Gs(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function Fw(i,e=document){return typeof i=="string"?e.querySelector(i):Gs(i)?i:null}var Up=Fw;function Ow(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}var Wo=Ow;var Xs,Q,$p,Lw,gr,zp,Vp,Wp,Gp,uu,au,lu,Rw,Ys={},Kp=[],Mw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Zs=Array.isArray;function ei(i,e){for(var t in e)i[t]=e[t];return i}function hu(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function yi(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Xs.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return Ks(i,o,r,s,null)}function Ks(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++$p,__i:-1,__u:0};return s==null&&Q.vnode!=null&&Q.vnode(n),n}function Yo(){return{current:null}}function Ae(i){return i.children}function ke(i,e){this.props=i,this.context=e}function Jr(i,e){if(e==null)return i.__?Jr(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Jr(i):null}function Yp(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return Yp(i)}}function Hp(i){(!i.__d&&(i.__d=!0)&&gr.push(i)&&!Ko.__r++||zp!=Q.debounceRendering)&&((zp=Q.debounceRendering)||Vp)(Ko)}function Ko(){for(var i,e,t,r,s,n,o,a=1;gr.length;)gr.length>a&&gr.sort(Wp),i=gr.shift(),a=gr.length,i.__d&&(t=void 0,r=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=ei({},r)).__v=r.__v+1,Q.vnode&&Q.vnode(t),du(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Jr(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,Qp(n,t,o),r.__e=r.__=null,t.__e!=s&&Yp(t)));Ko.__r=0}function Xp(i,e,t,r,s,n,o,a,l,h,f){var m,w,y,_,P,O,R,C=r&&r.__k||Kp,F=e.length;for(l=Dw(t,e,C,l,F),m=0;m<F;m++)(y=t.__k[m])!=null&&(w=y.__i==-1?Ys:C[y.__i]||Ys,y.__i=m,O=du(i,y,w,s,n,o,a,l,h,f),_=y.__e,y.ref&&w.ref!=y.ref&&(w.ref&&pu(w.ref,null,y),f.push(y.ref,y.__c||_,y)),P==null&&_!=null&&(P=_),(R=!!(4&y.__u))||w.__k===y.__k?l=Zp(y,l,i,R):typeof y.type=="function"&&O!==void 0?l=O:_&&(l=_.nextSibling),y.__u&=-7);return t.__e=P,l}function Dw(i,e,t,r,s){var n,o,a,l,h,f=t.length,m=f,w=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[n]=Ks(null,o,null,null,null):Zs(o)?o=i.__k[n]=Ks(Ae,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[n]=Ks(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[n]=o,l=n+w,o.__=i,o.__b=i.__b+1,a=null,(h=o.__i=Iw(o,t,l,m))!=-1&&(m--,(a=t[h])&&(a.__u|=2)),a==null||a.__v==null?(h==-1&&(s>f?w--:s<f&&w++),typeof o.type!="function"&&(o.__u|=4)):h!=l&&(h==l-1?w--:h==l+1?w++:(h>l?w--:w++,o.__u|=4))):i.__k[n]=null;if(m)for(n=0;n<f;n++)(a=t[n])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=Jr(a)),ef(a,a));return r}function Zp(i,e,t,r){var s,n;if(typeof i.type=="function"){for(s=i.__k,n=0;s&&n<s.length;n++)s[n]&&(s[n].__=i,e=Zp(s[n],e,t,r));return e}i.__e!=e&&(r&&(e&&i.type&&!e.parentNode&&(e=Jr(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function pt(i,e){return e=e||[],i==null||typeof i=="boolean"||(Zs(i)?i.some(function(t){pt(t,e)}):e.push(i)),e}function Iw(i,e,t,r){var s,n,o,a=i.key,l=i.type,h=e[t],f=h!=null&&(2&h.__u)==0;if(h===null&&a==null||f&&a==h.key&&l==h.type)return t;if(r>(f?1:0)){for(s=t-1,n=t+1;s>=0||n<e.length;)if((h=e[o=s>=0?s--:n++])!=null&&(2&h.__u)==0&&a==h.key&&l==h.type)return o}return-1}function jp(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Mw.test(e)?t:t+"px"}function Go(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||jp(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||jp(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Gp,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=uu,i.addEventListener(e,n?lu:au,n)):i.removeEventListener(e,n?lu:au,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function qp(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=uu++;else if(e.t<t.u)return;return t(Q.event?Q.event(e):e)}}}function du(i,e,t,r,s,n,o,a,l,h){var f,m,w,y,_,P,O,R,C,F,k,S,A,L,H,j,G,K=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(f=Q.__b)&&f(e);e:if(typeof K=="function")try{if(R=e.props,C="prototype"in K&&K.prototype.render,F=(f=K.contextType)&&r[f.__c],k=f?F?F.props.value:f.__:r,t.__c?O=(m=e.__c=t.__c).__=m.__E:(C?e.__c=m=new K(R,k):(e.__c=m=new ke(R,k),m.constructor=K,m.render=Bw),F&&F.sub(m),m.state||(m.state={}),m.__n=r,w=m.__d=!0,m.__h=[],m._sb=[]),C&&m.__s==null&&(m.__s=m.state),C&&K.getDerivedStateFromProps!=null&&(m.__s==m.state&&(m.__s=ei({},m.__s)),ei(m.__s,K.getDerivedStateFromProps(R,m.__s))),y=m.props,_=m.state,m.__v=e,w)C&&K.getDerivedStateFromProps==null&&m.componentWillMount!=null&&m.componentWillMount(),C&&m.componentDidMount!=null&&m.__h.push(m.componentDidMount);else{if(C&&K.getDerivedStateFromProps==null&&R!==y&&m.componentWillReceiveProps!=null&&m.componentWillReceiveProps(R,k),e.__v==t.__v||!m.__e&&m.shouldComponentUpdate!=null&&m.shouldComponentUpdate(R,m.__s,k)===!1){for(e.__v!=t.__v&&(m.props=R,m.state=m.__s,m.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(ee){ee&&(ee.__=e)}),S=0;S<m._sb.length;S++)m.__h.push(m._sb[S]);m._sb=[],m.__h.length&&o.push(m);break e}m.componentWillUpdate!=null&&m.componentWillUpdate(R,m.__s,k),C&&m.componentDidUpdate!=null&&m.__h.push(function(){m.componentDidUpdate(y,_,P)})}if(m.context=k,m.props=R,m.__P=i,m.__e=!1,A=Q.__r,L=0,C){for(m.state=m.__s,m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),H=0;H<m._sb.length;H++)m.__h.push(m._sb[H]);m._sb=[]}else do m.__d=!1,A&&A(e),f=m.render(m.props,m.state,m.context),m.state=m.__s;while(m.__d&&++L<25);m.state=m.__s,m.getChildContext!=null&&(r=ei(ei({},r),m.getChildContext())),C&&!w&&m.getSnapshotBeforeUpdate!=null&&(P=m.getSnapshotBeforeUpdate(y,_)),j=f,f!=null&&f.type===Ae&&f.key==null&&(j=Jp(f.props.children)),a=Xp(i,Zs(j)?j:[j],e,t,r,s,n,o,a,l,h),m.base=e.__e,e.__u&=-161,m.__h.length&&o.push(m),O&&(m.__E=m.__=null)}catch(ee){if(e.__v=null,l||n!=null)if(ee.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else{for(G=n.length;G--;)hu(n[G]);cu(e)}else e.__e=t.__e,e.__k=t.__k,ee.then||cu(e);Q.__e(ee,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=Nw(t.__e,e,t,r,s,n,o,l,h);return(f=Q.diffed)&&f(e),128&e.__u?void 0:a}function cu(i){i&&i.__c&&(i.__c.__e=!0),i&&i.__k&&i.__k.forEach(cu)}function Qp(i,e,t){for(var r=0;r<t.length;r++)pu(t[r],t[++r],t[++r]);Q.__c&&Q.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){Q.__e(n,s.__v)}})}function Jp(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Zs(i)?i.map(Jp):ei({},i)}function Nw(i,e,t,r,s,n,o,a,l){var h,f,m,w,y,_,P,O=t.props||Ys,R=e.props,C=e.type;if(C=="svg"?s="http://www.w3.org/2000/svg":C=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(h=0;h<n.length;h++)if((y=n[h])&&"setAttribute"in y==!!C&&(C?y.localName==C:y.nodeType==3)){i=y,n[h]=null;break}}if(i==null){if(C==null)return document.createTextNode(R);i=document.createElementNS(s,C,R.is&&R),a&&(Q.__m&&Q.__m(e,n),a=!1),n=null}if(C==null)O===R||a&&i.data==R||(i.data=R);else{if(n=n&&Xs.call(i.childNodes),!a&&n!=null)for(O={},h=0;h<i.attributes.length;h++)O[(y=i.attributes[h]).name]=y.value;for(h in O)if(y=O[h],h!="children"){if(h=="dangerouslySetInnerHTML")m=y;else if(!(h in R)){if(h=="value"&&"defaultValue"in R||h=="checked"&&"defaultChecked"in R)continue;Go(i,h,null,y,s)}}for(h in R)y=R[h],h=="children"?w=y:h=="dangerouslySetInnerHTML"?f=y:h=="value"?_=y:h=="checked"?P=y:a&&typeof y!="function"||O[h]===y||Go(i,h,y,O[h],s);if(f)a||m&&(f.__html==m.__html||f.__html==i.innerHTML)||(i.innerHTML=f.__html),e.__k=[];else if(m&&(i.innerHTML=""),Xp(e.type=="template"?i.content:i,Zs(w)?w:[w],e,t,r,C=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&Jr(t,0),a,l),n!=null)for(h=n.length;h--;)hu(n[h]);a||(h="value",C=="progress"&&_==null?i.removeAttribute("value"):_!=null&&(_!==i[h]||C=="progress"&&!_||C=="option"&&_!=O[h])&&Go(i,h,_,O[h],s),h="checked",P!=null&&P!=i[h]&&Go(i,h,P,O[h],s))}return i}function pu(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){Q.__e(s,t)}}function ef(i,e,t){var r,s;if(Q.unmount&&Q.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||pu(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){Q.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&ef(r[s],e,t||typeof i.type!="function");t||hu(i.__e),i.__c=i.__=i.__e=void 0}function Bw(i,e,t){return this.constructor(i,t)}function tf(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),Q.__&&Q.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],du(e,i=(!r&&t||e).__k=yi(Ae,null,[i]),s||Ys,Ys,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Xs.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),Qp(n,i,o)}function Qs(i,e,t){var r,s,n,o,a=ei({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Xs.call(arguments,2):t),Ks(i.type,a,r||i.key,s||i.ref,null)}Xs=Kp.slice,Q={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},$p=0,Lw=function(i){return i!=null&&i.constructor===void 0},ke.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ei({},this.state),typeof i=="function"&&(i=i(ei({},t),this.props)),i&&ei(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Hp(this))},ke.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Hp(this))},ke.prototype.render=Ae,gr=[],Vp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Wp=function(i,e){return i.__v.__b-e.__v.__b},Ko.__r=0,Gp=/(PointerCapture)$|Capture$/i,uu=0,au=qp(!1),lu=qp(!0),Rw=0;var Js,Oe,fu,rf,en=0,hf=[],De=Q,sf=De.__b,nf=De.__r,of=De.diffed,af=De.__c,lf=De.unmount,cf=De.__;function gu(i,e){De.__h&&De.__h(Oe,i,en||e),en=0;var t=Oe.__H||(Oe.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Mt(i){return en=1,df(ff,i)}function df(i,e,t){var r=gu(Js++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):ff(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],h=r.t(l,a);l!==h&&(r.__N=[h,r.__[1]],r.__c.setState({}))}],r.__c=Oe,!Oe.__f)){var s=function(a,l,h){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(w){return!!w.__c});if(f.every(function(w){return!w.__N}))return!n||n.call(this,a,l,h);var m=r.__c.props!==a;return f.forEach(function(w){if(w.__N){var y=w.__[0];w.__=w.__N,w.__N=void 0,y!==w.__[0]&&(m=!0)}}),n&&n.call(this,a,l,h)||m};Oe.__f=!0;var n=Oe.shouldComponentUpdate,o=Oe.componentWillUpdate;Oe.componentWillUpdate=function(a,l,h){if(this.__e){var f=n;n=void 0,s(a,l,h),n=f}o&&o.call(this,a,l,h)},Oe.shouldComponentUpdate=s}return r.__N||r.__}function Vt(i,e){var t=gu(Js++,3);!De.__s&&pf(t.__H,e)&&(t.__=i,t.u=e,Oe.__H.__h.push(t))}function Ii(i){return en=5,Ni(function(){return{current:i}},[])}function Ni(i,e){var t=gu(Js++,7);return pf(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Bi(i,e){return en=8,Ni(function(){return i},e)}function Uw(){for(var i;i=hf.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Xo),i.__H.__h.forEach(mu),i.__H.__h=[]}catch(e){i.__H.__h=[],De.__e(e,i.__v)}}De.__b=function(i){Oe=null,sf&&sf(i)},De.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),cf&&cf(i,e)},De.__r=function(i){nf&&nf(i),Js=0;var e=(Oe=i.__c).__H;e&&(fu===Oe?(e.__h=[],Oe.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Xo),e.__h.forEach(mu),e.__h=[],Js=0)),fu=Oe},De.diffed=function(i){of&&of(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(hf.push(e)!==1&&rf===De.requestAnimationFrame||((rf=De.requestAnimationFrame)||zw)(Uw)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),fu=Oe=null},De.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Xo),t.__h=t.__h.filter(function(r){return!r.__||mu(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],De.__e(r,t.__v)}}),af&&af(i,e)},De.unmount=function(i){lf&&lf(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{Xo(r)}catch(s){e=s}}),t.__H=void 0,e&&De.__e(e,t.__v))};var uf=typeof requestAnimationFrame=="function";function zw(i){var e,t=function(){clearTimeout(r),uf&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);uf&&(e=requestAnimationFrame(t))}function Xo(i){var e=Oe,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Oe=e}function mu(i){var e=Oe;i.__c=i.__(),Oe=e}function pf(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function ff(i,e){return typeof e=="function"?e(i):e}function jw(i,e){for(var t in e)i[t]=e[t];return i}function mf(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function gf(i,e){this.props=i,this.context=e}(gf.prototype=new ke).isPureReactComponent=!0,gf.prototype.shouldComponentUpdate=function(i,e){return mf(this.props,i)||mf(this.state,e)};var bf=Q.__b;Q.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),bf&&bf(i)};var HA=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var qw=Q.__e;Q.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}qw(i,e,t,r)};var yf=Q.unmount;function xf(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=jw({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return xf(r,e,t)})),i}function kf(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return kf(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function bu(){this.__u=0,this.o=null,this.__b=null}function _f(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Zo(){this.i=null,this.l=null}Q.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),yf&&yf(i)},(bu.prototype=new ke).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=_f(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=kf(l,l.__c.__P,l.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},bu.prototype.componentWillUnmount=function(){this.o=[]},bu.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=xf(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&yi(Ae,null,i.fallback);return s&&(s.__u&=-33),[yi(Ae,null,e.__a?null:i.children),s]};var vf=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Zo.prototype=new ke).__a=function(i){var e=this,t=_f(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),vf(e,i,r)):s()};t?t(n):n()}},Zo.prototype.render=function(i){this.i=null,this.l=new Map;var e=pt(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Zo.prototype.componentDidUpdate=Zo.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){vf(i,t,e)})};var $w=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Vw=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ww=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Gw=/[A-Z0-9]/g,Kw=typeof document<"u",Yw=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function yu(i,e,t){return e.__k==null&&(e.textContent=""),tf(i,e),typeof t=="function"&&t(),i?i.__c:null}ke.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(ke.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var wf=Q.event;function Xw(){}function Zw(){return this.cancelBubble}function Qw(){return this.defaultPrevented}Q.event=function(i){return wf&&(i=wf(i)),i.persist=Xw,i.isPropagationStopped=Zw,i.isDefaultPrevented=Qw,i.nativeEvent=i};var Cf,Jw={enumerable:!1,configurable:!0,get:function(){return this.class}},Sf=Q.vnode;Q.vnode=function(i){typeof i.type=="string"&&(function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Kw&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||Yw(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Ww.test(o)&&(o=l):l=o="oninput":n&&Vw.test(o)?o=o.replace(Gw,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=pt(t.children).forEach(function(h){h.props.selected=s.value.indexOf(h.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=pt(t.children).forEach(function(h){h.props.selected=s.multiple?s.defaultValue.indexOf(h.props.value)!=-1:s.defaultValue==h.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Jw)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s})(i),i.$$typeof=$w,Sf&&Sf(i)};var Ef=Q.__r;Q.__r=function(i){Ef&&Ef(i),Cf=i.__c};var Tf=Q.diffed;Q.diffed=function(i){Tf&&Tf(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),Cf=null};function e1(i){let e=null,t;return(...r)=>(t=r,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}var vu=class i extends Di{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=Up(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),this.#e=e1(l=>{this.uppy.getPlugin(this.id)&&(yu(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),yu(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||Wo(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){this.el!=null&&this.#e?.(e)}unmount(){this.isTargetDOMEl&&this.el?.remove(),this.onUnmount()}onMount(){}onUnmount(){}},Wt=vu;var Af={name:"@uppy/store-default",description:"The default simple object-based store for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-store"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},devDependencies:{jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"]};var wu=class{static VERSION=Af.version;state={};#e=new Set;getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,this.#t(t,r,e)}subscribe(e){return this.#e.add(e),()=>{this.#e.delete(e)}}#t(...e){this.#e.forEach(t=>{t(...e)})}},Pf=wu;function br(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var Su={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function tn(i){if(i.type)return i.type;let e=i.name?br(i.name).extension?.toLowerCase():null;return e&&e in Su?Su[e]:"application/octet-stream"}function i1(i){return i.charCodeAt(0).toString(32)}function Ff(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${i1(t)}`,"/"))+e}function Of(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Ff(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Ff(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function r1(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Qo(i,e){if(r1(i))return i.id;let t=tn(i);return Of({...i,type:t},e)}var Tm=Te(um(),1),xm=Te(dm(),1);var X1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ui=(i=21)=>{let e="",t=i|0;for(;t-- >0;)e+=X1[Math.random()*64|0];return e};var pm={name:"@uppy/core",description:"Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",sideEffects:["*.css"],scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^4.3.2","@uppy/utils":"^6.2.2",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},devDependencies:{"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"}};function _u(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}var fm={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};var sn=Te(ea(),1),Sm=Te(wm(),1),Em={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},ft=class extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0},ta=class{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{let r=e();if(r.restrictions?.allowedFileTypes!=null&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new ft(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>o+(a.size??0),0);if(n>r)throw new ft(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,sn.default)(r),size:(0,sn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(o=>o.includes("/")?e.type?(0,Sm.default)(e.type.replace(/;.*?$/,""),o):!1:o[0]==="."&&e.extension?e.extension.toLowerCase()===o.slice(1).toLowerCase():!1)){let o=s.join(", ");throw new ft(this.getI18n()("youCanOnlyUploadFileTypes",{types:o}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new ft(this.getI18n()("exceedsSize",{size:(0,sn.default)(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(r&&e.size!=null&&e.size<r)throw new ft(this.getI18n()("inferiorSize",{size:(0,sn.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new ft(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){let t=new ft(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(let n of r)(!Object.hasOwn(e.meta,n)||e.meta[n]==="")&&s.push(n);return{missingFields:s,error:t}}};function Cu(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}var ia={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},Au=class i{static VERSION=pm.version;#e=Object.create(null);#t;#i;#r=(0,xm.default)();#s=new Set;#a=new Set;#n=new Set;defaultLocale;locale;opts;store;i18n;i18nArray;scheduledAutoProceed=null;wasOffline=!1;constructor(e){this.defaultLocale=fm;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Em,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new Pf,logger:Np,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e?.restrictions}},e?.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e?.debug&&(this.opts.logger=Bp),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...ia,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Cu(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),this.#t=new ta(()=>this.opts,()=>this.i18n),this.#i=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),this.#S()}emit(e,...t){this.#r.emit(e,...t)}on(e,t){return this.#r.on(e,t),this}once(e,t){return this.#r.once(e,t),this}off(e,t){return this.#r.off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(([r,s])=>[r,{...t[r],...s}]))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new mr([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...ia})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...ia,files:{}})}addPreProcessor(e){this.#s.add(e)}removePreProcessor(e){return this.#s.delete(e)}addPostProcessor(e){this.#n.add(e)}removePostProcessor(e){return this.#n.delete(e)}addUploader(e){this.#a.add(e)}removeUploader(e){return this.#a.delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],h=[],f=[],m=[],w=[],y=[];for(let _ of s){let{progress:P}=_;!P.uploadComplete&&P.uploadStarted&&(n.push(_),_.isPaused||w.push(_)),P.uploadStarted||o.push(_),(P.uploadStarted||P.preprocess||P.postprocess)&&a.push(_),P.uploadStarted&&l.push(_),_.isPaused&&h.push(_),P.uploadComplete&&f.push(_),_.error&&m.push(_),(P.preprocess||P.postprocess)&&y.push(_)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:h,completeFiles:f,erroredFiles:m,inProgressFiles:n,inProgressNotPausedFiles:w,processingFiles:y,isUploadStarted:l.length>0,isAllComplete:t===100&&f.length===s.length&&y.length===0,isAllErrored:!!r&&m.length===s.length,isAllPaused:n.length!==0&&h.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(_=>_.isGhost)}}#l(e){for(let o of e)o.isRestriction?this.emit("restriction-failed",o.file,o):this.emit("error",o,o.file),this.log(o,"warning");let t=e.filter(o=>o.isUserFacing),r=4,s=t.slice(0,r),n=t.slice(r);s.forEach(({message:o,details:a=""})=>{this.info({message:o,details:a},"error",this.opts.infoTimeout)}),n.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:n.length})})}validateRestrictions(e,t=this.getFiles()){try{this.#t.validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{this.#t.validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{this.#t.validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}#o(e){let{missingFields:t,error:r}=this.#t.getMissingRequiredMetaFields(e);return t.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:t,error:r.message}),this.log(r.message),this.emit("restriction-failed",e,r),!1):(t.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)}#f(e){let t=!0;for(let r of Object.values(e))this.#o(r)||(t=!1);return t}#c(e){let{allowNewUpload:t}=this.getState();if(t===!1){let r=new ft(this.i18n("noMoreFilesAllowed"),{file:e});throw this.#l([r]),r}}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}#h(e){let t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=tn(t),s=_u(r,t),n=br(s).extension,o=Qo(t,this.getID()),a=t.meta||{};a.name=s,a.type=r;let l=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:o,name:s,extension:n||"",meta:{...this.getState().meta,...a},type:r,data:t.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:l,uploadComplete:!1,uploadStarted:null},size:l,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote,preview:t.preview}}#u(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}#p(e){let{files:t}=this.getState(),r={...t},s=[],n=[];for(let o of e)try{let a=this.#h(o),l=t[a.id]?.isGhost;l&&(a={...t[a.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${a.name}, ${a.id}`));let h=this.opts.onBeforeFileAdded(a,r);if(t=this.getState().files,r={...t,...r},!h&&this.checkIfFileAlreadyExists(a.id))throw new ft(this.i18n("noDuplicates",{fileName:a.name??this.i18n("unnamed")}),{file:o});if(h===!1&&!l)throw new ft("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});typeof h=="object"&&h!==null&&(a=h),this.#t.validateSingleFile(a),r[a.id]=a,s.push(a)}catch(a){n.push(a)}try{this.#t.validateAggregateRestrictions(Object.values(t),s)}catch(o){return n.push(o),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}addFile(e){this.#c(e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p([e]),n=s.filter(a=>a.isRestriction);if(this.#l(n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),this.#u(),o.id}addFiles(e){this.#c();let{nextFilesState:t,validFilesToAdd:r,errors:s}=this.#p(e),n=s.filter(a=>a.isRestriction);this.#l(n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
89
89
  `;if(o.forEach(l=>{a+=`
90
90
  * ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:a},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,a);{let l=new Error(a);throw l.errors=o,l}}this.setState({files:t}),r.forEach(a=>{this.emit("file-added",a)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(a=>{this.log(`Added file: ${a.name}
91
91
  id: ${a.id}
92
- type: ${a.type}`)}),r.length>0&&this.#u()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},o=Object.create(null);e.forEach(m=>{t[m]&&(o[m]=t[m],delete s[m])});function a(m){return o[m]===void 0}Object.keys(n).forEach(m=>{let g=r[m].fileIDs.filter(a);if(g.length===0){delete n[m];return}let{capabilities:E}=this.getState();if(g.length!==r[m].fileIDs.length&&!E.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[m]={...r[m],fileIDs:g}});let l={currentUploads:n,files:s};Object.keys(s).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.#v();let h=Object.keys(o);h.forEach(m=>{this.emit("file-removed",o[m])}),h.length>5?this.log(`Removed ${h.length} files`):this.log(`Removed files: ${h.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#g(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#h(){let e=this.#g(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#w(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#h();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Jo)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#w([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#y=(e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#v()};#m(){let e=this.#T(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#v=(0,hm.default)(()=>this.#m(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#m()}#T(){let t=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(t.length===0)return 0;if(t.every(l=>l.progress.uploadComplete))return 1;let r=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,s=t.filter(r),n=t.filter(l=>!r(l));if(s.every(l=>l.progress.uploadComplete)&&n.length>0&&!n.every(l=>l.progress.uploadComplete))return null;let o=s.reduce((l,h)=>l+(h.progress.bytesTotal??0),0),a=s.reduce((l,h)=>l+(h.progress.bytesUploaded||0),0);return o===0?0:a/o}#S(){let e=(s,n,o)=>{let a=s.message||"Unknown error";s.details&&(a+=` ${s.details}`),this.setState({error:a}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(s,n,o)=>{if(e(n,s,o),typeof n=="object"&&n.message){this.log(n.message,"error");let a=new Error(this.i18n("failedToUpload",{file:s?.name??""}));a.isUserFacing=!0,a.details=n.message,n.details&&(a.details+=` ${n.details}`),this.#l([a])}else this.#l([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:o}=s,a=n.map(l=>l.meta.name).join(", ");t||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=s=>{let n=s.filter(a=>{let l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a?.id}`),l}),o=Object.fromEntries(n.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",r),this.on("upload-progress",this.#y),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let o=this.getFile(s.id).progress;this.setFileState(s.id,{progress:{...o,postprocess:this.#s.size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||o.bytesTotal}),this.#v()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.postprocess,this.setState({files:n})}),this.on("restored",()=>{this.#v()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#a(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#b),window.addEventListener("offline",this.#b),setTimeout(this.#b,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#b=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let o=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
93
- Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#i(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#b),window.removeEventListener("offline",this.#b))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?this.#k(e):(this.#E(e),Promise.reject(new Error("Nonexistent upload")))}#w(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let o=Ni();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[o]:{fileIDs:e,step:0,result:{}}}}),o}[Symbol.for("uppy test: createUpload")](...e){return this.#w(...e)}#_(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#_(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#E(e){let t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async#k(e){let t=()=>{let{currentUploads:o}=this.getState();return o[e]},r=t(),s=[...this.#n,...this.#o,...this.#s];try{for(let o=r.step||0;o<s.length&&r;o++){let a=s[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:o}}});let{fileIDs:l}=r;await a(l,e),r=t()}}catch(o){throw this.#E(e),o}if(r){r.fileIDs.forEach(h=>{let m=this.getFile(h);m?.progress.postprocess&&this.emit("postprocess-complete",m)});let o=r.fileIDs.map(h=>this.getFile(h)),a=o.filter(h=>!h.error),l=o.filter(h=>h.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#E(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#g().length>0){let s=await this.#h();if(!(this.getFiles().filter(o=>o.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(e=r,this.setState({files:e})),Promise.resolve().then(()=>this.#t.validateMinNumberOfFiles(e)).catch(s=>{throw this.#l([s]),s}).then(()=>{if(!this.#f(e))throw new ft(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(h=>h.fileIDs),o=[];Object.keys(e).forEach(h=>{let m=this.getFile(h);!m.progress.uploadStarted&&n.indexOf(h)===-1&&o.push(m.id)});let a=this.#w(o),l=await this.#k(a);return this.emit("complete",l),l}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}},ea=vu;var U1=0;function c(i,e,t,r,s,n){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--U1,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(o=i.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return G.vnode&&G.vnode(h),h}var pm={name:"@uppy/informer",description:"A notification and error pop-up bar for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","notification","bar","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var fm=300,tn=class extends ve{ref=Wo();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,fm)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,fm)}render(){let{children:e}=this.props;return c("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function H1(i,e){return Object.assign(i,e)}function j1(i,e){return i?.key??e}function q1(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function rn(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=j1(i[t],t.toString(36));e[r]=i[t]}return e}function $1(i,e){i=i||{},e=e||{};let t=o=>Object.hasOwn(e,o)?e[o]:i[o],r={},s=[];for(let o in i)Object.hasOwn(e,o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(Object.hasOwn(r,o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var V1=i=>i,ta=class extends ve{constructor(e,t){super(e,t),this.refs={},this.state={children:rn(pt(pt(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=rn(pt(e.children)||[]),r=this.state.children;this.setState(n=>({children:$1(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=rn(pt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=rn(pt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=rn(pt(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=H1({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:o,transitionEnterTimeout:a,transitionAppearTimeout:l,component:h,...m},{children:g}){let E=Object.entries(g).map(([w,F])=>{if(!F)return;let L=q1(this,w);return Ys(e(F),{ref:L,key:w})}).filter(Boolean);return fi(h,m,E)}};ta.defaultProps={component:"span",childFactory:V1};var mm=ta;var Zr=class extends Vt{static VERSION=pm.version;constructor(e,t){super(e,t),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}render=e=>c("div",{className:"uppy uppy-Informer",children:c(mm,{children:e.info.map(t=>c(tn,{children:c("p",{role:"alert",children:[t.message," ",t.details&&c("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${t.message}
92
+ type: ${a.type}`)}),r.length>0&&this.#u()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},o=Object.create(null);e.forEach(f=>{t[f]&&(o[f]=t[f],delete s[f])});function a(f){return o[f]===void 0}Object.keys(n).forEach(f=>{let m=r[f].fileIDs.filter(a);if(m.length===0){delete n[f];return}let{capabilities:w}=this.getState();if(m.length!==r[f].fileIDs.length&&!w.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[f]={...r[f],fileIDs:m}});let l={currentUploads:n,files:s};Object.keys(s).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.#v();let h=Object.keys(o);h.forEach(f=>{this.emit("file-removed",o[f])}),h.length>5?this.log(`Removed ${h.length} files`):this.log(`Removed files: ${h.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}#m(){let{files:e}=this.getState();return Object.keys(e).filter(t=>{let r=e[t];return r.error&&(!r.missingRequiredMetaFields||r.missingRequiredMetaFields.length===0)})}async#d(){let e=this.#m(),t={...this.getState().files};if(e.forEach(s=>{t[s]={...t[s],isPaused:!1,error:null}}),this.setState({files:t,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};let r=this.#w(e,{forceAllowNewUpload:!0});return this.#k(r)}async retryAll(){let e=await this.#d();return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(ia)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=this.#w([e],{forceAllowNewUpload:!0});return this.#k(t)}logout(){this.iteratePlugins(e=>{e.provider?.logout?.()})}#y=(e,t)=>{let r=e?this.getFile(e.id):void 0;if(e==null||!r){this.log(`Not setting progress for a file that has been removed: ${e?.id}`);return}if(r.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}let s={bytesTotal:t.bytesTotal,percentage:t.bytesTotal!=null&&Number.isFinite(t.bytesTotal)&&t.bytesTotal>0?Math.round(t.bytesUploaded/t.bytesTotal*100):void 0};r.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...r.progress,...s,bytesUploaded:t.bytesUploaded}}):this.setFileState(e.id,{progress:{...r.progress,...s}}),this.#v()};#g(){let e=this.#T(),t=null;e!=null&&(t=Math.round(e*100),t>100?t=100:t<0&&(t=0)),this.emit("progress",t??0),this.setState({totalProgress:t??0})}#v=(0,Tm.default)(()=>this.#g(),500,{leading:!0,trailing:!0});[Symbol.for("uppy test: updateTotalProgress")](){return this.#g()}#T(){let t=this.getFiles().filter(l=>l.progress.uploadStarted||l.progress.preprocess||l.progress.postprocess);if(t.length===0)return 0;if(t.every(l=>l.progress.uploadComplete))return 1;let r=l=>l.progress.bytesTotal!=null&&l.progress.bytesTotal!==0,s=t.filter(r),n=t.filter(l=>!r(l));if(s.every(l=>l.progress.uploadComplete)&&n.length>0&&!n.every(l=>l.progress.uploadComplete))return null;let o=s.reduce((l,h)=>l+(h.progress.bytesTotal??0),0),a=s.reduce((l,h)=>l+(h.progress.bytesUploaded||0),0);return o===0?0:a/o}#S(){let e=(s,n,o)=>{let a=s.message||"Unknown error";s.details&&(a+=` ${s.details}`),this.setState({error:a}),n!=null&&n.id in this.getState().files&&this.setFileState(n.id,{error:a,response:o})};this.on("error",e),this.on("upload-error",(s,n,o)=>{if(e(n,s,o),typeof n=="object"&&n.message){this.log(n.message,"error");let a=new Error(this.i18n("failedToUpload",{file:s?.name??""}));a.isUserFacing=!0,a.details=n.message,n.details&&(a.details+=` ${n.details}`),this.#l([a])}else this.#l([n])});let t=null;this.on("upload-stalled",(s,n)=>{let{message:o}=s,a=n.map(l=>l.meta.name).join(", ");t||(this.info({message:o,details:a},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${o} ${a}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let r=s=>{let n=s.filter(a=>{let l=a!=null&&this.getFile(a.id);return l||this.log(`Not setting progress for a file that has been removed: ${a?.id}`),l}),o=Object.fromEntries(n.map(a=>[a.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:a.size}}]));this.patchFilesState(o)};this.on("upload-start",r),this.on("upload-progress",this.#y),this.on("upload-success",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let o=this.getFile(s.id).progress;this.setFileState(s.id,{progress:{...o,postprocess:this.#n.size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal},response:n,uploadURL:n.uploadURL,isPaused:!1}),s.size==null&&this.setFileState(s.id,{size:n.bytesUploaded||o.bytesTotal}),this.#v()}),this.on("preprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getFile(s.id).progress,preprocess:n}})}),this.on("preprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.preprocess,this.setState({files:n})}),this.on("postprocess-progress",(s,n)=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}this.setFileState(s.id,{progress:{...this.getState().files[s.id].progress,postprocess:n}})}),this.on("postprocess-complete",s=>{if(s==null||!this.getFile(s.id)){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}let n={...this.getState().files};n[s.id]={...n[s.id],progress:{...n[s.id].progress}},delete n[s.id].progress.postprocess,this.setState({files:n})}),this.on("restored",()=>{this.#v()}),this.on("dashboard:file-edit-complete",s=>{s&&this.#o(s)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",this.#b),window.addEventListener("offline",this.#b),setTimeout(this.#b,3e3))}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}#b=this.updateOnlineStatus.bind(this);getID(){return this.opts.id}use(e,...t){if(typeof e!="function"){let o=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(o)}let r=new e(this,...t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");let n=this.getPlugin(s);if(n){let o=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.
93
+ Uppy plugins must have unique \`id\` options.`;throw new Error(o)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in this.#e?this.#e[r.type].push(r):this.#e[r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(let t of Object.values(this.#e)){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return this.#e[e]}iteratePlugins(e){Object.values(this.#e).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=this.#e[e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),this.#i(),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",this.#b),window.removeEventListener("offline",this.#b))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t="info",r=3e3){let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}#x=new Map;registerRequestClient(e,t){this.#x.set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=this.#x.get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?this.#k(e):(this.#E(e),Promise.reject(new Error("Nonexistent upload")))}#w(e,t={}){let{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");let o=Ui();return this.emit("upload",o,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...n,[o]:{fileIDs:e,step:0,result:{}}}}),o}[Symbol.for("uppy test: createUpload")](...e){return this.#w(...e)}#_(e){let{currentUploads:t}=this.getState();return t[e]}addResultData(e,t){if(!this.#_(e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}#E(e){let t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async#k(e){let t=()=>{let{currentUploads:o}=this.getState();return o[e]},r=t(),s=[...this.#s,...this.#a,...this.#n];try{for(let o=r.step||0;o<s.length&&r;o++){let a=s[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:o}}});let{fileIDs:l}=r;await a(l,e),r=t()}}catch(o){throw this.#E(e),o}if(r){r.fileIDs.forEach(h=>{let f=this.getFile(h);f?.progress.postprocess&&this.emit("postprocess-complete",f)});let o=r.fileIDs.map(h=>this.getFile(h)),a=o.filter(h=>!h.error),l=o.filter(h=>h.error);this.addResultData(e,{successful:a,failed:l,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.#E(e)),n==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),n={successful:[],failed:[],uploadID:e}),n}async upload(){this.#e.uploader?.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(this.#m().length>0){let s=await this.#d();if(!(this.getFiles().filter(o=>o.progress.uploadStarted==null).length>0))return this.emit("complete",s),s;({files:e}=this.getState())}let r=this.opts.onBeforeUpload(e);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(e=r,this.setState({files:e})),Promise.resolve().then(()=>this.#t.validateMinNumberOfFiles(e)).catch(s=>{throw this.#l([s]),s}).then(()=>{if(!this.#f(e))throw new ft(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(async()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(h=>h.fileIDs),o=[];Object.keys(e).forEach(h=>{let f=this.getFile(h);!f.progress.uploadStarted&&n.indexOf(h)===-1&&o.push(f.id)});let a=this.#w(o),l=await this.#k(a);return this.emit("complete",l),l}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}},ra=Au;var eS=0;function c(i,e,t,r,s,n){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)a=="ref"?o=e[a]:l[a]=e[a];var h={type:i,props:l,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eS,__i:-1,__u:0,__source:s,__self:n};if(typeof i=="function"&&(o=i.defaultProps))for(a in o)l[a]===void 0&&(l[a]=o[a]);return Q.vnode&&Q.vnode(h),h}var km={name:"@uppy/informer",description:"A notification and error pop-up bar for Uppy.",version:"4.3.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","notification","bar","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var _m=300,nn=class extends ke{ref=Yo();componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,_m)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,_m)}render(){let{children:e}=this.props;return c("div",{className:"uppy-Informer-animated",ref:this.ref,children:e})}};function iS(i,e){return Object.assign(i,e)}function rS(i,e){return i?.key??e}function sS(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function on(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=rS(i[t],t.toString(36));e[r]=i[t]}return e}function nS(i,e){i=i||{},e=e||{};let t=o=>Object.hasOwn(e,o)?e[o]:i[o],r={},s=[];for(let o in i)Object.hasOwn(e,o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(Object.hasOwn(r,o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var oS=i=>i,sa=class extends ke{constructor(e,t){super(e,t),this.refs={},this.state={children:on(pt(pt(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=on(pt(e.children)||[]),r=this.state.children;this.setState(n=>({children:nS(n.children,t)}));let s;for(s in t)if(Object.hasOwn(t,s)){let n=r&&Object.hasOwn(r,s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(Object.hasOwn(r,s)){let n=t&&Object.hasOwn(t,s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t?.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=on(pt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t?.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t?.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=on(pt(this.props.children)||[]);(!r||!Object.hasOwn(r,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r?.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r?.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=on(pt(this.props.children)||[]);if(s&&Object.hasOwn(s,e))this.performEnter(e);else{let n=iS({},this.state.children);delete n[e],this.setState({children:n})}}render({childFactory:e,transitionLeave:t,transitionName:r,transitionAppear:s,transitionEnter:n,transitionLeaveTimeout:o,transitionEnterTimeout:a,transitionAppearTimeout:l,component:h,...f},{children:m}){let w=Object.entries(m).map(([y,_])=>{if(!_)return;let P=sS(this,y);return Qs(e(_),{ref:P,key:y})}).filter(Boolean);return yi(h,f,w)}};sa.defaultProps={component:"span",childFactory:oS};var Cm=sa;var es=class extends Wt{static VERSION=km.version;constructor(e,t){super(e,t),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}render=e=>c("div",{className:"uppy uppy-Informer",children:c(Cm,{children:e.info.map(t=>c(nn,{children:c("p",{role:"alert",children:[t.message," ",t.details&&c("span",{"aria-label":t.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${t.message}
94
94
 
95
- ${t.details}`),children:"?"})]})},t.message))})});install(){let{target:e}=this.opts;e&&this.mount(e,this)}};function W1(){return c("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:c("g",{fill:"none","fill-rule":"evenodd",children:[c("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),c("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),c("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),c("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),c("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),c("path",{d:"M4 4h18v18H4z"})]})})}function G1({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=Di(n=>{n.preventDefault(),t()},[t]);return c("form",{onSubmit:s,children:r?c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[c(W1,{}),e("signInWithGoogle")]}):c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}var K1=({pluginName:i,i18n:e,onAuth:t})=>c(G1,{pluginName:i,i18n:e,onAuth:t});function ia({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=K1}){return c("div",{className:"uppy-Provider-auth",children:[c("div",{className:"uppy-Provider-authIcon",children:t()}),c("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}function sn(i){return{...i,type:i.mimeType,extension:i.name?dr(i.name).extension:null}}var Lm=be(nt(),1);var sa={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",classnames:"^2.2.6",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var X1={position:"relative",width:"100%",minHeight:"100%"},Z1={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},wu=class extends ve{constructor(e){super(e),this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement?.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleScroll=()=>{this.setState({offset:this.base.scrollTop})};handleResize=()=>{this.resize()};resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:e,rowHeight:t,renderRow:r,overscanCount:s=10,...n}){let{offset:o,height:a}=this.state,l=Math.floor(o/t),h=Math.floor(a/t);s&&(l=Math.max(0,l-l%s),h+=s);let m=l+h+4,g=e.slice(l,m),E={...X1,height:e.length*t},w={...Z1,top:l*t};return c("div",{onScroll:this.handleScroll,...n,children:c("div",{role:"presentation",style:E,children:c("div",{role:"presentation",style:w,children:g.map(r)})})})}},na=wu;var gm=be(nt(),1);function Q1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:c("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}function J1(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:c("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}function eS(){return c("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[c("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),c("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}function Qr({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return c(Q1,{});case"folder":return c(J1,{});case"video":return c(eS,{});default:return c("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function tS({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:o=null,i18n:a}){return c("li",{className:t,title:r&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),c("label",{htmlFor:i.id,"aria-label":i.data.name??a("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c(Qr,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??a("unnamed")),o]})]})}var Su=tS;function Eu({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:o,i18n:a}){return c("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?a("allFilesFromFolderNamed",{name:i.data.name??a("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>e(i.id),"aria-label":a("openFolderNamed",{name:i.data.name??a("unnamed")}),children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(Qr,{itemIconString:i.data.icon})}),o&&i.data.name?c("span",{children:i.data.name}):a("unnamed")]}):c("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(Qr,{itemIconString:i.data.icon})}),o&&(i.data.name??a("unnamed"))]})]})}function Tu(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,h=!!l&&o.status!=="checked",m={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,gm.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":h},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:h,restrictionError:l};switch(e){case"grid":return c(Su,{...m});case"list":return c(Eu,{...m});case"unsplash":return c(Su,{...m,children:c("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:o.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}function iS(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:h,virtualList:m,utmSource:g}=i,[E,w]=Ft(!1);if($t(()=>{let L=D=>{D.key==="Shift"&&w(!1)},M=D=>{D.key==="Shift"&&w(!0)};return document.addEventListener("keyup",L),document.addEventListener("keydown",M),()=>{document.removeEventListener("keyup",L),document.removeEventListener("keydown",M)}},[]),a)return c("div",{className:"uppy-Provider-loading",children:typeof a=="string"?a:o("loading")});if(e.length===0)return c("div",{className:"uppy-Provider-empty",children:h});let F=L=>c(Tu,{viewType:t,toggleCheckbox:M=>{M.stopPropagation(),M.preventDefault(),document.getSelection()?.removeAllRanges(),r(L,E)},showTitles:n,i18n:o,openFolder:l,file:L,utmSource:g},L.id);return m?c("div",{className:"uppy-ProviderBrowser-body",children:c(na,{className:"uppy-ProviderBrowser-list",data:e,renderRow:F,rowHeight:35.5})}):c("div",{className:"uppy-ProviderBrowser-body",children:c("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(F)})})}var oa=iS;var bm=be(nt(),1);var rS=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,aa=rS;function nn({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=Ii(()=>s(r),[r,s]),o=Ii(()=>aa(r),[r]);return o===0?null:c("div",{className:"uppy-ProviderBrowser-footer",children:[c("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[c("button",{className:(0,bm.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:o})}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&c("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}function sS({searchString:i,setSearchString:e,submitSearchString:t,wrapperClassName:r,inputClassName:s,inputLabel:n,clearSearchLabel:o="",showButton:a=!1,buttonLabel:l="",buttonCSSClassName:h=""}){let m=w=>{e(w.target.value)},g=Di(w=>{w.preventDefault(),t()},[t]),[E]=Ft(()=>{let w=document.createElement("form");return w.setAttribute("tabindex","-1"),w.id=Ni(),w});return $t(()=>(document.body.appendChild(E),E.addEventListener("submit",g),()=>{E.removeEventListener("submit",g),document.body.removeChild(E)}),[E,g]),c("section",{className:r,children:[c("input",{className:`uppy-u-reset ${s}`,type:"search","aria-label":n,placeholder:n,value:i,onInput:m,form:E.id,"data-uppy-super-focusable":!0}),!a&&c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:c("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),!a&&i&&c("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:()=>e(""),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:c("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})}),a&&c("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${h}`,type:"submit",form:E.id,children:l})]})}var Jr=sS;var nS=(i,e,t)=>({id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}),ym=nS;var oS=(i,e,t)=>{let r=i.map(o=>ym(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(Yo(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},la=oS;var aS=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},ca=aS;var lS=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},mi=lS;var cS=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},vm=cS;var wm=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...wm(i,s.parentId,t),s];return t[r]=n,n},uS=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=wm(i,s.id,e),o=n.findIndex(m=>m.type==="folder"&&m.status==="checked"),a=n.slice(o),l=`/${n.map(m=>m.data.name).join("/")}`,h=a.length===1?void 0:a.map(m=>m.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:h}})},ua=uS;var ku=be(Em(),1);var an=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},_u=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Tm=i=>globalThis.DOMException===void 0?new _u(i):new DOMException(i),xm=i=>{let e=i.reason===void 0?Tm("This operation was aborted."):i.reason;return e instanceof Error?e:Tm(e)};function Cu(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,h=new Promise((m,g)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:w}=e;w.aborted&&g(xm(w)),a=()=>{g(xm(w))},w.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(m,g);return}let E=new an;o=n.setTimeout.call(void 0,()=>{if(r){try{m(r())}catch(w){g(w)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?m():s instanceof Error?g(s):(E.message=s??`Promise timed out after ${t} milliseconds`,g(E))},t),(async()=>{try{m(await i)}catch(w){g(w)}})()}).finally(()=>{h.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return h.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},h}function Au(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var ln=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=Au(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var cn=class extends ku.default{#e;#t;#i=0;#r;#n;#o=0;#s;#l;#a;#f;#c=0;#d;#u;#p;#g=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:ln,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#n=e.interval,this.#a=new e.queueClass,this.#f=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=e.throwOnTimeout===!0,this.#u=e.autoStart===!1}get#h(){return this.#t||this.#i<this.#r}get#y(){return this.#c<this.#d}#m(){this.#c--,this.#S(),this.emit("next")}#v(){this.#x(),this.#b(),this.#l=void 0}get#T(){let e=Date.now();if(this.#s===void 0){let t=this.#o-e;if(t<0)this.#i=this.#e?this.#c:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#v()},t)),!0}return!1}#S(){if(this.#a.size===0)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),this.#c===0&&this.emit("idle"),!1;if(!this.#u){let e=!this.#T;if(this.#h&&this.#y){let t=this.#a.dequeue();return t?(this.emit("active"),t(),e&&this.#b(),!0):!1}}return!1}#b(){this.#t||this.#s!==void 0||(this.#s=setInterval(()=>{this.#x()},this.#n),this.#o=Date.now()+this.#n)}#x(){this.#i===0&&this.#c===0&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#i=this.#e?this.#c:0,this.#w()}#w(){for(;this.#S(););}get concurrency(){return this.#d}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#d=e,this.#w()}async#_(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#a.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#g++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise((r,s)=>{this.#a.enqueue(async()=>{this.#c++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=Cu(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#_(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof an&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#m()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#u?(this.#u=!1,this.#w(),this):this}pause(){this.#u=!0}clear(){this.#a=new this.#f}async onEmpty(){this.#a.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#a.size<e||await this.#E("next",()=>this.#a.size<e)}async onIdle(){this.#c===0&&this.#a.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#a.size}sizeBy(e){return this.#a.filter(e).length}get pending(){return this.#c}get isPaused(){return this.#u}};var pS=i=>i.map(e=>({...e})),da=pS;var km=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let g=await r(o);n=n.concat(g.items),o=g.nextPagePath}let a=n.filter(g=>g.isFolder===!0),l=n.filter(g=>g.isFolder===!1),h=a.map(g=>({type:"folder",id:g.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:g})),m=l.map(g=>{let E=s(g);return{type:"file",id:g.requestPath,restrictionError:E,status:E?"unchecked":"checked",parentId:t.id,data:g}});t.cached=!0,t.nextPagePath=null,e.push(...m,...h),h.forEach(async g=>{i.add(()=>km(i,e,g,r,s))})},fS=async(i,e,t,r)=>{let s=new cn({concurrency:6}),n=da(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>km(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},_m=fS;var mS=(i,e,t,r,s)=>{let n=e.filter(w=>w.isFolder===!0),o=e.filter(w=>w.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(w=>({type:"folder",id:w.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:w})),h=o.map(w=>{let F=s(w);return{type:"file",id:w.requestPath,restrictionError:F,status:a&&!F?"checked":"unchecked",parentId:t.id,data:w}}),m={...t,cached:!0,nextPagePath:r};return[...i.map(w=>w.id===m.id?m:w),...l,...h]},Cm=mS;var gS=(i,e,t,r,s)=>{let n=i.find(F=>F.id===e),o=t.filter(F=>F.isFolder===!0),a=t.filter(F=>F.isFolder===!1),l={...n,nextPagePath:r},h=i.map(F=>F.id===l.id?l:F),m=l.type==="folder"&&l.status==="checked",g=o.map(F=>({type:"folder",id:F.requestPath,cached:!1,nextPagePath:null,status:m?"checked":"unchecked",parentId:l.id,data:F})),E=a.map(F=>{let L=s(F);return{type:"file",id:F.requestPath,restrictionError:L,status:m&&!L?"checked":"unchecked",parentId:l.id,data:F}});return[...h,...g,...E]},Am=gS;var Pu=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",Pu(i,s.id,t)})},Fu=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",Fu(i,t.parentId)},bS=(i,e)=>{let t=da(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{Pu(t,s.id,!0)}),Fu(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",Pu(t,r.id,r.status==="checked"),Fu(t,r.parentId)}return t},Pm=bS;var pr={afterOpenFolder:Cm,afterScrollFolder:Am,afterToggleCheckbox:Pm,afterFill:_m};var yS=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},pa=yS;var Fm=be(nt(),1);function Ou(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return c("div",{className:"uppy-Provider-breadcrumbs",children:[c("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((o,a)=>c(Te,{children:[c("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id),children:o.type==="root"?t:o.data.name??n("unnamed")},o.id),s.length===a+1?"":" / "]}))]})}function Lu({i18n:i,logout:e,username:t}){return c(Te,{children:[t&&c("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),c("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}function Ru(i){return c("div",{className:"uppy-ProviderBrowser-header",children:c("div",{className:(0,Fm.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&c(Ou,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),c(Lu,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}function hn(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:c("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}var Om=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),un=class{static VERSION=sa.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(Om(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}#e;async#t(e){this.#e?.abort();let t=new AbortController;this.#e=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#e=void 0}}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#t(async s=>{let n=e,o=[];do{let{username:l,nextPagePath:h,items:m}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=h,o=o.concat(m),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=pr.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(mi(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#t(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...Om(this.plugin.rootFolderId),authenticated:!1})}}).catch(mi(this.plugin.uppy))}async handleAuth(e){await this.#t(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(mi(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);pa(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#t(async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=pr.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(mi(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=e=>{let t=sn(e);return this.plugin.uppy.validateSingleFile(t)};async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await this.#t(async t=>{let r=await pr.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=ua(r);la(n,this.plugin,this.provider),this.resetPluginState()}).catch(mi(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=ca(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=pr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}getDisplayedPartialTree=()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(o=>o.type!=="root"&&o.parentId===t);return r===""?s:s.filter(o=>(o.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.toLowerCase())!==-1)};getBreadcrumbs=()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return vm(e,t)};getSelectedAmount=()=>{let{partialTree:e}=this.plugin.getPluginState();return aa(e)};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||hn;if(o===!1)return c(ia,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:h,username:m,searchString:g}=this.plugin.getPluginState(),E=this.getBreadcrumbs();return c("div",{className:(0,Lm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[c(Ru,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:E,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:m,i18n:s}),n.showFilter&&c(Jr,{searchString:g,setSearchString:w=>{this.plugin.setPluginState({searchString:w})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(oa,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),c(nn,{partialTree:h,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Rm=be(nt(),1);var vS={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},wS={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},dn=class{static VERSION=sa.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...wS,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(vS)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){mi(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(pa(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(h=>h.type!=="root"),l=[o,...a,...n.items.map(h=>({type:"file",id:h.requestPath,status:"unchecked",parentId:null,data:h}))];this.plugin.setPluginState({partialTree:l})}catch(n){mi(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=ua(e);la(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=ca(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=pr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=e=>{let t=sn(e);return this.plugin.uppy.validateSingleFile(t)};getDisplayedPartialTree=()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")};setSearchString=e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?c(Jr,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):c("div",{className:(0,Rm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`),children:[l.showFilter&&c(Jr,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(oa,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),c(nn,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};function fa(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var Mm={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"4.2.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"^6.2.2",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Im={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var St={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var zu=be(nt(),1);var Du=be(Zo(),1);function Mu(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function Iu(i){let e=Mu(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var Nu=be(nt(),1);var ES="\xB7",Dm=()=>` ${ES} `;function Nm(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,Nu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===St.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),h=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return c("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0,children:h})}function Bm(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:c("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function Um(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function zm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return c("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function Hm(i){let{i18n:e,doneButtonHandler:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}function jm(){return c("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:c("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function qm(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return c("div",{className:"uppy-StatusBar-content",children:[c(jm,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}function TS(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,Du.default)(r);return c("div",{className:"uppy-StatusBar-statusSecondary",children:[a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),c("span",{className:"uppy-StatusBar-additionalInfo",children:[a&&Dm(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,Du.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),Dm(),n!=null&&o("xTimeLeft",{time:Iu(n)})]})]})}function $m(i){let{i18n:e,complete:t,numUploads:r}=i;return c("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}function xS(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Nu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return c("div",{className:"uppy-StatusBar-statusSecondary",children:[c("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),c("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}function Vm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:h,complete:m,totalUploadedSize:g,totalSize:E,totalETA:w,startUpload:F}=i,L=l&&n;if(!n||o)return null;let M=e(a?"paused":"uploading");function D(){return!a&&!L&&s?t?c(TS,{numUploads:h,complete:m,totalUploadedSize:g,totalSize:E,totalETA:w,i18n:e}):c($m,{i18n:e,complete:m,numUploads:h}):null}return c("div",{className:"uppy-StatusBar-content",title:M,children:[a?null:c(jm,{}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${M}: ${r}%`:M}),D(),L?c(xS,{i18n:e,newFiles:l,startUpload:F}):null]})]})}function Wm(i){let{i18n:e}=i;return c("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:c("div",{className:"uppy-StatusBar-status",children:c("div",{className:"uppy-StatusBar-statusPrimary",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:c("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function Gm(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
95
+ ${t.details}`),children:"?"})]})},t.message))})});install(){let{target:e}=this.opts;e&&this.mount(e,this)}};function aS(){return c("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",children:c("g",{fill:"none","fill-rule":"evenodd",children:[c("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),c("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),c("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),c("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),c("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),c("path",{d:"M4 4h18v18H4z"})]})})}function lS({pluginName:i,i18n:e,onAuth:t}){let r=i==="Google Drive",s=Bi(n=>{n.preventDefault(),t()},[t]);return c("form",{onSubmit:s,children:r?c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0,children:[c(aS,{}),e("signInWithGoogle")]}):c("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0,children:e("authenticateWith",{pluginName:i})})})}var cS=({pluginName:i,i18n:e,onAuth:t})=>c(lS,{pluginName:i,i18n:e,onAuth:t});function na({loading:i,pluginName:e,pluginIcon:t,i18n:r,handleAuth:s,renderForm:n=cS}){return c("div",{className:"uppy-Provider-auth",children:[c("div",{className:"uppy-Provider-authIcon",children:t()}),c("div",{className:"uppy-Provider-authTitle",children:r("authenticateWithTitle",{pluginName:e})}),n({pluginName:e,i18n:r,loading:i,onAuth:s})]})}function an(i){return{...i,type:i.mimeType,extension:i.name?br(i.name).extension:null}}var $m=Te(at(),1);var aa={name:"@uppy/provider-views",description:"View library for Uppy remote provider plugins.",version:"4.5.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",classnames:"^2.2.6",nanoid:"^5.0.9","p-queue":"^8.0.0",preact:"^10.5.13"},devDependencies:{"@types/gapi":"^0.0.47","@types/google.accounts":"^0.0.14","@types/google.picker":"^0.0.42",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var hS={position:"relative",width:"100%",minHeight:"100%"},dS={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},Pu=class extends ke{constructor(e){super(e),this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement?.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}handleScroll=()=>{this.setState({offset:this.base.scrollTop})};handleResize=()=>{this.resize()};resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render({data:e,rowHeight:t,renderRow:r,overscanCount:s=10,...n}){let{offset:o,height:a}=this.state,l=Math.floor(o/t),h=Math.floor(a/t);s&&(l=Math.max(0,l-l%s),h+=s);let f=l+h+4,m=e.slice(l,f),w={...hS,height:e.length*t},y={...dS,top:l*t};return c("div",{onScroll:this.handleScroll,...n,children:c("div",{role:"presentation",style:w,children:c("div",{role:"presentation",style:y,children:m.map(r)})})})}},la=Pu;var Am=Te(at(),1);function pS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58",children:c("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"})})}function fS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157",children:c("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"})})}function mS(){return c("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58",children:[c("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),c("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"})]})}function ts({itemIconString:i,alt:e=void 0}){if(i===null)return null;switch(i){case"file":return c(pS,{});case"folder":return c(fS,{});case"video":return c(mS,{});default:return c("img",{src:i,alt:e,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function gS({file:i,toggleCheckbox:e,className:t,isDisabled:r,restrictionError:s,showTitles:n,children:o=null,i18n:a}){return c("li",{className:t,title:r&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:e,name:"listitem",id:i.id,checked:i.status==="checked",disabled:r,"data-uppy-super-focusable":!0}),c("label",{htmlFor:i.id,"aria-label":i.data.name??a("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c(ts,{itemIconString:i.data.thumbnail||i.data.icon}),n&&(i.data.name??a("unnamed")),o]})]})}var Fu=gS;function Ou({file:i,openFolder:e,className:t,isDisabled:r,restrictionError:s,toggleCheckbox:n,showTitles:o,i18n:a}){return c("li",{className:t,title:i.status!=="checked"&&s?s:void 0,children:[c("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:n,name:"listitem",id:i.id,checked:i.status==="checked","aria-label":i.data.isFolder?a("allFilesFromFolderNamed",{name:i.data.name??a("unnamed")}):null,disabled:r,"data-uppy-super-focusable":!0}),i.data.isFolder?c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>e(i.id),"aria-label":a("openFolderNamed",{name:i.data.name??a("unnamed")}),children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(ts,{itemIconString:i.data.icon})}),o&&i.data.name?c("span",{children:i.data.name}):a("unnamed")]}):c("label",{htmlFor:i.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner",children:[c("div",{className:"uppy-ProviderBrowserItem-iconWrap",children:c(ts,{itemIconString:i.data.icon})}),o&&(i.data.name??a("unnamed"))]})]})}function Lu(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,h=!!l&&o.status!=="checked",f={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,Am.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":h},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:h,restrictionError:l};switch(e){case"grid":return c(Fu,{...f});case"list":return c(Ou,{...f});case"unsplash":return c(Fu,{...f,children:c("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1,children:o.data.author.name})});default:throw new Error(`There is no such type ${e}`)}}function bS(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:h,virtualList:f,utmSource:m}=i,[w,y]=Mt(!1);if(Vt(()=>{let P=R=>{R.key==="Shift"&&y(!1)},O=R=>{R.key==="Shift"&&y(!0)};return document.addEventListener("keyup",P),document.addEventListener("keydown",O),()=>{document.removeEventListener("keyup",P),document.removeEventListener("keydown",O)}},[]),a)return c("div",{className:"uppy-Provider-loading",children:typeof a=="string"?a:o("loading")});if(e.length===0)return c("div",{className:"uppy-Provider-empty",children:h});let _=P=>c(Lu,{viewType:t,toggleCheckbox:O=>{O.stopPropagation(),O.preventDefault(),document.getSelection()?.removeAllRanges(),r(P,w)},showTitles:n,i18n:o,openFolder:l,file:P,utmSource:m},P.id);return f?c("div",{className:"uppy-ProviderBrowser-body",children:c(la,{className:"uppy-ProviderBrowser-list",data:e,renderRow:_,rowHeight:35.5})}):c("div",{className:"uppy-ProviderBrowser-body",children:c("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,tabIndex:-1,children:e.map(_)})})}var ca=bS;var Pm=Te(at(),1);var yS=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,ua=yS;function ln({cancelSelection:i,donePicking:e,i18n:t,partialTree:r,validateAggregateRestrictions:s}){let n=Ni(()=>s(r),[r,s]),o=Ni(()=>ua(r),[r]);return o===0?null:c("div",{className:"uppy-ProviderBrowser-footer",children:[c("div",{className:"uppy-ProviderBrowser-footer-buttons",children:[c("button",{className:(0,Pm.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":n}),disabled:!!n,onClick:e,type:"button",children:t("selectX",{smart_count:o})}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:i,type:"button",children:t("cancel")})]}),n&&c("div",{className:"uppy-ProviderBrowser-footer-error",children:n})]})}function vS({searchString:i,setSearchString:e,submitSearchString:t,wrapperClassName:r,inputClassName:s,inputLabel:n,clearSearchLabel:o="",showButton:a=!1,buttonLabel:l="",buttonCSSClassName:h=""}){let f=y=>{e(y.target.value)},m=Bi(y=>{y.preventDefault(),t()},[t]),[w]=Mt(()=>{let y=document.createElement("form");return y.setAttribute("tabindex","-1"),y.id=Ui(),y});return Vt(()=>(document.body.appendChild(w),w.addEventListener("submit",m),()=>{w.removeEventListener("submit",m),document.body.removeChild(w)}),[w,m]),c("section",{className:r,children:[c("input",{className:`uppy-u-reset ${s}`,type:"search","aria-label":n,placeholder:n,value:i,onInput:f,form:w.id,"data-uppy-super-focusable":!0}),!a&&c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12",children:c("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})}),!a&&i&&c("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":o,title:o,onClick:()=>e(""),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19",children:c("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})})}),a&&c("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${h}`,type:"submit",form:w.id,children:l})]})}var is=vS;var wS=(i,e,t)=>({id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:i.author?.name,authorUrl:i.author?.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}),Fm=wS;var SS=(i,e,t)=>{let r=i.map(o=>Fm(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(Qo(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},ha=SS;var ES=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},da=ES;var TS=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},vi=TS;var xS=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},Om=xS;var Lm=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...Lm(i,s.parentId,t),s];return t[r]=n,n},kS=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=Lm(i,s.id,e),o=n.findIndex(f=>f.type==="folder"&&f.status==="checked"),a=n.slice(o),l=`/${n.map(f=>f.data.name).join("/")}`,h=a.length===1?void 0:a.map(f=>f.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:h}})},pa=kS;var Mu=Te(Mm(),1);var un=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Du=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Dm=i=>globalThis.DOMException===void 0?new Du(i):new DOMException(i),Im=i=>{let e=i.reason===void 0?Dm("This operation was aborted."):i.reason;return e instanceof Error?e:Dm(e)};function Iu(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,h=new Promise((f,m)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:y}=e;y.aborted&&m(Im(y)),a=()=>{m(Im(y))},y.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(f,m);return}let w=new un;o=n.setTimeout.call(void 0,()=>{if(r){try{f(r())}catch(y){m(y)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?f():s instanceof Error?m(s):(w.message=s??`Promise timed out after ${t} milliseconds`,m(w))},t),(async()=>{try{f(await i)}catch(y){m(y)}})()}).finally(()=>{h.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return h.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},h}function Nu(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var hn=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=Nu(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var dn=class extends Mu.default{#e;#t;#i=0;#r;#s;#a=0;#n;#l;#o;#f;#c=0;#h;#u;#p;#m=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:hn,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#r=e.intervalCap,this.#s=e.interval,this.#o=new e.queueClass,this.#f=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=e.throwOnTimeout===!0,this.#u=e.autoStart===!1}get#d(){return this.#t||this.#i<this.#r}get#y(){return this.#c<this.#h}#g(){this.#c--,this.#S(),this.emit("next")}#v(){this.#x(),this.#b(),this.#l=void 0}get#T(){let e=Date.now();if(this.#n===void 0){let t=this.#a-e;if(t<0)this.#i=this.#e?this.#c:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#v()},t)),!0}return!1}#S(){if(this.#o.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#c===0&&this.emit("idle"),!1;if(!this.#u){let e=!this.#T;if(this.#d&&this.#y){let t=this.#o.dequeue();return t?(this.emit("active"),t(),e&&this.#b(),!0):!1}}return!1}#b(){this.#t||this.#n!==void 0||(this.#n=setInterval(()=>{this.#x()},this.#s),this.#a=Date.now()+this.#s)}#x(){this.#i===0&&this.#c===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#i=this.#e?this.#c:0,this.#w()}#w(){for(;this.#S(););}get concurrency(){return this.#h}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#h=e,this.#w()}async#_(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#o.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#m++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise((r,s)=>{this.#o.enqueue(async()=>{this.#c++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=Iu(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#_(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof un&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#g()}},t),this.emit("add"),this.#S()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#u?(this.#u=!1,this.#w(),this):this}pause(){this.#u=!0}clear(){this.#o=new this.#f}async onEmpty(){this.#o.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#o.size<e||await this.#E("next",()=>this.#o.size<e)}async onIdle(){this.#c===0&&this.#o.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#o.size}sizeBy(e){return this.#o.filter(e).length}get pending(){return this.#c}get isPaused(){return this.#u}};var AS=i=>i.map(e=>({...e})),ma=AS;var Nm=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let m=await r(o);n=n.concat(m.items),o=m.nextPagePath}let a=n.filter(m=>m.isFolder===!0),l=n.filter(m=>m.isFolder===!1),h=a.map(m=>({type:"folder",id:m.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:m})),f=l.map(m=>{let w=s(m);return{type:"file",id:m.requestPath,restrictionError:w,status:w?"unchecked":"checked",parentId:t.id,data:m}});t.cached=!0,t.nextPagePath=null,e.push(...f,...h),h.forEach(async m=>{i.add(()=>Nm(i,e,m,r,s))})},PS=async(i,e,t,r)=>{let s=new dn({concurrency:6}),n=ma(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>Nm(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},Bm=PS;var FS=(i,e,t,r,s)=>{let n=e.filter(y=>y.isFolder===!0),o=e.filter(y=>y.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(y=>({type:"folder",id:y.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:y})),h=o.map(y=>{let _=s(y);return{type:"file",id:y.requestPath,restrictionError:_,status:a&&!_?"checked":"unchecked",parentId:t.id,data:y}}),f={...t,cached:!0,nextPagePath:r};return[...i.map(y=>y.id===f.id?f:y),...l,...h]},Um=FS;var OS=(i,e,t,r,s)=>{let n=i.find(_=>_.id===e),o=t.filter(_=>_.isFolder===!0),a=t.filter(_=>_.isFolder===!1),l={...n,nextPagePath:r},h=i.map(_=>_.id===l.id?l:_),f=l.type==="folder"&&l.status==="checked",m=o.map(_=>({type:"folder",id:_.requestPath,cached:!1,nextPagePath:null,status:f?"checked":"unchecked",parentId:l.id,data:_})),w=a.map(_=>{let P=s(_);return{type:"file",id:_.requestPath,restrictionError:P,status:f&&!P?"checked":"unchecked",parentId:l.id,data:_}});return[...h,...m,...w]},zm=OS;var Bu=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",Bu(i,s.id,t)})},Uu=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",Uu(i,t.parentId)},LS=(i,e)=>{let t=ma(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{Bu(t,s.id,!0)}),Uu(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",Bu(t,r.id,r.status==="checked"),Uu(t,r.parentId)}return t},Hm=LS;var yr={afterOpenFolder:Um,afterScrollFolder:zm,afterToggleCheckbox:Hm,afterFill:Bm};var RS=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},ga=RS;var jm=Te(at(),1);function zu(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return c("div",{className:"uppy-Provider-breadcrumbs",children:[c("div",{className:"uppy-Provider-breadcrumbsIcon",children:r}),s.map((o,a)=>c(Ae,{children:[c("button",{type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id),children:o.type==="root"?t:o.data.name??n("unnamed")},o.id),s.length===a+1?"":" / "]}))]})}function Hu({i18n:i,logout:e,username:t}){return c(Ae,{children:[t&&c("span",{className:"uppy-ProviderBrowser-user",children:t},"username"),c("button",{type:"button",onClick:e,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",children:i("logOut")},"logout")]})}function ju(i){return c("div",{className:"uppy-ProviderBrowser-header",children:c("div",{className:(0,jm.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple"),children:[i.showBreadcrumbs&&c(zu,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon?.(),title:i.title,i18n:i.i18n}),c(Hu,{logout:i.logout,username:i.username,i18n:i.i18n})]})})}function fn(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:c("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}var qm=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),pn=class{static VERSION=aa.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(qm(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}#e;async#t(e){this.#e?.abort();let t=new AbortController;this.#e=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await e(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),this.#e=void 0}}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await this.#t(async s=>{let n=e,o=[];do{let{username:l,nextPagePath:h,items:f}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=h,o=o.concat(f),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=yr.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(vi(this.plugin.uppy)),this.setLoading(!1)}async logout(){await this.#t(async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...qm(this.plugin.rootFolderId),authenticated:!1})}}).catch(vi(this.plugin.uppy))}async handleAuth(e){await this.#t(async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(vi(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);ga(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await this.#t(async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=yr.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(vi(this.plugin.uppy)),this.isHandlingScroll=!1)}validateSingleFile=e=>{let t=an(e);return this.plugin.uppy.validateSingleFile(t)};async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await this.#t(async t=>{let r=await yr.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=pa(r);ha(n,this.plugin,this.provider),this.resetPluginState()}).catch(vi(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=da(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=yr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}getDisplayedPartialTree=()=>{let{partialTree:e,currentFolderId:t,searchString:r}=this.plugin.getPluginState(),s=e.filter(o=>o.type!=="root"&&o.parentId===t);return r===""?s:s.filter(o=>(o.data.name??this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(r.toLowerCase())!==-1)};getBreadcrumbs=()=>{let{partialTree:e,currentFolderId:t}=this.plugin.getPluginState();return Om(e,t)};getSelectedAmount=()=>{let{partialTree:e}=this.plugin.getPluginState();return ua(e)};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||fn;if(o===!1)return c(na,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:h,username:f,searchString:m}=this.plugin.getPluginState(),w=this.getBreadcrumbs();return c("div",{className:(0,$m.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`),children:[c(ju,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:w,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&c(is,{searchString:m,setSearchString:y=>{this.plugin.setPluginState({searchString:y})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(ca,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),c(ln,{partialTree:h,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};var Vm=Te(at(),1);var MS={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},DS={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},mn=class{static VERSION=aa.version;plugin;provider;opts;isHandlingScroll=!1;lastCheckbox=null;constructor(e,t){this.plugin=e,this.provider=t.provider,this.opts={...DS,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(MS)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){vi(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(ga(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(h=>h.type!=="root"),l=[o,...a,...n.items.map(h=>({type:"file",id:h.requestPath,status:"unchecked",parentId:null,data:h}))];this.plugin.setPluginState({partialTree:l})}catch(n){vi(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=pa(e);ha(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=da(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=yr.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}validateSingleFile=e=>{let t=an(e);return this.plugin.uppy.validateSingleFile(t)};getDisplayedPartialTree=()=>{let{partialTree:e}=this.plugin.getPluginState();return e.filter(t=>t.type!=="root")};setSearchString=e=>{this.plugin.setPluginState({searchString:e}),e===""&&this.plugin.setPluginState({partialTree:[]})};validateAggregateRestrictions=e=>{let r=e.filter(s=>s.type==="file"&&s.status==="checked").map(s=>s.data);return this.plugin.uppy.validateAggregateRestrictions(r)};render(e,t={}){let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?c(is,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):c("div",{className:(0,Vm.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`),children:[l.showFilter&&c(is,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),c(ca,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),c(ln,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions})]})}};function ba(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var Wm={name:"@uppy/status-bar",description:"A progress bar for Uppy, with many bells and whistles.",version:"4.2.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","uppy","uppy-plugin","progress bar","status bar","progress","upload","eta","speed"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/utils":"^6.2.2",classnames:"^2.2.6",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Gm={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};var kt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var Yu=Te(at(),1);var Vu=Te(ea(),1);function qu(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function $u(i){let e=qu(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var Wu=Te(at(),1);var NS="\xB7",Km=()=>` ${NS} `;function Ym(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,Wu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===kt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),h=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return c("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0,children:h})}function Xm(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:c("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function Zm(i){let{i18n:e,uppy:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function Qm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return c("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:c("g",{fill:"none",fillRule:"evenodd",children:[c("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),c("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function Jm(i){let{i18n:e,doneButtonHandler:t}=i;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0,children:e("done")})}function eg(){return c("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:c("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function tg(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return c("div",{className:"uppy-StatusBar-content",children:[c(eg,{}),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s]})}function BS(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,Vu.default)(r);return c("div",{className:"uppy-StatusBar-statusSecondary",children:[a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),c("span",{className:"uppy-StatusBar-additionalInfo",children:[a&&Km(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,Vu.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),Km(),n!=null&&o("xTimeLeft",{time:$u(n)})]})]})}function ig(i){let{i18n:e,complete:t,numUploads:r}=i;return c("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:t,smart_count:r})})}function US(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,Wu.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return c("div",{className:"uppy-StatusBar-statusSecondary",children:[c("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:t})}),c("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r,children:e("upload")})]})}function rg(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,startUpload:_}=i,P=l&&n;if(!n||o)return null;let O=e(a?"paused":"uploading");function R(){return!a&&!P&&s?t?c(BS,{numUploads:h,complete:f,totalUploadedSize:m,totalSize:w,totalETA:y,i18n:e}):c(ig,{i18n:e,complete:f,numUploads:h}):null}return c("div",{className:"uppy-StatusBar-content",title:O,children:[a?null:c(eg,{}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:t&&r!==0?`${O}: ${r}%`:O}),R(),P?c(US,{i18n:e,newFiles:l,startUpload:_}):null]})]})}function sg(i){let{i18n:e}=i;return c("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:c("div",{className:"uppy-StatusBar-status",children:c("div",{className:"uppy-StatusBar-statusPrimary",children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:c("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function ng(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
96
96
 
97
- ${e}`;alert(o)}return c("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),c("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),c($m,{i18n:t,complete:r,numUploads:s})]})]})}function pn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var{STATE_ERROR:Km,STATE_WAITING:kS,STATE_PREPROCESSING:Bu,STATE_UPLOADING:ma,STATE_POSTPROCESSING:Uu,STATE_COMPLETE:ga}=St;function Hu({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:o=void 0,hidePauseResumeButton:a=!1,hideCancelButton:l=!1,hideRetryButton:h=!1,recoveredState:m,uploadState:g,totalProgress:E,files:w,supportsUploadProgress:F,hideAfterFinish:L=!1,isSomeGhost:M,doneButtonHandler:D=void 0,isUploadStarted:A,i18n:R,startUpload:T,uppy:x,isAllComplete:P,showProgressDetails:I=void 0,numUploads:B,complete:U,totalSize:j,totalETA:q,totalUploadedSize:W}){function te(){switch(g){case Uu:case Bu:{let Me=pn(w);return Me.mode==="determinate"?Me.value*100:E}case Km:return null;case ma:return F?E:null;default:return E}}function ae(){switch(g){case Uu:case Bu:{let{mode:Me}=pn(w);return Me==="indeterminate"}case ma:return!F;default:return!1}}let xe=te(),he=xe??100,Ce=!n&&i&&(!t&&!r||m)&&e&&!o,pe=!l&&g!==kS&&g!==ga,et=s&&!a&&g===ma,Ot=n&&!P&&!h,ee=D&&g===ga,mt=(0,zu.default)("uppy-StatusBar-progress",{"is-indeterminate":ae()}),lt=(0,zu.default)("uppy-StatusBar",`is-${g}`,{"has-ghosts":M}),Qe=(()=>{switch(g){case Bu:case Uu:return c(qm,{progress:pn(w)});case ga:return c(Wm,{i18n:R});case Km:return c(Gm,{error:n,i18n:R,numUploads:B,complete:U});case ma:return c(Vm,{i18n:R,supportsUploadProgress:F,totalProgress:E,showProgressDetails:I,isUploadStarted:A,isAllComplete:P,isAllPaused:r,newFiles:i,numUploads:B,complete:U,totalUploadedSize:W,totalSize:j,totalETA:q,startUpload:T});default:return null}})();return!(Ce||Ot||et||pe||ee)&&!Qe||g===ga&&L?null:c("div",{className:lt,children:[c("div",{className:mt,style:{width:`${he}%`},role:"progressbar","aria-label":`${he}%`,"aria-valuetext":`${he}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":xe}),Qe,c("div",{className:"uppy-StatusBar-actions",children:[Ce?c(Nm,{newFiles:i,isUploadStarted:A,recoveredState:m,i18n:R,isSomeGhost:M,startUpload:T,uploadState:g}):null,Ot?c(Bm,{i18n:R,uppy:x}):null,et?c(zm,{isAllPaused:r,i18n:R,isAllComplete:P,resumableUploads:s,uppy:x}):null,pe?c(Um,{i18n:R,uppy:x}):null,ee?c(Hm,{i18n:R,doneButtonHandler:D}):null]})]})}var _S=2e3,CS=2e3;function AS(i,e,t,r){if(i)return St.STATE_ERROR;if(e)return St.STATE_COMPLETE;if(t)return St.STATE_WAITING;let s=St.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return St.STATE_UPLOADING;a.preprocess&&(s=St.STATE_PREPROCESSING),a.postprocess&&s!==St.STATE_PREPROCESSING&&(s=St.STATE_POSTPROCESSING)}return s}var PS={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},es=class extends Vt{static VERSION=Mm.version;#e;#t;#i;#r;constructor(e,t){super(e,{...PS,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Im,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#n(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#r??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#r??0)/100)/10;let n=s/r,o=this.#i==null?n:fa(n,this.#i,_S,r);this.#i=o;let a=t/o,l=Math.max(this.#r-r,0),h=this.#r==null?a:fa(a,l,CS,r);return this.#r=h,this.#e=performance.now(),Math.round(h/100)/10}startUpload=()=>this.uppy.upload().catch((()=>{}));render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:h,completeFiles:m,isUploadStarted:g,isAllComplete:E,isAllPaused:w,isUploadInProgress:F,isSomeGhost:L}=this.uppy.getObjectOfFilesPerState(),M=a?Object.values(r):l,D=!!t.resumableUploads,A=t.uploadProgress!==!1,R=null,T=0;h.every(P=>P.progress.bytesTotal!=null&&P.progress.bytesTotal!==0)?(R=0,h.forEach(P=>{R+=P.progress.bytesTotal||0,T+=P.progress.bytesUploaded||0})):h.forEach(P=>{T+=P.progress.bytesUploaded||0});let x=this.#n({uploaded:T,total:R});return Hu({error:o,uploadState:AS(o,E,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:R,totalUploadedSize:T,isAllComplete:!1,isAllPaused:w,isUploadStarted:g,isUploadInProgress:F,isSomeGhost:L,recoveredState:a,complete:m.length,newFiles:M.length,numUploads:h.length,totalETA:x,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:D,supportsUploadProgress:A,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;qo(e)||(e.dir="ltr")}#o=()=>{let{recoveredState:e}=this.uppy.getState();if(this.#i=null,this.#r=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0};install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#o),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#o)}};var FS=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function OS(i,e,t){let r=FS.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let o=atob(decodeURIComponent(r[3])),a=new Uint8Array(o.length);for(let l=0;l<o.length;l++)a[l]=o.charCodeAt(l);n=[a]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}var Ym=OS;function ba(i){return i.startsWith("blob:")}function ya(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function oe(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var sg=typeof self<"u"?self:global,bn=typeof navigator<"u",LS=bn&&typeof HTMLImageElement>"u",Xm=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),ng=sg.Buffer,og=!!ng,RS=i=>i!==void 0;function ag(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(RS).length===0)}function qe(i){let e=new Error(i);throw delete e.stack,e}function Zm(i){let e=(function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048})(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var ju=i=>String.fromCharCode.apply(null,i),Qm=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,mr=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&qe("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else qe("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||qe("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),Qm?Qm.decode(s):og?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(ju(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return ju(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return ju(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function $u(i,e){qe(`${i} '${e}' was not loaded, try using full build of exifr.`)}var yn=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||$u(this.kind,e),t&&(e in t||(function(r,s){qe(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||$u(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},Ta=new yn("file parser"),Et=new yn("segment parser"),Sn=new yn("file reader"),MS=sg.fetch;function Jm(i,e){return(t=i).startsWith("data:")||t.length>1e4?Wu(i,e,"base64"):Xm&&i.includes("://")?Vu(i,e,"url",va):Xm?Wu(i,e,"fs"):bn?Vu(i,e,"url",va):void qe("Invalid input argument");var t}async function Vu(i,e,t,r){return Sn.has(t)?Wu(i,e,t):r?(async function(s,n){let o=await n(s);return new mr(o)})(i,r):void qe(`Parser ${t} is not loaded`)}async function Wu(i,e,t){let r=new(Sn.get(t))(i,e);return await r.read(),r}var va=i=>MS(i).then((e=>e.arrayBuffer())),vn=i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),Gu=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function lg(i,e,t){let r=new Gu;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function cg(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var En=new Map,Qu=new Map,Ju=new Map,ts=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],xa=["jfif","xmp","icc","iptc","ihdr"],wn=["tiff",...xa],Re=["ifd0","ifd1","exif","gps","interop"],is=[...wn,...Re],rs=["makerNote","userComment"],ka=["translateKeys","translateValues","reviveValues","multiSegment"],ss=[...ka,"sanitize","mergeOutput","silentErrors"],wa=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},fr=class extends wa{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),oe(this,"enabled",!1),oe(this,"skip",new Set),oe(this,"pick",new Set),oe(this,"deps",new Set),oe(this,"translateKeys",!1),oe(this,"translateValues",!1),oe(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Re.includes(e),this.canBeFiltered&&(this.dict=En.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:qe(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of ka)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,Sa(this.pick,this.deps)):this.enabled&&this.pick.size>0&&Sa(this.pick,this.deps)}},at={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},eg=new Map,gr=class extends wa{static useCached(e){let t=eg.get(e);return t!==void 0||(t=new this(e),eg.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):qe(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=bn?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of ts)this[e]=at[e];for(e of ss)this[e]=at[e];for(e of rs)this[e]=at[e];for(e of is)this[e]=new fr(e,at[e],void 0,this)}setupFromTrue(){let e;for(e of ts)this[e]=at[e];for(e of ss)this[e]=at[e];for(e of rs)this[e]=!0;for(e of is)this[e]=new fr(e,!0,void 0,this)}setupFromArray(e){let t;for(t of ts)this[t]=at[t];for(t of ss)this[t]=at[t];for(t of rs)this[t]=at[t];for(t of is)this[t]=new fr(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Re)}setupFromObject(e){let t;for(t of(Re.ifd0=Re.ifd0||Re.image,Re.ifd1=Re.ifd1||Re.thumbnail,Object.assign(this,e),ts))this[t]=qu(e[t],at[t]);for(t of ss)this[t]=qu(e[t],at[t]);for(t of rs)this[t]=qu(e[t],at[t]);for(t of wn)this[t]=new fr(t,at[t],e[t],this);for(t of Re)this[t]=new fr(t,at[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Re,is),e.tiff===!0?this.batchEnableWithBool(Re,!0):e.tiff===!1?this.batchEnableWithUserValue(Re,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Re):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Re)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=tg(e,r);for(let[o,a]of n)Sa(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=tg(t,r);for(let[o,a]of n)Sa(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Re.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of Re)this[n].finalizeFilters()}get onlyTiff(){return!xa.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of wn)this[e].enabled&&!Et.has(e)&&$u("segment parser",e)}};function tg(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=En.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function qu(i,e){return i!==void 0?i:e!==void 0?e:void 0}function Sa(i,e){for(let t of e)i.add(t)}oe(gr,"default",at);var ns=class{constructor(e){oe(this,"parsers",{}),oe(this,"output",{}),oe(this,"errors",[]),oe(this,"pushToErrors",(t=>this.errors.push(t))),this.options=gr.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?Jm(t,r):bn&&!LS&&t instanceof HTMLImageElement?Jm(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new mr(t):bn&&t instanceof Blob?Vu(t,r,"blob",vn):void qe("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of Ta)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),qe("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),ag(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async r=>{let s=await r.parse();r.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((r=>r.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=Et.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function ug(i,e){let t=new ns(e);return await t.read(i),t.parse()}var IS=Object.freeze({__proto__:null,parse:ug,Exifr:ns,fileParsers:Ta,segmentParsers:Et,fileReaders:Sn,tagKeys:En,tagValues:Qu,tagRevivers:Ju,createDictionary:lg,extendDictionary:cg,fetchUrlAsArrayBuffer:va,readBlobAsArrayBuffer:vn,chunkedProps:ts,otherSegments:xa,segments:wn,tiffBlocks:Re,segmentsAndBlocks:is,tiffExtractables:rs,inheritables:ka,allFormatters:ss,Options:gr}),Bi=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new gr({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof mr?e:new mr(e)}constructor(e,t={},r){oe(this,"errors",[]),oe(this,"raw",new Map),oe(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=Ju.get(t),s=Qu.get(t),n=En.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,h=o.translateKeys&&!!n,m={};for(let[g,E]of e)a&&r.has(g)?E=r.get(g)(E):l&&s.has(g)&&(E=this.translateValue(E,s.get(g))),h&&n.has(g)&&(g=n.get(g)||g),m[g]=E;return m}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};oe(Bi,"headerLength",4),oe(Bi,"type",void 0),oe(Bi,"multiSegment",!1),oe(Bi,"canHandle",(()=>!1));function DS(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function NS(i){return i>=224&&i<=239}function BS(i,e,t){for(let[r,s]of Et)if(s.canHandle(i,e,t))return r}var Ea=class extends class{constructor(e,t,r){oe(this,"errors",[]),oe(this,"ensureSegmentChunk",(async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){qe(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):qe("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(Et.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),oe(this,"appSegments",[]),oe(this,"jpegSegments",[]),oe(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(Et.keyList())):(e=e===void 0?Et.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&Et.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((a=>{let l=Et.get(a),h=this.options[a];return l.multiSegment&&h.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,h=this.appSegments.some((m=>!this.file.available(m.offset||m.start,m.length||m.size)));if(a=e>l&&!h?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:h,findAll:m,wanted:g,remaining:E,options:w}=this;for(;e<t;e++)if(h.getUint8(e)===255){if(r=h.getUint8(e+1),NS(r)){if(s=h.getUint16(e+2),n=BS(h,e,s),n&&g.has(n)&&(o=Et.get(n),a=o.findPosition(h,e),l=w[n],a.type=n,this.appSegments.push(a),!m&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||E.delete(n)):E.delete(n),E.size===0)))break;w.recordUnknownSegments&&(a=Bi.findPosition(h,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(DS(r)){if(s=h.getUint16(e+2),r===218&&w.stopAfterSos!==!1)return;w.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,r])=>{let s=Et.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};oe(Ea,"type","jpeg"),Ta.set("jpeg",Ea);var US=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Ku=class extends Bi{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let h=0;h<l;h++){let m=this.chunk.getUint16(e);if(o){if(s.has(m)&&(r.set(m,this.parseTag(e,m,t)),s.delete(m),s.size===0))break}else!a&&n.has(m)||r.set(m,this.parseTag(e,m,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=US[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&qe(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&qe(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=(function(h){for(;h.endsWith("\0");)h=h.slice(0,-1);return h})(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let h=new((function(g){switch(g){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(o),m=a;for(let g=0;g<o;g++)h[g]=this.parseTagValue(n,e),e+=m;return h}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:qe(`Invalid tiff type ${e}`)}}},gn=class extends Ku{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&qe("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&qe(`IFD0 offset points to outside of file.
98
- this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Zm(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,Zm(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",ig(...e.get(2),e.get(1))),e.set("longitude",ig(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Re)if(e=this[t],!ag(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function ig(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}oe(gn,"type","tiff"),oe(gn,"headerLength",10),Et.set("tiff",gn);var cO=Object.freeze({__proto__:null,default:IS,Exifr:ns,fileParsers:Ta,segmentParsers:Et,fileReaders:Sn,tagKeys:En,tagValues:Qu,tagRevivers:Ju,createDictionary:lg,extendDictionary:cg,fetchUrlAsArrayBuffer:va,readBlobAsArrayBuffer:vn,chunkedProps:ts,otherSegments:xa,segments:wn,tiffBlocks:Re,segmentsAndBlocks:is,tiffExtractables:rs,inheritables:ka,allFormatters:ss,Options:gr,parse:ug}),eh={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},uO=Object.assign({},eh,{firstChunkSize:4e4,gps:[1,2,3,4]});var hO=Object.assign({},eh,{tiff:!1,ifd1:!0,mergeOutput:!1});var zS=Object.assign({},eh,{firstChunkSize:4e4,ifd0:[274]});async function HS(i){let e=new ns(zS);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var jS=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),fn=!0,mn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;fn=Number(t)+.1*Number(r)<13.4,mn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);fn=mn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);fn=mn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);fn=mn=Number(e)<77}}async function hg(i){let e=await HS(i);return Object.assign({canvas:fn,css:mn},jS[e])}var Yu=class extends mr{constructor(...e){super(...e),oe(this,"ranges",new Xu),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=og?ng.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},Xu=class{constructor(){oe(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((o=>rg(e,o.offset,s)||rg(e,o.end,s)));if(n.length>0){e=Math.min(e,...n.map((a=>a.offset))),s=Math.max(s,...n.map((a=>a.end))),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter((a=>!n.includes(a)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function rg(i,e,t){return i<=e&&e<=t}var Zu=class extends Yu{constructor(e,t){super(0),oe(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};Sn.set("blob",class extends Zu{async readWhole(){this.chunked=!1;let i=await vn(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await vn(r);return this.set(s,i,!0)}});var dg={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"4.2.3",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var pg={strings:{generatingThumbnails:"Generating thumbnails..."}};function $S(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Ym(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function VS(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function WS(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var GS={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},Tn=class extends Vt{static VERSION=dg.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...GS,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=pg,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let h=new Image;h.src=s,h.addEventListener("load",()=>{URL.revokeObjectURL(s),a(h)}),h.addEventListener("error",m=>{URL.revokeObjectURL(s),l(m.error||new Error("Could not create thumbnail"))})}),o=hg(e.data).catch(()=>1);return Promise.all([n,o]).then(([a,l])=>{let h=this.getProportionalDimensions(a,t,r,l.deg),m=VS(a,l),g=this.resizeImage(m,h.width,h.height);return $S(g,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let o=t;return e.width<t&&(o=e.width),{width:o,height:Math.round(o/n)}}if(r!=null){let o=r;return e.height<r&&(o=e.height),{width:Math.round(o*n),height:o}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=WS(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let h=document.createElement("canvas");h.width=o,h.height=a,h.getContext("2d").drawImage(s,0,0,o,a),s=h,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return ya(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=e=>{!e.preview&&e.data&&ya(e.type)&&!e.isRemote&&this.addToQueue(e.id)};onCancelRequest=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)};onFileRemoved=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&ba(e.preview)&&URL.revokeObjectURL(e.preview)};onRestored=()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||ba(t.preview))&&this.addToQueue(t.id)})};onAllFilesRemoved=()=>{this.queue=[]};waitUntilAllProcessed=e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})};return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})};install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};function KS(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&$s(i)?[i]:null}var th=KS;var Ui=Array.from;function ih(i){let e=Ui(i.files);return Promise.resolve(e)}function _a(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{_a(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}function fg(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{_a(t,[],e,{onSuccess:n=>s(n.map(o=>fg(o,e)))})})},isSameEntry:void 0}}async function*mg(i,e,t=void 0){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*mg(s,e?r():i.name);else t!=null&&(yield t)}async function*rh(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=fg(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*mg(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}async function sh(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of rh(i,t))r.push(s);return r}catch{return ih(i)}}var gg={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"4.4.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest watch --project browser --browser.headless false"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/informer":"^4.3.2","@uppy/provider-views":"^4.5.2","@uppy/status-bar":"^4.2.3","@uppy/thumbnail-generator":"^4.2.2","@uppy/utils":"^6.2.2",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"^4.5.2","@uppy/google-drive":"^4.4.2","@uppy/status-bar":"^4.2.3","@uppy/url":"^4.3.2","@uppy/webcam":"^4.3.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.2"}};function nh(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var Mg=be(nt(),1);var oh=class extends ve{fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=()=>{this.fileInput?.click()};triggerFolderInputClick=()=>{this.folderInput?.click()};triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput?.click()};triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput?.click()};onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""};renderHiddenInput=(e,t)=>c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t});renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})};renderMyDeviceAcquirer=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})});renderPhotoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})});renderVideoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})});renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})};renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return c("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})};[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=e=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id),children:[c("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),c("div",{className:"uppy-DashboardTab-name",children:e.name})]})});renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return c(Te,{children:[t.map(s=>this.renderAcquirer(s)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})};renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(m=>({key:m.id,elements:this.renderAcquirer(m)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],h=l.splice(n.length-2,n.length);return c(Te,{children:[this.renderDropPasteBrowseTagline(n.length),c("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[l.map(({key:m,elements:g})=>c(Te,{children:g},m)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:h.map(({key:m,elements:g})=>c(Te,{children:g},m))})]})]})};renderPoweredByUppy(){let{i18nArray:e}=this.props,t=c("span",{children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),c("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return c("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return c("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),c("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&c("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},Ca=oh;var bg=be(nt(),1);var XS=i=>c("div",{className:(0,bg.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1),children:i.i18n("back")})]}),c(Ca,{...i})]}),yg=XS;var vg=be(nt(),1);function ZS(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return c("div",{className:(0,vg.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),c("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),c("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}var wg=ZS;var Sg=be(nt(),1);function QS(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#686DE0",fillRule:"evenodd",children:[c("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),c("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),c("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function JS(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function eE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function tE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function iE(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function rE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[c("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),c("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function sE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function br(i){let e={color:"#838999",icon:rE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:sE()}:t==="image"?{color:"#686de0",icon:QS()}:t==="audio"?{color:"#068dbb",icon:JS()}:t==="video"?{color:"#19af67",icon:eE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:tE()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:iE()}:e}function nE(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var Jt=nE;function xn(i){let{file:e}=i;if(e.preview)return c("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=br(e.type);return c("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[c("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:c("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function ah(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,h=t.includes(a.id);return c("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[c("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l,children:a.name}),a.render!==void 0?a.render({value:n[a.id],onChange:m=>r(m,a.id),fieldCSSClasses:o,required:h,form:s.id},fi):c("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:h,value:n[a.id],placeholder:a.placeholder,onInput:m=>r(m.target.value,a.id),"data-uppy-super-focusable":!0})]},a.id)})}function lh(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:o,openFileEditor:a,i18n:l,i18nArray:h,className:m,canEditFile:g}=i,E=()=>typeof n=="function"?n(e[t]):n,w=e[t],F=E()??[],L=g(w),M={};F.forEach(I=>{M[I.id]=w.meta[I.id]??""});let[D,A]=Ft(M),R=Di(I=>{I.preventDefault(),s(D,t)},[s,D,t]),T=(I,B)=>{A({...D,[B]:I})},x=()=>{r(!1)},[P]=Ft(()=>{let I=document.createElement("form");return I.setAttribute("tabindex","-1"),I.id=Ni(),I});return $t(()=>(document.body.appendChild(P),P.addEventListener("submit",R),()=>{P.removeEventListener("submit",R),document.body.removeChild(P)}),[P,R]),c("div",{className:(0,Sg.default)("uppy-Dashboard-FileCard",m),"data-uppy-panelType":"FileCard",onDragOver:Jt,onDragLeave:Jt,onDrop:Jt,onPaste:Jt,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:h("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:w.meta?w.meta.name:w.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",form:P.id,title:l("finishEditingFile"),onClick:x,children:l("cancel")})]}),c("div",{className:"uppy-Dashboard-FileCard-inner",children:[c("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:br(w.type).color},children:[c(xn,{file:w}),L&&c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:I=>{R(I),a(w)},children:l("editImage")})]}),c("div",{className:"uppy-Dashboard-FileCard-info",children:c(ah,{computedMetaFields:F,requiredMetaFields:o,updateMeta:T,form:P,formState:D})}),c("div",{className:"uppy-Dashboard-FileCard-actions",children:[c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:P.id,children:l("saveChanges")}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:x,form:P.id,children:l("cancel")})]})]})]})}var kg=be(nt(),1);function Eg(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function ch(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function oE({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:()=>n(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:c("g",{fillRule:"evenodd",children:[c("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),c("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),c("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function aE({i18n:i,onClick:e,file:t}){return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:()=>e(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[c("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),c("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function lE({file:i,uppy:e,i18n:t}){let r=s=>{ch(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))};return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:s=>r(s),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:c("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function uh(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:h,openFileEditor:m}=i;return c("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[c(oE,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?h(!0,t.id):m(t)}}),o&&t.uploadURL?c(lE,{file:t,uppy:e,i18n:l}):null,a?c(aE,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null]})}var Tg=be(Zo(),1);function Aa(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}var cE=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function kn(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let o=n.map(a=>cE(a,s)).join(", ");return c("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",c("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id),children:r("editFile")})]})}var uE=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return c("div",{className:"uppy-Dashboard-Item-name",title:t,children:Aa(t,r())})},hE=i=>{let{author:e}=i.file.meta,t=i.file.remote?.providerName,r="\xB7";return e?c("div",{className:"uppy-Dashboard-Item-author",children:[c("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Aa(e.name,13)}),t?c(Te,{children:[` ${r} `,t,` ${r} `]}):null]}):null},dE=i=>i.file.size&&c("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,Tg.default)(i.file.size)}),pE=i=>i.file.isGhost&&c("span",{children:[" \u2022 ",c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0),children:i.i18n("reSelect")})]}),fE=({file:i,onClick:e})=>i.error?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function hh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return c("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[c("div",{className:"uppy-Dashboard-Item-fileName",children:[uE({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),c(fE,{file:e,onClick:()=>alert(e.error)})]}),c("div",{className:"uppy-Dashboard-Item-status",children:[hE({file:e}),dE({file:e}),pE({file:e,toggleAddFilesPanel:n,i18n:t})]}),c(kn,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function dh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":br(e.type).color;return c("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a},children:[n&&e.uploadURL&&c("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:c("span",{hidden:!0,children:e.meta.name})}),c(xn,{file:e}),c(kn,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function mE(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function xg(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function ph(i){return c("div",{className:"uppy-Dashboard-Item-progress",children:c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":xg(i),title:xg(i),onClick:()=>mE(i),children:i.children})})}function Pa({children:i}){return c("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}function fh({progress:i}){let e=2*Math.PI*15;return c("g",{children:[c("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),c("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}function mh(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(Pa,{children:[c("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),c("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?c(ph,{...i,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[c("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),c("path",{d:"M7.9 3H10v2H7.9z"}),c("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),c("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?c(ph,{...i,children:c(Pa,{children:[c(fh,{progress:i.file.progress.percentage}),i.file.isPaused?c("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):c("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[c("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),c("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?c(ph,{...i,children:c(Pa,{children:[c(fh,{progress:i.file.progress.percentage}),c("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(Pa,{children:c(fh,{progress:i.file.progress.percentage})})})})}var _n=class extends ve{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Eg(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let h=(0,kg.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return c("div",{className:h,id:`uppy_${e.id}`,role:this.props.role,children:[c("div",{className:"uppy-Dashboard-Item-preview",children:[c(dh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),c(mh,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),c("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[c(hh,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),c(uh,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function gE(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function gh({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:m,isSingleFile:g,toggleFileCard:E,handleRequestThumbnail:w,handleCancelThumbnail:F,recoveredState:L,individualCancellation:M,itemsPerRow:D,openFileEditor:A,canEditFile:R,toggleAddFilesPanel:T,containerWidth:x,containerHeight:P}){let I=D===1?71:200,B=Ii(()=>{let j=(W,te)=>Number(r[te].isGhost)-Number(r[W].isGhost),q=Object.keys(r);return L&&q.sort(j),gE(q,D)},[r,D,L]),U=j=>c("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:j.map(q=>c(_n,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:M,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:m,recoveredState:L,isSingleFile:g,containerWidth:x,containerHeight:P,toggleFileCard:E,handleRequestThumbnail:w,handleCancelThumbnail:F,role:"listitem",openFileEditor:A,canEditFile:R,toggleAddFilesPanel:T,file:r[q]},q))},j[0]);return g?c("div",{class:"uppy-Dashboard-files",children:U(B[0])}):c(na,{class:"uppy-Dashboard-files",role:"list",data:B,renderRow:U,rowHeight:I})}var _g=be(nt(),1);function bE({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let o=Mi(null);return c("div",{className:(0,_g.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:Jt,onDragLeave:Jt,onDrop:Jt,onPaste:Jt,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),c("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,o.current)})]})}var Cg=bE;var ei={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function yE(i,e,t,r={}){if(i)return ei.STATE_ERROR;if(e)return ei.STATE_COMPLETE;if(t)return ei.STATE_PAUSED;let s=ei.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return ei.STATE_UPLOADING;a.preprocess&&s!==ei.STATE_UPLOADING&&(s=ei.STATE_PREPROCESSING),a.postprocess&&s!==ei.STATE_UPLOADING&&s!==ei.STATE_PREPROCESSING&&(s=ei.STATE_POSTPROCESSING)}return s}function vE({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:o,processingFiles:a}){switch(yE(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:a.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:o.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}function wE(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),c("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:e("cancel")}):c("div",{}),c("div",{className:"uppy-DashboardContent-title",children:c(vE,{...i})}),a?c("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:c("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),c("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):c("div",{})]})}var Ag=wE;var Fg=be(nt(),1);var os="uppy-transition-slideDownUp",Pg=250;function SE({children:i}){let[e,t]=Ft(null),[r,s]=Ft(""),n=Mi(),o=Mi(),a=Mi(),l=()=>{s(`${os}-enter`),cancelAnimationFrame(a.current),clearTimeout(o.current),o.current=void 0,a.current=requestAnimationFrame(()=>{s(`${os}-enter ${os}-enter-active`),n.current=setTimeout(()=>{s("")},Pg)})},h=()=>{s(`${os}-leave`),cancelAnimationFrame(a.current),clearTimeout(n.current),n.current=void 0,a.current=requestAnimationFrame(()=>{s(`${os}-leave ${os}-leave-active`),o.current=setTimeout(()=>{t(null),s("")},Pg)})};return $t(()=>{let m=pt(i)[0];e!==m&&(m&&!e?l():e&&!m&&!o.current&&h(),t(m))},[i,e]),$t(()=>()=>{clearTimeout(n.current),clearTimeout(o.current),cancelAnimationFrame(a.current)},[]),e?Ys(e,{className:(0,Fg.default)(r,e.props.className)}):null}var Cn=SE;var Og=900,Lg=700,bh=576,Rg=330;function yh(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>bh,s=i.containerHeight>Rg,n=(0,Mg.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>bh,"uppy-size--lg":i.containerWidth>Lg,"uppy-size--xl":i.containerWidth>Og,"uppy-size--height-md":i.containerHeight>Rg,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>Og?o=5:i.containerWidth>Lg?o=4:i.containerWidth>bh&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,h=i.files?Object.keys(i.files).filter(E=>i.files[E].isGhost).length:0,m=()=>h>0?i.i18n("recoveredXFiles",{smart_count:h}):i.i18n("recoveredAllFiles");return c("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&nh(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[c("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),c("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:c("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:c("span",{"aria-hidden":"true",children:"\xD7"})}),c("div",{className:"uppy-Dashboard-innerWrap",children:[c("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),a&&c(Ag,{...i}),l&&c("div",{className:"uppy-Dashboard-serviceMsg",children:[c("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:c("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[c("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),c("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),c("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),c("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),c("div",{className:"uppy-Dashboard-serviceMsg-text",children:m()})]}),a?c(gh,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):c(Ca,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),c(Cn,{children:i.showAddFilesPanel?c(yg,{...i,isSizeMD:r},"AddFiles"):null}),c(Cn,{children:i.fileCardFor?c(lh,{...i},"FileCard"):null}),c(Cn,{children:i.activePickerPanel?c(Cg,{...i},"Picker"):null}),c(Cn,{children:i.showFileEditor?c(wg,{...i},"Editor"):null}),c("div",{className:"uppy-Dashboard-progressindicators",children:i.progressindicators.map(E=>i.uppy.getPlugin(E.id).render(i.state))})]})]})]})}var Ig={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};var Fa=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];var Dg=be(gu(),1);function An(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function vh(){let i=!1;return(0,Dg.default)((t,r)=>{let s=An(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");n&&!o||(o?(o.focus({preventScroll:!0}),i=!0):(s.querySelector(Fa)?.focus({preventScroll:!0}),i=!1))},260)}function Ng(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function EE(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function TE(i){return i.contains(document.activeElement)}function wh(i,e,t){let r=An(t,e),s=Ui(r.querySelectorAll(Fa)),n=s.indexOf(document.activeElement);TE(r)?i.shiftKey&&n===0?EE(i,s):!i.shiftKey&&n===s.length-1&&Ng(i,s):Ng(i,s)}function Bg(i,e,t){e===null||wh(i,e,t)}var Ug=9,kE=27;function zg(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var _E={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:hn,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},yr=class extends Vt{static VERSION=gg.version;#e;modalName=`uppy-Dashboard-${Ni()}`;superFocus=vh();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{..._E,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=Ig,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})};addTarget=e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},a=this.getPluginState().targets.slice();return a.push(n),this.setPluginState({targets:a}),this.el};hideAllPanels=()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))};showPanel=e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)};canEditFile=e=>{let{targets:t}=this.getPluginState();return this.#l(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))};openFileEditor=e=>{let{targets:t}=this.getPluginState(),r=this.#l(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})};closeFileEditor=()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})};saveFileEditor=()=>{let{targets:e}=this.getPluginState();this.#l(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()};openModal=()=>{let{promise:e,resolve:t}=zg();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()};this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e};closeModal=e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:o}=zg();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let a=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",a,!1),o()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),o();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n};isModalOpen=()=>!this.getPluginState().isHidden||!1;requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal();setDarkModeCapability=e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})};handleSystemDarkModeChange=e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)};toggleFileCard=(e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})};toggleAddFilesPanel=e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})};addFiles=e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}};startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)};stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)};recordIfFocusedOnUppyRecently=e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())};disableInteractiveElements=e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??Ui(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e};updateBrowserHistory=()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)};handlePopState=e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()};handleKeyDownInModal=e=>{e.keyCode===kE&&this.requestCloseModal(),e.keyCode===Ug&&wh(e,this.getPluginState().activeOverlayType,this.el)};handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()};handlePaste=e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=Ui(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))};handleInputChange=e=>{e.preventDefault();let t=Ui(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))};handleDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=()=>{let o=!0;return this.uppy.iteratePlugins(a=>{a.canHandleRootDrop?.(e)&&(o=!0)}),o},r=()=>{let{types:o}=e.dataTransfer;return o.some(a=>a==="Files")},s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)};handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)};handleDrop=async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)};this.uppy.log("[Dashboard] Processing dropped files");let s=await sh(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)};handleRequestThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)};handleCancelThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)};handleKeyDownInInline=e=>{e.keyCode===Ug&&Bg(e,this.getPluginState().activeOverlayType,this.el)};handlePasteOnBody=e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)};handleComplete=({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()};handleCancelRestore=()=>{this.uppy.emit("restore-canceled")};#t=()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}};#i=e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)};initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let e=th(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#c),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#i)};removeEvents=()=>{let e=th(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#c),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)};superFocusOnEachUpdate=()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()};afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()};saveFileCard=(e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)};#r=e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}};#n=e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()};#o=e=>e.filter(t=>t.type==="acquirer"&&this.#n(t)).map(this.#r);#s=e=>e.filter(t=>t.type==="progressindicator").map(this.#r);#l=e=>e.filter(t=>t.type==="editor").map(this.#r);render=e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:m,inProgressNotPausedFiles:g,processingFiles:E,isUploadStarted:w,isAllComplete:F,isAllPaused:L}=this.uppy.getObjectOfFilesPerState(),M=this.#o(t.targets),D=this.#s(t.targets),A=this.#l(t.targets),R;return this.opts.theme==="auto"?R=s.darkMode?"dark":"light":R=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),yh({state:e,isHidden:t.isHidden,files:r,newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:m,inProgressNotPausedFiles:g,processingFiles:E,isUploadStarted:w,isAllComplete:F,isAllPaused:L,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:M,theme:R,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:D,editors:A,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})};#a=()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})};#f=()=>{this.uppy.iteratePlugins(this.#c)};#c=e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))};#d(){let{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideProgressAfterFinish:o,locale:a,doneButtonHandler:l}=this.opts;return{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideAfterFinish:o,locale:a,doneButtonHandler:l}}#u(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}#p(){return{}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#g())?.setOptions(this.#d()),this.uppy.getPlugin(this.#h())?.setOptions(this.#u())}#g(){return`${this.id}:StatusBar`}#h(){return`${this.id}:ThumbnailGenerator`}#y(){return`${this.id}:Informer`}install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableStatusBar||this.uppy.use(es,{id:this.#g(),target:this,...this.#d()}),this.opts.disableInformer||this.uppy.use(Zr,{id:this.#y(),target:this,...this.#p()}),this.opts.disableThumbnailGenerator||this.uppy.use(Tn,{id:this.#h(),...this.#u()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let o=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${o?"on":"off"}`),this.setDarkModeCapability(o),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#a(),this.#f(),this.initEvents()};uninstall=()=>{if(!this.opts.disableInformer){let t=this.uppy.getPlugin(`${this.id}:Informer`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableStatusBar){let t=this.uppy.getPlugin(`${this.id}:StatusBar`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()}};var Hg={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"3.4.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var Gg=be(jg(),1);function AE(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var qg=AE;function PE(i){return i*(Math.PI/180)}function FE(i,e,t){let r=Math.abs(PE(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var $g=FE;function OE(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var Vg=OE;function LE(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var Wg=LE;var Pn=class extends ve{imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new Gg.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Vg(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Wg(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=qg(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)};onRotateGranular=e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),o=$g(n.naturalWidth,n.naturalHeight,t),a=this.cropper.getImageData().scaleX<0?-o:o;this.cropper.scale(a,o)};renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return c("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:c("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),c("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),c("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),c("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return c("div",{className:"uppy-ImageCropper",children:[c("div",{className:"uppy-ImageCropper-container",children:c("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})}),c("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var Kg={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var Yg={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},Xg={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},RE={quality:.8,actions:Xg,cropperOptions:Yg},as=class extends Vt{static VERSION=Hg.version;cropper;constructor(e,t){super(e,{...RE,...t,actions:{...Xg,...t?.actions},cropperOptions:{...Yg,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Kg,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=()=>{let e=s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let o=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",o),this.setPluginState({currentImage:o}),this.uppy.emit("file-editor:complete",o)},{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)};storeCropperInstance=e=>{this.cropper=e};selectFile=e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})};install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:c(Pn,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var Fn=class{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};function ME(i){return new Error("Cancelled",{cause:i})}function Zg(i){if(i!=null){let e=()=>this.abort(i.reason);i.addEventListener("abort",e,{once:!0});let t=()=>{i.removeEventListener("abort",e)};this.then?.(t,t)}return this}var Oa=class{#e=0;#t=[];#i=!1;#r;#n=1;#o;#s;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#l(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:s=>{t||(t=!0,this.#e-=1,r?.(s),this.#a())},done:()=>{t||(t=!0,this.#e-=1,this.#a())}}}#a(){queueMicrotask(()=>this.#f())}#f(){if(this.#i||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#l(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:()=>{this.#d(r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#d(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#l(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Zg,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((o,a)=>{s=this.run(()=>{let l,h;try{h=Promise.resolve(e(...r))}catch(m){h=Promise.reject(m)}return h.then(m=>{l?a(l):(s.done(),o(m))},m=>{l?a(l):(s.done(),a(m))}),m=>{l=ME(m)}},t)});return n.abort=o=>{s.abort(o)},n.abortOn=Zg,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#a()}#u=()=>this.resume();pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#u,e))}rateLimit(e){clearTimeout(this.#s),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#o=this.limit-1,this.limit=this.#n,this.#s=setTimeout(this.#p,e))}#p=()=>{if(this.#i){this.#s=setTimeout(this.#p,0);return}this.#n=this.limit,this.limit=Math.ceil((this.#o+this.#n)/2);for(let e=this.#n;e<=this.limit;e++)this.#a();this.#o-this.#n>3?this.#s=setTimeout(this.#p,2e3):this.#n=Math.floor(this.#n/2)};get isPaused(){return this.#i}},La=Symbol("__queue");var Th=class extends Error{cause;isNetworkError;request;constructor(e,t=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},On=Th;function IE(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var Qg=IE;var xh=class{#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},Jg=xh;var Ra=()=>{};function eb(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=Ra,onUploadProgress:o=Ra,shouldRetry:a=()=>!0,onAfterResponse:l=Ra,onTimeout:h=Ra,responseType:m,retries:g=3,signal:E=null,timeout:w=3e4,withCredentials:F=!1}=e,L=A=>.3*2**(A-1)*1e3,M=new Jg(w,h);function D(A=0){return new Promise(async(R,T)=>{let x=new XMLHttpRequest,P=I=>{a(x)&&A<g?setTimeout(()=>{D(A+1).then(R,T)},L(A)):(M.done(),T(I))};x.open(s,i,!0),x.withCredentials=F,m&&(x.responseType=m),E?.addEventListener("abort",()=>{x.abort(),T(new DOMException("Aborted","AbortError"))}),x.onload=async()=>{try{await l(x,A)}catch(I){I.request=x,P(I);return}x.status>=200&&x.status<300?(M.done(),R(x)):a(x)&&A<g?setTimeout(()=>{D(A+1).then(R,T)},L(A)):(M.done(),T(new On(x.statusText,x)))},x.onerror=()=>P(new On(x.statusText,x)),x.upload.onprogress=I=>{M.progress(),o(I)},r&&Object.keys(r).forEach(I=>{x.setRequestHeader(I,r[I])}),await n(x,A),x.send(t)})}return D()}function tb(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function ib(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function Ma(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var rb={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function gi(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var DE=0;function cs(i){return"__private_"+DE+++"_"+i}var NE={version:"4.3.3"};function BE(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Qg(i)?(t=new On(t,i),t):(t.request=i,t)}function sb(i){return i.data.slice(0,i.data.size,i.meta.type)}var UE={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},vr=cs("getFetcher"),Ch=cs("uploadLocalFile"),kh=cs("uploadBundle"),Ah=cs("getCompanionClientArgs"),_h=cs("uploadFiles"),Ln=cs("handleUpload"),ls=class extends Ri{constructor(e,t){if(super(e,{...UE,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,_h,{value:qE}),Object.defineProperty(this,Ah,{value:jE}),Object.defineProperty(this,kh,{value:HE}),Object.defineProperty(this,Ch,{value:zE}),Object.defineProperty(this,vr,{writable:!0,value:void 0}),Object.defineProperty(this,Ln,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[La]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=tb(s),o=ib(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await gi(this,kh)[kh](n)}else await gi(this,_h)[_h](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=rb,this.i18nInit(),La in this.opts?this.requests=this.opts[La]:this.requests=new Oa(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),gi(this,vr)[vr]=r=>async(s,n)=>{try{var o,a,l;let g=await eb(s,{...n,onBeforeRequest:(F,L)=>{var M,D;return(M=(D=this.opts).onBeforeRequest)==null?void 0:M.call(D,F,L,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:F=>{let L=Math.ceil(F/1e3),M=new Error(this.i18n("uploadStalled",{seconds:L}));this.uppy.emit("upload-stalled",M,r)},onUploadProgress:F=>{if(F.lengthComputable)for(let{id:M}of r){var L;let D=this.uppy.getFile(M);this.uppy.emit("upload-progress",D,{uploadStarted:(L=D.progress.uploadStarted)!=null?L:0,bytesUploaded:F.loaded/F.total*D.size,bytesTotal:D.size})}}}),E=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,g));if(g.responseType==="json"){var h;(h=E)!=null||(E=g.response)}else try{var m;(m=E)!=null||(E=JSON.parse(g.responseText))}catch(F){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:F})}let w=typeof((l=E)==null?void 0:l.url)=="string"?E.url:void 0;for(let{id:F}of r)this.uppy.emit("upload-success",this.uppy.getFile(F),{status:g.status,body:E,uploadURL:w});return g}catch(g){if(g.name==="AbortError")return;let E=g.request;for(let w of r)this.uppy.emit("upload-error",this.uppy.getFile(w.id),BE(E,g),E);throw g}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Ma(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=sb(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=sb(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(gi(this,Ln)[Ln])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(gi(this,Ln)[Ln])}};async function zE(i){let e=new Fn(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=gi(this,vr)[vr]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function HE(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=gi(this,vr)[vr](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function jE(i){var e;let t=this.getOptions(i),r=Ma(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function qE(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,gi(this,Ah)[Ah](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return gi(this,Ch)[Ch](e)}))}ls.VERSION=NE.version;var Xe=class{static fromTemplate(i){if(Vr.isSupported)return Vr.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return $E(e)}}};function $E(i){return VE(i),nb(i),i}function VE(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function WE(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function GE(i){let e=i.attributes;for(let{name:t,value:r}of e)WE(t,r)&&i.removeAttribute(t)}function nb(i){let e=i.children;for(let t of e)GE(t),nb(t)}var Ia=class extends H{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#s(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#s())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#s()}attachmentPreviewOutletDisconnected(i,e){this.#s()}configureUppy(){let i={inline:!1,closeAfterFinish:!0},e=this.element.closest("dialog");e&&(i.target=e),this.uppy=new ea({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(yr,i).use(as,{target:yr}),this.#i(),this.#r()}#i(){this.uppy.use(ls,{endpoint:this.endpointValue})}#r(){this.uppy.on("upload-success",this.#o.bind(this))}#n(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#u.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#u.openModal()}#o(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#c(t,r))}#s(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#l(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#a(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#a(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=Xe.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
97
+ ${e}`;alert(o)}return c("div",{className:"uppy-StatusBar-content",title:t("uploadFailed"),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),c("div",{className:"uppy-StatusBar-status",children:[c("div",{className:"uppy-StatusBar-statusPrimary",children:[t("uploadFailed"),c("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button",children:"?"})]}),c(ig,{i18n:t,complete:r,numUploads:s})]})]})}function gn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var{STATE_ERROR:og,STATE_WAITING:zS,STATE_PREPROCESSING:Gu,STATE_UPLOADING:ya,STATE_POSTPROCESSING:Ku,STATE_COMPLETE:va}=kt;function Xu({newFiles:i,allowNewUpload:e,isUploadInProgress:t,isAllPaused:r,resumableUploads:s,error:n,hideUploadButton:o=void 0,hidePauseResumeButton:a=!1,hideCancelButton:l=!1,hideRetryButton:h=!1,recoveredState:f,uploadState:m,totalProgress:w,files:y,supportsUploadProgress:_,hideAfterFinish:P=!1,isSomeGhost:O,doneButtonHandler:R=void 0,isUploadStarted:C,i18n:F,startUpload:k,uppy:S,isAllComplete:A,showProgressDetails:L=void 0,numUploads:H,complete:j,totalSize:G,totalETA:K,totalUploadedSize:ee}){function se(){switch(m){case Ku:case Gu:{let He=gn(y);return He.mode==="determinate"?He.value*100:w}case og:return null;case ya:return _?w:null;default:return w}}function ae(){switch(m){case Ku:case Gu:{let{mode:He}=gn(y);return He==="indeterminate"}case ya:return!_;default:return!1}}let ve=se(),we=ve??100,Ne=!n&&i&&(!t&&!r||f)&&e&&!o,pe=!l&&m!==zS&&m!==va,Ye=s&&!a&&m===ya,Ct=n&&!A&&!h,mt=R&&m===va,gt=(0,Yu.default)("uppy-StatusBar-progress",{"is-indeterminate":ae()}),ut=(0,Yu.default)("uppy-StatusBar",`is-${m}`,{"has-ghosts":O}),te=(()=>{switch(m){case Gu:case Ku:return c(tg,{progress:gn(y)});case va:return c(sg,{i18n:F});case og:return c(ng,{error:n,i18n:F,numUploads:H,complete:j});case ya:return c(rg,{i18n:F,supportsUploadProgress:_,totalProgress:w,showProgressDetails:L,isUploadStarted:C,isAllComplete:A,isAllPaused:r,newFiles:i,numUploads:H,complete:j,totalUploadedSize:ee,totalSize:G,totalETA:K,startUpload:k});default:return null}})();return!(Ne||Ct||Ye||pe||mt)&&!te||m===va&&P?null:c("div",{className:ut,children:[c("div",{className:gt,style:{width:`${we}%`},role:"progressbar","aria-label":`${we}%`,"aria-valuetext":`${we}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ve}),te,c("div",{className:"uppy-StatusBar-actions",children:[Ne?c(Ym,{newFiles:i,isUploadStarted:C,recoveredState:f,i18n:F,isSomeGhost:O,startUpload:k,uploadState:m}):null,Ct?c(Xm,{i18n:F,uppy:S}):null,Ye?c(Qm,{isAllPaused:r,i18n:F,isAllComplete:A,resumableUploads:s,uppy:S}):null,pe?c(Zm,{i18n:F,uppy:S}):null,mt?c(Jm,{i18n:F,doneButtonHandler:R}):null]})]})}var HS=2e3,jS=2e3;function qS(i,e,t,r){if(i)return kt.STATE_ERROR;if(e)return kt.STATE_COMPLETE;if(t)return kt.STATE_WAITING;let s=kt.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return kt.STATE_UPLOADING;a.preprocess&&(s=kt.STATE_PREPROCESSING),a.postprocess&&s!==kt.STATE_PREPROCESSING&&(s=kt.STATE_POSTPROCESSING)}return s}var $S={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},rs=class extends Wt{static VERSION=Wm.version;#e;#t;#i;#r;constructor(e,t){super(e,{...$S,...t}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Gm,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}#s(e){if(e.total==null||e.total===0)return null;let t=e.total-e.uploaded;if(t<=0)return null;this.#e??=performance.now();let r=performance.now()-this.#e;if(r===0)return Math.round((this.#r??0)/100)/10;let s=e.uploaded-this.#t;if(this.#t=e.uploaded,s<=0)return Math.round((this.#r??0)/100)/10;let n=s/r,o=this.#i==null?n:ba(n,this.#i,HS,r);this.#i=o;let a=t/o,l=Math.max(this.#r-r,0),h=this.#r==null?a:ba(a,l,jS,r);return this.#r=h,this.#e=performance.now(),Math.round(h/100)/10}startUpload=()=>this.uppy.upload().catch((()=>{}));render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:h,completeFiles:f,isUploadStarted:m,isAllComplete:w,isAllPaused:y,isUploadInProgress:_,isSomeGhost:P}=this.uppy.getObjectOfFilesPerState(),O=a?Object.values(r):l,R=!!t.resumableUploads,C=t.uploadProgress!==!1,F=null,k=0;h.every(A=>A.progress.bytesTotal!=null&&A.progress.bytesTotal!==0)?(F=0,h.forEach(A=>{F+=A.progress.bytesTotal||0,k+=A.progress.bytesUploaded||0})):h.forEach(A=>{k+=A.progress.bytesUploaded||0});let S=this.#s({uploaded:k,total:F});return Xu({error:o,uploadState:qS(o,w,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:F,totalUploadedSize:k,isAllComplete:!1,isAllPaused:y,isUploadStarted:m,isUploadInProgress:_,isSomeGhost:P,recoveredState:a,complete:f.length,newFiles:O.length,numUploads:h.length,totalETA:S,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:R,supportsUploadProgress:C,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Wo(e)||(e.dir="ltr")}#a=()=>{let{recoveredState:e}=this.uppy.getState();if(this.#i=null,this.#r=null,e){this.#t=Object.values(e.files).reduce((t,{progress:r})=>t+r.bytesUploaded,0),this.uppy.emit("restore-confirmed");return}this.#e=performance.now(),this.#t=0};install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",this.#a),this.#e=performance.now(),this.#t=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",this.#a)}};var VS=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function WS(i,e,t){let r=VS.exec(i),s=e.mimeType??r?.[1]??"plain/text",n;if(r?.[2]!=null){let o=atob(decodeURIComponent(r[3])),a=new Uint8Array(o.length);for(let l=0;l<o.length;l++)a[l]=o.charCodeAt(l);n=[a]}else r?.[3]!=null&&(n=[decodeURIComponent(r[3])]);return t?new File(n,e.name||"",{type:s}):new Blob(n,{type:s})}var ag=WS;function wa(i){return i.startsWith("blob:")}function Sa(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function he(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var gg=typeof self<"u"?self:global,wn=typeof navigator<"u",GS=wn&&typeof HTMLImageElement>"u",lg=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),bg=gg.Buffer,yg=!!bg,KS=i=>i!==void 0;function vg(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(KS).length===0)}function Ke(i){let e=new Error(i);throw delete e.stack,e}function cg(i){let e=(function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048})(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var Zu=i=>String.fromCharCode.apply(null,i),ug=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,wr=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Ke("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Ke("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Ke("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),ug?ug.decode(s):yg?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(Zu(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return Zu(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return Zu(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function Ju(i,e){Ke(`${i} '${e}' was not loaded, try using full build of exifr.`)}var Sn=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||Ju(this.kind,e),t&&(e in t||(function(r,s){Ke(`Unknown ${r} '${s}'.`)})(this.kind,e),t[e].enabled||Ju(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},_a=new Sn("file parser"),_t=new Sn("segment parser"),xn=new Sn("file reader"),YS=gg.fetch;function hg(i,e){return(t=i).startsWith("data:")||t.length>1e4?th(i,e,"base64"):lg&&i.includes("://")?eh(i,e,"url",Ea):lg?th(i,e,"fs"):wn?eh(i,e,"url",Ea):void Ke("Invalid input argument");var t}async function eh(i,e,t,r){return xn.has(t)?th(i,e,t):r?(async function(s,n){let o=await n(s);return new wr(o)})(i,r):void Ke(`Parser ${t} is not loaded`)}async function th(i,e,t){let r=new(xn.get(t))(i,e);return await r.read(),r}var Ea=i=>YS(i).then((e=>e.arrayBuffer())),En=i=>new Promise(((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)})),ih=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function wg(i,e,t){let r=new ih;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function Sg(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var kn=new Map,ah=new Map,lh=new Map,ss=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],Ca=["jfif","xmp","icc","iptc","ihdr"],Tn=["tiff",...Ca],Ie=["ifd0","ifd1","exif","gps","interop"],ns=[...Tn,...Ie],os=["makerNote","userComment"],Aa=["translateKeys","translateValues","reviveValues","multiSegment"],as=[...Aa,"sanitize","mergeOutput","silentErrors"],Ta=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},vr=class extends Ta{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),he(this,"enabled",!1),he(this,"skip",new Set),he(this,"pick",new Set),he(this,"deps",new Set),he(this,"translateKeys",!1),he(this,"translateValues",!1),he(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Ie.includes(e),this.canBeFiltered&&(this.dict=kn.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Ke(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of Aa)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,xa(this.pick,this.deps)):this.enabled&&this.pick.size>0&&xa(this.pick,this.deps)}},ct={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},dg=new Map,Sr=class extends Ta{static useCached(e){let t=dg.get(e);return t!==void 0||(t=new this(e),dg.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Ke(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=wn?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of ss)this[e]=ct[e];for(e of as)this[e]=ct[e];for(e of os)this[e]=ct[e];for(e of ns)this[e]=new vr(e,ct[e],void 0,this)}setupFromTrue(){let e;for(e of ss)this[e]=ct[e];for(e of as)this[e]=ct[e];for(e of os)this[e]=!0;for(e of ns)this[e]=new vr(e,!0,void 0,this)}setupFromArray(e){let t;for(t of ss)this[t]=ct[t];for(t of as)this[t]=ct[t];for(t of os)this[t]=ct[t];for(t of ns)this[t]=new vr(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Ie)}setupFromObject(e){let t;for(t of(Ie.ifd0=Ie.ifd0||Ie.image,Ie.ifd1=Ie.ifd1||Ie.thumbnail,Object.assign(this,e),ss))this[t]=Qu(e[t],ct[t]);for(t of as)this[t]=Qu(e[t],ct[t]);for(t of os)this[t]=Qu(e[t],ct[t]);for(t of Tn)this[t]=new vr(t,ct[t],e[t],this);for(t of Ie)this[t]=new vr(t,ct[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Ie,ns),e.tiff===!0?this.batchEnableWithBool(Ie,!0):e.tiff===!1?this.batchEnableWithUserValue(Ie,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Ie):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Ie)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=pg(e,r);for(let[o,a]of n)xa(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=pg(t,r);for(let[o,a]of n)xa(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Ie.some((n=>this[n].enabled===!0))||this.makerNote||this.userComment;for(let n of Ie)this[n].finalizeFilters()}get onlyTiff(){return!Ca.map((e=>this[e].enabled)).some((e=>e===!0))&&this.tiff.enabled}checkLoadedPlugins(){for(let e of Tn)this[e].enabled&&!_t.has(e)&&Ju("segment parser",e)}};function pg(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=kn.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function Qu(i,e){return i!==void 0?i:e!==void 0?e:void 0}function xa(i,e){for(let t of e)i.add(t)}he(Sr,"default",ct);var ls=class{constructor(e){he(this,"parsers",{}),he(this,"output",{}),he(this,"errors",[]),he(this,"pushToErrors",(t=>this.errors.push(t))),this.options=Sr.useCached(e)}async read(e){this.file=await(function(t,r){return typeof t=="string"?hg(t,r):wn&&!GS&&t instanceof HTMLImageElement?hg(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new wr(t):wn&&t instanceof Blob?eh(t,r,"blob",En):void Ke("Invalid input argument")})(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of _a)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Ke("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),vg(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map((async r=>{let s=await r.parse();r.assignToOutput(e,s)}));this.options.silentErrors&&(t=t.map((r=>r.catch(this.pushToErrors)))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=_t.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function Eg(i,e){let t=new ls(e);return await t.read(i),t.parse()}var XS=Object.freeze({__proto__:null,parse:Eg,Exifr:ls,fileParsers:_a,segmentParsers:_t,fileReaders:xn,tagKeys:kn,tagValues:ah,tagRevivers:lh,createDictionary:wg,extendDictionary:Sg,fetchUrlAsArrayBuffer:Ea,readBlobAsArrayBuffer:En,chunkedProps:ss,otherSegments:Ca,segments:Tn,tiffBlocks:Ie,segmentsAndBlocks:ns,tiffExtractables:os,inheritables:Aa,allFormatters:as,Options:Sr}),zi=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new Sr({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof wr?e:new wr(e)}constructor(e,t={},r){he(this,"errors",[]),he(this,"raw",new Map),he(this,"handleError",(s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)})),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=lh.get(t),s=ah.get(t),n=kn.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,h=o.translateKeys&&!!n,f={};for(let[m,w]of e)a&&r.has(m)?w=r.get(m)(w):l&&s.has(m)&&(w=this.translateValue(w,s.get(m))),h&&n.has(m)&&(m=n.get(m)||m),f[m]=w;return f}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};he(zi,"headerLength",4),he(zi,"type",void 0),he(zi,"multiSegment",!1),he(zi,"canHandle",(()=>!1));function ZS(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function QS(i){return i>=224&&i<=239}function JS(i,e,t){for(let[r,s]of _t)if(s.canHandle(i,e,t))return r}var ka=class extends class{constructor(e,t,r){he(this,"errors",[]),he(this,"ensureSegmentChunk",(async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){Ke(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):Ke("Segment unreachable: "+JSON.stringify(s));return s.chunk})),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(_t.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),he(this,"appSegments",[]),he(this,"jpegSegments",[]),he(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(_t.keyList())):(e=e===void 0?_t.keyList().filter((t=>this.options[t].enabled)):e.filter((t=>this.options[t].enabled&&_t.has(t))),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some((a=>{let l=_t.get(a),h=this.options[a];return l.multiSegment&&h.multiSegment})),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,h=this.appSegments.some((f=>!this.file.available(f.offset||f.start,f.length||f.size)));if(a=e>l&&!h?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:h,findAll:f,wanted:m,remaining:w,options:y}=this;for(;e<t;e++)if(h.getUint8(e)===255){if(r=h.getUint8(e+1),QS(r)){if(s=h.getUint16(e+2),n=JS(h,e,s),n&&m.has(n)&&(o=_t.get(n),a=o.findPosition(h,e),l=y[n],a.type=n,this.appSegments.push(a),!f&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||w.delete(n)):w.delete(n),w.size===0)))break;y.recordUnknownSegments&&(a=zi.findPosition(h,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(ZS(r)){if(s=h.getUint16(e+2),r===218&&y.stopAfterSos!==!1)return;y.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some((t=>t.multiSegment)))return;let e=(function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)})(this.appSegments,"type");this.mergedAppSegments=e.map((([t,r])=>{let s=_t.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]}))}getSegment(e){return this.appSegments.find((t=>t.type===e))}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};he(ka,"type","jpeg"),_a.set("jpeg",ka);var eE=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],rh=class extends zi{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let h=0;h<l;h++){let f=this.chunk.getUint16(e);if(o){if(s.has(f)&&(r.set(f,this.parseTag(e,f,t)),s.delete(f),s.size===0))break}else!a&&n.has(f)||r.set(f,this.parseTag(e,f,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=eE[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Ke(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Ke(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=(function(h){for(;h.endsWith("\0");)h=h.slice(0,-1);return h})(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let h=new((function(m){switch(m){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}})(n))(o),f=a;for(let m=0;m<o;m++)h[m]=this.parseTagValue(n,e),e+=f;return h}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Ke(`Invalid tiff type ${e}`)}}},vn=class extends rh{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Ke("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Ke(`IFD0 offset points to outside of file.
98
+ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,cg(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,cg(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",fg(...e.get(2),e.get(1))),e.set("longitude",fg(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Ie)if(e=this[t],!vg(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function fg(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}he(vn,"type","tiff"),he(vn,"headerLength",10),_t.set("tiff",vn);var kO=Object.freeze({__proto__:null,default:XS,Exifr:ls,fileParsers:_a,segmentParsers:_t,fileReaders:xn,tagKeys:kn,tagValues:ah,tagRevivers:lh,createDictionary:wg,extendDictionary:Sg,fetchUrlAsArrayBuffer:Ea,readBlobAsArrayBuffer:En,chunkedProps:ss,otherSegments:Ca,segments:Tn,tiffBlocks:Ie,segmentsAndBlocks:ns,tiffExtractables:os,inheritables:Aa,allFormatters:as,Options:Sr,parse:Eg}),ch={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},_O=Object.assign({},ch,{firstChunkSize:4e4,gps:[1,2,3,4]});var CO=Object.assign({},ch,{tiff:!1,ifd1:!0,mergeOutput:!1});var tE=Object.assign({},ch,{firstChunkSize:4e4,ifd0:[274]});async function iE(i){let e=new ls(tE);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var rE=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),bn=!0,yn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;bn=Number(t)+.1*Number(r)<13.4,yn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);bn=yn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);bn=yn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);bn=yn=Number(e)<77}}async function Tg(i){let e=await iE(i);return Object.assign({canvas:bn,css:yn},rE[e])}var sh=class extends wr{constructor(...e){super(...e),he(this,"ranges",new nh),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=yg?bg.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},nh=class{constructor(){he(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter((o=>mg(e,o.offset,s)||mg(e,o.end,s)));if(n.length>0){e=Math.min(e,...n.map((a=>a.offset))),s=Math.max(s,...n.map((a=>a.end))),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter((a=>!n.includes(a)))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some((s=>s.offset<=e&&r<=s.end))}};function mg(i,e,t){return i<=e&&e<=t}var oh=class extends sh{constructor(e,t){super(0),he(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};xn.set("blob",class extends oh{async readWhole(){this.chunked=!1;let i=await En(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await En(r);return this.set(s,i,!0)}});var xg={name:"@uppy/thumbnail-generator",description:"Uppy plugin that generates small previews of images to show on your upload UI.",version:"4.2.3",license:"MIT",main:"lib/index.js",type:"module",scripts:{build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},keywords:["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",exifr:"^7.0.0"},devDependencies:{jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.3"}};var kg={strings:{generatingThumbnails:"Generating thumbnails..."}};function nE(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>ag(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function oE(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function aE(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var lE={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},_n=class extends Wt{static VERSION=xg.version;queue;queueProcessing;defaultThumbnailDimension;thumbnailType;constructor(e,t){if(super(e,{...lE,...t}),this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=kg,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let h=new Image;h.src=s,h.addEventListener("load",()=>{URL.revokeObjectURL(s),a(h)}),h.addEventListener("error",f=>{URL.revokeObjectURL(s),l(f.error||new Error("Could not create thumbnail"))})}),o=Tg(e.data).catch(()=>1);return Promise.all([n,o]).then(([a,l])=>{let h=this.getProportionalDimensions(a,t,r,l.deg),f=oE(a,l),m=this.resizeImage(f,h.width,h.height);return nE(m,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;if((s===90||s===270)&&(n=e.height/e.width),t!=null){let o=t;return e.width<t&&(o=e.width),{width:o,height:Math.round(o/n)}}if(r!=null){let o=r;return e.height<r&&(o=e.height),{width:Math.round(o*n),height:o}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=aE(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let h=document.createElement("canvas");h.width=o,h.height=a,h.getContext("2d").drawImage(s,0,0,o,a),s=h,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return Sa(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}onFileAdded=e=>{!e.preview&&e.data&&Sa(e.type)&&!e.isRemote&&this.addToQueue(e.id)};onCancelRequest=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1)};onFileRemoved=e=>{let t=this.queue.indexOf(e.id);t!==-1&&this.queue.splice(t,1),e.preview&&wa(e.preview)&&URL.revokeObjectURL(e.preview)};onRestored=()=>{this.uppy.getFiles().filter(t=>t.isRestored).forEach(t=>{(!t.preview||wa(t.preview))&&this.addToQueue(t.id)})};onAllFilesRemoved=()=>{this.queue=[]};waitUntilAllProcessed=e=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-progress",s,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let t=()=>{e.forEach(r=>{let s=this.uppy.getFile(r);this.uppy.emit("preprocess-complete",s)})};return new Promise(r=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{t(),r()}):(t(),r())})};install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};function cE(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Gs(i)?[i]:null}var uh=cE;var Hi=Array.from;function hh(i){let e=Hi(i.files);return Promise.resolve(e)}function Pa(i,e,t,{onSuccess:r}){i.readEntries(s=>{let n=[...e,...s];s.length?queueMicrotask(()=>{Pa(i,n,t,{onSuccess:r})}):r(n)},s=>{t(s),r(e)})}function _g(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{Pa(t,[],e,{onSuccess:n=>s(n.map(o=>_g(o,e)))})})},isSameEntry:void 0}}async function*Cg(i,e,t=void 0){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*Cg(s,e?r():i.name);else t!=null&&(yield t)}async function*dh(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??=_g(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*Cg(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}async function ph(i,e){let t=e?.logDropError??Function.prototype;try{let r=[];for await(let s of dh(i,t))r.push(s);return r}catch{return hh(i)}}var Ag={name:"@uppy/dashboard",description:"Universal UI plugin for Uppy.",version:"4.4.3",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest watch --project browser --browser.headless false"},keywords:["file uploader","uppy","uppy-plugin","dashboard","ui"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@transloadit/prettier-bytes":"^0.3.4","@uppy/informer":"^4.3.2","@uppy/provider-views":"^4.5.2","@uppy/status-bar":"^4.2.3","@uppy/thumbnail-generator":"^4.2.2","@uppy/utils":"^6.2.2",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},devDependencies:{"@uppy/core":"^4.5.2","@uppy/google-drive":"^4.4.2","@uppy/status-bar":"^4.2.3","@uppy/url":"^4.3.2","@uppy/webcam":"^4.3.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},peerDependencies:{"@uppy/core":"^4.5.2"}};function fh(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var Wg=Te(at(),1);var mh=class extends ke{fileInput=null;folderInput=null;mobilePhotoFileInput=null;mobileVideoFileInput=null;triggerFileInputClick=()=>{this.fileInput?.click()};triggerFolderInputClick=()=>{this.folderInput?.click()};triggerVideoCameraInputClick=()=>{this.mobileVideoFileInput?.click()};triggerPhotoCameraInputClick=()=>{this.mobilePhotoFileInput?.click()};onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""};renderHiddenInput=(e,t)=>c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:this.props.allowedFileTypes?.join(", "),ref:t});renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return c("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t===""?"environment":t,accept:n,ref:r})};renderMyDeviceAcquirer=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})});renderPhotoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})});renderVideoCamera=()=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[c("div",{className:"uppy-DashboardTab-inner",children:c("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:c("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),c("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})});renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0,children:e})};renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return c("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t})})};[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderAcquirer=e=>c("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id,children:c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":this.props.activePickerPanel?.id===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id),children:[c("div",{className:"uppy-DashboardTab-inner",children:e.icon()}),c("div",{className:"uppy-DashboardTab-name",children:e.name})]})});renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return c(Ae,{children:[t.map(s=>this.renderAcquirer(s)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:r.map(s=>this.renderAcquirer(s))})]})};renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(f=>({key:f.id,elements:this.renderAcquirer(f)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],h=l.splice(n.length-2,n.length);return c(Ae,{children:[this.renderDropPasteBrowseTagline(n.length),c("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[l.map(({key:f,elements:m})=>c(Ae,{children:m},f)),c("span",{role:"presentation",style:{"white-space":"nowrap"},children:h.map(({key:f,elements:m})=>c(Ae,{children:m},f))})]})]})};renderPoweredByUppy(){let{i18nArray:e}=this.props,t=c("span",{children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:c("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),c("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),r=e("poweredBy",{uppy:t});return c("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:r})}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return c("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),c("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&c("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}},Fa=mh;var Pg=Te(at(),1);var hE=i=>c("div",{className:(0,Pg.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18n("addingMoreFiles")}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1),children:i.i18n("back")})]}),c(Fa,{...i})]}),Fg=hE;var Og=Te(at(),1);function dE(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return c("div",{className:(0,Og.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:i.i18nArray("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:i.i18n("cancel")}),c("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor,children:i.i18n("save")})]}),c("div",{className:"uppy-DashboardContent-panelBody",children:i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))})]})}var Lg=dE;var Rg=Te(at(),1);function pE(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#686DE0",fillRule:"evenodd",children:[c("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),c("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),c("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function fE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function mE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function gE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function bE(){return c("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function yE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[c("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),c("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function vE(){return c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:c("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function Er(i){let e={color:"#838999",icon:yE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:vE()}:t==="image"?{color:"#686de0",icon:pE()}:t==="audio"?{color:"#068dbb",icon:fE()}:t==="video"?{color:"#19af67",icon:mE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:gE()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:bE()}:e}function wE(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var ti=wE;function Cn(i){let{file:e}=i;if(e.preview)return c("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=Er(e.type);return c("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[c("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t},children:r}),c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:c("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function gh(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,h=t.includes(a.id);return c("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[c("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l,children:a.name}),a.render!==void 0?a.render({value:n[a.id],onChange:f=>r(f,a.id),fieldCSSClasses:o,required:h,form:s.id},yi):c("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:h,value:n[a.id],placeholder:a.placeholder,onInput:f=>r(f.target.value,a.id),"data-uppy-super-focusable":!0})]},a.id)})}function bh(i){let{files:e,fileCardFor:t,toggleFileCard:r,saveFileCard:s,metaFields:n,requiredMetaFields:o,openFileEditor:a,i18n:l,i18nArray:h,className:f,canEditFile:m}=i,w=()=>typeof n=="function"?n(e[t]):n,y=e[t],_=w()??[],P=m(y),O={};_.forEach(L=>{O[L.id]=y.meta[L.id]??""});let[R,C]=Mt(O),F=Bi(L=>{L.preventDefault(),s(R,t)},[s,R,t]),k=(L,H)=>{C({...R,[H]:L})},S=()=>{r(!1)},[A]=Mt(()=>{let L=document.createElement("form");return L.setAttribute("tabindex","-1"),L.id=Ui(),L});return Vt(()=>(document.body.appendChild(A),A.addEventListener("submit",F),()=>{A.removeEventListener("submit",F),document.body.removeChild(A)}),[A,F]),c("div",{className:(0,Rg.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:ti,onDragLeave:ti,onDrop:ti,onPaste:ti,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:h("editing",{file:c("span",{className:"uppy-DashboardContent-titleFile",children:y.meta?y.meta.name:y.name})})}),c("button",{className:"uppy-DashboardContent-back",type:"button",form:A.id,title:l("finishEditingFile"),onClick:S,children:l("cancel")})]}),c("div",{className:"uppy-Dashboard-FileCard-inner",children:[c("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:Er(y.type).color},children:[c(Cn,{file:y}),P&&c("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:L=>{F(L),a(y)},children:l("editImage")})]}),c("div",{className:"uppy-Dashboard-FileCard-info",children:c(gh,{computedMetaFields:_,requiredMetaFields:o,updateMeta:k,form:A,formState:R})}),c("div",{className:"uppy-Dashboard-FileCard-actions",children:[c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:A.id,children:l("saveChanges")}),c("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:S,form:A.id,children:l("cancel")})]})]})]})}var Ng=Te(at(),1);function Mg(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function yh(i,e="Copy the URL below"){return new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function SE({file:i,uploadInProgressOrComplete:e,metaFields:t,canEditFile:r,i18n:s,onClick:n}){return!e&&t&&t.length>0||!e&&r(i)?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":s("editFileWithFilename",{file:i.meta.name}),title:s("editFileWithFilename",{file:i.meta.name}),onClick:()=>n(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:c("g",{fillRule:"evenodd",children:[c("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),c("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),c("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function EE({i18n:i,onClick:e,file:t}){return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":i("removeFile",{file:t.meta.name}),title:i("removeFile",{file:t.meta.name}),onClick:()=>e(),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[c("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),c("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function TE({file:i,uppy:e,i18n:t}){let r=s=>{yh(i.uploadURL,t("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(t("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>s.target.focus({preventScroll:!0}))};return c("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":t("copyLink"),title:t("copyLink"),onClick:s=>r(s),children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:c("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function vh(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:h,openFileEditor:f}=i;return c("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[c(SE,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?h(!0,t.id):f(t)}}),o&&t.uploadURL?c(TE,{file:t,uppy:e,i18n:l}):null,a?c(EE,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null]})}var Dg=Te(ea(),1);function Oa(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=4)return`${i.slice(0,e-1)}\u2026`;let t=e-3,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+"..."+i.slice(-s)}var xE=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function An(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!n?.length)return null;let o=n.map(a=>xE(a,s)).join(", ");return c("div",{className:"uppy-Dashboard-Item-errorMessage",children:[r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",c("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id),children:r("editFile")})]})}var kE=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return c("div",{className:"uppy-Dashboard-Item-name",title:t,children:Oa(t,r())})},_E=i=>{let{author:e}=i.file.meta,t=i.file.remote?.providerName,r="\xB7";return e?c("div",{className:"uppy-Dashboard-Item-author",children:[c("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Oa(e.name,13)}),t?c(Ae,{children:[` ${r} `,t,` ${r} `]}):null]}):null},CE=i=>i.file.size&&c("div",{className:"uppy-Dashboard-Item-statusSize",children:(0,Dg.default)(i.file.size)}),AE=i=>i.file.isGhost&&c("span",{children:[" \u2022 ",c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0),children:i.i18n("reSelect")})]}),PE=({file:i,onClick:e})=>i.error?c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":i.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function wh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return c("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[c("div",{className:"uppy-Dashboard-Item-fileName",children:[kE({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),c(PE,{file:e,onClick:()=>alert(e.error)})]}),c("div",{className:"uppy-Dashboard-Item-status",children:[_E({file:e}),CE({file:e}),AE({file:e,toggleAddFilesPanel:n,i18n:t})]}),c(An,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function Sh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":Er(e.type).color;return c("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a},children:[n&&e.uploadURL&&c("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:c("span",{hidden:!0,children:e.meta.name})}),c(Cn,{file:e}),c(An,{file:e,i18n:t,toggleFileCard:r,metaFields:s})]})}function FE(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function Ig(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Eh(i){return c("div",{className:"uppy-Dashboard-Item-progress",children:c("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":Ig(i),title:Ig(i),onClick:()=>FE(i),children:i.children})})}function La({children:i}){return c("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:i})}function Th({progress:i}){let e=2*Math.PI*15;return c("g",{children:[c("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),c("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*i})]})}function xh(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(La,{children:[c("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),c("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):i.recoveredState?null:i.error&&!i.hideRetryButton?c(Eh,{...i,children:c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[c("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),c("path",{d:"M7.9 3H10v2H7.9z"}),c("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),c("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):i.resumableUploads&&!i.hidePauseResumeButton?c(Eh,{...i,children:c(La,{children:[c(Th,{progress:i.file.progress.percentage}),i.file.isPaused?c("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):c("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[c("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),c("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?c(Eh,{...i,children:c(La,{children:[c(Th,{progress:i.file.progress.percentage}),c("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):c("div",{className:"uppy-Dashboard-Item-progress",children:c("div",{className:"uppy-Dashboard-Item-progressIndicator",children:c(La,{children:c(Th,{progress:i.file.progress.percentage})})})})}var Pn=class extends ke{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Mg(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let h=(0,Ng.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return c("div",{className:h,id:`uppy_${e.id}`,role:this.props.role,children:[c("div",{className:"uppy-Dashboard-Item-preview",children:[c(Sh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),c(xh,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),c("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[c(wh,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),c(vh,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}};function OE(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function kh({id:i,i18n:e,uppy:t,files:r,resumableUploads:s,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,isSingleFile:m,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:_,recoveredState:P,individualCancellation:O,itemsPerRow:R,openFileEditor:C,canEditFile:F,toggleAddFilesPanel:k,containerWidth:S,containerHeight:A}){let L=R===1?71:200,H=Ni(()=>{let G=(ee,se)=>Number(r[se].isGhost)-Number(r[ee].isGhost),K=Object.keys(r);return P&&K.sort(G),OE(K,R)},[r,R,P]),j=G=>c("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:G.map(K=>c(Pn,{uppy:t,id:i,i18n:e,resumableUploads:s,individualCancellation:O,hideRetryButton:n,hidePauseResumeButton:o,hideCancelButton:a,showLinkToFileUploadResult:l,showRemoveButtonAfterComplete:h,metaFields:f,recoveredState:P,isSingleFile:m,containerWidth:S,containerHeight:A,toggleFileCard:w,handleRequestThumbnail:y,handleCancelThumbnail:_,role:"listitem",openFileEditor:C,canEditFile:F,toggleAddFilesPanel:k,file:r[K]},K))},G[0]);return m?c("div",{class:"uppy-Dashboard-files",children:j(H[0])}):c(la,{class:"uppy-Dashboard-files",role:"list",data:H,renderRow:j,rowHeight:L})}var Bg=Te(at(),1);function LE({activePickerPanel:i,className:e,hideAllPanels:t,i18n:r,state:s,uppy:n}){let o=Ii(null);return c("div",{className:(0,Bg.default)("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${i.id}`,onDragOver:ti,onDragLeave:ti,onDrop:ti,onPaste:ti,children:[c("div",{className:"uppy-DashboardContent-bar",children:[c("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:r("importFrom",{name:i.name})}),c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t,children:r("cancel")})]}),c("div",{ref:o,className:"uppy-DashboardContent-panelBody",children:n.getPlugin(i.id).render(s,o.current)})]})}var Ug=LE;var ii={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function RE(i,e,t,r={}){if(i)return ii.STATE_ERROR;if(e)return ii.STATE_COMPLETE;if(t)return ii.STATE_PAUSED;let s=ii.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return ii.STATE_UPLOADING;a.preprocess&&s!==ii.STATE_UPLOADING&&(s=ii.STATE_PREPROCESSING),a.postprocess&&s!==ii.STATE_UPLOADING&&s!==ii.STATE_PREPROCESSING&&(s=ii.STATE_POSTPROCESSING)}return s}function ME({files:i,i18n:e,isAllComplete:t,isAllErrored:r,isAllPaused:s,inProgressNotPausedFiles:n,newFiles:o,processingFiles:a}){switch(RE(r,t,s,i)){case"uploading":return e("uploadingXFiles",{smart_count:n.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:a.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:o.length});case"complete":return e("uploadComplete");case"error":return e("error");default:}}function DE(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),c("div",{className:"uppy-DashboardContent-bar",children:[!t&&!r?c("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll(),children:e("cancel")}):c("div",{}),c("div",{className:"uppy-DashboardContent-title",children:c(ME,{...i})}),a?c("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0),children:[c("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:c("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),c("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):c("div",{})]})}var zg=DE;var jg=Te(at(),1);var cs="uppy-transition-slideDownUp",Hg=250;function IE({children:i}){let[e,t]=Mt(null),[r,s]=Mt(""),n=Ii(),o=Ii(),a=Ii(),l=()=>{s(`${cs}-enter`),cancelAnimationFrame(a.current),clearTimeout(o.current),o.current=void 0,a.current=requestAnimationFrame(()=>{s(`${cs}-enter ${cs}-enter-active`),n.current=setTimeout(()=>{s("")},Hg)})},h=()=>{s(`${cs}-leave`),cancelAnimationFrame(a.current),clearTimeout(n.current),n.current=void 0,a.current=requestAnimationFrame(()=>{s(`${cs}-leave ${cs}-leave-active`),o.current=setTimeout(()=>{t(null),s("")},Hg)})};return Vt(()=>{let f=pt(i)[0];e!==f&&(f&&!e?l():e&&!f&&!o.current&&h(),t(f))},[i,e]),Vt(()=>()=>{clearTimeout(n.current),clearTimeout(o.current),cancelAnimationFrame(a.current)},[]),e?Qs(e,{className:(0,jg.default)(r,e.props.className)}):null}var Fn=IE;var qg=900,$g=700,_h=576,Vg=330;function Ch(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>_h,s=i.containerHeight>Vg,n=(0,Wg.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>_h,"uppy-size--lg":i.containerWidth>$g,"uppy-size--xl":i.containerWidth>qg,"uppy-size--height-md":i.containerHeight>Vg,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>qg?o=5:i.containerWidth>$g?o=4:i.containerWidth>_h&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,h=i.files?Object.keys(i.files).filter(w=>i.files[w].isGhost).length:0,f=()=>h>0?i.i18n("recoveredXFiles",{smart_count:h}):i.i18n("recoveredAllFiles");return c("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&fh(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop,children:[c("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),c("div",{className:"uppy-Dashboard-inner",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""},children:[i.inline?null:c("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal,children:c("span",{"aria-hidden":"true",children:"\xD7"})}),c("div",{className:"uppy-Dashboard-innerWrap",children:[c("div",{className:"uppy-Dashboard-dropFilesHereHint",children:i.i18n("dropHint")}),a&&c(zg,{...i}),l&&c("div",{className:"uppy-Dashboard-serviceMsg",children:[c("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:c("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[c("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),c("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),c("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),c("strong",{className:"uppy-Dashboard-serviceMsg-title",children:i.i18n("sessionRestored")}),c("div",{className:"uppy-Dashboard-serviceMsg-text",children:f()})]}),a?c(kh,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):c(Fa,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),c(Fn,{children:i.showAddFilesPanel?c(Fg,{...i,isSizeMD:r},"AddFiles"):null}),c(Fn,{children:i.fileCardFor?c(bh,{...i},"FileCard"):null}),c(Fn,{children:i.activePickerPanel?c(Ug,{...i},"Picker"):null}),c(Fn,{children:i.showFileEditor?c(Lg,{...i},"Editor"):null}),c("div",{className:"uppy-Dashboard-progressindicators",children:i.progressindicators.map(w=>i.uppy.getPlugin(w.id).render(i.state))})]})]})]})}var Gg={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};var Ra=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];var Kg=Te(ku(),1);function On(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function Ah(){let i=!1;return(0,Kg.default)((t,r)=>{let s=On(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");n&&!o||(o?(o.focus({preventScroll:!0}),i=!0):(s.querySelector(Ra)?.focus({preventScroll:!0}),i=!1))},260)}function Yg(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function NE(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function BE(i){return i.contains(document.activeElement)}function Ph(i,e,t){let r=On(t,e),s=Hi(r.querySelectorAll(Ra)),n=s.indexOf(document.activeElement);BE(r)?i.shiftKey&&n===0?NE(i,s):!i.shiftKey&&n===s.length-1&&Yg(i,s):Yg(i,s)}function Xg(i,e,t){e===null||Ph(i,e,t)}var Zg=9,zE=27;function Qg(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var HE={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:fn,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},Tr=class extends Wt{static VERSION=Ag.version;#e;modalName=`uppy-Dashboard-${Ui()}`;superFocus=Ah();ifFocusedOnUppyRecently=!1;dashboardIsDisabled;savedScrollPosition;savedActiveElement;resizeObserver;darkModeMediaQuery;makeDashboardInsidesVisibleAnywayTimeout;constructor(e,t){let r=t?.autoOpen??null;super(e,{...HE,...t,autoOpen:r}),this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=Gg,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),this.opts.onRequestCloseModal??=()=>this.closeModal(),this.i18nInit()}removeTarget=e=>{let r=this.getPluginState().targets.filter(s=>s.id!==e.id);this.setPluginState({targets:r})};addTarget=e=>{let t=e.id||e.constructor.name,r=e.title||t,s=e.type;if(s!=="acquirer"&&s!=="progressindicator"&&s!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let n={id:t,name:r,type:s},a=this.getPluginState().targets.slice();return a.push(n),this.setPluginState({targets:a}),this.el};hideAllPanels=()=>{let e=this.getPluginState(),t={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};e.activePickerPanel===t.activePickerPanel&&e.showAddFilesPanel===t.showAddFilesPanel&&e.showFileEditor===t.showFileEditor&&e.activeOverlayType===t.activeOverlayType||(this.setPluginState(t),this.uppy.emit("dashboard:close-panel",e.activePickerPanel?.id))};showPanel=e=>{let{targets:t}=this.getPluginState(),r=t.find(s=>s.type==="acquirer"&&s.id===e);this.setPluginState({activePickerPanel:r,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",e)};canEditFile=e=>{let{targets:t}=this.getPluginState();return this.#l(t).some(s=>this.uppy.getPlugin(s.id).canEditFile(e))};openFileEditor=e=>{let{targets:t}=this.getPluginState(),r=this.#l(t);this.setPluginState({showFileEditor:!0,fileCardFor:e.id||null,activeOverlayType:"FileEditor"}),r.forEach(s=>{this.uppy.getPlugin(s.id).selectFile(e)})};closeFileEditor=()=>{let{metaFields:e}=this.getPluginState();e&&e.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})};saveFileEditor=()=>{let{targets:e}=this.getPluginState();this.#l(e).forEach(r=>{this.uppy.getPlugin(r.id).save()}),this.closeFileEditor()};openModal=()=>{let{promise:e,resolve:t}=Qg();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let r=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",r,!1),t()};this.el.addEventListener("animationend",r,!1)}else this.setPluginState({isHidden:!1}),t();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),e};closeModal=e=>{let t=e?.manualClose??!0,{isHidden:r,isClosing:s}=this.getPluginState();if(r||s)return;let{promise:n,resolve:o}=Qg();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let a=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",a,!1),o()};this.el.addEventListener("animationend",a,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),o();return document.removeEventListener("keydown",this.handleKeyDownInModal),t&&this.opts.browserBackButtonClose&&history.state?.[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),n};isModalOpen=()=>!this.getPluginState().isHidden||!1;requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal();setDarkModeCapability=e=>{let{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,darkMode:e}})};handleSystemDarkModeChange=e=>{let t=e.matches;this.uppy.log(`[Dashboard] Dark mode is ${t?"on":"off"}`),this.setDarkModeCapability(t)};toggleFileCard=(e,t)=>{let r=this.uppy.getFile(t);e?this.uppy.emit("dashboard:file-edit-start",r):this.uppy.emit("dashboard:file-edit-complete",r),this.setPluginState({fileCardFor:e?t:null,activeOverlayType:e?"FileCard":null})};toggleAddFilesPanel=e=>{this.setPluginState({showAddFilesPanel:e,activeOverlayType:e?"AddFiles":null})};addFiles=e=>{let t=e.map(r=>({source:this.id,name:r.name,type:r.type,data:r,meta:{relativePath:r.relativePath||r.webkitRelativePath||null}}));try{this.uppy.addFiles(t)}catch(r){this.uppy.log(r)}};startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(e=>{let t=e[0],{width:r,height:s}=t.contentRect;this.setPluginState({containerWidth:r,containerHeight:s,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let e=this.getPluginState(),t=!this.opts.inline&&e.isHidden;!e.areInsidesReadyToBeVisible&&!t&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)};stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)};recordIfFocusedOnUppyRecently=e=>{this.el.contains(e.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())};disableInteractiveElements=e=>{let t=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],r=this.#e??Hi(this.el.querySelectorAll(t)).filter(s=>!s.classList.contains("uppy-Dashboard-close"));for(let s of r)s.tagName==="A"?s.setAttribute("aria-disabled",e):s.disabled=e;e?this.#e=r:this.#e=null,this.dashboardIsDisabled=e};updateBrowserHistory=()=>{history.state?.[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)};handlePopState=e=>{this.isModalOpen()&&(!e.state||!e.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&e.state?.[this.modalName]&&history.back()};handleKeyDownInModal=e=>{e.keyCode===zE&&this.requestCloseModal(),e.keyCode===Zg&&Ph(e,this.getPluginState().activeOverlayType,this.el)};handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()};handlePaste=e=>{this.uppy.iteratePlugins(r=>{r.type==="acquirer"&&r.handleRootPaste?.(e)});let t=Hi(e.clipboardData.files);t.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(t))};handleInputChange=e=>{e.preventDefault();let t=Hi(e.currentTarget.files||[]);t.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(t))};handleDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=()=>{let o=!0;return this.uppy.iteratePlugins(a=>{a.canHandleRootDrop?.(e)&&(o=!0)}),o},r=()=>{let{types:o}=e.dataTransfer;return o.some(a=>a==="Files")},s=t(),n=r();if(!s&&!n||this.opts.disabled||this.opts.disableLocalFiles&&(n||!s)||!this.uppy.getState().allowNewUpload){e.dataTransfer.dropEffect="none";return}e.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(e)};handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(e)};handleDrop=async e=>{e.preventDefault(),e.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(n=>{n.type==="acquirer"&&n.handleRootDrop?.(e)});let t=!1,r=n=>{this.uppy.log(n,"error"),t||(this.uppy.info(n.message,"error"),t=!0)};this.uppy.log("[Dashboard] Processing dropped files");let s=await ph(e.dataTransfer,{logDropError:r});s.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(s)),this.opts.onDrop(e)};handleRequestThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",e)};handleCancelThumbnail=e=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",e)};handleKeyDownInInline=e=>{e.keyCode===Zg&&Xg(e,this.getPluginState().activeOverlayType,this.el)};handlePasteOnBody=e=>{this.el.contains(document.activeElement)&&this.handlePaste(e)};handleComplete=({failed:e})=>{this.opts.closeAfterFinish&&!e?.length&&this.requestCloseModal()};handleCancelRestore=()=>{this.uppy.emit("restore-canceled")};#t=()=>{if(this.opts.disableThumbnailGenerator)return;let e=600,t=this.uppy.getFiles();if(t.length===1){let r=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);r?.setOptions({thumbnailWidth:e});let s={...t[0],preview:void 0};r?.requestThumbnail(s).then(()=>{r?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}};#i=e=>{let t=e[0],{metaFields:r}=this.getPluginState(),s=r&&r.length>0,n=this.canEditFile(t);s&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,t.id):n&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(t)};initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let e=uh(this.opts.trigger);e?e.forEach(t=>t.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",this.#c),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",this.#t),this.uppy.on("file-removed",this.#t),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",this.#i)};removeEvents=()=>{let e=uh(this.opts.trigger);!this.opts.inline&&e&&e.forEach(t=>t.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",this.#c),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",this.#t),this.uppy.off("file-removed",this.#t),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",this.#i)};superFocusOnEachUpdate=()=>{let e=this.el.contains(document.activeElement),t=document.activeElement===document.body||document.activeElement===null,r=this.uppy.getState().info.length===0,s=!this.opts.inline;r&&(s||e||t&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()};afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()};saveFileCard=(e,t)=>{this.uppy.setFileMeta(t,e),this.toggleFileCard(!1,t)};#r=e=>{let t=this.uppy.getPlugin(e.id);return{...e,icon:t.icon||this.opts.defaultPickerIcon,render:t.render}};#s=e=>{let t=this.uppy.getPlugin(e.id);return typeof t.isSupported!="function"?!0:t.isSupported()};#a=e=>e.filter(t=>t.type==="acquirer"&&this.#s(t)).map(this.#r);#n=e=>e.filter(t=>t.type==="progressindicator").map(this.#r);#l=e=>e.filter(t=>t.type==="editor").map(this.#r);render=e=>{let t=this.getPluginState(),{files:r,capabilities:s,allowNewUpload:n}=e,{newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:_,isAllPaused:P}=this.uppy.getObjectOfFilesPerState(),O=this.#a(t.targets),R=this.#n(t.targets),C=this.#l(t.targets),F;return this.opts.theme==="auto"?F=s.darkMode?"dark":"light":F=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),Ch({state:e,isHidden:t.isHidden,files:r,newFiles:o,uploadStartedFiles:a,completeFiles:l,erroredFiles:h,inProgressFiles:f,inProgressNotPausedFiles:m,processingFiles:w,isUploadStarted:y,isAllComplete:_,isAllPaused:P,totalFileCount:Object.keys(r).length,totalProgress:e.totalProgress,allowNewUpload:n,acquirers:O,theme:F,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:t.activePickerPanel,showFileEditor:t.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:t.isClosing,progressindicators:R,editors:C,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:e.recoveredState,metaFields:t.metaFields,resumableUploads:s.resumableUploads||!1,individualCancellation:s.individualCancellation,isMobileDevice:s.isMobileDevice,fileCardFor:t.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:t.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:t.containerWidth,containerHeight:t.containerHeight,areInsidesReadyToBeVisible:t.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:t.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})};#o=()=>{let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r?r.mount(this,r):this.uppy.log(`[Uppy] Dashboard could not find plugin '${t}', make sure to uppy.use() the plugins you are specifying`,"warning")})};#f=()=>{this.uppy.iteratePlugins(this.#c)};#c=e=>{let t=["acquirer","editor"];e&&!e.opts?.target&&t.includes(e.type)&&(this.getPluginState().targets.some(s=>e.id===s.id)||e.mount(this,e))};#h(){let{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideProgressAfterFinish:o,locale:a,doneButtonHandler:l}=this.opts;return{hideUploadButton:e,hideRetryButton:t,hidePauseResumeButton:r,hideCancelButton:s,showProgressDetails:n,hideAfterFinish:o,locale:a,doneButtonHandler:l}}#u(){let{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s}=this.opts;return{thumbnailWidth:e,thumbnailHeight:t,thumbnailType:r,waitForThumbnailsBeforeUpload:s,lazy:!s}}#p(){return{}}setOptions(e){super.setOptions(e),this.uppy.getPlugin(this.#m())?.setOptions(this.#h()),this.uppy.getPlugin(this.#d())?.setOptions(this.#u())}#m(){return`${this.id}:StatusBar`}#d(){return`${this.id}:ThumbnailGenerator`}#y(){return`${this.id}:Informer`}install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:e,closeAfterFinish:t}=this.opts;if(e&&t)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:r,allowMultipleUploadBatches:s}=this.uppy.opts;(r||s)&&t&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:n}=this.opts;n&&this.mount(n,this),this.opts.disableStatusBar||this.uppy.use(rs,{id:this.#m(),target:this,...this.#h()}),this.opts.disableInformer||this.uppy.use(es,{id:this.#y(),target:this,...this.#p()}),this.opts.disableThumbnailGenerator||this.uppy.use(_n,{id:this.#d(),...this.#u()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let o=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${o?"on":"off"}`),this.setDarkModeCapability(o),this.opts.theme==="auto"&&this.darkModeMediaQuery?.addListener(this.handleSystemDarkModeChange),this.#o(),this.#f(),this.initEvents()};uninstall=()=>{if(!this.opts.disableInformer){let t=this.uppy.getPlugin(`${this.id}:Informer`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableStatusBar){let t=this.uppy.getPlugin(`${this.id}:StatusBar`);t&&this.uppy.removePlugin(t)}if(!this.opts.disableThumbnailGenerator){let t=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);t&&this.uppy.removePlugin(t)}let{plugins:e}=this.opts;e.forEach(t=>{let r=this.uppy.getPlugin(t);r&&r.unmount()}),this.opts.theme==="auto"&&this.darkModeMediaQuery?.removeListener(this.handleSystemDarkModeChange),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()}};var Jg={name:"@uppy/image-editor",description:"Image editor and cropping UI",version:"3.4.2",license:"MIT",main:"lib/index.js",style:"dist/style.min.css",type:"module",scripts:{build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build"},keywords:["file uploader","upload","uppy","uppy-plugin","image editor","cropper","crop","rotate","resize"],homepage:"https://uppy.io",bugs:{url:"https://github.com/transloadit/uppy/issues"},repository:{type:"git",url:"git+https://github.com/transloadit/uppy.git"},files:["src","lib","dist","CHANGELOG.md"],dependencies:{"@uppy/utils":"^6.2.2",cropperjs:"^1.6.2",preact:"^10.5.13"},peerDependencies:{"@uppy/core":"^4.5.2"},publishConfig:{access:"public"},devDependencies:{cssnano:"^7.0.7",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3"}};var nb=Te(eb(),1);function qE(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var tb=qE;function $E(i){return i*(Math.PI/180)}function VE(i,e,t){let r=Math.abs($E(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var ib=VE;function WE(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var rb=WE;function GE(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var sb=GE;var Ln=class extends ke{imgElement;cropper;constructor(e){super(e),this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new nb.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=rb(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=sb(t,r,s);n&&this.cropper.setCropBoxData(n)}}onRotate90Deg=()=>{let{angle90Deg:e}=this.state,t=e-90;this.setState({angle90Deg:t,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(t);let r=this.cropper.getCanvasData(),s=this.cropper.getContainerData(),n=tb(s,r);this.cropper.setCanvasData(n),this.cropper.setCropBoxData(n)};onRotateGranular=e=>{let t=Number(e.target.value);this.setState({angleGranular:t});let{angle90Deg:r}=this.state,s=r+t;this.cropper.rotateTo(s);let n=this.cropper.getImageData(),o=ib(n.naturalWidth,n.naturalHeight,t),a=this.cropper.getImageData().scaleX<0?-o:o;this.cropper.scale(a,o)};renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return c("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper",children:c("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")})})}renderRevert(){let{i18n:e,opts:t}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})},children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})]})})}renderRotate(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg,children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})]})})}renderFlip(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})]})})}renderZoomIn(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),c("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})]})})}renderZoomOut(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0V0z",fill:"none"}),c("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})]})})}renderCropSquare(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M0 0h24v24H0z",fill:"none"}),c("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})]})})}renderCropWidescreen(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),c("path",{fill:"none",d:"M0 0h24v24H0z"})]})})}renderCropWidescreenVertical(){let{i18n:e}=this.props;return c("button",{"data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16),children:c("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24",children:[c("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),c("path",{d:"M0 0h24v24H0z",fill:"none"})]})})}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return c("div",{className:"uppy-ImageCropper",children:[c("div",{className:"uppy-ImageCropper-container",children:c("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})}),c("div",{className:"uppy-ImageCropper-controls",children:[r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()]})]})}};var ob={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var ab={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},lb={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},KE={quality:.8,actions:lb,cropperOptions:ab},us=class extends Wt{static VERSION=Jg.version;cropper;constructor(e,t){super(e,{...KE,...t,actions:{...lb,...t?.actions},cropperOptions:{...ab,...t?.cropperOptions}}),this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=ob,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}save=()=>{let e=s=>{let{currentImage:n}=this.getPluginState();this.uppy.setFileState(n.id,{data:new File([s],n.name??this.i18n("unnamed"),{type:s.type}),size:s.size,preview:void 0});let o=this.uppy.getFile(n.id);this.uppy.emit("thumbnail:request",o),this.setPluginState({currentImage:o}),this.uppy.emit("file-editor:complete",o)},{currentImage:t}=this.getPluginState(),r=this.cropper.getCroppedCanvas({});r.width%2!==0&&this.cropper.setData({width:r.width-1}),r.height%2!==0&&this.cropper.setData({height:r.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(e,t.type,this.opts.quality)};storeCropperInstance=e=>{this.cropper=e};selectFile=e=>{this.uppy.emit("file-editor:start",e),this.setPluginState({currentImage:e})};install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:c(Ln,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};var Rn=class{#e;#t=[];constructor(e){this.#e=e}on(e,t){return this.#t.push([e,t]),this.#e.on(e,t)}remove(){for(let[e,t]of this.#t.splice(0))this.#e.off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{this.#e.getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{this.#e.getFile(e)&&t()})}onCancelAll(e,t){this.on("cancel-all",(...r)=>{this.#e.getFile(e)&&t(...r)})}onResumeAll(e,t){this.on("resume-all",()=>{this.#e.getFile(e)&&t()})}};function YE(i){return new Error("Cancelled",{cause:i})}function cb(i){if(i!=null){let e=()=>this.abort(i.reason);i.addEventListener("abort",e,{once:!0});let t=()=>{i.removeEventListener("abort",e)};this.then?.(t,t)}return this}var Ma=class{#e=0;#t=[];#i=!1;#r;#s=1;#a;#n;limit;constructor(e){typeof e!="number"||e===0?this.limit=1/0:this.limit=e}#l(e){this.#e+=1;let t=!1,r;try{r=e()}catch(s){throw this.#e-=1,s}return{abort:s=>{t||(t=!0,this.#e-=1,r?.(s),this.#o())},done:()=>{t||(t=!0,this.#e-=1,this.#o())}}}#o(){queueMicrotask(()=>this.#f())}#f(){if(this.#i||this.#e>=this.limit||this.#t.length===0)return;let e=this.#t.shift();if(e==null)throw new Error("Invariant violation: next is null");let t=this.#l(e.fn);e.abort=t.abort,e.done=t.done}#c(e,t){let r={fn:e,priority:t?.priority||0,abort:()=>{this.#h(r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=this.#t.findIndex(n=>r.priority>n.priority);return s===-1?this.#t.push(r):this.#t.splice(s,0,r),r}#h(e){let t=this.#t.indexOf(e);t!==-1&&this.#t.splice(t,1)}run(e,t){return!this.#i&&this.#e<this.limit?this.#l(e):this.#c(e,t)}wrapSyncFunction(e,t){return(...r)=>{let s=this.run(()=>(e(...r),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:cb,abort(){s.abort()}}}}wrapPromiseFunction(e,t){return(...r)=>{let s,n=new Promise((o,a)=>{s=this.run(()=>{let l,h;try{h=Promise.resolve(e(...r))}catch(f){h=Promise.reject(f)}return h.then(f=>{l?a(l):(s.done(),o(f))},f=>{l?a(l):(s.done(),a(f))}),f=>{l=YE(f)}},t)});return n.abort=o=>{s.abort(o)},n.abortOn=cb,n}}resume(){this.#i=!1,clearTimeout(this.#r);for(let e=0;e<this.limit;e++)this.#o()}#u=()=>this.resume();pause(e=null){this.#i=!0,clearTimeout(this.#r),e!=null&&(this.#r=setTimeout(this.#u,e))}rateLimit(e){clearTimeout(this.#n),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(this.#a=this.limit-1,this.limit=this.#s,this.#n=setTimeout(this.#p,e))}#p=()=>{if(this.#i){this.#n=setTimeout(this.#p,0);return}this.#s=this.limit,this.limit=Math.ceil((this.#a+this.#s)/2);for(let e=this.#s;e<=this.limit;e++)this.#o();this.#a-this.#s>3?this.#n=setTimeout(this.#p,2e3):this.#s=Math.floor(this.#s/2)};get isPaused(){return this.#i}},Da=Symbol("__queue");var Lh=class extends Error{cause;isNetworkError;request;constructor(e,t=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},Mn=Lh;function XE(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var ub=XE;var Rh=class{#e;#t=!1;#i;#r;constructor(e,t){this.#r=e,this.#i=()=>t(e)}progress(){this.#t||this.#r>0&&(clearTimeout(this.#e),this.#e=setTimeout(this.#i,this.#r))}done(){this.#t||(clearTimeout(this.#e),this.#e=void 0,this.#t=!0)}},hb=Rh;var Ia=()=>{};function db(i,e={}){let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=Ia,onUploadProgress:o=Ia,shouldRetry:a=()=>!0,onAfterResponse:l=Ia,onTimeout:h=Ia,responseType:f,retries:m=3,signal:w=null,timeout:y=3e4,withCredentials:_=!1}=e,P=C=>.3*2**(C-1)*1e3,O=new hb(y,h);function R(C=0){return new Promise(async(F,k)=>{let S=new XMLHttpRequest,A=L=>{a(S)&&C<m?setTimeout(()=>{R(C+1).then(F,k)},P(C)):(O.done(),k(L))};S.open(s,i,!0),S.withCredentials=_,f&&(S.responseType=f),w?.addEventListener("abort",()=>{S.abort(),k(new DOMException("Aborted","AbortError"))}),S.onload=async()=>{try{await l(S,C)}catch(L){L.request=S,A(L);return}S.status>=200&&S.status<300?(O.done(),F(S)):a(S)&&C<m?setTimeout(()=>{R(C+1).then(F,k)},P(C)):(O.done(),k(new Mn(S.statusText,S)))},S.onerror=()=>A(new Mn(S.statusText,S)),S.upload.onprogress=L=>{O.progress(),o(L)},r&&Object.keys(r).forEach(L=>{S.setRequestHeader(L,r[L])}),await n(S,C),S.send(t)})}return R()}function pb(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function fb(i){return i.filter(e=>!e.progress?.uploadStarted||!e.isRestored)}function Na(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var mb={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function wi(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var ZE=0;function ds(i){return"__private_"+ZE+++"_"+i}var QE={version:"4.3.3"};function JE(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),ub(i)?(t=new Mn(t,i),t):(t.request=i,t)}function gb(i){return i.data.slice(0,i.data.size,i.meta.type)}var eT={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},xr=ds("getFetcher"),Ih=ds("uploadLocalFile"),Mh=ds("uploadBundle"),Nh=ds("getCompanionClientArgs"),Dh=ds("uploadFiles"),Dn=ds("handleUpload"),hs=class extends Di{constructor(e,t){if(super(e,{...eT,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,Dh,{value:sT}),Object.defineProperty(this,Nh,{value:rT}),Object.defineProperty(this,Mh,{value:iT}),Object.defineProperty(this,Ih,{value:tT}),Object.defineProperty(this,xr,{writable:!0,value:void 0}),Object.defineProperty(this,Dn,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[Da]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=pb(s),o=fb(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await wi(this,Mh)[Mh](n)}else await wi(this,Dh)[Dh](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=mb,this.i18nInit(),Da in this.opts?this.requests=this.opts[Da]:this.requests=new Ma(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),wi(this,xr)[xr]=r=>async(s,n)=>{try{var o,a,l;let m=await db(s,{...n,onBeforeRequest:(_,P)=>{var O,R;return(O=(R=this.opts).onBeforeRequest)==null?void 0:O.call(R,_,P,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:_=>{let P=Math.ceil(_/1e3),O=new Error(this.i18n("uploadStalled",{seconds:P}));this.uppy.emit("upload-stalled",O,r)},onUploadProgress:_=>{if(_.lengthComputable)for(let{id:O}of r){var P;let R=this.uppy.getFile(O);this.uppy.emit("upload-progress",R,{uploadStarted:(P=R.progress.uploadStarted)!=null?P:0,bytesUploaded:_.loaded/_.total*R.size,bytesTotal:R.size})}}}),w=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,m));if(m.responseType==="json"){var h;(h=w)!=null||(w=m.response)}else try{var f;(f=w)!=null||(w=JSON.parse(m.responseText))}catch(_){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:_})}let y=typeof((l=w)==null?void 0:l.url)=="string"?w.url:void 0;for(let{id:_}of r)this.uppy.emit("upload-success",this.uppy.getFile(_),{status:m.status,body:w,uploadURL:y});return m}catch(m){if(m.name==="AbortError")return;let w=m.request;for(let y of r)this.uppy.emit("upload-error",this.uppy.getFile(y.id),JE(w,m),w);throw m}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Na(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=gb(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=gb(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(wi(this,Dn)[Dn])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(wi(this,Dn)[Dn])}};async function tT(i){let e=new Rn(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=wi(this,xr)[xr]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function iT(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=wi(this,xr)[xr](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function rT(i){var e;let t=this.getOptions(i),r=Na(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function sT(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,wi(this,Nh)[Nh](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return wi(this,Ih)[Ih](e)}))}hs.VERSION=QE.version;var Qe=class{static fromTemplate(i){if(Kr.isSupported)return Kr.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return nT(e)}}};function nT(i){return oT(i),bb(i),i}function oT(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function aT(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function lT(i){let e=i.attributes;for(let{name:t,value:r}of e)aT(t,r)&&i.removeAttribute(t)}function bb(i){let e=i.children;for(let t of e)lT(t),bb(t)}var Ba=class extends W{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#l(),this.#n())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#n()}attachmentPreviewOutletDisconnected(i,e){this.#n()}configureUppy(){let i={inline:!1,closeAfterFinish:!0},e=this.element.closest("dialog");e&&(i.target=e),this.uppy=new ra({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(Tr,i).use(us,{target:Tr}),this.#i(),this.#r()}#i(){this.uppy.use(hs,{endpoint:this.endpointValue})}#r(){this.uppy.on("upload-success",this.#a.bind(this))}#s(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#u.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#u.openModal()}#a(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#c(t,r))}#n(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#l(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#o(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#o(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=Qe.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
99
99
  <svg class="w-4 h-4 mr-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
100
100
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"/>
101
101
  </svg>
102
102
  ${i}
103
- </button>`,!1),this.uploadTrigger.addEventListener("click",this.#n.bind(this))}#f(){this.deleteAllTrigger=Xe.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
103
+ </button>`,!1),this.uploadTrigger.addEventListener("click",this.#s.bind(this))}#f(){this.deleteAllTrigger=Qe.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
104
104
  Delete ${this.attachmentPreviewOutlets.length}
105
- </button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#c(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=Xe.fromTemplate(this.#d(t,r,n,e,a)),h=Xe.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return h.value=JSON.stringify(i),l.appendChild(h),l}#d(i,e,t,r,s){return`
105
+ </button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#c(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=Qe.fromTemplate(this.#h(t,r,n,e,a)),h=Qe.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return h.value=JSON.stringify(i),l.appendChild(h),l}#h(i,e,t,r,s){return`
106
106
  <div class="${this.identifierValue} attachment-preview group relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md transition-all duration-300"
107
107
  data-controller="attachment-preview"
108
108
  data-attachment-preview-mime-type-value="${t}"
@@ -124,7 +124,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
124
124
  Delete
125
125
  </button>
126
126
  </div>
127
- `}get#u(){return this.uppy.getPlugin("Dashboard")}get multiple(){return this.maxFileNumValue!=1}};function KE(){return Xe.fromTemplate(`
127
+ `}get#u(){return this.uppy.getPlugin("Dashboard")}get multiple(){return this.maxFileNumValue!=1}};function cT(){return Qe.fromTemplate(`
128
128
  <svg aria-hidden="true" focusable="false" width="25" height="25" viewBox="0 0 25 25">
129
129
  <g fill="#686DE0" fillRule="evenodd">
130
130
  <path d="M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z" fillRule="nonzero" />
@@ -132,36 +132,36 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
132
132
  <circle cx="7.5" cy="9.5" r="1.5" />
133
133
  </g>
134
134
  </svg>
135
- `)}function YE(){return Xe.fromTemplate(`
135
+ `)}function uT(){return Qe.fromTemplate(`
136
136
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
137
137
  <path d="M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z" fill="#049BCF" fillRule="nonzero" />
138
138
  </svg>
139
- `)}function XE(){return Xe.fromTemplate(`
139
+ `)}function hT(){return Qe.fromTemplate(`
140
140
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
141
141
  <path d="M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z" fill="#19AF67" fillRule="nonzero" />
142
142
  </svg>
143
- `)}function ZE(){return Xe.fromTemplate(`
143
+ `)}function dT(){return Qe.fromTemplate(`
144
144
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
145
145
  <path d="M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z" fill="#E2514A" fillRule="nonzero" />
146
146
  </svg>
147
- `)}function QE(){return Xe.fromTemplate(`
147
+ `)}function pT(){return Qe.fromTemplate(`
148
148
  <svg aria-hidden="true" focusable="false" width="25" height="25" viewBox="0 0 25 25">
149
149
  <path d="M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z" fill="#00C469" fillRule="nonzero" />
150
150
  </svg>
151
- `)}function JE(){return Xe.fromTemplate(`
151
+ `)}function fT(){return Qe.fromTemplate(`
152
152
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
153
153
  <g fill="#A7AFB7" fillRule="nonzero">
154
154
  <path d="M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z" />
155
155
  <path d="M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z" />
156
156
  </g>
157
157
  </svg>
158
- `)}function eT(){return Xe.fromTemplate(`
158
+ `)}function mT(){return Qe.fromTemplate(`
159
159
  <svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
160
160
  <path d="M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z" fill="#5A5E69" fillRule="nonzero" />
161
161
  </svg>
162
- `)}function Ph(i){let e={color:"#838999",icon:JE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:eT()}:t==="image"?{color:"#686de0",icon:KE()}:t==="audio"?{color:"#068dbb",icon:YE()}:t==="video"?{color:"#19af67",icon:XE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:ZE()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:QE()}:e}var Da=class extends H{static targets=["thumbnail","thumbnailLink"];static values={mimeType:String,thumbnailUrl:String};connect(){this.hasThumbnailTarget&&(this.thumbnailUrlValue?this.useThumbnailPreview():this.useMimeIconPreview())}remove(){this.element.remove()}useThumbnailPreview(){let i=Xe.fromTemplate(`
162
+ `)}function Bh(i){let e={color:"#838999",icon:fT()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:mT()}:t==="image"?{color:"#686de0",icon:cT()}:t==="audio"?{color:"#068dbb",icon:uT()}:t==="video"?{color:"#19af67",icon:hT()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:dT()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:pT()}:e}var Ua=class extends W{static targets=["thumbnail","thumbnailLink"];static values={mimeType:String,thumbnailUrl:String};connect(){this.hasThumbnailTarget&&(this.thumbnailUrlValue?this.useThumbnailPreview():this.useMimeIconPreview())}remove(){this.element.remove()}useThumbnailPreview(){let i=Qe.fromTemplate(`
163
163
  <img src="${this.thumbnailUrlValue}" class="w-full h-full object-cover" />
164
- `);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=Ph(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var Na=class extends H{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var ob=0,Ba=class extends H{static targets=["scroll"];connect(){this.beforeRender=this.beforeRender.bind(this),this.afterRender=this.afterRender.bind(this),document.addEventListener("turbo:before-render",this.beforeRender),document.addEventListener("turbo:render",this.afterRender)}disconnect(){document.removeEventListener("turbo:before-render",this.beforeRender),document.removeEventListener("turbo:render",this.afterRender)}beforeRender(){this.hasScrollTarget&&(ob=this.scrollTarget.scrollTop)}afterRender(){this.hasScrollTarget&&(this.scrollTarget.scrollTop=ob)}};var Ua=class extends H{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var za=class extends H{static values={sentinel:String};connect(){this.armed=this.element.value===this.sentinelValue}beforeinput(i){if(!this.armed)return;i.preventDefault(),this.armed=!1;let e="";i.inputType==="insertText"&&i.data!=null?e=i.data:i.inputType==="insertFromPaste"&&i.dataTransfer&&(e=i.dataTransfer.getData("text")),this.element.value=e,this.element.setSelectionRange(e.length,e.length),this.element.dispatchEvent(new Event("input",{bubbles:!0}))}};var Ha=class extends H{connect(){this.originalScrollPosition=window.scrollY,this.originalOverflow=document.body.style.overflow,this.bodyStateRestored=!1,this._closing=!1,document.body.style.overflow="hidden",this.element.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.element.setAttribute("data-open","")})}),this.onCancel=this.#e.bind(this),this.onClose=this.#t.bind(this),this.onRequestClose=()=>this.#i(),this.element.addEventListener("cancel",this.onCancel),this.element.addEventListener("close",this.onClose),this.element.addEventListener("modal:request-close",this.onRequestClose)}disconnect(){this.element.removeEventListener("cancel",this.onCancel),this.element.removeEventListener("close",this.onClose),this.element.removeEventListener("modal:request-close",this.onRequestClose),this.#r()}close(){this.#i()}#e(i){i.target===this.element&&(i.defaultPrevented||(i.preventDefault(),this.#i()))}#t(){this.#r()}async#i(){if(this._closing)return;this._closing=!0,this.element.getAnimations().forEach(e=>e.finish()),this.element.removeAttribute("data-open");let i=this.element.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),this.element.close()}#r(){this.bodyStateRestored||(this.bodyStateRestored=!0,document.body.style.overflow=this.originalOverflow||"",window.scrollTo(0,this.originalScrollPosition))}};var ja=class extends H{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateIndices(),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`),t.id=t.id.replace(/_\d+_/,`_${e}_`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`),r.id=r.id.replace(/_\d+_/,`_${e}_`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e)),r.id&&(r.id=r.id.replace("___INDEX___",`_${e}_`))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var qa=class extends H{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","filterPills"];toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasFilterPillsTarget&&this.filterPillsTarget.classList.toggle("hidden",i.length>0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;n&&(s.href=t?`${n}?${t}`:n),s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}clearSelection(){this.checkboxTargets.forEach(i=>i.checked=!1),this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=!1,this.checkboxAllTarget.indeterminate=!1),this.updateUI()}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var $a=class extends H{static targets=["panel","backdrop"];connect(){this._onKeydown=this._onKeydown.bind(this)}disconnect(){this.isOpen&&(document.removeEventListener("keydown",this._onKeydown),this._unlockBodyScroll())}toggle(){this.isOpen?this.close():this.open()}open(){this.hasPanelTarget&&(this.panelTarget.setAttribute("data-open",""),this.panelTarget.setAttribute("aria-hidden","false")),this.hasBackdropTarget&&this.backdropTarget.setAttribute("data-open",""),this._lockBodyScroll(),document.addEventListener("keydown",this._onKeydown)}close(){this.hasPanelTarget&&(this.panelTarget.removeAttribute("data-open"),this.panelTarget.setAttribute("aria-hidden","true")),this.hasBackdropTarget&&this.backdropTarget.removeAttribute("data-open"),this._unlockBodyScroll(),document.removeEventListener("keydown",this._onKeydown)}_lockBodyScroll(){this._previousBodyOverflow==null&&(this._previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){this._previousBodyOverflow!=null&&(document.body.style.overflow=this._previousBodyOverflow,this._previousBodyOverflow=null)}clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.querySelector("form");i&&i.requestSubmit()}get isOpen(){return this.hasPanelTarget&&this.panelTarget.hasAttribute("data-open")}_onKeydown(i){i.key==="Escape"&&this.close()}};var Va=class extends H{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};var Wa=class extends H{static targets=["source"];copy(i){let e=this.sourceTarget.value||this.sourceTarget.textContent,t=i.currentTarget,r=t.textContent;navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)}).catch(s=>{console.warn("Clipboard API failed, using fallback:",s),this.fallbackCopy(e),t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)})}fallbackCopy(i){let e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}};var Ga=class extends H{static values={storageKey:{type:String,default:"pu_rail_pinned"}};connect(){let i=localStorage.getItem(this.storageKeyValue)!=="false";document.documentElement.classList.toggle("pu-rail-pinned",i)}disconnect(){document.querySelector('[data-controller~="icon-rail"]')||document.documentElement.classList.remove("pu-rail-pinned")}togglePin(){let i=document.documentElement.classList.toggle("pu-rail-pinned");localStorage.setItem(this.storageKeyValue,i)}};var Ka=class extends H{static targets=["trigger","panel"];static values={closeDelay:{type:Number,default:150}};connect(){this._closeTimer=null,this._open=!1,this._panel=null,this._panelHome=null,this._onPanelEnter=()=>{this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null)},this._onPanelLeave=()=>this.scheduleClose()}disconnect(){this._returnPanel()}open(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),!this._open&&(!this._panel&&!this.hasPanelTarget||(this._open=!0,this.element.dataset.flyoutOpen="true",this._portalPanel(),this._position()))}scheduleClose(){this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(()=>this.close(),this.closeDelayValue)}close(){this._open&&(this._open=!1,delete this.element.dataset.flyoutOpen,this._returnPanel())}toggle(i){i.preventDefault(),this._open?this.close():this.open()}closeOnEsc(i){i.key==="Escape"&&this.close()}_portalPanel(){if(this._panel)return;let i=this.panelTarget;i&&(this._panel=i,this._panelHome=i.parentElement,i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),document.body.appendChild(i),i.style.display="block")}_returnPanel(){if(!this._panel)return;let i=this._panel;i.removeEventListener("mouseenter",this._onPanelEnter),i.removeEventListener("mouseleave",this._onPanelLeave),i.style.position="",i.style.left="",i.style.top="",i.style.display="",this._panelHome&&document.contains(this._panelHome)?this._panelHome.appendChild(i):i.remove(),this._panel=null,this._panelHome=null}_position(){if(!this._panel||!this.hasTriggerTarget)return;let i=this._panel,e=this.triggerTarget.getBoundingClientRect();i.style.position="fixed",i.style.left=`${e.right+4}px`,i.style.top=`${e.top}px`,requestAnimationFrame(()=>{let t=i.getBoundingClientRect(),r=window.innerHeight;if(t.bottom>r-8){let s=t.bottom-(r-8),n=Math.max(8,parseFloat(i.style.top)-s);i.style.top=`${n}px`}})}};var Ya=class extends H{headerClick(i){if(!i.shiftKey)return;let t=i.currentTarget.dataset.tableHeaderMultiHref;t&&(i.preventDefault(),Turbo.visit(t))}};var Xa=class extends H{static targets=["panel"];connect(){this._onDocClick=this._onDocClick.bind(this)}toggle(i){i.preventDefault(),i.stopPropagation(),this.hasPanelTarget&&(!this.panelTarget.classList.toggle("hidden")?(document.addEventListener("click",this._onDocClick),this._onKey=t=>{t.key==="Escape"&&this._close()},document.addEventListener("keydown",this._onKey)):this._unbind())}_close(){this.hasPanelTarget&&this.panelTarget.classList.add("hidden"),this._unbind()}_unbind(){document.removeEventListener("click",this._onDocClick),this._onKey&&(document.removeEventListener("keydown",this._onKey),this._onKey=null)}_onDocClick(i){this.element.contains(i.target)||this._close()}};var Za=class extends H{connect(){if(!("value"in this.element))return;let i=this.element.value;if(!i)return;let{hash:e}=window.location;e&&(this.element.value=i.split("#")[0]+e)}};var Qa=class extends H{click(i){if(i.target.closest("a, button, input, label, select, textarea, [data-row-click-ignore]"))return;let e=this.element.querySelector('[data-row-click-target="show"]');if(e){if(i.metaKey||i.ctrlKey||i.button===1){window.open(e.href,"_blank","noopener");return}e.click()}}};var Ja=class extends H{static values={cookieName:String,cookiePath:{type:String,default:"/"}};select(i){let e=i.params.view;if(!e||!this.cookieNameValue)return;let t=3600*24*365,r=this.cookiePathValue||"/";document.cookie=`${this.cookieNameValue}=${encodeURIComponent(e)}; Path=${r}; Max-Age=${t}; SameSite=Lax`;let s=new URL(window.location.href);s.searchParams.delete("view"),window.location.href=s.toString()}};var el=class extends H{static values={delay:{type:Number,default:300}};connect(){this._timer=null}disconnect(){this._timer&&clearTimeout(this._timer)}submit(){this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this.element.closest("form")?.requestSubmit()},this.delayValue)}};var tl=class extends H{static targets=["confirmDialog"];static IGNORED_KEYS=new Set(["authenticity_token","return_to","pre_submit"]);static NON_EDITING_KEYS=new Set(["Tab","Escape","Shift","Control","Alt","Meta"]);connect(){this.dialog=this.element.closest("dialog"),this.baseline=null,this.forceClose=!1,this.submitting=!1,this.onFirstIntent=this.#t.bind(this),this.onSubmit=this.#n.bind(this),this.onLeaveClick=this.#s.bind(this),this.onSettled=this.#o.bind(this),this.element.addEventListener("pointerdown",this.onFirstIntent,!0),this.element.addEventListener("keydown",this.onFirstIntent,!0),this.element.addEventListener("submit",this.onSubmit),this.element.addEventListener("turbo:submit-end",this.onSettled),this.dialog||document.addEventListener("click",this.onLeaveClick,!0),this.dialog&&(this.onCancel=this.#u.bind(this),this.onCloseButtonClick=this.#p.bind(this),this.onConfirmCancel=this.#g.bind(this),this.onKeydown=this.#d.bind(this),document.addEventListener("keydown",this.onKeydown,!0),this.dialog.addEventListener("cancel",this.onCancel,!0),this.#e().forEach(i=>i.addEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.addEventListener("cancel",this.onConfirmCancel))}disconnect(){this.element.removeEventListener("pointerdown",this.onFirstIntent,!0),this.element.removeEventListener("keydown",this.onFirstIntent,!0),this.element.removeEventListener("submit",this.onSubmit),this.element.removeEventListener("turbo:submit-end",this.onSettled),this.dialog||document.removeEventListener("click",this.onLeaveClick,!0),this.dialog&&(document.removeEventListener("keydown",this.onKeydown,!0),this.dialog.removeEventListener("cancel",this.onCancel,!0),this.#e().forEach(i=>i.removeEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.removeEventListener("cancel",this.onConfirmCancel))}discard(){this.forceClose=!0,this.#y(),this.dialog.dispatchEvent(new CustomEvent("modal:request-close"))}keepEditing(){this.#m()}#e(){return this.dialog?this.dialog.querySelectorAll('[data-action~="remote-modal#close"]'):[]}#t(i){this.baseline==null&&i.isTrusted&&(i.type==="keydown"&&this.constructor.NON_EDITING_KEYS.has(i.key)||(this.baseline=this.#i()))}#i(){let i=new FormData(this.element),e=encodeURIComponent;return[...i.entries()].filter(([t])=>!this.constructor.IGNORED_KEYS.has(t)).map(([t,r])=>{let s=r instanceof File?r.name:r;return`${e(t)}=${e(s)}`}).sort().join("&")}#r(){return this.baseline!=null&&this.#i()!==this.baseline}#n(){this.submitting=!0}#o(){this.submitting=!1,this.forceClose=!1,this.baseline=null}async#s(i){let e=i.target.closest("[data-dirty-form-guard-leave]");if(!e||this.#l(e)!==this.element||this.forceClose||this.submitting||!this.#r())return;i.preventDefault(),i.stopPropagation();let t=e.getAttribute("data-dirty-form-guard-leave")||"You have unsaved changes that will be lost. Continue?";if(!await this.#f(t))return;this.forceClose=!0;let s=e.closest("form");if(s){let n=e.matches("button, input[type=submit], input[type=image]")?e:null;s.requestSubmit(n)}}static GUARDED_FORM_SELECTOR="form[data-controller~='dirty-form-guard']";#l(i){let e=this.constructor.GUARDED_FORM_SELECTOR,t=i.closest(e);if(t)return t;let r=null,s=-1;return document.querySelectorAll(e).forEach(n=>{let o=n;for(;o&&!o.contains(i);)o=o.parentElement;if(!o)return;let a=this.#a(o);a>s&&(s=a,r=n)}),r}#a(i){let e=0;for(;i=i.parentElement;)e++;return e}#f(i){let e=window.Turbo?.config?.forms?.confirm;return typeof e=="function"?Promise.resolve(e(i)):Promise.resolve(window.confirm(i))}#c(){return this.hasConfirmDialogTarget&&this.confirmDialogTarget.open}#d(i){if(i.key==="Escape"&&this.dialog.open){if(this.#c()){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();return}this.forceClose||this.submitting||this.#r()&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.#h())}}#u(i){i.target===this.dialog&&(this.forceClose||this.submitting||this.#r()&&(i.preventDefault(),this.#h()))}#p(i){this.forceClose||this.submitting||this.#r()&&(i.preventDefault(),i.stopPropagation(),this.#h())}#g(i){i.preventDefault()}#h(){if(this.hasConfirmDialogTarget){let i=this.confirmDialogTarget;i.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>i.setAttribute("data-open",""))})}else window.confirm("Discard your changes?")&&(this.forceClose=!0,this.dialog.dispatchEvent(new CustomEvent("modal:request-close")))}#y(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;i.removeAttribute("data-open"),i.open&&i.close()}async#m(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;if(!i.open)return;i.removeAttribute("data-open");let e=i.getAnimations({subtree:!0});await Promise.allSettled(e.map(t=>t.finished)),i.close()}};var il=class extends H{static targets=["direction"];connect(){this.submitting=!1,this.element.addEventListener("submit",this.onSubmit),this.element.addEventListener("turbo:submit-end",this.onSettled),document.addEventListener("turbo:load",this.onSettled),window.addEventListener("pageshow",this.onSettled)}disconnect(){this.element.removeEventListener("submit",this.onSubmit),this.element.removeEventListener("turbo:submit-end",this.onSettled),document.removeEventListener("turbo:load",this.onSettled),window.removeEventListener("pageshow",this.onSettled)}setDirection(i){this.hasDirectionTarget&&(this.directionTarget.value=i)}onSubmit=i=>{if(this.submitting){i.preventDefault();return}this.submitting=!0};onSettled=()=>{this.submitting=!1}};var rl=class extends H{static values={moveUrlTemplate:String,collapseCookie:String,collapsePath:String};static targets=["column"];connect(){this.draggedCard=null,this.onDragStart=this.#v.bind(this),this.onDragOver=this.#T.bind(this),this.onDragLeave=this.#S.bind(this),this.onDrop=this.#b.bind(this),this.onDragEnd=this.#_.bind(this),this.element.addEventListener("dragstart",this.onDragStart),this.element.addEventListener("dragover",this.onDragOver),this.element.addEventListener("dragleave",this.onDragLeave),this.element.addEventListener("drop",this.onDrop),this.element.addEventListener("dragend",this.onDragEnd),this.scrollTarget=this.#u(),this.captureScroll=this.#p.bind(this),this.onBoardScroll=()=>{this.restoringScroll||(clearTimeout(this.scrollSaveTimer),this.scrollSaveTimer=setTimeout(this.captureScroll,120))},this.element.addEventListener("scroll",this.onBoardScroll,{passive:!0}),this.onUserScrollIntent=()=>this.#f(),this.element.addEventListener("wheel",this.onUserScrollIntent,{passive:!0}),this.element.addEventListener("touchmove",this.onUserScrollIntent,{passive:!0}),this.onPageHide=this.captureScroll,window.addEventListener("pagehide",this.onPageHide),this.onTurboLoad=this.#t.bind(this),this.onBeforeFrameRender=this.#n.bind(this),this.onFrameRender=this.#o.bind(this),this.onBeforeStreamRender=this.#g.bind(this),document.addEventListener("turbo:load",this.onTurboLoad),document.addEventListener("turbo:before-frame-render",this.onBeforeFrameRender),document.addEventListener("turbo:frame-render",this.onFrameRender),document.addEventListener("turbo:before-stream-render",this.onBeforeStreamRender),this.#t(),this.#c(),this.#e()}disconnect(){this.element.removeEventListener("dragstart",this.onDragStart),this.element.removeEventListener("dragover",this.onDragOver),this.element.removeEventListener("dragleave",this.onDragLeave),this.element.removeEventListener("drop",this.onDrop),this.element.removeEventListener("dragend",this.onDragEnd),this.#p(),this.element.removeEventListener("scroll",this.onBoardScroll),this.element.removeEventListener("wheel",this.onUserScrollIntent),this.element.removeEventListener("touchmove",this.onUserScrollIntent),window.removeEventListener("pagehide",this.onPageHide),clearTimeout(this.restoreScrollTimer),clearTimeout(this.scrollSaveTimer),document.removeEventListener("turbo:load",this.onTurboLoad),document.removeEventListener("turbo:before-frame-render",this.onBeforeFrameRender),document.removeEventListener("turbo:frame-render",this.onFrameRender),document.removeEventListener("turbo:before-stream-render",this.onBeforeStreamRender)}#e(){let i=new URL(window.location.href);i.searchParams.has("kanban_reload")&&(i.searchParams.delete("kanban_reload"),history.replaceState(history.state,"",`${i.pathname}${i.search}${i.hash}`),this.#y().forEach(e=>e.reload()))}#t(){this.#y().forEach(i=>{let e=this.#i(i.dataset.kanbanColFrame),t=i.getAttribute("src");t&&this.#r(t)===this.#r(e)||(i.src=e)})}#i(i){let e=new URLSearchParams(window.location.search);return e.set("view","kanban"),e.set("column",i),`${window.location.pathname}?${e.toString()}`}#r(i){let e=new URL(i,window.location.origin);return e.searchParams.sort(),`${e.pathname}?${e.searchParams.toString()}`}#n(i){this.#m(i.target)&&(i.detail.render=(e,t)=>Yl(e,t))}#o(i){this.#m(i.target)&&this.restoringScroll&&(this.#s(),this.#a())}#s(){let i=this.scrollTarget;!i||!i.l&&!i.e||(this.element.scrollLeft=i.e?this.element.scrollWidth:i.l)}#l(){!this.scrollTarget||!this.scrollTarget.l&&!this.scrollTarget.e||(this.restoringScroll=!0,this.#s(),requestAnimationFrame(()=>this.#s()),this.#a())}#a(){clearTimeout(this.restoreScrollTimer),this.restoreScrollTimer=setTimeout(()=>this.#f(),400)}#f(){this.restoringScroll&&(this.#s(),this.restoringScroll=!1,clearTimeout(this.restoreScrollTimer))}#c(){this.#l()}#d(){return`pu-kanban-scroll:${this.moveUrlTemplateValue.replace("/__ID__/kanban_move","")}`}#u(){try{let i=sessionStorage.getItem(this.#d());return i?JSON.parse(i):null}catch{return null}}#p(){let i=this.element;if(!this.restoringScroll&&i.clientWidth>0){let e=i.scrollWidth-i.clientWidth;this.scrollTarget={l:i.scrollLeft,e:e>0&&i.scrollLeft>=e-2}}if(this.scrollTarget)try{sessionStorage.setItem(this.#d(),JSON.stringify(this.scrollTarget))}catch{}}#g(i){if(!this.#h(i.target))return;let e=i.detail.render;i.detail.render=async t=>{this.restoringScroll=!0,await e(t),this.#l()}}#h(i){if(!i)return!1;let e=i.getAttribute("target");if(e)return this.#m(document.getElementById(e));let t=i.getAttribute("targets");return t?[...document.querySelectorAll(t)].some(r=>this.#m(r)):!1}#y(){return this.element.querySelectorAll("turbo-frame[data-kanban-col-frame]")}#m(i){return i?.matches?.("turbo-frame[data-kanban-col-frame]")&&this.element.contains(i)}toggleColumn(i){let e=i.currentTarget.dataset.kanbanColumnKey;if(!e)return;let t=this.element.querySelector(`[data-kanban-col="${e}"]`);if(!t)return;let r=t.querySelector("[data-kanban-role='strip']"),s=t.querySelector("[data-kanban-role='body']");if(!r||!s)return;let n=t.classList.toggle("pu-kanban-column-collapsed"),o=t.dataset.kanbanDefaultCollapsed==="true";this.#P(e,n!==o)}#v(i){let e=i.target.closest("[data-kanban-record-id]");e&&(this.draggedCard=e,i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",e.dataset.kanbanRecordId),requestAnimationFrame(()=>e.classList.add("pu-kanban-dragging")),this.#E(e.dataset.kanbanColumnKey))}#T(i){let e=i.target.closest("[data-kanban-target='column']");!e||i.target.closest("[data-kanban-col]")?.classList.contains("pu-kanban-no-drop")||(i.preventDefault(),i.dataTransfer.dropEffect="move",this.#R(e))}#S(i){this.element.contains(i.relatedTarget)||this.#C()}async#b(i){if(i.preventDefault(),this.#C(),!this.draggedCard||i.target.closest("[data-kanban-col]")?.classList.contains("pu-kanban-no-drop"))return;let t=i.target.closest("[data-kanban-target='column']");if(!t)return;let r=this.draggedCard.dataset.kanbanRecordId,s=this.draggedCard.dataset.kanbanColumnKey,n=t.dataset.kanbanColumnKeyValue,o=[...t.querySelectorAll("[data-kanban-record-id]")].filter(h=>h!==this.draggedCard),a=this.#L(i.clientY,o),l=t.closest("[data-kanban-col]");if(l?.dataset.kanbanDropInteraction==="true"&&s!==n){if(l.dataset.kanbanDropImmediate==="true"){let h=l.dataset.kanbanDropConfirm;if(h&&!window.confirm(h))return}else if(this.#w(l,{recordId:r,fromColumn:s,toColumn:n,toIndex:a}))return}this.#x(r,{fromColumn:s,toColumn:n,toIndex:a})}async#x(i,{fromColumn:e,toColumn:t,toIndex:r}){let s=this.moveUrlTemplateValue.replace("__ID__",i),n=document.querySelector('meta[name="csrf-token"]')?.content??"";try{let o=await fetch(s,{method:"POST",headers:{Accept:"text/vnd.turbo-stream.html","Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":n},body:new URLSearchParams({from_column:e,to_column:t,to_index:r}),credentials:"same-origin"});if((o.headers.get("Content-Type")||"").includes("text/vnd.turbo-stream.html")&&window.Turbo){let h=await o.text();Turbo.renderStreamMessage(h)}else o.ok?console.warn("[kanban] move returned a non-stream response (session expired?); leaving card in place"):console.error(`[kanban] move rejected (${o.status}); leaving card in place`)}catch(o){console.error("[kanban] move request failed:",o)}}#w(i,{recordId:e,fromColumn:t,toColumn:r,toIndex:s}){let n=i.dataset.kanbanDropFormUrlTemplate,o=document.getElementById("remote_modal");if(!o||!n)return!1;let a=new URLSearchParams({from_column:t,to_column:r,to_index:s}),l=`${n.replace("__ID__",e)}?${a.toString()}`;return o.src=l,!0}#_(i){this.#C(),this.#k(),this.draggedCard&&(this.draggedCard.classList.remove("pu-kanban-dragging"),this.draggedCard=null)}#E(i){let t=this.element.querySelector(`[data-kanban-col="${i}"]`)?.dataset.kanbanLocked==="true";this.element.querySelectorAll("[data-kanban-col]").forEach(r=>{let s=t||!this.#A(r.dataset.kanbanAccepts,i);r.classList.toggle("pu-kanban-no-drop",s)})}#k(){this.element.querySelectorAll("[data-kanban-col]").forEach(i=>i.classList.remove("pu-kanban-no-drop"))}#A(i,e){return!i||i==="all"?!0:i==="none"?!1:i.split(",").map(t=>t.trim()).includes(e)}#P(i,e){let t=new Set(this.#F());e?t.add(i):t.delete(i),this.#O([...t])}#F(){let i=this.collapseCookieValue;if(!i)return[];let e=document.cookie.split("; ").find(t=>t.startsWith(`${i}=`));return e?decodeURIComponent(e.slice(i.length+1)).split(",").filter(Boolean):[]}#O(i){let e=this.collapseCookieValue;if(!e)return;let t=this.collapsePathValue||"/";if(i.length===0){document.cookie=`${e}=; path=${t}; max-age=0; SameSite=Lax`;return}let r=encodeURIComponent(i.join(","));document.cookie=`${e}=${r}; path=${t}; max-age=${3600*24*180}; SameSite=Lax`}#L(i,e){for(let t=0;t<e.length;t++){let r=e[t].getBoundingClientRect();if(i<r.top+r.height/2)return t}return e.length}#R(i){this.columnTargets.forEach(e=>{e.classList.toggle("pu-kanban-drop-target",e===i)})}#C(){this.columnTargets.forEach(i=>i.classList.remove("pu-kanban-drop-target"))}};var sl=class extends H{static targets=["prefix","field"];static values={gap:{type:Number,default:6}};connect(){this.#e(),document.fonts.ready.then(()=>this.#e())}#e(){this.fieldTarget.style.setProperty("padding-left",`${this.prefixTarget.offsetWidth+this.gapValue}px`,"important")}};function Fh(i){i.register("password-visibility",Ua),i.register("password-sentinel",za),i.register("sidebar",Ba),i.register("resource-header",go),i.register("nested-resource-form-fields",bo),i.register("structured-input-row",yo),i.register("form",vo),i.register("resource-drop-down",_o),i.register("resource-collapse",Co),i.register("resource-dismiss",Ao),i.register("frame-navigator",Po),i.register("color-mode",Oo),i.register("easymde",No),i.register("slim-select",Bo),i.register("flatpickr",Uo),i.register("intl-tel-input",zo),i.register("select-navigator",Ho),i.register("resource-tab-list",jo),i.register("attachment-input",Ia),i.register("attachment-preview",Da),i.register("attachment-preview-container",Na),i.register("remote-modal",Ha),i.register("key-value-store",ja),i.register("bulk-actions",qa),i.register("filter-panel",$a),i.register("textarea-autogrow",Va),i.register("clipboard",Wa),i.register("icon-rail",Ga),i.register("icon-rail-flyout",Ka),i.register("table-header",Ya),i.register("table-column-menu",Xa),i.register("capture-url",Za),i.register("row-click",Qa),i.register("view-switcher",Ja),i.register("autosubmit",el),i.register("dirty-form-guard",tl),i.register("wizard",il),i.register("kanban",rl),i.register("currency-input",sl)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};Turbo.StreamActions.close_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);if(!e)return;let t=e.querySelector("dialog");t&&typeof t.close=="function"&&t.close(),e.innerHTML="",e.removeAttribute("src")};Turbo.StreamActions.reload_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);!e||typeof e.reload!="function"||e.reload()};var Ze,Rn,zi,wr;function tT(){if(Ze){Ze.isConnected||document.body.appendChild(Ze);return}Ze=document.createElement("dialog"),Ze.className=["pu-dialog","top-1/2","-translate-y-1/2","left-1/2","-translate-x-1/2","w-full","max-w-md","p-0","open:flex","flex-col","opacity-0","scale-95","data-[open]:opacity-100","data-[open]:scale-100","transition-[opacity,scale]","duration-200","ease-out"].join(" "),Ze.setAttribute("aria-labelledby","pu-turbo-confirm-message");let i=document.createElement("div");i.className="px-6 pt-5 pb-4 border-b border-[var(--pu-border)]",Rn=document.createElement("h2"),Rn.id="pu-turbo-confirm-message",Rn.className="text-lg font-semibold text-[var(--pu-text)]",i.appendChild(Rn);let e=document.createElement("div");e.className="flex items-center justify-end gap-2 px-6 py-4",wr=document.createElement("button"),wr.type="button",wr.className="pu-btn pu-btn-md pu-btn-outline",wr.textContent="Cancel",zi=document.createElement("button"),zi.type="button",zi.className="pu-btn pu-btn-md pu-btn-primary",zi.textContent="Confirm",e.appendChild(wr),e.appendChild(zi),Ze.appendChild(i),Ze.appendChild(e),document.body.appendChild(Ze)}async function iT(){Ze.removeAttribute("data-open");let i=Ze.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),Ze.open&&Ze.close()}function ab(i){return tT(),Rn.textContent=i||"Are you sure?",new Promise(e=>{let t=!1,r=l=>{t||(t=!0,a(),e(l),iT())},s=()=>r(!0),n=()=>r(!1),o=()=>r(!1),a=()=>{zi.removeEventListener("click",s),wr.removeEventListener("click",n),Ze.removeEventListener("close",o)};zi.addEventListener("click",s),wr.addEventListener("click",n),Ze.addEventListener("close",o),Ze.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>Ze.setAttribute("data-open",""))}),zi.focus()})}typeof window<"u"&&window.Turbo&&(window.Turbo.config?.forms?window.Turbo.config.forms.confirm=ab:window.Turbo.setConfirmMethod&&window.Turbo.setConfirmMethod(ab));var rT=fo.start();Fh(rT);})();
164
+ `);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=Bh(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var za=class extends W{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var yb=0,Ha=class extends W{static targets=["scroll"];connect(){this.beforeRender=this.beforeRender.bind(this),this.afterRender=this.afterRender.bind(this),document.addEventListener("turbo:before-render",this.beforeRender),document.addEventListener("turbo:render",this.afterRender)}disconnect(){document.removeEventListener("turbo:before-render",this.beforeRender),document.removeEventListener("turbo:render",this.afterRender)}beforeRender(){this.hasScrollTarget&&(yb=this.scrollTarget.scrollTop)}afterRender(){this.hasScrollTarget&&(this.scrollTarget.scrollTop=yb)}};var ja=class extends W{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var qa=class extends W{static values={sentinel:String};connect(){this.armed=this.element.value===this.sentinelValue}beforeinput(i){if(!this.armed)return;i.preventDefault(),this.armed=!1;let e="";i.inputType==="insertText"&&i.data!=null?e=i.data:i.inputType==="insertFromPaste"&&i.dataTransfer&&(e=i.dataTransfer.getData("text")),this.element.value=e,this.element.setSelectionRange(e.length,e.length),this.element.dispatchEvent(new Event("input",{bubbles:!0}))}};var $a=class extends W{connect(){this.originalScrollPosition=window.scrollY,this.originalOverflow=document.body.style.overflow,this.bodyStateRestored=!1,this._closing=!1,document.body.style.overflow="hidden",this.element.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.element.setAttribute("data-open","")})}),this.onCancel=this.#e.bind(this),this.onClose=this.#t.bind(this),this.onRequestClose=()=>this.#i(),this.element.addEventListener("cancel",this.onCancel),this.element.addEventListener("close",this.onClose),this.element.addEventListener("modal:request-close",this.onRequestClose)}disconnect(){this.element.removeEventListener("cancel",this.onCancel),this.element.removeEventListener("close",this.onClose),this.element.removeEventListener("modal:request-close",this.onRequestClose),this.#r()}close(){this.#i()}#e(i){i.target===this.element&&(i.defaultPrevented||(i.preventDefault(),this.#i()))}#t(){this.#r()}async#i(){if(this._closing)return;this._closing=!0,this.element.getAnimations().forEach(e=>e.finish()),this.element.removeAttribute("data-open");let i=this.element.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),this.element.close()}#r(){this.bodyStateRestored||(this.bodyStateRestored=!0,document.body.style.overflow=this.originalOverflow||"",window.scrollTo(0,this.originalScrollPosition))}};var Va=class extends W{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateIndices(),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`),t.id=t.id.replace(/_\d+_/,`_${e}_`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`),r.id=r.id.replace(/_\d+_/,`_${e}_`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e)),r.id&&(r.id=r.id.replace("___INDEX___",`_${e}_`))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var Wa=class extends W{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","filterPills"];toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasFilterPillsTarget&&this.filterPillsTarget.classList.toggle("hidden",i.length>0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;if(n){let[a,l]=n.split("?"),h=[l,t].filter(Boolean).join("&");s.href=h?`${a}?${h}`:a}s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}clearSelection(){this.checkboxTargets.forEach(i=>i.checked=!1),this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=!1,this.checkboxAllTarget.indeterminate=!1),this.updateUI()}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var Ga=class extends W{static targets=["panel","backdrop"];connect(){this._onKeydown=this._onKeydown.bind(this)}disconnect(){this.isOpen&&(document.removeEventListener("keydown",this._onKeydown),this._unlockBodyScroll())}toggle(){this.isOpen?this.close():this.open()}open(){this.hasPanelTarget&&(this.panelTarget.setAttribute("data-open",""),this.panelTarget.setAttribute("aria-hidden","false")),this.hasBackdropTarget&&this.backdropTarget.setAttribute("data-open",""),this._lockBodyScroll(),document.addEventListener("keydown",this._onKeydown)}close(){this.hasPanelTarget&&(this.panelTarget.removeAttribute("data-open"),this.panelTarget.setAttribute("aria-hidden","true")),this.hasBackdropTarget&&this.backdropTarget.removeAttribute("data-open"),this._unlockBodyScroll(),document.removeEventListener("keydown",this._onKeydown)}_lockBodyScroll(){this._previousBodyOverflow==null&&(this._previousBodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden")}_unlockBodyScroll(){this._previousBodyOverflow!=null&&(document.body.style.overflow=this._previousBodyOverflow,this._previousBodyOverflow=null)}clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.querySelector("form");i&&i.requestSubmit()}get isOpen(){return this.hasPanelTarget&&this.panelTarget.hasAttribute("data-open")}_onKeydown(i){i.key==="Escape"&&this.close()}};var Ka=class extends W{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};var Ya=class extends W{static targets=["source"];copy(i){let e=this.sourceTarget.value||this.sourceTarget.textContent,t=i.currentTarget,r=t.textContent;navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)}).catch(s=>{console.warn("Clipboard API failed, using fallback:",s),this.fallbackCopy(e),t.textContent="Copied!",setTimeout(()=>{t.textContent=r},2e3)})}fallbackCopy(i){let e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}};var Xa=class extends W{static values={storageKey:{type:String,default:"pu_rail_pinned"}};connect(){let i=localStorage.getItem(this.storageKeyValue)!=="false";document.documentElement.classList.toggle("pu-rail-pinned",i)}disconnect(){document.querySelector('[data-controller~="icon-rail"]')||document.documentElement.classList.remove("pu-rail-pinned")}togglePin(){let i=document.documentElement.classList.toggle("pu-rail-pinned");localStorage.setItem(this.storageKeyValue,i)}};var Za=class extends W{static targets=["trigger","panel"];static values={closeDelay:{type:Number,default:150}};connect(){this._closeTimer=null,this._open=!1,this._panel=null,this._panelHome=null,this._onPanelEnter=()=>{this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null)},this._onPanelLeave=()=>this.scheduleClose()}disconnect(){this._returnPanel()}open(){this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),!this._open&&(!this._panel&&!this.hasPanelTarget||(this._open=!0,this.element.dataset.flyoutOpen="true",this._portalPanel(),this._position()))}scheduleClose(){this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(()=>this.close(),this.closeDelayValue)}close(){this._open&&(this._open=!1,delete this.element.dataset.flyoutOpen,this._returnPanel())}toggle(i){i.preventDefault(),this._open?this.close():this.open()}closeOnEsc(i){i.key==="Escape"&&this.close()}_portalPanel(){if(this._panel)return;let i=this.panelTarget;i&&(this._panel=i,this._panelHome=i.parentElement,i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),document.body.appendChild(i),i.style.display="block")}_returnPanel(){if(!this._panel)return;let i=this._panel;i.removeEventListener("mouseenter",this._onPanelEnter),i.removeEventListener("mouseleave",this._onPanelLeave),i.style.position="",i.style.left="",i.style.top="",i.style.display="",this._panelHome&&document.contains(this._panelHome)?this._panelHome.appendChild(i):i.remove(),this._panel=null,this._panelHome=null}_position(){if(!this._panel||!this.hasTriggerTarget)return;let i=this._panel,e=this.triggerTarget.getBoundingClientRect();i.style.position="fixed",i.style.left=`${e.right+4}px`,i.style.top=`${e.top}px`,requestAnimationFrame(()=>{let t=i.getBoundingClientRect(),r=window.innerHeight;if(t.bottom>r-8){let s=t.bottom-(r-8),n=Math.max(8,parseFloat(i.style.top)-s);i.style.top=`${n}px`}})}};var Qa=class extends W{headerClick(i){if(!i.shiftKey)return;let t=i.currentTarget.dataset.tableHeaderMultiHref;t&&(i.preventDefault(),Turbo.visit(t))}};var Ja=class extends W{static targets=["panel"];connect(){this._onDocClick=this._onDocClick.bind(this)}toggle(i){i.preventDefault(),i.stopPropagation(),this.hasPanelTarget&&(!this.panelTarget.classList.toggle("hidden")?(document.addEventListener("click",this._onDocClick),this._onKey=t=>{t.key==="Escape"&&this._close()},document.addEventListener("keydown",this._onKey)):this._unbind())}_close(){this.hasPanelTarget&&this.panelTarget.classList.add("hidden"),this._unbind()}_unbind(){document.removeEventListener("click",this._onDocClick),this._onKey&&(document.removeEventListener("keydown",this._onKey),this._onKey=null)}_onDocClick(i){this.element.contains(i.target)||this._close()}};var el=class extends W{connect(){if(!("value"in this.element))return;let i=this.element.value;if(!i)return;let{hash:e}=window.location;e&&(this.element.value=i.split("#")[0]+e)}};var tl=class extends W{click(i){if(i.target.closest("a, button, input, label, select, textarea, [data-row-click-ignore]"))return;let e=this.element.querySelector('[data-row-click-target="show"]');if(e){if(i.metaKey||i.ctrlKey||i.button===1){window.open(e.href,"_blank","noopener");return}e.click()}}};var il=class extends W{static values={cookieName:String,cookiePath:{type:String,default:"/"}};select(i){let e=i.params.view;if(!e||!this.cookieNameValue)return;let t=3600*24*365,r=this.cookiePathValue||"/";document.cookie=`${this.cookieNameValue}=${encodeURIComponent(e)}; Path=${r}; Max-Age=${t}; SameSite=Lax`;let s=new URL(window.location.href);s.searchParams.delete("view"),window.location.href=s.toString()}};var rl=class extends W{static values={delay:{type:Number,default:300}};connect(){this._timer=null}disconnect(){this._timer&&clearTimeout(this._timer)}submit(){this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{this.element.closest("form")?.requestSubmit()},this.delayValue)}};var sl=class extends W{static targets=["confirmDialog"];static IGNORED_KEYS=new Set(["authenticity_token","return_to","pre_submit"]);static NON_EDITING_KEYS=new Set(["Tab","Escape","Shift","Control","Alt","Meta"]);connect(){this.dialog=this.element.closest("dialog"),this.baseline=null,this.forceClose=!1,this.submitting=!1,this.onFirstIntent=this.#t.bind(this),this.onSubmit=this.#s.bind(this),this.onLeaveClick=this.#n.bind(this),this.onSettled=this.#a.bind(this),this.element.addEventListener("pointerdown",this.onFirstIntent,!0),this.element.addEventListener("keydown",this.onFirstIntent,!0),this.element.addEventListener("submit",this.onSubmit),this.element.addEventListener("turbo:submit-end",this.onSettled),this.dialog||document.addEventListener("click",this.onLeaveClick,!0),this.dialog&&(this.onCancel=this.#u.bind(this),this.onCloseButtonClick=this.#p.bind(this),this.onConfirmCancel=this.#m.bind(this),this.onKeydown=this.#h.bind(this),document.addEventListener("keydown",this.onKeydown,!0),this.dialog.addEventListener("cancel",this.onCancel,!0),this.#e().forEach(i=>i.addEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.addEventListener("cancel",this.onConfirmCancel))}disconnect(){this.element.removeEventListener("pointerdown",this.onFirstIntent,!0),this.element.removeEventListener("keydown",this.onFirstIntent,!0),this.element.removeEventListener("submit",this.onSubmit),this.element.removeEventListener("turbo:submit-end",this.onSettled),this.dialog||document.removeEventListener("click",this.onLeaveClick,!0),this.dialog&&(document.removeEventListener("keydown",this.onKeydown,!0),this.dialog.removeEventListener("cancel",this.onCancel,!0),this.#e().forEach(i=>i.removeEventListener("click",this.onCloseButtonClick,!0)),this.hasConfirmDialogTarget&&this.confirmDialogTarget.removeEventListener("cancel",this.onConfirmCancel))}discard(){this.forceClose=!0,this.#y(),this.dialog.dispatchEvent(new CustomEvent("modal:request-close"))}keepEditing(){this.#g()}#e(){return this.dialog?this.dialog.querySelectorAll('[data-action~="remote-modal#close"]'):[]}#t(i){this.baseline==null&&i.isTrusted&&(i.type==="keydown"&&this.constructor.NON_EDITING_KEYS.has(i.key)||(this.baseline=this.#i()))}#i(){let i=new FormData(this.element),e=encodeURIComponent;return[...i.entries()].filter(([t])=>!this.constructor.IGNORED_KEYS.has(t)).map(([t,r])=>{let s=r instanceof File?r.name:r;return`${e(t)}=${e(s)}`}).sort().join("&")}#r(){return this.baseline!=null&&this.#i()!==this.baseline}#s(){this.submitting=!0}#a(){this.submitting=!1,this.forceClose=!1,this.baseline=null}async#n(i){let e=i.target.closest("[data-dirty-form-guard-leave]");if(!e||this.#l(e)!==this.element||this.forceClose||this.submitting||!this.#r())return;i.preventDefault(),i.stopPropagation();let t=e.getAttribute("data-dirty-form-guard-leave")||"You have unsaved changes that will be lost. Continue?";if(!await this.#f(t))return;this.forceClose=!0;let s=e.closest("form");if(s){let n=e.matches("button, input[type=submit], input[type=image]")?e:null;s.requestSubmit(n)}}static GUARDED_FORM_SELECTOR="form[data-controller~='dirty-form-guard']";#l(i){let e=this.constructor.GUARDED_FORM_SELECTOR,t=i.closest(e);if(t)return t;let r=null,s=-1;return document.querySelectorAll(e).forEach(n=>{let o=n;for(;o&&!o.contains(i);)o=o.parentElement;if(!o)return;let a=this.#o(o);a>s&&(s=a,r=n)}),r}#o(i){let e=0;for(;i=i.parentElement;)e++;return e}#f(i){let e=window.Turbo?.config?.forms?.confirm;return typeof e=="function"?Promise.resolve(e(i)):Promise.resolve(window.confirm(i))}#c(){return this.hasConfirmDialogTarget&&this.confirmDialogTarget.open}#h(i){if(i.key==="Escape"&&this.dialog.open){if(this.#c()){i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation();return}this.forceClose||this.submitting||this.#r()&&(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),this.#d())}}#u(i){i.target===this.dialog&&(this.forceClose||this.submitting||this.#r()&&(i.preventDefault(),this.#d()))}#p(i){this.forceClose||this.submitting||this.#r()&&(i.preventDefault(),i.stopPropagation(),this.#d())}#m(i){i.preventDefault()}#d(){if(this.hasConfirmDialogTarget){let i=this.confirmDialogTarget;i.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>i.setAttribute("data-open",""))})}else window.confirm("Discard your changes?")&&(this.forceClose=!0,this.dialog.dispatchEvent(new CustomEvent("modal:request-close")))}#y(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;i.removeAttribute("data-open"),i.open&&i.close()}async#g(){if(!this.hasConfirmDialogTarget)return;let i=this.confirmDialogTarget;if(!i.open)return;i.removeAttribute("data-open");let e=i.getAnimations({subtree:!0});await Promise.allSettled(e.map(t=>t.finished)),i.close()}};var nl=class extends W{static targets=["direction"];connect(){this.submitting=!1,this.element.addEventListener("submit",this.onSubmit),this.element.addEventListener("turbo:submit-end",this.onSettled),document.addEventListener("turbo:load",this.onSettled),window.addEventListener("pageshow",this.onSettled)}disconnect(){this.element.removeEventListener("submit",this.onSubmit),this.element.removeEventListener("turbo:submit-end",this.onSettled),document.removeEventListener("turbo:load",this.onSettled),window.removeEventListener("pageshow",this.onSettled)}setDirection(i){this.hasDirectionTarget&&(this.directionTarget.value=i)}onSubmit=i=>{if(this.submitting){i.preventDefault();return}this.submitting=!0};onSettled=()=>{this.submitting=!1}};function In(i,e){for(let t=0;t<e.length;t++){let r=e[t].getBoundingClientRect();if(i<r.top+r.height/2)return t}return e.length}function vb(i,e){for(let t=0;t<e.length;t++){let r=e[t].getBoundingClientRect();if(i<r.left+r.width/2)return t}return e.length}function ol(i,e,{draggingClass:t,payload:r,dragImage:s=null}){if(i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",r),s){let n=s.getBoundingClientRect();i.dataTransfer.setDragImage(s,i.clientX-n.left,i.clientY-n.top)}requestAnimationFrame(()=>e.classList.add(t))}function al(i,{draggingClass:e}){i.classList.remove(e),ri()}var Uh="pu-drag-insertion-marker";function gT(){let i=document.getElementById(Uh);return i||(i=document.createElement("div"),i.id=Uh,i.className="pu-drag-marker",i.setAttribute("aria-hidden","true"),document.body.appendChild(i)),i}function ll(i,e,{axis:t="vertical",container:r=null,gap:s=null}={}){let n=gT();s?n.style.setProperty("--pu-drag-marker-gap",s):n.style.removeProperty("--pu-drag-marker-gap");let o=t!=="horizontal",a=w=>o?w.top:w.left,l=w=>o?w.bottom:w.right,h,f,m;if(i.length===0){if(!r)return ri();h=r.getBoundingClientRect(),f=a(h),m="leading"}else e<=0?(h=i[0].getBoundingClientRect(),f=a(h),m="leading"):e>=i.length?(h=i[i.length-1].getBoundingClientRect(),f=l(h),m="trailing"):(h=i[e].getBoundingClientRect(),f=(l(i[e-1].getBoundingClientRect())+a(h))/2,m="between");o?(n.style.left=`${h.left}px`,n.style.top=`${f}px`,n.style.width=`${h.width}px`,n.style.height=""):(n.style.left=`${f}px`,n.style.top=`${h.top}px`,n.style.height=`${h.height}px`,n.style.width=""),n.dataset.axis=t,n.dataset.edge=m,n.style.display="block"}function ri(){let i=document.getElementById(Uh);i&&(i.style.display="none")}var cl=class extends W{static values={moveUrlTemplate:String,collapseCookie:String,collapsePath:String};static targets=["column"];connect(){this.draggedCard=null,this.onDragStart=this.#v.bind(this),this.onDragOver=this.#T.bind(this),this.onDragLeave=this.#S.bind(this),this.onDrop=this.#b.bind(this),this.onDragEnd=this.#_.bind(this),this.element.addEventListener("dragstart",this.onDragStart),this.element.addEventListener("dragover",this.onDragOver),this.element.addEventListener("dragleave",this.onDragLeave),this.element.addEventListener("drop",this.onDrop),this.element.addEventListener("dragend",this.onDragEnd),this.scrollTarget=this.#u(),this.captureScroll=this.#p.bind(this),this.onBoardScroll=()=>{this.restoringScroll||(clearTimeout(this.scrollSaveTimer),this.scrollSaveTimer=setTimeout(this.captureScroll,120))},this.element.addEventListener("scroll",this.onBoardScroll,{passive:!0}),this.onUserScrollIntent=()=>this.#f(),this.element.addEventListener("wheel",this.onUserScrollIntent,{passive:!0}),this.element.addEventListener("touchmove",this.onUserScrollIntent,{passive:!0}),this.onPageHide=this.captureScroll,window.addEventListener("pagehide",this.onPageHide),this.onTurboLoad=this.#t.bind(this),this.onBeforeFrameRender=this.#s.bind(this),this.onFrameRender=this.#a.bind(this),this.onBeforeStreamRender=this.#m.bind(this),document.addEventListener("turbo:load",this.onTurboLoad),document.addEventListener("turbo:before-frame-render",this.onBeforeFrameRender),document.addEventListener("turbo:frame-render",this.onFrameRender),document.addEventListener("turbo:before-stream-render",this.onBeforeStreamRender),this.#t(),this.#c(),this.#e()}disconnect(){this.element.removeEventListener("dragstart",this.onDragStart),this.element.removeEventListener("dragover",this.onDragOver),this.element.removeEventListener("dragleave",this.onDragLeave),this.element.removeEventListener("drop",this.onDrop),this.element.removeEventListener("dragend",this.onDragEnd),this.#p(),this.element.removeEventListener("scroll",this.onBoardScroll),this.element.removeEventListener("wheel",this.onUserScrollIntent),this.element.removeEventListener("touchmove",this.onUserScrollIntent),window.removeEventListener("pagehide",this.onPageHide),clearTimeout(this.restoreScrollTimer),clearTimeout(this.scrollSaveTimer),document.removeEventListener("turbo:load",this.onTurboLoad),document.removeEventListener("turbo:before-frame-render",this.onBeforeFrameRender),document.removeEventListener("turbo:frame-render",this.onFrameRender),document.removeEventListener("turbo:before-stream-render",this.onBeforeStreamRender)}#e(){let i=new URL(window.location.href);i.searchParams.has("kanban_reload")&&(i.searchParams.delete("kanban_reload"),history.replaceState(history.state,"",`${i.pathname}${i.search}${i.hash}`),this.#y().forEach(e=>e.reload()))}#t(){this.#y().forEach(i=>{let e=this.#i(i.dataset.kanbanColFrame),t=i.getAttribute("src");t&&this.#r(t)===this.#r(e)||(i.src=e)})}#i(i){let e=new URLSearchParams(window.location.search);return e.set("view","kanban"),e.set("column",i),`${window.location.pathname}?${e.toString()}`}#r(i){let e=new URL(i,window.location.origin);return e.searchParams.sort(),`${e.pathname}?${e.searchParams.toString()}`}#s(i){this.#g(i.target)&&(i.detail.render=(e,t)=>rc(e,t))}#a(i){this.#g(i.target)&&this.restoringScroll&&(this.#n(),this.#o())}#n(){let i=this.scrollTarget;!i||!i.l&&!i.e||(this.element.scrollLeft=i.e?this.element.scrollWidth:i.l)}#l(){!this.scrollTarget||!this.scrollTarget.l&&!this.scrollTarget.e||(this.restoringScroll=!0,this.#n(),requestAnimationFrame(()=>this.#n()),this.#o())}#o(){clearTimeout(this.restoreScrollTimer),this.restoreScrollTimer=setTimeout(()=>this.#f(),400)}#f(){this.restoringScroll&&(this.#n(),this.restoringScroll=!1,clearTimeout(this.restoreScrollTimer))}#c(){this.#l()}#h(){return`pu-kanban-scroll:${this.moveUrlTemplateValue.replace("/__ID__/kanban_move","")}`}#u(){try{let i=sessionStorage.getItem(this.#h());return i?JSON.parse(i):null}catch{return null}}#p(){let i=this.element;if(!this.restoringScroll&&i.clientWidth>0){let e=i.scrollWidth-i.clientWidth;this.scrollTarget={l:i.scrollLeft,e:e>0&&i.scrollLeft>=e-2}}if(this.scrollTarget)try{sessionStorage.setItem(this.#h(),JSON.stringify(this.scrollTarget))}catch{}}#m(i){if(!this.#d(i.target))return;let e=i.detail.render;i.detail.render=async t=>{this.restoringScroll=!0,await e(t),this.#l()}}#d(i){if(!i)return!1;let e=i.getAttribute("target");if(e)return this.#g(document.getElementById(e));let t=i.getAttribute("targets");return t?[...document.querySelectorAll(t)].some(r=>this.#g(r)):!1}#y(){return this.element.querySelectorAll("turbo-frame[data-kanban-col-frame]")}#g(i){return i?.matches?.("turbo-frame[data-kanban-col-frame]")&&this.element.contains(i)}toggleColumn(i){let e=i.currentTarget.dataset.kanbanColumnKey;if(!e)return;let t=this.element.querySelector(`[data-kanban-col="${e}"]`);if(!t)return;let r=t.querySelector("[data-kanban-role='strip']"),s=t.querySelector("[data-kanban-role='body']");if(!r||!s)return;let n=t.classList.toggle("pu-kanban-column-collapsed"),o=t.dataset.kanbanDefaultCollapsed==="true";this.#P(e,n!==o)}#v(i){let e=i.target.closest("[data-kanban-record-id]");e&&(this.draggedCard=e,ol(i,e,{draggingClass:"pu-kanban-dragging",payload:e.dataset.kanbanRecordId}),this.#E(e.dataset.kanbanColumnKey))}#T(i){let e=i.target.closest("[data-kanban-target='column']");if(!e||i.target.closest("[data-kanban-col]")?.classList.contains("pu-kanban-no-drop"))return;i.preventDefault(),i.dataTransfer.dropEffect="move",this.#L(e);let r=[...e.querySelectorAll("[data-kanban-record-id]")].filter(s=>s!==this.draggedCard);ll(r,In(i.clientY,r),{axis:"vertical",container:e,gap:"10px"})}#S(i){this.element.contains(i.relatedTarget)||(this.#C(),ri())}async#b(i){if(i.preventDefault(),this.#C(),ri(),!this.draggedCard||i.target.closest("[data-kanban-col]")?.classList.contains("pu-kanban-no-drop"))return;let t=i.target.closest("[data-kanban-target='column']");if(!t)return;let r=this.draggedCard.dataset.kanbanRecordId,s=this.draggedCard.dataset.kanbanColumnKey,n=t.dataset.kanbanColumnKeyValue,o=[...t.querySelectorAll("[data-kanban-record-id]")].filter(h=>h!==this.draggedCard),a=In(i.clientY,o),l=t.closest("[data-kanban-col]");if(l?.dataset.kanbanDropInteraction==="true"&&s!==n){if(l.dataset.kanbanDropImmediate==="true"){let h=l.dataset.kanbanDropConfirm;if(h&&!window.confirm(h))return}else if(this.#w(l,{recordId:r,fromColumn:s,toColumn:n,toIndex:a}))return}this.#x(r,{fromColumn:s,toColumn:n,toIndex:a})}async#x(i,{fromColumn:e,toColumn:t,toIndex:r}){let s=this.moveUrlTemplateValue.replace("__ID__",i),n=document.querySelector('meta[name="csrf-token"]')?.content??"";try{let o=await fetch(s,{method:"POST",headers:{Accept:"text/vnd.turbo-stream.html","Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":n},body:new URLSearchParams({from_column:e,to_column:t,to_index:r}),credentials:"same-origin"});if((o.headers.get("Content-Type")||"").includes("text/vnd.turbo-stream.html")&&window.Turbo){let h=await o.text();Turbo.renderStreamMessage(h)}else o.ok?console.warn("[kanban] move returned a non-stream response (session expired?); leaving card in place"):console.error(`[kanban] move rejected (${o.status}); leaving card in place`)}catch(o){console.error("[kanban] move request failed:",o)}}#w(i,{recordId:e,fromColumn:t,toColumn:r,toIndex:s}){let n=i.dataset.kanbanDropFormUrlTemplate,o=document.getElementById("remote_modal");if(!o||!n)return!1;let a=new URLSearchParams({from_column:t,to_column:r,to_index:s}),l=`${n.replace("__ID__",e)}?${a.toString()}`;return o.src=l,!0}#_(i){this.#C(),this.#k(),this.draggedCard&&(al(this.draggedCard,{draggingClass:"pu-kanban-dragging"}),this.draggedCard=null)}#E(i){let t=this.element.querySelector(`[data-kanban-col="${i}"]`)?.dataset.kanbanLocked==="true";this.element.querySelectorAll("[data-kanban-col]").forEach(r=>{let s=t||!this.#A(r.dataset.kanbanAccepts,i);r.classList.toggle("pu-kanban-no-drop",s)})}#k(){this.element.querySelectorAll("[data-kanban-col]").forEach(i=>i.classList.remove("pu-kanban-no-drop"))}#A(i,e){return!i||i==="all"?!0:i==="none"?!1:i.split(",").map(t=>t.trim()).includes(e)}#P(i,e){let t=new Set(this.#F());e?t.add(i):t.delete(i),this.#O([...t])}#F(){let i=this.collapseCookieValue;if(!i)return[];let e=document.cookie.split("; ").find(t=>t.startsWith(`${i}=`));return e?decodeURIComponent(e.slice(i.length+1)).split(",").filter(Boolean):[]}#O(i){let e=this.collapseCookieValue;if(!e)return;let t=this.collapsePathValue||"/";if(i.length===0){document.cookie=`${e}=; path=${t}; max-age=0; SameSite=Lax`;return}let r=encodeURIComponent(i.join(","));document.cookie=`${e}=${r}; path=${t}; max-age=${3600*24*180}; SameSite=Lax`}#L(i){this.columnTargets.forEach(e=>{e.classList.toggle("pu-kanban-drop-target",e===i)})}#C(){this.columnTargets.forEach(i=>i.classList.remove("pu-kanban-drop-target"))}};var wb="opacity-30",ul=class extends W{static values={urlTemplate:String,axis:{type:String,default:"vertical"}};connect(){this.draggedRow=null,this.onDragStart=this.#e.bind(this),this.onDragOver=this.#t.bind(this),this.onDragLeave=this.#i.bind(this),this.onDrop=this.#r.bind(this),this.onDragEnd=this.#n.bind(this),this.onKeyDown=this.#l.bind(this),this.element.addEventListener("dragstart",this.onDragStart),this.element.addEventListener("dragover",this.onDragOver),this.element.addEventListener("dragleave",this.onDragLeave),this.element.addEventListener("drop",this.onDrop),this.element.addEventListener("dragend",this.onDragEnd),this.element.addEventListener("keydown",this.onKeyDown)}disconnect(){this.element.removeEventListener("dragstart",this.onDragStart),this.element.removeEventListener("dragover",this.onDragOver),this.element.removeEventListener("dragleave",this.onDragLeave),this.element.removeEventListener("drop",this.onDrop),this.element.removeEventListener("dragend",this.onDragEnd),this.element.removeEventListener("keydown",this.onKeyDown),ri()}#e(i){let e=i.target.closest("[data-positioned-grip]");if(!e)return;let t=this.#u(e);t&&(this.draggedRow=t,ol(i,t,{draggingClass:wb,payload:t.dataset.positionedRowId,dragImage:t}))}#t(i){if(!this.draggedRow)return;if(!this.#p(i.target)){ri();return}i.preventDefault(),i.dataTransfer.dropEffect="move";let e=this.#h().filter(t=>t!==this.draggedRow);ll(e,this.#s(i,e),{axis:this.axisValue==="horizontal"?"horizontal":"vertical",container:this.element})}#i(i){i.relatedTarget&&this.element.contains(i.relatedTarget)||ri()}#r(i){if(i.preventDefault(),ri(),!this.draggedRow)return;let e=this.draggedRow,t=this.#h().filter(r=>r!==e);this.#o(e,t,this.#s(i,t))}#s(i,e){if(this.axisValue!=="horizontal")return In(i.clientY,e);if(e.length===0)return 0;let t=this.#a(e);if(i.clientY<t[0].top)return 0;let r=t.find(s=>i.clientY<=s.bottom);return r?r.start+vb(i.clientX,e.slice(r.start,r.end)):e.length}#a(i){let e=[];return i.forEach((t,r)=>{let s=t.getBoundingClientRect(),n=e[e.length-1];n&&Math.abs(s.top-n.top)<=1?(n.end=r+1,n.bottom=Math.max(n.bottom,s.bottom)):e.push({top:s.top,bottom:s.bottom,start:r,end:r+1})}),e}#n(i){this.draggedRow&&(al(this.draggedRow,{draggingClass:wb}),this.draggedRow=null)}#l(i){if(i.key!=="ArrowUp"&&i.key!=="ArrowDown")return;let e=i.target.closest("[data-positioned-grip]");if(!e)return;let t=this.#u(e);if(!t)return;i.preventDefault();let r=this.#h(),s=r.indexOf(t),n=i.key==="ArrowUp"?s-1:s+1;if(n<0||n>=r.length)return;let o=r.filter(a=>a!==t);this.#o(t,o,n),e.focus()}#o(i,e,t){let r=e[t]??null,s=e[t-1]??null;if(i.nextElementSibling===r&&i.previousElementSibling===s)return;let n=i.nextSibling;i.parentElement.insertBefore(i,r),this.#f(i,n,{prevId:s?.dataset.positionedRowId??"",nextId:r?.dataset.positionedRowId??"",toIndex:t})}async#f(i,e,{prevId:t,nextId:r,toIndex:s}){let n=i.dataset.positionedRowId,o=this.urlTemplateValue.replace("__ID__",n)+window.location.search,a=document.querySelector('meta[name="csrf-token"]')?.content??"";try{let l=await fetch(o,{method:"POST",headers:{Accept:"text/vnd.turbo-stream.html","Content-Type":"application/x-www-form-urlencoded","X-CSRF-Token":a},body:new URLSearchParams({prev_id:t,next_id:r,to_index:s}),credentials:"same-origin"});if(l.status===204)return;if((l.headers.get("Content-Type")||"").includes("text/vnd.turbo-stream.html")&&window.Turbo){let f=this.#m();window.Turbo.renderStreamMessage(await l.text()),f&&this.#d(f)}else l.ok?(console.warn("[positioned] reposition returned a non-stream response (session expired?); reverting the move"),this.#c(i,e)):(console.error(`[positioned] reposition rejected (${l.status}); reverting the move`),this.#c(i,e))}catch(l){console.error("[positioned] reposition request failed:",l),this.#c(i,e)}}#c(i,e){let t=i.parentElement;if(!t||!i.isConnected)return;let r=i.contains(document.activeElement);t.insertBefore(i,e?.parentNode===t?e:null),r&&i.querySelector("[data-positioned-grip]")?.focus()}#h(){return[...this.element.querySelectorAll("[data-positioned-row-id]")]}#u(i){return i.closest("[data-positioned-row-id]")}#p(i){let e=this.#u(i);return e?e.dataset.positionedGroup===this.draggedRow.dataset.positionedGroup:!0}#m(){let i=document.activeElement?.closest?.("[data-positioned-grip]");return i?this.#u(i)?.dataset.positionedRowId:null}#d(i){requestAnimationFrame(()=>{document.querySelector(`[data-positioned-row-id="${CSS.escape(i)}"] [data-positioned-grip]`)?.focus()})}};var hl=class extends W{static targets=["prefix","field"];static values={gap:{type:Number,default:6}};connect(){this.#e(),document.fonts.ready.then(()=>this.#e())}#e(){this.fieldTarget.style.setProperty("padding-left",`${this.prefixTarget.offsetWidth+this.gapValue}px`,"important")}};var dl=class extends W{static targets=["list","item","last","overflow","menuItem"];connect(){this.menuItems=this.menuItemTargets,this.observer=new ResizeObserver(()=>this.reflow()),this.observer.observe(this.element),this.reflow(),document.fonts?.ready.then(()=>this.reflow())}disconnect(){this.observer.disconnect()}reflow(){if(!(!this.element.isConnected||!this.hasListTarget)){if(this.itemTargets.forEach(i=>this.#t(i)),this.hasOverflowTarget&&this.#i(this.overflowTarget),this.hasLastTarget&&this.lastTarget.classList.add("shrink-0"),this.#e()){if(this.hasOverflowTarget){this.#t(this.overflowTarget);for(let i of this.itemTargets){if(!this.#e())break;this.#i(i)}}this.#e()&&this.hasLastTarget&&this.lastTarget.classList.remove("shrink-0")}this.#r()}}#e(){return this.element.scrollWidth>this.element.clientWidth}#t(i){i.classList.remove("hidden"),i.classList.add("flex")}#i(i){i.classList.remove("flex"),i.classList.add("hidden")}#r(){if(!this.hasOverflowTarget)return;let i=this.itemTargets.map(e=>e.classList.contains("hidden"));this.menuItems.forEach((e,t)=>{e.classList.toggle("hidden",!i[t])}),i.some(Boolean)||this.#s()}#s(){let i=this.overflowTarget.querySelector('[data-controller~="resource-drop-down"]'),e=this.application.getControllerForElementAndIdentifier(i,"resource-drop-down");e?.visible&&e.hide()}};var pl=class extends W{static values={url:String,interval:{type:Number,default:2e3},finished:Boolean};connect(){if(this.finishedValue)return this.reloadPage();this.schedule()}disconnect(){this.timer&&clearTimeout(this.timer),this.timer=null}schedule(){this.timer=setTimeout(()=>this.refresh(),this.intervalValue)}reloadPage(){window.Turbo?.visit(window.location.href,{action:"replace"})}refresh(){let i=this.element.closest("turbo-frame");i&&(this.schedule(),i.src?i.reload():i.src=this.urlValue)}};function zh(i){i.register("password-visibility",ja),i.register("password-sentinel",qa),i.register("sidebar",Ha),i.register("resource-header",vo),i.register("nested-resource-form-fields",wo),i.register("structured-input-row",So),i.register("form",Eo),i.register("resource-drop-down",Po),i.register("resource-collapse",Fo),i.register("resource-dismiss",Oo),i.register("frame-navigator",Lo),i.register("color-mode",Mo),i.register("easymde",zo),i.register("slim-select",Ho),i.register("flatpickr",jo),i.register("intl-tel-input",qo),i.register("select-navigator",$o),i.register("resource-tab-list",Vo),i.register("attachment-input",Ba),i.register("attachment-preview",Ua),i.register("attachment-preview-container",za),i.register("remote-modal",$a),i.register("key-value-store",Va),i.register("bulk-actions",Wa),i.register("filter-panel",Ga),i.register("textarea-autogrow",Ka),i.register("clipboard",Ya),i.register("icon-rail",Xa),i.register("icon-rail-flyout",Za),i.register("table-header",Qa),i.register("table-column-menu",Ja),i.register("capture-url",el),i.register("row-click",tl),i.register("view-switcher",il),i.register("autosubmit",rl),i.register("dirty-form-guard",sl),i.register("wizard",nl),i.register("kanban",cl),i.register("positioned",ul),i.register("currency-input",hl),i.register("breadcrumbs",dl),i.register("run-progress",pl)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};Turbo.StreamActions.close_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);if(!e)return;let t=e.querySelector("dialog");t&&typeof t.close=="function"&&t.close(),e.innerHTML="",e.removeAttribute("src")};Turbo.StreamActions.reload_frame=function(){let i=this.getAttribute("target");if(!i)return;let e=document.getElementById(i);!e||typeof e.reload!="function"||e.reload()};var Je,Nn,ji,kr;function bT(){if(Je){Je.isConnected||document.body.appendChild(Je);return}Je=document.createElement("dialog"),Je.className=["pu-dialog","top-1/2","-translate-y-1/2","left-1/2","-translate-x-1/2","w-full","max-w-md","p-0","open:flex","flex-col","opacity-0","scale-95","data-[open]:opacity-100","data-[open]:scale-100","transition-[opacity,scale]","duration-200","ease-out"].join(" "),Je.setAttribute("aria-labelledby","pu-turbo-confirm-message");let i=document.createElement("div");i.className="px-6 pt-5 pb-4 border-b border-[var(--pu-border)]",Nn=document.createElement("h2"),Nn.id="pu-turbo-confirm-message",Nn.className="text-lg font-semibold text-[var(--pu-text)]",i.appendChild(Nn);let e=document.createElement("div");e.className="flex items-center justify-end gap-2 px-6 py-4",kr=document.createElement("button"),kr.type="button",kr.className="pu-btn pu-btn-md pu-btn-outline",kr.textContent="Cancel",ji=document.createElement("button"),ji.type="button",ji.className="pu-btn pu-btn-md pu-btn-primary",ji.textContent="Confirm",e.appendChild(kr),e.appendChild(ji),Je.appendChild(i),Je.appendChild(e),document.body.appendChild(Je)}async function yT(){Je.removeAttribute("data-open");let i=Je.getAnimations({subtree:!0});await Promise.allSettled(i.map(e=>e.finished)),Je.open&&Je.close()}function Sb(i){return bT(),Nn.textContent=i||"Are you sure?",new Promise(e=>{let t=!1,r=l=>{t||(t=!0,a(),e(l),yT())},s=()=>r(!0),n=()=>r(!1),o=()=>r(!1),a=()=>{ji.removeEventListener("click",s),kr.removeEventListener("click",n),Je.removeEventListener("close",o)};ji.addEventListener("click",s),kr.addEventListener("click",n),Je.addEventListener("close",o),Je.showModal(),requestAnimationFrame(()=>{requestAnimationFrame(()=>Je.setAttribute("data-open",""))}),ji.focus()})}typeof window<"u"&&window.Turbo&&(window.Turbo.config?.forms?window.Turbo.config.forms.confirm=Sb:window.Turbo.setConfirmMethod&&window.Turbo.setConfirmMethod(Sb));var vT=bo.start();zh(vT);})();
165
165
  /*!
166
166
  * Sanitize an HTML node
167
167
  */
@@ -192,7 +192,7 @@ cropperjs/dist/cropper.js:
192
192
  *)
193
193
 
194
194
  dompurify/dist/purify.es.mjs:
195
- (*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE *)
195
+ (*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE *)
196
196
 
197
197
  @uppy/utils/lib/Translator.js:
198
198
  (**