rails_pulse 0.4.0.pre.4 → 0.4.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +64 -87
  3. data/README.md +83 -111
  4. data/app/controllers/concerns/session_filters_concern.rb +4 -3
  5. data/app/controllers/concerns/time_range_concern.rb +29 -19
  6. data/app/controllers/rails_pulse/application_controller.rb +9 -5
  7. data/app/controllers/rails_pulse/dashboard_controller.rb +20 -11
  8. data/app/controllers/rails_pulse/routes_controller.rb +46 -0
  9. data/app/helpers/rails_pulse/application_helper.rb +4 -0
  10. data/app/javascript/rails_pulse/controllers/chart_controller.js +27 -0
  11. data/app/models/rails_pulse/cards/base.rb +61 -25
  12. data/app/models/rails_pulse/dashboard/charts/response_time_percentiles.rb +38 -15
  13. data/app/models/rails_pulse/dashboard/charts/throughput_and_errors.rb +36 -13
  14. data/app/models/rails_pulse/dashboard/concerns/time_range_helper.rb +3 -0
  15. data/app/models/rails_pulse/dashboard/health_summary.rb +3 -1
  16. data/app/models/rails_pulse/dashboard/needs_attention.rb +3 -1
  17. data/app/models/rails_pulse/dashboard/storage_status.rb +38 -68
  18. data/app/models/rails_pulse/exceptions/cards/exception_rate.rb +1 -5
  19. data/app/models/rails_pulse/exceptions/cards/open_groups.rb +4 -4
  20. data/app/models/rails_pulse/exceptions/cards/total_occurrences.rb +3 -4
  21. data/app/models/rails_pulse/jobs/cards/failure_rate.rb +7 -20
  22. data/app/models/rails_pulse/jobs/cards/p95_duration.rb +5 -8
  23. data/app/models/rails_pulse/jobs/cards/total_runs.rb +4 -4
  24. data/app/models/rails_pulse/queries/cards/average_query_times.rb +6 -9
  25. data/app/models/rails_pulse/queries/cards/database_load.rb +7 -10
  26. data/app/models/rails_pulse/queries/cards/execution_rate.rb +4 -6
  27. data/app/models/rails_pulse/queries/cards/percentile_query_times.rb +5 -8
  28. data/app/models/rails_pulse/route.rb +7 -1
  29. data/app/models/rails_pulse/routes/cards/error_rates.rb +5 -11
  30. data/app/models/rails_pulse/routes/cards/percentile_response_times.rb +3 -1
  31. data/app/models/rails_pulse/routes/cards/request_count_totals.rb +4 -6
  32. data/app/models/rails_pulse/summary.rb +13 -18
  33. data/app/models/rails_pulse/time_range_preference.rb +28 -0
  34. data/app/models/rails_pulse/time_window.rb +61 -0
  35. data/app/services/rails_pulse/summary_service.rb +112 -162
  36. data/app/services/rails_pulse/tag_filter_service.rb +10 -1
  37. data/app/views/layouts/rails_pulse/_time_range_selector.html.erb +2 -2
  38. data/app/views/rails_pulse/dashboard/index.html.erb +6 -3
  39. data/app/views/rails_pulse/routes/_archived_summary_table.html.erb +46 -0
  40. data/app/views/rails_pulse/routes/_archived_table_pagination.html.erb +28 -0
  41. data/app/views/rails_pulse/routes/show.html.erb +14 -2
  42. data/lib/generators/rails_pulse/install_generator.rb +5 -2
  43. data/lib/generators/rails_pulse/templates/rails_pulse.rb +7 -2
  44. data/lib/rails_pulse/cleanup_service.rb +7 -7
  45. data/lib/rails_pulse/configuration.rb +9 -1
  46. data/lib/rails_pulse/engine.rb +14 -42
  47. data/lib/rails_pulse/middleware/request_collector.rb +2 -17
  48. data/lib/rails_pulse/standalone.rb +12 -0
  49. data/lib/rails_pulse/subscribers/operation_subscriber.rb +45 -3
  50. data/lib/rails_pulse/tracker.rb +241 -25
  51. data/lib/rails_pulse/version.rb +1 -1
  52. data/lib/rails_pulse.rb +3 -16
  53. data/lib/rails_pulse_server.ru +37 -23
  54. data/public/rails-pulse-assets/rails-pulse.js +1 -1
  55. metadata +7 -9
  56. data/app/assets/images/rails_pulse/dashboard.png +0 -0
  57. data/app/assets/images/rails_pulse/query-show.png +0 -0
  58. data/app/assets/images/rails_pulse/request-show.png +0 -0
  59. data/app/assets/images/rails_pulse/request.png +0 -0
  60. data/app/assets/images/rails_pulse/route-show.png +0 -0
  61. data/lib/rails_pulse/extensions/active_record.rb +0 -124
@@ -25,7 +25,7 @@ yyyy`);var i=qt(t),n=e?"getUTC":"get",a=i[n+"FullYear"](),o=i[n+"Month"]()+1,s=i
25
25
  <span class='flatpickr-weekday'>
26
26
  `+D.join("</span><span class='flatpickr-weekday'>")+`
27
27
  </span>
28
- `}}function oe(){e.calendarContainer.classList.add("hasWeeks");var C=Fe("div","flatpickr-weekwrapper");C.appendChild(Fe("span","flatpickr-weekday",e.l10n.weekAbbreviation));var D=Fe("div","flatpickr-weeks");return C.appendChild(D),{weekWrapper:C,weekNumbers:D}}function ie(C,D){D===void 0&&(D=!0);var P=D?C:C-e.currentMonth;P<0&&e._hidePrevMonthArrow===!0||P>0&&e._hideNextMonthArrow===!0||(e.currentMonth+=P,(e.currentMonth<0||e.currentMonth>11)&&(e.currentYear+=e.currentMonth>11?1:-1,e.currentMonth=(e.currentMonth+12)%12,tt("onYearChange"),I()),L(),tt("onMonthChange"),vf())}function pe(C,D){if(C===void 0&&(C=!0),D===void 0&&(D=!0),e.input.value="",e.altInput!==void 0&&(e.altInput.value=""),e.mobileInput!==void 0&&(e.mobileInput.value=""),e.selectedDates=[],e.latestSelectedDateObj=void 0,D===!0&&(e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth()),e.config.enableTime===!0){var P=xv(e.config),R=P.hours,X=P.minutes,Q=P.seconds;p(R,X,Q)}e.redraw(),C&&tt("onChange")}function de(){e.isOpen=!1,e.isMobile||(e.calendarContainer!==void 0&&e.calendarContainer.classList.remove("open"),e._input!==void 0&&e._input.classList.remove("active")),tt("onClose")}function te(){e.config!==void 0&&tt("onDestroy");for(var C=e._handlers.length;C--;)e._handlers[C].remove();if(e._handlers=[],e.mobileInput)e.mobileInput.parentNode&&e.mobileInput.parentNode.removeChild(e.mobileInput),e.mobileInput=void 0;else if(e.calendarContainer&&e.calendarContainer.parentNode)if(e.config.static&&e.calendarContainer.parentNode){var D=e.calendarContainer.parentNode;if(D.lastChild&&D.removeChild(D.lastChild),D.parentNode){for(;D.firstChild;)D.parentNode.insertBefore(D.firstChild,D);D.parentNode.removeChild(D)}}else e.calendarContainer.parentNode.removeChild(e.calendarContainer);e.altInput&&(e.input.type="text",e.altInput.parentNode&&e.altInput.parentNode.removeChild(e.altInput),delete e.altInput),e.input&&(e.input.type=e.input._type,e.input.classList.remove("flatpickr-input"),e.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(function(P){try{delete e[P]}catch{}})}function Te(C){return e.calendarContainer.contains(C)}function Pe(C){if(e.isOpen&&!e.config.inline){var D=gr(C),P=Te(D),R=D===e.input||D===e.altInput||e.element.contains(D)||C.path&&C.path.indexOf&&(~C.path.indexOf(e.input)||~C.path.indexOf(e.altInput)),X=!R&&!P&&!Te(C.relatedTarget),Q=!e.config.ignoredFocusElements.some(function(Me){return Me.contains(D)});X&&Q&&(e.config.allowInput&&e.setDate(e._input.value,!1,e.config.altInput?e.config.altFormat:e.config.dateFormat),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0&&e.input.value!==""&&e.input.value!==void 0&&l(),e.close(),e.config&&e.config.mode==="range"&&e.selectedDates.length===1&&e.clear(!1))}}function vt(C){if(!(!C||e.config.minDate&&C<e.config.minDate.getFullYear()||e.config.maxDate&&C>e.config.maxDate.getFullYear())){var D=C,P=e.currentYear!==D;e.currentYear=D||e.currentYear,e.config.maxDate&&e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth=Math.min(e.config.maxDate.getMonth(),e.currentMonth):e.config.minDate&&e.currentYear===e.config.minDate.getFullYear()&&(e.currentMonth=Math.max(e.config.minDate.getMonth(),e.currentMonth)),P&&(e.redraw(),tt("onYearChange"),I())}}function bt(C,D){var P;D===void 0&&(D=!0);var R=e.parseDate(C,void 0,D);if(e.config.minDate&&R&&yr(R,e.config.minDate,D!==void 0?D:!e.minDateHasTime)<0||e.config.maxDate&&R&&yr(R,e.config.maxDate,D!==void 0?D:!e.maxDateHasTime)>0)return!1;if(!e.config.enable&&e.config.disable.length===0)return!0;if(R===void 0)return!1;for(var X=!!e.config.enable,Q=(P=e.config.enable)!==null&&P!==void 0?P:e.config.disable,Me=0,le=void 0;Me<Q.length;Me++){if(le=Q[Me],typeof le=="function"&&le(R))return X;if(le instanceof Date&&R!==void 0&&le.getTime()===R.getTime())return X;if(typeof le=="string"){var Ne=e.parseDate(le,void 0,!0);return Ne&&Ne.getTime()===R.getTime()?X:!X}else if(typeof le=="object"&&R!==void 0&&le.from&&le.to&&R.getTime()>=le.from.getTime()&&R.getTime()<=le.to.getTime())return X}return!X}function ze(C){return e.daysContainer!==void 0?C.className.indexOf("hidden")===-1&&C.className.indexOf("flatpickr-disabled")===-1&&e.daysContainer.contains(C):!1}function ut(C){var D=C.target===e._input,P=e._input.value.trimEnd()!==Nv();D&&P&&!(C.relatedTarget&&Te(C.relatedTarget))&&e.setDate(e._input.value,!0,C.target===e.altInput?e.config.altFormat:e.config.dateFormat)}function Ce(C){var D=gr(C),P=e.config.wrap?r.contains(D):D===e._input,R=e.config.allowInput,X=e.isOpen&&(!R||!P),Q=e.config.inline&&P&&!R;if(C.keyCode===13&&P){if(R)return e.setDate(e._input.value,!0,D===e.altInput?e.config.altFormat:e.config.dateFormat),e.close(),D.blur();e.open()}else if(Te(D)||X||Q){var Me=!!e.timeContainer&&e.timeContainer.contains(D);switch(C.keyCode){case 13:Me?(C.preventDefault(),l(),Iv()):tb(C);break;case 27:C.preventDefault(),Iv();break;case 8:case 46:P&&!e.config.allowInput&&(C.preventDefault(),e.clear());break;case 37:case 39:if(!Me&&!P){C.preventDefault();var le=a();if(e.daysContainer!==void 0&&(R===!1||le&&ze(le))){var Ne=C.keyCode===39?1:-1;C.ctrlKey?(C.stopPropagation(),ie(Ne),M(A(1),0)):M(void 0,Ne)}}else e.hourElement&&e.hourElement.focus();break;case 38:case 40:C.preventDefault();var ae=C.keyCode===40?1:-1;e.daysContainer&&D.$i!==void 0||D===e.input||D===e.altInput?C.ctrlKey?(C.stopPropagation(),vt(e.currentYear-ae),M(A(1),0)):Me||M(void 0,ae*7):D===e.currentYearElement?vt(e.currentYear-ae):e.config.enableTime&&(!Me&&e.hourElement&&e.hourElement.focus(),l(C),e._debouncedChange());break;case 9:if(Me){var be=[e.hourElement,e.minuteElement,e.secondElement,e.amPM].concat(e.pluginElements).filter(function(br){return br}),Ye=be.indexOf(D);if(Ye!==-1){var Di=be[Ye+(C.shiftKey?-1:1)];C.preventDefault(),(Di||e._input).focus()}}else!e.config.noCalendar&&e.daysContainer&&e.daysContainer.contains(D)&&C.shiftKey&&(C.preventDefault(),e._input.focus());break;default:break}}if(e.amPM!==void 0&&D===e.amPM)switch(C.key){case e.l10n.amPM[0].charAt(0):case e.l10n.amPM[0].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[0],f(),ji();break;case e.l10n.amPM[1].charAt(0):case e.l10n.amPM[1].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[1],f(),ji();break}(P||Te(D))&&tt("onKeyDown",C)}function Ie(C,D){if(D===void 0&&(D="flatpickr-day"),!(e.selectedDates.length!==1||C&&(!C.classList.contains(D)||C.classList.contains("flatpickr-disabled")))){for(var P=C?C.dateObj.getTime():e.days.firstElementChild.dateObj.getTime(),R=e.parseDate(e.selectedDates[0],void 0,!0).getTime(),X=Math.min(P,e.selectedDates[0].getTime()),Q=Math.max(P,e.selectedDates[0].getTime()),Me=!1,le=0,Ne=0,ae=X;ae<Q;ae+=TI.DAY)bt(new Date(ae),!0)||(Me=Me||ae>X&&ae<Q,ae<R&&(!le||ae>le)?le=ae:ae>R&&(!Ne||ae<Ne)&&(Ne=ae));var be=Array.from(e.rContainer.querySelectorAll("*:nth-child(-n+"+e.config.showMonths+") > ."+D));be.forEach(function(Ye){var Di=Ye.dateObj,br=Di.getTime(),Gl=le>0&&br<le||Ne>0&&br>Ne;if(Gl){Ye.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Ko){Ye.classList.remove(Ko)});return}else if(Me&&!Gl)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Ko){Ye.classList.remove(Ko)}),C!==void 0&&(C.classList.add(P<=e.selectedDates[0].getTime()?"startRange":"endRange"),R<P&&br===R?Ye.classList.add("startRange"):R>P&&br===R&&Ye.classList.add("endRange"),br>=le&&(Ne===0||br<=Ne)&&SI(br,R,P)&&Ye.classList.add("inRange"))})}}function $i(){e.isOpen&&!e.config.static&&!e.config.inline&&pf()}function Nt(C,D){if(D===void 0&&(D=e._positionElement),e.isMobile===!0){if(C){C.preventDefault();var P=gr(C);P&&P.blur()}e.mobileInput!==void 0&&(e.mobileInput.focus(),e.mobileInput.click()),tt("onOpen");return}else if(e._input.disabled||e.config.inline)return;var R=e.isOpen;e.isOpen=!0,R||(e.calendarContainer.classList.add("open"),e._input.classList.add("active"),tt("onOpen"),pf(D)),e.config.enableTime===!0&&e.config.noCalendar===!0&&e.config.allowInput===!1&&(C===void 0||!e.timeContainer.contains(C.relatedTarget))&&setTimeout(function(){return e.hourElement.select()},50)}function Hl(C){return function(D){var P=e.config["_"+C+"Date"]=e.parseDate(D,e.config.dateFormat),R=e.config["_"+(C==="min"?"max":"min")+"Date"];P!==void 0&&(e[C==="min"?"minDateHasTime":"maxDateHasTime"]=P.getHours()>0||P.getMinutes()>0||P.getSeconds()>0),e.selectedDates&&(e.selectedDates=e.selectedDates.filter(function(X){return bt(X)}),!e.selectedDates.length&&C==="min"&&h(P),ji()),e.daysContainer&&(eb(),P!==void 0?e.currentYearElement[C]=P.getFullYear().toString():e.currentYearElement.removeAttribute(C),e.currentYearElement.disabled=!!R&&P!==void 0&&R.getFullYear()===P.getFullYear())}}function hf(){var C=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],D=Xt(Xt({},JSON.parse(JSON.stringify(r.dataset||{}))),t),P={};e.config.parseDate=D.parseDate,e.config.formatDate=D.formatDate,Object.defineProperty(e.config,"enable",{get:function(){return e.config._enable},set:function(be){e.config._enable=ib(be)}}),Object.defineProperty(e.config,"disable",{get:function(){return e.config._disable},set:function(be){e.config._disable=ib(be)}});var R=D.mode==="time";if(!D.dateFormat&&(D.enableTime||R)){var X=xt.defaultConfig.dateFormat||ya.dateFormat;P.dateFormat=D.noCalendar||R?"H:i"+(D.enableSeconds?":S":""):X+" H:i"+(D.enableSeconds?":S":"")}if(D.altInput&&(D.enableTime||R)&&!D.altFormat){var Q=xt.defaultConfig.altFormat||ya.altFormat;P.altFormat=D.noCalendar||R?"h:i"+(D.enableSeconds?":S K":" K"):Q+(" h:i"+(D.enableSeconds?":S":"")+" K")}Object.defineProperty(e.config,"minDate",{get:function(){return e.config._minDate},set:Hl("min")}),Object.defineProperty(e.config,"maxDate",{get:function(){return e.config._maxDate},set:Hl("max")});var Me=function(be){return function(Ye){e.config[be==="min"?"_minTime":"_maxTime"]=e.parseDate(Ye,"H:i:S")}};Object.defineProperty(e.config,"minTime",{get:function(){return e.config._minTime},set:Me("min")}),Object.defineProperty(e.config,"maxTime",{get:function(){return e.config._maxTime},set:Me("max")}),D.mode==="time"&&(e.config.noCalendar=!0,e.config.enableTime=!0),Object.assign(e.config,P,D);for(var le=0;le<C.length;le++)e.config[C[le]]=e.config[C[le]]===!0||e.config[C[le]]==="true";dv.filter(function(be){return e.config[be]!==void 0}).forEach(function(be){e.config[be]=gv(e.config[be]||[]).map(o)}),e.isMobile=!e.config.disableMobile&&!e.config.inline&&e.config.mode==="single"&&!e.config.disable.length&&!e.config.enable&&!e.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var le=0;le<e.config.plugins.length;le++){var Ne=e.config.plugins[le](e)||{};for(var ae in Ne)dv.indexOf(ae)>-1?e.config[ae]=gv(Ne[ae]).map(o).concat(e.config[ae]):typeof D[ae]>"u"&&(e.config[ae]=Ne[ae])}D.altInputClass||(e.config.altInputClass=Jx().className+" "+e.config.altInputClass),tt("onParseConfig")}function Jx(){return e.config.wrap?r.querySelector("[data-input]"):r}function Qx(){typeof e.config.locale!="object"&&typeof xt.l10ns[e.config.locale]>"u"&&e.config.errorHandler(new Error("flatpickr: invalid locale "+e.config.locale)),e.l10n=Xt(Xt({},xt.l10ns.default),typeof e.config.locale=="object"?e.config.locale:e.config.locale!=="default"?xt.l10ns[e.config.locale]:void 0),In.D="("+e.l10n.weekdays.shorthand.join("|")+")",In.l="("+e.l10n.weekdays.longhand.join("|")+")",In.M="("+e.l10n.months.shorthand.join("|")+")",In.F="("+e.l10n.months.longhand.join("|")+")",In.K="("+e.l10n.amPM[0]+"|"+e.l10n.amPM[1]+"|"+e.l10n.amPM[0].toLowerCase()+"|"+e.l10n.amPM[1].toLowerCase()+")";var C=Xt(Xt({},t),JSON.parse(JSON.stringify(r.dataset||{})));C.time_24hr===void 0&&xt.defaultConfig.time_24hr===void 0&&(e.config.time_24hr=e.l10n.time_24hr),e.formatDate=Hx(e),e.parseDate=yv({config:e.config,l10n:e.l10n})}function pf(C){if(typeof e.config.position=="function")return void e.config.position(e,C);if(e.calendarContainer!==void 0){tt("onPreCalendarPosition");var D=C||e._positionElement,P=Array.prototype.reduce.call(e.calendarContainer.children,(function(DL,EL){return DL+EL.offsetHeight}),0),R=e.calendarContainer.offsetWidth,X=e.config.position.split(" "),Q=X[0],Me=X.length>1?X[1]:null,le=D.getBoundingClientRect(),Ne=window.innerHeight-le.bottom,ae=Q==="above"||Q!=="below"&&Ne<P&&le.top>P,be=window.pageYOffset+le.top+(ae?-P-2:D.offsetHeight+2);if(Zt(e.calendarContainer,"arrowTop",!ae),Zt(e.calendarContainer,"arrowBottom",ae),!e.config.inline){var Ye=window.pageXOffset+le.left,Di=!1,br=!1;Me==="center"?(Ye-=(R-le.width)/2,Di=!0):Me==="right"&&(Ye-=R-le.width,br=!0),Zt(e.calendarContainer,"arrowLeft",!Di&&!br),Zt(e.calendarContainer,"arrowCenter",Di),Zt(e.calendarContainer,"arrowRight",br);var Gl=window.document.body.offsetWidth-(window.pageXOffset+le.right),Ko=Ye+R>window.document.body.offsetWidth,xL=Gl+R>window.document.body.offsetWidth;if(Zt(e.calendarContainer,"rightMost",Ko),!e.config.static)if(e.calendarContainer.style.top=be+"px",!Ko)e.calendarContainer.style.left=Ye+"px",e.calendarContainer.style.right="auto";else if(!xL)e.calendarContainer.style.left="auto",e.calendarContainer.style.right=Gl+"px";else{var kv=uL();if(kv===void 0)return;var bL=window.document.body.offsetWidth,SL=Math.max(0,bL/2-R/2),wL=".flatpickr-calendar.centerMost:before",TL=".flatpickr-calendar.centerMost:after",CL=kv.cssRules.length,AL="{left:"+le.left+"px;right:auto;}";Zt(e.calendarContainer,"rightMost",!1),Zt(e.calendarContainer,"centerMost",!0),kv.insertRule(wL+","+TL+AL,CL),e.calendarContainer.style.left=SL+"px",e.calendarContainer.style.right="auto"}}}}function uL(){for(var C=null,D=0;D<document.styleSheets.length;D++){var P=document.styleSheets[D];if(P.cssRules){try{P.cssRules}catch{continue}C=P;break}}return C??cL()}function cL(){var C=document.createElement("style");return document.head.appendChild(C),C.sheet}function eb(){e.config.noCalendar||e.isMobile||(I(),vf(),L())}function Iv(){e._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(e.close,0):e.close()}function tb(C){C.preventDefault(),C.stopPropagation();var D=function(be){return be.classList&&be.classList.contains("flatpickr-day")&&!be.classList.contains("flatpickr-disabled")&&!be.classList.contains("notAllowed")},P=Vx(gr(C),D);if(P!==void 0){var R=P,X=e.latestSelectedDateObj=new Date(R.dateObj.getTime()),Q=(X.getMonth()<e.currentMonth||X.getMonth()>e.currentMonth+e.config.showMonths-1)&&e.config.mode!=="range";if(e.selectedDateElem=R,e.config.mode==="single")e.selectedDates=[X];else if(e.config.mode==="multiple"){var Me=Pv(X);Me?e.selectedDates.splice(parseInt(Me),1):e.selectedDates.push(X)}else e.config.mode==="range"&&(e.selectedDates.length===2&&e.clear(!1,!1),e.latestSelectedDateObj=X,e.selectedDates.push(X),yr(X,e.selectedDates[0],!0)!==0&&e.selectedDates.sort(function(be,Ye){return be.getTime()-Ye.getTime()}));if(f(),Q){var le=e.currentYear!==X.getFullYear();e.currentYear=X.getFullYear(),e.currentMonth=X.getMonth(),le&&(tt("onYearChange"),I()),tt("onMonthChange")}if(vf(),L(),ji(),!Q&&e.config.mode!=="range"&&e.config.showMonths===1?T(R):e.selectedDateElem!==void 0&&e.hourElement===void 0&&e.selectedDateElem&&e.selectedDateElem.focus(),e.hourElement!==void 0&&e.hourElement!==void 0&&e.hourElement.focus(),e.config.closeOnSelect){var Ne=e.config.mode==="single"&&!e.config.enableTime,ae=e.config.mode==="range"&&e.selectedDates.length===2&&!e.config.enableTime;(Ne||ae)&&Iv()}m()}}var df={locale:[Qx,$],showMonths:[z,s,G],minDate:[y],maxDate:[y],positionElement:[nb],clickOpens:[function(){e.config.clickOpens===!0?(v(e._input,"focus",e.open),v(e._input,"click",e.open)):(e._input.removeEventListener("focus",e.open),e._input.removeEventListener("click",e.open))}]};function fL(C,D){if(C!==null&&typeof C=="object"){Object.assign(e.config,C);for(var P in C)df[P]!==void 0&&df[P].forEach(function(R){return R()})}else e.config[C]=D,df[C]!==void 0?df[C].forEach(function(R){return R()}):dv.indexOf(C)>-1&&(e.config[C]=gv(D));e.redraw(),ji(!0)}function rb(C,D){var P=[];if(C instanceof Array)P=C.map(function(R){return e.parseDate(R,D)});else if(C instanceof Date||typeof C=="number")P=[e.parseDate(C,D)];else if(typeof C=="string")switch(e.config.mode){case"single":case"time":P=[e.parseDate(C,D)];break;case"multiple":P=C.split(e.config.conjunction).map(function(R){return e.parseDate(R,D)});break;case"range":P=C.split(e.l10n.rangeSeparator).map(function(R){return e.parseDate(R,D)});break;default:break}else e.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(C)));e.selectedDates=e.config.allowInvalidPreload?P:P.filter(function(R){return R instanceof Date&&bt(R,!1)}),e.config.mode==="range"&&e.selectedDates.sort(function(R,X){return R.getTime()-X.getTime()})}function hL(C,D,P){if(D===void 0&&(D=!1),P===void 0&&(P=e.config.dateFormat),C!==0&&!C||C instanceof Array&&C.length===0)return e.clear(D);rb(C,P),e.latestSelectedDateObj=e.selectedDates[e.selectedDates.length-1],e.redraw(),y(void 0,D),h(),e.selectedDates.length===0&&e.clear(!1),ji(D),D&&tt("onChange")}function ib(C){return C.slice().map(function(D){return typeof D=="string"||typeof D=="number"||D instanceof Date?e.parseDate(D,void 0,!0):D&&typeof D=="object"&&D.from&&D.to?{from:e.parseDate(D.from,void 0),to:e.parseDate(D.to,void 0)}:D}).filter(function(D){return D})}function pL(){e.selectedDates=[],e.now=e.parseDate(e.config.now)||new Date;var C=e.config.defaultDate||((e.input.nodeName==="INPUT"||e.input.nodeName==="TEXTAREA")&&e.input.placeholder&&e.input.value===e.input.placeholder?null:e.input.value);C&&rb(C,e.config.dateFormat),e._initialDate=e.selectedDates.length>0?e.selectedDates[0]:e.config.minDate&&e.config.minDate.getTime()>e.now.getTime()?e.config.minDate:e.config.maxDate&&e.config.maxDate.getTime()<e.now.getTime()?e.config.maxDate:e.now,e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth(),e.selectedDates.length>0&&(e.latestSelectedDateObj=e.selectedDates[0]),e.config.minTime!==void 0&&(e.config.minTime=e.parseDate(e.config.minTime,"H:i")),e.config.maxTime!==void 0&&(e.config.maxTime=e.parseDate(e.config.maxTime,"H:i")),e.minDateHasTime=!!e.config.minDate&&(e.config.minDate.getHours()>0||e.config.minDate.getMinutes()>0||e.config.minDate.getSeconds()>0),e.maxDateHasTime=!!e.config.maxDate&&(e.config.maxDate.getHours()>0||e.config.maxDate.getMinutes()>0||e.config.maxDate.getSeconds()>0)}function dL(){if(e.input=Jx(),!e.input){e.config.errorHandler(new Error("Invalid input element specified"));return}e.input._type=e.input.type,e.input.type="text",e.input.classList.add("flatpickr-input"),e._input=e.input,e.config.altInput&&(e.altInput=Fe(e.input.nodeName,e.config.altInputClass),e._input=e.altInput,e.altInput.placeholder=e.input.placeholder,e.altInput.disabled=e.input.disabled,e.altInput.required=e.input.required,e.altInput.tabIndex=e.input.tabIndex,e.altInput.type="text",e.input.setAttribute("type","hidden"),!e.config.static&&e.input.parentNode&&e.input.parentNode.insertBefore(e.altInput,e.input.nextSibling)),e.config.allowInput||e._input.setAttribute("readonly","readonly"),nb()}function nb(){e._positionElement=e.config.positionElement||e._input}function vL(){var C=e.config.enableTime?e.config.noCalendar?"time":"datetime-local":"date";e.mobileInput=Fe("input",e.input.className+" flatpickr-mobile"),e.mobileInput.tabIndex=1,e.mobileInput.type=C,e.mobileInput.disabled=e.input.disabled,e.mobileInput.required=e.input.required,e.mobileInput.placeholder=e.input.placeholder,e.mobileFormatStr=C==="datetime-local"?"Y-m-d\\TH:i:S":C==="date"?"Y-m-d":"H:i:S",e.selectedDates.length>0&&(e.mobileInput.defaultValue=e.mobileInput.value=e.formatDate(e.selectedDates[0],e.mobileFormatStr)),e.config.minDate&&(e.mobileInput.min=e.formatDate(e.config.minDate,"Y-m-d")),e.config.maxDate&&(e.mobileInput.max=e.formatDate(e.config.maxDate,"Y-m-d")),e.input.getAttribute("step")&&(e.mobileInput.step=String(e.input.getAttribute("step"))),e.input.type="hidden",e.altInput!==void 0&&(e.altInput.type="hidden");try{e.input.parentNode&&e.input.parentNode.insertBefore(e.mobileInput,e.input.nextSibling)}catch{}v(e.mobileInput,"change",function(D){e.setDate(gr(D).value,!1,e.mobileFormatStr),tt("onChange"),tt("onClose")})}function mL(C){if(e.isOpen===!0)return e.close();e.open(C)}function tt(C,D){if(e.config!==void 0){var P=e.config[C];if(P!==void 0&&P.length>0)for(var R=0;P[R]&&R<P.length;R++)P[R](e.selectedDates,e.input.value,e,D);C==="onChange"&&(e.input.dispatchEvent(Lv("change")),e.input.dispatchEvent(Lv("input")))}}function Lv(C){var D=document.createEvent("Event");return D.initEvent(C,!0,!0),D}function Pv(C){for(var D=0;D<e.selectedDates.length;D++){var P=e.selectedDates[D];if(P instanceof Date&&yr(P,C)===0)return""+D}return!1}function gL(C){return e.config.mode!=="range"||e.selectedDates.length<2?!1:yr(C,e.selectedDates[0])>=0&&yr(C,e.selectedDates[1])<=0}function vf(){e.config.noCalendar||e.isMobile||!e.monthNav||(e.yearElements.forEach(function(C,D){var P=new Date(e.currentYear,e.currentMonth,1);P.setMonth(e.currentMonth+D),e.config.showMonths>1||e.config.monthSelectorType==="static"?e.monthElements[D].textContent=$c(P.getMonth(),e.config.shorthandCurrentMonth,e.l10n)+" ":e.monthsDropdownContainer.value=P.getMonth().toString(),C.value=P.getFullYear().toString()}),e._hidePrevMonthArrow=e.config.minDate!==void 0&&(e.currentYear===e.config.minDate.getFullYear()?e.currentMonth<=e.config.minDate.getMonth():e.currentYear<e.config.minDate.getFullYear()),e._hideNextMonthArrow=e.config.maxDate!==void 0&&(e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth+1>e.config.maxDate.getMonth():e.currentYear>e.config.maxDate.getFullYear()))}function Nv(C){var D=C||(e.config.altInput?e.config.altFormat:e.config.dateFormat);return e.selectedDates.map(function(P){return e.formatDate(P,D)}).filter(function(P,R,X){return e.config.mode!=="range"||e.config.enableTime||X.indexOf(P)===R}).join(e.config.mode!=="range"?e.config.conjunction:e.l10n.rangeSeparator)}function ji(C){C===void 0&&(C=!0),e.mobileInput!==void 0&&e.mobileFormatStr&&(e.mobileInput.value=e.latestSelectedDateObj!==void 0?e.formatDate(e.latestSelectedDateObj,e.mobileFormatStr):""),e.input.value=Nv(e.config.dateFormat),e.altInput!==void 0&&(e.altInput.value=Nv(e.config.altFormat)),C!==!1&&tt("onValueUpdate")}function yL(C){var D=gr(C),P=e.prevMonthNav.contains(D),R=e.nextMonthNav.contains(D);P||R?ie(P?-1:1):e.yearElements.indexOf(D)>=0?D.select():D.classList.contains("arrowUp")?e.changeYear(e.currentYear+1):D.classList.contains("arrowDown")&&e.changeYear(e.currentYear-1)}function _L(C){C.preventDefault();var D=C.type==="keydown",P=gr(C),R=P;e.amPM!==void 0&&P===e.amPM&&(e.amPM.textContent=e.l10n.amPM[mr(e.amPM.textContent===e.l10n.amPM[0])]);var X=parseFloat(R.getAttribute("min")),Q=parseFloat(R.getAttribute("max")),Me=parseFloat(R.getAttribute("step")),le=parseInt(R.value,10),Ne=C.delta||(D?C.which===38?1:-1:0),ae=le+Me*Ne;if(typeof R.value<"u"&&R.value.length===2){var be=R===e.hourElement,Ye=R===e.minuteElement;ae<X?(ae=Q+ae+mr(!be)+(mr(be)&&mr(!e.amPM)),Ye&&x(void 0,-1,e.hourElement)):ae>Q&&(ae=R===e.hourElement?ae-Q-mr(!e.amPM):X,Ye&&x(void 0,1,e.hourElement)),e.amPM&&be&&(Me===1?ae+le===23:Math.abs(ae-le)>Me)&&(e.amPM.textContent=e.l10n.amPM[mr(e.amPM.textContent===e.l10n.amPM[0])]),R.value=Wt(ae)}}return n(),e}function wl(r,t){for(var e=Array.prototype.slice.call(r).filter(function(o){return o instanceof HTMLElement}),i=[],n=0;n<e.length;n++){var a=e[n];try{if(a.getAttribute("data-fp-omit")!==null)continue;a._flatpickr!==void 0&&(a._flatpickr.destroy(),a._flatpickr=void 0),a._flatpickr=t5(a,t||{}),i.push(a._flatpickr)}catch(o){console.error(o)}}return i.length===1?i[0]:i}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(r){return wl(this,r)},HTMLElement.prototype.flatpickr=function(r){return wl([this],r)});var xt=function(r,t){return typeof r=="string"?wl(window.document.querySelectorAll(r),t):r instanceof Node?wl([r],t):wl(r,t)};xt.defaultConfig={};xt.l10ns={en:Xt({},mv),default:Xt({},mv)};xt.localize=function(r){xt.l10ns.default=Xt(Xt({},xt.l10ns.default),r)};xt.setDefaults=function(r){xt.defaultConfig=Xt(Xt({},xt.defaultConfig),r)};xt.parseDate=yv({});xt.formatDate=Hx({});xt.compareDates=yr;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(r){return wl(this,r)});Date.prototype.fp_incr=function(r){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof r=="string"?parseInt(r,10):r))};typeof window<"u"&&(window.flatpickr=xt);var bv=xt;var wi,AI,DI,EI,Gx,Tl=class extends xe{constructor(){super(...arguments);Ji(this,wi)}connect(){this.typeValue=="time"?this.flatpickr=bv(this.element,Bt(this,wi,AI)):this.typeValue=="datetime"?this.flatpickr=bv(this.element,Bt(this,wi,DI)):this.flatpickr=bv(this.element,Bt(this,wi,EI))}disconnect(){this.flatpickr.destroy()}};wi=new WeakSet,AI=function(){return{dateFormat:"H:i",enableTime:!0,noCalendar:!0}},DI=function(){return{...Bt(this,wi,Gx),altFormat:this.dateTimeFormatValue,dateFormat:"Y-m-d H:i",enableTime:!0}},EI=function(){return{...Bt(this,wi,Gx),altFormat:this.dateFormatValue,dateFormat:"Y-m-d"}},Gx=function(){return{altInput:!0,disable:this.disableValue,mode:this.modeValue,showMonths:this.showMonthsValue}},se(Tl,"targets",["details"]),se(Tl,"values",{type:String,disable:Array,mode:{type:String,default:"single"},showMonths:{type:Number,default:1},dateFormat:{type:String,default:"F d, Y"},dateTimeFormat:{type:String,default:"M d, Y h:i K"}});var jc=class extends xe{show(){this.menuTarget.show()}showModal(){this.menuTarget.showModal()}close(){this.menuTarget.close()}closeOnClickOutside({target:r}){r.nodeName==="DIALOG"&&this.close()}};se(jc,"targets",["menu"]);var Al,_r,MI,Sv,OI,II,LI,Cl=class extends xe{constructor(){super(...arguments);Ji(this,_r);Ji(this,Al)}initialize(){Yl(this,Al,new IntersectionObserver(xa(this,_r,MI).bind(this)))}connect(){Bt(this,Al).observe(this.element)}disconnect(){Bt(this,Al).disconnect()}prev(){this.indexValue>0&&(this.indexValue--,xa(this,_r,Sv).call(this))}next(){this.indexValue<Bt(this,_r,LI)&&(this.indexValue++,xa(this,_r,Sv).call(this))}};Al=new WeakMap,_r=new WeakSet,MI=function([t]){t.isIntersecting&&(this.indexValue=0,xa(this,_r,Sv).call(this))},Sv=function(){xa(this,_r,OI).call(this),xa(this,_r,II).call(this)},OI=function(){this.itemTargets.forEach((t,e)=>{t.tabIndex=e===this.indexValue?0:-1})},II=function(){this.itemTargets[this.indexValue].focus()},LI=function(){return this.itemTargets.length-1},se(Cl,"targets",["item"]),se(Cl,"values",{index:Number});var Dl=Math.min,Ln=Math.max,Qc=Math.round,ef=Math.floor,Ti=r=>({x:r,y:r}),r5={left:"right",right:"left",bottom:"top",top:"bottom"},i5={start:"end",end:"start"};function Yx(r,t,e){return Ln(r,Dl(t,e))}function tf(r,t){return typeof r=="function"?r(t):r}function _a(r){return r.split("-")[0]}function rf(r){return r.split("-")[1]}function Wx(r){return r==="x"?"y":"x"}function Zx(r){return r==="y"?"height":"width"}var n5=new Set(["top","bottom"]);function Pn(r){return n5.has(_a(r))?"y":"x"}function Xx(r){return Wx(Pn(r))}function kI(r,t,e){e===void 0&&(e=!1);let i=rf(r),n=Xx(r),a=Zx(n),o=n==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=Jc(o)),[o,Jc(o)]}function RI(r){let t=Jc(r);return[wv(r),t,wv(t)]}function wv(r){return r.replace(/start|end/g,t=>i5[t])}var PI=["left","right"],NI=["right","left"],a5=["top","bottom"],o5=["bottom","top"];function s5(r,t,e){switch(r){case"top":case"bottom":return e?t?NI:PI:t?PI:NI;case"left":case"right":return t?a5:o5;default:return[]}}function FI(r,t,e,i){let n=rf(r),a=s5(_a(r),e==="start",i);return n&&(a=a.map(o=>o+"-"+n),t&&(a=a.concat(a.map(wv)))),a}function Jc(r){return r.replace(/left|right|bottom|top/g,t=>r5[t])}function l5(r){return{top:0,right:0,bottom:0,left:0,...r}}function BI(r){return typeof r!="number"?l5(r):{top:r,right:r,bottom:r,left:r}}function Yo(r){let{x:t,y:e,width:i,height:n}=r;return{width:i,height:n,top:e,left:t,right:t+i,bottom:e+n,x:t,y:e}}function zI(r,t,e){let{reference:i,floating:n}=r,a=Pn(t),o=Xx(t),s=Zx(o),l=_a(t),u=a==="y",c=i.x+i.width/2-n.width/2,f=i.y+i.height/2-n.height/2,h=i[s]/2-n[s]/2,p;switch(l){case"top":p={x:c,y:i.y-n.height};break;case"bottom":p={x:c,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:f};break;case"left":p={x:i.x-n.width,y:f};break;default:p={x:i.x,y:i.y}}switch(rf(t)){case"start":p[o]-=h*(e&&u?-1:1);break;case"end":p[o]+=h*(e&&u?-1:1);break}return p}var VI=async(r,t,e)=>{let{placement:i="bottom",strategy:n="absolute",middleware:a=[],platform:o}=e,s=a.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t)),u=await o.getElementRects({reference:r,floating:t,strategy:n}),{x:c,y:f}=zI(u,i,l),h=i,p={},d=0;for(let v=0;v<s.length;v++){let{name:m,fn:g}=s[v],{x:y,y:_,data:x,reset:b}=await g({x:c,y:f,initialPlacement:i,placement:h,strategy:n,middlewareData:p,rects:u,platform:o,elements:{reference:r,floating:t}});c=y??c,f=_??f,p={...p,[m]:{...p[m],...x}},b&&d<=50&&(d++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(u=b.rects===!0?await o.getElementRects({reference:r,floating:t,strategy:n}):b.rects),{x:c,y:f}=zI(u,h,l)),v=-1)}return{x:c,y:f,placement:h,strategy:n,middlewareData:p}};async function Kx(r,t){var e;t===void 0&&(t={});let{x:i,y:n,platform:a,rects:o,elements:s,strategy:l}=r,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=tf(t,r),d=BI(p),m=s[h?f==="floating"?"reference":"floating":f],g=Yo(await a.getClippingRect({element:(e=await(a.isElement==null?void 0:a.isElement(m)))==null||e?m:m.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),y=f==="floating"?{x:i,y:n,width:o.floating.width,height:o.floating.height}:o.reference,_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),x=await(a.isElement==null?void 0:a.isElement(_))?await(a.getScale==null?void 0:a.getScale(_))||{x:1,y:1}:{x:1,y:1},b=Yo(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:_,strategy:l}):y);return{top:(g.top-b.top+d.top)/x.y,bottom:(b.bottom-g.bottom+d.bottom)/x.y,left:(g.left-b.left+d.left)/x.x,right:(b.right-g.right+d.right)/x.x}}var UI=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(t){var e,i;let{placement:n,middlewareData:a,rects:o,initialPlacement:s,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:v=!0,...m}=tf(r,t);if((e=a.arrow)!=null&&e.alignmentOffset)return{};let g=_a(n),y=Pn(s),_=_a(s)===s,x=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=h||(_||!v?[Jc(s)]:RI(s)),S=d!=="none";!h&&S&&b.push(...FI(s,v,d,x));let T=[s,...b],A=await Kx(t,m),E=[],M=((i=a.flip)==null?void 0:i.overflows)||[];if(c&&E.push(A[g]),f){let k=kI(n,o,x);E.push(A[k[0]],A[k[1]])}if(M=[...M,{placement:n,overflows:E}],!E.every(k=>k<=0)){var O,L;let k=(((O=a.flip)==null?void 0:O.index)||0)+1,z=T[k];if(z&&(!(f==="alignment"?y!==Pn(z):!1)||M.every(G=>G.overflows[0]>0&&Pn(G.placement)===y)))return{data:{index:k,overflows:M},reset:{placement:z}};let V=(L=M.filter(q=>q.overflows[0]<=0).sort((q,G)=>q.overflows[1]-G.overflows[1])[0])==null?void 0:L.placement;if(!V)switch(p){case"bestFit":{var I;let q=(I=M.filter(G=>{if(S){let $=Pn(G.placement);return $===y||$==="y"}return!0}).map(G=>[G.placement,G.overflows.filter($=>$>0).reduce(($,oe)=>$+oe,0)]).sort((G,$)=>G[1]-$[1])[0])==null?void 0:I[0];q&&(V=q);break}case"initialPlacement":V=s;break}if(n!==V)return{reset:{placement:V}}}return{}}}};var u5=new Set(["left","top"]);async function c5(r,t){let{placement:e,platform:i,elements:n}=r,a=await(i.isRTL==null?void 0:i.isRTL(n.floating)),o=_a(e),s=rf(e),l=Pn(e)==="y",u=u5.has(o)?-1:1,c=a&&l?-1:1,f=tf(t,r),{mainAxis:h,crossAxis:p,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof d=="number"&&(p=s==="end"?d*-1:d),l?{x:p*c,y:h*u}:{x:h*u,y:p*c}}var HI=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(t){var e,i;let{x:n,y:a,placement:o,middlewareData:s}=t,l=await c5(t,r);return o===((e=s.offset)==null?void 0:e.placement)&&(i=s.arrow)!=null&&i.alignmentOffset?{}:{x:n+l.x,y:a+l.y,data:{...l,placement:o}}}}},GI=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(t){let{x:e,y:i,placement:n}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:m=>{let{x:g,y}=m;return{x:g,y}}},...l}=tf(r,t),u={x:e,y:i},c=await Kx(t,l),f=Pn(_a(n)),h=Wx(f),p=u[h],d=u[f];if(a){let m=h==="y"?"top":"left",g=h==="y"?"bottom":"right",y=p+c[m],_=p-c[g];p=Yx(y,p,_)}if(o){let m=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=d+c[m],_=d-c[g];d=Yx(y,d,_)}let v=s.fn({...t,[h]:p,[f]:d});return{...v,data:{x:v.x-e,y:v.y-i,enabled:{[h]:a,[f]:o}}}}}};function Tv(){return typeof window<"u"}function Wo(r){return WI(r)?(r.nodeName||"").toLowerCase():"#document"}function xr(r){var t;return(r==null||(t=r.ownerDocument)==null?void 0:t.defaultView)||window}function Ci(r){var t;return(t=(WI(r)?r.ownerDocument:r.document)||window.document)==null?void 0:t.documentElement}function WI(r){return Tv()?r instanceof Node||r instanceof xr(r).Node:!1}function oi(r){return Tv()?r instanceof Element||r instanceof xr(r).Element:!1}function Ai(r){return Tv()?r instanceof HTMLElement||r instanceof xr(r).HTMLElement:!1}function YI(r){return!Tv()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof xr(r).ShadowRoot}var f5=new Set(["inline","contents"]);function Ml(r){let{overflow:t,overflowX:e,overflowY:i,display:n}=si(r);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!f5.has(n)}var h5=new Set(["table","td","th"]);function ZI(r){return h5.has(Wo(r))}var p5=[":popover-open",":modal"];function nf(r){return p5.some(t=>{try{return r.matches(t)}catch{return!1}})}var d5=["transform","translate","scale","rotate","perspective"],v5=["transform","translate","scale","rotate","perspective","filter"],m5=["paint","layout","strict","content"];function Cv(r){let t=Av(),e=oi(r)?si(r):r;return d5.some(i=>e[i]?e[i]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||v5.some(i=>(e.willChange||"").includes(i))||m5.some(i=>(e.contain||"").includes(i))}function XI(r){let t=Nn(r);for(;Ai(t)&&!Zo(t);){if(Cv(t))return t;if(nf(t))return null;t=Nn(t)}return null}function Av(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var g5=new Set(["html","body","#document"]);function Zo(r){return g5.has(Wo(r))}function si(r){return xr(r).getComputedStyle(r)}function af(r){return oi(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Nn(r){if(Wo(r)==="html")return r;let t=r.assignedSlot||r.parentNode||YI(r)&&r.host||Ci(r);return YI(t)?t.host:t}function KI(r){let t=Nn(r);return Zo(t)?r.ownerDocument?r.ownerDocument.body:r.body:Ai(t)&&Ml(t)?t:KI(t)}function El(r,t,e){var i;t===void 0&&(t=[]),e===void 0&&(e=!0);let n=KI(r),a=n===((i=r.ownerDocument)==null?void 0:i.body),o=xr(n);if(a){let s=Dv(o);return t.concat(o,o.visualViewport||[],Ml(n)?n:[],s&&e?El(s):[])}return t.concat(n,El(n,[],e))}function Dv(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function jI(r){let t=si(r),e=parseFloat(t.width)||0,i=parseFloat(t.height)||0,n=Ai(r),a=n?r.offsetWidth:e,o=n?r.offsetHeight:i,s=Qc(e)!==a||Qc(i)!==o;return s&&(e=a,i=o),{width:e,height:i,$:s}}function $x(r){return oi(r)?r:r.contextElement}function Ol(r){let t=$x(r);if(!Ai(t))return Ti(1);let e=t.getBoundingClientRect(),{width:i,height:n,$:a}=jI(t),o=(a?Qc(e.width):e.width)/i,s=(a?Qc(e.height):e.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var y5=Ti(0);function JI(r){let t=xr(r);return!Av()||!t.visualViewport?y5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _5(r,t,e){return t===void 0&&(t=!1),!e||t&&e!==xr(r)?!1:t}function Xo(r,t,e,i){t===void 0&&(t=!1),e===void 0&&(e=!1);let n=r.getBoundingClientRect(),a=$x(r),o=Ti(1);t&&(i?oi(i)&&(o=Ol(i)):o=Ol(r));let s=_5(a,e,i)?JI(a):Ti(0),l=(n.left+s.x)/o.x,u=(n.top+s.y)/o.y,c=n.width/o.x,f=n.height/o.y;if(a){let h=xr(a),p=i&&oi(i)?xr(i):i,d=h,v=Dv(d);for(;v&&i&&p!==d;){let m=Ol(v),g=v.getBoundingClientRect(),y=si(v),_=g.left+(v.clientLeft+parseFloat(y.paddingLeft))*m.x,x=g.top+(v.clientTop+parseFloat(y.paddingTop))*m.y;l*=m.x,u*=m.y,c*=m.x,f*=m.y,l+=_,u+=x,d=xr(v),v=Dv(d)}}return Yo({width:c,height:f,x:l,y:u})}function jx(r,t){let e=af(r).scrollLeft;return t?t.left+e:Xo(Ci(r)).left+e}function QI(r,t,e){e===void 0&&(e=!1);let i=r.getBoundingClientRect(),n=i.left+t.scrollLeft-(e?0:jx(r,i)),a=i.top+t.scrollTop;return{x:n,y:a}}function x5(r){let{elements:t,rect:e,offsetParent:i,strategy:n}=r,a=n==="fixed",o=Ci(i),s=t?nf(t.floating):!1;if(i===o||s&&a)return e;let l={scrollLeft:0,scrollTop:0},u=Ti(1),c=Ti(0),f=Ai(i);if((f||!f&&!a)&&((Wo(i)!=="body"||Ml(o))&&(l=af(i)),Ai(i))){let p=Xo(i);u=Ol(i),c.x=p.x+i.clientLeft,c.y=p.y+i.clientTop}let h=o&&!f&&!a?QI(o,l,!0):Ti(0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}}function b5(r){return Array.from(r.getClientRects())}function S5(r){let t=Ci(r),e=af(r),i=r.ownerDocument.body,n=Ln(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),a=Ln(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),o=-e.scrollLeft+jx(r),s=-e.scrollTop;return si(i).direction==="rtl"&&(o+=Ln(t.clientWidth,i.clientWidth)-n),{width:n,height:a,x:o,y:s}}function w5(r,t){let e=xr(r),i=Ci(r),n=e.visualViewport,a=i.clientWidth,o=i.clientHeight,s=0,l=0;if(n){a=n.width,o=n.height;let u=Av();(!u||u&&t==="fixed")&&(s=n.offsetLeft,l=n.offsetTop)}return{width:a,height:o,x:s,y:l}}var T5=new Set(["absolute","fixed"]);function C5(r,t){let e=Xo(r,!0,t==="fixed"),i=e.top+r.clientTop,n=e.left+r.clientLeft,a=Ai(r)?Ol(r):Ti(1),o=r.clientWidth*a.x,s=r.clientHeight*a.y,l=n*a.x,u=i*a.y;return{width:o,height:s,x:l,y:u}}function qI(r,t,e){let i;if(t==="viewport")i=w5(r,e);else if(t==="document")i=S5(Ci(r));else if(oi(t))i=C5(t,e);else{let n=JI(r);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Yo(i)}function eL(r,t){let e=Nn(r);return e===t||!oi(e)||Zo(e)?!1:si(e).position==="fixed"||eL(e,t)}function A5(r,t){let e=t.get(r);if(e)return e;let i=El(r,[],!1).filter(s=>oi(s)&&Wo(s)!=="body"),n=null,a=si(r).position==="fixed",o=a?Nn(r):r;for(;oi(o)&&!Zo(o);){let s=si(o),l=Cv(o);!l&&s.position==="fixed"&&(n=null),(a?!l&&!n:!l&&s.position==="static"&&!!n&&T5.has(n.position)||Ml(o)&&!l&&eL(r,o))?i=i.filter(c=>c!==o):n=s,o=Nn(o)}return t.set(r,i),i}function D5(r){let{element:t,boundary:e,rootBoundary:i,strategy:n}=r,o=[...e==="clippingAncestors"?nf(t)?[]:A5(t,this._c):[].concat(e),i],s=o[0],l=o.reduce((u,c)=>{let f=qI(t,c,n);return u.top=Ln(f.top,u.top),u.right=Dl(f.right,u.right),u.bottom=Dl(f.bottom,u.bottom),u.left=Ln(f.left,u.left),u},qI(t,s,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function E5(r){let{width:t,height:e}=jI(r);return{width:t,height:e}}function M5(r,t,e){let i=Ai(t),n=Ci(t),a=e==="fixed",o=Xo(r,!0,a,t),s={scrollLeft:0,scrollTop:0},l=Ti(0);function u(){l.x=jx(n)}if(i||!i&&!a)if((Wo(t)!=="body"||Ml(n))&&(s=af(t)),i){let p=Xo(t,!0,a,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else n&&u();a&&!i&&n&&u();let c=n&&!i&&!a?QI(n,s):Ti(0),f=o.left+s.scrollLeft-l.x-c.x,h=o.top+s.scrollTop-l.y-c.y;return{x:f,y:h,width:o.width,height:o.height}}function qx(r){return si(r).position==="static"}function $I(r,t){if(!Ai(r)||si(r).position==="fixed")return null;if(t)return t(r);let e=r.offsetParent;return Ci(r)===e&&(e=e.ownerDocument.body),e}function tL(r,t){let e=xr(r);if(nf(r))return e;if(!Ai(r)){let n=Nn(r);for(;n&&!Zo(n);){if(oi(n)&&!qx(n))return n;n=Nn(n)}return e}let i=$I(r,t);for(;i&&ZI(i)&&qx(i);)i=$I(i,t);return i&&Zo(i)&&qx(i)&&!Cv(i)?e:i||XI(r)||e}var O5=async function(r){let t=this.getOffsetParent||tL,e=this.getDimensions,i=await e(r.floating);return{reference:M5(r.reference,await t(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function I5(r){return si(r).direction==="rtl"}var L5={convertOffsetParentRelativeRectToViewportRelativeRect:x5,getDocumentElement:Ci,getClippingRect:D5,getOffsetParent:tL,getElementRects:O5,getClientRects:b5,getDimensions:E5,getScale:Ol,isElement:oi,isRTL:I5};function rL(r,t){return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height}function P5(r,t){let e=null,i,n=Ci(r);function a(){var s;clearTimeout(i),(s=e)==null||s.disconnect(),e=null}function o(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();let u=r.getBoundingClientRect(),{left:c,top:f,width:h,height:p}=u;if(s||t(),!h||!p)return;let d=ef(f),v=ef(n.clientWidth-(c+h)),m=ef(n.clientHeight-(f+p)),g=ef(c),_={rootMargin:-d+"px "+-v+"px "+-m+"px "+-g+"px",threshold:Ln(0,Dl(1,l))||1},x=!0;function b(S){let T=S[0].intersectionRatio;if(T!==l){if(!x)return o();T?o(!1,T):i=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!rL(u,r.getBoundingClientRect())&&o(),x=!1}try{e=new IntersectionObserver(b,{..._,root:n.ownerDocument})}catch{e=new IntersectionObserver(b,_)}e.observe(r)}return o(!0),a}function iL(r,t,e,i){i===void 0&&(i={});let{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,u=$x(r),c=n||a?[...u?El(u):[],...El(t)]:[];c.forEach(g=>{n&&g.addEventListener("scroll",e,{passive:!0}),a&&g.addEventListener("resize",e)});let f=u&&s?P5(u,e):null,h=-1,p=null;o&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),e()}),u&&!l&&p.observe(u),p.observe(t));let d,v=l?Xo(r):null;l&&m();function m(){let g=Xo(r);v&&!rL(v,g)&&e(),v=g,d=requestAnimationFrame(m)}return e(),()=>{var g;c.forEach(y=>{n&&y.removeEventListener("scroll",e),a&&y.removeEventListener("resize",e)}),f?.(),(g=p)==null||g.disconnect(),p=null,l&&cancelAnimationFrame(d)}}var nL=HI;var aL=GI,oL=UI;var sL=(r,t,e)=>{let i=new Map,n={platform:L5,...e},a={...n.platform,_c:i};return VI(r,t,{...n,platform:a})};function N5(){let r=document.querySelector('meta[name="csrf-token"]');return r?r.content:null}async function k5(r,t={}){let e={Accept:"text/html","X-Partial-Request":"true","X-Requested-With":"XMLHttpRequest"},i=t.method||"GET";if(i!=="GET"){let s=N5();s&&(e["X-CSRF-Token"]=s)}let n=await fetch(r,{method:i,headers:{...e,...t.headers},...t});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.text();return new DOMParser().parseFromString(a,"text/html")}function R5(r,t){for(;r.firstChild;)r.removeChild(r.firstChild);Array.from(t.childNodes).forEach(e=>{r.appendChild(e.cloneNode(!0))})}async function kn(r,t,e={}){let i=await k5(r,e),n=e.selector||`#${t.id}`,a=i.querySelector(n);if(a)return R5(t,a),!0;for(;t.firstChild;)t.removeChild(t.firstChild);return!1}var Ll,Pl,Ev,lL,Il=class extends xe{constructor(){super(...arguments);Ji(this,Ev);Ji(this,Ll,null);Ji(this,Pl,null)}initialize(){this.orient=this.orient.bind(this)}connect(){this.cleanup=iL(this.buttonTarget,this.menuTarget,this.orient)}disconnect(){clearTimeout(Bt(this,Ll)),clearTimeout(Bt(this,Pl)),this.cleanup()}show(t){t&&t.preventDefault(),this.menuTarget.showPopover({source:this.buttonTarget}),this.orient(),this.loadOperationDetailsIfNeeded()}hide(){this.menuTarget.hidePopover()}toggle(t){t.preventDefault(),this.menuTarget.togglePopover({source:this.buttonTarget}),this.orient(),this.loadOperationDetailsIfNeeded()}debouncedShow(){clearTimeout(Bt(this,Pl)),Yl(this,Ll,setTimeout(()=>this.show(),700))}debouncedHide(){clearTimeout(Bt(this,Ll)),Yl(this,Pl,setTimeout(()=>this.hide(),300))}orient(){sL(this.buttonTarget,this.menuTarget,Bt(this,Ev,lL)).then(({x:t,y:e})=>{this.menuTarget.style.setProperty("--popover-x",`${t}px`),this.menuTarget.style.setProperty("--popover-y",`${e}px`),this.menuTarget.classList.add("positioned")})}loadOperationDetailsIfNeeded(){let t=this.menuTarget.dataset.operationUrl;if(!t)return;let e=this.menuTarget.querySelector("[data-operation-url]");!e||e.dataset.loaded||!this.hasLoadingContent(e)||kn(t,e).then(()=>{e.dataset.loaded="true"}).catch(n=>console.error("Popover details fetch error:",n))}hasLoadingContent(t){return(t.textContent||"").includes("Loading operation details")}};Ll=new WeakMap,Pl=new WeakMap,Ev=new WeakSet,lL=function(){return{placement:this.placementValue,middleware:[nL(4),oL(),aL({padding:4})]}},se(Il,"targets",["button","menu"]),se(Il,"values",{placement:{type:String,default:"top"}});var of=class extends xe{constructor(){super(...arguments);se(this,"deploymentMarkerSeriesId","rails-pulse-deployment-markers")}connect(){this.initializeChart(),this.handleColorSchemeChange=this.onColorSchemeChange.bind(this),this.handleSeriesToggle=this.onSeriesToggle.bind(this),this.handleDeploymentMarkersToggle=this.onDeploymentMarkersToggle.bind(this),document.addEventListener("rails-pulse:color-scheme-changed",this.handleColorSchemeChange),document.addEventListener("rails-pulse:toggle-series",this.handleSeriesToggle),document.addEventListener("rails-pulse:toggle-deployment-markers",this.handleDeploymentMarkersToggle)}disconnect(){document.removeEventListener("rails-pulse:color-scheme-changed",this.handleColorSchemeChange),document.removeEventListener("rails-pulse:toggle-series",this.handleSeriesToggle),document.removeEventListener("rails-pulse:toggle-deployment-markers",this.handleDeploymentMarkersToggle),this.disposeChart()}initializeChart(){this.retryCount=0,this.maxRetries=100,this.attemptInit()}attemptInit(){if(typeof echarts>"u"){if(this.retryCount++,this.retryCount>=this.maxRetries){console.error("[RailsPulse] echarts not loaded after 5 seconds for",this.element.id),this.showError();return}setTimeout(()=>this.attemptInit(),50);return}this.renderChart()}renderChart(){try{this.chart=echarts.init(this.element,this.themeValue||"railspulse");let t=this.buildChartConfig();this.chart.setOption(t),this.applyColorScheme(),document.dispatchEvent(new CustomEvent("stimulus:echarts:rendered",{detail:{containerId:this.element.id,chart:this.chart,controller:this}})),this.resizeObserver=new ResizeObserver(()=>{this.chart&&this.chart.resize()}),this.resizeObserver.observe(this.element),this.chart.on("legendselectchanged",e=>{this.handleLegendToggle(e)}),this.chart.on("click",e=>{e.componentType==="markLine"&&e.name&&navigator.clipboard.writeText(e.name).then(()=>{this.showCopiedToast(e.name)}).catch(()=>{})}),this.element.setAttribute("data-chart-rendered","true")}catch(t){console.error("[RailsPulse] Error initializing chart:",t),this.showError()}}buildChartConfig(){let t={...this.optionsValue};if(this.processFormatters(t),this.setChartData(t),!t.legend){let n=document.querySelectorAll(`[data-rails-pulse--series-toggle-chart-id-value="${this.element.id}"]`),a={};n.forEach(s=>{let l=s.getAttribute("data-rails-pulse--series-toggle-series-name-value");l&&(a[l]=s.dataset.active!=="false")});let o={};t.series&&Array.isArray(t.series)&&t.series.forEach(s=>{s.name&&(o[s.name]=s.name in a?a[s.name]:!0)}),t.legend={show:!1,selected:o}}let e=this.dataValue,i=e.deployment_markers;if(i&&i.length>0&&this._usesTimeAxisData(e)){let a=(this.element.closest('[data-controller~="rails-pulse--index"]')||document).querySelector('[data-controller~="rails-pulse--deployment-markers-toggle"]'),o=!a||a.dataset.active!=="false";t.series=t.series||[],t.series.push(this._buildDeploymentMarkerSeries(i,o))}return t}setChartData(t){let e=this.dataValue;if(e&&typeof e=="object"&&e.series){let i=e.series[0]?.data?.[0],n=Array.isArray(i)||Array.isArray(i?.value);t.xAxis=t.xAxis||{},n?t.xAxis.type="time":(t.xAxis.type="category",t.xAxis.data=e.labels),t.yAxis=t.yAxis||{},t.yAxis.type="value";let a=t.series&&!Array.isArray(t.series)?t.series:{};t.series=e.series.map(o=>({type:this.typeValue,...a,...o}))}else{let i=Object.keys(e).map(a=>{let o=Number(a);return isNaN(o)?a:o}),n=Object.values(e).map(a=>{if(typeof a=="object"&&a!==null){if(a.value!==void 0){let o=Object.keys(a);return o.length>1||o.length===1&&o[0]!=="value"?a:a.value}return a}return a});if(t.xAxis=t.xAxis||{},t.xAxis.type="category",t.xAxis.data=i,t.yAxis=t.yAxis||{},t.yAxis.type="value",Array.isArray(t.series))t.series[0]=t.series[0]||{},t.series[0].type=this.typeValue,t.series[0].data=n;else if(t.series&&typeof t.series=="object"){let a={...t.series};t.series=[{type:this.typeValue,data:n,...a}]}else t.series=[{type:this.typeValue,data:n}]}}_usesTimeAxisData(t=this.dataValue){let e=t?.series?.find(i=>Array.isArray(i?.data)&&i.data.length>0)?.data?.[0];return Array.isArray(e)||Array.isArray(e?.value)}_buildDeploymentMarkerSeries(t,e=!0){return{id:this.deploymentMarkerSeriesId,type:"line",data:[],name:"",showSymbol:!1,symbolSize:0,silent:!1,animation:!1,legendHoverLink:!1,lineStyle:{opacity:0},itemStyle:{opacity:0},tooltip:{show:!1},z:10,markLine:e?this._buildMarkLineConfig(t):{data:[]}}}_buildMarkLineConfig(t){let e=a=>{let o=a?.data?.xAxis,s=a?.data?.revision;if(typeof o!="number")return"";let l=new Date(o).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return s?`{time|${l}}
28
+ `}}function oe(){e.calendarContainer.classList.add("hasWeeks");var C=Fe("div","flatpickr-weekwrapper");C.appendChild(Fe("span","flatpickr-weekday",e.l10n.weekAbbreviation));var D=Fe("div","flatpickr-weeks");return C.appendChild(D),{weekWrapper:C,weekNumbers:D}}function ie(C,D){D===void 0&&(D=!0);var P=D?C:C-e.currentMonth;P<0&&e._hidePrevMonthArrow===!0||P>0&&e._hideNextMonthArrow===!0||(e.currentMonth+=P,(e.currentMonth<0||e.currentMonth>11)&&(e.currentYear+=e.currentMonth>11?1:-1,e.currentMonth=(e.currentMonth+12)%12,tt("onYearChange"),I()),L(),tt("onMonthChange"),vf())}function pe(C,D){if(C===void 0&&(C=!0),D===void 0&&(D=!0),e.input.value="",e.altInput!==void 0&&(e.altInput.value=""),e.mobileInput!==void 0&&(e.mobileInput.value=""),e.selectedDates=[],e.latestSelectedDateObj=void 0,D===!0&&(e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth()),e.config.enableTime===!0){var P=xv(e.config),R=P.hours,X=P.minutes,Q=P.seconds;p(R,X,Q)}e.redraw(),C&&tt("onChange")}function de(){e.isOpen=!1,e.isMobile||(e.calendarContainer!==void 0&&e.calendarContainer.classList.remove("open"),e._input!==void 0&&e._input.classList.remove("active")),tt("onClose")}function te(){e.config!==void 0&&tt("onDestroy");for(var C=e._handlers.length;C--;)e._handlers[C].remove();if(e._handlers=[],e.mobileInput)e.mobileInput.parentNode&&e.mobileInput.parentNode.removeChild(e.mobileInput),e.mobileInput=void 0;else if(e.calendarContainer&&e.calendarContainer.parentNode)if(e.config.static&&e.calendarContainer.parentNode){var D=e.calendarContainer.parentNode;if(D.lastChild&&D.removeChild(D.lastChild),D.parentNode){for(;D.firstChild;)D.parentNode.insertBefore(D.firstChild,D);D.parentNode.removeChild(D)}}else e.calendarContainer.parentNode.removeChild(e.calendarContainer);e.altInput&&(e.input.type="text",e.altInput.parentNode&&e.altInput.parentNode.removeChild(e.altInput),delete e.altInput),e.input&&(e.input.type=e.input._type,e.input.classList.remove("flatpickr-input"),e.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(function(P){try{delete e[P]}catch{}})}function Te(C){return e.calendarContainer.contains(C)}function Pe(C){if(e.isOpen&&!e.config.inline){var D=gr(C),P=Te(D),R=D===e.input||D===e.altInput||e.element.contains(D)||C.path&&C.path.indexOf&&(~C.path.indexOf(e.input)||~C.path.indexOf(e.altInput)),X=!R&&!P&&!Te(C.relatedTarget),Q=!e.config.ignoredFocusElements.some(function(Me){return Me.contains(D)});X&&Q&&(e.config.allowInput&&e.setDate(e._input.value,!1,e.config.altInput?e.config.altFormat:e.config.dateFormat),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0&&e.input.value!==""&&e.input.value!==void 0&&l(),e.close(),e.config&&e.config.mode==="range"&&e.selectedDates.length===1&&e.clear(!1))}}function vt(C){if(!(!C||e.config.minDate&&C<e.config.minDate.getFullYear()||e.config.maxDate&&C>e.config.maxDate.getFullYear())){var D=C,P=e.currentYear!==D;e.currentYear=D||e.currentYear,e.config.maxDate&&e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth=Math.min(e.config.maxDate.getMonth(),e.currentMonth):e.config.minDate&&e.currentYear===e.config.minDate.getFullYear()&&(e.currentMonth=Math.max(e.config.minDate.getMonth(),e.currentMonth)),P&&(e.redraw(),tt("onYearChange"),I())}}function bt(C,D){var P;D===void 0&&(D=!0);var R=e.parseDate(C,void 0,D);if(e.config.minDate&&R&&yr(R,e.config.minDate,D!==void 0?D:!e.minDateHasTime)<0||e.config.maxDate&&R&&yr(R,e.config.maxDate,D!==void 0?D:!e.maxDateHasTime)>0)return!1;if(!e.config.enable&&e.config.disable.length===0)return!0;if(R===void 0)return!1;for(var X=!!e.config.enable,Q=(P=e.config.enable)!==null&&P!==void 0?P:e.config.disable,Me=0,le=void 0;Me<Q.length;Me++){if(le=Q[Me],typeof le=="function"&&le(R))return X;if(le instanceof Date&&R!==void 0&&le.getTime()===R.getTime())return X;if(typeof le=="string"){var Ne=e.parseDate(le,void 0,!0);return Ne&&Ne.getTime()===R.getTime()?X:!X}else if(typeof le=="object"&&R!==void 0&&le.from&&le.to&&R.getTime()>=le.from.getTime()&&R.getTime()<=le.to.getTime())return X}return!X}function ze(C){return e.daysContainer!==void 0?C.className.indexOf("hidden")===-1&&C.className.indexOf("flatpickr-disabled")===-1&&e.daysContainer.contains(C):!1}function ut(C){var D=C.target===e._input,P=e._input.value.trimEnd()!==Nv();D&&P&&!(C.relatedTarget&&Te(C.relatedTarget))&&e.setDate(e._input.value,!0,C.target===e.altInput?e.config.altFormat:e.config.dateFormat)}function Ce(C){var D=gr(C),P=e.config.wrap?r.contains(D):D===e._input,R=e.config.allowInput,X=e.isOpen&&(!R||!P),Q=e.config.inline&&P&&!R;if(C.keyCode===13&&P){if(R)return e.setDate(e._input.value,!0,D===e.altInput?e.config.altFormat:e.config.dateFormat),e.close(),D.blur();e.open()}else if(Te(D)||X||Q){var Me=!!e.timeContainer&&e.timeContainer.contains(D);switch(C.keyCode){case 13:Me?(C.preventDefault(),l(),Iv()):tb(C);break;case 27:C.preventDefault(),Iv();break;case 8:case 46:P&&!e.config.allowInput&&(C.preventDefault(),e.clear());break;case 37:case 39:if(!Me&&!P){C.preventDefault();var le=a();if(e.daysContainer!==void 0&&(R===!1||le&&ze(le))){var Ne=C.keyCode===39?1:-1;C.ctrlKey?(C.stopPropagation(),ie(Ne),M(A(1),0)):M(void 0,Ne)}}else e.hourElement&&e.hourElement.focus();break;case 38:case 40:C.preventDefault();var ae=C.keyCode===40?1:-1;e.daysContainer&&D.$i!==void 0||D===e.input||D===e.altInput?C.ctrlKey?(C.stopPropagation(),vt(e.currentYear-ae),M(A(1),0)):Me||M(void 0,ae*7):D===e.currentYearElement?vt(e.currentYear-ae):e.config.enableTime&&(!Me&&e.hourElement&&e.hourElement.focus(),l(C),e._debouncedChange());break;case 9:if(Me){var be=[e.hourElement,e.minuteElement,e.secondElement,e.amPM].concat(e.pluginElements).filter(function(br){return br}),Ye=be.indexOf(D);if(Ye!==-1){var Di=be[Ye+(C.shiftKey?-1:1)];C.preventDefault(),(Di||e._input).focus()}}else!e.config.noCalendar&&e.daysContainer&&e.daysContainer.contains(D)&&C.shiftKey&&(C.preventDefault(),e._input.focus());break;default:break}}if(e.amPM!==void 0&&D===e.amPM)switch(C.key){case e.l10n.amPM[0].charAt(0):case e.l10n.amPM[0].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[0],f(),ji();break;case e.l10n.amPM[1].charAt(0):case e.l10n.amPM[1].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[1],f(),ji();break}(P||Te(D))&&tt("onKeyDown",C)}function Ie(C,D){if(D===void 0&&(D="flatpickr-day"),!(e.selectedDates.length!==1||C&&(!C.classList.contains(D)||C.classList.contains("flatpickr-disabled")))){for(var P=C?C.dateObj.getTime():e.days.firstElementChild.dateObj.getTime(),R=e.parseDate(e.selectedDates[0],void 0,!0).getTime(),X=Math.min(P,e.selectedDates[0].getTime()),Q=Math.max(P,e.selectedDates[0].getTime()),Me=!1,le=0,Ne=0,ae=X;ae<Q;ae+=TI.DAY)bt(new Date(ae),!0)||(Me=Me||ae>X&&ae<Q,ae<R&&(!le||ae>le)?le=ae:ae>R&&(!Ne||ae<Ne)&&(Ne=ae));var be=Array.from(e.rContainer.querySelectorAll("*:nth-child(-n+"+e.config.showMonths+") > ."+D));be.forEach(function(Ye){var Di=Ye.dateObj,br=Di.getTime(),Gl=le>0&&br<le||Ne>0&&br>Ne;if(Gl){Ye.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Ko){Ye.classList.remove(Ko)});return}else if(Me&&!Gl)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Ko){Ye.classList.remove(Ko)}),C!==void 0&&(C.classList.add(P<=e.selectedDates[0].getTime()?"startRange":"endRange"),R<P&&br===R?Ye.classList.add("startRange"):R>P&&br===R&&Ye.classList.add("endRange"),br>=le&&(Ne===0||br<=Ne)&&SI(br,R,P)&&Ye.classList.add("inRange"))})}}function $i(){e.isOpen&&!e.config.static&&!e.config.inline&&pf()}function Nt(C,D){if(D===void 0&&(D=e._positionElement),e.isMobile===!0){if(C){C.preventDefault();var P=gr(C);P&&P.blur()}e.mobileInput!==void 0&&(e.mobileInput.focus(),e.mobileInput.click()),tt("onOpen");return}else if(e._input.disabled||e.config.inline)return;var R=e.isOpen;e.isOpen=!0,R||(e.calendarContainer.classList.add("open"),e._input.classList.add("active"),tt("onOpen"),pf(D)),e.config.enableTime===!0&&e.config.noCalendar===!0&&e.config.allowInput===!1&&(C===void 0||!e.timeContainer.contains(C.relatedTarget))&&setTimeout(function(){return e.hourElement.select()},50)}function Hl(C){return function(D){var P=e.config["_"+C+"Date"]=e.parseDate(D,e.config.dateFormat),R=e.config["_"+(C==="min"?"max":"min")+"Date"];P!==void 0&&(e[C==="min"?"minDateHasTime":"maxDateHasTime"]=P.getHours()>0||P.getMinutes()>0||P.getSeconds()>0),e.selectedDates&&(e.selectedDates=e.selectedDates.filter(function(X){return bt(X)}),!e.selectedDates.length&&C==="min"&&h(P),ji()),e.daysContainer&&(eb(),P!==void 0?e.currentYearElement[C]=P.getFullYear().toString():e.currentYearElement.removeAttribute(C),e.currentYearElement.disabled=!!R&&P!==void 0&&R.getFullYear()===P.getFullYear())}}function hf(){var C=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],D=Xt(Xt({},JSON.parse(JSON.stringify(r.dataset||{}))),t),P={};e.config.parseDate=D.parseDate,e.config.formatDate=D.formatDate,Object.defineProperty(e.config,"enable",{get:function(){return e.config._enable},set:function(be){e.config._enable=ib(be)}}),Object.defineProperty(e.config,"disable",{get:function(){return e.config._disable},set:function(be){e.config._disable=ib(be)}});var R=D.mode==="time";if(!D.dateFormat&&(D.enableTime||R)){var X=xt.defaultConfig.dateFormat||ya.dateFormat;P.dateFormat=D.noCalendar||R?"H:i"+(D.enableSeconds?":S":""):X+" H:i"+(D.enableSeconds?":S":"")}if(D.altInput&&(D.enableTime||R)&&!D.altFormat){var Q=xt.defaultConfig.altFormat||ya.altFormat;P.altFormat=D.noCalendar||R?"h:i"+(D.enableSeconds?":S K":" K"):Q+(" h:i"+(D.enableSeconds?":S":"")+" K")}Object.defineProperty(e.config,"minDate",{get:function(){return e.config._minDate},set:Hl("min")}),Object.defineProperty(e.config,"maxDate",{get:function(){return e.config._maxDate},set:Hl("max")});var Me=function(be){return function(Ye){e.config[be==="min"?"_minTime":"_maxTime"]=e.parseDate(Ye,"H:i:S")}};Object.defineProperty(e.config,"minTime",{get:function(){return e.config._minTime},set:Me("min")}),Object.defineProperty(e.config,"maxTime",{get:function(){return e.config._maxTime},set:Me("max")}),D.mode==="time"&&(e.config.noCalendar=!0,e.config.enableTime=!0),Object.assign(e.config,P,D);for(var le=0;le<C.length;le++)e.config[C[le]]=e.config[C[le]]===!0||e.config[C[le]]==="true";dv.filter(function(be){return e.config[be]!==void 0}).forEach(function(be){e.config[be]=gv(e.config[be]||[]).map(o)}),e.isMobile=!e.config.disableMobile&&!e.config.inline&&e.config.mode==="single"&&!e.config.disable.length&&!e.config.enable&&!e.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var le=0;le<e.config.plugins.length;le++){var Ne=e.config.plugins[le](e)||{};for(var ae in Ne)dv.indexOf(ae)>-1?e.config[ae]=gv(Ne[ae]).map(o).concat(e.config[ae]):typeof D[ae]>"u"&&(e.config[ae]=Ne[ae])}D.altInputClass||(e.config.altInputClass=Jx().className+" "+e.config.altInputClass),tt("onParseConfig")}function Jx(){return e.config.wrap?r.querySelector("[data-input]"):r}function Qx(){typeof e.config.locale!="object"&&typeof xt.l10ns[e.config.locale]>"u"&&e.config.errorHandler(new Error("flatpickr: invalid locale "+e.config.locale)),e.l10n=Xt(Xt({},xt.l10ns.default),typeof e.config.locale=="object"?e.config.locale:e.config.locale!=="default"?xt.l10ns[e.config.locale]:void 0),In.D="("+e.l10n.weekdays.shorthand.join("|")+")",In.l="("+e.l10n.weekdays.longhand.join("|")+")",In.M="("+e.l10n.months.shorthand.join("|")+")",In.F="("+e.l10n.months.longhand.join("|")+")",In.K="("+e.l10n.amPM[0]+"|"+e.l10n.amPM[1]+"|"+e.l10n.amPM[0].toLowerCase()+"|"+e.l10n.amPM[1].toLowerCase()+")";var C=Xt(Xt({},t),JSON.parse(JSON.stringify(r.dataset||{})));C.time_24hr===void 0&&xt.defaultConfig.time_24hr===void 0&&(e.config.time_24hr=e.l10n.time_24hr),e.formatDate=Hx(e),e.parseDate=yv({config:e.config,l10n:e.l10n})}function pf(C){if(typeof e.config.position=="function")return void e.config.position(e,C);if(e.calendarContainer!==void 0){tt("onPreCalendarPosition");var D=C||e._positionElement,P=Array.prototype.reduce.call(e.calendarContainer.children,(function(DL,EL){return DL+EL.offsetHeight}),0),R=e.calendarContainer.offsetWidth,X=e.config.position.split(" "),Q=X[0],Me=X.length>1?X[1]:null,le=D.getBoundingClientRect(),Ne=window.innerHeight-le.bottom,ae=Q==="above"||Q!=="below"&&Ne<P&&le.top>P,be=window.pageYOffset+le.top+(ae?-P-2:D.offsetHeight+2);if(Zt(e.calendarContainer,"arrowTop",!ae),Zt(e.calendarContainer,"arrowBottom",ae),!e.config.inline){var Ye=window.pageXOffset+le.left,Di=!1,br=!1;Me==="center"?(Ye-=(R-le.width)/2,Di=!0):Me==="right"&&(Ye-=R-le.width,br=!0),Zt(e.calendarContainer,"arrowLeft",!Di&&!br),Zt(e.calendarContainer,"arrowCenter",Di),Zt(e.calendarContainer,"arrowRight",br);var Gl=window.document.body.offsetWidth-(window.pageXOffset+le.right),Ko=Ye+R>window.document.body.offsetWidth,xL=Gl+R>window.document.body.offsetWidth;if(Zt(e.calendarContainer,"rightMost",Ko),!e.config.static)if(e.calendarContainer.style.top=be+"px",!Ko)e.calendarContainer.style.left=Ye+"px",e.calendarContainer.style.right="auto";else if(!xL)e.calendarContainer.style.left="auto",e.calendarContainer.style.right=Gl+"px";else{var kv=uL();if(kv===void 0)return;var bL=window.document.body.offsetWidth,SL=Math.max(0,bL/2-R/2),wL=".flatpickr-calendar.centerMost:before",TL=".flatpickr-calendar.centerMost:after",CL=kv.cssRules.length,AL="{left:"+le.left+"px;right:auto;}";Zt(e.calendarContainer,"rightMost",!1),Zt(e.calendarContainer,"centerMost",!0),kv.insertRule(wL+","+TL+AL,CL),e.calendarContainer.style.left=SL+"px",e.calendarContainer.style.right="auto"}}}}function uL(){for(var C=null,D=0;D<document.styleSheets.length;D++){var P=document.styleSheets[D];if(P.cssRules){try{P.cssRules}catch{continue}C=P;break}}return C??cL()}function cL(){var C=document.createElement("style");return document.head.appendChild(C),C.sheet}function eb(){e.config.noCalendar||e.isMobile||(I(),vf(),L())}function Iv(){e._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(e.close,0):e.close()}function tb(C){C.preventDefault(),C.stopPropagation();var D=function(be){return be.classList&&be.classList.contains("flatpickr-day")&&!be.classList.contains("flatpickr-disabled")&&!be.classList.contains("notAllowed")},P=Vx(gr(C),D);if(P!==void 0){var R=P,X=e.latestSelectedDateObj=new Date(R.dateObj.getTime()),Q=(X.getMonth()<e.currentMonth||X.getMonth()>e.currentMonth+e.config.showMonths-1)&&e.config.mode!=="range";if(e.selectedDateElem=R,e.config.mode==="single")e.selectedDates=[X];else if(e.config.mode==="multiple"){var Me=Pv(X);Me?e.selectedDates.splice(parseInt(Me),1):e.selectedDates.push(X)}else e.config.mode==="range"&&(e.selectedDates.length===2&&e.clear(!1,!1),e.latestSelectedDateObj=X,e.selectedDates.push(X),yr(X,e.selectedDates[0],!0)!==0&&e.selectedDates.sort(function(be,Ye){return be.getTime()-Ye.getTime()}));if(f(),Q){var le=e.currentYear!==X.getFullYear();e.currentYear=X.getFullYear(),e.currentMonth=X.getMonth(),le&&(tt("onYearChange"),I()),tt("onMonthChange")}if(vf(),L(),ji(),!Q&&e.config.mode!=="range"&&e.config.showMonths===1?T(R):e.selectedDateElem!==void 0&&e.hourElement===void 0&&e.selectedDateElem&&e.selectedDateElem.focus(),e.hourElement!==void 0&&e.hourElement!==void 0&&e.hourElement.focus(),e.config.closeOnSelect){var Ne=e.config.mode==="single"&&!e.config.enableTime,ae=e.config.mode==="range"&&e.selectedDates.length===2&&!e.config.enableTime;(Ne||ae)&&Iv()}m()}}var df={locale:[Qx,$],showMonths:[z,s,G],minDate:[y],maxDate:[y],positionElement:[nb],clickOpens:[function(){e.config.clickOpens===!0?(v(e._input,"focus",e.open),v(e._input,"click",e.open)):(e._input.removeEventListener("focus",e.open),e._input.removeEventListener("click",e.open))}]};function fL(C,D){if(C!==null&&typeof C=="object"){Object.assign(e.config,C);for(var P in C)df[P]!==void 0&&df[P].forEach(function(R){return R()})}else e.config[C]=D,df[C]!==void 0?df[C].forEach(function(R){return R()}):dv.indexOf(C)>-1&&(e.config[C]=gv(D));e.redraw(),ji(!0)}function rb(C,D){var P=[];if(C instanceof Array)P=C.map(function(R){return e.parseDate(R,D)});else if(C instanceof Date||typeof C=="number")P=[e.parseDate(C,D)];else if(typeof C=="string")switch(e.config.mode){case"single":case"time":P=[e.parseDate(C,D)];break;case"multiple":P=C.split(e.config.conjunction).map(function(R){return e.parseDate(R,D)});break;case"range":P=C.split(e.l10n.rangeSeparator).map(function(R){return e.parseDate(R,D)});break;default:break}else e.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(C)));e.selectedDates=e.config.allowInvalidPreload?P:P.filter(function(R){return R instanceof Date&&bt(R,!1)}),e.config.mode==="range"&&e.selectedDates.sort(function(R,X){return R.getTime()-X.getTime()})}function hL(C,D,P){if(D===void 0&&(D=!1),P===void 0&&(P=e.config.dateFormat),C!==0&&!C||C instanceof Array&&C.length===0)return e.clear(D);rb(C,P),e.latestSelectedDateObj=e.selectedDates[e.selectedDates.length-1],e.redraw(),y(void 0,D),h(),e.selectedDates.length===0&&e.clear(!1),ji(D),D&&tt("onChange")}function ib(C){return C.slice().map(function(D){return typeof D=="string"||typeof D=="number"||D instanceof Date?e.parseDate(D,void 0,!0):D&&typeof D=="object"&&D.from&&D.to?{from:e.parseDate(D.from,void 0),to:e.parseDate(D.to,void 0)}:D}).filter(function(D){return D})}function pL(){e.selectedDates=[],e.now=e.parseDate(e.config.now)||new Date;var C=e.config.defaultDate||((e.input.nodeName==="INPUT"||e.input.nodeName==="TEXTAREA")&&e.input.placeholder&&e.input.value===e.input.placeholder?null:e.input.value);C&&rb(C,e.config.dateFormat),e._initialDate=e.selectedDates.length>0?e.selectedDates[0]:e.config.minDate&&e.config.minDate.getTime()>e.now.getTime()?e.config.minDate:e.config.maxDate&&e.config.maxDate.getTime()<e.now.getTime()?e.config.maxDate:e.now,e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth(),e.selectedDates.length>0&&(e.latestSelectedDateObj=e.selectedDates[0]),e.config.minTime!==void 0&&(e.config.minTime=e.parseDate(e.config.minTime,"H:i")),e.config.maxTime!==void 0&&(e.config.maxTime=e.parseDate(e.config.maxTime,"H:i")),e.minDateHasTime=!!e.config.minDate&&(e.config.minDate.getHours()>0||e.config.minDate.getMinutes()>0||e.config.minDate.getSeconds()>0),e.maxDateHasTime=!!e.config.maxDate&&(e.config.maxDate.getHours()>0||e.config.maxDate.getMinutes()>0||e.config.maxDate.getSeconds()>0)}function dL(){if(e.input=Jx(),!e.input){e.config.errorHandler(new Error("Invalid input element specified"));return}e.input._type=e.input.type,e.input.type="text",e.input.classList.add("flatpickr-input"),e._input=e.input,e.config.altInput&&(e.altInput=Fe(e.input.nodeName,e.config.altInputClass),e._input=e.altInput,e.altInput.placeholder=e.input.placeholder,e.altInput.disabled=e.input.disabled,e.altInput.required=e.input.required,e.altInput.tabIndex=e.input.tabIndex,e.altInput.type="text",e.input.setAttribute("type","hidden"),!e.config.static&&e.input.parentNode&&e.input.parentNode.insertBefore(e.altInput,e.input.nextSibling)),e.config.allowInput||e._input.setAttribute("readonly","readonly"),nb()}function nb(){e._positionElement=e.config.positionElement||e._input}function vL(){var C=e.config.enableTime?e.config.noCalendar?"time":"datetime-local":"date";e.mobileInput=Fe("input",e.input.className+" flatpickr-mobile"),e.mobileInput.tabIndex=1,e.mobileInput.type=C,e.mobileInput.disabled=e.input.disabled,e.mobileInput.required=e.input.required,e.mobileInput.placeholder=e.input.placeholder,e.mobileFormatStr=C==="datetime-local"?"Y-m-d\\TH:i:S":C==="date"?"Y-m-d":"H:i:S",e.selectedDates.length>0&&(e.mobileInput.defaultValue=e.mobileInput.value=e.formatDate(e.selectedDates[0],e.mobileFormatStr)),e.config.minDate&&(e.mobileInput.min=e.formatDate(e.config.minDate,"Y-m-d")),e.config.maxDate&&(e.mobileInput.max=e.formatDate(e.config.maxDate,"Y-m-d")),e.input.getAttribute("step")&&(e.mobileInput.step=String(e.input.getAttribute("step"))),e.input.type="hidden",e.altInput!==void 0&&(e.altInput.type="hidden");try{e.input.parentNode&&e.input.parentNode.insertBefore(e.mobileInput,e.input.nextSibling)}catch{}v(e.mobileInput,"change",function(D){e.setDate(gr(D).value,!1,e.mobileFormatStr),tt("onChange"),tt("onClose")})}function mL(C){if(e.isOpen===!0)return e.close();e.open(C)}function tt(C,D){if(e.config!==void 0){var P=e.config[C];if(P!==void 0&&P.length>0)for(var R=0;P[R]&&R<P.length;R++)P[R](e.selectedDates,e.input.value,e,D);C==="onChange"&&(e.input.dispatchEvent(Lv("change")),e.input.dispatchEvent(Lv("input")))}}function Lv(C){var D=document.createEvent("Event");return D.initEvent(C,!0,!0),D}function Pv(C){for(var D=0;D<e.selectedDates.length;D++){var P=e.selectedDates[D];if(P instanceof Date&&yr(P,C)===0)return""+D}return!1}function gL(C){return e.config.mode!=="range"||e.selectedDates.length<2?!1:yr(C,e.selectedDates[0])>=0&&yr(C,e.selectedDates[1])<=0}function vf(){e.config.noCalendar||e.isMobile||!e.monthNav||(e.yearElements.forEach(function(C,D){var P=new Date(e.currentYear,e.currentMonth,1);P.setMonth(e.currentMonth+D),e.config.showMonths>1||e.config.monthSelectorType==="static"?e.monthElements[D].textContent=$c(P.getMonth(),e.config.shorthandCurrentMonth,e.l10n)+" ":e.monthsDropdownContainer.value=P.getMonth().toString(),C.value=P.getFullYear().toString()}),e._hidePrevMonthArrow=e.config.minDate!==void 0&&(e.currentYear===e.config.minDate.getFullYear()?e.currentMonth<=e.config.minDate.getMonth():e.currentYear<e.config.minDate.getFullYear()),e._hideNextMonthArrow=e.config.maxDate!==void 0&&(e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth+1>e.config.maxDate.getMonth():e.currentYear>e.config.maxDate.getFullYear()))}function Nv(C){var D=C||(e.config.altInput?e.config.altFormat:e.config.dateFormat);return e.selectedDates.map(function(P){return e.formatDate(P,D)}).filter(function(P,R,X){return e.config.mode!=="range"||e.config.enableTime||X.indexOf(P)===R}).join(e.config.mode!=="range"?e.config.conjunction:e.l10n.rangeSeparator)}function ji(C){C===void 0&&(C=!0),e.mobileInput!==void 0&&e.mobileFormatStr&&(e.mobileInput.value=e.latestSelectedDateObj!==void 0?e.formatDate(e.latestSelectedDateObj,e.mobileFormatStr):""),e.input.value=Nv(e.config.dateFormat),e.altInput!==void 0&&(e.altInput.value=Nv(e.config.altFormat)),C!==!1&&tt("onValueUpdate")}function yL(C){var D=gr(C),P=e.prevMonthNav.contains(D),R=e.nextMonthNav.contains(D);P||R?ie(P?-1:1):e.yearElements.indexOf(D)>=0?D.select():D.classList.contains("arrowUp")?e.changeYear(e.currentYear+1):D.classList.contains("arrowDown")&&e.changeYear(e.currentYear-1)}function _L(C){C.preventDefault();var D=C.type==="keydown",P=gr(C),R=P;e.amPM!==void 0&&P===e.amPM&&(e.amPM.textContent=e.l10n.amPM[mr(e.amPM.textContent===e.l10n.amPM[0])]);var X=parseFloat(R.getAttribute("min")),Q=parseFloat(R.getAttribute("max")),Me=parseFloat(R.getAttribute("step")),le=parseInt(R.value,10),Ne=C.delta||(D?C.which===38?1:-1:0),ae=le+Me*Ne;if(typeof R.value<"u"&&R.value.length===2){var be=R===e.hourElement,Ye=R===e.minuteElement;ae<X?(ae=Q+ae+mr(!be)+(mr(be)&&mr(!e.amPM)),Ye&&x(void 0,-1,e.hourElement)):ae>Q&&(ae=R===e.hourElement?ae-Q-mr(!e.amPM):X,Ye&&x(void 0,1,e.hourElement)),e.amPM&&be&&(Me===1?ae+le===23:Math.abs(ae-le)>Me)&&(e.amPM.textContent=e.l10n.amPM[mr(e.amPM.textContent===e.l10n.amPM[0])]),R.value=Wt(ae)}}return n(),e}function wl(r,t){for(var e=Array.prototype.slice.call(r).filter(function(o){return o instanceof HTMLElement}),i=[],n=0;n<e.length;n++){var a=e[n];try{if(a.getAttribute("data-fp-omit")!==null)continue;a._flatpickr!==void 0&&(a._flatpickr.destroy(),a._flatpickr=void 0),a._flatpickr=t5(a,t||{}),i.push(a._flatpickr)}catch(o){console.error(o)}}return i.length===1?i[0]:i}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(r){return wl(this,r)},HTMLElement.prototype.flatpickr=function(r){return wl([this],r)});var xt=function(r,t){return typeof r=="string"?wl(window.document.querySelectorAll(r),t):r instanceof Node?wl([r],t):wl(r,t)};xt.defaultConfig={};xt.l10ns={en:Xt({},mv),default:Xt({},mv)};xt.localize=function(r){xt.l10ns.default=Xt(Xt({},xt.l10ns.default),r)};xt.setDefaults=function(r){xt.defaultConfig=Xt(Xt({},xt.defaultConfig),r)};xt.parseDate=yv({});xt.formatDate=Hx({});xt.compareDates=yr;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(r){return wl(this,r)});Date.prototype.fp_incr=function(r){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof r=="string"?parseInt(r,10):r))};typeof window<"u"&&(window.flatpickr=xt);var bv=xt;var wi,AI,DI,EI,Gx,Tl=class extends xe{constructor(){super(...arguments);Ji(this,wi)}connect(){this.typeValue=="time"?this.flatpickr=bv(this.element,Bt(this,wi,AI)):this.typeValue=="datetime"?this.flatpickr=bv(this.element,Bt(this,wi,DI)):this.flatpickr=bv(this.element,Bt(this,wi,EI))}disconnect(){this.flatpickr.destroy()}};wi=new WeakSet,AI=function(){return{dateFormat:"H:i",enableTime:!0,noCalendar:!0}},DI=function(){return{...Bt(this,wi,Gx),altFormat:this.dateTimeFormatValue,dateFormat:"Y-m-d H:i",enableTime:!0}},EI=function(){return{...Bt(this,wi,Gx),altFormat:this.dateFormatValue,dateFormat:"Y-m-d"}},Gx=function(){return{altInput:!0,disable:this.disableValue,mode:this.modeValue,showMonths:this.showMonthsValue}},se(Tl,"targets",["details"]),se(Tl,"values",{type:String,disable:Array,mode:{type:String,default:"single"},showMonths:{type:Number,default:1},dateFormat:{type:String,default:"F d, Y"},dateTimeFormat:{type:String,default:"M d, Y h:i K"}});var jc=class extends xe{show(){this.menuTarget.show()}showModal(){this.menuTarget.showModal()}close(){this.menuTarget.close()}closeOnClickOutside({target:r}){r.nodeName==="DIALOG"&&this.close()}};se(jc,"targets",["menu"]);var Al,_r,MI,Sv,OI,II,LI,Cl=class extends xe{constructor(){super(...arguments);Ji(this,_r);Ji(this,Al)}initialize(){Yl(this,Al,new IntersectionObserver(xa(this,_r,MI).bind(this)))}connect(){Bt(this,Al).observe(this.element)}disconnect(){Bt(this,Al).disconnect()}prev(){this.indexValue>0&&(this.indexValue--,xa(this,_r,Sv).call(this))}next(){this.indexValue<Bt(this,_r,LI)&&(this.indexValue++,xa(this,_r,Sv).call(this))}};Al=new WeakMap,_r=new WeakSet,MI=function([t]){t.isIntersecting&&(this.indexValue=0,xa(this,_r,Sv).call(this))},Sv=function(){xa(this,_r,OI).call(this),xa(this,_r,II).call(this)},OI=function(){this.itemTargets.forEach((t,e)=>{t.tabIndex=e===this.indexValue?0:-1})},II=function(){this.itemTargets[this.indexValue].focus()},LI=function(){return this.itemTargets.length-1},se(Cl,"targets",["item"]),se(Cl,"values",{index:Number});var Dl=Math.min,Ln=Math.max,Qc=Math.round,ef=Math.floor,Ti=r=>({x:r,y:r}),r5={left:"right",right:"left",bottom:"top",top:"bottom"},i5={start:"end",end:"start"};function Yx(r,t,e){return Ln(r,Dl(t,e))}function tf(r,t){return typeof r=="function"?r(t):r}function _a(r){return r.split("-")[0]}function rf(r){return r.split("-")[1]}function Wx(r){return r==="x"?"y":"x"}function Zx(r){return r==="y"?"height":"width"}var n5=new Set(["top","bottom"]);function Pn(r){return n5.has(_a(r))?"y":"x"}function Xx(r){return Wx(Pn(r))}function kI(r,t,e){e===void 0&&(e=!1);let i=rf(r),n=Xx(r),a=Zx(n),o=n==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=Jc(o)),[o,Jc(o)]}function RI(r){let t=Jc(r);return[wv(r),t,wv(t)]}function wv(r){return r.replace(/start|end/g,t=>i5[t])}var PI=["left","right"],NI=["right","left"],a5=["top","bottom"],o5=["bottom","top"];function s5(r,t,e){switch(r){case"top":case"bottom":return e?t?NI:PI:t?PI:NI;case"left":case"right":return t?a5:o5;default:return[]}}function FI(r,t,e,i){let n=rf(r),a=s5(_a(r),e==="start",i);return n&&(a=a.map(o=>o+"-"+n),t&&(a=a.concat(a.map(wv)))),a}function Jc(r){return r.replace(/left|right|bottom|top/g,t=>r5[t])}function l5(r){return{top:0,right:0,bottom:0,left:0,...r}}function BI(r){return typeof r!="number"?l5(r):{top:r,right:r,bottom:r,left:r}}function Yo(r){let{x:t,y:e,width:i,height:n}=r;return{width:i,height:n,top:e,left:t,right:t+i,bottom:e+n,x:t,y:e}}function zI(r,t,e){let{reference:i,floating:n}=r,a=Pn(t),o=Xx(t),s=Zx(o),l=_a(t),u=a==="y",c=i.x+i.width/2-n.width/2,f=i.y+i.height/2-n.height/2,h=i[s]/2-n[s]/2,p;switch(l){case"top":p={x:c,y:i.y-n.height};break;case"bottom":p={x:c,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:f};break;case"left":p={x:i.x-n.width,y:f};break;default:p={x:i.x,y:i.y}}switch(rf(t)){case"start":p[o]-=h*(e&&u?-1:1);break;case"end":p[o]+=h*(e&&u?-1:1);break}return p}var VI=async(r,t,e)=>{let{placement:i="bottom",strategy:n="absolute",middleware:a=[],platform:o}=e,s=a.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t)),u=await o.getElementRects({reference:r,floating:t,strategy:n}),{x:c,y:f}=zI(u,i,l),h=i,p={},d=0;for(let v=0;v<s.length;v++){let{name:m,fn:g}=s[v],{x:y,y:_,data:x,reset:b}=await g({x:c,y:f,initialPlacement:i,placement:h,strategy:n,middlewareData:p,rects:u,platform:o,elements:{reference:r,floating:t}});c=y??c,f=_??f,p={...p,[m]:{...p[m],...x}},b&&d<=50&&(d++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(u=b.rects===!0?await o.getElementRects({reference:r,floating:t,strategy:n}):b.rects),{x:c,y:f}=zI(u,h,l)),v=-1)}return{x:c,y:f,placement:h,strategy:n,middlewareData:p}};async function Kx(r,t){var e;t===void 0&&(t={});let{x:i,y:n,platform:a,rects:o,elements:s,strategy:l}=r,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=tf(t,r),d=BI(p),m=s[h?f==="floating"?"reference":"floating":f],g=Yo(await a.getClippingRect({element:(e=await(a.isElement==null?void 0:a.isElement(m)))==null||e?m:m.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),y=f==="floating"?{x:i,y:n,width:o.floating.width,height:o.floating.height}:o.reference,_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),x=await(a.isElement==null?void 0:a.isElement(_))?await(a.getScale==null?void 0:a.getScale(_))||{x:1,y:1}:{x:1,y:1},b=Yo(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:_,strategy:l}):y);return{top:(g.top-b.top+d.top)/x.y,bottom:(b.bottom-g.bottom+d.bottom)/x.y,left:(g.left-b.left+d.left)/x.x,right:(b.right-g.right+d.right)/x.x}}var UI=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(t){var e,i;let{placement:n,middlewareData:a,rects:o,initialPlacement:s,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:v=!0,...m}=tf(r,t);if((e=a.arrow)!=null&&e.alignmentOffset)return{};let g=_a(n),y=Pn(s),_=_a(s)===s,x=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=h||(_||!v?[Jc(s)]:RI(s)),S=d!=="none";!h&&S&&b.push(...FI(s,v,d,x));let T=[s,...b],A=await Kx(t,m),E=[],M=((i=a.flip)==null?void 0:i.overflows)||[];if(c&&E.push(A[g]),f){let k=kI(n,o,x);E.push(A[k[0]],A[k[1]])}if(M=[...M,{placement:n,overflows:E}],!E.every(k=>k<=0)){var O,L;let k=(((O=a.flip)==null?void 0:O.index)||0)+1,z=T[k];if(z&&(!(f==="alignment"?y!==Pn(z):!1)||M.every(G=>G.overflows[0]>0&&Pn(G.placement)===y)))return{data:{index:k,overflows:M},reset:{placement:z}};let V=(L=M.filter(q=>q.overflows[0]<=0).sort((q,G)=>q.overflows[1]-G.overflows[1])[0])==null?void 0:L.placement;if(!V)switch(p){case"bestFit":{var I;let q=(I=M.filter(G=>{if(S){let $=Pn(G.placement);return $===y||$==="y"}return!0}).map(G=>[G.placement,G.overflows.filter($=>$>0).reduce(($,oe)=>$+oe,0)]).sort((G,$)=>G[1]-$[1])[0])==null?void 0:I[0];q&&(V=q);break}case"initialPlacement":V=s;break}if(n!==V)return{reset:{placement:V}}}return{}}}};var u5=new Set(["left","top"]);async function c5(r,t){let{placement:e,platform:i,elements:n}=r,a=await(i.isRTL==null?void 0:i.isRTL(n.floating)),o=_a(e),s=rf(e),l=Pn(e)==="y",u=u5.has(o)?-1:1,c=a&&l?-1:1,f=tf(t,r),{mainAxis:h,crossAxis:p,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof d=="number"&&(p=s==="end"?d*-1:d),l?{x:p*c,y:h*u}:{x:h*u,y:p*c}}var HI=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(t){var e,i;let{x:n,y:a,placement:o,middlewareData:s}=t,l=await c5(t,r);return o===((e=s.offset)==null?void 0:e.placement)&&(i=s.arrow)!=null&&i.alignmentOffset?{}:{x:n+l.x,y:a+l.y,data:{...l,placement:o}}}}},GI=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(t){let{x:e,y:i,placement:n}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:m=>{let{x:g,y}=m;return{x:g,y}}},...l}=tf(r,t),u={x:e,y:i},c=await Kx(t,l),f=Pn(_a(n)),h=Wx(f),p=u[h],d=u[f];if(a){let m=h==="y"?"top":"left",g=h==="y"?"bottom":"right",y=p+c[m],_=p-c[g];p=Yx(y,p,_)}if(o){let m=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=d+c[m],_=d-c[g];d=Yx(y,d,_)}let v=s.fn({...t,[h]:p,[f]:d});return{...v,data:{x:v.x-e,y:v.y-i,enabled:{[h]:a,[f]:o}}}}}};function Tv(){return typeof window<"u"}function Wo(r){return WI(r)?(r.nodeName||"").toLowerCase():"#document"}function xr(r){var t;return(r==null||(t=r.ownerDocument)==null?void 0:t.defaultView)||window}function Ci(r){var t;return(t=(WI(r)?r.ownerDocument:r.document)||window.document)==null?void 0:t.documentElement}function WI(r){return Tv()?r instanceof Node||r instanceof xr(r).Node:!1}function oi(r){return Tv()?r instanceof Element||r instanceof xr(r).Element:!1}function Ai(r){return Tv()?r instanceof HTMLElement||r instanceof xr(r).HTMLElement:!1}function YI(r){return!Tv()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof xr(r).ShadowRoot}var f5=new Set(["inline","contents"]);function Ml(r){let{overflow:t,overflowX:e,overflowY:i,display:n}=si(r);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!f5.has(n)}var h5=new Set(["table","td","th"]);function ZI(r){return h5.has(Wo(r))}var p5=[":popover-open",":modal"];function nf(r){return p5.some(t=>{try{return r.matches(t)}catch{return!1}})}var d5=["transform","translate","scale","rotate","perspective"],v5=["transform","translate","scale","rotate","perspective","filter"],m5=["paint","layout","strict","content"];function Cv(r){let t=Av(),e=oi(r)?si(r):r;return d5.some(i=>e[i]?e[i]!=="none":!1)||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||v5.some(i=>(e.willChange||"").includes(i))||m5.some(i=>(e.contain||"").includes(i))}function XI(r){let t=Nn(r);for(;Ai(t)&&!Zo(t);){if(Cv(t))return t;if(nf(t))return null;t=Nn(t)}return null}function Av(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var g5=new Set(["html","body","#document"]);function Zo(r){return g5.has(Wo(r))}function si(r){return xr(r).getComputedStyle(r)}function af(r){return oi(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Nn(r){if(Wo(r)==="html")return r;let t=r.assignedSlot||r.parentNode||YI(r)&&r.host||Ci(r);return YI(t)?t.host:t}function KI(r){let t=Nn(r);return Zo(t)?r.ownerDocument?r.ownerDocument.body:r.body:Ai(t)&&Ml(t)?t:KI(t)}function El(r,t,e){var i;t===void 0&&(t=[]),e===void 0&&(e=!0);let n=KI(r),a=n===((i=r.ownerDocument)==null?void 0:i.body),o=xr(n);if(a){let s=Dv(o);return t.concat(o,o.visualViewport||[],Ml(n)?n:[],s&&e?El(s):[])}return t.concat(n,El(n,[],e))}function Dv(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function jI(r){let t=si(r),e=parseFloat(t.width)||0,i=parseFloat(t.height)||0,n=Ai(r),a=n?r.offsetWidth:e,o=n?r.offsetHeight:i,s=Qc(e)!==a||Qc(i)!==o;return s&&(e=a,i=o),{width:e,height:i,$:s}}function $x(r){return oi(r)?r:r.contextElement}function Ol(r){let t=$x(r);if(!Ai(t))return Ti(1);let e=t.getBoundingClientRect(),{width:i,height:n,$:a}=jI(t),o=(a?Qc(e.width):e.width)/i,s=(a?Qc(e.height):e.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var y5=Ti(0);function JI(r){let t=xr(r);return!Av()||!t.visualViewport?y5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _5(r,t,e){return t===void 0&&(t=!1),!e||t&&e!==xr(r)?!1:t}function Xo(r,t,e,i){t===void 0&&(t=!1),e===void 0&&(e=!1);let n=r.getBoundingClientRect(),a=$x(r),o=Ti(1);t&&(i?oi(i)&&(o=Ol(i)):o=Ol(r));let s=_5(a,e,i)?JI(a):Ti(0),l=(n.left+s.x)/o.x,u=(n.top+s.y)/o.y,c=n.width/o.x,f=n.height/o.y;if(a){let h=xr(a),p=i&&oi(i)?xr(i):i,d=h,v=Dv(d);for(;v&&i&&p!==d;){let m=Ol(v),g=v.getBoundingClientRect(),y=si(v),_=g.left+(v.clientLeft+parseFloat(y.paddingLeft))*m.x,x=g.top+(v.clientTop+parseFloat(y.paddingTop))*m.y;l*=m.x,u*=m.y,c*=m.x,f*=m.y,l+=_,u+=x,d=xr(v),v=Dv(d)}}return Yo({width:c,height:f,x:l,y:u})}function jx(r,t){let e=af(r).scrollLeft;return t?t.left+e:Xo(Ci(r)).left+e}function QI(r,t,e){e===void 0&&(e=!1);let i=r.getBoundingClientRect(),n=i.left+t.scrollLeft-(e?0:jx(r,i)),a=i.top+t.scrollTop;return{x:n,y:a}}function x5(r){let{elements:t,rect:e,offsetParent:i,strategy:n}=r,a=n==="fixed",o=Ci(i),s=t?nf(t.floating):!1;if(i===o||s&&a)return e;let l={scrollLeft:0,scrollTop:0},u=Ti(1),c=Ti(0),f=Ai(i);if((f||!f&&!a)&&((Wo(i)!=="body"||Ml(o))&&(l=af(i)),Ai(i))){let p=Xo(i);u=Ol(i),c.x=p.x+i.clientLeft,c.y=p.y+i.clientTop}let h=o&&!f&&!a?QI(o,l,!0):Ti(0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}}function b5(r){return Array.from(r.getClientRects())}function S5(r){let t=Ci(r),e=af(r),i=r.ownerDocument.body,n=Ln(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),a=Ln(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),o=-e.scrollLeft+jx(r),s=-e.scrollTop;return si(i).direction==="rtl"&&(o+=Ln(t.clientWidth,i.clientWidth)-n),{width:n,height:a,x:o,y:s}}function w5(r,t){let e=xr(r),i=Ci(r),n=e.visualViewport,a=i.clientWidth,o=i.clientHeight,s=0,l=0;if(n){a=n.width,o=n.height;let u=Av();(!u||u&&t==="fixed")&&(s=n.offsetLeft,l=n.offsetTop)}return{width:a,height:o,x:s,y:l}}var T5=new Set(["absolute","fixed"]);function C5(r,t){let e=Xo(r,!0,t==="fixed"),i=e.top+r.clientTop,n=e.left+r.clientLeft,a=Ai(r)?Ol(r):Ti(1),o=r.clientWidth*a.x,s=r.clientHeight*a.y,l=n*a.x,u=i*a.y;return{width:o,height:s,x:l,y:u}}function qI(r,t,e){let i;if(t==="viewport")i=w5(r,e);else if(t==="document")i=S5(Ci(r));else if(oi(t))i=C5(t,e);else{let n=JI(r);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Yo(i)}function eL(r,t){let e=Nn(r);return e===t||!oi(e)||Zo(e)?!1:si(e).position==="fixed"||eL(e,t)}function A5(r,t){let e=t.get(r);if(e)return e;let i=El(r,[],!1).filter(s=>oi(s)&&Wo(s)!=="body"),n=null,a=si(r).position==="fixed",o=a?Nn(r):r;for(;oi(o)&&!Zo(o);){let s=si(o),l=Cv(o);!l&&s.position==="fixed"&&(n=null),(a?!l&&!n:!l&&s.position==="static"&&!!n&&T5.has(n.position)||Ml(o)&&!l&&eL(r,o))?i=i.filter(c=>c!==o):n=s,o=Nn(o)}return t.set(r,i),i}function D5(r){let{element:t,boundary:e,rootBoundary:i,strategy:n}=r,o=[...e==="clippingAncestors"?nf(t)?[]:A5(t,this._c):[].concat(e),i],s=o[0],l=o.reduce((u,c)=>{let f=qI(t,c,n);return u.top=Ln(f.top,u.top),u.right=Dl(f.right,u.right),u.bottom=Dl(f.bottom,u.bottom),u.left=Ln(f.left,u.left),u},qI(t,s,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function E5(r){let{width:t,height:e}=jI(r);return{width:t,height:e}}function M5(r,t,e){let i=Ai(t),n=Ci(t),a=e==="fixed",o=Xo(r,!0,a,t),s={scrollLeft:0,scrollTop:0},l=Ti(0);function u(){l.x=jx(n)}if(i||!i&&!a)if((Wo(t)!=="body"||Ml(n))&&(s=af(t)),i){let p=Xo(t,!0,a,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else n&&u();a&&!i&&n&&u();let c=n&&!i&&!a?QI(n,s):Ti(0),f=o.left+s.scrollLeft-l.x-c.x,h=o.top+s.scrollTop-l.y-c.y;return{x:f,y:h,width:o.width,height:o.height}}function qx(r){return si(r).position==="static"}function $I(r,t){if(!Ai(r)||si(r).position==="fixed")return null;if(t)return t(r);let e=r.offsetParent;return Ci(r)===e&&(e=e.ownerDocument.body),e}function tL(r,t){let e=xr(r);if(nf(r))return e;if(!Ai(r)){let n=Nn(r);for(;n&&!Zo(n);){if(oi(n)&&!qx(n))return n;n=Nn(n)}return e}let i=$I(r,t);for(;i&&ZI(i)&&qx(i);)i=$I(i,t);return i&&Zo(i)&&qx(i)&&!Cv(i)?e:i||XI(r)||e}var O5=async function(r){let t=this.getOffsetParent||tL,e=this.getDimensions,i=await e(r.floating);return{reference:M5(r.reference,await t(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function I5(r){return si(r).direction==="rtl"}var L5={convertOffsetParentRelativeRectToViewportRelativeRect:x5,getDocumentElement:Ci,getClippingRect:D5,getOffsetParent:tL,getElementRects:O5,getClientRects:b5,getDimensions:E5,getScale:Ol,isElement:oi,isRTL:I5};function rL(r,t){return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height}function P5(r,t){let e=null,i,n=Ci(r);function a(){var s;clearTimeout(i),(s=e)==null||s.disconnect(),e=null}function o(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();let u=r.getBoundingClientRect(),{left:c,top:f,width:h,height:p}=u;if(s||t(),!h||!p)return;let d=ef(f),v=ef(n.clientWidth-(c+h)),m=ef(n.clientHeight-(f+p)),g=ef(c),_={rootMargin:-d+"px "+-v+"px "+-m+"px "+-g+"px",threshold:Ln(0,Dl(1,l))||1},x=!0;function b(S){let T=S[0].intersectionRatio;if(T!==l){if(!x)return o();T?o(!1,T):i=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!rL(u,r.getBoundingClientRect())&&o(),x=!1}try{e=new IntersectionObserver(b,{..._,root:n.ownerDocument})}catch{e=new IntersectionObserver(b,_)}e.observe(r)}return o(!0),a}function iL(r,t,e,i){i===void 0&&(i={});let{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,u=$x(r),c=n||a?[...u?El(u):[],...El(t)]:[];c.forEach(g=>{n&&g.addEventListener("scroll",e,{passive:!0}),a&&g.addEventListener("resize",e)});let f=u&&s?P5(u,e):null,h=-1,p=null;o&&(p=new ResizeObserver(g=>{let[y]=g;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),e()}),u&&!l&&p.observe(u),p.observe(t));let d,v=l?Xo(r):null;l&&m();function m(){let g=Xo(r);v&&!rL(v,g)&&e(),v=g,d=requestAnimationFrame(m)}return e(),()=>{var g;c.forEach(y=>{n&&y.removeEventListener("scroll",e),a&&y.removeEventListener("resize",e)}),f?.(),(g=p)==null||g.disconnect(),p=null,l&&cancelAnimationFrame(d)}}var nL=HI;var aL=GI,oL=UI;var sL=(r,t,e)=>{let i=new Map,n={platform:L5,...e},a={...n.platform,_c:i};return VI(r,t,{...n,platform:a})};function N5(){let r=document.querySelector('meta[name="csrf-token"]');return r?r.content:null}async function k5(r,t={}){let e={Accept:"text/html","X-Partial-Request":"true","X-Requested-With":"XMLHttpRequest"},i=t.method||"GET";if(i!=="GET"){let s=N5();s&&(e["X-CSRF-Token"]=s)}let n=await fetch(r,{method:i,headers:{...e,...t.headers},...t});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.text();return new DOMParser().parseFromString(a,"text/html")}function R5(r,t){for(;r.firstChild;)r.removeChild(r.firstChild);Array.from(t.childNodes).forEach(e=>{r.appendChild(e.cloneNode(!0))})}async function kn(r,t,e={}){let i=await k5(r,e),n=e.selector||`#${t.id}`,a=i.querySelector(n);if(a)return R5(t,a),!0;for(;t.firstChild;)t.removeChild(t.firstChild);return!1}var Ll,Pl,Ev,lL,Il=class extends xe{constructor(){super(...arguments);Ji(this,Ev);Ji(this,Ll,null);Ji(this,Pl,null)}initialize(){this.orient=this.orient.bind(this)}connect(){this.cleanup=iL(this.buttonTarget,this.menuTarget,this.orient)}disconnect(){clearTimeout(Bt(this,Ll)),clearTimeout(Bt(this,Pl)),this.cleanup()}show(t){t&&t.preventDefault(),this.menuTarget.showPopover({source:this.buttonTarget}),this.orient(),this.loadOperationDetailsIfNeeded()}hide(){this.menuTarget.hidePopover()}toggle(t){t.preventDefault(),this.menuTarget.togglePopover({source:this.buttonTarget}),this.orient(),this.loadOperationDetailsIfNeeded()}debouncedShow(){clearTimeout(Bt(this,Pl)),Yl(this,Ll,setTimeout(()=>this.show(),700))}debouncedHide(){clearTimeout(Bt(this,Ll)),Yl(this,Pl,setTimeout(()=>this.hide(),300))}orient(){sL(this.buttonTarget,this.menuTarget,Bt(this,Ev,lL)).then(({x:t,y:e})=>{this.menuTarget.style.setProperty("--popover-x",`${t}px`),this.menuTarget.style.setProperty("--popover-y",`${e}px`),this.menuTarget.classList.add("positioned")})}loadOperationDetailsIfNeeded(){let t=this.menuTarget.dataset.operationUrl;if(!t)return;let e=this.menuTarget.querySelector("[data-operation-url]");!e||e.dataset.loaded||!this.hasLoadingContent(e)||kn(t,e).then(()=>{e.dataset.loaded="true"}).catch(n=>console.error("Popover details fetch error:",n))}hasLoadingContent(t){return(t.textContent||"").includes("Loading operation details")}};Ll=new WeakMap,Pl=new WeakMap,Ev=new WeakSet,lL=function(){return{placement:this.placementValue,middleware:[nL(4),oL(),aL({padding:4})]}},se(Il,"targets",["button","menu"]),se(Il,"values",{placement:{type:String,default:"top"}});var of=class extends xe{constructor(){super(...arguments);se(this,"deploymentMarkerSeriesId","rails-pulse-deployment-markers")}connect(){this.initializeChart(),this.handleColorSchemeChange=this.onColorSchemeChange.bind(this),this.handleSeriesToggle=this.onSeriesToggle.bind(this),this.handleDeploymentMarkersToggle=this.onDeploymentMarkersToggle.bind(this),document.addEventListener("rails-pulse:color-scheme-changed",this.handleColorSchemeChange),document.addEventListener("rails-pulse:toggle-series",this.handleSeriesToggle),document.addEventListener("rails-pulse:toggle-deployment-markers",this.handleDeploymentMarkersToggle)}disconnect(){document.removeEventListener("rails-pulse:color-scheme-changed",this.handleColorSchemeChange),document.removeEventListener("rails-pulse:toggle-series",this.handleSeriesToggle),document.removeEventListener("rails-pulse:toggle-deployment-markers",this.handleDeploymentMarkersToggle),this.disposeChart()}initializeChart(){this.retryCount=0,this.maxRetries=100,this.attemptInit()}attemptInit(){if(typeof echarts>"u"){if(this.retryCount++,this.retryCount>=this.maxRetries){console.error("[RailsPulse] echarts not loaded after 5 seconds for",this.element.id),this.showError();return}setTimeout(()=>this.attemptInit(),50);return}this.renderChart()}renderChart(){try{this.chart=echarts.init(this.element,this.themeValue||"railspulse");let t=this.buildChartConfig();this.chart.setOption(t),this.applyColorScheme(),document.dispatchEvent(new CustomEvent("stimulus:echarts:rendered",{detail:{containerId:this.element.id,chart:this.chart,controller:this}})),this.resizeObserver=new ResizeObserver(()=>{this.chart&&this.chart.resize()}),this.resizeObserver.observe(this.element),this.chart.on("legendselectchanged",e=>{this.handleLegendToggle(e)}),this.chart.on("click",e=>{e.componentType==="markLine"&&e.name&&navigator.clipboard.writeText(e.name).then(()=>{this.showCopiedToast(e.name)}).catch(()=>{})}),this.element.setAttribute("data-chart-rendered","true")}catch(t){console.error("[RailsPulse] Error initializing chart:",t),this.showError()}}buildChartConfig(){let t={...this.optionsValue};if(this.processFormatters(t),this.setChartData(t),!t.legend){let n=document.querySelectorAll(`[data-rails-pulse--series-toggle-chart-id-value="${this.element.id}"]`),a={};n.forEach(s=>{let l=s.getAttribute("data-rails-pulse--series-toggle-series-name-value");l&&(a[l]=s.dataset.active!=="false")});let o={};t.series&&Array.isArray(t.series)&&t.series.forEach(s=>{s.name&&(o[s.name]=s.name in a?a[s.name]:!0)}),t.legend={show:!1,selected:o}}let e=this.dataValue,i=e.deployment_markers;if(i&&i.length>0&&this._usesTimeAxisData(e)){let a=(this.element.closest('[data-controller~="rails-pulse--index"]')||document).querySelector('[data-controller~="rails-pulse--deployment-markers-toggle"]'),o=!a||a.dataset.active!=="false";t.series=t.series||[],t.series.push(this._buildDeploymentMarkerSeries(i,o))}return t}setChartData(t){let e=this.dataValue;if(e&&typeof e=="object"&&e.series){let i=e.series[0]?.data?.[0],n=Array.isArray(i)||Array.isArray(i?.value);if(t.xAxis=t.xAxis||{},n){t.xAxis.type="time";let o=this._minTimestampGapMs(e.series);o&&(t.xAxis.minInterval=o)}else t.xAxis.type="category",t.xAxis.data=e.labels;t.yAxis=t.yAxis||{},t.yAxis.type="value";let a=t.series&&!Array.isArray(t.series)?t.series:{};t.series=e.series.map(o=>({type:this.typeValue,...a,...o}))}else{let i=Object.keys(e).map(a=>{let o=Number(a);return isNaN(o)?a:o}),n=Object.values(e).map(a=>{if(typeof a=="object"&&a!==null){if(a.value!==void 0){let o=Object.keys(a);return o.length>1||o.length===1&&o[0]!=="value"?a:a.value}return a}return a});if(t.xAxis=t.xAxis||{},t.xAxis.type="category",t.xAxis.data=i,t.yAxis=t.yAxis||{},t.yAxis.type="value",Array.isArray(t.series))t.series[0]=t.series[0]||{},t.series[0].type=this.typeValue,t.series[0].data=n;else if(t.series&&typeof t.series=="object"){let a={...t.series};t.series=[{type:this.typeValue,data:n,...a}]}else t.series=[{type:this.typeValue,data:n}]}}_usesTimeAxisData(t=this.dataValue){let e=t?.series?.find(i=>Array.isArray(i?.data)&&i.data.length>0)?.data?.[0];return Array.isArray(e)||Array.isArray(e?.value)}_minTimestampGapMs(t){let e=new Set;t.forEach(a=>{(a.data||[]).forEach(o=>{let s=Array.isArray(o)?o:Array.isArray(o?.value)?o.value:null;s&&typeof s[0]=="number"&&e.add(s[0])})});let i=Array.from(e).sort((a,o)=>a-o),n=null;for(let a=1;a<i.length;a++){let o=i[a]-i[a-1];o>0&&(n===null||o<n)&&(n=o)}return n}_buildDeploymentMarkerSeries(t,e=!0){return{id:this.deploymentMarkerSeriesId,type:"line",data:[],name:"",showSymbol:!1,symbolSize:0,silent:!1,animation:!1,legendHoverLink:!1,lineStyle:{opacity:0},itemStyle:{opacity:0},tooltip:{show:!1},z:10,markLine:e?this._buildMarkLineConfig(t):{data:[]}}}_buildMarkLineConfig(t){let e=a=>{let o=a?.data?.xAxis,s=a?.data?.revision;if(typeof o!="number")return"";let l=new Date(o).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return s?`{time|${l}}
29
29
  {revision|${s}}`:`{time|${l}}`},i={color:"#22c55e",type:"dashed",width:2,opacity:.8},n={color:"#22c55e",formatter:e,rich:{time:{color:"#22c55e",fontWeight:600},revision:{color:"#22c55e",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:11}}};return{symbol:["none","none"],silent:!1,lineStyle:i,label:{...n,show:!1},emphasis:{lineStyle:i,label:{...n,show:!0}},data:t.map(a=>({xAxis:a.timestamp,name:a.revision,revision:a.revision,started_at:a.started_at})),tooltip:{show:!0,formatter:a=>{let o=a?.data?.revision||a.name,s=a?.data?.started_at;if(!s)return o;let l=new Date(s).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`<strong>Deploy</strong><br/><code style="font-size:11px">${o}</code><br/>${l}<br/><span style="font-size:10px;opacity:0.7">Click to copy SHA</span>`}}}}processFormatters(t){t.tooltip?.formatter&&typeof t.tooltip.formatter=="string"&&(this.isEChartsTemplate(t.tooltip.formatter)||(t.tooltip.formatter=this.parseFormatter(t.tooltip.formatter),this._tooltipFormatter=t.tooltip.formatter)),t.xAxis?.axisLabel?.formatter&&typeof t.xAxis.axisLabel.formatter=="string"&&(this.isEChartsTemplate(t.xAxis.axisLabel.formatter)||(t.xAxis.axisLabel.formatter=this.parseFormatter(t.xAxis.axisLabel.formatter))),t.yAxis?.axisLabel?.formatter&&typeof t.yAxis.axisLabel.formatter=="string"&&(this.isEChartsTemplate(t.yAxis.axisLabel.formatter)||(t.yAxis.axisLabel.formatter=this.parseFormatter(t.yAxis.axisLabel.formatter)))}isEChartsTemplate(t){return/^\{[a-zA-Z0-9_]+\}/.test(t.trim())||t.includes("{value}")||t.includes("{a}")||t.includes("{b}")||t.includes("{c}")}parseFormatter(t){let e=t.replace(/__FUNCTION_START__|__FUNCTION_END__/g,"");return this.getSafeFormatter(e)}getSafeFormatter(t){let e={duration_ms:n=>typeof n=="number"?n.toFixed(2)+" ms":n,percentage:n=>typeof n=="number"?n.toFixed(1)+"%":n,number_delimited:n=>typeof n=="number"?n.toLocaleString():n,timestamp:n=>typeof n=="number"||typeof n=="string"?new Date(n).toLocaleString():n,date:n=>{if(typeof n=="number"||typeof n=="string"){let a=typeof n=="string"?parseInt(n):n,o=new Date(a);return isNaN(o.getTime())?n.toString():o.toLocaleDateString("en-US",{month:"short",day:"numeric"})}return n},time:n=>{if(typeof n=="number"||typeof n=="string"){let a=typeof n=="string"?parseInt(n):n,o=new Date(a),s=o.getHours();if(isNaN(s))return n.toString();let l=o.getMinutes();return s.toString().padStart(2,"0")+":"+l.toString().padStart(2,"0")}return n},bytes:n=>{if(typeof n!="number")return n;let a=["B","KB","MB","GB","TB"],o=n,s=0;for(;o>=1024&&s<a.length-1;)o/=1024,s++;return o.toFixed(2)+" "+a[s]},tooltip_time_ms:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0],o=new Date(a.axisValue),s=o.getHours().toString().padStart(2,"0"),l=o.getMinutes().toString().padStart(2,"0"),u=`${s}:${l}`,c=parseInt(a.data);return`${u} <br /> ${a.marker} ${c} ms`},tooltip_date_ms:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0],s=new Date(a.axisValue).toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=parseInt(a.data);return`${s} <br /> ${a.marker} ${l} ms`},tooltip_time:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0],o=new Date(a.axisValue),s=o.getHours().toString().padStart(2,"0"),l=o.getMinutes().toString().padStart(2,"0");return`${`${s}:${l}`} <br /> ${a.marker} ${a.data}`},tooltip_date:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0];return`${new Date(a.axisValue).toLocaleDateString("en-US",{month:"short",day:"numeric"})} <br /> ${a.marker} ${a.data}`},auto_date_tooltip:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0].axisValue||n[0].axisValueLabel,o=a;if(typeof a=="number"||typeof a=="string"&&!isNaN(Number(a))){let l=Number(a),u=new Date(l);isNaN(u.getTime())||(o=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:u.getFullYear()!==new Date().getFullYear()?"numeric":void 0}))}let s=`${o}<br/>`;return n.forEach(l=>{let u=Array.isArray(l.value)?l.value[1]:l.value,c=typeof u=="number"?Math.round(u).toLocaleString("en-US"):u??0;s+=`${l.marker} ${l.seriesName}: ${c}<br/>`}),s},timestamp_to_date:n=>{let a=typeof n=="string"?parseFloat(n):n;if(typeof a=="number"&&!isNaN(a)&&a>1e12){let o=new Date(a);if(!isNaN(o.getTime()))return o.toLocaleDateString("en-US",{month:"short",day:"numeric"})}return n},tooltip_with_timestamp:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0].axisValue,o=Number(a),s;if(!isNaN(o)&&o>1e12){let u=new Date(o),c=n[0].axisValueLabel||"";s=/^\d{2}:\d{2}$/.test(c)?u.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):u.toLocaleDateString("en-US",{month:"short",day:"numeric"})}else s=a;let l=`${s}<br/>`;return n.forEach(u=>{let c=Array.isArray(u.value)?u.value[1]:u.value,f=typeof c=="number"?Math.round(c).toLocaleString("en-US"):c??0;l+=`${u.marker} ${u.seriesName}: ${f}<br/>`}),l},sparkline_tooltip:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0],o=a.axisValue,s=typeof a.value=="number"?Math.round(a.value).toLocaleString("en-US"):a.value??0,l=a.seriesName||"Value",u=typeof o=="string"?parseFloat(o):o;if(typeof u=="number"&&!isNaN(u)&&u>1e12){let c=new Date(u);if(!isNaN(c.getTime())){let f=c.getHours().toString().padStart(2,"0"),h=c.getMinutes().toString().padStart(2,"0");o=`${f}:${h}`}}return`${o}<br/>${a.marker} ${l}: ${s}`},sparkline_percentage_tooltip:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0],o=a.axisValue,s=typeof a.value=="number"?a.value:a.value??0,l=typeof s=="number"?s.toFixed(2)+"%":s,u=a.seriesName||"Value",c=typeof o=="string"?parseFloat(o):o;if(typeof c=="number"&&!isNaN(c)&&c>1e12){let f=new Date(c);if(!isNaN(f.getTime())){let h=f.getHours().toString().padStart(2,"0"),p=f.getMinutes().toString().padStart(2,"0");o=`${h}:${p}`}}return`${o}<br/>${a.marker} ${u}: ${l}`},tooltip_with_timestamp_rate:n=>{if(!Array.isArray(n)||n.length===0)return"";let a=n[0].axisValue,o=Number(a),s;if(!isNaN(o)&&o>1e12){let u=new Date(o),c=n[0].axisValueLabel||"";s=/^\d{2}:\d{2}$/.test(c)?u.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):u.toLocaleDateString("en-US",{month:"short",day:"numeric"})}else s=a;let l=`${s}<br/>`;return n.forEach(u=>{let c=Array.isArray(u.value)?u.value[1]:u.value,h=(typeof c=="number"?c:0).toFixed(2)+"%";l+=`${u.marker} ${u.seriesName}: ${h}<br/>`}),l}};if(t.includes("params")&&t.includes("params[0]")&&t.includes("axisValue"))return t.includes("getHours")?t.includes("ms")?e.tooltip_time_ms:e.tooltip_time:t.includes("toLocaleDateString")&&t.includes("ms")?e.tooltip_date_ms:e.tooltip_date;if(t.includes("getHours"))return e.time;if(t.includes("toLocaleDateString"))return e.date;if(t.includes("toLocaleTimeString"))return e.time;if(t.includes("toLocaleString"))return e.number_delimited;if(t.includes("toFixed(2)")&&t.includes("ms"))return e.duration_ms;if(e[t])return e[t];for(let[n,a]of Object.entries(e))if(t.includes(n)||t.includes(n.replace("_","")))return a;return console.warn("[RailsPulse] Unknown formatter pattern, using identity function:",t.substring(0,100)),n=>n}findDeploymentCopyHintElement(){let t=this.element.closest('[data-controller~="rails-pulse--index"]')||document;return Array.from(t.querySelectorAll('[data-rails-pulse--deployment-markers-toggle-target="message"]')).find(i=>i.offsetParent!==null)||null}showCopiedToast(t){let e=document.createElement("div");e.textContent=`Copied ${t}`;let i=this.findDeploymentCopyHintElement();if(i){let n=i.getBoundingClientRect();e.style.cssText=`position:fixed;top:${n.top+n.height/2}px;left:${n.right+8}px;transform:translateY(-50%);background:#22c55e;color:#fff;padding:0.35rem 0.7rem;border-radius:6px;font-size:12px;font-family:monospace;white-space:nowrap;z-index:9999;pointer-events:none;opacity:1;transition:opacity 0.4s ease`}else e.style.cssText="position:fixed;bottom:1rem;right:1rem;background:#22c55e;color:#fff;padding:0.4rem 0.8rem;border-radius:6px;font-size:13px;font-family:monospace;z-index:9999;pointer-events:none;opacity:1;transition:opacity 0.4s ease";document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0"},1500),setTimeout(()=>{e.remove()},2e3)}showError(){this.element.classList.add("chart-error"),this.element.innerHTML='<p class="text-subtle p-4">Chart failed to load</p>'}get chartInstance(){return this.chart}disposeChart(){this.resizeObserver&&this.resizeObserver.disconnect(),this.chart&&(this.chart.dispose(),this.chart=null)}update(t){if(t.detail?.data&&(this.dataValue=t.detail.data),t.detail?.options&&(this.optionsValue=t.detail.options),this.chart){let e=this.buildChartConfig();this.chart.setOption(e,!0)}}onSeriesToggle({detail:{chartId:t,seriesName:e}}){if(t!==this.element.id||!this.chart)return;let n=(this.dataValue?.series||[]).map(o=>o.name).filter(Boolean).filter(o=>o.startsWith(e));(n.length>0?n:[e]).forEach(o=>{this.chart.dispatchAction({type:"legendToggleSelect",name:o})})}onDeploymentMarkersToggle({detail:{visible:t}}){if(!this.chart)return;let e=this.dataValue?.deployment_markers;!e?.length||!this._usesTimeAxisData()||this.chart.setOption({series:[this._buildDeploymentMarkerSeries(e,t)]})}handleLegendToggle(t){if(!this.chart)return;let i=this.chart.getOption().series||[];if(!i.some(u=>u.type==="bar"&&u.stack))return;let a=t.selected||{},o=[];if(i.forEach((u,c)=>{a[u.name]!==!1&&u.type==="bar"&&u.stack&&o.push(c)}),o.length===0)return;let s=o[o.length-1],l=i.map((u,c)=>{if(u.type!=="bar"||!u.stack)return u;let f=o.includes(c),h=c===s;return{...u,itemStyle:{...u.itemStyle||{},borderRadius:f&&h?[5,5,0,0]:[0,0,0,0]}}});this.chart.setOption({series:l})}onColorSchemeChange(){this.applyColorScheme()}applyColorScheme(){if(!this.chart)return;let e=document.documentElement.getAttribute("data-color-scheme")==="dark",i=e?"rgba(255,255,255,0.55)":"#999999",n=e?"rgba(255,255,255,0.07)":"#eeeeee",l={backgroundColor:e?"rgba(24,24,27,0.95)":"rgba(255,255,255,0.95)",textStyle:{color:e?"#e4e4e7":"#18181b"},borderColor:e?"rgba(255,255,255,0.12)":"#cccccc"};this._tooltipFormatter&&(l.formatter=this._tooltipFormatter),this.chart.setOption({xAxis:{axisLabel:{color:i},splitLine:{lineStyle:{color:n}}},yAxis:{axisLabel:{color:i},splitLine:{lineStyle:{color:n}}},tooltip:l})}};se(of,"values",{type:String,data:Object,options:Object,theme:String});var Nl=class extends xe{constructor(){super(...arguments);se(this,"lastFrameRequestAt",0);se(this,"pendingRequestTimeout",null);se(this,"pendingRequestData",null);se(this,"selectedColumnIndex",null);se(this,"zrClickHandler",null);se(this,"highlightBarName","__rp_col_bg__");se(this,"deploymentMarkerSeriesId","rails-pulse-deployment-markers");se(this,"charts",{});se(this,"chartControllers",{});se(this,"chartSetup",{});se(this,"activeChartId",null)}connect(){let e=new URLSearchParams(window.location.search).get("chart_type"),i={response_time:"response_time_percentiles_chart",request_rate:"request_rate_chart",error_rate:"error_rate_chart",query_performance:"query_performance_chart",execution_volume:"execution_volume_chart",database_load:"database_load_chart"};this.activeChartId=i[e]||this.chartIdValue,this.handleChartInitialized=this.onChartInitialized.bind(this),document.addEventListener("stimulus:echarts:rendered",this.handleChartInitialized),this.handleDocumentMouseUp=()=>{!this.chart||!this.visibleData||this.handleZoomChange()},document.addEventListener("mouseup",this.handleDocumentMouseUp)}disconnect(){document.removeEventListener("stimulus:echarts:rendered",this.handleChartInitialized);let t=this.getActiveChartContainer();t&&(t.removeEventListener("mousedown",this.handleChartMouseDown),t.removeEventListener("mouseup",this.handleChartMouseUp)),document.removeEventListener("mouseup",this.handleDocumentMouseUp);try{this.chart&&this.zrClickHandler&&this.chart.getZr().off("click",this.zrClickHandler),this.chart&&this.zrMouseMoveHandler&&this.chart.getZr().off("mousemove",this.zrMouseMoveHandler)}catch{}this.pendingRequestTimeout&&clearTimeout(this.pendingRequestTimeout)}onChartInitialized(t){let{containerId:e,chart:i,controller:n}=t.detail;this.charts[e]=i,this.chartControllers[e]=n,e===this.activeChartId&&(this.chart=i,this.setup())}handleChartSwitched(t){let{toId:e}=t.detail;if(!e||e===this.activeChartId)return;let i=this.captureZoomState();this.teardownActiveChartListeners(),this.originalBarItemStyles=null,this.activeChartId=e,this.chart=this.charts[e],this.chart&&(requestAnimationFrame(()=>{let n=this.chartControllers[e];this.chart&&this.chart.resize(),n?.chart&&n.chart.setOption(n.buildChartConfig(),!0),setTimeout(()=>{this.chart&&this.chart.resize()},0)}),i&&this.applyZoomState(i),this.chartSetup[e]?(this.visibleData=this.getVisibleData(),this.setupChartEventListeners(),this.initializeColumnSelectionFromUrl()):this.setup())}captureZoomState(){if(!this.chart)return null;try{let t=this.chart.getOption(),e=t.dataZoom?.[1]||t.dataZoom?.[0];return e?{startValue:e.startValue,endValue:e.endValue}:null}catch{return null}}applyZoomState(t){if(!(!this.chart||t.startValue===void 0||t.endValue===void 0))try{this.chart.dispatchAction({type:"dataZoom",startValue:t.startValue,endValue:t.endValue}),this.visibleData=this.getVisibleData()}catch{}}teardownActiveChartListeners(){let t=this.getActiveChartContainer();t&&(t.removeEventListener("mousedown",this.handleChartMouseDown),t.removeEventListener("mouseup",this.handleChartMouseUp));try{this.chart&&(this.chart.off("datazoom"),this.zrClickHandler&&this.chart.getZr().off("click",this.zrClickHandler),this.zrMouseMoveHandler&&this.chart.getZr().off("mousemove",this.zrMouseMoveHandler))}catch{}this.zrClickHandler=null,this.zrMouseMoveHandler=null}getActiveChartContainer(){return this.chartTargets.find(t=>t.dataset.chartId===this.activeChartId)||null}setup(){this.chartSetup[this.activeChartId]||!this.getActiveChartContainer()||!this.chart||(this.visibleData=this.getVisibleData(),this.setupHighlightSeries(),this.setupChartEventListeners(),this.chartSetup[this.activeChartId]=!0,document.getElementById(this.activeChartId)?.setAttribute("data-chart-rendered","true"),this.initializeZoomFromUrl(),this.initializeColumnSelectionFromUrl())}setupChartEventListeners(){let t=this.getActiveChartContainer();this.handleChartMouseDown=()=>{this.visibleData=this.getVisibleData()},t.addEventListener("mousedown",this.handleChartMouseDown),this.handleChartMouseUp=()=>{this.handleZoomChange()},t.addEventListener("mouseup",this.handleChartMouseUp),this.chart.on("datazoom",()=>{this.handleZoomChange()}),this.zrClickHandler=e=>{if(this.isClickOnDeploymentMarker(e))return;let i=this.getDataIndexFromPixel(e);i!=null&&this.handleColumnClick({dataIndex:i})},this.chart.getZr().on("click",this.zrClickHandler),this.zrMouseMoveHandler=e=>{let i=this.getDataIndexFromPixel(e);this.chart.getZr().setCursorStyle(i==null?"default":"pointer")},this.chart.getZr().on("mousemove",this.zrMouseMoveHandler)}getPrimaryDataSeries(t=this.chart?.getOption()){return(t?.series||[]).find(e=>e?.name!==this.highlightBarName&&e?.id!==this.deploymentMarkerSeriesId&&Array.isArray(e?.data)&&e.data.length>0)||null}getPrimaryDataSeriesIndex(t=this.chart?.getOption()){return(t?.series||[]).findIndex(e=>e?.name!==this.highlightBarName&&e?.id!==this.deploymentMarkerSeriesId&&Array.isArray(e?.data)&&e.data.length>0)}getXAxisValues(t=this.chart?.getOption()){let e=t?.xAxis?.[0]?.data;if(Array.isArray(e)&&e.length>0)return e;let i=this.getPrimaryDataSeries(t);return i?i.data.map(n=>Array.isArray(n)?n[0]:Array.isArray(n?.value)?n.value[0]:null).filter(n=>n!=null):[]}getAxisType(t=this.chart?.getOption()){return t?.xAxis?.[0]?.type||"category"}getDataIndexFromPixel(t){if(!this.chart)return null;let e=this.chart.getOption(),i=this.getAxisType(e),n=this.getXAxisValues(e),a=this.getPrimaryDataSeriesIndex(e),o=[t.offsetX,t.offsetY];if(n.length===0||!this.chart.containPixel({gridIndex:0},o))return null;let s=this.chart.convertFromPixel({gridIndex:0},o);if(i==="time"){let c=Array.isArray(s)?Number(s[0]):Number(s);if(Number.isNaN(c)&&a>=0){let p=this.chart.convertFromPixel({seriesIndex:a},o);c=Array.isArray(p)?Number(p[0]):Number(p)}if(Number.isNaN(c))return null;let f=0,h=1/0;return n.forEach((p,d)=>{let v=Math.abs(Number(p)-c);v<h&&(h=v,f=d)}),f}let l=Array.isArray(s)?s:this.chart.convertFromPixel({seriesIndex:a>=0?a:0},o);if(!l)return null;let u=Math.round(l[0]);return u<0||u>=n.length?null:u}getTimeBucketRange(t,e){let i=Number(t[e]),n=e>0?Number(t[e-1]):null,a=e<t.length-1?Number(t[e+1]):null,o=n!=null?i-n:a!=null?a-i:36e5,s=n!=null?i-n:o,l=a!=null?a-i:o;return{start:i-s/2,end:i+l/2}}isClickOnDeploymentMarker(t){if(!this.chart)return!1;let n=(this.chart.getOption()?.series||[]).find(s=>s?.id===this.deploymentMarkerSeriesId)?.markLine?.data||[];if(n.length===0)return!1;let a=[t.offsetX,t.offsetY];if(!this.chart.containPixel({gridIndex:0},a))return!1;let o=8;return n.some(s=>{let l=this.chart.convertToPixel({xAxisIndex:0},s.xAxis),u=Array.isArray(l)?l[0]:l;return typeof u=="number"&&!Number.isNaN(u)&&Math.abs(u-t.offsetX)<=o})}getVisibleData(){try{let t=this.chart.getOption();if(!t.dataZoom||t.dataZoom.length===0)return{xAxis:[],series:[]};let e=t.dataZoom[1]||t.dataZoom[0],i=this.getXAxisValues(t),a=this.getPrimaryDataSeries(t)?.data||[];if(i.length===0||a.length===0)return{xAxis:[],series:[]};if(this.getAxisType(t)==="time"){let l=e.startValue??i[0],u=e.endValue??i[i.length-1];return{xAxis:i.filter(c=>c>=l&&c<=u),series:a.filter(c=>{let f=Array.isArray(c)?c[0]:c?.value?.[0];return f>=l&&f<=u})}}let o=e.startValue??0,s=e.endValue??i.length-1;return{xAxis:i.slice(o,s+1),series:a.slice(o,s+1)}}catch{return{xAxis:[],series:[]}}}handleZoomChange(){let t=this.getVisibleData(),e=t.xAxis.join(),i=this.visibleData.xAxis.join();e!==i&&(this.visibleData=t,this.updateUrlWithZoomParams(t),this.sendFrameRequest(t))}updateUrlWithZoomParams(t){let e=new URL(window.location.href),i=new URLSearchParams(e.search),n=t.xAxis[0],a=t.xAxis[t.xAxis.length-1];i.set("zoom_start_time",n),i.set("zoom_end_time",a),e.search=i.toString(),window.history.replaceState({},"",e)}updatePaginationLimit(){if(!this.hasPaginationLimitTarget)return;let t=new URL(window.location.href),e=new URLSearchParams(t.search),i=this.paginationLimitTarget.value;e.set("limit",i),t.search=e.toString(),window.history.replaceState({},"",t)}sendFrameRequest(t){let i=Date.now()-this.lastFrameRequestAt;if(this.pendingRequestData=t,this.pendingRequestTimeout&&clearTimeout(this.pendingRequestTimeout),i>=1e3)this.executeFrameRequest(t);else{let n=1e3-i;this.pendingRequestTimeout=setTimeout(()=>{this.executeFrameRequest(this.pendingRequestData),this.pendingRequestTimeout=null},n)}}executeFrameRequest(t){this.lastFrameRequestAt=Date.now();let e=new URL(window.location.href),i=new URLSearchParams(e.search),n=t.xAxis[0],a=t.xAxis[t.xAxis.length-1];i.set("zoom_start_time",n),i.set("zoom_end_time",a),this.hasPaginationLimitTarget&&i.set("limit",this.paginationLimitTarget.value),e.search=i.toString(),kn(e.toString(),this.indexTableTarget).catch(o=>console.error("[IndexController] Fetch error:",o))}handleColumnClick(t){let e=t.dataIndex;this.selectedColumnIndex===e?(this.resetColumnColors(),this.selectedColumnIndex=null,this.sendColumnDeselectionRequest()):(this.highlightColumn(e),this.selectedColumnIndex=e,this.sendColumnSelectionRequest(e))}setupHighlightSeries(){try{let t=this.chart.getOption();if(t.series?.[0]?.type==="bar")return;if(t.xAxis?.[0]?.type==="time"){this.chart.setOption({series:[...t.series||[],{name:this.highlightBarName,type:"line",data:[],showSymbol:!1,silent:!0,z:0,animation:!1,legendHoverLink:!1,lineStyle:{opacity:0},itemStyle:{opacity:0},tooltip:{show:!1},markArea:{silent:!0,itemStyle:{color:"rgba(128, 128, 128, 0.2)"},data:[]}}]});return}let n=t.xAxis?.[0]?.data?.length||0,a=Array.isArray(t.yAxis)?t.yAxis:[t.yAxis||{}];this.chart.setOption({yAxis:[...a,{show:!1,position:"right",min:0,max:1}],series:[...t.series||[],{name:this.highlightBarName,type:"bar",yAxisIndex:a.length,barWidth:"100%",itemStyle:{color:"rgba(0, 0, 0, 0)",borderWidth:0},data:Array(n).fill(null),silent:!0,z:0,animation:!1,legendHoverLink:!1,tooltip:{show:!1}}]})}catch(t){console.error("Error setting up highlight series:",t)}}highlightColumn(t){try{let e=this.chart.getOption(),i=this.getXAxisValues(e);if(!i.length||t<0||t>=i.length)return;let n=e.series?.[0]?.type==="bar";if(this.getAxisType(e)==="time"&&!n){let o=this.getTimeBucketRange(i,t);this.chart.setOption({series:e.series.map(s=>s.name===this.highlightBarName?{markArea:{silent:!0,itemStyle:{color:"rgba(128, 128, 128, 0.2)"},data:[[{xAxis:o.start},{xAxis:o.end}]]}}:{})});return}let a=e.xAxis?.[0]?.data?.length;if(n){if(!this.originalBarItemStyles){let o=e.series?.[0]?.data||[];this.originalBarItemStyles=o.map(s=>typeof s=="object"?s.itemStyle||{}:{})}this.chart.setOption({series:e.series.slice(0,1).map(o=>({data:(o.data||[]).map((s,l)=>({value:s&&typeof s=="object"&&!Array.isArray(s)?s.value:s,itemStyle:{...this.originalBarItemStyles[l]||{},opacity:l===t?1:.25}}))}))})}else{let o=Array(a).fill(null);o[t]=1,this.chart.setOption({series:e.series.map(s=>s.name===this.highlightBarName?{itemStyle:{color:"rgba(128, 128, 128, 0.2)",borderWidth:0},data:o}:{})})}}catch(e){console.error("Error highlighting column:",e)}}resetColumnColors(){try{let t=this.chart.getOption(),e=t.xAxis?.[0]?.data?.length||0,i=t.series?.[0]?.type==="bar";if(this.getAxisType(t)==="time"&&!i){this.chart.setOption({series:t.series.map(n=>n.name===this.highlightBarName?{markArea:{data:[]}}:{})});return}if(i){let n=this.originalBarItemStyles||[];this.originalBarItemStyles=null,this.chart.setOption({series:t.series.slice(0,1).map(a=>({data:(a.data||[]).map((o,s)=>({value:o&&typeof o=="object"&&!Array.isArray(o)?o.value:o,itemStyle:{...n[s]||{},opacity:1}}))}))})}else this.chart.setOption({series:t.series.map(n=>n.name===this.highlightBarName?{itemStyle:{color:"rgba(0, 0, 0, 0)",borderWidth:0},data:Array(e).fill(null)}:{})})}catch(t){console.error("Error resetting column highlight:",t)}}sendColumnSelectionRequest(t){let e=this.chart.getOption(),n=this.getXAxisValues(e)[t];if(!n){console.error("Could not find timestamp for column index:",t);return}let a=new URL(window.location.href),o=new URLSearchParams(a.search);o.set("selected_column_time",n),this.hasPaginationLimitTarget&&o.set("limit",this.paginationLimitTarget.value),a.search=o.toString(),window.history.replaceState({},"",a),this.executeFrameRequestForColumn(a)}sendColumnDeselectionRequest(){let t=new URL(window.location.href),e=new URLSearchParams(t.search);e.delete("selected_column_time"),this.hasPaginationLimitTarget&&e.set("limit",this.paginationLimitTarget.value),t.search=e.toString(),window.history.replaceState({},"",t),this.executeFrameRequestForColumn(t)}executeFrameRequestForColumn(t){kn(t.toString(),this.indexTableTarget).catch(e=>console.error("[IndexController] Column selection fetch error:",e))}initializeZoomFromUrl(){let t=new URLSearchParams(window.location.search),e=t.get("zoom_start_time"),i=t.get("zoom_end_time");if(!e||!i)return;let n=this.chart.getOption(),a=this.getXAxisValues(n);if(a.length===0)return;let o=parseInt(e),s=parseInt(i);if(this.getAxisType(n)==="time")this.chart.dispatchAction({type:"dataZoom",startValue:o,endValue:s});else{let l=a.reduce((c,f,h)=>Math.abs(parseInt(f)-o)<Math.abs(parseInt(a[c])-o)?h:c,0),u=a.reduce((c,f,h)=>Math.abs(parseInt(f)-s)<Math.abs(parseInt(a[c])-s)?h:c,0);this.chart.dispatchAction({type:"dataZoom",startValue:l,endValue:u})}this.visibleData=this.getVisibleData()}initializeColumnSelectionFromUrl(){let e=new URLSearchParams(window.location.search).get("selected_column_time");if(e){let i=this.chart.getOption(),n=this.getXAxisValues(i);if(n.length===0)return;let a=n.findIndex(o=>o.toString()===e);if(a===-1){let o=parseInt(e);a=n.findIndex(s=>parseInt(s)===o)}a!==-1&&(this.selectedColumnIndex=a,requestAnimationFrame(()=>{this.highlightColumn(a)}))}}};se(Nl,"targets",["chart","paginationLimit","indexTable"]),se(Nl,"values",{chartId:String});var Mv=class extends xe{connect(){this.storageKey="color-scheme",this.html=document.documentElement;let r=localStorage.getItem(this.storageKey);r&&this.html.setAttribute("data-color-scheme",r)}toggle(r){r.preventDefault();let t=this.html.getAttribute("data-color-scheme")==="dark"?"light":"dark";this.html.setAttribute("data-color-scheme",t),localStorage.setItem(this.storageKey,t),document.dispatchEvent(new CustomEvent("rails-pulse:color-scheme-changed",{detail:{scheme:t}}))}};var kl=class extends xe{connect(){this.restorePaginationLimit()}updateLimit(){let r=this.limitTarget.value;sessionStorage.setItem(this.storageKeyValue,r);let t=new URL(window.location);t.searchParams.set("limit",r),t.searchParams.delete("page"),window.location.href=t.toString()}restorePaginationLimit(){if(!this.hasLimitTarget)return;let t=new URLSearchParams(window.location.search).get("limit");if(t)sessionStorage.setItem(this.storageKeyValue,t),this.limitTarget.value!==t&&(this.limitTarget.value=t);else{let e=sessionStorage.getItem(this.storageKeyValue);e&&this.limitTarget.value!==e&&(this.limitTarget.value=e)}}};se(kl,"targets",["limit"]),se(kl,"values",{storageKey:{type:String,default:"rails_pulse_pagination_limit"}});var Rl=class extends xe{connect(){this.renderIcon()}nameValueChanged(){this.renderIcon()}renderIcon(){this.clearIcon(),this.element.classList.add(...this.loadingClasses),this.element.classList.remove(...this.errorClasses,...this.loadedClasses);let r=this.nameValue;if(!r){this.handleError("Icon name is required");return}if(!window.RailsPulseIcons){this.handleError("RailsPulseIcons not loaded");return}let t=window.RailsPulseIcons.get(r);if(!t){this.handleError(`Icon '${r}' not found`);return}try{let e=this.createSVGElement(t);this.element.appendChild(e),this.element.classList.remove(...this.loadingClasses,...this.errorClasses),this.element.classList.add(...this.loadedClasses),this.element.setAttribute("aria-label",`${r} icon`)}catch(e){this.handleError(`Failed to render icon '${r}': ${e.message}`)}}createSVGElement(r){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");if(t.setAttribute("width",this.widthValue||"24"),t.setAttribute("height",this.heightValue||"24"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width",this.strokeWidthValue||"2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),window.RailsPulseIcons.render){let a=document.createElement("div");if(window.RailsPulseIcons.render(this.nameValue,a,{width:this.widthValue||"24",height:this.heightValue||"24"})&&a.firstChild)return a.firstChild}let n=new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="${this.widthValue||"24"}" height="${this.heightValue||"24"}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${this.strokeWidthValue||"2"}" stroke-linecap="round" stroke-linejoin="round">${r}</svg>`,"image/svg+xml").documentElement;if(n.nodeName==="parsererror")throw new Error("Invalid SVG content");return document.importNode(n,!0)}clearIcon(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild)}handleError(r){console.warn(`[Rails Pulse Icon Controller] ${r}`),this.clearIcon(),this.element.classList.remove(...this.loadingClasses,...this.loadedClasses),this.element.classList.add(...this.errorClasses),this.createErrorPlaceholder(),this.element.setAttribute("aria-label","Icon not available")}createErrorPlaceholder(){let r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("width",this.widthValue||"24"),r.setAttribute("height",this.heightValue||"24"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","currentColor"),r.setAttribute("opacity","0.3");let t=document.createElementNS("http://www.w3.org/2000/svg","rect");t.setAttribute("width","20"),t.setAttribute("height","20"),t.setAttribute("x","2"),t.setAttribute("y","2"),t.setAttribute("rx","2"),r.appendChild(t),this.element.appendChild(r)}};se(Rl,"values",{name:String,width:String,height:String,strokeWidth:String}),se(Rl,"classes",["loading","error","loaded"]);var Ov=class extends xe{toggle(r){let t=r.target.closest("tr");if(!t||t.closest("tbody")!==this.element||t.classList.contains("operation-details-row"))return;let e=r.target.closest("td,th");if(e&&e.parentElement===t&&e.cellIndex===t.cells.length-1)return;r.preventDefault(),r.stopPropagation();let i=t.nextElementSibling;if(!i||i.tagName!=="TR"||!i.classList.contains("operation-details-row"))return;i.classList.contains("hidden")?this.expand(t,i):this.collapse(t,i)}expand(r,t){t.classList.remove("hidden");let e=r.querySelector(".chevron");e&&(e.style.transform="rotate(90deg)"),r.classList.add("expanded");let i=t.querySelector("[data-operation-url]");if(i&&!i.dataset.loaded){let n=i.dataset.operationUrl;n&&this.loadOperationDetails(n,i)}}async loadOperationDetails(r,t){try{await kn(r,t),t.dataset.loaded="true"}catch(e){console.error("Operation details fetch error:",e)}}collapse(r,t){t.classList.add("hidden");let e=r.querySelector(".chevron");e&&(e.style.transform="rotate(0deg)"),r.classList.remove("expanded")}};var Fl=class extends xe{connect(){this.collapse()}toggle(){this.element.classList.contains(this.collapsedClass)?this.expand():this.collapse()}collapse(){this.element.classList.add(this.collapsedClass),this.hasToggleTarget&&(this.toggleTarget.textContent="show more")}expand(){this.element.classList.remove(this.collapsedClass),this.hasToggleTarget&&(this.toggleTarget.textContent="show less")}};se(Fl,"targets",["content","toggle"]),se(Fl,"classes",["collapsed"]);var Bl=class extends xe{disconnect(){this.resetTimeout&&clearTimeout(this.resetTimeout)}async copy(r){let t=r.currentTarget,e=this.hasSourceTarget?this.sourceTarget.textContent:"";try{await this.write(e),this.flash(t,this.copiedLabelValue)}catch{this.flash(t,this.errorLabelValue)}}async write(r){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(r);let t=document.createElement("textarea");t.value=r,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{if(!document.execCommand("copy"))throw new Error("execCommand copy failed")}finally{document.body.removeChild(t)}}flash(r,t){r.textContent=t,this.resetTimeout&&clearTimeout(this.resetTimeout),this.resetTimeout=setTimeout(()=>{r.textContent=this.labelValue},this.resetDelayValue)}};se(Bl,"targets",["source"]),se(Bl,"values",{label:{type:String,default:"copy"},copiedLabel:{type:String,default:"copied!"},errorLabel:{type:String,default:"copy failed"},resetDelay:{type:Number,default:1500}});var sf=class extends xe{updateUrl(r){r.preventDefault();let e=r.currentTarget.getAttribute("href");e&&(window.history.replaceState({},"",e),this.fetchAndUpdateTable(e))}async fetchAndUpdateTable(r){try{await kn(r,this.tableFrameTarget)}catch(t){console.error("Table sort error:",t)}}};se(sf,"targets",["tableFrame"]);var zl=class extends xe{connect(){this.updateIndicator()}open(r){r.preventDefault(),this.wrapperTarget.style.display="flex",document.body.style.overflow="hidden"}close(r){r&&r.preventDefault(),this.wrapperTarget.style.display="none",document.body.style.overflow=""}closeOnClickOutside(r){r.target===this.wrapperTarget&&this.close(r)}submit(r){r.submitter&&r.submitter.name}updateIndicator(){this.hasIndicatorTarget&&(this.activeValue?this.indicatorTarget.classList.add("global-filters-active"):this.indicatorTarget.classList.remove("global-filters-active"))}activeValueChanged(){this.updateIndicator()}};se(zl,"targets",["wrapper","dialog","indicator","form"]),se(zl,"values",{active:{type:Boolean,default:!1}});var lf=class extends xe{connect(){let r=this.selectWrapperTarget.querySelector("select");if(!r)return;r.dataset.mode==="recent_custom"?r.value==="custom"&&(this.showPicker(),this.initializeDatePicker()):r.value==="custom"&&(this.showPicker(),this.initializeDatePicker())}handleChange(r){r.target.dataset.mode==="recent_custom"?r.target.value==="custom"?(this.showPicker(),this.openDatePicker()):(this.pickerWrapperTarget.style.display="none",this.selectWrapperTarget.style.display="block"):r.target.value==="custom"&&(this.showPicker(),this.openDatePicker())}showPicker(){this.selectWrapperTarget.style.display="none",this.pickerWrapperTarget.style.display="flex"}openDatePicker(){setTimeout(()=>{let r=this.pickerWrapperTarget.querySelector('input[name*="custom_date_range"]');if(!r)return;let t=this.application.getControllerForElementAndIdentifier(r,"rails-pulse--datepicker");t&&t.flatpickr&&t.flatpickr.open()},50)}showSelect(){this.pickerWrapperTarget.style.display="none",this.selectWrapperTarget.style.display="block";let r=this.selectWrapperTarget.querySelector("select");r&&(r.dataset.mode==="recent_custom"?r.value="recent":r.value="last_day")}initializeDatePicker(){let r=this.pickerWrapperTarget.querySelector('input[type="text"]');if(!r||!r.value)return;let t=this.application.getControllerForElementAndIdentifier(r,"rails-pulse--datepicker");if(t&&t.flatpickr){let e=r.value;if(e.includes(" to ")){let[i,n]=e.split(" to ").map(a=>a.trim());t.flatpickr.setDate([i,n],!1)}}}};se(lf,"targets",["selectWrapper","pickerWrapper"]);var uf=class extends xe{toggle(){let r=this.element.dataset.active!=="false";this.element.dataset.active=r?"false":"true",document.dispatchEvent(new CustomEvent("rails-pulse:toggle-series",{detail:{chartId:this.chartIdValue,seriesName:this.seriesNameValue}}))}};se(uf,"values",{seriesName:String,chartId:String});var cf=class extends xe{connect(){this.syncUi()}toggle(){let r=this.element.dataset.active!=="false";this.element.dataset.active=r?"false":"true",this.syncUi(),document.dispatchEvent(new CustomEvent("rails-pulse:toggle-deployment-markers",{detail:{visible:!r}}))}syncUi(){let r=this.element.dataset.active!=="false";this.hasButtonTarget&&(this.buttonTarget.dataset.active=r?"true":"false"),this.hasMessageTarget&&(this.messageTarget.style.display=r?"inline":"none")}};se(cf,"targets",["button","message"]);var ff=class extends xe{showTooltip(r){let t=r.currentTarget,e=this.tooltipTarget;e.querySelector("[data-flame-type]").textContent=t.dataset.opType.replace(/_/g," "),e.querySelector("[data-flame-label]").textContent=t.dataset.opLabel,e.querySelector("[data-flame-duration]").textContent=t.dataset.opDuration,e.querySelector("[data-flame-impact]").textContent=t.dataset.opImpact,e.classList.remove("hidden")}moveTooltip(r){let t=this.tooltipTarget;if(t.classList.contains("hidden"))return;let e=Math.min(r.clientX+16,window.innerWidth-320),i=Math.max(r.clientY-80,8);t.style.left=`${e}px`,t.style.top=`${i}px`}hideTooltip(){this.tooltipTarget.classList.add("hidden")}navigate(r){let t=r.currentTarget.dataset.opUrl;t&&(window.location.href=t)}};se(ff,"targets",["tooltip"]);var Vl=class extends xe{connect(){let t=new URLSearchParams(window.location.search).get("chart_type");t&&(this.selectedValue=t),this.showSelected(),this.syncHiddenInput()}switch(r){let t=this.selectedValue,e=r.currentTarget.dataset.chartType,i=this.chartTargets.find(o=>o.dataset.chartType===t),n=this.chartTargets.find(o=>o.dataset.chartType===e);this.selectedValue=e,this.showSelected();let a=new URL(window.location.href);a.searchParams.set("chart_type",e),window.history.replaceState({},"",a),this.syncHiddenInput(),this.dispatch("switched",{detail:{fromId:i?.dataset.chartId,toId:n?.dataset.chartId}})}syncHiddenInput(){this.hasChartTypeInputTarget&&(this.chartTypeInputTarget.value=this.selectedValue)}showSelected(){let r=this.selectedValue;this.chartTargets.forEach(t=>{t.style.display=t.dataset.chartType===r?"block":"none"}),this.buttonTargets.forEach(t=>{t.dataset.active=t.dataset.chartType===r?"true":"false"}),this.toggleGroupTargets.forEach(t=>{t.style.display=t.dataset.chartType===r?"flex":"none"})}};se(Vl,"targets",["chart","button","toggleGroup","chartTypeInput"]),se(Vl,"values",{selected:{type:String,default:"response_time"}});var Ul=class extends xe{selectPreset(r){r.preventDefault();let e=r.currentTarget.dataset.preset;this.submitTimeRange(e,null,null)}showCustom(r){r.preventDefault();let t=this.element.querySelector('[role="menu"]').closest("[popover]");t&&t.hidePopover(),this.hasModalWrapperTarget&&(this.modalWrapperTarget.style.display="flex",document.body.style.overflow="hidden")}cancelCustom(r){r.preventDefault(),this.hasDateInputTarget&&(this.dateInputTarget.value=""),this.closeModal()}closeModal(){this.hasModalWrapperTarget&&(this.modalWrapperTarget.style.display="none",document.body.style.overflow="")}closeOnClickOutside(r){this.hasModalTarget&&r.target===this.modalWrapperTarget&&this.cancelCustom(r)}applyCustom(r){r.preventDefault();let t=this.dateInputTarget.value;if(!t||!t.includes(" to ")){alert("Please select a valid date range");return}let[e,i]=t.split(" to ").map(n=>n.trim());this.closeModal(),this.submitTimeRange(null,e,i)}submitTimeRange(r,t,e){let i=document.createElement("form");i.method="POST",i.action=this.urlValue;let n=document.querySelector('meta[name="csrf-token"]')?.content;if(n){let o=document.createElement("input");o.type="hidden",o.name="authenticity_token",o.value=n,i.appendChild(o)}let a=document.createElement("input");if(a.type="hidden",a.name="_method",a.value="patch",i.appendChild(a),r){let o=document.createElement("input");o.type="hidden",o.name="preset",o.value=r,i.appendChild(o)}else if(t&&e){let o=document.createElement("input");o.type="hidden",o.name="start_time",o.value=t,i.appendChild(o);let s=document.createElement("input");s.type="hidden",s.name="end_time",s.value=e,i.appendChild(s)}document.body.appendChild(i),i.submit()}};se(Ul,"targets",["modalWrapper","modal","dateInput","label","trigger"]),se(Ul,"values",{url:String});Pt([v_,n_,sx,R_,rx,q_,K_,G_,px]);var et=hv.start();et.debug=!1;window.Stimulus=et;window.echarts=j0;et.register("rails-pulse--context-menu",Xc);et.register("rails-pulse--datepicker",Tl);et.register("rails-pulse--dialog",jc);et.register("rails-pulse--menu",Cl);et.register("rails-pulse--popover",Il);et.register("rails-pulse--chart",of);et.register("rails-pulse--index",Nl);et.register("rails-pulse--color-scheme",Mv);et.register("rails-pulse--pagination",kl);et.register("rails-pulse--icon",Rl);et.register("rails-pulse--expandable-rows",Ov);et.register("rails-pulse--collapsible",Fl);et.register("rails-pulse--clipboard",Bl);et.register("rails-pulse--table-sort",sf);et.register("rails-pulse--global-filters",zl);et.register("rails-pulse--custom-range",lf);et.register("rails-pulse--series-toggle",uf);et.register("rails-pulse--deployment-markers-toggle",cf);et.register("rails-pulse--flame-graph",ff);et.register("rails-pulse--chart-switcher",Vl);et.register("rails-pulse--time-range",Ul);lc("railspulse",{color:["#ffc91f","#ffde66","#fbedbf"],backgroundColor:"rgba(255,255,255,0)",textStyle:{},title:{textStyle:{color:"#666666"}},line:{lineStyle:{width:"3"},symbolSize:"8"},bar:{itemStyle:{barBorderWidth:0}}});window.RailsPulse={application:et,version:"1.0.0"};})();
30
30
  /*! Bundled license information:
31
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pulse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Harvey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-07 00:00:00.000000000 Z
11
+ date: 2026-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -189,12 +189,7 @@ files:
189
189
  - CHANGELOG.md
190
190
  - MIT-LICENSE
191
191
  - README.md
192
- - app/assets/images/rails_pulse/dashboard.png
193
- - app/assets/images/rails_pulse/query-show.png
194
192
  - app/assets/images/rails_pulse/rails-pulse-logo.png
195
- - app/assets/images/rails_pulse/request-show.png
196
- - app/assets/images/rails_pulse/request.png
197
- - app/assets/images/rails_pulse/route-show.png
198
193
  - app/assets/stylesheets/rails_pulse/application.css
199
194
  - app/assets/stylesheets/rails_pulse/components/alert.css
200
195
  - app/assets/stylesheets/rails_pulse/components/backtrace.css
@@ -346,6 +341,8 @@ files:
346
341
  - app/models/rails_pulse/routes/tables/index.rb
347
342
  - app/models/rails_pulse/summary.rb
348
343
  - app/models/rails_pulse/tables/base.rb
344
+ - app/models/rails_pulse/time_range_preference.rb
345
+ - app/models/rails_pulse/time_window.rb
349
346
  - app/services/rails_pulse/analysis/backtrace_analyzer.rb
350
347
  - app/services/rails_pulse/analysis/base_analyzer.rb
351
348
  - app/services/rails_pulse/analysis/explain_plan_analyzer.rb
@@ -444,6 +441,8 @@ files:
444
441
  - app/views/rails_pulse/requests/_table.html.erb
445
442
  - app/views/rails_pulse/requests/index.html.erb
446
443
  - app/views/rails_pulse/requests/show.html.erb
444
+ - app/views/rails_pulse/routes/_archived_summary_table.html.erb
445
+ - app/views/rails_pulse/routes/_archived_table_pagination.html.erb
447
446
  - app/views/rails_pulse/routes/_chart_tabs.html.erb
448
447
  - app/views/rails_pulse/routes/_metric_cards.html.erb
449
448
  - app/views/rails_pulse/routes/_requests_table.html.erb
@@ -491,7 +490,6 @@ files:
491
490
  - lib/rails_pulse/cleanup_service.rb
492
491
  - lib/rails_pulse/configuration.rb
493
492
  - lib/rails_pulse/engine.rb
494
- - lib/rails_pulse/extensions/active_record.rb
495
493
  - lib/rails_pulse/installers/config_installer.rb
496
494
  - lib/rails_pulse/installers/config_updater.rb
497
495
  - lib/rails_pulse/installers/migration_installer.rb
@@ -547,7 +545,7 @@ metadata:
547
545
  bug_tracker_uri: https://github.com/railspulse/rails_pulse/issues
548
546
  rubygems_mfa_required: 'true'
549
547
  post_install_message: |
550
- Rails Pulse 0.4.0.pre.4 installed.
548
+ Rails Pulse 0.4.0 installed.
551
549
 
552
550
  UPGRADING from any 0.3.x? This release changes route identity and DROPS
553
551
  rails_pulse_routes.method. Back up your database first, then run:
@@ -1,124 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsPulse
4
- module Extensions
5
- module ActiveRecord
6
- # Extends ActiveRecord::Relation with database-agnostic date grouping
7
- # This is a replacement for Groupdate that works regardless of ActiveRecord.default_timezone
8
- module QueryMethods
9
- # Groups records by date extracted from a timestamp column
10
- # Works across PostgreSQL, MySQL, and SQLite
11
- #
12
- # @param column [Symbol, String] the timestamp column to group by (default: :period_start)
13
- # @return [ActiveRecord::Relation] relation with DATE grouping applied
14
- #
15
- # @example Group summaries by date
16
- # RailsPulse::Summary.where(...).group_by_date(:period_start).sum(:count)
17
- # # => { Date(2024-01-01) => 100, Date(2024-01-02) => 150, ... }
18
- #
19
- # @example Group by different column
20
- # Model.group_by_date(:created_at).count
21
- #
22
- def group_by_date(column = :period_start)
23
- group(Arel.sql(date_sql(column.to_s))).extending(DateResultTransformer)
24
- end
25
-
26
- # Groups records by hour extracted from a timestamp column
27
- # Works across PostgreSQL, MySQL, and SQLite
28
- #
29
- # @param column [Symbol, String] the timestamp column to group by (default: :period_start)
30
- # @return [ActiveRecord::Relation] relation with hour grouping applied
31
- #
32
- # @example Group summaries by hour
33
- # RailsPulse::Summary.where(...).group_by_hour(:period_start).sum(:count)
34
- # # => { Time(2024-01-01 14:00:00) => 100, Time(2024-01-01 15:00:00) => 150, ... }
35
- #
36
- def group_by_hour(column = :period_start)
37
- group(Arel.sql(hour_sql(column.to_s))).extending(HourResultTransformer)
38
- end
39
-
40
- private
41
-
42
- # Returns database-specific SQL for extracting date from timestamp
43
- def date_sql(column)
44
- "DATE(#{column})"
45
- end
46
-
47
- # Returns database-specific SQL for extracting datetime truncated to hour
48
- def hour_sql(column)
49
- case connection.adapter_name.downcase
50
- when "mysql", "mysql2"
51
- "DATE_FORMAT(#{column}, '%Y-%m-%d %H:00:00')"
52
- when "sqlite"
53
- "STRFTIME('%Y-%m-%d %H:00:00', #{column})"
54
- else
55
- # PostgreSQL and unknown adapters
56
- "DATE_TRUNC('hour', #{column})"
57
- end
58
- end
59
- end
60
-
61
- # Shared base for transforming aggregation result hash keys.
62
- # Include this module and implement #parse_key to specialize.
63
- module ResultTransformer
64
- def sum(*args)
65
- super.transform_keys { |k| parse_key(k) }
66
- end
67
-
68
- def count(*args)
69
- result = super
70
- # count can return an integer or a hash depending on whether group is used
71
- result.is_a?(Hash) ? result.transform_keys { |k| parse_key(k) } : result
72
- end
73
-
74
- def average(*args)
75
- super.transform_keys { |k| parse_key(k) }
76
- end
77
-
78
- def maximum(*args)
79
- super.transform_keys { |k| parse_key(k) }
80
- end
81
-
82
- def minimum(*args)
83
- super.transform_keys { |k| parse_key(k) }
84
- end
85
-
86
- def pluck(*args)
87
- result = super
88
- result.is_a?(Hash) ? result.transform_keys { |k| parse_key(k) } : result
89
- end
90
- end
91
-
92
- # Module to transform aggregation result keys from strings to Date objects
93
- # This makes the API match Groupdate's behavior
94
- module DateResultTransformer
95
- include ResultTransformer
96
-
97
- private
98
-
99
- def parse_key(date_str)
100
- Date.parse(date_str.to_s)
101
- end
102
- end
103
-
104
- # Module to transform aggregation result keys from strings to Time objects
105
- # Used for hourly grouping
106
- module HourResultTransformer
107
- include ResultTransformer
108
-
109
- private
110
-
111
- def parse_key(time_str)
112
- return time_str if time_str.is_a?(Time)
113
- return nil if time_str.nil? || time_str.to_s.strip.empty?
114
- # Parse as UTC since STRFTIME returns UTC strings from the database
115
- # Keep in UTC to match the time range boundaries used in queries
116
- Time.find_zone("UTC").parse(time_str.to_s)
117
- end
118
- end
119
- end
120
- end
121
- end
122
-
123
- # Extend ActiveRecord::Relation with our date grouping methods
124
- ActiveRecord::Relation.include(RailsPulse::Extensions::ActiveRecord::QueryMethods)