rails_live_dashboard 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/rails_live_dashboard/application.css +1 -0
  3. data/app/assets/builds/rails_live_dashboard/application.js +39 -0
  4. data/app/assets/builds/rails_live_dashboard/application.js.map +7 -0
  5. data/app/controllers/rails_live_dashboard/clean_controller.rb +1 -1
  6. data/app/models/rails_live_dashboard/query.rb +4 -0
  7. data/app/models/rails_live_dashboard/request.rb +3 -35
  8. data/app/views/layouts/rails_live_dashboard/application.html.erb +3 -0
  9. data/app/views/rails_live_dashboard/exceptions/index.html.erb +1 -1
  10. data/app/views/rails_live_dashboard/queries/_list.html.erb +3 -30
  11. data/app/views/rails_live_dashboard/queries/_query.html.erb +18 -0
  12. data/app/views/rails_live_dashboard/queries/index.html.erb +2 -0
  13. data/app/views/rails_live_dashboard/requests/_contents.html.erb +4 -4
  14. data/app/views/rails_live_dashboard/requests/_exceptions.html.erb +16 -16
  15. data/app/views/rails_live_dashboard/requests/_request.html.erb +17 -0
  16. data/app/views/rails_live_dashboard/requests/index.html.erb +4 -24
  17. data/app/views/rails_live_dashboard/requests/show.html.erb +6 -6
  18. data/app/views/rails_live_dashboard/shared/_header.html.erb +11 -11
  19. data/app/views/rails_live_dashboard/widgets/slowest_queries/_query.html.erb +25 -0
  20. data/app/views/rails_live_dashboard/widgets/slowest_queries/show.html.erb +2 -28
  21. data/app/views/rails_live_dashboard/widgets/slowest_requests/_request.html.erb +25 -0
  22. data/app/views/rails_live_dashboard/widgets/slowest_requests/show.html.erb +3 -29
  23. data/lib/rails_live_dashboard/version.rb +1 -1
  24. metadata +11 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8191e76856529454685851b592ae8ec7cd2db404ef511feaa6c25bd540c7094c
4
- data.tar.gz: faf0d4c66724089ad85ded3f51ed04be8c76c9757b034f91969e91c051e01434
3
+ metadata.gz: 681e481e630cd45d6418af3965fa1e68c73382fc2fce84989c1c2ec25fc913d4
4
+ data.tar.gz: 010a88562af62e9a674abcc40b9832f6b12c1a8a1e6eaafe717345612f4a8855
5
5
  SHA512:
6
- metadata.gz: 69c22167f87dda32caa0059da14d8ff1b0cce379a30d32ec9b4f2df492668a185eecf85144e27859634962d9dcbeeaac88b13d5ef7e5f610e094e335f9082a3e
7
- data.tar.gz: d99939b2af5a197798757e200aae9c0fb909af03d4315fe7df718f29d65ee6af0063ec21b0be7abfa4cc5c59eafbc049ef83a19f29cfbba3a971e1f59f51090d
6
+ metadata.gz: 84de4cbcb1fd5b8ad210eb1d39a6ca93e146e52529349f06457d863d3d4a8697a61f101fd23c265ae97eb70b8838acdaaf2c1b036e647e1d98b28598afcc4c59
7
+ data.tar.gz: 21e8131e50bc888b5e4e78bdd9d9a649b198f29f0ed8c0c999c588bd3c4af64fd1c53f9ae499037aafa2b37526c17fb15461423a1a71af77ab1e3c16836cc87e
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.relative{position:relative}.isolate{isolation:isolate}.z-10{z-index:10}.-mx-4{margin-left:-1rem;margin-right:-1rem}.-my-2{margin-top:-.5rem;margin-bottom:-.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mt-1{margin-top:.25rem}.mt-10{margin-top:2.5rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-5{margin-top:1.25rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-16{height:4rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-16{width:4rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0}.min-w-full{min-width:100%}.max-w-7xl{max-width:80rem}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-10{gap:2.5rem}.gap-5{gap:1.25rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.gap-x-1\.5{-moz-column-gap:.375rem;column-gap:.375rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem*var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px*var(--tw-divide-y-reverse))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.divide-gray-300>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(209 213 219/var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}.border-indigo-500{--tw-border-opacity:1;border-color:rgb(99 102 241/var(--tw-border-opacity))}.bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity))}.bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity))}.bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-yellow-50{--tw-bg-opacity:1;background-color:rgb(254 252 232/var(--tw-bg-opacity))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-orange-700{--tw-gradient-from:#c2410c var(--tw-gradient-from-position);--tw-gradient-to:#c2410c00 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-red-700{--tw-gradient-from:#b91c1c var(--tw-gradient-from-position);--tw-gradient-to:#b91c1c00 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.to-orange-500{--tw-gradient-to:#f97316 var(--tw-gradient-to-position)}.to-red-500{--tw-gradient-to:#ef4444 var(--tw-gradient-to-position)}.fill-blue-500{fill:#3b82f6}.fill-green-500{fill:#22c55e}.fill-indigo-500{fill:#6366f1}.fill-purple-500{fill:#a855f7}.fill-red-500{fill:#ef4444}.fill-yellow-500{fill:#eab308}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-10{padding-bottom:2.5rem}.pb-3{padding-bottom:.75rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.tracking-tight{letter-spacing:-.025em}.text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity))}.text-indigo-600{--tw-text-opacity:1;color:rgb(79 70 229/var(--tw-text-opacity))}.text-orange-700{--tw-text-opacity:1;color:rgb(194 65 12/var(--tw-text-opacity))}.text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-yellow-800{--tw-text-opacity:1;color:rgb(133 77 14/var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-inset{--tw-ring-inset:inset}.ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}.ring-blue-700\/10{--tw-ring-color:#1d4ed81a}.ring-gray-200{--tw-ring-opacity:1;--tw-ring-color:rgb(229 231 235/var(--tw-ring-opacity))}.ring-gray-900\/5{--tw-ring-color:#1118270d}.ring-green-600\/20{--tw-ring-color:#16a34a33}.ring-orange-600\/10{--tw-ring-color:#ea580c1a}.ring-red-600\/10{--tw-ring-color:#dc26261a}.ring-yellow-600\/20{--tw-ring-color:#ca8a0433}.ring-opacity-5{--tw-ring-opacity:0.05}.hover\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.hover\:text-indigo-900:hover{--tw-text-opacity:1;color:rgb(49 46 129/var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-inset:focus{--tw-ring-inset:inset}.focus\:ring-white:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(255 255 255/var(--tw-ring-opacity))}@media (min-width:640px){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.sm\:mt-0{margin-top:0}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-col{flex-direction:column}.sm\:items-end{align-items:flex-end}.sm\:gap-4{gap:1rem}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-6{padding:1.5rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-right:1.5rem}.sm\:pl-6,.sm\:px-6{padding-left:1.5rem}.sm\:pr-6{padding-right:1.5rem}}@media (min-width:1024px){.lg\:relative{position:relative}.lg\:z-10{z-index:10}.lg\:-mx-8{margin-left:-2rem;margin-right:-2rem}.lg\:ml-4{margin-left:1rem}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:items-center{align-items:center}.lg\:space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(2rem*var(--tw-space-x-reverse));margin-left:calc(2rem*(1 - var(--tw-space-x-reverse)))}.lg\:divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px*var(--tw-divide-y-reverse))}.lg\:divide-gray-700>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(55 65 81/var(--tw-divide-opacity))}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-2{padding-top:.5rem;padding-bottom:.5rem}}
@@ -0,0 +1,39 @@
1
+ var kr=Object.defineProperty;var R=(r,e)=>()=>(r&&(e=r(r=0)),e);var ws=(r,e)=>{for(var t in e)kr(r,t,{get:e[t],enumerable:!0})};var V,$e=R(()=>{V={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0}});var g,ne=R(()=>{$e();g={log(...r){this.enabled&&(r.push(Date.now()),V.logger.log("[ActionCable]",...r))}}});var pe,We,ge,_e,Nt=R(()=>{ne();pe=()=>new Date().getTime(),We=r=>(pe()-r)/1e3,ge=class{constructor(e){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=e,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=pe(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),g.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=pe(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),g.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=pe()}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,g.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=pe(),g.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:e,reconnectionBackoffRate:t}=this.constructor,s=Math.pow(1+t,Math.min(this.reconnectAttempts,10)),n=(this.reconnectAttempts===0?1:t)*Math.random();return e*1e3*s*(1+n)}reconnectIfStale(){this.connectionIsStale()&&(g.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${We(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?g.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${We(this.disconnectedAt)} s`):(g.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return We(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&We(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(g.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};ge.staleThreshold=6;ge.reconnectionBackoffRate=.15;_e=ge});var be,Ht=R(()=>{be={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]}});var ve,Vt,xi,Xs,ye,Ue,xt=R(()=>{$e();Nt();Ht();ne();({message_types:ve,protocols:Vt}=be),xi=Vt.slice(0,Vt.length-1),Xs=[].indexOf,ye=class{constructor(e){this.open=this.open.bind(this),this.consumer=e,this.subscriptions=this.consumer.subscriptions,this.monitor=new _e(this),this.disconnected=!0}send(e){return this.isOpen()?(this.webSocket.send(JSON.stringify(e)),!0):!1}open(){if(this.isActive())return g.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let e=[...Vt,...this.consumer.subprotocols||[]];return g.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${e}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new V.WebSocket(this.consumer.url,e),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:e}={allowReconnect:!0}){if(e||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(g.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(e){g.log("Failed to reopen WebSocket",e)}finally{g.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return Xs.call(xi,this.getProtocol())>=0}isState(...e){return Xs.call(e,this.getState())>=0}getState(){if(this.webSocket){for(let e in V.WebSocket)if(V.WebSocket[e]===this.webSocket.readyState)return e.toLowerCase()}return null}installEventHandlers(){for(let e in this.events){let t=this.events[e].bind(this);this.webSocket[`on${e}`]=t}}uninstallEventHandlers(){for(let e in this.events)this.webSocket[`on${e}`]=function(){}}};ye.reopenDelay=500;ye.prototype.events={message(r){if(!this.isProtocolSupported())return;let{identifier:e,message:t,reason:s,reconnect:i,type:n}=JSON.parse(r.data);switch(n){case ve.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case ve.disconnect:return g.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:i});case ve.ping:return this.monitor.recordPing();case ve.confirmation:return this.subscriptions.confirmSubscription(e),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(e,"connected",{reconnected:!0})):this.subscriptions.notify(e,"connected",{reconnected:!1});case ve.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",t)}},open(){if(g.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return g.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(r){if(g.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){g.log("WebSocket onerror event")}};Ue=ye});var $i,z,$t=R(()=>{$i=function(r,e){if(e!=null)for(let t in e){let s=e[t];r[t]=s}return r},z=class{constructor(e,t={},s){this.consumer=e,this.identifier=JSON.stringify(t),$i(this,s)}perform(e,t={}){return t.action=e,this.send(t)}send(e){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(e)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}});var Wt,je,_t=R(()=>{ne();Wt=class{constructor(e){this.subscriptions=e,this.pendingSubscriptions=[]}guarantee(e){this.pendingSubscriptions.indexOf(e)==-1?(g.log(`SubscriptionGuarantor guaranteeing ${e.identifier}`),this.pendingSubscriptions.push(e)):g.log(`SubscriptionGuarantor already guaranteeing ${e.identifier}`),this.startGuaranteeing()}forget(e){g.log(`SubscriptionGuarantor forgetting ${e.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(t=>t!==e)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(e=>{g.log(`SubscriptionGuarantor resubscribing ${e.identifier}`),this.subscriptions.subscribe(e)})},500)}},je=Wt});var J,Ut=R(()=>{$t();_t();ne();J=class{constructor(e){this.consumer=e,this.guarantor=new je(this),this.subscriptions=[]}create(e,t){let s=e,i=typeof s=="object"?s:{channel:s},n=new z(this.consumer,i,t);return this.add(n)}add(e){return this.subscriptions.push(e),this.consumer.ensureActiveConnection(),this.notify(e,"initialized"),this.subscribe(e),e}remove(e){return this.forget(e),this.findAll(e.identifier).length||this.sendCommand(e,"unsubscribe"),e}reject(e){return this.findAll(e).map(t=>(this.forget(t),this.notify(t,"rejected"),t))}forget(e){return this.guarantor.forget(e),this.subscriptions=this.subscriptions.filter(t=>t!==e),e}findAll(e){return this.subscriptions.filter(t=>t.identifier===e)}reload(){return this.subscriptions.map(e=>this.subscribe(e))}notifyAll(e,...t){return this.subscriptions.map(s=>this.notify(s,e,...t))}notify(e,t,...s){let i;return typeof e=="string"?i=this.findAll(e):i=[e],i.map(n=>typeof n[t]=="function"?n[t](...s):void 0)}subscribe(e){this.sendCommand(e,"subscribe")&&this.guarantor.guarantee(e)}confirmSubscription(e){g.log(`Subscription confirmed ${e}`),this.findAll(e).map(t=>this.guarantor.forget(t))}sendCommand(e,t){let{identifier:s}=e;return this.consumer.send({command:t,identifier:s})}}});function jt(r){if(typeof r=="function"&&(r=r()),r&&!/^wss?:/i.test(r)){let e=document.createElement("a");return e.href=r,e.href=e.href,e.protocol=e.protocol.replace("http","ws"),e.href}else return r}var oe,Ys=R(()=>{xt();Ut();oe=class{constructor(e){this._url=e,this.subscriptions=new J(this),this.connection=new Ue(this),this.subprotocols=[]}get url(){return jt(this._url)}send(e){return this.connection.send(e)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(e){this.subprotocols=[...this.subprotocols,e]}}});var Zs={};ws(Zs,{Connection:()=>Ue,ConnectionMonitor:()=>_e,Consumer:()=>oe,INTERNAL:()=>be,Subscription:()=>z,SubscriptionGuarantor:()=>je,Subscriptions:()=>J,adapters:()=>V,createConsumer:()=>Wi,createWebSocketURL:()=>jt,getConfig:()=>Qs,logger:()=>g});function Wi(r=Qs("url")||be.default_mount_path){return new oe(r)}function Qs(r){let e=document.head.querySelector(`meta[name='action-cable-${r}']`);if(e)return e.getAttribute("content")}var er=R(()=>{xt();Nt();Ys();Ht();$t();Ut();_t();$e();ne()});var qt={};ws(qt,{FetchEnctype:()=>D,FetchMethod:()=>L,FetchRequest:()=>N,FetchResponse:()=>te,FrameElement:()=>M,FrameLoadingStyle:()=>_,FrameRenderer:()=>ie,PageRenderer:()=>K,PageSnapshot:()=>C,StreamActions:()=>Dt,StreamElement:()=>Ne,StreamSourceElement:()=>He,cache:()=>$s,clearCache:()=>Ks,connectStreamSource:()=>me,disconnectStreamSource:()=>fe,fetch:()=>It,fetchEnctypeFromString:()=>Ns,fetchMethodFromString:()=>Ve,isSafe:()=>xe,navigator:()=>Ws,registerAdapter:()=>_s,renderStreamMessage:()=>js,session:()=>b,setConfirmMethod:()=>Js,setFormMode:()=>Gs,setProgressBarDelay:()=>zs,start:()=>Bt,visit:()=>Us});(function(r){if(typeof r.requestSubmit=="function")return;r.requestSubmit=function(s){s?(e(s,this),s.click()):(s=document.createElement("input"),s.type="submit",s.hidden=!0,this.appendChild(s),s.click(),this.removeChild(s))};function e(s,i){s instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),s.type=="submit"||t(TypeError,"The specified element is not a submit button"),s.form==i||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(s,i,n){throw new s("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",n)}})(HTMLFormElement.prototype);var Ms=new WeakMap;function Or(r){let e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function Fr(r){let e=Or(r.target);e&&e.form&&Ms.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let r=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))r=e;else return}addEventListener("click",Fr,!0),Object.defineProperty(r,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Ms.get(this.target)}})})();var _={eager:"eager",lazy:"lazy"},M=class r extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.delegate=new r.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return Pr(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function Pr(r){switch(r.toLowerCase()){case"lazy":return _.lazy;default:return _.eager}}function S(r){return new URL(r.toString(),document.baseURI)}function U(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function Ft(r,e){let t=e?.getAttribute("formaction")||r.getAttribute("action")||r.action;return S(t)}function Ir(r){return(Hr(r).match(/\.[^.]*$/)||[])[0]||""}function Br(r){return!!Ir(r).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Dr(r,e){let t=Vr(e);return r.href===S(t).href||r.href.startsWith(t)}function B(r,e){return Dr(r,e)&&Br(r)}function it(r){let e=U(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function Ce(r){return it(r)}function qr(r,e){return S(r).href==S(e).href}function Nr(r){return r.pathname.split("/").slice(1)}function Hr(r){return Nr(r).slice(-1)[0]}function Vr(r){return xr(r.origin+r.pathname)}function xr(r){return r.endsWith("/")?r:r+"/"}var te=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return S(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function le(r){if(r.getAttribute("data-turbo-eval")=="false")return r;{let e=document.createElement("script"),t=se("csp-nonce");return t&&(e.nonce=t),e.textContent=r.textContent,e.async=!1,$r(e,r),e}}function $r(r,e){for(let{name:t,value:s}of e.attributes)r.setAttribute(t,s)}function Wr(r){let e=document.createElement("template");return e.innerHTML=r,e.content}function v(r,{target:e,cancelable:t,detail:s}={}){let i=new CustomEvent(r,{cancelable:t,bubbles:!0,composed:!0,detail:s});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function Q(){return document.visibilityState==="hidden"?ks():Rs()}function Rs(){return new Promise(r=>requestAnimationFrame(()=>r()))}function ks(){return new Promise(r=>setTimeout(()=>r(),0))}function _r(){return Promise.resolve()}function Os(r=""){return new DOMParser().parseFromString(r,"text/html")}function Fs(r,...e){let t=Ur(r,e).replace(/^\n/,"").split(`
2
+ `),s=t[0].match(/^\s+/),i=s?s[0].length:0;return t.map(n=>n.slice(i)).join(`
3
+ `)}function Ur(r,e){return r.reduce((t,s,i)=>{let n=e[i]==null?"":e[i];return t+s+n},"")}function q(){return Array.from({length:36}).map((r,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function Re(r,...e){for(let t of e.map(s=>s?.getAttribute(r)))if(typeof t=="string")return t;return null}function jr(r,...e){return e.some(t=>t&&t.hasAttribute(r))}function ke(...r){for(let e of r)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Oe(...r){for(let e of r)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Kr(r,e=2e3){return new Promise(t=>{let s=()=>{r.removeEventListener("error",s),r.removeEventListener("load",s),t()};r.addEventListener("load",s,{once:!0}),r.addEventListener("error",s,{once:!0}),setTimeout(t,e)})}function Ps(r){switch(r){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function zr(r){return r=="advance"||r=="replace"||r=="restore"}function j(...r){let e=Re("data-turbo-action",...r);return zr(e)?e:null}function Is(r){return document.querySelector(`meta[name="${r}"]`)}function se(r){let e=Is(r);return e&&e.content}function Jr(r,e){let t=Is(r);return t||(t=document.createElement("meta"),t.setAttribute("name",r),document.head.appendChild(t)),t.setAttribute("content",e),t}function Z(r,e){if(r instanceof Element)return r.closest(e)||Z(r.assignedSlot||r.getRootNode()?.host,e)}function Pt(r){return!!r&&r.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof r.focus=="function"}function Bs(r){return Array.from(r.querySelectorAll("[autofocus]")).find(Pt)}async function Gr(r,e){let t=e();r(),await Rs();let s=e();return[t,s]}function Xr(r){if(r.hasAttribute("target")){for(let e of document.getElementsByName(r.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function Yr(r){return Z(r,"a[href]:not([target^=_]):not([download])")}function Ds(r){return S(r.getAttribute("href")||"")}function Qr(r,e){let t=null;return(...s)=>{let i=()=>r.apply(this,s);clearTimeout(t),t=setTimeout(i,e)}}var nt=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let s=this.values().next().value;this.delete(s)}super.add(e)}},qs=new nt(20),Zr=window.fetch;function It(r,e={}){let t=new Headers(e.headers||{}),s=q();return qs.add(s),t.append("X-Turbo-Request-Id",s),Zr(r,{...e,headers:t})}function Ve(r){switch(r.toLowerCase()){case"get":return L.get;case"post":return L.post;case"put":return L.put;case"patch":return L.patch;case"delete":return L.delete}}var L={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Ns(r){switch(r.toLowerCase()){case D.multipart:return D.multipart;case D.plain:return D.plain;default:return D.urlEncoded}}var D={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},N=class{abortController=new AbortController;#e=e=>{};constructor(e,t,s,i=new URLSearchParams,n=null,l=D.urlEncoded){let[d,p]=Ss(S(s),t,i,l);this.delegate=e,this.url=d,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:p,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=l}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=Ve(e)||L.get;this.url.search="";let[i,n]=Ss(this.url,s,t,this.enctype);this.url=i,this.fetchOptions.body=n,this.fetchOptions.method=s}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=It(this.url.href,e);let s=await this.response;return await this.receive(s)}catch(s){if(s.name!=="AbortError")throw this.#s(s)&&this.delegate.requestErrored(this,s),s}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new te(e);return v("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return xe(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(i=>this.#e=i),s=v("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await t,s}#s(e){return!v("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function xe(r){return Ve(r)==L.get}function Ss(r,e,t,s){let i=Array.from(t).length>0?new URLSearchParams(Hs(t)):r.searchParams;return xe(e)?[ei(r,i),null]:s==D.urlEncoded?[r,i]:[r,t]}function Hs(r){let e=[];for(let[t,s]of r)s instanceof File||e.push([t,s]);return e}function ei(r,e){let t=new URLSearchParams(Hs(e));return r.search=t.toString(),r}var ot=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},H=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(Wr(e)):e}constructor(e){this.fragment=ti(e)}};function ti(r){for(let e of r.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let s of t.templateElement.content.querySelectorAll("script"))s.replaceWith(le(s));e.replaceWith(t)}return r}var si=100,at=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,s){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,s),this.#e=null},si)}set(e,t,s){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+s)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},ri=10*1e3,Y=new at,X={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},he=class r{state=X.initialized;static confirmMethod(e,t,s){return Promise.resolve(confirm(e))}constructor(e,t,s,i=!1){let n=li(t,s),l=ci(ai(t,s),n),d=ii(t,s),p=hi(t,s);this.delegate=e,this.formElement=t,this.submitter=s,this.fetchRequest=new N(this,n,l,d,t,p),this.mustRedirect=i}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=S(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=X,s=Re("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof s=="string"&&!await r.confirmMethod(s,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=X;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=ni(se("csrf-param"))||se("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(H.contentType)}requestStarted(e){this.state=X.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),ke(this.formElement),v("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Y.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Y.clear(),this.requestMustRedirect(e)&&oi(t)){let s=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,s)}else this.state=X.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=X.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),Oe(this.formElement),v("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||jr("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function ii(r,e){let t=new FormData(r),s=e?.getAttribute("name"),i=e?.getAttribute("value");return s&&t.append(s,i||""),t}function ni(r){if(r!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(s=>s.startsWith(r));if(t){let s=t.split("=").slice(1).join("=");return s?decodeURIComponent(s):void 0}}}function oi(r){return r.statusCode==200&&!r.redirected}function ai(r,e){let t=typeof r.action=="string"?r.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":r.getAttribute("action")||t||""}function ci(r,e){let t=S(r);return xe(e)&&(t.search=""),t}function li(r,e){let t=e?.getAttribute("formmethod")||r.getAttribute("method")||"";return Ve(t.toLowerCase())||L.get}function hi(r,e){return Ns(e?.getAttribute("formenctype")||r.enctype)}var re=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Bs(this.element)}get permanentElements(){return xs(this.element)}getPermanentElementById(e){return Vs(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let s of this.permanentElements){let{id:i}=s,n=e.getPermanentElementById(i);n&&(t[i]=[s,n])}return t}};function Vs(r,e){return r.querySelector(`#${e}[data-turbo-permanent]`)}function xs(r){return r.querySelectorAll("[id][data-turbo-permanent]")}var ue=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,s=e.submitter||void 0;t&&ui(t,s)&&di(t,s)&&this.delegate.willSubmitForm(t,s)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,s))}}};function ui(r,e){return(e?.getAttribute("formmethod")||r.getAttribute("method"))!="dialog"}function di(r,e){if(e?.hasAttribute("formtarget")||r.hasAttribute("target")){let t=e?.getAttribute("formtarget")||r.target;for(let s of document.getElementsByName(t))if(s instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Fe=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(U(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:s,willRender:i,newSnapshot:n}=e,l=i;if(s)try{this.renderPromise=new Promise(A=>this.#e=A),this.renderer=e,await this.prepareToRenderSnapshot(e);let d=new Promise(A=>this.#t=A),p={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,p)||await d,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else l&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},ct=class extends Fe{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new re(this.element)}},Pe=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},Ie=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,s=Yr(t);if(s&&Xr(s)){let i=Ds(s);this.delegate.willFollowLinkToLocation(s,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(s,i))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},Be=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Ie(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,s){return this.delegate.willSubmitFormLinkToLocation(e,t,s)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let s=document.createElement("form"),i="hidden";for(let[I,T]of t.searchParams)s.append(Object.assign(document.createElement("input"),{type:i,name:I,value:T}));let n=Object.assign(t,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",n.href),s.setAttribute("hidden","");let l=e.getAttribute("data-turbo-method");l&&s.setAttribute("method",l);let d=e.getAttribute("data-turbo-frame");d&&s.setAttribute("data-turbo-frame",d);let p=j(e);p&&s.setAttribute("data-turbo-action",p);let y=e.getAttribute("data-turbo-confirm");y&&s.setAttribute("data-turbo-confirm",y),e.hasAttribute("data-turbo-stream")&&s.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,s),document.body.appendChild(s),s.addEventListener("turbo:submit-end",()=>s.remove(),{once:!0}),requestAnimationFrame(()=>s.requestSubmit())}},De=class{static async preservingPermanentElements(e,t,s){let i=new this(e,t);i.enter(),await s(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,s]=this.permanentElementMap[e];this.delegate.enteringBardo(t,s),this.replaceNewPermanentElementWithPlaceholder(s)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=mi(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function mi(r){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var de=class{#e=null;constructor(e,t,s,i,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=n,this.renderElement=s,this.promise=new Promise((l,d)=>this.resolvingFunctions={resolve:l,reject:d})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await De.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},ie=class extends de{static renderElement(e,t){let s=document.createRange();s.selectNodeContents(e),s.deleteContents();let i=t,n=i.ownerDocument?.createRange();n&&(n.selectNodeContents(i),e.appendChild(n.extractContents()))}constructor(e,t,s,i,n,l=!0){super(t,s,i,n,l),this.delegate=e}get shouldRender(){return!0}async render(){await Q(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Q(),this.focusFirstAutofocusableElement(),await Q(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=fi(this.currentElement.getAttribute("data-autoscroll-block"),"end"),s=pi(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:s}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=le(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function fi(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}function pi(r,e){return r=="auto"||r=="smooth"?r:e}var lt=class r{static animationDuration=300;static get defaultCSS(){return Fs`
4
+ .turbo-progress-bar {
5
+ position: fixed;
6
+ display: block;
7
+ top: 0;
8
+ left: 0;
9
+ height: 3px;
10
+ background: #0076ff;
11
+ z-index: 2147483647;
12
+ transition:
13
+ width ${r.animationDuration}ms ease-out,
14
+ opacity ${r.animationDuration/2}ms ${r.animationDuration/2}ms ease-in;
15
+ transform: translate3d(0, 0, 0);
16
+ }
17
+ `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,r.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,r.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=r.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return se("csp-nonce")}},ht=class extends re{detailsByOuterHTML=this.children.filter(e=>!yi(e)).map(e=>Si(e)).reduce((e,t)=>{let{outerHTML:s}=t,i=s in e?e[s]:{type:gi(t),tracked:bi(t),elements:[]};return{...e,[s]:{...i,elements:[...i.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(s=>!(s in t.detailsByOuterHTML)).map(s=>this.detailsByOuterHTML[s]).filter(({type:s})=>s==e).map(({elements:[s]})=>s)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:s,tracked:i,elements:n}=this.detailsByOuterHTML[t];return s==null&&!i?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,s)=>{let{elements:[i]}=this.detailsByOuterHTML[s];return wi(i,e)?i:t},void 0|void 0)}};function gi(r){if(vi(r))return"script";if(Ei(r))return"stylesheet"}function bi(r){return r.getAttribute("data-turbo-track")=="reload"}function vi(r){return r.localName=="script"}function yi(r){return r.localName=="noscript"}function Ei(r){let e=r.localName;return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function wi(r,e){return r.localName=="meta"&&r.getAttribute("name")==e}function Si(r){return r.hasAttribute("nonce")&&r.setAttribute("nonce",""),r}var C=class r extends re{static fromHTMLString(e=""){return this.fromDocument(Os(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:s}){return new this(e,t,new ht(s))}constructor(e,t,s){super(t),this.documentElement=e,this.headSnapshot=s}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),s=e.querySelectorAll("select");for(let[i,n]of t.entries()){let l=s[i];for(let d of l.selectedOptions)d.selected=!1;for(let d of n.selectedOptions)l.options[d.index].selected=!0}for(let i of e.querySelectorAll('input[type="password"]'))i.value="";return new r(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return S(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},ut=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Ai={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},Me={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},F={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ee={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Ti={advance:"forward",restore:"back",replace:"none"},dt=class{identifier=q();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=F.initialized;viewTransitioner=new ut;constructor(e,t,s,i={}){this.delegate=e,this.location=t,this.restorationIdentifier=s||q();let{action:n,historyChanged:l,referrer:d,snapshot:p,snapshotHTML:y,response:A,visitCachedSnapshot:I,willRender:T,updateHistory:tt,shouldCacheSnapshot:st,acceptsStreamResponse:Le,direction:G}={...Ai,...i};this.action=n,this.historyChanged=l,this.referrer=d,this.snapshot=p,this.snapshotHTML=y,this.response=A,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=I,this.willRender=T,this.updateHistory=tt,this.scrolled=!T,this.shouldCacheSnapshot=st,this.acceptsStreamResponse=Le,this.direction=G||Ti[n]}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==F.initialized&&(this.recordTimingMetric(Me.visitStart),this.state=F.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==F.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=F.canceled)}complete(){this.state==F.started&&(this.recordTimingMetric(Me.visitEnd),this.adapter.visitCompleted(this),this.state=F.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==F.started&&(this.state=F.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Ps(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new N(this,L.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Me.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;As(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Me.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,As(e)&&t!=null){let s=C.fromHTMLString(t);await this.renderPageSnapshot(s,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(C.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!U(this.location)||e.hasAnchor(U(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return C.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(H.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let s=await t.responseHTML,{redirected:i,statusCode:n}=t;s==null?this.recordResponse({statusCode:ee.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:s,redirected:i}))}async requestFailedWithResponse(e,t){let s=await t.responseHTML,{redirected:i,statusCode:n}=t;s==null?this.recordResponse({statusCode:ee.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:n,responseHTML:s,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:ee.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=U(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await Q(),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function As(r){return r>=200&&r<300}var mt=class{progressBar=new lt;constructor(e){this.session=e}visitProposedToLocation(e,t){B(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||q(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case ee.networkFailure:case ee.timeoutFailure:case ee.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){v("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},ft=class{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},pt=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Pe(this,t),this.formSubmitObserver=new ue(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,s){return this.#t(e)}linkClickIntercepted(e,t,s){let i=this.#s(e);i&&i.delegate.linkClickIntercepted(e,t,s)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let s=this.#s(e,t);s&&s.delegate.formSubmitted(e,t)}#e(e,t){let s=Ft(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=S(i?.content??"/");return this.#t(e,t)&&B(s,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let i=this.#s(e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1}#s(e,t){let s=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(s&&s!="_top"){let i=this.element.querySelector(`#${s}:not([disabled])`);if(i instanceof M)return i}}},gt=class{location;restorationIdentifier=q();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,s=q()){e===history.pushState&&++this.currentIndex;let i={turbo:{restorationIdentifier:s,restorationIndex:this.currentIndex}};e.call(history,i,"",t.href),this.location=t,this.restorationIdentifier=s}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,s=this.restorationData[t];this.restorationData[t]={...s,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:s,restorationIndex:i}=t;this.restorationIdentifier=s;let n=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,s,n),this.currentIndex=i}}};onPageLoad=async e=>{await _r(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},bt=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#s,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#r,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#s,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#r,!0),this.started=!0};#s=e=>{if(se("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#a(t)){let i=t,n=Ds(i);if(this.delegate.canPrefetchRequestToLocation(i,n)){this.#e=i;let l=new N(this,L.get,n,new URLSearchParams,t);Y.setLater(n.toString(),l,this.#o)}}};#i=e=>{e.target===this.#e&&this.#n()};#n=()=>{Y.clear(),this.#e=null};#r=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="get"){let t=Y.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),Y.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let s=t.closest("turbo-frame"),i=t.getAttribute("data-turbo-frame")||s?.getAttribute("target")||s?.id;i&&i!=="_top"&&(e.headers["Turbo-Frame"]=i)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#o(){return Number(se("turbo-prefetch-cache-time"))||ri}#a(e){return!(!e.getAttribute("href")||Li(e)||Ci(e)||Mi(e)||Ri(e)||Oi(e))}},Li=r=>r.origin!==document.location.origin||!["http:","https:"].includes(r.protocol)||r.hasAttribute("target"),Ci=r=>r.pathname+r.search===document.location.pathname+document.location.search||r.href.startsWith("#"),Mi=r=>{if(r.getAttribute("data-turbo-prefetch")==="false"||r.getAttribute("data-turbo")==="false")return!0;let e=Z(r,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Ri=r=>{let e=r.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||ki(r)||r.hasAttribute("data-turbo-confirm")||r.hasAttribute("data-turbo-stream"))},ki=r=>r.hasAttribute("data-remote")||r.hasAttribute("data-behavior")||r.hasAttribute("data-confirm")||r.hasAttribute("data-method"),Oi=r=>v("turbo:before-prefetch",{target:r,cancelable:!0}).defaultPrevented,vt=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,s={}){this.stop(),this.currentVisit=new dt(this,S(e),t,{referrer:this.location,...s}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new he(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let s=await t.responseHTML;if(s){let i=e.isSafe;i||this.view.clearSnapshotCache();let{statusCode:n,redirected:l}=t,p={action:this.#e(e,t),shouldCacheSnapshot:i,response:{statusCode:n,responseHTML:s,redirected:l}};this.proposeVisit(t.location,p)}}}async formSubmissionFailedWithResponse(e,t){let s=await t.responseHTML;if(s){let i=C.fromHTMLString(s);t.serverError?await this.view.renderError(i,this.currentVisit):await this.view.renderPage(i,!1,!0,this.currentVisit),i.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let s=U(e),i=U(this.view.lastRenderedLocation),n=t==="restore"&&typeof s>"u";return t!=="replace"&&it(e)===it(this.view.lastRenderedLocation)&&(n||s!=null&&s!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:s,formElement:i}=e;return j(s,i)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},W={initial:0,loading:1,interactive:2,complete:3},yt=class{stage=W.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==W.initial&&(this.stage=W.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==W.loading&&(this.stage=W.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==W.interactive&&(this.stage=W.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},Et=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},wt=class{render({fragment:e}){De.preservingPermanentElements(this,Fi(e),()=>{Pi(e,()=>{Ii(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Fi(r){let e=xs(document.documentElement),t={};for(let s of e){let{id:i}=s;for(let n of r.querySelectorAll("turbo-stream")){let l=Vs(n.templateElement.content,i);l&&(t[i]=[s,l])}}return t}async function Pi(r,e){let t=`turbo-stream-autofocus-${q()}`,s=r.querySelectorAll("turbo-stream"),i=Bi(s),n=null;if(i&&(i.id?n=i.id:n=t,i.id=n),e(),await Q(),(document.activeElement==null||document.activeElement==document.body)&&n){let d=document.getElementById(n);Pt(d)&&d.focus(),d&&d.id==t&&d.removeAttribute("id")}}async function Ii(r){let[e,t]=await Gr(r,()=>document.activeElement),s=e&&e.id;if(s){let i=document.getElementById(s);Pt(i)&&i!=t&&i.focus()}}function Bi(r){for(let e of r){let t=Bs(e.templateElement.content);if(t)return t}return null}var St=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=Di(e);t&&qi(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(H.wrap(e))}};function Di(r){let e=r.detail?.fetchResponse;if(e instanceof te)return e}function qi(r){return(r.contentType??"").startsWith(H.contentType)}var qe=class extends de{static renderElement(e,t){let{documentElement:s,body:i}=document;s.replaceChild(t,i)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let s=le(e);t.replaceChild(s,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Ni=function(){let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:T,afterNodeAdded:T,beforeNodeMorphed:T,afterNodeMorphed:T,beforeNodeRemoved:T,afterNodeRemoved:T,beforeAttributeUpdated:T},head:{style:"merge",shouldPreserve:function(o){return o.getAttribute("im-preserve")==="true"},shouldReAppend:function(o){return o.getAttribute("im-re-append")==="true"},shouldRemove:T,afterHeadMorphed:T}};function t(o,a,c={}){o instanceof Document&&(o=o.documentElement),typeof a=="string"&&(a=Er(a));let h=wr(a),u=st(o,h,c);return s(o,h,u)}function s(o,a,c){if(c.head.block){let h=o.querySelector("head"),u=a.querySelector("head");if(h&&u){let m=I(u,h,c);Promise.all(m).then(function(){s(o,a,Object.assign(c,{head:{block:!1,ignore:!0}}))});return}}if(c.morphStyle==="innerHTML")return l(a,o,c),o.children;if(c.morphStyle==="outerHTML"||c.morphStyle==null){let h=Ar(a,o,c),u=h?.previousSibling,m=h?.nextSibling,f=n(o,h,c);return h?Sr(u,f,m):[]}else throw"Do not understand how to morph style "+c.morphStyle}function i(o,a){return a.ignoreActiveValue&&o===document.activeElement&&o!==document.body}function n(o,a,c){if(!(c.ignoreActive&&o===document.activeElement))return a==null?c.callbacks.beforeNodeRemoved(o)===!1?o:(o.remove(),c.callbacks.afterNodeRemoved(o),null):G(o,a)?(c.callbacks.beforeNodeMorphed(o,a)===!1||(o instanceof HTMLHeadElement&&c.head.ignore||(o instanceof HTMLHeadElement&&c.head.style!=="morph"?I(a,o,c):(p(a,o,c),i(o,c)||l(a,o,c))),c.callbacks.afterNodeMorphed(o,a)),o):c.callbacks.beforeNodeRemoved(o)===!1||c.callbacks.beforeNodeAdded(a)===!1?o:(o.parentElement.replaceChild(a,o),c.callbacks.afterNodeAdded(a),c.callbacks.afterNodeRemoved(o),a)}function l(o,a,c){let h=o.firstChild,u=a.firstChild,m;for(;h;){if(m=h,h=m.nextSibling,u==null){if(c.callbacks.beforeNodeAdded(m)===!1)return;a.appendChild(m),c.callbacks.afterNodeAdded(m),x(c,m);continue}if(Le(m,u,c)){n(u,m,c),u=u.nextSibling,x(c,m);continue}let f=vr(o,a,m,u,c);if(f){u=bs(u,f,c),n(f,m,c),x(c,m);continue}let E=yr(o,a,m,u,c);if(E){u=bs(u,E,c),n(E,m,c),x(c,m);continue}if(c.callbacks.beforeNodeAdded(m)===!1)return;a.insertBefore(m,u),c.callbacks.afterNodeAdded(m),x(c,m)}for(;u!==null;){let f=u;u=u.nextSibling,vs(f,c)}}function d(o,a,c,h){return o==="value"&&h.ignoreActiveValue&&a===document.activeElement?!0:h.callbacks.beforeAttributeUpdated(o,a,c)===!1}function p(o,a,c){let h=o.nodeType;if(h===1){let u=o.attributes,m=a.attributes;for(let f of u)d(f.name,a,"update",c)||a.getAttribute(f.name)!==f.value&&a.setAttribute(f.name,f.value);for(let f=m.length-1;0<=f;f--){let E=m[f];d(E.name,a,"remove",c)||o.hasAttribute(E.name)||a.removeAttribute(E.name)}}(h===8||h===3)&&a.nodeValue!==o.nodeValue&&(a.nodeValue=o.nodeValue),i(a,c)||A(o,a,c)}function y(o,a,c,h){if(o[c]!==a[c]){let u=d(c,a,"update",h);u||(a[c]=o[c]),o[c]?u||a.setAttribute(c,o[c]):d(c,a,"remove",h)||a.removeAttribute(c)}}function A(o,a,c){if(o instanceof HTMLInputElement&&a instanceof HTMLInputElement&&o.type!=="file"){let h=o.value,u=a.value;y(o,a,"checked",c),y(o,a,"disabled",c),o.hasAttribute("value")?h!==u&&(d("value",a,"update",c)||(a.setAttribute("value",h),a.value=h)):d("value",a,"remove",c)||(a.value="",a.removeAttribute("value"))}else if(o instanceof HTMLOptionElement)y(o,a,"selected",c);else if(o instanceof HTMLTextAreaElement&&a instanceof HTMLTextAreaElement){let h=o.value,u=a.value;if(d("value",a,"update",c))return;h!==u&&(a.value=h),a.firstChild&&a.firstChild.nodeValue!==h&&(a.firstChild.nodeValue=h)}}function I(o,a,c){let h=[],u=[],m=[],f=[],E=c.head.style,$=new Map;for(let w of o.children)$.set(w.outerHTML,w);for(let w of a.children){let O=$.has(w.outerHTML),ce=c.head.shouldReAppend(w),rt=c.head.shouldPreserve(w);O||rt?ce?u.push(w):($.delete(w.outerHTML),m.push(w)):E==="append"?ce&&(u.push(w),f.push(w)):c.head.shouldRemove(w)!==!1&&u.push(w)}f.push(...$.values());let Es=[];for(let w of f){let O=document.createRange().createContextualFragment(w.outerHTML).firstChild;if(c.callbacks.beforeNodeAdded(O)!==!1){if(O.href||O.src){let ce=null,rt=new Promise(function(Rr){ce=Rr});O.addEventListener("load",function(){ce()}),Es.push(rt)}a.appendChild(O),c.callbacks.afterNodeAdded(O),h.push(O)}}for(let w of u)c.callbacks.beforeNodeRemoved(w)!==!1&&(a.removeChild(w),c.callbacks.afterNodeRemoved(w));return c.head.afterHeadMorphed(a,{added:h,kept:m,removed:u}),Es}function T(){}function tt(o){let a={};return Object.assign(a,e),Object.assign(a,o),a.callbacks={},Object.assign(a.callbacks,e.callbacks),Object.assign(a.callbacks,o.callbacks),a.head={},Object.assign(a.head,e.head),Object.assign(a.head,o.head),a}function st(o,a,c){return c=tt(c),{target:o,newContent:a,config:c,morphStyle:c.morphStyle,ignoreActive:c.ignoreActive,ignoreActiveValue:c.ignoreActiveValue,idMap:Mr(o,a),deadIds:new Set,callbacks:c.callbacks,head:c.head}}function Le(o,a,c){return o==null||a==null?!1:o.nodeType===a.nodeType&&o.tagName===a.tagName?o.id!==""&&o.id===a.id?!0:ae(c,o,a)>0:!1}function G(o,a){return o==null||a==null?!1:o.nodeType===a.nodeType&&o.tagName===a.tagName}function bs(o,a,c){for(;o!==a;){let h=o;o=o.nextSibling,vs(h,c)}return x(c,a),a.nextSibling}function vr(o,a,c,h,u){let m=ae(u,c,a),f=null;if(m>0){let E=h,$=0;for(;E!=null;){if(Le(c,E,u))return E;if($+=ae(u,E,o),$>m)return null;E=E.nextSibling}}return f}function yr(o,a,c,h,u){let m=h,f=c.nextSibling,E=0;for(;m!=null;){if(ae(u,m,o)>0)return null;if(G(c,m))return m;if(G(f,m)&&(E++,f=f.nextSibling,E>=2))return null;m=m.nextSibling}return m}function Er(o){let a=new DOMParser,c=o.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(c.match(/<\/html>/)||c.match(/<\/head>/)||c.match(/<\/body>/)){let h=a.parseFromString(o,"text/html");if(c.match(/<\/html>/))return h.generatedByIdiomorph=!0,h;{let u=h.firstChild;return u?(u.generatedByIdiomorph=!0,u):null}}else{let u=a.parseFromString("<body><template>"+o+"</template></body>","text/html").body.querySelector("template").content;return u.generatedByIdiomorph=!0,u}}function wr(o){if(o==null)return document.createElement("div");if(o.generatedByIdiomorph)return o;if(o instanceof Node){let a=document.createElement("div");return a.append(o),a}else{let a=document.createElement("div");for(let c of[...o])a.append(c);return a}}function Sr(o,a,c){let h=[],u=[];for(;o!=null;)h.push(o),o=o.previousSibling;for(;h.length>0;){let m=h.pop();u.push(m),a.parentElement.insertBefore(m,a)}for(u.push(a);c!=null;)h.push(c),u.push(c),c=c.nextSibling;for(;h.length>0;)a.parentElement.insertBefore(h.pop(),a.nextSibling);return u}function Ar(o,a,c){let h;h=o.firstChild;let u=h,m=0;for(;h;){let f=Tr(h,a,c);f>m&&(u=h,m=f),h=h.nextSibling}return u}function Tr(o,a,c){return G(o,a)?.5+ae(c,o,a):0}function vs(o,a){x(a,o),a.callbacks.beforeNodeRemoved(o)!==!1&&(o.remove(),a.callbacks.afterNodeRemoved(o))}function Lr(o,a){return!o.deadIds.has(a)}function Cr(o,a,c){return(o.idMap.get(c)||r).has(a)}function x(o,a){let c=o.idMap.get(a)||r;for(let h of c)o.deadIds.add(h)}function ae(o,a,c){let h=o.idMap.get(a)||r,u=0;for(let m of h)Lr(o,m)&&Cr(o,m,c)&&++u;return u}function ys(o,a){let c=o.parentElement,h=o.querySelectorAll("[id]");for(let u of h){let m=u;for(;m!==c&&m!=null;){let f=a.get(m);f==null&&(f=new Set,a.set(m,f)),f.add(u.id),m=m.parentElement}}}function Mr(o,a){let c=new Map;return ys(o,c),ys(a,c),c}return{morph:t,defaults:e}}(),K=class extends de{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Kr(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(le(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[s,i]of t.entries()){if(e.tagName=="TITLE"){if(i.tagName!="TITLE")continue;if(e.innerHTML==i.innerHTML)return t.splice(s,1),!0}if(i.isEqualNode(e))return t.splice(s,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=le(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},At=class extends K{async render(){this.willRender&&await this.#e()}get renderMethod(){return"morph"}async#e(){this.#t(this.currentElement,this.newElement),this.#a(),v("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})}#t(e,t,s="outerHTML"){this.isMorphingTurboFrame=this.#c(e),Ni.morph(e,t,{ignoreActiveValue:!0,morphStyle:s,callbacks:{beforeNodeAdded:this.#s,beforeNodeMorphed:this.#i,beforeAttributeUpdated:this.#n,beforeNodeRemoved:this.#o,afterNodeMorphed:this.#r}})}#s=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));#i=(e,t)=>{if(e instanceof HTMLElement)return!e.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!this.#c(e))?!v("turbo:before-morph-element",{cancelable:!0,target:e,detail:{newElement:t}}).defaultPrevented:!1};#n=(e,t,s)=>!v("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:s}}).defaultPrevented;#r=(e,t)=>{t instanceof HTMLElement&&v("turbo:morph-element",{target:e,detail:{newElement:t}})};#o=e=>this.#i(e);#a(){this.#d().forEach(e=>{this.#c(e)&&(this.#h(e),e.reload())})}#h(e){e.addEventListener("turbo:before-frame-render",t=>{t.detail.render=this.#u},{once:!0})}#u=(e,t)=>{v("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),this.#t(e,t.children,"innerHTML")};#c(e){return e.src&&e.refresh==="morph"}#d(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(e=>!e.closest("[data-turbo-permanent]"))}},Tt=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return Ce(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[Ce(e)]}write(e,t){this.snapshots[Ce(e)]=t}touch(e){let t=Ce(e),s=this.keys.indexOf(t);s>-1&&this.keys.splice(s,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},Lt=class extends Fe{snapshotCache=new Tt(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,s=!0,i){let l=this.isPageRefresh(i)&&this.snapshot.shouldMorphPage?At:K,d=new l(this.snapshot,e,K.renderElement,t,s);return d.shouldRender?i?.changeHistory():this.forceReloaded=!0,this.render(d)}renderError(e,t){t?.changeHistory();let s=new qe(this.snapshot,e,qe.renderElement,!1);return this.render(s)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await ks();let s=e.clone();return this.snapshotCache.put(t,s),s}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return C.fromElement(this.element)}},Ct=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new N(this,L.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let s=await t.responseHTML,i=C.fromHTMLString(s);this.snapshotCache.put(e.url,i)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},Mt=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Jr("turbo-cache-control",e)}},Rt=class{navigator=new vt(this);history=new gt(this);view=new Lt(this,document.documentElement);adapter=new mt(this);pageObserver=new yt(this);cacheObserver=new ft;linkPrefetchObserver=new bt(this,document);linkClickObserver=new Ie(this,window);formSubmitObserver=new ue(this,document);scrollObserver=new Et(this);streamObserver=new St(this);formLinkClickObserver=new Be(this,document.documentElement);frameRedirector=new pt(this,document.documentElement);streamMessageRenderer=new wt;cache=new Mt(this);drive=!0;enabled=!0;progressBarDelay=500;started=!1;formMode="on";#e=150;constructor(e){this.recentRequests=e,this.preloader=new Ct(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let s=t.frame?document.getElementById(t.frame):null;if(s instanceof M){let i=t.action||j(s);s.delegate.proposeVisitIfNavigatedWithAction(s,i),s.src=e.toString()}else this.navigator.proposeVisit(S(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||(this.cache.exemptPageFromPreview(),this.visit(e,{action:"replace"}))}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(H.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=Qr(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),s=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),n=i=="_top"?null:document.getElementById(i)||Z(e,"turbo-frame:not([disabled])");if(t||s||n instanceof M)return!1;{let l=new URL(e.href);return this.elementIsNavigatable(e)&&B(l,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,s){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:s}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&B(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&B(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,s){return this.elementIsNavigatable(e)&&B(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,s)}followedLinkToLocation(e,t){let s=this.getActionForLink(e),i=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:s,acceptsStreamResponse:i})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Ts(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(ke(document.documentElement),this.view.markVisitDirection(e.direction)),Ts(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Oe(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let s=Ft(e,t);return this.submissionIsNavigatable(e,t)&&B(S(s),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let s=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:i,detail:{render:n}}=s;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!i}viewRenderedSnapshot(e,t,s){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(s)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,s){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,s).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,s){return v("turbo:click",{target:e,detail:{url:t.href,originalEvent:s},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return v("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return v("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return v("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return v("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return v("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return v("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return v("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return v("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let s=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?s&&e.closest('[data-turbo="true"]')!=null:s&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=Z(e,"[data-turbo]"),s=Z(e,"turbo-frame");return this.drive||s?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return j(e)||"advance"}get snapshot(){return this.view.snapshot}};function Ts(r){Object.defineProperties(r,Hi)}var Hi={absoluteURL:{get(){return this.toString()}}},b=new Rt(qs),{cache:$s,navigator:Ws}=b;function Bt(){b.start()}function _s(r){b.registerAdapter(r)}function Us(r,e){b.visit(r,e)}function me(r){b.connectStreamSource(r)}function fe(r){b.disconnectStreamSource(r)}function js(r){b.renderStreamMessage(r)}function Ks(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),b.clearCache()}function zs(r){b.setProgressBarDelay(r)}function Js(r){he.confirmMethod=r}function Gs(r){b.setFormMode(r)}var Vi=Object.freeze({__proto__:null,navigator:Ws,session:b,cache:$s,PageRenderer:K,PageSnapshot:C,FrameRenderer:ie,fetch:It,start:Bt,registerAdapter:_s,visit:Us,connectStreamSource:me,disconnectStreamSource:fe,renderStreamMessage:js,clearCache:Ks,setProgressBarDelay:zs,setConfirmMethod:Js,setFormMode:Gs}),kt=class extends Error{},Ot=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#s=!1;#i=!1;#n=new Set;action=null;constructor(e){this.element=e,this.view=new ct(this,this.element),this.appearanceObserver=new ot(this,this.element),this.formLinkClickObserver=new Be(this,this.element),this.linkInterceptor=new Pe(this,this.element),this.restorationIdentifier=q(),this.formSubmitObserver=new ue(this,this.element)}connect(){this.#s||(this.#s=!0,this.loadingStyle==_.lazy?this.appearanceObserver.start():this.#r(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#s&&(this.#s=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==_.eager&&this.#r()}sourceURLChanged(){this.#g("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==_.eager||this.#i)&&this.#r())}sourceURLReloaded(){let{src:e}=this.element;return this.#f("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.#g("complete")||this.#r()}loadingStyleChanged(){this.loadingStyle==_.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#r())}async#r(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#a(S(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#i=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let s=Os(t);C.fromDocument(s).isVisitable?await this.#o(e,s):await this.#u(e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,j(e)),this.#r()}willSubmitFormLinkToLocation(e){return this.#m(e)}submittedFormLinkToLocation(e,t,s){let i=this.#l(e);i&&s.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,s){return this.#m(e)}linkClickIntercepted(e,t){this.#h(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#m(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new he(this,e,t);let{fetchRequest:s}=this.formSubmission;this.prepareRequest(s),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(H.contentType)}requestStarted(e){ke(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Oe(this.element)}formSubmissionStarted({formElement:e}){ke(e,this.#l(e))}formSubmissionSucceededWithResponse(e,t){let s=this.#l(e.formElement,e.submitter);s.delegate.proposeVisitIfNavigatedWithAction(s,j(e.submitter,e.formElement,s)),s.delegate.loadResponse(t),e.isSafe||b.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),b.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Oe(e,this.#l(e))}allowsImmediateRender({element:e},t){let s=v("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:i,detail:{render:n}}=s;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!i}viewRenderedSnapshot(e,t,s){}preloadOnLoadLinksForView(e){b.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#o(e,t){let s=await this.extractForeignFrameElement(t.body);if(s){let i=new re(s),n=new ie(this,this.view.snapshot,i,ie.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,b.frameRendered(e,this.element),b.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#c(e)&&this.#d(e)}async#a(e){let t=new N(this,L.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(s=>{this.#t=()=>{this.#t=()=>{},this.#e=null,s()},t.perform()})}#h(e,t,s){let i=this.#l(e,s);i.delegate.proposeVisitIfNavigatedWithAction(i,j(s,e,i)),this.#y(e,()=>{i.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let s=C.fromElement(e).clone(),{visitCachedSnapshot:i}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:l,redirected:d}=n,p=await n.responseHTML,A={response:{statusCode:l,redirected:d,responseHTML:p},visitCachedSnapshot:i,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(A.action=this.action),b.visit(e.src,A)}}}}changeHistory(){if(this.action){let e=Ps(this.action);b.history.update(e,S(this.element.src||""),this.restorationIdentifier)}}async#u(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#p(e.response)}#c(e){this.element.setAttribute("complete","");let t=e.response,s=async(n,l)=>{n instanceof Response?this.#p(n):b.visit(n,l)};return!v("turbo:frame-missing",{target:this.element,detail:{response:t,visit:s},cancelable:!0}).defaultPrevented}#d(e){this.view.missing(),this.#b(e)}#b(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new kt(t)}async#p(e){let t=new te(e),s=await t.responseHTML,{location:i,redirected:n,statusCode:l}=t;return b.visit(i,{response:{redirected:n,statusCode:l,responseHTML:s}})}#l(e,t){let s=Re("data-turbo-frame",t,e)||this.element.getAttribute("target");return Ls(s)??this.element}async extractForeignFrameElement(e){let t,s=CSS.escape(this.id);try{if(t=Cs(e.querySelector(`turbo-frame#${s}`),this.sourceURL),t)return t;if(t=Cs(e.querySelector(`turbo-frame[src][recurse~=${s}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(i){return console.error(i),new M}return null}#v(e,t){let s=Ft(e,t);return B(S(s),this.rootLocation)}#m(e,t){let s=Re("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#v(e,t)||!this.enabled||s=="_top")return!1;if(s){let i=Ls(s);if(i)return!i.disabled}return!(!b.elementIsNavigatable(e)||t&&!b.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#f("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.#f("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.#s}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return S(t)}#g(e){return this.#n.has(e)}#f(e,t){this.#n.add(e),t(),this.#n.delete(e)}#y(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Ls(r){if(r!=null){let e=document.getElementById(r);if(e instanceof M)return e}}function Cs(r,e){if(r){let t=r.getAttribute("src");if(t!=null&&e!=null&&qr(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof M)return r.connectedCallback(),r.disconnectedCallback(),r}}var Dt={after(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>r.parentElement?.insertBefore(this.templateContent,r))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})},refresh(){b.refresh(this.baseURI,this.requestId)}},Ne=class r extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await Q(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(s=>[...s.children]).filter(s=>!!s.id),t=[...this.templateContent?.children||[]].filter(s=>!!s.id).map(s=>s.id);return e.filter(s=>t.includes(s.id))}get performAction(){if(this.action){let e=Dt[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:r.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},He=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),me(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),fe(this.streamSource))}get src(){return this.getAttribute("src")||""}};M.delegateConstructor=Ot;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",M);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Ne);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",He);(()=>{let r=document.currentScript;if(r&&!r.hasAttribute("data-turbo-suppress-warning"))for(r=r.parentElement;r;){if(r==document.body)return console.warn(Fs`
18
+ You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
19
+
20
+ Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
21
+
22
+ For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
23
+
24
+ ——
25
+ Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
26
+ `,r.outerHTML);r=r.parentElement}})();window.Turbo={...Vi,StreamActions:Dt};Bt();var sr;async function _i(){return sr||tr(Ui().then(tr))}function tr(r){return sr=r}async function Ui(){let{createConsumer:r}=await Promise.resolve().then(()=>(er(),Zs));return r()}async function rr(r,e){let{subscriptions:t}=await _i();return t.create(r,e)}function Ee(r){return!r||typeof r!="object"||r instanceof Date||r instanceof RegExp?r:Array.isArray(r)?r.map(Ee):Object.keys(r).reduce(function(e,t){var s=t[0].toLowerCase()+t.slice(1).replace(/([A-Z]+)/g,function(i,n){return"_"+n.toLowerCase()});return e[s]=Ee(r[t]),e},{})}var Kt=class extends HTMLElement{async connectedCallback(){me(this),this.subscription=await rr(this.channel,{received:this.dispatchMessageEvent.bind(this),connected:this.subscriptionConnected.bind(this),disconnected:this.subscriptionDisconnected.bind(this)})}disconnectedCallback(){fe(this),this.subscription&&this.subscription.unsubscribe()}dispatchMessageEvent(e){let t=new MessageEvent("message",{data:e});return this.dispatchEvent(t)}subscriptionConnected(){this.setAttribute("connected","")}subscriptionDisconnected(){this.removeAttribute("connected")}get channel(){let e=this.getAttribute("channel"),t=this.getAttribute("signed-stream-name");return{channel:e,signed_stream_name:t,...Ee({...this.dataset})}}};customElements.get("turbo-cable-stream-source")===void 0&&customElements.define("turbo-cable-stream-source",Kt);function ir(r){if(r.target instanceof HTMLFormElement){let{target:e,detail:{fetchOptions:t}}=r;e.addEventListener("turbo:submit-start",({detail:{formSubmission:{submitter:s}}})=>{let i=Ji(t.body)?t.body:new URLSearchParams,n=Ki(s,i,e);/get/i.test(n)||(/post/i.test(n)?i.delete("_method"):i.set("_method",n),t.method="post")},{once:!0})}}function Ki(r,e,t){let s=zi(r),i=e.get("_method"),n=t.getAttribute("method")||"get";return typeof s=="string"?s:typeof i=="string"?i:n}function zi(r){return r instanceof HTMLButtonElement||r instanceof HTMLInputElement?r.name==="_method"?r.value:r.hasAttribute("formmethod")?r.formMethod:null:null}function Ji(r){return r instanceof FormData||r instanceof URLSearchParams}window.Turbo=qt;addEventListener("turbo:before-fetch-request",ir);var zt=class{constructor(e,t,s){this.eventTarget=e,this.eventName=t,this.eventOptions=s,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=Gi(e);for(let s of this.bindings){if(t.immediatePropagationStopped)break;s.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let s=e.index,i=t.index;return s<i?-1:s>i?1:0})}};function Gi(r){if("immediatePropagationStopped"in r)return r;{let{stopImmediatePropagation:e}=r;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Jt=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,s={}){this.application.handleError(e,`Error ${t}`,s)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:s,eventOptions:i}=e,n=this.fetchEventListenerMapForEventTarget(t),l=this.cacheKey(s,i);n.delete(l),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:s,eventOptions:i}=e;return this.fetchEventListener(t,s,i)}fetchEventListener(e,t,s){let i=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,s),l=i.get(n);return l||(l=this.createEventListener(e,t,s),i.set(n,l)),l}createEventListener(e,t,s){let i=new zt(e,t,s);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let s=[e];return Object.keys(t).sort().forEach(i=>{s.push(`${t[i]?"":"!"}${i}`)}),s.join(":")}},Xi={stop({event:r,value:e}){return e&&r.stopPropagation(),!0},prevent({event:r,value:e}){return e&&r.preventDefault(),!0},self({event:r,value:e,element:t}){return e?t===r.target:!0}},Yi=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Qi(r){let t=r.trim().match(Yi)||[],s=t[2],i=t[3];return i&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${i}`,i=""),{eventTarget:Zi(t[4]),eventName:s,eventOptions:t[7]?en(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||i}}function Zi(r){if(r=="window")return window;if(r=="document")return document}function en(r){return r.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function tn(r){if(r==window)return"window";if(r==document)return"document"}function gs(r){return r.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Gt(r){return gs(r.replace(/--/g,"-").replace(/__/g,"_"))}function Se(r){return r.charAt(0).toUpperCase()+r.slice(1)}function fr(r){return r.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function sn(r){return r.match(/[^\s]+/g)||[]}function nr(r){return r!=null}function Xt(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var or=["meta","ctrl","alt","shift"],Yt=class{constructor(e,t,s,i){this.element=e,this.index=t,this.eventTarget=s.eventTarget||e,this.eventName=s.eventName||rn(e)||Ke("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||Ke("missing identifier"),this.methodName=s.methodName||Ke("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=i}static forToken(e,t){return new this(e.element,e.index,Qi(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let s=t.filter(i=>!or.includes(i))[0];return s?(Xt(this.keyMappings,s)||Ke(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[s].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:s,value:i}of Array.from(this.element.attributes)){let n=s.match(t),l=n&&n[1];l&&(e[gs(l)]=nn(i))}return e}get eventTargetName(){return tn(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[s,i,n,l]=or.map(d=>t.includes(d));return e.metaKey!==s||e.ctrlKey!==i||e.altKey!==n||e.shiftKey!==l}},ar={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function rn(r){let e=r.tagName.toLowerCase();if(e in ar)return ar[e](r)}function Ke(r){throw new Error(r)}function nn(r){try{return JSON.parse(r)}catch{return r}}var Qt=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:s}=this.context.application,{controller:i}=this.context,n=!0;for(let[l,d]of Object.entries(this.eventOptions))if(l in s){let p=s[l];n=n&&p({name:l,value:d,event:e,element:t,controller:i})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:s}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:s,action:this.methodName})}catch(i){let{identifier:n,controller:l,element:d,index:p}=this,y={identifier:n,controller:l,element:d,index:p,event:e};this.context.handleError(i,`invoking action "${this.action}"`,y)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},ze=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let s=this.elementFromNode(t);s&&this.processTree(s,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let s=this.elementFromNode(t);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let s of this.matchElementsInTree(e))t.call(this,s)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},Je=class{constructor(e,t,s){this.attributeName=t,this.delegate=s,this.elementObserver=new ze(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(this.selector));return t.concat(s)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function on(r,e,t){pr(r,e).add(t)}function an(r,e,t){pr(r,e).delete(t),cn(r,e)}function pr(r,e){let t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function cn(r,e){let t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var P=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,s)=>t.concat(Array.from(s)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,s)=>t+s.size,0)}add(e,t){on(this.valuesByKey,e,t)}delete(e,t){an(this.valuesByKey,e,t)}has(e,t){let s=this.valuesByKey.get(e);return s!=null&&s.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(s=>s.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,s])=>s.has(e)).map(([t,s])=>t)}};var Zt=class{constructor(e,t,s,i){this._selector=t,this.details=i,this.elementObserver=new ze(e,this),this.delegate=s,this.matchesByElement=new P}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let s=e.matches(t);return this.delegate.selectorMatchElement?s&&this.delegate.selectorMatchElement(e,this.details):s}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let s=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return s.concat(i)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let s of t)this.selectorUnmatched(e,s)}elementAttributeChanged(e,t){let{selector:s}=this;if(s){let i=this.matchElement(e),n=this.matchesByElement.has(s,e);i&&!n?this.selectorMatched(e,s):!i&&n&&this.selectorUnmatched(e,s)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},es=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let s=this.delegate.getStringMapKeyForAttribute(e);if(s!=null){this.stringMap.has(e)||this.stringMapKeyAdded(s,e);let i=this.element.getAttribute(e);if(this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,s,t),i==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(s,e,n)}else this.stringMap.set(e,i)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,s)}stringMapKeyRemoved(e,t,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,s)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},Ge=class{constructor(e,t,s){this.attributeObserver=new Je(e,t,this),this.delegate=s,this.tokensByElement=new P}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,s]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(s)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),s=this.readTokensForElement(e),i=hn(t,s).findIndex(([n,l])=>!un(n,l));return i==-1?[[],[]]:[t.slice(i),s.slice(i)]}readTokensForElement(e){let t=this.attributeName,s=e.getAttribute(t)||"";return ln(s,e,t)}};function ln(r,e,t){return r.trim().split(/\s+/).filter(s=>s.length).map((s,i)=>({element:e,attributeName:t,content:s,index:i}))}function hn(r,e){let t=Math.max(r.length,e.length);return Array.from({length:t},(s,i)=>[r[i],e[i]])}function un(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var Xe=class{constructor(e,t,s){this.tokenListObserver=new Ge(e,t,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:s}=this.fetchParseResultForToken(e);s&&(this.fetchValuesByTokenForElement(t).set(e,s),this.delegate.elementMatchedValue(t,s))}tokenUnmatched(e){let{element:t}=e,{value:s}=this.fetchParseResultForToken(e);s&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,s))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},ts=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Xe(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new Qt(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=Yt.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},ss=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new es(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let s=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,s.writer(this.receiver[e]),s.writer(s.defaultValue))}stringMapValueChanged(e,t,s){let i=this.valueDescriptorNameMap[t];e!==null&&(s===null&&(s=i.writer(i.defaultValue)),this.invokeChangedCallback(t,e,s))}stringMapKeyRemoved(e,t,s){let i=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,i.writer(this.receiver[e]),s):this.invokeChangedCallback(e,i.writer(i.defaultValue),s)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:s,writer:i}of this.valueDescriptors)s!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,i(s),void 0)}invokeChangedCallback(e,t,s){let i=`${e}Changed`,n=this.receiver[i];if(typeof n=="function"){let l=this.valueDescriptorNameMap[e];try{let d=l.reader(t),p=s;s&&(p=l.reader(s)),n.call(this.receiver,d,p)}catch(d){throw d instanceof TypeError&&(d.message=`Stimulus Value "${this.context.identifier}.${l.name}" - ${d.message}`),d}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let s=this.valueDescriptorMap[t];e[s.name]=s}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],s=`has${Se(t.name)}`;return this.receiver[s]}},rs=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new P}start(){this.tokenListObserver||(this.tokenListObserver=new Ge(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var s;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var s;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Ae(r,e){let t=gr(r);return Array.from(t.reduce((s,i)=>(mn(i,e).forEach(n=>s.add(n)),s),new Set))}function dn(r,e){return gr(r).reduce((s,i)=>(s.push(...fn(i,e)),s),[])}function gr(r){let e=[];for(;r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function mn(r,e){let t=r[e];return Array.isArray(t)?t:[]}function fn(r,e){let t=r[e];return t?Object.keys(t).map(s=>[s,t[s]]):[]}var is=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new P,this.outletElementsByName=new P,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:s}){let i=this.getOutlet(e,s);i&&this.connectOutlet(i,e,s)}selectorUnmatched(e,t,{outletName:s}){let i=this.getOutletFromMap(e,s);i&&this.disconnectOutlet(i,e,s)}selectorMatchElement(e,{outletName:t}){let s=this.selector(t),i=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return s?i&&n&&e.matches(s):!1}elementMatchedAttribute(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}elementAttributeValueChanged(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}elementUnmatchedAttribute(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}connectOutlet(e,t,s){var i;this.outletElementsByName.has(s,t)||(this.outletsByName.add(s,e),this.outletElementsByName.add(s,t),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletConnected(e,t,s)))}disconnectOutlet(e,t,s){var i;this.outletElementsByName.has(s,t)&&(this.outletsByName.delete(s,e),this.outletElementsByName.delete(s,t),(i=this.selectorObserverMap.get(s))===null||i===void 0||i.pause(()=>this.delegate.outletDisconnected(e,t,s)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let s of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(s,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),s=new Zt(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,s),s.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),s=new Je(this.scope.element,t,this);this.attributeObserverMap.set(e,s),s.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new P;return this.router.modules.forEach(t=>{let s=t.definition.controllerConstructor;Ae(s,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(s=>s.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},ns=class{constructor(e,t){this.logDebugActivity=(s,i={})=>{let{identifier:n,controller:l,element:d}=this;i=Object.assign({identifier:n,controller:l,element:d},i),this.application.logDebugActivity(this.identifier,s,i)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new ts(this,this.dispatcher),this.valueObserver=new ss(this,this.controller),this.targetObserver=new rs(this,this),this.outletObserver=new is(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(s){this.handleError(s,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,s={}){let{identifier:i,controller:n,element:l}=this;s=Object.assign({identifier:i,controller:n,element:l},s),this.application.handleError(e,`Error ${t}`,s)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,s){this.invokeControllerMethod(`${Gt(s)}OutletConnected`,e,t)}outletDisconnected(e,t,s){this.invokeControllerMethod(`${Gt(s)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let s=this.controller;typeof s[e]=="function"&&s[e](...t)}};function pn(r){return gn(r,bn(r))}function gn(r,e){let t=wn(r),s=vn(r.prototype,e);return Object.defineProperties(t.prototype,s),t}function bn(r){return Ae(r,"blessings").reduce((t,s)=>{let i=s(r);for(let n in i){let l=t[n]||{};t[n]=Object.assign(l,i[n])}return t},{})}function vn(r,e){return En(e).reduce((t,s)=>{let i=yn(r,e,s);return i&&Object.assign(t,{[s]:i}),t},{})}function yn(r,e,t){let s=Object.getOwnPropertyDescriptor(r,t);if(!(s&&"value"in s)){let n=Object.getOwnPropertyDescriptor(e,t).value;return s&&(n.get=s.get||n.get,n.set=s.set||n.set),n}}var En=typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames,wn=(()=>{function r(t){function s(){return Reflect.construct(t,arguments,new.target)}return s.prototype=Object.create(t.prototype,{constructor:{value:s}}),Reflect.setPrototypeOf(s,t),s}function e(){let s=r(function(){this.a.call(this)});return s.prototype.a=function(){},new s}try{return e(),r}catch{return s=>class extends s{}}})();function Sn(r){return{identifier:r.identifier,controllerConstructor:pn(r.controllerConstructor)}}var os=class{constructor(e,t){this.application=e,this.definition=Sn(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new ns(this,e),this.contextsByScope.set(e,t)),t}},as=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return sn(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},cs=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let s=this.getAttributeNameForKey(e);return this.element.setAttribute(s,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${fr(e)}`}},ls=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,s){let i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(s,e))}};function hs(r,e){return`[${r}~="${e}"]`}var us=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,s)=>t||this.findTarget(s)||this.findLegacyTarget(s),void 0)}findAll(...e){return e.reduce((t,s)=>[...t,...this.findAllTargets(s),...this.findAllLegacyTargets(s)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return hs(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(s=>this.deprecate(s,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return hs(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:s}=this,i=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(s);this.guide.warn(e,`target:${t}`,`Please replace ${i}="${s}.${t}" with ${n}="${t}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},ds=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,s)=>t||this.findOutlet(s),void 0)}findAll(...e){return e.reduce((t,s)=>[...t,...this.findAllOutlets(s)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(i=>this.matchesElement(i,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(i=>this.matchesElement(i,e,t))}matchesElement(e,t,s){let i=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&i.split(" ").includes(s)}},ms=class r{constructor(e,t,s,i){this.targets=new us(this),this.classes=new as(this),this.data=new cs(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=s,this.guide=new ls(i),this.outlets=new ds(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return hs(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new r(this.schema,document.documentElement,this.identifier,this.guide.logger)}},fs=class{constructor(e,t,s){this.element=e,this.schema=t,this.delegate=s,this.valueListObserver=new Xe(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:s}=e;return this.parseValueForElementAndIdentifier(t,s)}parseValueForElementAndIdentifier(e,t){let s=this.fetchScopesByIdentifierForElement(e),i=s.get(t);return i||(i=this.delegate.createScopeForElementAndIdentifier(e,t),s.set(t,i)),i}elementMatchedValue(e,t){let s=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,s),s==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let s=this.scopeReferenceCounts.get(t);s&&(this.scopeReferenceCounts.set(t,s-1),s==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},ps=class{constructor(e){this.application=e,this.scopeObserver=new fs(this.element,this.schema,this),this.scopesByIdentifier=new P,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new os(this.application,e);this.connectModule(t);let s=e.controllerConstructor.afterLoad;s&&s.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let s=this.modulesByIdentifier.get(t);if(s)return s.contexts.find(i=>i.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let s=this.scopeObserver.parseValueForElementAndIdentifier(e,t);s?this.scopeObserver.elementMatchedValue(s.element,s):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,s){this.application.handleError(e,t,s)}createScopeForElementAndIdentifier(e,t){return new ms(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(s=>e.connectContextForScope(s))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(s=>e.disconnectContextForScope(s))}},An={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:r=>`data-${r}-target`,outletAttributeForScope:(r,e)=>`data-${r}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},cr("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),cr("0123456789".split("").map(r=>[r,r])))};function cr(r){return r.reduce((e,[t,s])=>Object.assign(Object.assign({},e),{[t]:s}),{})}var Ye=class{constructor(e=document.documentElement,t=An){this.logger=console,this.debug=!1,this.logDebugActivity=(s,i,n={})=>{this.debug&&this.logFormattedMessage(s,i,n)},this.element=e,this.schema=t,this.dispatcher=new Jt(this),this.router=new ps(this),this.actionDescriptorFilters=Object.assign({},Xi)}static start(e,t){let s=new this(e,t);return s.start(),s}async start(){await Tn(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(i=>{i.controllerConstructor.shouldLoad&&this.router.loadDefinition(i)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(i=>this.router.unloadIdentifier(i))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let s=this.router.getContextForElementAndIdentifier(e,t);return s?s.controller:null}handleError(e,t,s){var i;this.logger.error(`%s
27
+
28
+ %o
29
+
30
+ %o`,t,e,s),(i=window.onerror)===null||i===void 0||i.call(window,t,"",0,0,e)}logFormattedMessage(e,t,s={}){s=Object.assign({application:this},s),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},s)),this.logger.groupEnd()}};function Tn(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function Ln(r){return Ae(r,"classes").reduce((t,s)=>Object.assign(t,Cn(s)),{})}function Cn(r){return{[`${r}Class`]:{get(){let{classes:e}=this;if(e.has(r))return e.get(r);{let t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${Se(r)}Class`]:{get(){return this.classes.has(r)}}}}function Mn(r){return Ae(r,"outlets").reduce((t,s)=>Object.assign(t,Rn(s)),{})}function lr(r,e,t){return r.application.getControllerForElementAndIdentifier(e,t)}function hr(r,e,t){let s=lr(r,e,t);if(s||(r.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),s=lr(r,e,t),s))return s}function Rn(r){let e=Gt(r);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(r),s=this.outlets.getSelectorForOutletName(r);if(t){let i=hr(this,t,r);if(i)return i;throw new Error(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(r);return t.length>0?t.map(s=>{let i=hr(this,s,r);if(i)return i;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,s)}).filter(s=>s):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(r),s=this.outlets.getSelectorForOutletName(r);if(t)return t;throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${Se(e)}Outlet`]:{get(){return this.outlets.has(r)}}}}function kn(r){return Ae(r,"targets").reduce((t,s)=>Object.assign(t,On(s)),{})}function On(r){return{[`${r}Target`]:{get(){let e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${Se(r)}Target`]:{get(){return this.targets.has(r)}}}}function Fn(r){let e=dn(r,"values"),t={valueDescriptorMap:{get(){return e.reduce((s,i)=>{let n=br(i,this.identifier),l=this.data.getAttributeNameForKey(n.key);return Object.assign(s,{[l]:n})},{})}}};return e.reduce((s,i)=>Object.assign(s,Pn(i)),t)}function Pn(r,e){let t=br(r,e),{key:s,name:i,reader:n,writer:l}=t;return{[i]:{get(){let d=this.data.get(s);return d!==null?n(d):t.defaultValue},set(d){d===void 0?this.data.delete(s):this.data.set(s,l(d))}},[`has${Se(i)}`]:{get(){return this.data.has(s)||t.hasCustomDefaultValue}}}}function br([r,e],t){return qn({controller:t,token:r,typeDefinition:e})}function Qe(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function we(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(r))return"array";if(Object.prototype.toString.call(r)==="[object Object]")return"object"}function In(r){let{controller:e,token:t,typeObject:s}=r,i=nr(s.type),n=nr(s.default),l=i&&n,d=i&&!n,p=!i&&n,y=Qe(s.type),A=we(r.typeObject.default);if(d)return y;if(p)return A;if(y!==A){let I=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${I}" must match the defined type "${y}". The provided default value of "${s.default}" is of type "${A}".`)}if(l)return y}function Bn(r){let{controller:e,token:t,typeDefinition:s}=r,n=In({controller:e,token:t,typeObject:s}),l=we(s),d=Qe(s),p=n||l||d;if(p)return p;let y=e?`${e}.${s}`:t;throw new Error(`Unknown value type "${y}" for "${t}" value`)}function Dn(r){let e=Qe(r);if(e)return ur[e];let t=Xt(r,"default"),s=Xt(r,"type"),i=r;if(t)return i.default;if(s){let{type:n}=i,l=Qe(n);if(l)return ur[l]}return r}function qn(r){let{token:e,typeDefinition:t}=r,s=`${fr(e)}-value`,i=Bn(r);return{type:i,key:s,name:gs(s),get defaultValue(){return Dn(t)},get hasCustomDefaultValue(){return we(t)!==void 0},reader:Nn[i],writer:dr[i]||dr.default}}var ur={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Nn={array(r){let e=JSON.parse(r);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${r}" of type "${we(e)}"`);return e},boolean(r){return!(r=="0"||String(r).toLowerCase()=="false")},number(r){return Number(r.replace(/_/g,""))},object(r){let e=JSON.parse(r);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${r}" of type "${we(e)}"`);return e},string(r){return r}},dr={default:Hn,array:mr,object:mr};function mr(r){return JSON.stringify(r)}function Hn(r){return`${r}`}var k=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:s={},prefix:i=this.identifier,bubbles:n=!0,cancelable:l=!0}={}){let d=i?`${i}:${e}`:e,p=new CustomEvent(d,{detail:s,bubbles:n,cancelable:l});return t.dispatchEvent(p),p}};k.blessings=[Ln,kn,Fn,Mn];k.targets=[];k.outlets=[];k.values={};var Te=Ye.start();Te.debug=!1;window.Stimulus=Te;var Ze=class extends k{static targets=["item"];static classes=["hidden"];connect(){this.class=this.hasHiddenClass?this.hiddenClass:"hidden"}toggle(){this.itemTargets.forEach(r=>{r.classList.toggle(this.class)})}show(){this.itemTargets.forEach(r=>{r.classList.remove(this.class)})}hide(){this.itemTargets.forEach(r=>{r.classList.add(this.class)})}};var et=class extends k{static classes=["active"];static targets=["button","tab"];static values={defaultTab:String};connect(){this.tabTargets.map(r=>{r.id!=this.defaultTabValue&&(r.hidden=!0)}),this.buttonTargets.find(r=>{r.id===this.defaultTabValue&&r.classList.add(...this.activeClasses)})}select(r){let e=this.tabTargets.find(t=>t.id===r.currentTarget.id);e.hidden&&(this.tabTargets.map(t=>t.hidden=!0),this.buttonTargets.map(t=>t.classList.remove(...this.activeClasses)),e.hidden=!1,r.currentTarget.classList.add(...this.activeClasses))}};Te.register("reveal",Ze);Te.register("tabs",et);
31
+ /*! Bundled license information:
32
+
33
+ @hotwired/turbo/dist/turbo.es2017-esm.js:
34
+ (*!
35
+ Turbo 8.0.2
36
+ Copyright © 2024 37signals LLC
37
+ *)
38
+ */
39
+ //# sourceMappingURL=application.js.map