Plugin Directory

Changeset 3297490


Ignore:
Timestamp:
05/20/2025 03:27:48 PM (10 months ago)
Author:
rherault
Message:

Update to version 0.4.0 from GitHub

Location:
td-turbo-drive
Files:
4 added
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • td-turbo-drive/tags/0.4.0/dist/main.js

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

    r2984793 r3297490  
    1313 */
    1414
     15// Include settings class file
     16require_once plugin_dir_path(__FILE__) . 'includes/class-turbo-drive-settings.php';
     17
     18// Initialize settings class
     19$turbo_drive_settings = Turbo_Drive_Settings::get_instance();
     20
    1521add_action('wp_enqueue_scripts', function () {
    1622    wp_enqueue_script('turbo-drive', plugins_url('/dist/main.js', __FILE__));
     23
     24    // Add progress bar color to JavaScript parameters
     25    $options = Turbo_Drive_Settings::get_instance()->get_options();
     26    wp_localize_script('turbo-drive', 'turboDriveOptions', array(
     27        'progressBarColor' => $options['progress_bar_color'],
     28    ));
    1729}, 10);
    1830
  • td-turbo-drive/trunk/dist/main.js

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

    r2984793 r3297490  
    1313 */
    1414
     15// Include settings class file
     16require_once plugin_dir_path(__FILE__) . 'includes/class-turbo-drive-settings.php';
     17
     18// Initialize settings class
     19$turbo_drive_settings = Turbo_Drive_Settings::get_instance();
     20
    1521add_action('wp_enqueue_scripts', function () {
    1622    wp_enqueue_script('turbo-drive', plugins_url('/dist/main.js', __FILE__));
     23
     24    // Add progress bar color to JavaScript parameters
     25    $options = Turbo_Drive_Settings::get_instance()->get_options();
     26    wp_localize_script('turbo-drive', 'turboDriveOptions', array(
     27        'progressBarColor' => $options['progress_bar_color'],
     28    ));
    1729}, 10);
    1830
Note: See TracChangeset for help on using the changeset viewer.