diff --git a/assets/main.js b/assets/main.js index aa58177..28a46fb 100644 --- a/assets/main.js +++ b/assets/main.js @@ -1,6 +1,6 @@ -(()=>{var St=Object.defineProperty;var wt=(s,e,t)=>e in s?St(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var x=(s,e,t)=>(wt(s,typeof e!="symbol"?e+"":e,t),t);(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,n){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",n)}})(HTMLFormElement.prototype);var ve=new WeakMap;function Et(s){let e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function yt(s){let e=Et(s.target);e&&e.form&&ve.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))s=e;else return}addEventListener("click",yt,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return ve.get(this.target)}})})();var M={eager:"eager",lazy:"lazy"},be=class extends HTMLElement{loaded=Promise.resolve();static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super();this.delegate=new be.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return Lt(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}},b=be;x(b,"delegateConstructor");function Lt(s){switch(s.toLowerCase()){case"lazy":return M.lazy;default:return M.eager}}function u(s){return new URL(s.toString(),document.baseURI)}function A(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function ie(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return u(t)}function At(s){return(Mt(s).match(/\.[^.]*$/)||[])[0]||""}function Rt(s){return!!At(s).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Tt(s,e){let t=kt(e);return s.href===u(t).href||s.href.startsWith(t)}function R(s,e){return Tt(s,e)&&Rt(s)}function ne(s){let e=A(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function _(s){return ne(s)}function Ct(s,e){return u(s).href==u(e).href}function Pt(s){return s.pathname.split("/").slice(1)}function Mt(s){return Pt(s).slice(-1)[0]}function kt(s){return Ft(s.origin+s.pathname)}function Ft(s){return s.endsWith("/")?s:s+"/"}var U=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return u(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function B(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{let e=document.createElement("script"),t=Q("csp-nonce");return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,It(e,s),e}}function It(s,e){for(let{name:t,value:r}of e.attributes)s.setAttribute(t,r)}function qt(s){let e=document.createElement("template");return e.innerHTML=s,e.content}function d(s,{target:e,cancelable:t,detail:r}={}){let 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 k(){return document.visibilityState==="hidden"?we():Se()}function Se(){return new Promise(s=>requestAnimationFrame(()=>s()))}function we(){return new Promise(s=>setTimeout(()=>s(),0))}function Ht(){return Promise.resolve()}function Ee(s=""){return new DOMParser().parseFromString(s,"text/html")}function ye(s,...e){let t=Bt(s,e).replace(/^\n/,"").split(` -`),r=t[0].match(/^\s+/),i=r?r[0].length:0;return t.map(n=>n.slice(i)).join(` -`)}function Bt(s,e){return s.reduce((t,r,i)=>{let n=e[i]==null?"":e[i];return t+r+n},"")}function w(){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 $(s,...e){for(let t of e.map(r=>r?.getAttribute(s)))if(typeof t=="string")return t;return null}function Ot(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function z(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function j(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Nt(s,e=2e3){return new Promise(t=>{let 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 Le(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Vt(s){return s=="advance"||s=="replace"||s=="restore"}function K(...s){let e=$("data-turbo-action",...s);return Vt(e)?e:null}function Ae(s){return document.querySelector(`meta[name="${s}"]`)}function Q(s){let e=Ae(s);return e&&e.content}function Dt(s,e){let t=Ae(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function O(s,e){if(s instanceof Element)return s.closest(e)||O(s.assignedSlot||s.getRootNode()?.host,e)}function oe(s){let e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";return!!s&&s.closest(e)==null&&typeof s.focus=="function"}function Re(s){return Array.from(s.querySelectorAll("[autofocus]")).find(oe)}async function Wt(s,e){let t=e();s(),await Se();let r=e();return[t,r]}var Te=class extends Set{constructor(e){super();this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Ce=new Te(20),xt=window.fetch;function Pe(s,e={}){let t=new Headers(e.headers||{}),r=w();return Ce.add(r),t.append("X-Turbo-Request-Id",r),xt(s,{...e,headers:t})}function ae(s){switch(s.toLowerCase()){case"get":return p.get;case"post":return p.post;case"put":return p.put;case"patch":return p.patch;case"delete":return p.delete}}var p={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function _t(s){switch(s.toLowerCase()){case T.multipart:return T.multipart;case T.plain:return T.plain;default:return T.urlEncoded}}var T={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},N=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,i=new URLSearchParams,n=null,o=T.urlEncoded){let[a,l]=Me(u(r),t,i,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=ae(e)||p.get;this.url.search="";let[i,n]=Me(this.url,r,t,this.enctype);this.url=i,this.fetchOptions.body=n,this.fetchOptions.method=r}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this),await this.#t(e);try{this.delegate.requestStarted(this);let t=await Pe(this.url.href,e);return await this.receive(t)}catch(t){if(t.name!=="AbortError")throw this.#s(t)&&this.delegate.requestErrored(this,t),t}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new U(e);return d("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 le(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(i=>this.#e=i),r=d("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});this.url=r.detail.url,r.defaultPrevented&&await t}#s(e){return!d("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function le(s){return ae(s)==p.get}function Me(s,e,t,r){let i=Array.from(t).length>0?new URLSearchParams(ke(t)):s.searchParams;return le(e)?[Ut(s,i),null]:r==T.urlEncoded?[s,i]:[s,t]}function ke(s){let e=[];for(let[t,r]of s)r instanceof File||e.push([t,r]);return e}function Ut(s,e){let t=new URLSearchParams(ke(e));return s.search=t.toString(),s}var Fe=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},E=class{static wrap(e){return typeof e=="string"?new this(qt(e)):e}constructor(e){this.fragment=$t(e)}};x(E,"contentType","text/vnd.turbo-stream.html");function $t(s){for(let e of s.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(B(r));e.replaceWith(t)}return s}var F={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},I=class{state=F.initialized;static confirmMethod(e,t,r){return Promise.resolve(confirm(e))}constructor(e,t,r,i=!1){let n=Yt(t,r),o=Xt(Qt(t,r),n),a=zt(t,r),l=Jt(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new N(this,n,o,a,t,l),this.mustRedirect=i}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=u(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=F,r=$("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await I.confirmMethod(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=F;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=jt(Q("csrf-param"))||Q("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(E.contentType)}requestStarted(e){this.state=F.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),z(this.formElement),d("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&Kt(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=F.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=F.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),j(this.formElement),d("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Ot("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function zt(s,e){let t=new FormData(s),r=e?.getAttribute("name"),i=e?.getAttribute("value");return r&&t.append(r,i||""),t}function jt(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(s));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Kt(s){return s.statusCode==200&&!s.redirected}function Qt(s,e){let t=typeof s.action=="string"?s.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":s.getAttribute("action")||t||""}function Xt(s,e){let t=u(s);return le(e)&&(t.search=""),t}function Yt(s,e){let t=e?.getAttribute("formmethod")||s.getAttribute("method")||"";return ae(t.toLowerCase())||p.get}function Jt(s,e){return _t(e?.getAttribute("formenctype")||s.enctype)}var V=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Re(this.element)}get permanentElements(){return qe(this.element)}getPermanentElementById(e){return Ie(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:i}=r,n=e.getPermanentElementById(i);n&&(t[i]=[r,n])}return t}};function Ie(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function qe(s){return s.querySelectorAll("[id][data-turbo-permanent]")}var X=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Gt(t,r)&&Zt(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Gt(s,e){return(e?.getAttribute("formmethod")||s.getAttribute("method"))!="dialog"}function Zt(s,e){if(e?.hasAttribute("formtarget")||s.hasAttribute("target")){let t=e?.getAttribute("formtarget")||s.target;for(let r of document.getElementsByName(t))if(r instanceof HTMLIFrameElement)return!1;return!0}else return!0}var ce=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(A(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,newSnapshot:i}=e;if(r)try{this.renderPromise=new Promise(l=>this.#e=l),this.renderer=e,await this.prepareToRenderSnapshot(e);let n=new Promise(l=>this.#t=l),o={resume:this.#t,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(i,t,o)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(i,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else 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()}},He=class extends ce{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new V(this.element)}},he=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},de=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=this.findLinkFromClickTarget(t);if(r&&es(r)){let i=this.getLocationForLink(r);this.delegate.willFollowLinkToLocation(r,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,i))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}findLinkFromClickTarget(e){return O(e,"a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return u(e.getAttribute("href")||"")}};function es(s){if(s.hasAttribute("target")){for(let e of document.getElementsByName(s.target))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}var ue=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new de(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),i="hidden";for(let[m,g]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:i,name:m,value:g}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=K(e);l&&r.setAttribute("data-turbo-action",l);let v=e.getAttribute("data-turbo-confirm");v&&r.setAttribute("data-turbo-confirm",v),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())}},me=class{static async preservingPermanentElements(e,t,r){let i=new this(e,t);i.enter(),await r(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=ts(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function ts(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var D=class{#e=null;constructor(e,t,r,i,n=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=n,this.renderElement=r,this.promise=new Promise((o,a)=>this.resolvingFunctions={resolve:o,reject:a})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await me.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},Y=class extends D{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let i=t,n=i.ownerDocument?.createRange();n&&(n.selectNodeContents(i),e.appendChild(n.extractContents()))}constructor(e,t,r,i,n,o=!0){super(t,r,i,n,o);this.delegate=e}get shouldRender(){return!0}async render(){await k(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await k(),this.focusFirstAutofocusableElement(),await k(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=ss(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=rs(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=B(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function ss(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function rs(s,e){return s=="auto"||s=="smooth"?s:e}var L=class{static get defaultCSS(){return ye` +(()=>{var Wt=Object.defineProperty;var Ut=(s,e,t)=>e in s?Wt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var se=(s,e,t)=>(Ut(s,typeof e!="symbol"?e+"":e,t),t);(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,l){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+i+".",l)}})(HTMLFormElement.prototype);var qe=new WeakMap;function _t(s){let e=s instanceof Element?s:s instanceof Node?s.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function xt(s){let e=_t(s.target);e&&e.form&&qe.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let s=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))s=e;else return}addEventListener("click",xt,!0),Object.defineProperty(s,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return qe.get(this.target)}})})();var U={eager:"eager",lazy:"lazy"},Ce=class extends HTMLElement{loaded=Promise.resolve();static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super();this.delegate=new Ce.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="complete"?this.delegate.completeChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get loading(){return $t(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}},T=Ce;se(T,"delegateConstructor");function $t(s){switch(s.toLowerCase()){case"lazy":return U.lazy;default:return U.eager}}function S(s){return new URL(s.toString(),document.baseURI)}function B(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function ge(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return S(t)}function jt(s){return(Yt(s).match(/\.[^.]*$/)||[])[0]||""}function zt(s){return!!jt(s).match(/^(?:|\.(?:htm|html|xhtml|php))$/)}function Xt(s,e){let t=Jt(e);return s.href===S(t).href||s.href.startsWith(t)}function k(s,e){return Xt(s,e)&&zt(s)}function be(s){let e=B(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function re(s){return be(s)}function Kt(s,e){return S(s).href==S(e).href}function Qt(s){return s.pathname.split("/").slice(1)}function Yt(s){return Qt(s).slice(-1)[0]}function Jt(s){return Gt(s.origin+s.pathname)}function Gt(s){return s.endsWith("/")?s:s+"/"}var ie=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return S(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function G(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{let e=document.createElement("script"),t=x("csp-nonce");return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Zt(e,s),e}}function Zt(s,e){for(let{name:t,value:r}of e.attributes)s.setAttribute(t,r)}function es(s){let e=document.createElement("template");return e.innerHTML=s,e.content}function p(s,{target:e,cancelable:t,detail:r}={}){let 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 _(){return document.visibilityState==="hidden"?Be():He()}function He(){return new Promise(s=>requestAnimationFrame(()=>s()))}function Be(){return new Promise(s=>setTimeout(()=>s(),0))}function ts(){return Promise.resolve()}function Oe(s=""){return new DOMParser().parseFromString(s,"text/html")}function De(s,...e){let t=ss(s,e).replace(/^\n/,"").split(` +`),r=t[0].match(/^\s+/),i=r?r[0].length:0;return t.map(l=>l.slice(i)).join(` +`)}function ss(s,e){return s.reduce((t,r,i)=>{let l=e[i]==null?"":e[i];return t+r+l},"")}function F(){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 ne(s,...e){for(let t of e.map(r=>r?.getAttribute(s)))if(typeof t=="string")return t;return null}function rs(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function oe(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function ae(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function is(s,e=2e3){return new Promise(t=>{let 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 Ve(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function ns(s){return s=="advance"||s=="replace"||s=="restore"}function O(...s){let e=ne("data-turbo-action",...s);return ns(e)?e:null}function Ne(s){return document.querySelector(`meta[name="${s}"]`)}function x(s){let e=Ne(s);return e&&e.content}function os(s,e){let t=Ne(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function $(s,e){if(s instanceof Element)return s.closest(e)||$(s.assignedSlot||s.getRootNode()?.host,e)}function ve(s){let e="[inert], :disabled, [hidden], details:not([open]), dialog:not([open])";return!!s&&s.closest(e)==null&&typeof s.focus=="function"}function We(s){return Array.from(s.querySelectorAll("[autofocus]")).find(ve)}async function as(s,e){let t=e();s(),await He();let r=e();return[t,r]}function Ue(s){if(s.hasAttribute("target")){for(let e of document.getElementsByName(s.target))if(e instanceof HTMLIFrameElement)return!1}return!0}function ls(s){return $(s,"a[href]:not([target^=_]):not([download])")}function _e(s){return S(s.getAttribute("href")||"")}function cs(s,e){let t=null;return(...r)=>{let i=()=>s.apply(this,r);clearTimeout(t),t=setTimeout(i,e)}}var xe=class extends Set{constructor(e){super();this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},$e=new xe(20),hs=window.fetch;function je(s,e={}){let t=new Headers(e.headers||{}),r=F();return $e.add(r),t.append("X-Turbo-Request-Id",r),hs(s,{...e,headers:t})}function Se(s){switch(s.toLowerCase()){case"get":return y.get;case"post":return y.post;case"put":return y.put;case"patch":return y.patch;case"delete":return y.delete}}var y={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function us(s){switch(s.toLowerCase()){case D.multipart:return D.multipart;case D.plain:return D.plain;default:return D.urlEncoded}}var D={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},j=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,i=new URLSearchParams,l=null,d=D.urlEncoded){let[m,w]=ze(S(r),t,i,d);this.delegate=e,this.url=m,this.target=l,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t,headers:{...this.defaultHeaders},body:w,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=d}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Se(e)||y.get;this.url.search="";let[i,l]=ze(this.url,r,t,this.enctype);this.url=i,this.fetchOptions.body=l,this.fetchOptions.method=r}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=je(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#s(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new ie(e);return p("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 we(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(i=>this.#e=i),r=p("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#s(e){return!p("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function we(s){return Se(s)==y.get}function ze(s,e,t,r){let i=Array.from(t).length>0?new URLSearchParams(Xe(t)):s.searchParams;return we(e)?[ds(s,i),null]:r==D.urlEncoded?[s,i]:[s,t]}function Xe(s){let e=[];for(let[t,r]of s)r instanceof File||e.push([t,r]);return e}function ds(s,e){let t=new URLSearchParams(Xe(e));return s.search=t.toString(),s}var Ke=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},C=class{static wrap(e){return typeof e=="string"?new this(es(e)):e}constructor(e){this.fragment=ms(e)}};se(C,"contentType","text/vnd.turbo-stream.html");function ms(s){for(let e of s.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(G(r));e.replaceWith(t)}return s}var fs=100,Qe=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,r){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,r),this.#e=null},fs)}set(e,t,r){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+r)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},ps=10*1e3,z=new Qe,X={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},K=class{state=X.initialized;static confirmMethod(e,t,r){return Promise.resolve(confirm(e))}constructor(e,t,r,i=!1){let l=Es(t,r),d=ws(Ss(t,r),l),m=gs(t,r),w=ys(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new j(this,l,d,m,t,w),this.mustRedirect=i}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=S(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=X,r=ne("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await K.confirmMethod(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=X;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=bs(x("csrf-param"))||x("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(C.contentType)}requestStarted(e){this.state=X.waiting,this.submitter?.setAttribute("disabled",""),this.setSubmitsWith(),oe(this.formElement),p("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){z.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(z.clear(),this.requestMustRedirect(e)&&vs(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=X.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=X.stopped,this.submitter?.removeAttribute("disabled"),this.resetSubmitterText(),ae(this.formElement),p("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||rs("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function gs(s,e){let t=new FormData(s),r=e?.getAttribute("name"),i=e?.getAttribute("value");return r&&t.append(r,i||""),t}function bs(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(s));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function vs(s){return s.statusCode==200&&!s.redirected}function Ss(s,e){let t=typeof s.action=="string"?s.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":s.getAttribute("action")||t||""}function ws(s,e){let t=S(s);return we(e)&&(t.search=""),t}function Es(s,e){let t=e?.getAttribute("formmethod")||s.getAttribute("method")||"";return Se(t.toLowerCase())||y.get}function ys(s,e){return us(e?.getAttribute("formenctype")||s.enctype)}var Z=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return We(this.element)}get permanentElements(){return Je(this.element)}getPermanentElementById(e){return Ye(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:i}=r,l=e.getPermanentElementById(i);l&&(t[i]=[r,l])}return t}};function Ye(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function Je(s){return s.querySelectorAll("[id][data-turbo-permanent]")}var le=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Rs(t,r)&&As(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Rs(s,e){return(e?.getAttribute("formmethod")||s.getAttribute("method"))!="dialog"}function As(s,e){if(e?.hasAttribute("formtarget")||s.hasAttribute("target")){let t=e?.getAttribute("formtarget")||s.target;for(let r of document.getElementsByName(t))if(r instanceof HTMLIFrameElement)return!1;return!0}else return!0}var Ee=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(B(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:i,newSnapshot:l}=e,d=i;if(r)try{this.renderPromise=new Promise(A=>this.#e=A),this.renderer=e,await this.prepareToRenderSnapshot(e);let m=new Promise(A=>this.#t=A),w={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(l,w)||await m,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(l,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else d&&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()}},Ge=class extends Ee{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new Z(this.element)}},ye=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.respondsToEventTarget(e.target)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.respondsToEventTarget(e.target)&&e.target instanceof Element&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},Re=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=ls(t);if(r&&Ue(r)){let i=_e(r);this.delegate.willFollowLinkToLocation(r,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,i))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},Ae=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Re(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),i="hidden";for(let[N,E]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:i,name:N,value:E}));let l=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",l.href),r.setAttribute("hidden","");let d=e.getAttribute("data-turbo-method");d&&r.setAttribute("method",d);let m=e.getAttribute("data-turbo-frame");m&&r.setAttribute("data-turbo-frame",m);let w=O(e);w&&r.setAttribute("data-turbo-action",w);let L=e.getAttribute("data-turbo-confirm");L&&r.setAttribute("data-turbo-confirm",L),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())}},Le=class{static async preservingPermanentElements(e,t,r){let i=new this(e,t);i.enter(),await r(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Ls(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Ls(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var ce=class{#e=null;constructor(e,t,r,i,l=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=i,this.willRender=l,this.renderElement=r,this.promise=new Promise((d,m)=>this.resolvingFunctions={resolve:d,reject:m})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Le.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},he=class extends ce{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let i=t,l=i.ownerDocument?.createRange();l&&(l.selectNodeContents(i),e.appendChild(l.extractContents()))}constructor(e,t,r,i,l,d=!0){super(t,r,i,l,d);this.delegate=e}get shouldRender(){return!0}async render(){await _(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await _(),this.focusFirstAutofocusableElement(),await _(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=Ts(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=Ps(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=G(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function Ts(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function Ps(s,e){return s=="auto"||s=="smooth"?s:e}var I=class{static get defaultCSS(){return De` .turbo-progress-bar { position: fixed; display: block; @@ -10,11 +10,11 @@ background: #0076ff; z-index: 2147483647; transition: - width ${L.animationDuration}ms ease-out, - opacity ${L.animationDuration/2}ms ${L.animationDuration/2}ms ease-in; + width ${I.animationDuration}ms ease-out, + opacity ${I.animationDuration/2}ms ${I.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } - `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,L.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,L.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=L.defaultCSS,this.cspNonce&&(e.nonce=this.cspNonce),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}get cspNonce(){return Q("csp-nonce")}},fe=L;x(fe,"animationDuration",300);var Be=class extends V{detailsByOuterHTML=this.children.filter(e=>!as(e)).map(e=>hs(e)).reduce((e,t)=>{let{outerHTML:r}=t,i=r in e?e[r]:{type:is(t),tracked:ns(t),elements:[]};return{...e,[r]:{...i,elements:[...i.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:i,elements:n}=this.detailsByOuterHTML[t];return r==null&&!i?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[i]}=this.detailsByOuterHTML[r];return cs(i,e)?i:t},void 0|void 0)}};function is(s){if(os(s))return"script";if(ls(s))return"stylesheet"}function ns(s){return s.getAttribute("data-turbo-track")=="reload"}function os(s){return s.localName=="script"}function as(s){return s.localName=="noscript"}function ls(s){let e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function cs(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function hs(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}var f=class extends V{static fromHTMLString(e=""){return this.fromDocument(Ee(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new Be(r))}constructor(e,t,r){super(t);this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[i,n]of t.entries()){let o=r[i];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let i of e.querySelectorAll('input[type="password"]'))i.value="";return new f(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return u(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}`)}},Oe=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},ds={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},J={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},S={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},q={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},us={advance:"forward",restore:"back",replace:"none"},Ne=class{identifier=w();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=S.initialized;viewTransitioner=new Oe;constructor(e,t,r,i={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||w();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:v,response:c,visitCachedSnapshot:m,willRender:g,updateHistory:H,shouldCacheSnapshot:re,acceptsStreamResponse:bt,direction:vt}={...ds,...i};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=v,this.response=c,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.visitCachedSnapshot=m,this.willRender=g,this.updateHistory=H,this.scrolled=!g,this.shouldCacheSnapshot=re,this.acceptsStreamResponse=bt,this.direction=vt||us[n]}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==S.initialized&&(this.recordTimingMetric(J.visitStart),this.state=S.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==S.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=S.canceled)}complete(){this.state==S.started&&(this.recordTimingMetric(J.visitEnd),this.state=S.completed,this.followRedirect(),this.followedRedirect||(this.adapter.visitCompleted(this),this.delegate.visitCompleted(this)))}fail(){this.state==S.started&&(this.state=S.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Le(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new N(this,p.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(J.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Ve(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(J.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Ve(e)&&t!=null){let r=f.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(f.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!A(this.location)||e.hasAnchor(A(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return f.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(E.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:i,statusCode:n}=t;r==null?this.recordResponse({statusCode:q.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:i}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:i,statusCode:n}=t;r==null?this.recordResponse({statusCode:q.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:n,responseHTML:r,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:q.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=A(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),this.frame=await k(),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 Ve(s){return s>=200&&s<300}var De=class{progressBar=new fe;constructor(e){this.session=e}visitProposedToLocation(e,t){R(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||w(),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 q.networkFailure:case q.timeoutFailure:case q.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){d("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},We=class{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},xe=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new he(this,t),this.formSubmitObserver=new X(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let i=this.#s(e);i&&i.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#s(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=ie(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=u(i?.content??"/");return this.#t(e,t)&&R(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let i=this.#s(e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1}#s(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let i=this.element.querySelector(`#${r}:not([disabled])`);if(i instanceof b)return i}}},_e=class{location;restorationIdentifier=w();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=w()){e===history.pushState&&++this.currentIndex;let 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){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:r,restorationIndex:i}=t;this.restorationIdentifier=r;let n=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=i}}};onPageLoad=async e=>{await Ht(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},Ue=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new Ne(this,u(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new I(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let i=e.isSafe;i||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:i,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let i=f.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)}locationWithActionIsSamePage(e,t){let r=A(e),i=A(this.view.lastRenderedLocation),n=t==="restore"&&typeof r=="undefined";return t!=="replace"&&ne(e)===ne(this.view.lastRenderedLocation)&&(n||r!=null&&r!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:i}=e;return K(r,i)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},C={initial:0,loading:1,interactive:2,complete:3},$e=class{stage=C.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==C.initial&&(this.stage=C.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==C.loading&&(this.stage=C.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==C.interactive&&(this.stage=C.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},ze=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},je=class{render({fragment:e}){me.preservingPermanentElements(this,ms(e),()=>{fs(e,()=>{ps(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function ms(s){let e=qe(document.documentElement),t={};for(let r of e){let{id:i}=r;for(let n of s.querySelectorAll("turbo-stream")){let o=Ie(n.templateElement.content,i);o&&(t[i]=[r,o])}}return t}async function fs(s,e){let t=`turbo-stream-autofocus-${w()}`,r=s.querySelectorAll("turbo-stream"),i=gs(r),n=null;if(i&&(i.id?n=i.id:n=t,i.id=n),e(),await k(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);oe(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function ps(s){let[e,t]=await Wt(s,()=>document.activeElement),r=e&&e.id;if(r){let i=document.getElementById(r);oe(i)&&i!=t&&i.focus()}}function gs(s){for(let e of s){let t=Re(e.templateElement.content);if(t)return t}return null}var Ke=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=bs(e);t&&vs(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(E.wrap(e))}};function bs(s){let e=s.detail?.fetchResponse;if(e instanceof U)return e}function vs(s){return(s.contentType??"").startsWith(E.contentType)}var pe=class extends D{static renderElement(e,t){let{documentElement:r,body:i}=document;r.replaceChild(t,i)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=B(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},ge=new Set;function Ss(s,e,t={}){s instanceof Document&&(s=s.documentElement),typeof e=="string"&&(e=As(e));let r=Rs(e),i=Es(s,r,t);return Qe(s,r,i)}function Qe(s,e,t){if(t.head.block){let r=s.querySelector("head"),i=e.querySelector("head");if(r&&i){let n=Ye(i,r,t);Promise.all(n).then(function(){Qe(s,e,Object.assign(t,{head:{block:!1,ignore:!0}}))});return}}if(t.morphStyle==="innerHTML")return Xe(e,s,t),s.children;if(t.morphStyle==="outerHTML"||t.morphStyle==null){let r=Cs(e,s,t),i=r?.previousSibling,n=r?.nextSibling,o=G(s,r,t);return r?Ts(i,o,n):[]}else throw"Do not understand how to morph style "+t.morphStyle}function G(s,e,t){if(!(t.ignoreActive&&s===document.activeElement))return e==null?t.callbacks.beforeNodeRemoved(s)===!1?void 0:(s.remove(),t.callbacks.afterNodeRemoved(s),null):ee(s,e)?t.callbacks.beforeNodeMorphed(s,e)===!1?void 0:(s instanceof HTMLHeadElement&&t.head.ignore||(s instanceof HTMLHeadElement&&t.head.style!=="morph"?Ye(e,s,t):(ws(e,s),Xe(e,s,t))),t.callbacks.afterNodeMorphed(s,e),s):t.callbacks.beforeNodeRemoved(s)===!1||t.callbacks.beforeNodeAdded(e)===!1?void 0:(s.parentElement.replaceChild(e,s),t.callbacks.afterNodeAdded(e),t.callbacks.afterNodeRemoved(s),e)}function Xe(s,e,t){let r=s.firstChild,i=e.firstChild,n;for(;r;){if(n=r,r=n.nextSibling,i==null){if(t.callbacks.beforeNodeAdded(n)===!1)return;e.appendChild(n),t.callbacks.afterNodeAdded(n),P(t,n);continue}if(Je(n,i,t)){G(i,n,t),i=i.nextSibling,P(t,n);continue}let o=ys(s,e,n,i,t);if(o){i=Ge(i,o,t),G(o,n,t),P(t,n);continue}let a=Ls(s,e,n,i,t);if(a){i=Ge(i,a,t),G(a,n,t),P(t,n);continue}if(t.callbacks.beforeNodeAdded(n)===!1)return;e.insertBefore(n,i),t.callbacks.afterNodeAdded(n),P(t,n)}for(;i!==null;){let o=i;i=i.nextSibling,Ze(o,t)}}function ws(s,e){let t=s.nodeType;if(t===1){let r=s.attributes,i=e.attributes;for(let n of r)e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value);for(let n of i)s.hasAttribute(n.name)||e.removeAttribute(n.name)}if((t===8||t===3)&&e.nodeValue!==s.nodeValue&&(e.nodeValue=s.nodeValue),s instanceof HTMLInputElement&&e instanceof HTMLInputElement&&s.type!=="file")e.value=s.value||"",Z(s,e,"value"),Z(s,e,"checked"),Z(s,e,"disabled");else if(s instanceof HTMLOptionElement)Z(s,e,"selected");else if(s instanceof HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){let r=s.value,i=e.value;r!==i&&(e.value=r),e.firstChild&&e.firstChild.nodeValue!==r&&(e.firstChild.nodeValue=r)}}function Z(s,e,t){s[t]!==e[t]&&(s[t]?e.setAttribute(t,s[t]):e.removeAttribute(t))}function Ye(s,e,t){let r=[],i=[],n=[],o=[],a=t.head.style,l=new Map;for(let c of s.children)l.set(c.outerHTML,c);for(let c of e.children){let m=l.has(c.outerHTML),g=t.head.shouldReAppend(c),H=t.head.shouldPreserve(c);m||H?g?i.push(c):(l.delete(c.outerHTML),n.push(c)):a==="append"?g&&(i.push(c),o.push(c)):t.head.shouldRemove(c)!==!1&&i.push(c)}o.push(...l.values());let v=[];for(let c of o){let m=document.createRange().createContextualFragment(c.outerHTML).firstChild;if(t.callbacks.beforeNodeAdded(m)!==!1){if(m.href||m.src){let g=null,H=new Promise(function(re){g=re});m.addEventListener("load",function(){g()}),v.push(H)}e.appendChild(m),t.callbacks.afterNodeAdded(m),r.push(m)}}for(let c of i)t.callbacks.beforeNodeRemoved(c)!==!1&&(e.removeChild(c),t.callbacks.afterNodeRemoved(c));return t.head.afterHeadMorphed(e,{added:r,kept:n,removed:i}),v}function y(){}function Es(s,e,t){return{target:s,newContent:e,config:t,morphStyle:t.morphStyle,ignoreActive:t.ignoreActive,idMap:Fs(s,e),deadIds:new Set,callbacks:Object.assign({beforeNodeAdded:y,afterNodeAdded:y,beforeNodeMorphed:y,afterNodeMorphed:y,beforeNodeRemoved:y,afterNodeRemoved:y},t.callbacks),head:Object.assign({style:"merge",shouldPreserve:function(r){return r.getAttribute("im-preserve")==="true"},shouldReAppend:function(r){return r.getAttribute("im-re-append")==="true"},shouldRemove:y,afterHeadMorphed:y},t.head)}}function Je(s,e,t){return s==null||e==null?!1:s.nodeType===e.nodeType&&s.tagName===e.tagName?s.id!==""&&s.id===e.id?!0:W(t,s,e)>0:!1}function ee(s,e){return s==null||e==null?!1:s.nodeType===e.nodeType&&s.tagName===e.tagName}function Ge(s,e,t){for(;s!==e;){let r=s;s=s.nextSibling,Ze(r,t)}return P(t,e),e.nextSibling}function ys(s,e,t,r,i){let n=W(i,t,e),o=null;if(n>0){let a=r,l=0;for(;a!=null;){if(Je(t,a,i))return a;if(l+=W(i,a,s),l>n)return null;a=a.nextSibling}}return o}function Ls(s,e,t,r,i){let n=r,o=t.nextSibling,a=0;for(;n!=null;){if(W(i,n,s)>0)return null;if(ee(t,n))return n;if(ee(o,n)&&(a++,o=o.nextSibling,a>=2))return null;n=n.nextSibling}return n}function As(s){let e=new DOMParser,t=s.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(t.match(/<\/html>/)||t.match(/<\/head>/)||t.match(/<\/body>/)){let r=e.parseFromString(s,"text/html");if(t.match(/<\/html>/))return r.generatedByIdiomorph=!0,r;{let i=r.firstChild;return i?(i.generatedByIdiomorph=!0,i):null}}else{let i=e.parseFromString("","text/html").body.querySelector("template").content;return i.generatedByIdiomorph=!0,i}}function Rs(s){if(s==null)return document.createElement("div");if(s.generatedByIdiomorph)return s;if(s instanceof Node){let e=document.createElement("div");return e.append(s),e}else{let e=document.createElement("div");for(let t of[...s])e.append(t);return e}}function Ts(s,e,t){let r=[],i=[];for(;s!=null;)r.push(s),s=s.previousSibling;for(;r.length>0;){let n=r.pop();i.push(n),e.parentElement.insertBefore(n,e)}for(i.push(e);t!=null;)r.push(t),i.push(t),t=t.nextSibling;for(;r.length>0;)e.parentElement.insertBefore(r.pop(),e.nextSibling);return i}function Cs(s,e,t){let r;r=s.firstChild;let i=r,n=0;for(;r;){let o=Ps(r,e,t);o>n&&(i=r,n=o),r=r.nextSibling}return i}function Ps(s,e,t){return ee(s,e)?.5+W(t,s,e):0}function Ze(s,e){P(e,s),e.callbacks.beforeNodeRemoved(s)!==!1&&(s.remove(),e.callbacks.afterNodeRemoved(s))}function Ms(s,e){return!s.deadIds.has(e)}function ks(s,e,t){return(s.idMap.get(t)||ge).has(e)}function P(s,e){let t=s.idMap.get(e)||ge;for(let r of t)s.deadIds.add(r)}function W(s,e,t){let r=s.idMap.get(e)||ge,i=0;for(let n of r)Ms(s,n)&&ks(s,n,t)&&++i;return i}function et(s,e){let t=s.parentElement,r=s.querySelectorAll("[id]");for(let i of r){let n=i;for(;n!==t&&n!=null;){let o=e.get(n);o==null&&(o=new Set,e.set(n,o)),o.add(i.id),n=n.parentElement}}}function Fs(s,e){let t=new Map;return et(s,t),et(e,t),t}var Is={morph:Ss},tt=class extends D{async render(){this.willRender&&await this.#e()}get renderMethod(){return"morph"}async#e(){this.#t(this.currentElement,this.newElement),this.#r(),d("turbo:morph",{detail:{currentElement:this.currentElement,newElement:this.newElement}})}#t(e,t,r="outerHTML"){this.isMorphingTurboFrame=this.#o(e),Is.morph(e,t,{morphStyle:r,callbacks:{beforeNodeAdded:this.#s,beforeNodeMorphed:this.#i,beforeNodeRemoved:this.#n}})}#s=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));#i=(e,t)=>e instanceof HTMLElement?!e.hasAttribute("data-turbo-permanent")&&(this.isMorphingTurboFrame||!this.#o(e)):!0;#n=e=>this.#i(e);#r(){this.#h().forEach(e=>{this.#o(e)&&(this.#l(e),e.reload())})}#l(e){e.addEventListener("turbo:before-frame-render",t=>{t.detail.render=this.#c},{once:!0})}#c=(e,t)=>{d("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),this.#t(e,t.children,"innerHTML")};#o(e){return e.src&&e.refresh==="morph"}#h(){return Array.from(document.querySelectorAll("turbo-frame[src]")).filter(e=>!e.closest("[data-turbo-permanent]"))}},te=class extends D{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Nt(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(B(e))}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,i]of t.entries()){if(e.tagName=="TITLE"){if(i.tagName!="TITLE")continue;if(e.innerHTML==i.innerHTML)return t.splice(r,1),!0}if(i.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=B(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}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")}},st=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return _(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[_(e)]}write(e,t){this.snapshots[_(e)]=t}touch(e){let t=_(e),r=this.keys.indexOf(t);r>-1&&this.keys.splice(r,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},rt=class extends ce{snapshotCache=new st(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,i){let o=this.isPageRefresh(i)&&this.snapshot.shouldMorphPage?tt:te,a=new o(this.snapshot,e,te.renderElement,t,r);return a.shouldRender?i?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new pe(this.snapshot,e,pe.renderElement,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await we();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return f.fromElement(this.element)}},it=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new N(this,p.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,i=f.fromHTMLString(r);this.snapshotCache.put(e.url,i)}catch(r){}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},nt=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Dt("turbo-cache-control",e)}},ot=class{navigator=new Ue(this);history=new _e(this);view=new rt(this,document.documentElement);adapter=new De(this);pageObserver=new $e(this);cacheObserver=new We;linkClickObserver=new de(this,window);formSubmitObserver=new X(this,document);scrollObserver=new ze(this);streamObserver=new Ke(this);formLinkClickObserver=new ue(this,document.documentElement);frameRedirector=new xe(this,document.documentElement);streamMessageRenderer=new je;cache=new nt(this);drive=!0;enabled=!0;progressBarDelay=500;started=!1;formMode="on";constructor(e){this.recentRequests=e,this.preloader=new it(this,this.view.snapshotCache)}start(){this.started||(this.pageObserver.start(),this.cacheObserver.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.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;r instanceof b?(r.src=e.toString(),r.loaded):this.navigator.proposeVisit(u(e),t)}refresh(e,t){t&&this.recentRequests.has(t)||(this.cache.exemptPageFromPreview(),this.visit(e,{action:"replace"}))}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(E.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}setFormMode(e){this.formMode=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),n=i=="_top"?null:document.getElementById(i)||O(e,"turbo-frame:not([disabled])");if(t||r||n instanceof b)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&R(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&R(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&R(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let 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){at(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(z(document.documentElement),this.view.markVisitDirection(e.direction)),at(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),j(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let r=ie(e,t);return this.submissionIsNavigatable(e,t)&&R(u(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t,r){let i=this.notifyApplicationBeforeRender(e,t,r),{defaultPrevented:n,detail:{render:o}}=i;return this.view.renderer&&o&&(this.view.renderer.renderElement=o),!n}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(t,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 d("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return d("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return d("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return d("turbo:before-cache")}notifyApplicationBeforeRender(e,t,r){return d("turbo:before-render",{detail:{newBody:e,isPreview:t,...r},cancelable:!0})}notifyApplicationAfterRender(e,t){return d("turbo:render",{detail:{isPreview:e,renderMethod:t}})}notifyApplicationAfterPageLoad(e={}){return d("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 d("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return d("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(this.formMode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return this.formMode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=O(e,"[data-turbo]"),r=O(e,"turbo-frame");return this.drive||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return K(e)||"advance"}get snapshot(){return this.view.snapshot}};function at(s){Object.defineProperties(s,qs)}var qs={absoluteURL:{get(){return this.toString()}}},h=new ot(Ce),{cache:Hs,navigator:Bs}=h;function lt(){h.start()}function Os(s){h.registerAdapter(s)}function Ns(s,e){h.visit(s,e)}function ct(s){h.connectStreamSource(s)}function ht(s){h.disconnectStreamSource(s)}function Vs(s){h.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.`"),h.clearCache()}function Ws(s){h.setProgressBarDelay(s)}function xs(s){I.confirmMethod=s}function _s(s){h.setFormMode(s)}var Us=Object.freeze({__proto__:null,navigator:Bs,session:h,cache:Hs,PageRenderer:te,PageSnapshot:f,FrameRenderer:Y,fetch:Pe,start:lt,registerAdapter:Os,visit:Ns,connectStreamSource:ct,disconnectStreamSource:ht,renderStreamMessage:Vs,clearCache:Ds,setProgressBarDelay:Ws,setConfirmMethod:xs,setFormMode:_s}),dt=class extends Error{},ut=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#s=!1;#i=!1;#n=new Set;action=null;constructor(e){this.element=e,this.view=new He(this,this.element),this.appearanceObserver=new Fe(this,this.element),this.formLinkClickObserver=new ue(this,this.element),this.linkInterceptor=new he(this,this.element),this.restorationIdentifier=w(),this.formSubmitObserver=new X(this,this.element)}connect(){this.#s||(this.#s=!0,this.loadingStyle==M.lazy?this.appearanceObserver.start():this.#r(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#s&&(this.#s=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==M.eager&&this.#r()}sourceURLChanged(){this.#f("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==M.eager||this.#i)&&this.#r())}sourceURLReloaded(){let{src:e}=this.element;return this.#u("complete",()=>{this.element.removeAttribute("complete")}),this.element.src=null,this.element.src=e,this.element.loaded}completeChanged(){this.#f("complete")||this.#r()}loadingStyleChanged(){this.loadingStyle==M.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#r())}async#r(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#c(u(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#i=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=Ee(t);f.fromDocument(r).isVisitable?await this.#l(e,r):await this.#h(e)}}finally{this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,e),this.#r()}willSubmitFormLinkToLocation(e){return this.#d(e)}submittedFormLinkToLocation(e,t,r){let i=this.#a(e);i&&r.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,r){return this.#d(e)}linkClickIntercepted(e,t){this.#o(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#d(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new I(this,e,t);let{fetchRequest:r}=this.formSubmission;this.prepareRequest(r),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(E.contentType)}requestStarted(e){z(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){j(this.element)}formSubmissionStarted({formElement:e}){z(e,this.#a(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#a(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,e.formElement,e.submitter),r.delegate.loadResponse(t),e.isSafe||h.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),h.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){j(e,this.#a(e))}allowsImmediateRender({element:e},t,r){let i=d("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...r},cancelable:!0}),{defaultPrevented:n,detail:{render:o}}=i;return this.view.renderer&&o&&(this.view.renderer.renderElement=o),!n}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){h.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#l(e,t){let r=await this.extractForeignFrameElement(t.body);if(r){let i=new V(r),n=new Y(this,this.view.snapshot,i,Y.renderElement,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,h.frameRendered(e,this.element),h.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#p(e)&&this.#g(e)}async#c(e){let t=new N(this,p.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#o(e,t,r){let i=this.#a(e,r);i.delegate.proposeVisitIfNavigatedWithAction(i,e,r),this.#S(e,()=>{i.src=t})}proposeVisitIfNavigatedWithAction(e,t,r){if(this.action=K(r,t,e),this.action){let i=f.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=async o=>{if(e.src){let{statusCode:a,redirected:l}=o,v=await o.responseHTML,m={response:{statusCode:a,redirected:l,responseHTML:v},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:i};this.action&&(m.action=this.action),h.visit(e.src,m)}}}}changeHistory(){if(this.action){let e=Le(this.action);h.history.update(e,u(this.element.src||""),this.restorationIdentifier)}}async#h(e){console.warn(`The response (${e.statusCode}) from is performing a full page visit due to turbo-visit-control.`),await this.#m(e.response)}#p(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#m(n):h.visit(n,o)};return!d("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#g(e){this.view.missing(),this.#b(e)}#b(e){let 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 dt(t)}async#m(e){let t=new U(e),r=await t.responseHTML,{location:i,redirected:n,statusCode:o}=t;return h.visit(i,{response:{redirected:n,statusCode:o,responseHTML:r}})}#a(e,t){let r=$("data-turbo-frame",t,e)||this.element.getAttribute("target");return mt(r)??this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=ft(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=ft(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 b}return null}#v(e,t){let r=ie(e,t);return R(u(r),this.rootLocation)}#d(e,t){let r=$("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#v(e,t)||!this.enabled||r=="_top")return!1;if(r){let i=mt(r);if(i)return!i.disabled}return!(!h.elementIsNavigatable(e)||t&&!h.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#u("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){this.#u("complete",()=>{e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")})}get isActive(){return this.element.isActive&&this.#s}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return u(t)}#f(e){return this.#n.has(e)}#u(e,t){this.#n.add(e),t(),this.#n.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function mt(s){if(s!=null){let e=document.getElementById(s);if(e instanceof b)return e}}function ft(s,e){if(s){let t=s.getAttribute("src");if(t!=null&&e!=null&&Ct(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 b)return s.connectedCallback(),s.disconnectedCallback(),s}}var pt={after(){this.targetElements.forEach(s=>s.parentElement?.insertBefore(this.templateContent,s.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.targetElements.forEach(s=>s.parentElement?.insertBefore(this.templateContent,s))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){this.targetElements.forEach(s=>s.replaceWith(this.templateContent))},update(){this.targetElements.forEach(s=>{s.innerHTML="",s.append(this.templateContent)})},refresh(){h.refresh(this.baseURI,this.requestId)}},se=class extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await k(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=pt[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a