avo 2.10.3.pre.1 → 2.11.1.pre.2

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaf0eb69447308c9c5124d557cacfcc5fce7ad1ee307980ea1601671e861346b
4
- data.tar.gz: 1e1b14789776d3d3382fca548f8ab1f18d05996ce39fce98091a75723e3b9dd0
3
+ metadata.gz: 4bc7baa68c6256d8c8a26e4a40be36129d1187451015bc72c0ec2be65c3acd8b
4
+ data.tar.gz: 57a8ef18222e622ed7d3f45334b46c97183d10ea845b321044648cd1974faf22
5
5
  SHA512:
6
- metadata.gz: 7c42723dfef266320c8b26820c3e9d4670b2c7ce1dccfc49f808cd035d751711479753bb441d15e7b62190b3550d9ea8d435dfe47289c0a8aaa431de37127bc4
7
- data.tar.gz: 8ea62dec974fc99d1f75f4e38a168738be810e118d99526f3cc166b9a12c1c13a8cfa33310fa6af24be32a838cb4e7cbd6f42c10108b76956a2b268525210992
6
+ metadata.gz: 3df946571876e5742a86eb9314fe1122ea2838bedd0c3af3027e754df24ca20a4c9961e62c46f50a399c9265ddbf2b1f2cb9b2fd2ffb43e13bdcf6595634d71c
7
+ data.tar.gz: 7d9b4560a2069d752f5e82bc66c0d0eb4e1e9df5d95261371e859c8907741ac80a43a7ba09ce5ed6f59da316723b9f1ab9dbb8de3931f98113fc5de1c619ee74
data/Gemfile CHANGED
@@ -121,8 +121,6 @@ gem "hotwire-rails"
121
121
 
122
122
  gem "active_link_to"
123
123
 
124
- gem "view_component"
125
-
126
124
  gem "addressable"
127
125
 
128
126
  gem "appraisal"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.10.3.pre.1)
4
+ avo (2.11.1.pre.2)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -16,7 +16,7 @@ PATH
16
16
  pagy
17
17
  pundit
18
18
  rails (>= 6.0)
19
- view_component
19
+ view_component (= 2.60)
20
20
  zeitwerk
21
21
 
22
22
  GEM
@@ -201,7 +201,7 @@ GEM
201
201
  httparty (0.20.0)
202
202
  mime-types (~> 3.0)
203
203
  multi_xml (>= 0.5.2)
204
- i18n (1.11.0)
204
+ i18n (1.12.0)
205
205
  concurrent-ruby (~> 1.0)
206
206
  i18n_data (0.15.0)
207
207
  simple_po_parser (~> 1.1)
@@ -390,10 +390,10 @@ GEM
390
390
  turbo-rails (1.0.1)
391
391
  actionpack (>= 6.0.0)
392
392
  railties (>= 6.0.0)
393
- tzinfo (2.0.4)
393
+ tzinfo (2.0.5)
394
394
  concurrent-ruby (~> 1.0)
395
395
  unicode-display_width (2.1.0)
396
- view_component (2.57.1)
396
+ view_component (2.60.0)
397
397
  activesupport (>= 5.0.0, < 8.0)
398
398
  method_source (~> 1.0)
399
399
  warden (1.2.9)
@@ -483,7 +483,6 @@ DEPENDENCIES
483
483
  standard
484
484
  test-prof
485
485
  tzinfo-data
486
- view_component
487
486
  web-console (>= 3.3.0)
488
487
  webdrivers
489
488
  webmock
@@ -2,6 +2,7 @@
2
2
  <%= content_tag :div, data: {
3
3
  controller: "date-field",
4
4
  date_field_view_value: @view,
5
+ date_field_enable_time_value: true,
5
6
  date_field_format_value: @field.format,
6
7
  date_field_timezone_value: @field.timezone,
7
8
  date_field_picker_format_value: @field.picker_format,
@@ -2,6 +2,7 @@
2
2
  <%= content_tag :div, data: {
3
3
  controller: "date-field",
4
4
  date_field_view_value: @view,
5
+ date_field_enable_time_value: true,
5
6
  date_field_format_value: @field.format,
6
7
  date_field_timezone_value: @field.timezone,
7
8
  date_field_picker_format_value: @field.picker_format,
@@ -28,6 +28,8 @@ class Avo::ItemSwitcherComponent < Avo::BaseComponent
28
28
  return false if in_reflection? && item.hidden_in_reflection?
29
29
  end
30
30
 
31
+ return false if item.is_main_panel?
32
+
31
33
  true
32
34
  end
33
35
 
@@ -34,10 +34,8 @@
34
34
  </div>
35
35
  <% end %>
36
36
  <% if footer_tools? %>
37
- <div class="<%= white_panel_classes %> p-4 flex-1 flex flex-col xl:flex-row justify-between mt-6">
38
- <div class="flex-1 w-full flex flex-col sm:flex-row xl:justify-end sm:items-end space-y-2 sm:space-y-0 sm:space-x-2 mt-4 xl:mt-0">
39
- <%= footer_tools %>
40
- </div>
37
+ <div class="flex-1 w-full flex flex-col sm:flex-row xl:justify-end sm:items-end space-y-2 sm:space-y-0 sm:space-x-2 mt-4 xl:mt-0">
38
+ <%= footer_tools %>
41
39
  </div>
42
40
  <% end %>
43
41
  <% if footer? %>
@@ -47,8 +47,4 @@ class Avo::PanelComponent < ViewComponent::Base
47
47
  def render_header?
48
48
  @name.present? || description.present? || tools.present? || display_breadcrumbs?
49
49
  end
50
-
51
- def render_footer_tools?
52
- footer_tools.present?
53
- end
54
50
  end
@@ -58,33 +58,14 @@ class Avo::ResourceComponent < Avo::BaseComponent
58
58
  association_policy
59
59
  end
60
60
 
61
- def split_panel_fields
62
- initialize_panels
63
- @resource.get_fields.each do |field|
64
- case field.class.to_s
65
- when "Avo::Fields::HasOneField"
66
- @has_one_panels << field
67
- when "Avo::Fields::HasManyField"
68
- @has_many_panels << field
69
- when "Avo::Fields::HasAndBelongsToManyField"
70
- @has_as_belongs_to_many_panels << field
71
- else
72
- @fields_by_panel[field.panel_name] ||= []
73
- @fields_by_panel[field.panel_name] << field
74
- end
61
+ def main_panel
62
+ @resource.get_items.find do |item|
63
+ item.is_main_panel?
75
64
  end
76
65
  end
77
66
 
78
67
  private
79
68
 
80
- def initialize_panels
81
- @fields_by_panel = {}
82
- @has_one_panels = []
83
- @has_many_panels = []
84
- @has_as_belongs_to_many_panels = []
85
- @resource_tools = @resource.tools
86
- end
87
-
88
69
  def via_resource?
89
70
  params[:via_resource_class].present? && params[:via_resource_id].present?
90
71
  end
@@ -14,7 +14,10 @@ class Avo::Sidebar::LinkComponent < ViewComponent::Base
14
14
  end
15
15
 
16
16
  def is_external?
17
- URI(path).scheme.present?
17
+ # If the path contains the scheme, check if it includes the root path or not
18
+ return !path.include?(Avo::App.root_path) if URI(path).scheme.present?
19
+
20
+ false
18
21
  end
19
22
 
20
23
  # For external links active_link_to marks them all as active.
@@ -5,8 +5,7 @@
5
5
  controller: "tabs",
6
6
  tabs_view_value: view,
7
7
  tabs_active_tab_value: active_tab_name
8
- },
9
- class: 'space-y-12' do %>
8
+ } do %>
10
9
  <% visible_tabs.each_with_index do |tab, index| %>
11
10
  <%
12
11
  args = {
@@ -33,20 +33,42 @@
33
33
  <% end %>
34
34
  <% end %>
35
35
  <% end %>
36
+ <%# Extract the main panel and display the fields here. %>
37
+ <%# This way we'll be able to render the footer buttons under the main fields. %>
38
+ <% if main_panel.present? %>
39
+ <% c.body do %>
40
+ <div class="divide-y">
41
+ <% main_panel.items.each_with_index do |field, index| %>
42
+ <%= render field.hydrate(resource: @resource, model: @resource.model, user: @resource.user, view: view)
43
+ .component_for_view(view)
44
+ .new(field: field, resource: @resource, index: index, form: form)
45
+ %>
46
+ <% end %>
47
+ </div>
48
+ <% end %>
49
+ <% end %>
36
50
  <% if Avo.configuration.buttons_on_form_footers %>
37
51
  <% c.footer_tools do %>
38
- <%= a_link back_path, icon: 'arrow-left' do %>
39
- <%= t('avo.cancel').capitalize %>
40
- <% end %>
41
- <% if can_see_the_save_button? %>
42
- <%= a_button color: :green, loading: true, type: :submit, icon: 'save' do %>
43
- <%= t('avo.save').capitalize %>
52
+ <div class="mt-4">
53
+ <%= a_link back_path,
54
+ style: :text,
55
+ icon: 'arrow-left' do %>
56
+ <%= t('avo.cancel').capitalize %>
44
57
  <% end %>
45
- <% end %>
58
+ <% if can_see_the_save_button? %>
59
+ <%= a_button color: :primary,
60
+ style: :primary,
61
+ loading: true,
62
+ type: :submit,
63
+ icon: 'save' do %>
64
+ <%= t('avo.save').capitalize %>
65
+ <% end %>
66
+ <% end %>
67
+ </div>
46
68
  <% end %>
47
69
  <% end %>
48
70
  <% end %>
49
- <%= content_tag :div, class: 'space-y-12' do %>
71
+ <%= content_tag :div, class: 'space-y-12 mt-12' do %>
50
72
  <% @resource.get_items.each_with_index do |item, index| %>
51
73
  <% next if item.nil? %>
52
74
  <%= render Avo::ItemSwitcherComponent.new resource: @resource, item: item, index: index + 1, view: @view, form: form %>
@@ -11,8 +11,6 @@ class Avo::Views::ResourceEditComponent < Avo::ResourceComponent
11
11
  @model = model
12
12
  @actions = actions
13
13
  @view = view
14
-
15
- split_panel_fields
16
14
  end
17
15
 
18
16
  def title
@@ -64,8 +64,20 @@
64
64
  <% end %>
65
65
  <% end %>
66
66
  <% end %>
67
+ <% if main_panel.present? %>
68
+ <% c.body do %>
69
+ <div class="divide-y">
70
+ <% main_panel.items.each_with_index do |field, index| %>
71
+ <%= render field.hydrate(resource: @resource, model: @resource.model, user: @resource.user, view: view)
72
+ .component_for_view(view)
73
+ .new(field: field, resource: @resource, index: index)
74
+ %>
75
+ <% end %>
76
+ </div>
77
+ <% end %>
78
+ <% end %>
67
79
  <% end %>
68
- <%= content_tag :div, class: 'space-y-12' do %>
80
+ <%= content_tag :div, class: 'space-y-12 mt-12' do %>
69
81
  <% @resource.get_items.each_with_index do |item, index| %>
70
82
  <% next if item.nil? %>
71
83
  <%= render Avo::ItemSwitcherComponent.new resource: @resource, reflection: @reflection, item: item, index: index + 1, view: @view %>
@@ -10,8 +10,6 @@ class Avo::Views::ResourceShowComponent < Avo::ResourceComponent
10
10
  @resource_panel = resource_panel
11
11
  @actions = actions
12
12
  @view = :show
13
-
14
- split_panel_fields
15
13
  end
16
14
 
17
15
  def title
@@ -320,7 +320,9 @@ module Avo
320
320
  .map do |action|
321
321
  action.new(model: @model, resource: @resource, view: @view)
322
322
  end
323
- .select { |action| action.visible_in_view }
323
+ .select do |action|
324
+ action.visible_in_view
325
+ end
324
326
  end
325
327
 
326
328
  def set_applied_filters
@@ -380,7 +382,6 @@ module Avo
380
382
 
381
383
  add_breadcrumb via_resource.plural_name, resources_path(resource: @resource)
382
384
  add_breadcrumb via_resource.model_title, resource_path(model: via_model, resource: via_resource)
383
- puts ["via_resource.model_title->", via_resource.model_title].inspect
384
385
 
385
386
  last_crumb_args = {
386
387
  via_resource_class: params[:via_resource_class],
@@ -68,7 +68,14 @@ export default class extends Controller {
68
68
 
69
69
  // Turns the value in the controller wrapper into the timezone of the browser
70
70
  initShow() {
71
- this.context.element.innerText = this.parsedValue.setZone(this.displayTimezone).toFormat(this.formatValue)
71
+ let value = this.parsedValue
72
+
73
+ // Set the zone only if the type of field is date time.
74
+ if (this.enableTimeValue) {
75
+ value = value.setZone(this.displayTimezone)
76
+ }
77
+
78
+ this.context.element.innerText = value.toFormat(this.formatValue)
72
79
  }
73
80
 
74
81
  initEdit() {
@@ -99,10 +106,13 @@ export default class extends Controller {
99
106
 
100
107
  // enable timezone display
101
108
  if (this.enableTimeValue) {
109
+ console.log(1)
102
110
  options.defaultDate = this.parsedValue.setZone(this.displayTimezone).toISO()
103
111
 
104
112
  options.dateFormat = 'Y-m-d H:i:S'
105
113
  } else {
114
+ console.log(2)
115
+
106
116
  // Because the browser treats the date like a timestamp and updates it at 00:00 hour, when on a western timezone the date will be converted with one day offset.
107
117
  // Ex: 2022-01-30 will render as 2022-01-29 on an American timezone
108
118
  options.defaultDate = universalTimestamp(this.initialValue)
@@ -1,2 +1 @@
1
1
  <%= render Avo::Views::ResourceEditComponent.new(resource: @resource, view: @view, actions: @actions) %>
2
-
data/avo.gemspec CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_dependency "httparty"
41
41
  spec.add_dependency "active_link_to"
42
42
  spec.add_dependency "image_processing"
43
- spec.add_dependency "view_component"
43
+ spec.add_dependency "view_component", "2.60"
44
44
  spec.add_dependency "hotwire-rails"
45
45
  spec.add_dependency "addressable"
46
46
  spec.add_dependency "meta-tags"
@@ -1,7 +1,5 @@
1
1
  module Avo
2
2
  class BaseAction
3
- extend HasContext
4
-
5
3
  include Avo::Concerns::HasFields
6
4
 
7
5
  class_attribute :name, default: nil
@@ -23,8 +21,16 @@ module Avo
23
21
  attr_accessor :user
24
22
 
25
23
  delegate :view, to: :class
24
+ delegate :context, to: ::Avo::App
25
+ delegate :current_user, to: ::Avo::App
26
+ delegate :params, to: ::Avo::App
27
+ delegate :view_context, to: ::Avo::App
28
+ delegate :avo, to: :view_context
29
+ delegate :main_app, to: :view_context
26
30
 
27
31
  class << self
32
+ delegate :context, to: ::Avo::App
33
+
28
34
  def form_data_attributes
29
35
  # We can't respond with a file download from Turbo se we disable it on the form
30
36
  if may_download_file
@@ -64,10 +70,6 @@ module Avo
64
70
  @response[:messages] = []
65
71
  end
66
72
 
67
- def context
68
- self.class.context
69
- end
70
-
71
73
  def get_attributes_for_action
72
74
  get_fields.map do |field|
73
75
  [field.id, field.value]
@@ -1,7 +1,6 @@
1
1
  module Avo
2
2
  class BaseResource
3
3
  extend ActiveSupport::DescendantsTracker
4
- extend HasContext
5
4
 
6
5
  include ActionView::Helpers::UrlHelper
7
6
  include Avo::Concerns::HasModel
@@ -18,6 +17,7 @@ module Avo
18
17
  delegate :resource_path, to: :view_context
19
18
  delegate :resources_path, to: :view_context
20
19
  delegate :t, to: ::I18n
20
+ delegate :context, to: ::Avo::App
21
21
 
22
22
  attr_accessor :view
23
23
  attr_accessor :model
@@ -50,6 +50,7 @@ module Avo
50
50
 
51
51
  class << self
52
52
  delegate :t, to: ::I18n
53
+ delegate :context, to: ::Avo::App
53
54
 
54
55
  def grid(&block)
55
56
  grid_collector = GridCollector.new
@@ -244,10 +245,6 @@ module Avo
244
245
  view_types
245
246
  end
246
247
 
247
- def context
248
- self.class.context
249
- end
250
-
251
248
  def attached_file_fields
252
249
  get_field_definitions.select do |field|
253
250
  [Avo::Fields::FileField, Avo::Fields::FilesField].include? field.class
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.10.3.pre.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.11.1.pre.2" unless const_defined?(:VERSION)
3
3
  end
@@ -6461,10 +6461,6 @@ trix-editor .attachment__metadata .attachment__size {
6461
6461
  margin-bottom:0.5rem
6462
6462
  }
6463
6463
 
6464
- .mt-6{
6465
- margin-top:1.5rem
6466
- }
6467
-
6468
6464
  .ml-1\/2{
6469
6465
  margin-left:50%
6470
6466
  }
@@ -6481,6 +6477,10 @@ trix-editor .attachment__metadata .attachment__size {
6481
6477
  margin-left:auto
6482
6478
  }
6483
6479
 
6480
+ .mt-12{
6481
+ margin-top:3rem
6482
+ }
6483
+
6484
6484
  .-mb-2{
6485
6485
  margin-bottom:-0.5rem
6486
6486
  }
@@ -6489,6 +6489,10 @@ trix-editor .attachment__metadata .attachment__size {
6489
6489
  margin-top:0px
6490
6490
  }
6491
6491
 
6492
+ .mt-6{
6493
+ margin-top:1.5rem
6494
+ }
6495
+
6492
6496
  .mr-px{
6493
6497
  margin-right:1px
6494
6498
  }
@@ -69,7 +69,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
69
69
  <span class='flatpickr-weekday'>
70
70
  ${de.join("</span><span class='flatpickr-weekday'>")}
71
71
  </span>
72
- `}function oe(){r.calendarContainer.classList.add("hasWeeks");let le=jr("div","flatpickr-weekwrapper");le.appendChild(jr("span","flatpickr-weekday",r.l10n.weekAbbreviation));let de=jr("div","flatpickr-weeks");return le.appendChild(de),{weekWrapper:le,weekNumbers:de}}function G(le,de=!0){let Ae=de?le:le-r.currentMonth;Ae<0&&r._hidePrevMonthArrow===!0||Ae>0&&r._hideNextMonthArrow===!0||(r.currentMonth+=Ae,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,er("onYearChange"),S()),V(),er("onMonthChange"),Zt())}function K(le=!0,de=!0){if(r.input.value="",r.altInput!==void 0&&(r.altInput.value=""),r.mobileInput!==void 0&&(r.mobileInput.value=""),r.selectedDates=[],r.latestSelectedDateObj=void 0,de===!0&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth()),r.config.enableTime===!0){let{hours:Ae,minutes:He,seconds:lt}=nE(r.config);g(Ae,He,lt)}r.redraw(),le&&er("onChange")}function ve(){r.isOpen=!1,r.isMobile||(r.calendarContainer!==void 0&&r.calendarContainer.classList.remove("open"),r._input!==void 0&&r._input.classList.remove("active")),er("onClose")}function Se(){r.config!==void 0&&er("onDestroy");for(let le=r._handlers.length;le--;)r._handlers[le].remove();if(r._handlers=[],r.mobileInput)r.mobileInput.parentNode&&r.mobileInput.parentNode.removeChild(r.mobileInput),r.mobileInput=void 0;else if(r.calendarContainer&&r.calendarContainer.parentNode)if(r.config.static&&r.calendarContainer.parentNode){let le=r.calendarContainer.parentNode;if(le.lastChild&&le.removeChild(le.lastChild),le.parentNode){for(;le.firstChild;)le.parentNode.insertBefore(le.firstChild,le);le.parentNode.removeChild(le)}}else r.calendarContainer.parentNode.removeChild(r.calendarContainer);r.altInput&&(r.input.type="text",r.altInput.parentNode&&r.altInput.parentNode.removeChild(r.altInput),delete r.altInput),r.input&&(r.input.type=r.input._type,r.input.classList.remove("flatpickr-input"),r.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(le=>{try{delete r[le]}catch{}})}function _e(le){return r.config.appendTo&&r.config.appendTo.contains(le)?!0:r.calendarContainer.contains(le)}function Ne(le){if(r.isOpen&&!r.config.inline){let de=sa(le),Ae=_e(de),He=de===r.input||de===r.altInput||r.element.contains(de)||le.path&&le.path.indexOf&&(~le.path.indexOf(r.input)||~le.path.indexOf(r.altInput)),lt=le.type==="blur"?He&&le.relatedTarget&&!_e(le.relatedTarget):!He&&!Ae&&!_e(le.relatedTarget),Qe=!r.config.ignoredFocusElements.some(Dt=>Dt.contains(de));lt&&Qe&&(r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0&&r.input.value!==""&&r.input.value!==void 0&&s(),r.close(),r.config&&r.config.mode==="range"&&r.selectedDates.length===1&&(r.clear(!1),r.redraw()))}}function Le(le){if(!le||r.config.minDate&&le<r.config.minDate.getFullYear()||r.config.maxDate&&le>r.config.maxDate.getFullYear())return;let de=le,Ae=r.currentYear!==de;r.currentYear=de||r.currentYear,r.config.maxDate&&r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth=Math.min(r.config.maxDate.getMonth(),r.currentMonth):r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&(r.currentMonth=Math.max(r.config.minDate.getMonth(),r.currentMonth)),Ae&&(r.redraw(),er("onYearChange"),S())}function it(le,de=!0){var Ae;let He=r.parseDate(le,void 0,de);if(r.config.minDate&&He&&la(He,r.config.minDate,de!==void 0?de:!r.minDateHasTime)<0||r.config.maxDate&&He&&la(He,r.config.maxDate,de!==void 0?de:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&r.config.disable.length===0)return!0;if(He===void 0)return!1;let lt=!!r.config.enable,Qe=(Ae=r.config.enable)!==null&&Ae!==void 0?Ae:r.config.disable;for(let Dt=0,wt;Dt<Qe.length;Dt++){if(wt=Qe[Dt],typeof wt=="function"&&wt(He))return lt;if(wt instanceof Date&&He!==void 0&&wt.getTime()===He.getTime())return lt;if(typeof wt=="string"){let Xt=r.parseDate(wt,void 0,!0);return Xt&&Xt.getTime()===He.getTime()?lt:!lt}else if(typeof wt=="object"&&He!==void 0&&wt.from&&wt.to&&He.getTime()>=wt.from.getTime()&&He.getTime()<=wt.to.getTime())return lt}return!lt}function ze(le){return r.daysContainer!==void 0?le.className.indexOf("hidden")===-1&&le.className.indexOf("flatpickr-disabled")===-1&&r.daysContainer.contains(le):!1}function tt(le){le.target===r._input&&(r.selectedDates.length>0||r._input.value.length>0)&&!(le.relatedTarget&&_e(le.relatedTarget))&&r.setDate(r._input.value,!0,le.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function xt(le){let de=sa(le),Ae=r.config.wrap?t.contains(de):de===r._input,He=r.config.allowInput,lt=r.isOpen&&(!He||!Ae),Qe=r.config.inline&&Ae&&!He;if(le.keyCode===13&&Ae){if(He)return r.setDate(r._input.value,!0,de===r.altInput?r.config.altFormat:r.config.dateFormat),de.blur();r.open()}else if(_e(de)||lt||Qe){let Dt=!!r.timeContainer&&r.timeContainer.contains(de);switch(le.keyCode){case 13:Dt?(le.preventDefault(),s(),Fe()):It(le);break;case 27:le.preventDefault(),Fe();break;case 8:case 46:Ae&&!r.config.allowInput&&(le.preventDefault(),r.clear());break;case 37:case 39:if(!Dt&&!Ae){if(le.preventDefault(),r.daysContainer!==void 0&&(He===!1||document.activeElement&&ze(document.activeElement))){let Xt=le.keyCode===39?1:-1;le.ctrlKey?(le.stopPropagation(),G(Xt),F(C(1),0)):F(void 0,Xt)}}else r.hourElement&&r.hourElement.focus();break;case 38:case 40:le.preventDefault();let wt=le.keyCode===40?1:-1;r.daysContainer&&de.$i!==void 0||de===r.input||de===r.altInput?le.ctrlKey?(le.stopPropagation(),Le(r.currentYear-wt),F(C(1),0)):Dt||F(void 0,wt*7):de===r.currentYearElement?Le(r.currentYear-wt):r.config.enableTime&&(!Dt&&r.hourElement&&r.hourElement.focus(),s(le),r._debouncedChange());break;case 9:if(Dt){let Xt=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter(dr=>dr),Yt=Xt.indexOf(de);if(Yt!==-1){let dr=Xt[Yt+(le.shiftKey?-1:1)];le.preventDefault(),(dr||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(de)&&le.shiftKey&&(le.preventDefault(),r._input.focus());break;default:break}}if(r.amPM!==void 0&&de===r.amPM)switch(le.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],f(),tr();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],f(),tr();break}(Ae||_e(de))&&er("onKeyDown",le)}function At(le){if(r.selectedDates.length!==1||le&&(!le.classList.contains("flatpickr-day")||le.classList.contains("flatpickr-disabled")))return;let de=le?le.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),Ae=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),He=Math.min(de,r.selectedDates[0].getTime()),lt=Math.max(de,r.selectedDates[0].getTime()),Qe=!1,Dt=0,wt=0;for(let Xt=He;Xt<lt;Xt+=foe.DAY)it(new Date(Xt),!0)||(Qe=Qe||Xt>He&&Xt<lt,Xt<Ae&&(!Dt||Xt>Dt)?Dt=Xt:Xt>Ae&&(!wt||Xt<wt)&&(wt=Xt));for(let Xt=0;Xt<r.config.showMonths;Xt++){let Yt=r.daysContainer.children[Xt];for(let dr=0,sn=Yt.children.length;dr<sn;dr++){let zr=Yt.children[dr],Hr=zr.dateObj.getTime(),Zn=Dt>0&&Hr<Dt||wt>0&&Hr>wt;if(Zn){zr.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(Wi=>{zr.classList.remove(Wi)});continue}else if(Qe&&!Zn)continue;["startRange","inRange","endRange","notAllowed"].forEach(Wi=>{zr.classList.remove(Wi)}),le!==void 0&&(le.classList.add(de<=r.selectedDates[0].getTime()?"startRange":"endRange"),Ae<de&&Hr===Ae?zr.classList.add("startRange"):Ae>de&&Hr===Ae&&zr.classList.add("endRange"),Hr>=Dt&&(wt===0||Hr<=wt)&&coe(Hr,Ae,de)&&zr.classList.add("inRange"))}}}function Ve(){r.isOpen&&!r.config.static&&!r.config.inline&&fe()}function Oe(le,de=r._positionElement){if(r.isMobile===!0){if(le){le.preventDefault();let He=sa(le);He&&He.blur()}r.mobileInput!==void 0&&(r.mobileInput.focus(),r.mobileInput.click()),er("onOpen");return}else if(r._input.disabled||r.config.inline)return;let Ae=r.isOpen;r.isOpen=!0,Ae||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),er("onOpen"),fe(de)),r.config.enableTime===!0&&r.config.noCalendar===!0&&r.config.allowInput===!1&&(le===void 0||!r.timeContainer.contains(le.relatedTarget))&&setTimeout(()=>r.hourElement.select(),50)}function Me(le){return de=>{let Ae=r.config[`_${le}Date`]=r.parseDate(de,r.config.dateFormat),He=r.config[`_${le==="min"?"max":"min"}Date`];Ae!==void 0&&(r[le==="min"?"minDateHasTime":"maxDateHasTime"]=Ae.getHours()>0||Ae.getMinutes()>0||Ae.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter(lt=>it(lt)),!r.selectedDates.length&&le==="min"&&p(Ae),tr()),r.daysContainer&&($e(),Ae!==void 0?r.currentYearElement[le]=Ae.getFullYear().toString():r.currentYearElement.removeAttribute(le),r.currentYearElement.disabled=!!He&&Ae!==void 0&&He.getFullYear()===Ae.getFullYear())}}function he(){let le=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],de=Object.assign(Object.assign({},JSON.parse(JSON.stringify(t.dataset||{}))),e),Ae={};r.config.parseDate=de.parseDate,r.config.formatDate=de.formatDate,Object.defineProperty(r.config,"enable",{get:()=>r.config._enable,set:Qe=>{r.config._enable=xe(Qe)}}),Object.defineProperty(r.config,"disable",{get:()=>r.config._disable,set:Qe=>{r.config._disable=xe(Qe)}});let He=de.mode==="time";if(!de.dateFormat&&(de.enableTime||He)){let Qe=li.defaultConfig.dateFormat||Df.dateFormat;Ae.dateFormat=de.noCalendar||He?"H:i"+(de.enableSeconds?":S":""):Qe+" H:i"+(de.enableSeconds?":S":"")}if(de.altInput&&(de.enableTime||He)&&!de.altFormat){let Qe=li.defaultConfig.altFormat||Df.altFormat;Ae.altFormat=de.noCalendar||He?"h:i"+(de.enableSeconds?":S K":" K"):Qe+` h:i${de.enableSeconds?":S":""} K`}Object.defineProperty(r.config,"minDate",{get:()=>r.config._minDate,set:Me("min")}),Object.defineProperty(r.config,"maxDate",{get:()=>r.config._maxDate,set:Me("max")});let lt=Qe=>Dt=>{r.config[Qe==="min"?"_minTime":"_maxTime"]=r.parseDate(Dt,"H:i:S")};Object.defineProperty(r.config,"minTime",{get:()=>r.config._minTime,set:lt("min")}),Object.defineProperty(r.config,"maxTime",{get:()=>r.config._maxTime,set:lt("max")}),de.mode==="time"&&(r.config.noCalendar=!0,r.config.enableTime=!0),Object.assign(r.config,Ae,de);for(let Qe=0;Qe<le.length;Qe++)r.config[le[Qe]]=r.config[le[Qe]]===!0||r.config[le[Qe]]==="true";Z1.filter(Qe=>r.config[Qe]!==void 0).forEach(Qe=>{r.config[Qe]=tE(r.config[Qe]||[]).map(o)}),r.isMobile=!r.config.disableMobile&&!r.config.inline&&r.config.mode==="single"&&!r.config.disable.length&&!r.config.enable&&!r.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(let Qe=0;Qe<r.config.plugins.length;Qe++){let Dt=r.config.plugins[Qe](r)||{};for(let wt in Dt)Z1.indexOf(wt)>-1?r.config[wt]=tE(Dt[wt]).map(o).concat(r.config[wt]):typeof de[wt]>"u"&&(r.config[wt]=Dt[wt])}de.altInputClass||(r.config.altInputClass=J().className+" "+r.config.altInputClass),er("onParseConfig")}function J(){return r.config.wrap?t.querySelector("[data-input]"):t}function re(){typeof r.config.locale!="object"&&typeof li.l10ns[r.config.locale]>"u"&&r.config.errorHandler(new Error(`flatpickr: invalid locale ${r.config.locale}`)),r.l10n=Object.assign(Object.assign({},li.l10ns.default),typeof r.config.locale=="object"?r.config.locale:r.config.locale!=="default"?li.l10ns[r.config.locale]:void 0),b0.K=`(${r.l10n.amPM[0]}|${r.l10n.amPM[1]}|${r.l10n.amPM[0].toLowerCase()}|${r.l10n.amPM[1].toLowerCase()})`,Object.assign(Object.assign({},e),JSON.parse(JSON.stringify(t.dataset||{}))).time_24hr===void 0&&li.defaultConfig.time_24hr===void 0&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=nF(r),r.parseDate=rE({config:r.config,l10n:r.l10n})}function fe(le){if(typeof r.config.position=="function")return void r.config.position(r,le);if(r.calendarContainer===void 0)return;er("onPreCalendarPosition");let de=le||r._positionElement,Ae=Array.prototype.reduce.call(r.calendarContainer.children,(ki,ln)=>ki+ln.offsetHeight,0),He=r.calendarContainer.offsetWidth,lt=r.config.position.split(" "),Qe=lt[0],Dt=lt.length>1?lt[1]:null,wt=de.getBoundingClientRect(),Xt=window.innerHeight-wt.bottom,Yt=Qe==="above"||Qe!=="below"&&Xt<Ae&&wt.top>Ae,dr=window.pageYOffset+wt.top+(Yt?-Ae-2:de.offsetHeight+2);if(ho(r.calendarContainer,"arrowTop",!Yt),ho(r.calendarContainer,"arrowBottom",Yt),r.config.inline)return;let sn=window.pageXOffset+wt.left,zr=!1,go=!1;Dt==="center"?(sn-=(He-wt.width)/2,zr=!0):Dt==="right"&&(sn-=He-wt.width,go=!0),ho(r.calendarContainer,"arrowLeft",!zr&&!go),ho(r.calendarContainer,"arrowCenter",zr),ho(r.calendarContainer,"arrowRight",go);let Hr=window.document.body.offsetWidth-(window.pageXOffset+wt.right),Zn=sn+He>window.document.body.offsetWidth,Wi=Hr+He>window.document.body.offsetWidth;if(ho(r.calendarContainer,"rightMost",Zn),!r.config.static)if(r.calendarContainer.style.top=`${dr}px`,!Zn)r.calendarContainer.style.left=`${sn}px`,r.calendarContainer.style.right="auto";else if(!Wi)r.calendarContainer.style.left="auto",r.calendarContainer.style.right=`${Hr}px`;else{let ki=ht();if(ki===void 0)return;let ln=window.document.body.offsetWidth,Po=Math.max(0,ln/2-He/2),Ei=".flatpickr-calendar.centerMost:before",Ws=".flatpickr-calendar.centerMost:after",mo=ki.cssRules.length,Ro=`{left:${wt.left}px;right:auto;}`;ho(r.calendarContainer,"rightMost",!1),ho(r.calendarContainer,"centerMost",!0),ki.insertRule(`${Ei},${Ws}${Ro}`,mo),r.calendarContainer.style.left=`${Po}px`,r.calendarContainer.style.right="auto"}}function ht(){let le=null;for(let de=0;de<document.styleSheets.length;de++){let Ae=document.styleSheets[de];try{Ae.cssRules}catch{continue}le=Ae;break}return le??ke()}function ke(){let le=document.createElement("style");return document.head.appendChild(le),le.sheet}function $e(){r.config.noCalendar||r.isMobile||(S(),Zt(),V())}function Fe(){r._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(r.close,0):r.close()}function It(le){le.preventDefault(),le.stopPropagation();let de=Dt=>Dt.classList&&Dt.classList.contains("flatpickr-day")&&!Dt.classList.contains("flatpickr-disabled")&&!Dt.classList.contains("notAllowed"),Ae=eF(sa(le),de);if(Ae===void 0)return;let He=Ae,lt=r.latestSelectedDateObj=new Date(He.dateObj.getTime()),Qe=(lt.getMonth()<r.currentMonth||lt.getMonth()>r.currentMonth+r.config.showMonths-1)&&r.config.mode!=="range";if(r.selectedDateElem=He,r.config.mode==="single")r.selectedDates=[lt];else if(r.config.mode==="multiple"){let Dt=Ze(lt);Dt?r.selectedDates.splice(parseInt(Dt),1):r.selectedDates.push(lt)}else r.config.mode==="range"&&(r.selectedDates.length===2&&r.clear(!1,!1),r.latestSelectedDateObj=lt,r.selectedDates.push(lt),la(lt,r.selectedDates[0],!0)!==0&&r.selectedDates.sort((Dt,wt)=>Dt.getTime()-wt.getTime()));if(f(),Qe){let Dt=r.currentYear!==lt.getFullYear();r.currentYear=lt.getFullYear(),r.currentMonth=lt.getMonth(),Dt&&(er("onYearChange"),S()),er("onMonthChange")}if(Zt(),V(),tr(),!Qe&&r.config.mode!=="range"&&r.config.showMonths===1?_(He):r.selectedDateElem!==void 0&&r.hourElement===void 0&&r.selectedDateElem&&r.selectedDateElem.focus(),r.hourElement!==void 0&&r.hourElement!==void 0&&r.hourElement.focus(),r.config.closeOnSelect){let Dt=r.config.mode==="single"&&!r.config.enableTime,wt=r.config.mode==="range"&&r.selectedDates.length===2&&!r.config.enableTime;(Dt||wt)&&Fe()}w()}let ut={locale:[re,X],showMonths:[q,a,z],minDate:[k],maxDate:[k],clickOpens:[()=>{r.config.clickOpens===!0?(x(r._input,"focus",r.open),x(r._input,"click",r.open)):(r._input.removeEventListener("focus",r.open),r._input.removeEventListener("click",r.open))}]};function pt(le,de){if(le!==null&&typeof le=="object"){Object.assign(r.config,le);for(let Ae in le)ut[Ae]!==void 0&&ut[Ae].forEach(He=>He())}else r.config[le]=de,ut[le]!==void 0?ut[le].forEach(Ae=>Ae()):Z1.indexOf(le)>-1&&(r.config[le]=tE(de));r.redraw(),tr(!0)}function st(le,de){let Ae=[];if(le instanceof Array)Ae=le.map(He=>r.parseDate(He,de));else if(le instanceof Date||typeof le=="number")Ae=[r.parseDate(le,de)];else if(typeof le=="string")switch(r.config.mode){case"single":case"time":Ae=[r.parseDate(le,de)];break;case"multiple":Ae=le.split(r.config.conjunction).map(He=>r.parseDate(He,de));break;case"range":Ae=le.split(r.l10n.rangeSeparator).map(He=>r.parseDate(He,de));break;default:break}else r.config.errorHandler(new Error(`Invalid date supplied: ${JSON.stringify(le)}`));r.selectedDates=r.config.allowInvalidPreload?Ae:Ae.filter(He=>He instanceof Date&&it(He,!1)),r.config.mode==="range"&&r.selectedDates.sort((He,lt)=>He.getTime()-lt.getTime())}function ye(le,de=!1,Ae=r.config.dateFormat){if(le!==0&&!le||le instanceof Array&&le.length===0)return r.clear(de);st(le,Ae),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),k(void 0,de),p(),r.selectedDates.length===0&&r.clear(!1),tr(de),de&&er("onChange")}function xe(le){return le.slice().map(de=>typeof de=="string"||typeof de=="number"||de instanceof Date?r.parseDate(de,void 0,!0):de&&typeof de=="object"&&de.from&&de.to?{from:r.parseDate(de.from,void 0),to:r.parseDate(de.to,void 0)}:de).filter(de=>de)}function We(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;let le=r.config.defaultDate||((r.input.nodeName==="INPUT"||r.input.nodeName==="TEXTAREA")&&r.input.placeholder&&r.input.value===r.input.placeholder?null:r.input.value);le&&st(le,r.config.dateFormat),r._initialDate=r.selectedDates.length>0?r.selectedDates[0]:r.config.minDate&&r.config.minDate.getTime()>r.now.getTime()?r.config.minDate:r.config.maxDate&&r.config.maxDate.getTime()<r.now.getTime()?r.config.maxDate:r.now,r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth(),r.selectedDates.length>0&&(r.latestSelectedDateObj=r.selectedDates[0]),r.config.minTime!==void 0&&(r.config.minTime=r.parseDate(r.config.minTime,"H:i")),r.config.maxTime!==void 0&&(r.config.maxTime=r.parseDate(r.config.maxTime,"H:i")),r.minDateHasTime=!!r.config.minDate&&(r.config.minDate.getHours()>0||r.config.minDate.getMinutes()>0||r.config.minDate.getSeconds()>0),r.maxDateHasTime=!!r.config.maxDate&&(r.config.maxDate.getHours()>0||r.config.maxDate.getMinutes()>0||r.config.maxDate.getSeconds()>0)}function yt(){if(r.input=J(),!r.input){r.config.errorHandler(new Error("Invalid input element specified"));return}r.input._type=r.input.type,r.input.type="text",r.input.classList.add("flatpickr-input"),r._input=r.input,r.config.altInput&&(r.altInput=jr(r.input.nodeName,r.config.altInputClass),r._input=r.altInput,r.altInput.placeholder=r.input.placeholder,r.altInput.disabled=r.input.disabled,r.altInput.required=r.input.required,r.altInput.tabIndex=r.input.tabIndex,r.altInput.type="text",r.input.setAttribute("type","hidden"),!r.config.static&&r.input.parentNode&&r.input.parentNode.insertBefore(r.altInput,r.input.nextSibling)),r.config.allowInput||r._input.setAttribute("readonly","readonly"),r._positionElement=r.config.positionElement||r._input}function Gr(){let le=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=jr("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=le,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr=le==="datetime-local"?"Y-m-d\\TH:i:S":le==="date"?"Y-m-d":"H:i:S",r.selectedDates.length>0&&(r.mobileInput.defaultValue=r.mobileInput.value=r.formatDate(r.selectedDates[0],r.mobileFormatStr)),r.config.minDate&&(r.mobileInput.min=r.formatDate(r.config.minDate,"Y-m-d")),r.config.maxDate&&(r.mobileInput.max=r.formatDate(r.config.maxDate,"Y-m-d")),r.input.getAttribute("step")&&(r.mobileInput.step=String(r.input.getAttribute("step"))),r.input.type="hidden",r.altInput!==void 0&&(r.altInput.type="hidden");try{r.input.parentNode&&r.input.parentNode.insertBefore(r.mobileInput,r.input.nextSibling)}catch{}x(r.mobileInput,"change",de=>{r.setDate(sa(de).value,!1,r.mobileFormatStr),er("onChange"),er("onClose")})}function mt(le){if(r.isOpen===!0)return r.close();r.open(le)}function er(le,de){if(r.config===void 0)return;let Ae=r.config[le];if(Ae!==void 0&&Ae.length>0)for(let He=0;Ae[He]&&He<Ae.length;He++)Ae[He](r.selectedDates,r.input.value,r,de);le==="onChange"&&(r.input.dispatchEvent(Ie("change")),r.input.dispatchEvent(Ie("input")))}function Ie(le){let de=document.createEvent("Event");return de.initEvent(le,!0,!0),de}function Ze(le){for(let de=0;de<r.selectedDates.length;de++)if(la(r.selectedDates[de],le)===0)return""+de;return!1}function dt(le){return r.config.mode!=="range"||r.selectedDates.length<2?!1:la(le,r.selectedDates[0])>=0&&la(le,r.selectedDates[1])<=0}function Zt(){r.config.noCalendar||r.isMobile||!r.monthNav||(r.yearElements.forEach((le,de)=>{let Ae=new Date(r.currentYear,r.currentMonth,1);Ae.setMonth(r.currentMonth+de),r.config.showMonths>1||r.config.monthSelectorType==="static"?r.monthElements[de].textContent=y0(Ae.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=Ae.getMonth().toString(),le.value=Ae.getFullYear().toString()}),r._hidePrevMonthArrow=r.config.minDate!==void 0&&(r.currentYear===r.config.minDate.getFullYear()?r.currentMonth<=r.config.minDate.getMonth():r.currentYear<r.config.minDate.getFullYear()),r._hideNextMonthArrow=r.config.maxDate!==void 0&&(r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth+1>r.config.maxDate.getMonth():r.currentYear>r.config.maxDate.getFullYear()))}function jt(le){return r.selectedDates.map(de=>r.formatDate(de,le)).filter((de,Ae,He)=>r.config.mode!=="range"||r.config.enableTime||He.indexOf(de)===Ae).join(r.config.mode!=="range"?r.config.conjunction:r.l10n.rangeSeparator)}function tr(le=!0){r.mobileInput!==void 0&&r.mobileFormatStr&&(r.mobileInput.value=r.latestSelectedDateObj!==void 0?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=jt(r.config.dateFormat),r.altInput!==void 0&&(r.altInput.value=jt(r.config.altFormat)),le!==!1&&er("onValueUpdate")}function sr(le){let de=sa(le),Ae=r.prevMonthNav.contains(de),He=r.nextMonthNav.contains(de);Ae||He?G(Ae?-1:1):r.yearElements.indexOf(de)>=0?de.select():de.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):de.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}function zn(le){le.preventDefault();let de=le.type==="keydown",Ae=sa(le),He=Ae;r.amPM!==void 0&&Ae===r.amPM&&(r.amPM.textContent=r.l10n.amPM[aa(r.amPM.textContent===r.l10n.amPM[0])]);let lt=parseFloat(He.getAttribute("min")),Qe=parseFloat(He.getAttribute("max")),Dt=parseFloat(He.getAttribute("step")),wt=parseInt(He.value,10),Xt=le.delta||(de?le.which===38?1:-1:0),Yt=wt+Dt*Xt;if(typeof He.value<"u"&&He.value.length===2){let dr=He===r.hourElement,sn=He===r.minuteElement;Yt<lt?(Yt=Qe+Yt+aa(!dr)+(aa(dr)&&aa(!r.amPM)),sn&&D(void 0,-1,r.hourElement)):Yt>Qe&&(Yt=He===r.hourElement?Yt-Qe-aa(!r.amPM):lt,sn&&D(void 0,1,r.hourElement)),r.amPM&&dr&&(Dt===1?Yt+wt===23:Math.abs(Yt-wt)>Dt)&&(r.amPM.textContent=r.l10n.amPM[aa(r.amPM.textContent===r.l10n.amPM[0])]),He.value=fo(Yt)}}return i(),r}function pm(t,e){let r=Array.prototype.slice.call(t).filter(i=>i instanceof HTMLElement),n=[];for(let i=0;i<r.length;i++){let o=r[i];try{if(o.getAttribute("data-fp-omit")!==null)continue;o._flatpickr!==void 0&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=fQe(o,e||{}),n.push(o._flatpickr)}catch(a){console.error(a)}}return n.length===1?n[0]:n}var cQe,li,poe,goe=se(()=>{Xq();Qq();Jq();loe();doe();rF();hoe();cQe=300;typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(t){return pm(this,t)},HTMLElement.prototype.flatpickr=function(t){return pm([this],t)});li=function(t,e){return typeof t=="string"?pm(window.document.querySelectorAll(t),e):t instanceof Node?pm([t],e):pm(t,e)};li.defaultConfig={};li.l10ns={en:Object.assign({},eE),default:Object.assign({},eE)};li.localize=t=>{li.l10ns.default=Object.assign(Object.assign({},li.l10ns.default),t)};li.setDefaults=t=>{li.defaultConfig=Object.assign(Object.assign({},li.defaultConfig),t)};li.parseDate=rE({});li.formatDate=nF({});li.compareDates=la;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(t){return pm(this,t)});Date.prototype.fp_incr=function(t){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof t=="string"?parseInt(t,10):t))};typeof window<"u"&&(window.flatpickr=li);poe=li});function dQe(t){return new Date(new Date(t).getTime()+new Date(t).getTimezoneOffset()*60*1e3)}var x0,w0,moe=se(()=>{Pr();x0=Vr(soe());goe();w0=class extends Ct{get browserZone(){return x0.DateTime.local().zoneName}get initialValue(){return this.isOnShow||this.isOnIndex?this.context.element.innerText:this.isOnEdit?this.inputTarget.value:null}get isOnIndex(){return this.viewValue==="index"}get isOnEdit(){return this.viewValue==="edit"}get isOnShow(){return this.viewValue==="show"}get parsedValue(){return x0.DateTime.fromISO(this.initialValue,{zone:"UTC"})}get displayTimezone(){return this.timezoneValue||this.browserZone}connect(){this.isOnShow||this.isOnIndex?this.initShow():this.isOnEdit&&this.initEdit()}initShow(){this.context.element.innerText=this.parsedValue.setZone(this.displayTimezone).toFormat(this.formatValue)}initEdit(){let t={enableTime:!1,enableSeconds:!1,time_24hr:this.time24HrValue,locale:{firstDayOfWeek:0},altInput:!0,onChange:this.onChange.bind(this)};t.altFormat=this.pickerFormatValue,t.disableMobile=this.disableMobileValue,t.locale.firstDayOfWeek=this.firstDayOfWeekValue,t.enableTime=this.enableTimeValue,t.enableSeconds=this.enableTimeValue,this.enableTimeValue?(t.defaultDate=this.parsedValue.setZone(this.displayTimezone).toISO(),t.dateFormat="Y-m-d H:i:S"):t.defaultDate=dQe(this.initialValue),poe(this.fakeInputTarget,t),this.updateRealInput(this.parsedValue.setZone(this.displayTimezone).toISO())}onChange(t){let e,r={};this.timezoneValue?r={keepLocalTime:!0}:r={keepLocalTime:!1},this.enableTimeValue?e=x0.DateTime.fromISO(t[0].toISOString()).setZone("UTC",r):e=x0.DateTime.fromISO(t[0].toISOString()).setZone("UTC",{keepLocalTime:!0}),this.updateRealInput(e)}updateRealInput(t){this.inputTarget.value=t}};_t(w0,"targets",["input","fakeInput"]),_t(w0,"values",{view:String,timezone:String,format:String,enableTime:Boolean,pickerFormat:String,firstDayOfWeek:Number,time24Hr:Boolean,disableMobile:Boolean})});var iE,voe=se(()=>{Pr();iE=class extends Ct{showContent(t){this.contentTarget.classList.toggle("hidden"),t.target.classList.add("hidden")}};_t(iE,"targets",["content"])});var oE,yoe=se(()=>{Pr();oE=class extends Ct{connect(){this.resourceName=this.element.dataset.resourceName}toggle(t){let e=!!t.target.checked;document.querySelectorAll(`[data-controller="item-selector"][data-resource-name="${this.resourceName}"] input[type=checkbox]`).forEach(r=>r.checked!=e&&r.click())}update(){let t=!0;this.itemCheckboxTargets.forEach(e=>t=t&&e.checked),this.checkboxTarget.checked=t}};_t(oE,"targets",["itemCheckbox","checkbox"])});var aE,boe=se(()=>{Pr();aE=class extends Ct{constructor(){super(...arguments);_t(this,"checkbox",{});_t(this,"enabledClasses",["text-black","hover:bg-blue-500","hover:text-white"]);_t(this,"disabledClasses",["text-gray-500"])}get actionsPanelPresent(){return this.actionsButtonElement!==null}get currentIds(){try{return JSON.parse(this.stateHolderElement.dataset.selectedResources)}catch(t){return[]}}get actionLinks(){return document.querySelectorAll('.js-actions-dropdown a[data-actions-picker-target="resourceAction"]')}set currentIds(t){this.stateHolderElement.dataset.selectedResources=JSON.stringify(t),this.actionsPanelPresent&&(t.length>0?this.enableResourceActions():this.disableResourceActions())}connect(){this.resourceName=this.element.dataset.resourceName,this.resourceId=this.element.dataset.resourceId,this.actionsButtonElement=document.querySelector(`[data-actions-dropdown-button="${this.resourceName}"]`),this.stateHolderElement=document.querySelector(`[data-selected-resources-name="${this.resourceName}"]`)}addToSelected(){let t=this.currentIds;t.push(this.resourceId),this.currentIds=t}removeFromSelected(){this.currentIds=this.currentIds.filter(t=>t.toString()!==this.resourceId)}toggle(t){this.checkbox=t.target,this.checkbox.checked?this.addToSelected():this.removeFromSelected()}enableResourceActions(){this.actionLinks.forEach(t=>{t.classList.add(...this.enabledClasses),t.classList.remove(...this.disabledClasses),t.setAttribute("data-href",t.getAttribute("href")),t.dataset.disabled=!1})}disableResourceActions(){this.actionLinks.forEach(t=>{t.classList.remove(...this.enabledClasses),t.classList.add(...this.disabledClasses),t.setAttribute("href",t.getAttribute("data-href")),t.dataset.disabled=!0})}};_t(aE,"targets",["panel"])});var sE,xoe=se(()=>{Pr();Qg();sE=class extends Ct{constructor(){super(...arguments);_t(this,"fieldValue",[]);_t(this,"options",{})}get keyInputDisabled(){return!this.options.editable||this.options.disable_editing_keys}get valueInputDisabled(){return!this.options.editable}connect(){this.setOptions();try{let t=JSON.parse(this.inputTarget.value);Object.keys(t).forEach(e=>this.fieldValue.push([e,t[e]]))}catch(t){this.fieldValue=[]}this.updateKeyValueComponent()}addRow(){this.options.disable_adding_rows||!this.options.editable||(this.fieldValue.push(["",""]),this.updateKeyValueComponent(),this.focusLastRow())}deleteRow(t){if(this.options.disable_deleting_rows||!this.options.editable)return;let{index:e}=t.params;this.fieldValue.splice(e,1),this.updateTextareaInput(),this.updateKeyValueComponent()}focusLastRow(){return this.rowsTarget.querySelector(".flex.key-value-row:last-child .key-value-input-key").focus()}valueFieldUpdated(t){let{value:e}=t.target,{index:r}=t.target.dataset;this.fieldValue[r][1]=e,this.updateTextareaInput()}keyFieldUpdated(t){let{value:e}=t.target,{index:r}=t.target.dataset;this.fieldValue[r][0]=e,this.updateTextareaInput()}updateTextareaInput(){if(!this.hasInputTarget)return;let t={};this.fieldValue&&this.fieldValue.length>0&&(t=Object.assign(...this.fieldValue.map(([e,r])=>({[e]:r})))),this.inputTarget.innerText=JSON.stringify(t),this.inputTarget.dispatchEvent(new Event("input"))}updateKeyValueComponent(){let t="",e=0;this.fieldValue.forEach(r=>{let[n,i]=r;t+=this.interpolatedRow(n,i,e),e++}),this.rowsTarget.innerHTML=t,window.initTippy()}interpolatedRow(t,e,r){let n=`<div class="flex key-value-row">
72
+ `}function oe(){r.calendarContainer.classList.add("hasWeeks");let le=jr("div","flatpickr-weekwrapper");le.appendChild(jr("span","flatpickr-weekday",r.l10n.weekAbbreviation));let de=jr("div","flatpickr-weeks");return le.appendChild(de),{weekWrapper:le,weekNumbers:de}}function G(le,de=!0){let Ae=de?le:le-r.currentMonth;Ae<0&&r._hidePrevMonthArrow===!0||Ae>0&&r._hideNextMonthArrow===!0||(r.currentMonth+=Ae,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,er("onYearChange"),S()),V(),er("onMonthChange"),Zt())}function K(le=!0,de=!0){if(r.input.value="",r.altInput!==void 0&&(r.altInput.value=""),r.mobileInput!==void 0&&(r.mobileInput.value=""),r.selectedDates=[],r.latestSelectedDateObj=void 0,de===!0&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth()),r.config.enableTime===!0){let{hours:Ae,minutes:He,seconds:lt}=nE(r.config);g(Ae,He,lt)}r.redraw(),le&&er("onChange")}function ve(){r.isOpen=!1,r.isMobile||(r.calendarContainer!==void 0&&r.calendarContainer.classList.remove("open"),r._input!==void 0&&r._input.classList.remove("active")),er("onClose")}function Se(){r.config!==void 0&&er("onDestroy");for(let le=r._handlers.length;le--;)r._handlers[le].remove();if(r._handlers=[],r.mobileInput)r.mobileInput.parentNode&&r.mobileInput.parentNode.removeChild(r.mobileInput),r.mobileInput=void 0;else if(r.calendarContainer&&r.calendarContainer.parentNode)if(r.config.static&&r.calendarContainer.parentNode){let le=r.calendarContainer.parentNode;if(le.lastChild&&le.removeChild(le.lastChild),le.parentNode){for(;le.firstChild;)le.parentNode.insertBefore(le.firstChild,le);le.parentNode.removeChild(le)}}else r.calendarContainer.parentNode.removeChild(r.calendarContainer);r.altInput&&(r.input.type="text",r.altInput.parentNode&&r.altInput.parentNode.removeChild(r.altInput),delete r.altInput),r.input&&(r.input.type=r.input._type,r.input.classList.remove("flatpickr-input"),r.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(le=>{try{delete r[le]}catch{}})}function _e(le){return r.config.appendTo&&r.config.appendTo.contains(le)?!0:r.calendarContainer.contains(le)}function Ne(le){if(r.isOpen&&!r.config.inline){let de=sa(le),Ae=_e(de),He=de===r.input||de===r.altInput||r.element.contains(de)||le.path&&le.path.indexOf&&(~le.path.indexOf(r.input)||~le.path.indexOf(r.altInput)),lt=le.type==="blur"?He&&le.relatedTarget&&!_e(le.relatedTarget):!He&&!Ae&&!_e(le.relatedTarget),Qe=!r.config.ignoredFocusElements.some(Dt=>Dt.contains(de));lt&&Qe&&(r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0&&r.input.value!==""&&r.input.value!==void 0&&s(),r.close(),r.config&&r.config.mode==="range"&&r.selectedDates.length===1&&(r.clear(!1),r.redraw()))}}function Le(le){if(!le||r.config.minDate&&le<r.config.minDate.getFullYear()||r.config.maxDate&&le>r.config.maxDate.getFullYear())return;let de=le,Ae=r.currentYear!==de;r.currentYear=de||r.currentYear,r.config.maxDate&&r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth=Math.min(r.config.maxDate.getMonth(),r.currentMonth):r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&(r.currentMonth=Math.max(r.config.minDate.getMonth(),r.currentMonth)),Ae&&(r.redraw(),er("onYearChange"),S())}function it(le,de=!0){var Ae;let He=r.parseDate(le,void 0,de);if(r.config.minDate&&He&&la(He,r.config.minDate,de!==void 0?de:!r.minDateHasTime)<0||r.config.maxDate&&He&&la(He,r.config.maxDate,de!==void 0?de:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&r.config.disable.length===0)return!0;if(He===void 0)return!1;let lt=!!r.config.enable,Qe=(Ae=r.config.enable)!==null&&Ae!==void 0?Ae:r.config.disable;for(let Dt=0,wt;Dt<Qe.length;Dt++){if(wt=Qe[Dt],typeof wt=="function"&&wt(He))return lt;if(wt instanceof Date&&He!==void 0&&wt.getTime()===He.getTime())return lt;if(typeof wt=="string"){let Xt=r.parseDate(wt,void 0,!0);return Xt&&Xt.getTime()===He.getTime()?lt:!lt}else if(typeof wt=="object"&&He!==void 0&&wt.from&&wt.to&&He.getTime()>=wt.from.getTime()&&He.getTime()<=wt.to.getTime())return lt}return!lt}function ze(le){return r.daysContainer!==void 0?le.className.indexOf("hidden")===-1&&le.className.indexOf("flatpickr-disabled")===-1&&r.daysContainer.contains(le):!1}function tt(le){le.target===r._input&&(r.selectedDates.length>0||r._input.value.length>0)&&!(le.relatedTarget&&_e(le.relatedTarget))&&r.setDate(r._input.value,!0,le.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function xt(le){let de=sa(le),Ae=r.config.wrap?t.contains(de):de===r._input,He=r.config.allowInput,lt=r.isOpen&&(!He||!Ae),Qe=r.config.inline&&Ae&&!He;if(le.keyCode===13&&Ae){if(He)return r.setDate(r._input.value,!0,de===r.altInput?r.config.altFormat:r.config.dateFormat),de.blur();r.open()}else if(_e(de)||lt||Qe){let Dt=!!r.timeContainer&&r.timeContainer.contains(de);switch(le.keyCode){case 13:Dt?(le.preventDefault(),s(),Fe()):It(le);break;case 27:le.preventDefault(),Fe();break;case 8:case 46:Ae&&!r.config.allowInput&&(le.preventDefault(),r.clear());break;case 37:case 39:if(!Dt&&!Ae){if(le.preventDefault(),r.daysContainer!==void 0&&(He===!1||document.activeElement&&ze(document.activeElement))){let Xt=le.keyCode===39?1:-1;le.ctrlKey?(le.stopPropagation(),G(Xt),F(C(1),0)):F(void 0,Xt)}}else r.hourElement&&r.hourElement.focus();break;case 38:case 40:le.preventDefault();let wt=le.keyCode===40?1:-1;r.daysContainer&&de.$i!==void 0||de===r.input||de===r.altInput?le.ctrlKey?(le.stopPropagation(),Le(r.currentYear-wt),F(C(1),0)):Dt||F(void 0,wt*7):de===r.currentYearElement?Le(r.currentYear-wt):r.config.enableTime&&(!Dt&&r.hourElement&&r.hourElement.focus(),s(le),r._debouncedChange());break;case 9:if(Dt){let Xt=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter(dr=>dr),Yt=Xt.indexOf(de);if(Yt!==-1){let dr=Xt[Yt+(le.shiftKey?-1:1)];le.preventDefault(),(dr||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(de)&&le.shiftKey&&(le.preventDefault(),r._input.focus());break;default:break}}if(r.amPM!==void 0&&de===r.amPM)switch(le.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],f(),tr();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],f(),tr();break}(Ae||_e(de))&&er("onKeyDown",le)}function At(le){if(r.selectedDates.length!==1||le&&(!le.classList.contains("flatpickr-day")||le.classList.contains("flatpickr-disabled")))return;let de=le?le.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),Ae=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),He=Math.min(de,r.selectedDates[0].getTime()),lt=Math.max(de,r.selectedDates[0].getTime()),Qe=!1,Dt=0,wt=0;for(let Xt=He;Xt<lt;Xt+=foe.DAY)it(new Date(Xt),!0)||(Qe=Qe||Xt>He&&Xt<lt,Xt<Ae&&(!Dt||Xt>Dt)?Dt=Xt:Xt>Ae&&(!wt||Xt<wt)&&(wt=Xt));for(let Xt=0;Xt<r.config.showMonths;Xt++){let Yt=r.daysContainer.children[Xt];for(let dr=0,sn=Yt.children.length;dr<sn;dr++){let zr=Yt.children[dr],Hr=zr.dateObj.getTime(),Zn=Dt>0&&Hr<Dt||wt>0&&Hr>wt;if(Zn){zr.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(Wi=>{zr.classList.remove(Wi)});continue}else if(Qe&&!Zn)continue;["startRange","inRange","endRange","notAllowed"].forEach(Wi=>{zr.classList.remove(Wi)}),le!==void 0&&(le.classList.add(de<=r.selectedDates[0].getTime()?"startRange":"endRange"),Ae<de&&Hr===Ae?zr.classList.add("startRange"):Ae>de&&Hr===Ae&&zr.classList.add("endRange"),Hr>=Dt&&(wt===0||Hr<=wt)&&coe(Hr,Ae,de)&&zr.classList.add("inRange"))}}}function Ve(){r.isOpen&&!r.config.static&&!r.config.inline&&fe()}function Oe(le,de=r._positionElement){if(r.isMobile===!0){if(le){le.preventDefault();let He=sa(le);He&&He.blur()}r.mobileInput!==void 0&&(r.mobileInput.focus(),r.mobileInput.click()),er("onOpen");return}else if(r._input.disabled||r.config.inline)return;let Ae=r.isOpen;r.isOpen=!0,Ae||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),er("onOpen"),fe(de)),r.config.enableTime===!0&&r.config.noCalendar===!0&&r.config.allowInput===!1&&(le===void 0||!r.timeContainer.contains(le.relatedTarget))&&setTimeout(()=>r.hourElement.select(),50)}function Me(le){return de=>{let Ae=r.config[`_${le}Date`]=r.parseDate(de,r.config.dateFormat),He=r.config[`_${le==="min"?"max":"min"}Date`];Ae!==void 0&&(r[le==="min"?"minDateHasTime":"maxDateHasTime"]=Ae.getHours()>0||Ae.getMinutes()>0||Ae.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter(lt=>it(lt)),!r.selectedDates.length&&le==="min"&&p(Ae),tr()),r.daysContainer&&($e(),Ae!==void 0?r.currentYearElement[le]=Ae.getFullYear().toString():r.currentYearElement.removeAttribute(le),r.currentYearElement.disabled=!!He&&Ae!==void 0&&He.getFullYear()===Ae.getFullYear())}}function he(){let le=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],de=Object.assign(Object.assign({},JSON.parse(JSON.stringify(t.dataset||{}))),e),Ae={};r.config.parseDate=de.parseDate,r.config.formatDate=de.formatDate,Object.defineProperty(r.config,"enable",{get:()=>r.config._enable,set:Qe=>{r.config._enable=xe(Qe)}}),Object.defineProperty(r.config,"disable",{get:()=>r.config._disable,set:Qe=>{r.config._disable=xe(Qe)}});let He=de.mode==="time";if(!de.dateFormat&&(de.enableTime||He)){let Qe=li.defaultConfig.dateFormat||Df.dateFormat;Ae.dateFormat=de.noCalendar||He?"H:i"+(de.enableSeconds?":S":""):Qe+" H:i"+(de.enableSeconds?":S":"")}if(de.altInput&&(de.enableTime||He)&&!de.altFormat){let Qe=li.defaultConfig.altFormat||Df.altFormat;Ae.altFormat=de.noCalendar||He?"h:i"+(de.enableSeconds?":S K":" K"):Qe+` h:i${de.enableSeconds?":S":""} K`}Object.defineProperty(r.config,"minDate",{get:()=>r.config._minDate,set:Me("min")}),Object.defineProperty(r.config,"maxDate",{get:()=>r.config._maxDate,set:Me("max")});let lt=Qe=>Dt=>{r.config[Qe==="min"?"_minTime":"_maxTime"]=r.parseDate(Dt,"H:i:S")};Object.defineProperty(r.config,"minTime",{get:()=>r.config._minTime,set:lt("min")}),Object.defineProperty(r.config,"maxTime",{get:()=>r.config._maxTime,set:lt("max")}),de.mode==="time"&&(r.config.noCalendar=!0,r.config.enableTime=!0),Object.assign(r.config,Ae,de);for(let Qe=0;Qe<le.length;Qe++)r.config[le[Qe]]=r.config[le[Qe]]===!0||r.config[le[Qe]]==="true";Z1.filter(Qe=>r.config[Qe]!==void 0).forEach(Qe=>{r.config[Qe]=tE(r.config[Qe]||[]).map(o)}),r.isMobile=!r.config.disableMobile&&!r.config.inline&&r.config.mode==="single"&&!r.config.disable.length&&!r.config.enable&&!r.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(let Qe=0;Qe<r.config.plugins.length;Qe++){let Dt=r.config.plugins[Qe](r)||{};for(let wt in Dt)Z1.indexOf(wt)>-1?r.config[wt]=tE(Dt[wt]).map(o).concat(r.config[wt]):typeof de[wt]>"u"&&(r.config[wt]=Dt[wt])}de.altInputClass||(r.config.altInputClass=J().className+" "+r.config.altInputClass),er("onParseConfig")}function J(){return r.config.wrap?t.querySelector("[data-input]"):t}function re(){typeof r.config.locale!="object"&&typeof li.l10ns[r.config.locale]>"u"&&r.config.errorHandler(new Error(`flatpickr: invalid locale ${r.config.locale}`)),r.l10n=Object.assign(Object.assign({},li.l10ns.default),typeof r.config.locale=="object"?r.config.locale:r.config.locale!=="default"?li.l10ns[r.config.locale]:void 0),b0.K=`(${r.l10n.amPM[0]}|${r.l10n.amPM[1]}|${r.l10n.amPM[0].toLowerCase()}|${r.l10n.amPM[1].toLowerCase()})`,Object.assign(Object.assign({},e),JSON.parse(JSON.stringify(t.dataset||{}))).time_24hr===void 0&&li.defaultConfig.time_24hr===void 0&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=nF(r),r.parseDate=rE({config:r.config,l10n:r.l10n})}function fe(le){if(typeof r.config.position=="function")return void r.config.position(r,le);if(r.calendarContainer===void 0)return;er("onPreCalendarPosition");let de=le||r._positionElement,Ae=Array.prototype.reduce.call(r.calendarContainer.children,(ki,ln)=>ki+ln.offsetHeight,0),He=r.calendarContainer.offsetWidth,lt=r.config.position.split(" "),Qe=lt[0],Dt=lt.length>1?lt[1]:null,wt=de.getBoundingClientRect(),Xt=window.innerHeight-wt.bottom,Yt=Qe==="above"||Qe!=="below"&&Xt<Ae&&wt.top>Ae,dr=window.pageYOffset+wt.top+(Yt?-Ae-2:de.offsetHeight+2);if(ho(r.calendarContainer,"arrowTop",!Yt),ho(r.calendarContainer,"arrowBottom",Yt),r.config.inline)return;let sn=window.pageXOffset+wt.left,zr=!1,go=!1;Dt==="center"?(sn-=(He-wt.width)/2,zr=!0):Dt==="right"&&(sn-=He-wt.width,go=!0),ho(r.calendarContainer,"arrowLeft",!zr&&!go),ho(r.calendarContainer,"arrowCenter",zr),ho(r.calendarContainer,"arrowRight",go);let Hr=window.document.body.offsetWidth-(window.pageXOffset+wt.right),Zn=sn+He>window.document.body.offsetWidth,Wi=Hr+He>window.document.body.offsetWidth;if(ho(r.calendarContainer,"rightMost",Zn),!r.config.static)if(r.calendarContainer.style.top=`${dr}px`,!Zn)r.calendarContainer.style.left=`${sn}px`,r.calendarContainer.style.right="auto";else if(!Wi)r.calendarContainer.style.left="auto",r.calendarContainer.style.right=`${Hr}px`;else{let ki=ht();if(ki===void 0)return;let ln=window.document.body.offsetWidth,Po=Math.max(0,ln/2-He/2),Ei=".flatpickr-calendar.centerMost:before",Ws=".flatpickr-calendar.centerMost:after",mo=ki.cssRules.length,Ro=`{left:${wt.left}px;right:auto;}`;ho(r.calendarContainer,"rightMost",!1),ho(r.calendarContainer,"centerMost",!0),ki.insertRule(`${Ei},${Ws}${Ro}`,mo),r.calendarContainer.style.left=`${Po}px`,r.calendarContainer.style.right="auto"}}function ht(){let le=null;for(let de=0;de<document.styleSheets.length;de++){let Ae=document.styleSheets[de];try{Ae.cssRules}catch{continue}le=Ae;break}return le??ke()}function ke(){let le=document.createElement("style");return document.head.appendChild(le),le.sheet}function $e(){r.config.noCalendar||r.isMobile||(S(),Zt(),V())}function Fe(){r._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(r.close,0):r.close()}function It(le){le.preventDefault(),le.stopPropagation();let de=Dt=>Dt.classList&&Dt.classList.contains("flatpickr-day")&&!Dt.classList.contains("flatpickr-disabled")&&!Dt.classList.contains("notAllowed"),Ae=eF(sa(le),de);if(Ae===void 0)return;let He=Ae,lt=r.latestSelectedDateObj=new Date(He.dateObj.getTime()),Qe=(lt.getMonth()<r.currentMonth||lt.getMonth()>r.currentMonth+r.config.showMonths-1)&&r.config.mode!=="range";if(r.selectedDateElem=He,r.config.mode==="single")r.selectedDates=[lt];else if(r.config.mode==="multiple"){let Dt=Ze(lt);Dt?r.selectedDates.splice(parseInt(Dt),1):r.selectedDates.push(lt)}else r.config.mode==="range"&&(r.selectedDates.length===2&&r.clear(!1,!1),r.latestSelectedDateObj=lt,r.selectedDates.push(lt),la(lt,r.selectedDates[0],!0)!==0&&r.selectedDates.sort((Dt,wt)=>Dt.getTime()-wt.getTime()));if(f(),Qe){let Dt=r.currentYear!==lt.getFullYear();r.currentYear=lt.getFullYear(),r.currentMonth=lt.getMonth(),Dt&&(er("onYearChange"),S()),er("onMonthChange")}if(Zt(),V(),tr(),!Qe&&r.config.mode!=="range"&&r.config.showMonths===1?_(He):r.selectedDateElem!==void 0&&r.hourElement===void 0&&r.selectedDateElem&&r.selectedDateElem.focus(),r.hourElement!==void 0&&r.hourElement!==void 0&&r.hourElement.focus(),r.config.closeOnSelect){let Dt=r.config.mode==="single"&&!r.config.enableTime,wt=r.config.mode==="range"&&r.selectedDates.length===2&&!r.config.enableTime;(Dt||wt)&&Fe()}w()}let ut={locale:[re,X],showMonths:[q,a,z],minDate:[k],maxDate:[k],clickOpens:[()=>{r.config.clickOpens===!0?(x(r._input,"focus",r.open),x(r._input,"click",r.open)):(r._input.removeEventListener("focus",r.open),r._input.removeEventListener("click",r.open))}]};function pt(le,de){if(le!==null&&typeof le=="object"){Object.assign(r.config,le);for(let Ae in le)ut[Ae]!==void 0&&ut[Ae].forEach(He=>He())}else r.config[le]=de,ut[le]!==void 0?ut[le].forEach(Ae=>Ae()):Z1.indexOf(le)>-1&&(r.config[le]=tE(de));r.redraw(),tr(!0)}function st(le,de){let Ae=[];if(le instanceof Array)Ae=le.map(He=>r.parseDate(He,de));else if(le instanceof Date||typeof le=="number")Ae=[r.parseDate(le,de)];else if(typeof le=="string")switch(r.config.mode){case"single":case"time":Ae=[r.parseDate(le,de)];break;case"multiple":Ae=le.split(r.config.conjunction).map(He=>r.parseDate(He,de));break;case"range":Ae=le.split(r.l10n.rangeSeparator).map(He=>r.parseDate(He,de));break;default:break}else r.config.errorHandler(new Error(`Invalid date supplied: ${JSON.stringify(le)}`));r.selectedDates=r.config.allowInvalidPreload?Ae:Ae.filter(He=>He instanceof Date&&it(He,!1)),r.config.mode==="range"&&r.selectedDates.sort((He,lt)=>He.getTime()-lt.getTime())}function ye(le,de=!1,Ae=r.config.dateFormat){if(le!==0&&!le||le instanceof Array&&le.length===0)return r.clear(de);st(le,Ae),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),k(void 0,de),p(),r.selectedDates.length===0&&r.clear(!1),tr(de),de&&er("onChange")}function xe(le){return le.slice().map(de=>typeof de=="string"||typeof de=="number"||de instanceof Date?r.parseDate(de,void 0,!0):de&&typeof de=="object"&&de.from&&de.to?{from:r.parseDate(de.from,void 0),to:r.parseDate(de.to,void 0)}:de).filter(de=>de)}function We(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;let le=r.config.defaultDate||((r.input.nodeName==="INPUT"||r.input.nodeName==="TEXTAREA")&&r.input.placeholder&&r.input.value===r.input.placeholder?null:r.input.value);le&&st(le,r.config.dateFormat),r._initialDate=r.selectedDates.length>0?r.selectedDates[0]:r.config.minDate&&r.config.minDate.getTime()>r.now.getTime()?r.config.minDate:r.config.maxDate&&r.config.maxDate.getTime()<r.now.getTime()?r.config.maxDate:r.now,r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth(),r.selectedDates.length>0&&(r.latestSelectedDateObj=r.selectedDates[0]),r.config.minTime!==void 0&&(r.config.minTime=r.parseDate(r.config.minTime,"H:i")),r.config.maxTime!==void 0&&(r.config.maxTime=r.parseDate(r.config.maxTime,"H:i")),r.minDateHasTime=!!r.config.minDate&&(r.config.minDate.getHours()>0||r.config.minDate.getMinutes()>0||r.config.minDate.getSeconds()>0),r.maxDateHasTime=!!r.config.maxDate&&(r.config.maxDate.getHours()>0||r.config.maxDate.getMinutes()>0||r.config.maxDate.getSeconds()>0)}function yt(){if(r.input=J(),!r.input){r.config.errorHandler(new Error("Invalid input element specified"));return}r.input._type=r.input.type,r.input.type="text",r.input.classList.add("flatpickr-input"),r._input=r.input,r.config.altInput&&(r.altInput=jr(r.input.nodeName,r.config.altInputClass),r._input=r.altInput,r.altInput.placeholder=r.input.placeholder,r.altInput.disabled=r.input.disabled,r.altInput.required=r.input.required,r.altInput.tabIndex=r.input.tabIndex,r.altInput.type="text",r.input.setAttribute("type","hidden"),!r.config.static&&r.input.parentNode&&r.input.parentNode.insertBefore(r.altInput,r.input.nextSibling)),r.config.allowInput||r._input.setAttribute("readonly","readonly"),r._positionElement=r.config.positionElement||r._input}function Gr(){let le=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=jr("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=le,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr=le==="datetime-local"?"Y-m-d\\TH:i:S":le==="date"?"Y-m-d":"H:i:S",r.selectedDates.length>0&&(r.mobileInput.defaultValue=r.mobileInput.value=r.formatDate(r.selectedDates[0],r.mobileFormatStr)),r.config.minDate&&(r.mobileInput.min=r.formatDate(r.config.minDate,"Y-m-d")),r.config.maxDate&&(r.mobileInput.max=r.formatDate(r.config.maxDate,"Y-m-d")),r.input.getAttribute("step")&&(r.mobileInput.step=String(r.input.getAttribute("step"))),r.input.type="hidden",r.altInput!==void 0&&(r.altInput.type="hidden");try{r.input.parentNode&&r.input.parentNode.insertBefore(r.mobileInput,r.input.nextSibling)}catch{}x(r.mobileInput,"change",de=>{r.setDate(sa(de).value,!1,r.mobileFormatStr),er("onChange"),er("onClose")})}function mt(le){if(r.isOpen===!0)return r.close();r.open(le)}function er(le,de){if(r.config===void 0)return;let Ae=r.config[le];if(Ae!==void 0&&Ae.length>0)for(let He=0;Ae[He]&&He<Ae.length;He++)Ae[He](r.selectedDates,r.input.value,r,de);le==="onChange"&&(r.input.dispatchEvent(Ie("change")),r.input.dispatchEvent(Ie("input")))}function Ie(le){let de=document.createEvent("Event");return de.initEvent(le,!0,!0),de}function Ze(le){for(let de=0;de<r.selectedDates.length;de++)if(la(r.selectedDates[de],le)===0)return""+de;return!1}function dt(le){return r.config.mode!=="range"||r.selectedDates.length<2?!1:la(le,r.selectedDates[0])>=0&&la(le,r.selectedDates[1])<=0}function Zt(){r.config.noCalendar||r.isMobile||!r.monthNav||(r.yearElements.forEach((le,de)=>{let Ae=new Date(r.currentYear,r.currentMonth,1);Ae.setMonth(r.currentMonth+de),r.config.showMonths>1||r.config.monthSelectorType==="static"?r.monthElements[de].textContent=y0(Ae.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=Ae.getMonth().toString(),le.value=Ae.getFullYear().toString()}),r._hidePrevMonthArrow=r.config.minDate!==void 0&&(r.currentYear===r.config.minDate.getFullYear()?r.currentMonth<=r.config.minDate.getMonth():r.currentYear<r.config.minDate.getFullYear()),r._hideNextMonthArrow=r.config.maxDate!==void 0&&(r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth+1>r.config.maxDate.getMonth():r.currentYear>r.config.maxDate.getFullYear()))}function jt(le){return r.selectedDates.map(de=>r.formatDate(de,le)).filter((de,Ae,He)=>r.config.mode!=="range"||r.config.enableTime||He.indexOf(de)===Ae).join(r.config.mode!=="range"?r.config.conjunction:r.l10n.rangeSeparator)}function tr(le=!0){r.mobileInput!==void 0&&r.mobileFormatStr&&(r.mobileInput.value=r.latestSelectedDateObj!==void 0?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=jt(r.config.dateFormat),r.altInput!==void 0&&(r.altInput.value=jt(r.config.altFormat)),le!==!1&&er("onValueUpdate")}function sr(le){let de=sa(le),Ae=r.prevMonthNav.contains(de),He=r.nextMonthNav.contains(de);Ae||He?G(Ae?-1:1):r.yearElements.indexOf(de)>=0?de.select():de.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):de.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}function zn(le){le.preventDefault();let de=le.type==="keydown",Ae=sa(le),He=Ae;r.amPM!==void 0&&Ae===r.amPM&&(r.amPM.textContent=r.l10n.amPM[aa(r.amPM.textContent===r.l10n.amPM[0])]);let lt=parseFloat(He.getAttribute("min")),Qe=parseFloat(He.getAttribute("max")),Dt=parseFloat(He.getAttribute("step")),wt=parseInt(He.value,10),Xt=le.delta||(de?le.which===38?1:-1:0),Yt=wt+Dt*Xt;if(typeof He.value<"u"&&He.value.length===2){let dr=He===r.hourElement,sn=He===r.minuteElement;Yt<lt?(Yt=Qe+Yt+aa(!dr)+(aa(dr)&&aa(!r.amPM)),sn&&D(void 0,-1,r.hourElement)):Yt>Qe&&(Yt=He===r.hourElement?Yt-Qe-aa(!r.amPM):lt,sn&&D(void 0,1,r.hourElement)),r.amPM&&dr&&(Dt===1?Yt+wt===23:Math.abs(Yt-wt)>Dt)&&(r.amPM.textContent=r.l10n.amPM[aa(r.amPM.textContent===r.l10n.amPM[0])]),He.value=fo(Yt)}}return i(),r}function pm(t,e){let r=Array.prototype.slice.call(t).filter(i=>i instanceof HTMLElement),n=[];for(let i=0;i<r.length;i++){let o=r[i];try{if(o.getAttribute("data-fp-omit")!==null)continue;o._flatpickr!==void 0&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=fQe(o,e||{}),n.push(o._flatpickr)}catch(a){console.error(a)}}return n.length===1?n[0]:n}var cQe,li,poe,goe=se(()=>{Xq();Qq();Jq();loe();doe();rF();hoe();cQe=300;typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(t){return pm(this,t)},HTMLElement.prototype.flatpickr=function(t){return pm([this],t)});li=function(t,e){return typeof t=="string"?pm(window.document.querySelectorAll(t),e):t instanceof Node?pm([t],e):pm(t,e)};li.defaultConfig={};li.l10ns={en:Object.assign({},eE),default:Object.assign({},eE)};li.localize=t=>{li.l10ns.default=Object.assign(Object.assign({},li.l10ns.default),t)};li.setDefaults=t=>{li.defaultConfig=Object.assign(Object.assign({},li.defaultConfig),t)};li.parseDate=rE({});li.formatDate=nF({});li.compareDates=la;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(t){return pm(this,t)});Date.prototype.fp_incr=function(t){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof t=="string"?parseInt(t,10):t))};typeof window<"u"&&(window.flatpickr=li);poe=li});function dQe(t){return new Date(new Date(t).getTime()+new Date(t).getTimezoneOffset()*60*1e3)}var x0,w0,moe=se(()=>{Pr();x0=Vr(soe());goe();w0=class extends Ct{get browserZone(){return x0.DateTime.local().zoneName}get initialValue(){return this.isOnShow||this.isOnIndex?this.context.element.innerText:this.isOnEdit?this.inputTarget.value:null}get isOnIndex(){return this.viewValue==="index"}get isOnEdit(){return this.viewValue==="edit"}get isOnShow(){return this.viewValue==="show"}get parsedValue(){return x0.DateTime.fromISO(this.initialValue,{zone:"UTC"})}get displayTimezone(){return this.timezoneValue||this.browserZone}connect(){this.isOnShow||this.isOnIndex?this.initShow():this.isOnEdit&&this.initEdit()}initShow(){let t=this.parsedValue;this.enableTimeValue&&(t=t.setZone(this.displayTimezone)),this.context.element.innerText=t.toFormat(this.formatValue)}initEdit(){let t={enableTime:!1,enableSeconds:!1,time_24hr:this.time24HrValue,locale:{firstDayOfWeek:0},altInput:!0,onChange:this.onChange.bind(this)};t.altFormat=this.pickerFormatValue,t.disableMobile=this.disableMobileValue,t.locale.firstDayOfWeek=this.firstDayOfWeekValue,t.enableTime=this.enableTimeValue,t.enableSeconds=this.enableTimeValue,this.enableTimeValue?(console.log(1),t.defaultDate=this.parsedValue.setZone(this.displayTimezone).toISO(),t.dateFormat="Y-m-d H:i:S"):(console.log(2),t.defaultDate=dQe(this.initialValue)),poe(this.fakeInputTarget,t),this.updateRealInput(this.parsedValue.setZone(this.displayTimezone).toISO())}onChange(t){let e,r={};this.timezoneValue?r={keepLocalTime:!0}:r={keepLocalTime:!1},this.enableTimeValue?e=x0.DateTime.fromISO(t[0].toISOString()).setZone("UTC",r):e=x0.DateTime.fromISO(t[0].toISOString()).setZone("UTC",{keepLocalTime:!0}),this.updateRealInput(e)}updateRealInput(t){this.inputTarget.value=t}};_t(w0,"targets",["input","fakeInput"]),_t(w0,"values",{view:String,timezone:String,format:String,enableTime:Boolean,pickerFormat:String,firstDayOfWeek:Number,time24Hr:Boolean,disableMobile:Boolean})});var iE,voe=se(()=>{Pr();iE=class extends Ct{showContent(t){this.contentTarget.classList.toggle("hidden"),t.target.classList.add("hidden")}};_t(iE,"targets",["content"])});var oE,yoe=se(()=>{Pr();oE=class extends Ct{connect(){this.resourceName=this.element.dataset.resourceName}toggle(t){let e=!!t.target.checked;document.querySelectorAll(`[data-controller="item-selector"][data-resource-name="${this.resourceName}"] input[type=checkbox]`).forEach(r=>r.checked!=e&&r.click())}update(){let t=!0;this.itemCheckboxTargets.forEach(e=>t=t&&e.checked),this.checkboxTarget.checked=t}};_t(oE,"targets",["itemCheckbox","checkbox"])});var aE,boe=se(()=>{Pr();aE=class extends Ct{constructor(){super(...arguments);_t(this,"checkbox",{});_t(this,"enabledClasses",["text-black","hover:bg-blue-500","hover:text-white"]);_t(this,"disabledClasses",["text-gray-500"])}get actionsPanelPresent(){return this.actionsButtonElement!==null}get currentIds(){try{return JSON.parse(this.stateHolderElement.dataset.selectedResources)}catch(t){return[]}}get actionLinks(){return document.querySelectorAll('.js-actions-dropdown a[data-actions-picker-target="resourceAction"]')}set currentIds(t){this.stateHolderElement.dataset.selectedResources=JSON.stringify(t),this.actionsPanelPresent&&(t.length>0?this.enableResourceActions():this.disableResourceActions())}connect(){this.resourceName=this.element.dataset.resourceName,this.resourceId=this.element.dataset.resourceId,this.actionsButtonElement=document.querySelector(`[data-actions-dropdown-button="${this.resourceName}"]`),this.stateHolderElement=document.querySelector(`[data-selected-resources-name="${this.resourceName}"]`)}addToSelected(){let t=this.currentIds;t.push(this.resourceId),this.currentIds=t}removeFromSelected(){this.currentIds=this.currentIds.filter(t=>t.toString()!==this.resourceId)}toggle(t){this.checkbox=t.target,this.checkbox.checked?this.addToSelected():this.removeFromSelected()}enableResourceActions(){this.actionLinks.forEach(t=>{t.classList.add(...this.enabledClasses),t.classList.remove(...this.disabledClasses),t.setAttribute("data-href",t.getAttribute("href")),t.dataset.disabled=!1})}disableResourceActions(){this.actionLinks.forEach(t=>{t.classList.remove(...this.enabledClasses),t.classList.add(...this.disabledClasses),t.setAttribute("href",t.getAttribute("data-href")),t.dataset.disabled=!0})}};_t(aE,"targets",["panel"])});var sE,xoe=se(()=>{Pr();Qg();sE=class extends Ct{constructor(){super(...arguments);_t(this,"fieldValue",[]);_t(this,"options",{})}get keyInputDisabled(){return!this.options.editable||this.options.disable_editing_keys}get valueInputDisabled(){return!this.options.editable}connect(){this.setOptions();try{let t=JSON.parse(this.inputTarget.value);Object.keys(t).forEach(e=>this.fieldValue.push([e,t[e]]))}catch(t){this.fieldValue=[]}this.updateKeyValueComponent()}addRow(){this.options.disable_adding_rows||!this.options.editable||(this.fieldValue.push(["",""]),this.updateKeyValueComponent(),this.focusLastRow())}deleteRow(t){if(this.options.disable_deleting_rows||!this.options.editable)return;let{index:e}=t.params;this.fieldValue.splice(e,1),this.updateTextareaInput(),this.updateKeyValueComponent()}focusLastRow(){return this.rowsTarget.querySelector(".flex.key-value-row:last-child .key-value-input-key").focus()}valueFieldUpdated(t){let{value:e}=t.target,{index:r}=t.target.dataset;this.fieldValue[r][1]=e,this.updateTextareaInput()}keyFieldUpdated(t){let{value:e}=t.target,{index:r}=t.target.dataset;this.fieldValue[r][0]=e,this.updateTextareaInput()}updateTextareaInput(){if(!this.hasInputTarget)return;let t={};this.fieldValue&&this.fieldValue.length>0&&(t=Object.assign(...this.fieldValue.map(([e,r])=>({[e]:r})))),this.inputTarget.innerText=JSON.stringify(t),this.inputTarget.dispatchEvent(new Event("input"))}updateKeyValueComponent(){let t="",e=0;this.fieldValue.forEach(r=>{let[n,i]=r;t+=this.interpolatedRow(n,i,e),e++}),this.rowsTarget.innerHTML=t,window.initTippy()}interpolatedRow(t,e,r){let n=`<div class="flex key-value-row">
73
73
  ${this.inputField("key",r,t,e)}
74
74
  ${this.inputField("value",r,t,e)}`;return this.options.editable&&(n+=`<a
75
75
  href="javascript:void(0);"