var ur=Object.defineProperty;var mr=(s,e,t)=>e in s?ur(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t)=>(mr(s,typeof e!="symbol"?e+"":e,t),t),Mt=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var f=(s,e,t)=>(Mt(s,e,"read from private field"),t?t.call(s):e.get(s)),m=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},S=(s,e,t,r)=>(Mt(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t);var g=(s,e,t)=>(Mt(s,e,"access private method"),t);import{_ as fr}from"./preload-helper-b857222e.js";/*! Turbo 8.0.12 Copyright © 2024 37signals LLC */(function(s){if(typeof s.requestSubmit=="function")return;s.requestSubmit=function(r){r?(e(r,this),r.click()):(r=document.createElement("input"),r.type="submit",r.hidden=!0,this.appendChild(r),r.click(),this.removeChild(r))};function e(r,i){r instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),r.type=="submit"||t(TypeError,"The specified element is not a submit button"),r.form==i||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(r,i,c){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",c)}})(HTMLFormElement.prototype);const ss=new WeakMap;function pr(s){const e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return(t==null?void 0:t.type)=="submit"?t:null}function gr(s){const e=pr(s.target);e&&e.form&&ss.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window){const e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))s=e;else return}addEventListener("click",gr,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return ss.get(this.target)}})})();const J={eager:"eager",lazy:"lazy"},Je=class Je extends HTMLElement{constructor(){super();l(this,"loaded",Promise.resolve());this.delegate=new Je.delegateConstructor(this)}static get observedAttributes(){return["disabled","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(t){t=="loading"?this.delegate.loadingStyleChanged():t=="src"?this.delegate.sourceURLChanged():t=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(t){t?this.setAttribute("src",t):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(t){t?this.setAttribute("refresh",t):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return br(this.getAttribute("loading")||"")}set loading(t){t?this.setAttribute("loading",t):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(t){t?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var t,r;return(r=(t=this.ownerDocument)==null?void 0:t.documentElement)==null?void 0:r.hasAttribute("data-turbo-preview")}};l(Je,"delegateConstructor");let I=Je;function br(s){switch(s.toLowerCase()){case"lazy":return J.lazy;default:return J.eager}}const vr={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function Re(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{const e=document.createElement("script"),t=cs();return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Sr(e,s),e}}function Sr(s,e){for(const{name:t,value:r}of e.attributes)s.setAttribute(t,r)}function wr(s){const e=document.createElement("template");return e.innerHTML=s,e.content}function w(s,{target:e,cancelable:t,detail:r}={}){const i=new CustomEvent(s,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function Xt(s){s.preventDefault(),s.stopImmediatePropagation()}function Ee(){return document.visibilityState==="hidden"?is():rs()}function rs(){return new Promise(s=>requestAnimationFrame(()=>s()))}function is(){return new Promise(s=>setTimeout(()=>s(),0))}function yr(){return Promise.resolve()}function ns(s=""){return new DOMParser().parseFromString(s,"text/html")}function os(s,...e){const t=Er(s,e).replace(/^\n/,"").split(` `),r=t[0].match(/^\s+/),i=r?r[0].length:0;return t.map(c=>c.slice(i)).join(` `)}function Er(s,e){return s.reduce((t,r,i)=>{const c=e[i]==null?"":e[i];return t+r+c},"")}function j(){return Array.from({length:36}).map((s,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 ze(s,...e){for(const t of e.map(r=>r==null?void 0:r.getAttribute(s)))if(typeof t=="string")return t;return null}function Rr(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function je(...s){for(const e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Ke(...s){for(const e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ar(s,e=2e3){return new Promise(t=>{const r=()=>{s.removeEventListener("error",r),s.removeEventListener("load",r),t()};s.addEventListener("load",r,{once:!0}),s.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function as(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Lr(s){return s=="advance"||s=="replace"||s=="restore"}function Z(...s){const e=ze("data-turbo-action",...s);return Lr(e)?e:null}function Ht(s){return document.querySelector(`meta[name="${s}"]`)}function Xe(s){const e=Ht(s);return e&&e.content}function cs(){const s=Ht("csp-nonce");if(s){const{nonce:e,content:t}=s;return e==""?t:e}}function Tr(s,e){let t=Ht(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function ce(s,e){var t;if(s instanceof Element)return s.closest(e)||ce(s.assignedSlot||((t=s.getRootNode())==null?void 0:t.host),e)}function Bt(s){const e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";return!!s&&s.closest(e)==null&&typeof s.focus=="function"}function ls(s){return Array.from(s.querySelectorAll("[autofocus]")).find(Bt)}async function Pr(s,e){const t=e();s(),await rs();const r=e();return[t,r]}function hs(s){if(s==="_blank")return!1;if(s){for(const e of document.getElementsByName(s))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function ds(s){return ce(s,"a[href]:not([target^=_]):not([download])")}function us(s){return T(s.getAttribute("href")||"")}function Cr(s,e){let t=null;return(...r)=>{const i=()=>s.apply(this,r);clearTimeout(t),t=setTimeout(i,e)}}const Mr={"aria-disabled":{beforeSubmit:s=>{s.setAttribute("aria-disabled","true"),s.addEventListener("click",Xt)},afterSubmit:s=>{s.removeAttribute("aria-disabled"),s.removeEventListener("click",Xt)}},disabled:{beforeSubmit:s=>s.disabled=!0,afterSubmit:s=>s.disabled=!1}};var Ae;class kr{constructor(e){m(this,Ae,null);Object.assign(this,e)}get submitter(){return f(this,Ae)}set submitter(e){S(this,Ae,Mr[e]||e)}}Ae=new WeakMap;const Ir=new kr({mode:"on",submitter:"disabled"}),L={drive:vr,forms:Ir};function T(s){return new URL(s.toString(),document.baseURI)}function ee(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function Ot(s,e){const t=(e==null?void 0:e.getAttribute("formaction"))||s.getAttribute("action")||s.action;return T(t)}function Fr(s){return(Or(s).match(/\.[^.]*$/)||[])[0]||""}function qr(s,e){const t=Dr(e);return s.href===T(t).href||s.href.startsWith(t)}function N(s,e){return qr(s,e)&&!L.drive.unvisitableExtensions.has(Fr(s))}function kt(s){const e=ee(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function Ne(s){return kt(s)}function Hr(s,e){return T(s).href==T(e).href}function Br(s){return s.pathname.split("/").slice(1)}function Or(s){return Br(s).slice(-1)[0]}function Dr(s){return Vr(s.origin+s.pathname)}function Vr(s){return s.endsWith("/")?s:s+"/"}class bt{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 T(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)}}class Nr extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){const r=this.values().next().value;this.delete(r)}super.add(e)}}const ms=new Nr(20),Wr=window.fetch;function Dt(s,e={}){const t=new Headers(e.headers||{}),r=j();return ms.add(r),t.append("X-Turbo-Request-Id",r),Wr(s,{...e,headers:t})}function vt(s){switch(s.toLowerCase()){case"get":return M.get;case"post":return M.post;case"put":return M.put;case"patch":return M.patch;case"delete":return M.delete}}const M={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function fs(s){switch(s.toLowerCase()){case W.multipart:return W.multipart;case W.plain:return W.plain;default:return W.urlEncoded}}const W={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"};var Le,Qe,ps,Ge,gs;class ve{constructor(e,t,r,i=new URLSearchParams,c=null,p=W.urlEncoded){m(this,Qe);m(this,Ge);l(this,"abortController",new AbortController);m(this,Le,e=>{});var C;const[v,E]=Yt(T(r),t,i,p);this.delegate=e,this.url=v,this.target=c,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:E,signal:this.abortSignal,referrer:(C=this.delegate.referrer)==null?void 0:C.href},this.enctype=p}get method(){return this.fetchOptions.method}set method(e){const t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=vt(e)||M.get;this.url.search="";const[i,c]=Yt(this.url,r,t,this.enctype);this.url=i,this.fetchOptions.body=c,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){const{fetchOptions:e}=this;this.delegate.prepareRequest(this);const t=await g(this,Qe,ps).call(this,e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Dt(this.url.href,e);const r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw g(this,Ge,gs).call(this,r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){const t=new bt(e);return w("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 St(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}}Le=new WeakMap,Qe=new WeakSet,ps=async function(e){const t=new Promise(i=>S(this,Le,i)),r=w("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:f(this,Le)},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r},Ge=new WeakSet,gs=function(e){return!w("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented};function St(s){return vt(s)==M.get}function Yt(s,e,t,r){const i=Array.from(t).length>0?new URLSearchParams(bs(t)):s.searchParams;return St(e)?[_r(s,i),null]:r==W.urlEncoded?[s,i]:[s,t]}function bs(s){const e=[];for(const[t,r]of s)r instanceof File||e.push([t,r]);return e}function _r(s,e){const t=new URLSearchParams(bs(e));return s.search=t.toString(),s}class Ur{constructor(e,t){l(this,"started",!1);l(this,"intersect",e=>{const t=e.slice(-1)[0];t!=null&&t.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)});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))}}class te{static wrap(e){return typeof e=="string"?new this(wr(e)):e}constructor(e){this.fragment=xr(e)}}l(te,"contentType","text/vnd.turbo-stream.html");function xr(s){for(const e of s.querySelectorAll("turbo-stream")){const t=document.importNode(e,!0);for(const r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(Re(r));e.replaceWith(t)}return s}const $r=100;var Q,D;class zr{constructor(){m(this,Q,null);m(this,D,null)}get(e){if(f(this,D)&&f(this,D).url===e&&f(this,D).expire>Date.now())return f(this,D).request}setLater(e,t,r){this.clear(),S(this,Q,setTimeout(()=>{t.perform(),this.set(e,t,r),S(this,Q,null)},$r))}set(e,t,r){S(this,D,{url:e,request:t,expire:new Date(new Date().getTime()+r)})}clear(){f(this,Q)&&clearTimeout(f(this,Q)),S(this,D,null)}}Q=new WeakMap,D=new WeakMap;const jr=10*1e3,ae=new zr,ie={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"};class wt{constructor(e,t,r,i=!1){l(this,"state",ie.initialized);const c=Gr(t,r),p=Qr(Jr(t,r),c),v=Kr(t,r),E=Zr(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new ve(this,c,p,v,t,E),this.mustRedirect=i}static confirmMethod(e){return Promise.resolve(confirm(e))}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=T(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(){const{initialized:e,requesting:t}=ie,r=ze("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof L.forms.confirm=="function"?L.forms.confirm:wt.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){const{stopping:e,stopped:t}=ie;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){const t=Xr(Xe("csrf-param"))||Xe("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(te.contentType)}requestStarted(e){this.state=ie.waiting,this.submitter&&L.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),je(this.formElement),w("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){ae.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(ae.clear(),this.requestMustRedirect(e)&&Yr(t)){const r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=ie.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=ie.stopped,this.submitter&&L.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),Ke(this.formElement),w("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")){const 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")){const e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Rr("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var e;return(e=this.submitter)==null?void 0:e.getAttribute("data-turbo-submits-with")}}function Kr(s,e){const t=new FormData(s),r=e==null?void 0:e.getAttribute("name"),i=e==null?void 0:e.getAttribute("value");return r&&t.append(r,i||""),t}function Xr(s){if(s!=null){const t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(s));if(t){const r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Yr(s){return s.statusCode==200&&!s.redirected}function Jr(s,e){const t=typeof s.action=="string"?s.action:null;return e!=null&&e.hasAttribute("formaction")?e.getAttribute("formaction")||"":s.getAttribute("action")||t||""}function Qr(s,e){const t=T(s);return St(e)&&(t.search=""),t}function Gr(s,e){const t=(e==null?void 0:e.getAttribute("formmethod"))||s.getAttribute("method")||"";return vt(t.toLowerCase())||M.get}function Zr(s,e){return fs((e==null?void 0:e.getAttribute("formenctype"))||s.enctype)}class yt{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 ls(this.element)}get permanentElements(){return Ss(this.element)}getPermanentElementById(e){return vs(this.element,e)}getPermanentElementMapForSnapshot(e){const t={};for(const r of this.permanentElements){const{id:i}=r,c=e.getPermanentElementById(i);c&&(t[i]=[r,c])}return t}}function vs(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function Ss(s){return s.querySelectorAll("[id][data-turbo-permanent]")}class Vt{constructor(e,t){l(this,"started",!1);l(this,"submitCaptured",()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)});l(this,"submitBubbled",e=>{if(!e.defaultPrevented){const t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&ei(t,r)&&ti(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}});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)}}function ei(s,e){return((e==null?void 0:e.getAttribute("formmethod"))||s.getAttribute("method"))!="dialog"}function ti(s,e){const t=(e==null?void 0:e.getAttribute("formtarget"))||s.getAttribute("target");return hs(t)}var Te,Pe;class ws{constructor(e,t){m(this,Te,e=>{});m(this,Pe,e=>{});this.delegate=e,this.element=t}scrollToAnchor(e){const t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(ee(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){const{isPreview:t,shouldRender:r,willRender:i,newSnapshot:c}=e,p=i;if(r)try{this.renderPromise=new Promise(F=>S(this,Te,F)),this.renderer=e,await this.prepareToRenderSnapshot(e);const v=new Promise(F=>S(this,Pe,F)),E={resume:f(this,Pe),render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(c,E)||await v,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(c,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,f(this,Te).call(this,void 0),delete this.renderPromise}else p&&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()}}Te=new WeakMap,Pe=new WeakMap;class si extends ws{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new yt(this.element)}}class ys{constructor(e,t){l(this,"clickBubbled",e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent});l(this,"linkClicked",e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent});l(this,"willVisit",e=>{delete this.clickEvent});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)}clickEventIsSignificant(e){var i;const t=e.composed?(i=e.target)==null?void 0:i.parentElement:e.target,r=ds(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}}class Es{constructor(e,t){l(this,"started",!1);l(this,"clickCaptured",()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)});l(this,"clickBubbled",e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){const t=e.composedPath&&e.composedPath()[0]||e.target,r=ds(t);if(r&&hs(r.target)){const i=us(r);this.delegate.willFollowLinkToLocation(r,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,i))}}});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)}clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}}class Rs{constructor(e,t){this.delegate=e,this.linkInterceptor=new Es(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){const r=document.createElement("form"),i="hidden";for(const[se,P]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:i,name:se,value:P}));const c=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",c.href),r.setAttribute("hidden","");const p=e.getAttribute("data-turbo-method");p&&r.setAttribute("method",p);const v=e.getAttribute("data-turbo-frame");v&&r.setAttribute("data-turbo-frame",v);const E=Z(e);E&&r.setAttribute("data-turbo-action",E);const C=e.getAttribute("data-turbo-confirm");C&&r.setAttribute("data-turbo-confirm",C),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}}class As{static async preservingPermanentElements(e,t,r){const i=new this(e,t);i.enter(),await r(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(const e in this.permanentElementMap){const[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(const e in this.permanentElementMap){const[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){const t=ri(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){const t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){const t=this.getPlaceholderById(e.id);t==null||t.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}function ri(s){const e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var V;class Nt{constructor(e,t,r,i=!0){m(this,V,null);this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=i,this.renderElement=this.constructor.renderElement,this.promise=new Promise((c,p)=>this.resolvingFunctions={resolve:c,reject:p})}static renderElement(e,t){}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await As.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){const e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){f(this,V)||e.contains(this.currentSnapshot.activeElement)&&S(this,V,this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(f(this,V))&&f(this,V)instanceof HTMLElement&&(f(this,V).focus(),S(this,V,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"}}V=new WeakMap;class Et extends Nt{static renderElement(e,t){var p;const r=document.createRange();r.selectNodeContents(e),r.deleteContents();const i=t,c=(p=i.ownerDocument)==null?void 0:p.createRange();c&&(c.selectNodeContents(i),e.appendChild(c.extractContents()))}constructor(e,t,r,i,c,p=!0){super(t,r,i,c,p),this.delegate=e}get shouldRender(){return!0}async render(){await Ee(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await Ee(),this.focusFirstAutofocusableElement(),await Ee(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){const e=this.currentElement.firstElementChild,t=ii(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=ni(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(const e of this.newScriptElements){const t=Re(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}}function ii(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function ni(s,e){return s=="auto"||s=="smooth"?s:e}var oi=function(){let s=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:P,afterNodeAdded:P,beforeNodeMorphed:P,afterNodeMorphed:P,beforeNodeRemoved:P,afterNodeRemoved:P,beforeAttributeUpdated:P},head:{style:"merge",shouldPreserve:function(n){return n.getAttribute("im-preserve")==="true"},shouldReAppend:function(n){return n.getAttribute("im-re-append")==="true"},shouldRemove:P,afterHeadMorphed:P}};function t(n,o,a={}){n instanceof Document&&(n=n.documentElement),typeof o=="string"&&(o=rr(o));let h=ir(o),d=Pt(n,h,a);return r(n,h,d)}function r(n,o,a){if(a.head.block){let h=n.querySelector("head"),d=o.querySelector("head");if(h&&d){let u=se(d,h,a);Promise.all(u).then(function(){r(n,o,Object.assign(a,{head:{block:!1,ignore:!0}}))});return}}if(a.morphStyle==="innerHTML")return p(o,n,a),n.children;if(a.morphStyle==="outerHTML"||a.morphStyle==null){let h=or(o,n,a),d=h==null?void 0:h.previousSibling,u=h==null?void 0:h.nextSibling,b=c(n,h,a);return h?nr(d,b,u):[]}else throw"Do not understand how to morph style "+a.morphStyle}function i(n,o){return o.ignoreActiveValue&&n===document.activeElement&&n!==document.body}function c(n,o,a){if(!(a.ignoreActive&&n===document.activeElement))return o==null?a.callbacks.beforeNodeRemoved(n)===!1?n:(n.remove(),a.callbacks.afterNodeRemoved(n),null):re(n,o)?(a.callbacks.beforeNodeMorphed(n,o)===!1||(n instanceof HTMLHeadElement&&a.head.ignore||(n instanceof HTMLHeadElement&&a.head.style!=="morph"?se(o,n,a):(E(o,n,a),i(n,a)||p(o,n,a))),a.callbacks.afterNodeMorphed(n,o)),n):a.callbacks.beforeNodeRemoved(n)===!1||a.callbacks.beforeNodeAdded(o)===!1?n:(n.parentElement.replaceChild(o,n),a.callbacks.afterNodeAdded(o),a.callbacks.afterNodeRemoved(n),o)}function p(n,o,a){let h=n.firstChild,d=o.firstChild,u;for(;h;){if(u=h,h=u.nextSibling,d==null){if(a.callbacks.beforeNodeAdded(u)===!1)return;o.appendChild(u),a.callbacks.afterNodeAdded(u),K(a,u);continue}if(Ve(u,d,a)){c(d,u,a),d=d.nextSibling,K(a,u);continue}let b=tr(n,o,u,d,a);if(b){d=$t(d,b,a),c(b,u,a),K(a,u);continue}let R=sr(n,o,u,d,a);if(R){d=$t(d,R,a),c(R,u,a),K(a,u);continue}if(a.callbacks.beforeNodeAdded(u)===!1)return;o.insertBefore(u,d),a.callbacks.afterNodeAdded(u),K(a,u)}for(;d!==null;){let b=d;d=d.nextSibling,zt(b,a)}}function v(n,o,a,h){return n==="value"&&h.ignoreActiveValue&&o===document.activeElement?!0:h.callbacks.beforeAttributeUpdated(n,o,a)===!1}function E(n,o,a){let h=n.nodeType;if(h===1){const d=n.attributes,u=o.attributes;for(const b of d)v(b.name,o,"update",a)||o.getAttribute(b.name)!==b.value&&o.setAttribute(b.name,b.value);for(let b=u.length-1;0<=b;b--){const R=u[b];v(R.name,o,"remove",a)||n.hasAttribute(R.name)||o.removeAttribute(R.name)}}(h===8||h===3)&&o.nodeValue!==n.nodeValue&&(o.nodeValue=n.nodeValue),i(o,a)||F(n,o,a)}function C(n,o,a,h){if(n[a]!==o[a]){let d=v(a,o,"update",h);d||(o[a]=n[a]),n[a]?d||o.setAttribute(a,n[a]):v(a,o,"remove",h)||o.removeAttribute(a)}}function F(n,o,a){if(n instanceof HTMLInputElement&&o instanceof HTMLInputElement&&n.type!=="file"){let h=n.value,d=o.value;C(n,o,"checked",a),C(n,o,"disabled",a),n.hasAttribute("value")?h!==d&&(v("value",o,"update",a)||(o.setAttribute("value",h),o.value=h)):v("value",o,"remove",a)||(o.value="",o.removeAttribute("value"))}else if(n instanceof HTMLOptionElement)C(n,o,"selected",a);else if(n instanceof HTMLTextAreaElement&&o instanceof HTMLTextAreaElement){let h=n.value,d=o.value;if(v("value",o,"update",a))return;h!==d&&(o.value=h),o.firstChild&&o.firstChild.nodeValue!==h&&(o.firstChild.nodeValue=h)}}function se(n,o,a){let h=[],d=[],u=[],b=[],R=a.head.style,X=new Map;for(const A of n.children)X.set(A.outerHTML,A);for(const A of o.children){let H=X.has(A.outerHTML),we=a.head.shouldReAppend(A),Ct=a.head.shouldPreserve(A);H||Ct?we?d.push(A):(X.delete(A.outerHTML),u.push(A)):R==="append"?we&&(d.push(A),b.push(A)):a.head.shouldRemove(A)!==!1&&d.push(A)}b.push(...X.values());let Kt=[];for(const A of b){let H=document.createRange().createContextualFragment(A.outerHTML).firstChild;if(a.callbacks.beforeNodeAdded(H)!==!1){if(H.href||H.src){let we=null,Ct=new Promise(function(dr){we=dr});H.addEventListener("load",function(){we()}),Kt.push(Ct)}o.appendChild(H),a.callbacks.afterNodeAdded(H),h.push(H)}}for(const A of d)a.callbacks.beforeNodeRemoved(A)!==!1&&(o.removeChild(A),a.callbacks.afterNodeRemoved(A));return a.head.afterHeadMorphed(o,{added:h,kept:u,removed:d}),Kt}function P(){}function Tt(n){let o={};return Object.assign(o,e),Object.assign(o,n),o.callbacks={},Object.assign(o.callbacks,e.callbacks),Object.assign(o.callbacks,n.callbacks),o.head={},Object.assign(o.head,e.head),Object.assign(o.head,n.head),o}function Pt(n,o,a){return a=Tt(a),{target:n,newContent:o,config:a,morphStyle:a.morphStyle,ignoreActive:a.ignoreActive,ignoreActiveValue:a.ignoreActiveValue,idMap:hr(n,o),deadIds:new Set,callbacks:a.callbacks,head:a.head}}function Ve(n,o,a){return n==null||o==null?!1:n.nodeType===o.nodeType&&n.tagName===o.tagName?n.id!==""&&n.id===o.id?!0:Se(a,n,o)>0:!1}function re(n,o){return n==null||o==null?!1:n.nodeType===o.nodeType&&n.tagName===o.tagName}function $t(n,o,a){for(;n!==o;){let h=n;n=n.nextSibling,zt(h,a)}return K(a,o),o.nextSibling}function tr(n,o,a,h,d){let u=Se(d,a,o),b=null;if(u>0){let R=h,X=0;for(;R!=null;){if(Ve(a,R,d))return R;if(X+=Se(d,R,n),X>u)return null;R=R.nextSibling}}return b}function sr(n,o,a,h,d){let u=h,b=a.nextSibling,R=0;for(;u!=null;){if(Se(d,u,n)>0)return null;if(re(a,u))return u;if(re(b,u)&&(R++,b=b.nextSibling,R>=2))return null;u=u.nextSibling}return u}function rr(n){let o=new DOMParser,a=n.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(a.match(/<\/html>/)||a.match(/<\/head>/)||a.match(/<\/body>/)){let h=o.parseFromString(n,"text/html");if(a.match(/<\/html>/))return h.generatedByIdiomorph=!0,h;{let d=h.firstChild;return d?(d.generatedByIdiomorph=!0,d):null}}else{let d=o.parseFromString("","text/html").body.querySelector("template").content;return d.generatedByIdiomorph=!0,d}}function ir(n){if(n==null)return document.createElement("div");if(n.generatedByIdiomorph)return n;if(n instanceof Node){const o=document.createElement("div");return o.append(n),o}else{const o=document.createElement("div");for(const a of[...n])o.append(a);return o}}function nr(n,o,a){let h=[],d=[];for(;n!=null;)h.push(n),n=n.previousSibling;for(;h.length>0;){let u=h.pop();d.push(u),o.parentElement.insertBefore(u,o)}for(d.push(o);a!=null;)h.push(a),d.push(a),a=a.nextSibling;for(;h.length>0;)o.parentElement.insertBefore(h.pop(),o.nextSibling);return d}function or(n,o,a){let h;h=n.firstChild;let d=h,u=0;for(;h;){let b=ar(h,o,a);b>u&&(d=h,u=b),h=h.nextSibling}return d}function ar(n,o,a){return re(n,o)?.5+Se(a,n,o):0}function zt(n,o){K(o,n),o.callbacks.beforeNodeRemoved(n)!==!1&&(n.remove(),o.callbacks.afterNodeRemoved(n))}function cr(n,o){return!n.deadIds.has(o)}function lr(n,o,a){return(n.idMap.get(a)||s).has(o)}function K(n,o){let a=n.idMap.get(o)||s;for(const h of a)n.deadIds.add(h)}function Se(n,o,a){let h=n.idMap.get(o)||s,d=0;for(const u of h)cr(n,u)&&lr(n,u,a)&&++d;return d}function jt(n,o){let a=n.parentElement,h=n.querySelectorAll("[id]");for(const d of h){let u=d;for(;u!==a&&u!=null;){let b=o.get(u);b==null&&(b=new Set,o.set(u,b)),b.add(d.id),u=u.parentElement}}}function hr(n,o){let a=new Map;return jt(n,a),jt(o,a),a}return{morph:t,defaults:e}}();function Wt(s,e,{callbacks:t,...r}={}){oi.morph(s,e,{...r,callbacks:new ai(t)})}function Ls(s,e){Wt(s,e.children,{morphStyle:"innerHTML"})}var Ce;class ai{constructor({beforeNodeMorphed:e}={}){m(this,Ce,void 0);l(this,"beforeNodeAdded",e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id)));l(this,"beforeNodeMorphed",(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&f(this,Ce).call(this,e,t)?!w("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1});l(this,"beforeAttributeUpdated",(e,t,r)=>!w("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented);l(this,"beforeNodeRemoved",e=>this.beforeNodeMorphed(e));l(this,"afterNodeMorphed",(e,t)=>{e instanceof Element&&w("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})});S(this,Ce,e||(()=>!0))}}Ce=new WeakMap;class ci extends Et{static renderElement(e,t){w("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Ls(e,t)}async preservingPermanentElements(e){return await e()}}const O=class O{constructor(){l(this,"hiding",!1);l(this,"value",0);l(this,"visible",!1);l(this,"trickle",()=>{this.setValue(this.value+Math.random()/100)});this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return os` .turbo-progress-bar { position: fixed; display: block; top: 0; left: 0; height: 3px; background: #0076ff; z-index: 2147483647; transition: width ${O.animationDuration}ms ease-out, opacity ${O.animationDuration/2}ms ${O.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 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,O.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,O.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){const e=document.createElement("style");e.type="text/css",e.textContent=O.defaultCSS;const t=cs();return t&&(e.nonce=t),e}createProgressElement(){const e=document.createElement("div");return e.className="turbo-progress-bar",e}};l(O,"animationDuration",300);let It=O;class li extends yt{constructor(){super(...arguments);l(this,"detailsByOuterHTML",this.children.filter(t=>!mi(t)).map(t=>gi(t)).reduce((t,r)=>{const{outerHTML:i}=r,c=i in t?t[i]:{type:hi(r),tracked:di(r),elements:[]};return{...t,[i]:{...c,elements:[...c.elements,r]}}},{}))}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(t=>this.detailsByOuterHTML[t].tracked).join("")}getScriptElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("script",t)}getStylesheetElementsNotInSnapshot(t){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",t)}getElementsMatchingTypeNotInSnapshot(t,r){return Object.keys(this.detailsByOuterHTML).filter(i=>!(i in r.detailsByOuterHTML)).map(i=>this.detailsByOuterHTML[i]).filter(({type:i})=>i==t).map(({elements:[i]})=>i)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{const{type:i,tracked:c,elements:p}=this.detailsByOuterHTML[r];return i==null&&!c?[...t,...p]:p.length>1?[...t,...p.slice(1)]:t},[])}getMetaValue(t){const r=this.findMetaElementByName(t);return r?r.getAttribute("content"):null}findMetaElementByName(t){return Object.keys(this.detailsByOuterHTML).reduce((r,i)=>{const{elements:[c]}=this.detailsByOuterHTML[i];return pi(c,t)?c:r},void 0|void 0)}}function hi(s){if(ui(s))return"script";if(fi(s))return"stylesheet"}function di(s){return s.getAttribute("data-turbo-track")=="reload"}function ui(s){return s.localName=="script"}function mi(s){return s.localName=="noscript"}function fi(s){const e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function pi(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function gi(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}class k extends yt{static fromHTMLString(e=""){return this.fromDocument(ns(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new li(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){const e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(const[i,c]of t.entries()){const p=r[i];for(const v of p.selectedOptions)v.selected=!1;for(const v of c.selectedOptions)p.options[v.index].selected=!0}for(const i of e.querySelectorAll('input[type="password"]'))i.value="";return new k(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){const e=this.getSetting("root")??"/";return T(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}`)}}var Me,_;class bi{constructor(){m(this,Me,!1);m(this,_,Promise.resolve())}renderChange(e,t){return e&&this.viewTransitionsAvailable&&!f(this,Me)?(S(this,Me,!0),S(this,_,f(this,_).then(async()=>{await document.startViewTransition(t).finished}))):S(this,_,f(this,_).then(t)),f(this,_)}get viewTransitionsAvailable(){return document.startViewTransition}}Me=new WeakMap,_=new WeakMap;const vi={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},We={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},B={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},le={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Si={advance:"forward",restore:"back",replace:"none"};class wi{constructor(e,t,r,i={}){l(this,"identifier",j());l(this,"timingMetrics",{});l(this,"followedRedirect",!1);l(this,"historyChanged",!1);l(this,"scrolled",!1);l(this,"shouldCacheSnapshot",!0);l(this,"acceptsStreamResponse",!1);l(this,"snapshotCached",!1);l(this,"state",B.initialized);l(this,"viewTransitioner",new bi);this.delegate=e,this.location=t,this.restorationIdentifier=r||j();const{action:c,historyChanged:p,referrer:v,snapshot:E,snapshotHTML:C,response:F,visitCachedSnapshot:se,willRender:P,updateHistory:Tt,shouldCacheSnapshot:Pt,acceptsStreamResponse:Ve,direction:re}={...vi,...i};this.action=c,this.historyChanged=p,this.referrer=v,this.snapshot=E,this.snapshotHTML=C,this.response=F,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=se,this.willRender=P,this.updateHistory=Tt,this.scrolled=!P,this.shouldCacheSnapshot=Pt,this.acceptsStreamResponse=Ve,this.direction=re||Si[c]}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==B.initialized&&(this.recordTimingMetric(We.visitStart),this.state=B.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==B.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=B.canceled)}complete(){this.state==B.started&&(this.recordTimingMetric(We.visitEnd),this.adapter.visitCompleted(this),this.state=B.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==B.started&&(this.state=B.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){var e;if(!this.historyChanged&&this.updateHistory){const t=this.location.href===((e=this.referrer)==null?void 0:e.href)?"replace":this.action,r=as(t);this.history.update(r,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new ve(this,M.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(We.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){const{statusCode:t}=e;Jt(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(We.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){const{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Jt(e)&&t!=null){const r=k.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(k.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){const e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!ee(this.location)||e.hasAnchor(ee(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return k.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){const e=this.getCachedSnapshot();if(e){const 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(){var e;this.redirectedToLocation&&!this.followedRedirect&&((e=this.response)!=null&&e.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(te.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){const r=await t.responseHTML,{redirected:i,statusCode:c}=t;r==null?this.recordResponse({statusCode:le.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:c,responseHTML:r,redirected:i}))}async requestFailedWithResponse(e,t){const r=await t.responseHTML,{redirected:i,statusCode:c}=t;r==null?this.recordResponse({statusCode:le.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:c,responseHTML:r,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:le.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(){const{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){const e=ee(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(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}}function Jt(s){return s>=200&&s<300}class yi{constructor(e){l(this,"progressBar",new It);l(this,"showProgressBar",()=>{this.progressBar.show()});this.session=e}visitProposedToLocation(e,t){N(e,this.navigator.rootLocation)?this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||j(),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 le.networkFailure:case le.timeoutFailure:case le.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)}reload(e){var t;w("turbo:reload",{detail:e}),window.location.href=((t=this.location)==null?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}}class Ei{constructor(){l(this,"selector","[data-turbo-temporary]");l(this,"deprecatedSelector","[data-turbo-cache=false]");l(this,"started",!1);l(this,"removeTemporaryElements",e=>{for(const t of this.temporaryElements)t.remove()})}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))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){const 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]}}var Ze,Ts,he,_e,de,Ue;class Ri{constructor(e,t){m(this,Ze);m(this,he);m(this,de);this.session=e,this.element=t,this.linkInterceptor=new ys(this,t),this.formSubmitObserver=new Vt(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return g(this,he,_e).call(this,e)}linkClickIntercepted(e,t,r){const i=g(this,de,Ue).call(this,e);i&&i.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&g(this,Ze,Ts).call(this,e,t)&&g(this,he,_e).call(this,e,t)}formSubmitted(e,t){const r=g(this,de,Ue).call(this,e,t);r&&r.delegate.formSubmitted(e,t)}}Ze=new WeakSet,Ts=function(e,t){const r=Ot(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),c=T((i==null?void 0:i.content)??"/");return g(this,he,_e).call(this,e,t)&&N(r,c)},he=new WeakSet,_e=function(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){const i=g(this,de,Ue).call(this,e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1},de=new WeakSet,Ue=function(e,t){const r=(t==null?void 0:t.getAttribute("data-turbo-frame"))||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){const i=this.element.querySelector(`#${r}:not([disabled])`);if(i instanceof I)return i}};class Ai{constructor(e){l(this,"location");l(this,"restorationIdentifier",j());l(this,"restorationData",{});l(this,"started",!1);l(this,"pageLoaded",!1);l(this,"currentIndex",0);l(this,"onPopState",e=>{if(this.shouldHandlePopState()){const{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);const{restorationIdentifier:r,restorationIndex:i}=t;this.restorationIdentifier=r;const c=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,c),this.currentIndex=i}}});l(this,"onPageLoad",async e=>{await yr(),this.pageLoaded=!0});this.delegate=e}start(){var e,t;this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=((t=(e=history.state)==null?void 0:e.turbo)==null?void 0:t.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,r=j()){e===history.pushState&&++this.currentIndex;const i={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,i,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){const{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}}var ue,ke,Ie,Fe,et,qe,tt,Ps,st,Cs;class Li{constructor(e,t){m(this,tt);m(this,st);l(this,"started",!1);m(this,ue,null);m(this,ke,()=>{this.eventTarget.addEventListener("mouseenter",f(this,Ie),{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",f(this,Fe),{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",f(this,qe),!0),this.started=!0});m(this,Ie,e=>{if(Xe("turbo-prefetch")==="false")return;const t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&g(this,st,Cs).call(this,t)){const i=t,c=us(i);if(this.delegate.canPrefetchRequestToLocation(i,c)){S(this,ue,i);const p=new ve(this,M.get,c,new URLSearchParams,t);ae.setLater(c.toString(),p,f(this,tt,Ps))}}});m(this,Fe,e=>{e.target===f(this,ue)&&f(this,et).call(this)});m(this,et,()=>{ae.clear(),S(this,ue,null)});m(this,qe,e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){const t=ae.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),ae.clear()}});this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",f(this,ke),{once:!0}):f(this,ke).call(this))}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",f(this,Ie),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",f(this,Fe),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",f(this,qe),!0),this.started=!1)}prepareRequest(e){const t=e.target;e.headers["X-Sec-Purpose"]="prefetch";const r=t.closest("turbo-frame"),i=t.getAttribute("data-turbo-frame")||(r==null?void 0:r.getAttribute("target"))||(r==null?void 0:r.id);i&&i!=="_top"&&(e.headers["Turbo-Frame"]=i)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}ue=new WeakMap,ke=new WeakMap,Ie=new WeakMap,Fe=new WeakMap,et=new WeakMap,qe=new WeakMap,tt=new WeakSet,Ps=function(){return Number(Xe("turbo-prefetch-cache-time"))||jr},st=new WeakSet,Cs=function(e){return!(!e.getAttribute("href")||Ti(e)||Pi(e)||Ci(e)||Mi(e)||Ii(e))};const Ti=s=>s.origin!==document.location.origin||!["http:","https:"].includes(s.protocol)||s.hasAttribute("target"),Pi=s=>s.pathname+s.search===document.location.pathname+document.location.search||s.href.startsWith("#"),Ci=s=>{if(s.getAttribute("data-turbo-prefetch")==="false"||s.getAttribute("data-turbo")==="false")return!0;const e=ce(s,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Mi=s=>{const e=s.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||ki(s)||s.hasAttribute("data-turbo-confirm")||s.hasAttribute("data-turbo-stream"))},ki=s=>s.hasAttribute("data-remote")||s.hasAttribute("data-behavior")||s.hasAttribute("data-confirm")||s.hasAttribute("data-method"),Ii=s=>w("turbo:before-prefetch",{target:s,cancelable:!0}).defaultPrevented;var rt,Ms,it,ks;class Fi{constructor(e){m(this,rt);m(this,it);this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new wi(this,T(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new wt(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){const r=await t.responseHTML;if(r){const i=e.isSafe;i||this.view.clearSnapshotCache();const{statusCode:c,redirected:p}=t,E={action:g(this,rt,Ms).call(this,e,t),shouldCacheSnapshot:i,response:{statusCode:c,responseHTML:r,redirected:p}};this.proposeVisit(t.location,E)}}}async formSubmissionFailedWithResponse(e,t){const r=await t.responseHTML;if(r){const i=k.fromHTMLString(r);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),delete this.currentVisit}locationWithActionIsSamePage(e,t){const r=ee(e),i=ee(this.view.lastRenderedLocation),c=t==="restore"&&typeof r>"u";return t!=="replace"&&kt(e)===kt(this.view.lastRenderedLocation)&&(c||r!=null&&r!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}}rt=new WeakSet,Ms=function(e,t){const{submitter:r,formElement:i}=e;return Z(r,i)||g(this,it,ks).call(this,t)},it=new WeakSet,ks=function(e){var r;return e.redirected&&e.location.href===((r=this.location)==null?void 0:r.href)?"replace":"advance"};const Y={initial:0,loading:1,interactive:2,complete:3};class qi{constructor(e){l(this,"stage",Y.initial);l(this,"started",!1);l(this,"interpretReadyState",()=>{const{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()});l(this,"pageWillUnload",()=>{this.delegate.pageWillUnload()});this.delegate=e}start(){this.started||(this.stage==Y.initial&&(this.stage=Y.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)}pageIsInteractive(){this.stage==Y.loading&&(this.stage=Y.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Y.interactive&&(this.stage=Y.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}}class Hi{constructor(e){l(this,"started",!1);l(this,"onScroll",()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})});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)}updatePosition(e){this.delegate.scrollPositionChanged(e)}}class Bi{render({fragment:e}){As.preservingPermanentElements(this,Oi(e),()=>{Di(e,()=>{Vi(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}}function Oi(s){const e=Ss(document.documentElement),t={};for(const r of e){const{id:i}=r;for(const c of s.querySelectorAll("turbo-stream")){const p=vs(c.templateElement.content,i);p&&(t[i]=[r,p])}}return t}async function Di(s,e){const t=`turbo-stream-autofocus-${j()}`,r=s.querySelectorAll("turbo-stream"),i=Ni(r);let c=null;if(i&&(i.id?c=i.id:c=t,i.id=c),e(),await Ee(),(document.activeElement==null||document.activeElement==document.body)&&c){const v=document.getElementById(c);Bt(v)&&v.focus(),v&&v.id==t&&v.removeAttribute("id")}}async function Vi(s){const[e,t]=await Pr(s,()=>document.activeElement),r=e&&e.id;if(r){const i=document.getElementById(r);Bt(i)&&i!=t&&i.focus()}}function Ni(s){for(const e of s){const t=ls(e.templateElement.content);if(t)return t}return null}var U;class Wi{constructor(e){l(this,"sources",new Set);m(this,U,!1);l(this,"inspectFetchResponse",e=>{const t=_i(e);t&&Ui(t)&&(e.preventDefault(),this.receiveMessageResponse(t))});l(this,"receiveMessageEvent",e=>{f(this,U)&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)});this.delegate=e}start(){f(this,U)||(S(this,U,!0),addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){f(this,U)&&(S(this,U,!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)}async receiveMessageResponse(e){const t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(te.wrap(e))}}U=new WeakMap;function _i(s){var t;const e=(t=s.detail)==null?void 0:t.fetchResponse;if(e instanceof bt)return e}function Ui(s){return(s.contentType??"").startsWith(te.contentType)}class xi extends Nt{static renderElement(e,t){const{documentElement:r,body:i}=document;r.replaceChild(t,i)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){const{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(const e of this.scriptElements){const t=e.parentNode;if(t){const r=Re(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}}var nt,Is;class Rt extends Nt{constructor(){super(...arguments);m(this,nt)}static renderElement(t,r){document.body&&r instanceof HTMLBodyElement?document.body.replaceWith(r):document.documentElement.appendChild(r)}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(){g(this,nt,Is).call(this),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}async mergeHead(){const t=this.mergeProvisionalElements(),r=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await t,await r,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(){const t=[];for(const r of this.newHeadStylesheetElements)t.push(Ar(r)),document.head.appendChild(r);await Promise.all(t)}copyNewHeadScriptElements(){for(const t of this.newHeadScriptElements)document.head.appendChild(Re(t))}removeUnusedDynamicStylesheetElements(){for(const t of this.unusedDynamicStylesheetElements)document.head.removeChild(t)}async mergeProvisionalElements(){const t=[...this.newHeadProvisionalElements];for(const r of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(r,t)||document.head.removeChild(r);for(const r of t)document.head.appendChild(r)}isCurrentElementInElementList(t,r){for(const[i,c]of r.entries()){if(t.tagName=="TITLE"){if(c.tagName!="TITLE")continue;if(t.innerHTML==c.innerHTML)return r.splice(i,1),!0}if(c.isEqualNode(t))return r.splice(i,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(const t of this.currentHeadProvisionalElements)document.head.removeChild(t)}copyNewHeadProvisionalElements(){for(const t of this.newHeadProvisionalElements)document.head.appendChild(t)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(const t of this.newBodyScriptElements){const r=Re(t);t.replaceWith(r)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(t=>t.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")}}nt=new WeakSet,Is=function(){const{documentElement:t}=this.currentSnapshot,{lang:r}=this.newSnapshot;r?t.setAttribute("lang",r):t.removeAttribute("lang")};class $i extends Rt{static renderElement(e,t){Wt(e,t,{callbacks:{beforeNodeMorphed:r=>!Qt(r)}});for(const r of e.querySelectorAll("turbo-frame"))Qt(r)&&r.reload();w("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}}function Qt(s){return s instanceof I&&s.src&&s.refresh==="morph"&&!s.closest("[data-turbo-permanent]")}class zi{constructor(e){l(this,"keys",[]);l(this,"snapshots",{});this.size=e}has(e){return Ne(e)in this.snapshots}get(e){if(this.has(e)){const 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[Ne(e)]}write(e,t){this.snapshots[Ne(e)]=t}touch(e){const t=Ne(e),r=this.keys.indexOf(t);r>-1&&this.keys.splice(r,1),this.keys.unshift(t),this.trim()}trim(){for(const e of this.keys.splice(this.size))delete this.snapshots[e]}}class ji extends ws{constructor(){super(...arguments);l(this,"snapshotCache",new zi(10));l(this,"lastRenderedLocation",new URL(location.href));l(this,"forceReloaded",!1)}shouldTransitionTo(t){return this.snapshot.prefersViewTransitions&&t.prefersViewTransitions}renderPage(t,r=!1,i=!0,c){const v=this.isPageRefresh(c)&&this.snapshot.shouldMorphPage?$i:Rt,E=new v(this.snapshot,t,r,i);return E.shouldRender?c==null||c.changeHistory():this.forceReloaded=!0,this.render(E)}renderError(t,r){r==null||r.changeHistory();const i=new xi(this.snapshot,t,!1);return this.render(i)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(t=this.snapshot){if(t.isCacheable){this.delegate.viewWillCacheSnapshot();const{lastRenderedLocation:r}=this;await is();const i=t.clone();return this.snapshotCache.put(r,i),i}}getCachedSnapshotForLocation(t){return this.snapshotCache.get(t)}isPageRefresh(t){return!t||this.lastRenderedLocation.pathname===t.location.pathname&&t.action==="replace"}shouldPreserveScrollPosition(t){return this.isPageRefresh(t)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return k.fromElement(this.element)}}var He;class Ki{constructor(e,t){l(this,"selector","a[data-turbo-preload]");m(this,He,()=>{this.preloadOnLoadLinksForView(document.body)});this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f(this,He)):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",f(this,He))}preloadOnLoadLinksForView(e){for(const t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){const t=new URL(e.href);if(this.snapshotCache.has(t))return;await new ve(this,M.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{const r=await t.responseHTML,i=k.fromHTMLString(r);this.snapshotCache.put(e.url,i)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}}He=new WeakMap;var me,xe;class Xi{constructor(e){m(this,me);this.session=e}clear(){this.session.clearCache()}resetCacheControl(){g(this,me,xe).call(this,"")}exemptPageFromCache(){g(this,me,xe).call(this,"no-cache")}exemptPageFromPreview(){g(this,me,xe).call(this,"no-preview")}}me=new WeakSet,xe=function(e){Tr("turbo-cache-control",e)};var Be;class Yi{constructor(e){l(this,"navigator",new Fi(this));l(this,"history",new Ai(this));l(this,"view",new ji(this,document.documentElement));l(this,"adapter",new yi(this));l(this,"pageObserver",new qi(this));l(this,"cacheObserver",new Ei);l(this,"linkPrefetchObserver",new Li(this,document));l(this,"linkClickObserver",new Es(this,window));l(this,"formSubmitObserver",new Vt(this,document));l(this,"scrollObserver",new Hi(this));l(this,"streamObserver",new Wi(this));l(this,"formLinkClickObserver",new Rs(this,document.documentElement));l(this,"frameRedirector",new Ri(this,document.documentElement));l(this,"streamMessageRenderer",new Bi);l(this,"cache",new Xi(this));l(this,"enabled",!0);l(this,"started",!1);m(this,Be,150);this.recentRequests=e,this.preloader=new Ki(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={}){const r=t.frame?document.getElementById(t.frame):null;if(r instanceof I){const i=t.action||Z(r);r.delegate.proposeVisitIfNavigatedWithAction(r,i),r.src=e.toString()}else this.navigator.proposeVisit(T(e),t)}refresh(e,t){!(t&&this.recentRequests.has(t))&&!this.navigator.currentVisit&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(te.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){L.drive.progressBarDelay=e}get progressBarDelay(){return L.drive.progressBarDelay}set drive(e){L.drive.enabled=e}get drive(){return L.drive.enabled}set formMode(e){L.forms.mode=e}get formMode(){return L.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return f(this,Be)}set pageRefreshDebouncePeriod(e){this.refresh=Cr(this.debouncedRefresh.bind(this),e),S(this,Be,e)}shouldPreloadLink(e){const t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),c=i=="_top"?null:document.getElementById(i)||ce(e,"turbo-frame:not([disabled])");if(t||r||c instanceof I)return!1;{const p=new URL(e.href);return this.elementIsNavigatable(e)&&N(p,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&N(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){const r=this.getActionForLink(e),i=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:i})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Gt(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(je(document.documentElement),this.view.markVisitDirection(e.direction)),Gt(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Ke(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){const r=Ot(e,t);return this.submissionIsNavigatable(e,t)&&N(T(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;(e=this.navigator.currentVisit)!=null&&e.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){const r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:i,detail:{render:c}}=r;return this.view.renderer&&c&&(this.view.renderer.renderElement=c),!i}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return w("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return w("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return w("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return w("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return w("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return w("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return w("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 w("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return w("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(L.forms.mode=="off")return!1;{const r=t?this.elementIsNavigatable(t):!0;return L.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){const t=ce(e,"[data-turbo]"),r=ce(e,"turbo-frame");return L.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return Z(e)||"advance"}get snapshot(){return this.view.snapshot}}Be=new WeakMap;function Gt(s){Object.defineProperties(s,Ji)}const Ji={absoluteURL:{get(){return this.toString()}}},y=new Yi(ms),{cache:Fs,navigator:qs}=y;function _t(){y.start()}function Hs(s){y.registerAdapter(s)}function Bs(s,e){y.visit(s,e)}function At(s){y.connectStreamSource(s)}function Lt(s){y.disconnectStreamSource(s)}function Os(s){y.renderStreamMessage(s)}function Ds(){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.`"),y.clearCache()}function Vs(s){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),L.drive.progressBarDelay=s}function Ns(s){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),L.forms.confirm=s}function Ws(s){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),L.forms.mode=s}var Qi=Object.freeze({__proto__:null,navigator:qs,session:y,cache:Fs,PageRenderer:Rt,PageSnapshot:k,FrameRenderer:Et,fetch:Dt,config:L,start:_t,registerAdapter:Hs,visit:Bs,connectStreamSource:At,disconnectStreamSource:Lt,renderStreamMessage:Os,clearCache:Ds,setProgressBarDelay:Vs,setConfirmMethod:Ns,setFormMode:Ws});class Gi extends Error{}var fe,q,x,Oe,pe,ge,$,ne,ot,_s,at,Us,ct,xs,lt,$s,ht,zs,dt,js,ut,Ks,De,Ft,z,oe,mt,Xs,be,$e,ft,Ys,pt,Js,gt,Qs;class Zi{constructor(e){m(this,$);m(this,ot);m(this,at);m(this,ct);m(this,lt);m(this,ht);m(this,dt);m(this,ut);m(this,De);m(this,z);m(this,mt);m(this,be);m(this,ft);m(this,pt);m(this,gt);l(this,"fetchResponseLoaded",e=>Promise.resolve());m(this,fe,null);m(this,q,()=>{});m(this,x,!1);m(this,Oe,!1);m(this,pe,new Set);m(this,ge,!1);l(this,"action",null);l(this,"visitCachedSnapshot",({element:e})=>{const t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement});this.element=e,this.view=new si(this,this.element),this.appearanceObserver=new Ur(this,this.element),this.formLinkClickObserver=new Rs(this,this.element),this.linkInterceptor=new ys(this,this.element),this.restorationIdentifier=j(),this.formSubmitObserver=new Vt(this,this.element)}connect(){f(this,x)||(S(this,x,!0),this.loadingStyle==J.lazy?this.appearanceObserver.start():g(this,$,ne).call(this),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){f(this,x)&&(S(this,x,!1),this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==J.eager&&g(this,$,ne).call(this)}sourceURLChanged(){g(this,ft,Ys).call(this,"src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==J.eager||f(this,Oe))&&g(this,$,ne).call(this))}sourceURLReloaded(){const{refresh:e,src:t}=this.element;return S(this,ge,t&&e==="morph"),this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==J.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),g(this,$,ne).call(this))}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{const t=await e.responseHTML;if(t){const r=ns(t);k.fromDocument(r).isVisitable?await g(this,ot,_s).call(this,e,r):await g(this,lt,$s).call(this,e)}}finally{S(this,ge,!1),this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,Z(e)),g(this,$,ne).call(this)}willSubmitFormLinkToLocation(e){return g(this,be,$e).call(this,e)}submittedFormLinkToLocation(e,t,r){const i=g(this,z,oe).call(this,e);i&&r.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,r){return g(this,be,$e).call(this,e)}linkClickIntercepted(e,t){g(this,ct,xs).call(this,e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&g(this,be,$e).call(this,e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new wt(this,e,t);const{fetchRequest:r}=this.formSubmission;this.prepareRequest(r),this.formSubmission.start()}prepareRequest(e){var t;e.headers["Turbo-Frame"]=this.id,(t=this.currentNavigationElement)!=null&&t.hasAttribute("data-turbo-stream")&&e.acceptResponseType(te.contentType)}requestStarted(e){je(this.element)}requestPreventedHandlingResponse(e,t){f(this,q).call(this)}async requestSucceededWithResponse(e,t){await this.loadResponse(t),f(this,q).call(this)}async requestFailedWithResponse(e,t){await this.loadResponse(t),f(this,q).call(this)}requestErrored(e,t){console.error(t),f(this,q).call(this)}requestFinished(e){Ke(this.element)}formSubmissionStarted({formElement:e}){je(e,g(this,z,oe).call(this,e))}formSubmissionSucceededWithResponse(e,t){const r=g(this,z,oe).call(this,e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,Z(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||y.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),y.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Ke(e,g(this,z,oe).call(this,e))}allowsImmediateRender({element:e},t){const r=w("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:i,detail:{render:c}}=r;return this.view.renderer&&c&&(this.view.renderer.renderElement=c),!i}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){y.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){const r=k.fromElement(e).clone(),{visitCachedSnapshot:i}=e.delegate;e.delegate.fetchResponseLoaded=async c=>{if(e.src){const{statusCode:p,redirected:v}=c,E=await c.responseHTML,F={response:{statusCode:p,redirected:v,responseHTML:E},visitCachedSnapshot:i,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(F.action=this.action),y.visit(e.src,F)}}}}changeHistory(){if(this.action){const e=as(this.action);y.history.update(e,T(this.element.src||""),this.restorationIdentifier)}}async extractForeignFrameElement(e){let t;const r=CSS.escape(this.id);try{if(t=es(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=es(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(i){return console.error(i),new I}return null}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){g(this,pt,Js).call(this,"src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||f(this,q).call(this)!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&f(this,x)}get rootLocation(){const e=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),t=(e==null?void 0:e.content)??"/";return T(t)}}fe=new WeakMap,q=new WeakMap,x=new WeakMap,Oe=new WeakMap,pe=new WeakMap,ge=new WeakMap,$=new WeakSet,ne=async function(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=g(this,at,Us).call(this,T(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,S(this,Oe,!0))},ot=new WeakSet,_s=async function(e,t){const r=await this.extractForeignFrameElement(t.body),i=f(this,ge)?ci:Et;if(r){const c=new yt(r),p=new i(this,this.view.snapshot,c,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(p),this.complete=!0,y.frameRendered(e,this.element),y.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else g(this,ht,zs).call(this,e)&&g(this,dt,js).call(this,e)},at=new WeakSet,Us=async function(e){var r;const t=new ve(this,M.get,e,new URLSearchParams,this.element);return(r=f(this,fe))==null||r.cancel(),S(this,fe,t),new Promise(i=>{S(this,q,()=>{S(this,q,()=>{}),S(this,fe,null),i()}),t.perform()})},ct=new WeakSet,xs=function(e,t,r){const i=g(this,z,oe).call(this,e,r);i.delegate.proposeVisitIfNavigatedWithAction(i,Z(r,e,i)),g(this,gt,Qs).call(this,e,()=>{i.src=t})},lt=new WeakSet,$s=async function(e){console.warn(`The response (${e.statusCode}) from is performing a full page visit due to turbo-visit-control.`),await g(this,De,Ft).call(this,e.response)},ht=new WeakSet,zs=function(e){this.element.setAttribute("complete","");const t=e.response,r=async(c,p)=>{c instanceof Response?g(this,De,Ft).call(this,c):y.visit(c,p)};return!w("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented},dt=new WeakSet,js=function(e){this.view.missing(),g(this,ut,Ks).call(this,e)},ut=new WeakSet,Ks=function(e){const t=`The response (${e.statusCode}) did not contain the expected and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Gi(t)},De=new WeakSet,Ft=async function(e){const t=new bt(e),r=await t.responseHTML,{location:i,redirected:c,statusCode:p}=t;return y.visit(i,{response:{redirected:c,statusCode:p,responseHTML:r}})},z=new WeakSet,oe=function(e,t){const r=ze("data-turbo-frame",t,e)||this.element.getAttribute("target");return Zt(r)??this.element},mt=new WeakSet,Xs=function(e,t){const r=Ot(e,t);return N(T(r),this.rootLocation)},be=new WeakSet,$e=function(e,t){const r=ze("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!g(this,mt,Xs).call(this,e,t)||!this.enabled||r=="_top")return!1;if(r){const i=Zt(r);if(i)return!i.disabled}return!(!y.elementIsNavigatable(e)||t&&!y.elementIsNavigatable(t))},ft=new WeakSet,Ys=function(e){return f(this,pe).has(e)},pt=new WeakSet,Js=function(e,t){f(this,pe).add(e),t(),f(this,pe).delete(e)},gt=new WeakSet,Qs=function(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement};function Zt(s){if(s!=null){const e=document.getElementById(s);if(e instanceof I)return e}}function es(s,e){if(s){const t=s.getAttribute("src");if(t!=null&&e!=null&&Hr(t,e))throw new Error(`Matching element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof I)return s.connectedCallback(),s.disconnectedCallback(),s}}const Ut={after(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)==null?void 0:e.insertBefore(this.templateContent,s.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>{var e;return(e=s.parentElement)==null?void 0:e.insertBefore(this.templateContent,s)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){const s=this.getAttribute("method");this.targetElements.forEach(e=>{s==="morph"?Wt(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){const s=this.getAttribute("method");this.targetElements.forEach(e=>{s==="morph"?Ls(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){y.refresh(this.baseURI,this.requestId)}};var G,ye;const xt=class xt extends HTMLElement{constructor(){super(...arguments);m(this,G)}static async renderElement(t){await t.performAction()}async connectedCallback(){try{await this.render()}catch(t){console.error(t)}finally{this.disconnect()}}async render(){return this.renderPromise??(this.renderPromise=(async()=>{const t=this.beforeRenderEvent;this.dispatchEvent(t)&&(await Ee(),await t.detail.render(this))})())}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(t=>t.remove())}get duplicateChildren(){var i;const t=this.targetElements.flatMap(c=>[...c.children]).filter(c=>!!c.id),r=[...((i=this.templateContent)==null?void 0:i.children)||[]].filter(c=>!!c.id).map(c=>c.id);return t.filter(c=>r.includes(c.id))}get performAction(){if(this.action){const t=Ut[this.action];if(t)return t;g(this,G,ye).call(this,"unknown action")}g(this,G,ye).call(this,"action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;g(this,G,ye).call(this,"target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){const t=this.ownerDocument.createElement("template");return this.appendChild(t),t}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;g(this,G,ye).call(this,"first child element must be a