1import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t}from"./integrationApp-DcQdpaRn.js";import{a as n,i as r,n as i,o as a,r as o}from"./phone-CmG242aJ.js";var s=e({FetchEnctype:()=>T,FetchMethod:()=>w,FetchRequest:()=>E,FetchResponse:()=>Fe,FrameElement:()=>l,FrameLoadingStyle:()=>c,FrameRenderer:()=>F,PageRenderer:()=>Pn,PageSnapshot:()=>R,StreamActions:()=>Or,StreamElement:()=>kr,StreamSourceElement:()=>jr,cache:()=>Jn,config:()=>b,connectStreamSource:()=>$n,disconnectStreamSource:()=>er,fetch:()=>Le,fetchEnctypeFromString:()=>ze,fetchMethodFromString:()=>Re,isSafe:()=>We,morphBodyElements:()=>ar,morphChildren:()=>L,morphElements:()=>I,morphTurboFrameElements:()=>or,navigator:()=>Yn,registerAdapter:()=>Zn,renderStreamMessage:()=>tr,session:()=>K,setConfirmMethod:()=>rr,setFormMode:()=>ir,setProgressBarDelay:()=>nr,start:()=>Xn,visit:()=>Qn}),c={eager:`eager`,lazy:`lazy`},l=class e extends HTMLElement{static get observedAttributes(){return[`disabled`,`loading`,`src`]}constructor(){super(),t(this,`loaded`,Promise.resolve()),this.delegate=new e.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e==`loading`?this.delegate.loadingStyleChanged():e==`src`?this.delegate.sourceURLChanged():e==`disabled`&&this.delegate.disabledChanged()}get src(){return this.getAttribute(`src`)}set src(e){e?this.setAttribute(`src`,e):this.removeAttribute(`src`)}get refresh(){return this.getAttribute(`refresh`)}set refresh(e){e?this.setAttribute(`refresh`,e):this.removeAttribute(`refresh`)}get shouldReloadWithMorph(){return this.src&&this.refresh===`morph`}get loading(){return u(this.getAttribute(`loading`)||``)}set loading(e){e?this.setAttribute(`loading`,e):this.removeAttribute(`loading`)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get autoscroll(){return this.hasAttribute(`autoscroll`)}set autoscroll(e){e?this.setAttribute(`autoscroll`,``):this.removeAttribute(`autoscroll`)}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var e;return(e=this.ownerDocument)==null||(e=e.documentElement)==null?void 0:e.hasAttribute(`data-turbo-preview`)}};t(l,`delegateConstructor`,void 0);function u(e){switch(e.toLowerCase()){case`lazy`:return c.lazy;default:return c.eager}}var d={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`.split(`,`))};function f(e){if(e.getAttribute(`data-turbo-eval`)==`false`)return e;{let t=document.createElement(`script`),n=he();return n&&(t.nonce=n),t.textContent=e.textContent,t.async=!1,ee(t,e),t}}function ee(e,t){for(let{name:n,value:r}of t.attributes)e.setAttribute(n,r)}function te(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content}function p(e,{target:t,cancelable:n,detail:r}={}){let i=new CustomEvent(e,{cancelable:n,bubbles:!0,composed:!0,detail:r});return t&&t.isConnected?t.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function ne(e){e.preventDefault(),e.stopImmediatePropagation()}function m(){return document.visibilityState===`hidden`?ie():re()}function re(){return new Promise(e=>requestAnimationFrame(()=>e()))}function ie(){return new Promise(e=>setTimeout(()=>e(),0))}function ae(e=``){return new DOMParser().parseFromString(e,`text/html`)}function oe(e,...t){let n=se(e,t).replace(/^\n/,``).split(` 2`),r=n[0].match(/^\s+/),i=r?r[0].length:0;return n.map(e=>e.slice(i)).join(` 3`)}function se(e,t){return e.reduce((e,n,r)=>{let i=t[r]==null?``:t[r];return e+n+i},``)}function h(){return Array.from({length:36}).map((e,t)=>t==8||t==13||t==18||t==23?`-`:t==14?`4`:t==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*16).toString(16)).join(``)}function g(e,...t){for(let n of t.map(t=>t==null?void 0:t.getAttribute(e)))if(typeof n==`string`)return n;return null}function ce(e,...t){return t.some(t=>t&&t.hasAttribute(e))}function _(...e){for(let t of e)t.localName==`turbo-frame`&&t.setAttribute(`busy`,``),t.setAttribute(`aria-busy`,`true`)}function le(...e){for(let t of e)t.localName==`turbo-frame`&&t.removeAttribute(`busy`),t.removeAttribute(`aria-busy`)}function ue(e,t=2e3){return new Promise(n=>{let r=()=>{e.removeEventListener(`error`,r),e.removeEventListener(`load`,r),n()};e.addEventListener(`load`,r,{once:!0}),e.addEventListener(`error`,r,{once:!0}),setTimeout(n,t)})}function de(e){switch(e){case`replace`:return history.replaceState;case`advance`:case`restore`:return history.pushState}}function fe(e){return e==`advance`||e==`replace`||e==`restore`}function v(...e){let t=g(`data-turbo-action`,...e);return fe(t)?t:null}function pe(e){return document.querySelector(`meta[name="${e}"]`)}function me(e){let t=pe(e);return t&&t.content}function he(){let e=pe(`csp-nonce`);if(e){let{nonce:t,content:n}=e;return t==``?n:t}}function ge(e,t){let n=pe(e);return n||(n=document.createElement(`meta`),n.setAttribute(`name`,e),document.head.appendChild(n)),n.setAttribute(`content`,t),n}function y(e,t){if(e instanceof Element){var n;return e.closest(t)||y(e.assignedSlot||((n=e.getRootNode())==null?void 0:n.host),t)}}function _e(e){return!!e&&e.closest(`[inert], :disabled, [hidden], details:not([open]), dialog:not([open])`)==null&&typeof e.focus==`function`}function ve(e){return Array.from(e.querySelectorAll(`[autofocus]`)).find(_e)}async function ye(e,t){let n=t();return e(),await re(),[n,t()]}function be(e){if(e===`_blank`)return!1;if(e){for(let t of document.getElementsByName(e))if(t instanceof HTMLIFrameElement)return!1;return!0}return!0}function xe(e){let t=y(e,`a[href], a[xlink\\:href]`);if(!t||t.href.startsWith(`#`)||t.hasAttribute(`download`))return null;let n=t.getAttribute(`target`);return n&&n!==`_self`?null:t}function Se(e,t){let n=null;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}var Ce={"aria-disabled":{beforeSubmit:e=>{e.setAttribute(`aria-disabled`,`true`),e.addEventListener(`click`,ne)},afterSubmit:e=>{e.removeAttribute(`aria-disabled`),e.removeEventListener(`click`,ne)}},disabled:{beforeSubmit:e=>e.disabled=!0,afterSubmit:e=>e.disabled=!1}},we=new WeakMap,b={drive:d,forms:new class{constructor(e){a(this,we,null),Object.assign(this,e)}get submitter(){return r(we,this)}set submitter(e){o(we,this,Ce[e]||e)}}({mode:`on`,submitter:`disabled`})};function x(e){return new URL(e.toString(),document.baseURI)}function S(e){let t;if(e.hash)return e.hash.slice(1);if(t=e.href.match(/#(.*)$/))return t[1]}function Te(e,t){return x((t==null?void 0:t.getAttribute(`formaction`))||e.getAttribute(`action`)||e.action)}function Ee(e){return(Ne(e).match(/\.[^.]*$/)||[])[0]||``}function De(e,t){let n=Pe(t.origin+t.pathname);return Pe(e.href)===n||e.href.startsWith(n)}function C(e,t){return De(e,t)&&!b.drive.unvisitableExtensions.has(Ee(e))}function Oe(e){return x(e.getAttribute(`href`)||``)}function ke(e){let t=S(e);return t==null?e.href:e.href.slice(0,-(t.length+1))}function Ae(e){return ke(e)}function je(e,t){return x(e).href==x(t).href}function Me(e){return e.pathname.split(`/`).slice(1)}function Ne(e){return Me(e).slice(-1)[0]}function Pe(e){return e.endsWith(`/`)?e:e+`/`}var Fe=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return x(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)}},Ie=new class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let e=this.values().next().value;this.delete(e)}super.add(e)}}(20);function Le(e,t={}){let n=new Headers(t.headers||{}),r=h();return Ie.add(r),n.append(`X-Turbo-Request-Id`,r),window.fetch(e,{...t,headers:n})}function Re(e){switch(e.toLowerCase()){case`get`:return w.get;case`post`:return w.post;case`put`:return w.put;case`patch`:return w.patch;case`delete`:return w.delete}}var w={get:`get`,post:`post`,put:`put`,patch:`patch`,delete:`delete`};function ze(e){switch(e.toLowerCase()){case T.multipart:return T.multipart;case T.plain:return T.plain;default:return T.urlEncoded}}var T={urlEncoded:`application/x-www-form-urlencoded`,multipart:`multipart/form-data`,plain:`text/plain`},Be=new WeakMap,Ve=new WeakSet,E=class{constructor(e,n,r,o=new URLSearchParams,s=null,c=T.urlEncoded){var l;i(this,Ve),t(this,`abortController`,new AbortController),a(this,Be,e=>{});let[u,d]=Ge(x(r),n,o,c);this.delegate=e,this.url=u,this.target=s,this.fetchOptions={credentials:`same-origin`,redirect:`follow`,method:n.toUpperCase(),headers:{...this.defaultHeaders}
3,body:d,signal:this.abortSignal,referrer:(l=this.delegate.referrer)==null?void 0:l.href},this.enctype=c}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,n=Re(e)||w.get;this.url.search=``;let[r,i]=Ge(this.url,n,t,this.enctype);this.url=r,this.fetchOptions.body=i,this.fetchOptions.method=n.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(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await n(Ve,this,He).call(this,e);try{this.delegate.requestStarted(this),this.response=t.detail.fetchRequest?t.detail.fetchRequest.response:Le(this.url.href,e);let n=await this.response;return await this.receive(n)}catch(e){if(e.name!==`AbortError`)throw n(Ve,this,Ue).call(this,e)&&this.delegate.requestErrored(this,e),e}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new Fe(e);return p(`turbo:before-fetch-response`,{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:`text/html, application/xhtml+xml`}}get isSafe(){return We(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(`, `)}};async function He(e){let t=new Promise(e=>o(Be,this,e)),n=p(`turbo:before-fetch-request`,{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:r(Be,this)},target:this.target});return this.url=n.detail.url,n.defaultPrevented&&await t,n}function Ue(e){return!p(`turbo:fetch-request-error`,{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}function We(e){return Re(e)==w.get}function Ge(e,t,n,r){let i=Array.from(n).length>0?new URLSearchParams(Ke(n)):e.searchParams;return We(t)?[qe(e,i),null]:r==T.urlEncoded?[e,i]:[e,n]}function Ke(e){let t=[];for(let[n,r]of e)if(r instanceof File)continue;else t.push([n,r]);return t}function qe(e,t){return e.search=new URLSearchParams(Ke(t)).toString(),e}var Je=class{constructor(e,n){t(this,`started`,!1),t(this,`intersect`,e=>{let t=e.slice(-1)[0];t!=null&&t.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}),this.delegate=e,this.element=n,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))}},D=class{static wrap(e){return typeof e==`string`?new this(te(e)):e}constructor(e){this.fragment=Ye(e)}};t(D,`contentType`,`text/vnd.turbo-stream.html`);function Ye(e){for(let t of e.querySelectorAll(`turbo-stream`)){let e=document.importNode(t,!0);for(let t of e.templateElement.content.querySelectorAll(`script`))t.replaceWith(f(t));t.replaceWith(e)}return e}var Xe=e=>e,O=new WeakMap,Ze=class{constructor(e,n=Xe){t(this,`keys`,[]),t(this,`entries`,{}),a(this,O,void 0),this.size=e,o(O,this,n)}has(e){return r(O,this).call(this,e)in this.entries}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){for(let e of Object.keys(this.entries))this.evict(e)}read(e){return this.entries[r(O,this).call(this,e)]}write(e,t){this.entries[r(O,this).call(this,e)]=t}touch(e){e=r(O,this).call(this,e);let t=this.keys.indexOf(e);t>-1&&this.keys.splice(t,1),this.keys.unshift(e),this.trim()}trim(){for(let e of this.keys.splice(this.size))this.evict(e)}evict(e){delete this.entries[e]}},Qe=100,k=new WeakMap,A=new WeakMap,$e=class extends Ze{constructor(e=1,t=Qe){super(e,Ae),a(this,k,null),a(this,A,{}),this.prefetchDelay=t}putLater(e,t,n){o(k,this,setTimeout(()=>{t.perform(),this.put(e,t,n),o(k,this,null)},this.prefetchDelay))}put(e,t,n=et){super.put(e,t),r(A,this)[Ae(e)]=new Date(new Date().getTime()+n)}clear(){super.clear(),r(k,this)&&clearTimeout(r(k,this))}evict(e){super.evict(e),delete r(A,this)[e]}has(e){if(super.has(e)){let t=r(A,this)[Ae(e)];return t&&t>Date.now()}return!1}},et=1e4,j=new $e,M={initialized:`initialized`,requesting:`requesting`,waiting:`waiting`,receiving:`receiving`,stopping:`stopping`,stopped:`stopped`},tt=class e{static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,n,r,i=!1){t(this,`state`,M.initialized);let a=st(n,r),o=ot(at(n,r),a),s=nt(n,r),c=ct(n,r);this.delegate=e,this.formElement=n,this.submitter=r,this.fetchRequest=new E(this,a,o,s,n,c),this.mustRedirect=i}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=x(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:t,requesting:n}=M,r=g(`data-turbo-confirm`,this.submitter,this.formElement);if((typeof r!=`string`||await(typeof b.forms.confirm==`function`?b.forms.confirm:e.confirmMethod)(r,this.formElement,this.submitter))&&this.state==t)return this.state=n,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=M;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=rt(me(`csrf-param`))||me(`csrf-token`);t&&(e.headers[`X-CSRF-Token`]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(D.contentType)}requestStarted(e){this.state=M.waiting,this.submitter&&b.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),_(this.formElement),p(`turbo:submit-start`,{target:this.formElement,detail
3:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){j.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(j.clear(),this.requestMustRedirect(e)&&it(t)){let e=Error(`Form responses must redirect to another location`);this.delegate.formSubmissionErrored(this,e)}else this.state=M.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=M.stopped,this.submitter&&b.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),le(this.formElement),p(`turbo:submit-end`,{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(this.submitter&&this.submitsWith){if(this.submitter.matches(`button`))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches(`input`)){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(this.submitter&&this.originalSubmitText){if(this.submitter.matches(`button`))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches(`input`)){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||ce(`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 nt(e,t){let n=new FormData(e),r=t==null?void 0:t.getAttribute(`name`),i=t==null?void 0:t.getAttribute(`value`);return r&&n.append(r,i||``),n}function rt(e){if(e!=null){let t=(document.cookie?document.cookie.split(`; `):[]).find(t=>t.startsWith(e));if(t){let e=t.split(`=`).slice(1).join(`=`);return e?decodeURIComponent(e):void 0}}}function it(e){return e.statusCode==200&&!e.redirected}function at(e,t){let n=typeof e.action==`string`?e.action:null;return t!=null&&t.hasAttribute(`formaction`)?t.getAttribute(`formaction`)||``:e.getAttribute(`action`)||n||``}function ot(e,t){let n=x(e);return We(t)&&(n.search=``),n}function st(e,t){return Re(((t==null?void 0:t.getAttribute(`formmethod`))||e.getAttribute(`method`)||``).toLowerCase())||w.get}function ct(e,t){return ze((t==null?void 0:t.getAttribute(`formenctype`))||e.enctype)}var N=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return ve(this.element)}get permanentElements(){return ut(this.element)}getPermanentElementById(e){return lt(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let n of this.permanentElements){let{id:r}=n,i=e.getPermanentElementById(r);i&&(t[r]=[n,i])}return t}};function lt(e,t){return e.querySelector(`#${t}[data-turbo-permanent]`)}function ut(e){return e.querySelectorAll(`[id][data-turbo-permanent]`)}var dt=class{constructor(e,n){t(this,`started`,!1),t(this,`submitCaptured`,()=>{this.eventTarget.removeEventListener(`submit`,this.submitBubbled,!1),this.eventTarget.addEventListener(`submit`,this.submitBubbled,!1)}),t(this,`submitBubbled`,e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,n=e.submitter||void 0;t&&ft(t,n)&&pt(t,n)&&this.delegate.willSubmitForm(t,n)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,n))}}),this.delegate=e,this.eventTarget=n}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 ft(e,t){return((t==null?void 0:t.getAttribute(`formmethod`))||e.getAttribute(`method`))!=`dialog`}function pt(e,t){return be((t==null?void 0:t.getAttribute(`formtarget`))||e.getAttribute(`target`))}var mt=new WeakMap,ht=new WeakMap,gt=class{constructor(e,t){a(this,mt,e=>{}),a(this,ht,e=>{}),this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.focusElement(t),this.scrollToElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(S(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}
3async render(e){let{isPreview:t,shouldRender:n,willRender:i,newSnapshot:a}=e,s=i;if(n)try{this.renderPromise=new Promise(e=>o(mt,this,e)),this.renderer=e,await this.prepareToRenderSnapshot(e);let n=new Promise(e=>o(ht,this,e)),i={resume:r(ht,this),render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(a,i)||await n,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(a,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,r(mt,this).call(this,void 0),delete this.renderPromise}else s&&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()}},_t=class extends gt{missing(){this.element.innerHTML=`<strong class="turbo-frame-error">Content missing</strong>`}get snapshot(){return new N(this.element)}},vt=class{constructor(e,n){t(this,`clickBubbled`,e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent}),t(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}),t(this,`willVisit`,e=>{delete this.clickEvent}),this.delegate=e,this.element=n}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 t;let n=e.composed?(t=e.target)==null?void 0:t.parentElement:e.target,r=xe(n)||n;return r instanceof Element&&r.closest(`turbo-frame, html`)==this.element}},yt=class{constructor(e,n){t(this,`started`,!1),t(this,`clickCaptured`,()=>{this.eventTarget.removeEventListener(`click`,this.clickBubbled,!1),this.eventTarget.addEventListener(`click`,this.clickBubbled,!1)}),t(this,`clickBubbled`,e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=xe(e.composedPath&&e.composedPath()[0]||e.target);if(t&&be(t.target)){let n=Oe(t);this.delegate.willFollowLinkToLocation(t,n,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(t,n))}}}),this.delegate=e,this.eventTarget=n}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)}},bt=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new yt(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,n){return this.delegate.willSubmitFormLinkToLocation(e,t,n)&&(e.hasAttribute(`data-turbo-method`)||e.hasAttribute(`data-turbo-stream`))}followedLinkToLocation(e,t){let n=document.createElement(`form`);for(let[e,r]of t.searchParams)n.append(Object.assign(document.createElement(`input`),{type:`hidden`,name:e,value:r}));let r=Object.assign(t,{search:``});n.setAttribute(`data-turbo`,`true`),n.setAttribute(`action`,r.href),n.setAttribute(`hidden`,``);let i=e.getAttribute(`data-turbo-method`);i&&n.setAttribute(`method`,i);let a=e.getAttribute(`data-turbo-frame`);a&&n.setAttribute(`data-turbo-frame`,a);let o=v(e);o&&n.setAttribute(`data-turbo-action`,o);let s=e.getAttribute(`data-turbo-confirm`);s&&n.setAttribute(`data-turbo-confirm`,s),e.hasAttribute(`data-turbo-stream`)&&n.setAttribute(`data-turbo-stream`,``),this.delegate.submittedFormLinkToLocation(e,t,n),document.body.appendChild(n),n.addEventListener(`turbo:submit-end`,()=>n.remove(),{once:!0}),requestAnimationFrame(()=>n.requestSubmit())}}
3,xt=class{static async preservingPermanentElements(e,t,n){let r=new this(e,t);r.enter(),await n(),r.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,n]=this.permanentElementMap[e];this.delegate.enteringBardo(t,n),this.replaceNewPermanentElementWithPlaceholder(n)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=St(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){let 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 St(e){let t=document.createElement(`meta`);return t.setAttribute(`name`,`turbo-permanent-placeholder`),t.setAttribute(`content`,e.id),t}var P=new WeakMap,Ct=class{static renderElement(e,t){}constructor(e,t,n,r=!0){a(this,P,null),this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=n,this.willRender=r,this.renderElement=this.constructor.renderElement,this.promise=new Promise((e,t)=>this.resolvingFunctions={resolve:e,reject: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){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){r(P,this)||e.contains(this.currentSnapshot.activeElement)&&o(P,this,this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(r(P,this))&&r(P,this)instanceof HTMLElement&&(r(P,this).focus(),o(P,this,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`}},F=class extends Ct{static renderElement(e,t){var n;let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let i=t,a=(n=i.ownerDocument)==null?void 0:n.createRange();a&&(a.selectNodeContents(i),e.appendChild(a.extractContents()))}constructor(e,t,n,r,i,a=!0){super(t,n,r,i,a),this.delegate=e}get shouldRender(){return!0}async render(){await m(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await m(),this.focusFirstAutofocusableElement(),await m(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=wt(this.currentElement.getAttribute(`data-autoscroll-block`),`end`),n=Tt(this.currentElement.getAttribute(`data-autoscroll-behavior`),`auto`);if(e)return e.scrollIntoView({block:t,behavior:n}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=f(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll(`script`)}};function wt(e,t){return e==`end`||e==`start`||e==`center`||e==`nearest`?e:t}function Tt(e,t){return e==`auto`||e==`smooth`?e:t}var Et=(function(){let e=()=>{},t={morphStyle:`outerHTML`,callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:`merge`,shouldPreserve:e=>e.getAttribute(`im-preserve`)===`true`,shouldReAppend:e=>e.getAttribute(`im-re-append`)===`true`,shouldRemove:e,afterHeadMorphed:e},restoreFocus:!0};function n(e,t,n={}){e=u(e);
3let o=d(t),c=l(e,o,n),f=i(c,()=>s(c,e,o,t=>t.morphStyle===`innerHTML`?(a(t,e,o),Array.from(e.childNodes)):r(t,e,o)));return c.pantry.remove(),f}function r(e,t,n){let r=d(t);return a(e,r,n,t,t.nextSibling),Array.from(r.childNodes)}function i(e,t){var n;if(!e.config.restoreFocus)return t();let r=document.activeElement;if(!(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement))return t();let{id:i,selectionStart:a,selectionEnd:o}=r,s=t();return i&&i!==((n=document.activeElement)==null?void 0:n.getAttribute(`id`))&&(r=e.target.querySelector(`[id="${i}"]`),r==null||r.focus()),r&&!r.selectionEnd&&o&&r.setSelectionRange(a,o),s}let a=(function(){function e(e,s,c,l=null,u=null){s instanceof HTMLTemplateElement&&c instanceof HTMLTemplateElement&&(s=s.content,c=c.content),l||(l=s.firstChild);for(let r of c.childNodes){if(l&&l!=u){let t=n(e,r,l,u);if(t){t!==l&&i(e,l,t),o(t,r,e),l=t.nextSibling;continue}}if(r instanceof Element){let t=r.getAttribute(`id`);if(e.persistentIds.has(t)){let n=a(s,t,l,e);o(n,r,e),l=n.nextSibling;continue}}let c=t(s,r,l,e);c&&(l=c.nextSibling)}for(;l&&l!=u;){let t=l;l=l.nextSibling,r(e,t)}}function t(e,t,n,r){if(r.callbacks.beforeNodeAdded(t)===!1)return null;if(r.idMap.has(t)){let i=document.createElement(t.tagName);return e.insertBefore(i,n),o(i,t,r),r.callbacks.afterNodeAdded(i),i}{let i=document.importNode(t,!0);return e.insertBefore(i,n),r.callbacks.afterNodeAdded(i),i}}let n=(function(){function e(e,r,i,a){let o=null,s=r.nextSibling,c=0,l=i;for(;l&&l!=a;){if(n(l,r)){if(t(e,l,r))return l;o===null&&(e.idMap.has(l)||(o=l))}if(o===null&&s&&n(l,s)&&(c++,s=s.nextSibling,c>=2&&(o=void 0)),e.activeElementAndParents.includes(l))break;l=l.nextSibling}return o||null}function t(e,t,n){let r=e.idMap.get(t),i=e.idMap.get(n);if(!i||!r)return!1;for(let e of r)if(i.has(e))return!0;return!1}function n(e,t){var n,r,i;let a=e,o=t;return a.nodeType===o.nodeType&&a.tagName===o.tagName&&(!((n=a.getAttribute)!=null&&n.call(a,`id`))||((r=a.getAttribute)==null?void 0:r.call(a,`id`))===((i=o.getAttribute)==null?void 0:i.call(o,`id`)))}return e})();function r(e,t){if(e.idMap.has(t))c(e.pantry,t,null);else{var n;if(e.callbacks.beforeNodeRemoved(t)===!1)return;(n=t.parentNode)==null||n.removeChild(t),e.callbacks.afterNodeRemoved(t)}}function i(e,t,n){let i=t;for(;i&&i!==n;){let t=i;i=i.nextSibling,r(e,t)}return i}function a(e,t,n,r){var i,a;let o=((i=(a=r.target).getAttribute)==null?void 0:i.call(a,`id`))===t&&r.target||r.target.querySelector(`[id="${t}"]`)||r.pantry.querySelector(`[id="${t}"]`);return s(o,r),c(e,o,n),o}function s(e,t){let n=e.getAttribute(`id`);for(;e=e.parentNode;){let r=t.idMap.get(e);r&&(r.delete(n),r.size||t.idMap.delete(e))}}function c(e,t,n){if(e.moveBefore)try{e.moveBefore(t,n)}catch{e.insertBefore(t,n)}else e.insertBefore(t,n)}return e})(),o=(function(){function e(e,n,r){return r.ignoreActive&&e===document.activeElement?null:r.callbacks.beforeNodeMorphed(e,n)===!1?e:(e instanceof HTMLHeadElement&&r.head.ignore||(e instanceof HTMLHeadElement&&r.head.style!==`morph`?c(e,n,r):(t(e,n,r),o(e,r)||a(r,e,n))),r.callbacks.afterNodeMorphed(e,n),e)}function t(e,t,r){let a=t.nodeType;if(a===1){let a=e,s=t,c=a.attributes,l=s.attributes;for(let e of l)i(e.name,a,`update`,r)||a.getAttribute(e.name)!==e.value&&a.setAttribute(e.name,e.value);for(let e=c.length-1;0<=e;e--){let t=c[e];if(t&&!s.hasAttribute(t.name)){if(i(t.name,a,`remove`,r))continue;a.removeAttribute(t.name)}}o(a,r)||n(a,s,r)}(a===8||a===3)&&e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue)}function n(e,t,n){if(e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&t.type!==`file`){let a=t.value,o=e.value;r(e,t,`checked`,n),r(e,t,`disabled`,n),t.hasAttribute(`value`)?o!==a&&(i(`value`,e,`update`,n)||(e.setAttribute(`value`,a),e.value=a)):i(`value`,e,`remove`,n)||(e.value=``,e.removeAttribute(`value`))}else if(e instanceof HTMLOptionElement&&t instanceof HTMLOptionElement)r(e,t,`selected`,n);else if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){let r=t.value,a=e.value;if(i(`value`,e,`update`,n))return;r!==a&&(e.value=r),e.firstChild&&e.firstChild.nodeValue!==r&&(e.firstChild.nodeValue=r)}}function r(e,t,n,r){let a=t[n];if(a!==e[n]){let o=i(n,e,`update`,r);o||(e[n]=t[n]),a?o||e.setAttribute(n,``):i(n,e,`remove`,r)||e.removeAttribute(n)}}function i(e,t,n,r){return e===`value`&&r.ignoreActiveValue&&t===document.activeElement?!0:r.callbacks.beforeAttributeUpdated(e,t,n)===!1}function o(e,t){return!!t.ignoreActiveValue&&e===document.activeElement&&e!==document.body}return e})();function s(e,t,n,r){if(e.head.block){let i=t.querySelector(`head`),a=n.querySelector(`head`);if(i&&a){let t=c(i,a,e);return Promise.all(t).then(()=>r(Object.assign(e,{head:{block:!1,ignore:!0}})))}}return r(e)}
3function c(e,t,n){let r=[],i=[],a=[],o=[],s=new Map;for(let e of t.children)s.set(e.outerHTML,e);for(let t of e.children){let e=s.has(t.outerHTML),r=n.head.shouldReAppend(t),c=n.head.shouldPreserve(t);e||c?r?i.push(t):(s.delete(t.outerHTML),a.push(t)):n.head.style===`append`?r&&(i.push(t),o.push(t)):n.head.shouldRemove(t)!==!1&&i.push(t)}o.push(...s.values());let c=[];for(let t of o){let i=document.createRange().createContextualFragment(t.outerHTML).firstChild;if(n.callbacks.beforeNodeAdded(i)!==!1){if(`href`in i&&i.href||`src`in i&&i.src){let e,t=new Promise(function(t){e=t});i.addEventListener(`load`,function(){e()}),c.push(t)}e.appendChild(i),n.callbacks.afterNodeAdded(i),r.push(i)}}for(let t of i)n.callbacks.beforeNodeRemoved(t)!==!1&&(e.removeChild(t),n.callbacks.afterNodeRemoved(t));return n.head.afterHeadMorphed(e,{added:r,kept:a,removed:i}),c}let l=(function(){function e(e,t,a){let{persistentIds:o,idMap:c}=s(e,t),l=n(a),u=l.morphStyle||`outerHTML`;if(![`innerHTML`,`outerHTML`].includes(u))throw`Do not understand how to morph style ${u}`;return{target:e,newContent:t,config:l,morphStyle:u,ignoreActive:l.ignoreActive,ignoreActiveValue:l.ignoreActiveValue,restoreFocus:l.restoreFocus,idMap:c,persistentIds:o,pantry:r(),activeElementAndParents:i(e),callbacks:l.callbacks,head:l.head}}function n(e){let n=Object.assign({},t);return Object.assign(n,e),n.callbacks=Object.assign({},t.callbacks,e.callbacks),n.head=Object.assign({},t.head,e.head),n}function r(){let e=document.createElement(`div`);return e.hidden=!0,document.body.insertAdjacentElement(`afterend`,e),e}function i(e){let t=[],n=document.activeElement;if((n==null?void 0:n.tagName)!==`BODY`&&e.contains(n))for(;n&&(t.push(n),n!==e);)n=n.parentElement;return t}function a(e){var t;let n=Array.from(e.querySelectorAll(`[id]`));return(t=e.getAttribute)!=null&&t.call(e,`id`)&&n.push(e),n}function o(e,t,n,r){for(let i of r){let r=i.getAttribute(`id`);if(t.has(r)){let t=i;for(;t;){let i=e.get(t);if(i==null&&(i=new Set,e.set(t,i)),i.add(r),t===n)break;t=t.parentElement}}}}function s(e,t){let n=a(e),r=a(t),i=c(n,r),s=new Map;return o(s,i,e,n),o(s,i,t.__idiomorphRoot||t,r),{persistentIds:i,idMap:s}}function c(e,t){let n=new Set,r=new Map;for(let{id:t,tagName:i}of e)r.has(t)?n.add(t):r.set(t,i);let i=new Set;for(let{id:e,tagName:a}of t)i.has(e)?n.add(e):r.get(e)===a&&i.add(e);for(let e of n)i.delete(e);return i}return e})(),{normalizeElement:u,normalizeParent:d}=(function(){let e=new WeakSet;function t(e){return e instanceof Document?e.documentElement:e}function n(t){if(t==null)return document.createElement(`div`);if(typeof t==`string`)return n(i(t));if(e.has(t))return t;if(t instanceof Node){if(t.parentNode)return new r(t);{let e=document.createElement(`div`);return e.append(t),e}}{let e=document.createElement(`div`);for(let n of[...t])e.append(n);return e}}class r{constructor(e){this.originalNode=e,this.realParentNode=e.parentNode,this.previousSibling=e.previousSibling,this.nextSibling=e.nextSibling}get childNodes(){let e=[],t=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;t&&t!=this.nextSibling;)e.push(t),t=t.nextSibling;return e}querySelectorAll(e){return this.childNodes.reduce((t,n)=>{if(n instanceof Element){n.matches(e)&&t.push(n);let r=n.querySelectorAll(e);for(let e=0;e<r.length;e++)t.push(r[e])}return t},[])}insertBefore(e,t){return this.realParentNode.insertBefore(e,t)}moveBefore(e,t){return this.realParentNode.moveBefore(e,t)}get __idiomorphRoot(){return this.originalNode}}function i(t){let n=new DOMParser,r=t.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,``);if(r.match(/<\/html>/)||r.match(/<\/head>/)||r.match(/<\/body>/)){let i=n.parseFromString(t,`text/html`);if(r.match(/<\/html>/))return e.add(i),i;{let t=i.firstChild;return t&&e.add(t),t}}{let r=n.parseFromString(`<body><template>`+t+`</template></body>`,`text/html`).body.querySelector(`template`).content;return e.add(r),r}}return{normalizeElement:t,normalizeParent:n}})();return{morph:n,defaults:t}})();function I(e,t,{callbacks:n,...r}={}){Et.morph(e,t,{...r,callbacks:new jt(n)})}function L(e,t,n={}){I(e,t.childNodes,{...n,morphStyle:`innerHTML`})}function Dt(e,t){return e instanceof l&&e.shouldReloadWithMorph&&(!t||Ot(e,t))&&!e.closest(`[data-turbo-permanent]`)}function Ot(e,t){return t instanceof Element&&t.nodeName===`TURBO-FRAME`&&e.id===t.id&&(!t.getAttribute(`src`)||je(e.src,t.getAttribute(`src`)))}function kt(e){return e.parentElement.closest(`turbo-frame[src][refresh=morph]`)}var At=new WeakMap,jt=class{constructor({beforeNodeMorphed:e}={}){a(this,At,void 0),t(this,`beforeNodeAdded`,e=>!(e.id&&e.hasAttribute(`data-turbo-permanent`)&&document.getElementById(e.id))),t(this,`beforeNodeMorphed`,(e,t)=>{if(e instanceof Element)return!e.hasAttribute(`data-turbo-permanent`)&&r(At,this).call(this,e,t)?!p(`turbo:before-morph-element`,{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1}),t(this,`beforeAttributeUpdated`,(e,t,n)=>!p(`turbo:before-morph-attribute`,{cancelable:!0,target:t,detail
3:{attributeName:e,mutationType:n}}).defaultPrevented),t(this,`beforeNodeRemoved`,e=>this.beforeNodeMorphed(e)),t(this,`afterNodeMorphed`,(e,t)=>{e instanceof Element&&p(`turbo:morph-element`,{target:e,detail:{currentElement:e,newElement:t}})}),o(At,this,e||(()=>!0))}},Mt=class extends F{static renderElement(e,t){p(`turbo:before-frame-morph`,{target:e,detail:{currentElement:e,newElement:t}}),L(e,t,{callbacks:{beforeNodeMorphed:(t,n)=>Dt(t,n)&&kt(t)===e?(t.reload(),!1):!0}})}async preservingPermanentElements(e){return await e()}},Nt=class e{static get defaultCSS(){return oe` 4 .turbo-progress-bar { 5 position: fixed; 6 display: block; 7 top: 0; 8 left: 0; 9 height: 3px; 10 background: #0076ff; 11 z-index: 2147483647; 12 transition: 13 width ${e.animationDuration}ms ease-out, 14 opacity ${e.animationDuration/2}ms ${e.animationDuration/2}ms ease-in; 15 transform: translate3d(0, 0, 0); 16 } 17 `}constructor(){t(this,`hiding`,!1),t(this,`value`,0),t(this,`visible`,!1),t(this,`trickle`,()=>{this.setValue(this.value+Math.random()/100)}),this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width=`0`,this.progressElement.style.opacity=`1`,document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(t){this.progressElement.style.opacity=`0`,setTimeout(t,e.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,e.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let t=document.createElement(`style`);t.type=`text/css`,t.textContent=e.defaultCSS;let n=he();return n&&(t.nonce=n),t}createProgressElement(){let e=document.createElement(`div`);return e.className=`turbo-progress-bar`,e}};t(Nt,`animationDuration`,300);var Pt=class extends N{constructor(...e){super(...e),t(this,`detailsByOuterHTML`,this.children.filter(e=>!Rt(e)).map(e=>Vt(e)).reduce((e,t)=>{let{outerHTML:n}=t,r=n in e?e[n]:{type:Ft(t),tracked:It(t),elements:[]};return{...e,[n]:{...r,elements:[...r.elements,t]}}},{}))}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join(``)}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot(`script`,e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot(`stylesheet`,e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(e=>!(e in t.detailsByOuterHTML)).map(e=>this.detailsByOuterHTML[e]).filter(({type:t})=>t==e).map(({elements:[e]})=>e)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:n,tracked:r,elements:i}=this.detailsByOuterHTML[t];return n==null&&!r?[...e,...i]:i.length>1?[...e,...i.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute(`content`):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,n)=>{let{elements:[r]}=this.detailsByOuterHTML[n];return Bt(r,e)?r:t},0)}};function Ft(e){if(Lt(e))return`script`;if(zt(e))return`stylesheet`}function It(e){return e.getAttribute(`data-turbo-track`)==`reload`}function Lt(e){return e.localName==`script`}function Rt(e){return e.localName==`noscript`}function zt(e){let t=e.localName;return t==`style`||t==`link`&&e.getAttribute(`rel`)==`stylesheet`}function Bt(e,t){return e.localName==`meta`&&e.getAttribute(`name`)==t}function Vt(e){return e.hasAttribute(`nonce`)&&e.setAttribute(`nonce`,``),e}var R=class e extends N{static fromHTMLString(e=``){return this.fromDocument(ae(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:n}){return new this(e,t,new Pt(n))}constructor(e,t,n){super(t),this.documentElement=e,this.headSnapshot=n}clone(){let t=this.element.cloneNode(!0),n=this.element.querySelectorAll(`select`),r=t.querySelectorAll(`select`);for(let[e,t]of n.entries()){let n=r[e];for(let e of n.selectedOptions)e.selected=!1;for(let e of t.selectedOptions)n.options[e.index].selected=!0}for(let e of t.querySelectorAll(`input[type="password"]`))e.value=``;for(let e of t.querySelectorAll(`noscript`))e.remove();return new e(this.documentElement,t,this.headSnapshot)}get lang(){return this.documentElement.getAttribute(`lang`)}get dir(){return this.documentElement.getAttribute(`dir`)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;return x((e=this.getSetting(`root`))==null?`/`:e)}
17get 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.getSetting(`view-transition`)===`true`||this.headSnapshot.getMetaValue(`view-transition`)===`same-origin`)&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}get refreshMethod(){return this.getSetting(`refresh-method`)}get refreshScroll(){return this.getSetting(`refresh-scroll`)}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Ht=new WeakMap,z=new WeakMap,Ut=class{constructor(){a(this,Ht,!1),a(this,z,Promise.resolve())}renderChange(e,t){return e&&this.viewTransitionsAvailable&&!r(Ht,this)?(o(Ht,this,!0),o(z,this,r(z,this).then(async()=>{await document.startViewTransition(t).finished}))):o(z,this,r(z,this).then(t)),r(z,this)}get viewTransitionsAvailable(){return document.startViewTransition}},Wt={action:`advance`,historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},B={visitStart:`visitStart`,requestStart:`requestStart`,requestEnd:`requestEnd`,visitEnd:`visitEnd`},V={initialized:`initialized`,started:`started`,canceled:`canceled`,failed:`failed`,completed:`completed`},H={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Gt={advance:`forward`,restore:`back`,replace:`none`},Kt=class{constructor(e,n,r,i={}){t(this,`identifier`,h()),t(this,`timingMetrics`,{}),t(this,`followedRedirect`,!1),t(this,`historyChanged`,!1),t(this,`scrolled`,!1),t(this,`shouldCacheSnapshot`,!0),t(this,`acceptsStreamResponse`,!1),t(this,`snapshotCached`,!1),t(this,`state`,V.initialized),t(this,`viewTransitioner`,new Ut),this.delegate=e,this.location=n,this.restorationIdentifier=r||h();let{action:a,historyChanged:o,referrer:s,snapshot:c,snapshotHTML:l,response:u,visitCachedSnapshot:d,willRender:f,updateHistory:ee,shouldCacheSnapshot:te,acceptsStreamResponse:p,direction:ne,refresh:m}={...Wt,...i};this.action=a,this.historyChanged=o,this.referrer=s,this.snapshot=c,this.snapshotHTML=l,this.response=u,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=d,this.willRender=f,this.updateHistory=ee,this.scrolled=!f,this.shouldCacheSnapshot=te,this.acceptsStreamResponse=p,this.direction=ne||Gt[a],this.refresh=m}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)}start(){this.state==V.initialized&&(this.recordTimingMetric(B.visitStart),this.state=V.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==V.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=V.canceled)}complete(){this.state==V.started&&(this.recordTimingMetric(B.visitEnd),this.adapter.visitCompleted(this),this.state=V.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==V.started&&(this.state=V.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){var e;let t=de(this.location.href===((e=this.referrer)==null?void 0:e.href)?`replace`:this.action);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new E(this,w.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(B.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;qt(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(B.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>
17{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,qt(e)&&t!=null){let e=R.fromHTMLString(t);await this.renderPageSnapshot(e,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(R.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!S(this.location)||e.hasAnchor(S(this.location)))&&(this.action==`restore`||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return R.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.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)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(D.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let n=await t.responseHTML,{redirected:r,statusCode:i}=t;n==null?this.recordResponse({statusCode:H.contentTypeMismatch,redirected:r}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:i,responseHTML:n,redirected:r}))}async requestFailedWithResponse(e,t){let n=await t.responseHTML,{redirected:r,statusCode:i}=t;n==null?this.recordResponse({statusCode:H.contentTypeMismatch,redirected:r}):this.recordResponse({statusCode:i,responseHTML:n,redirected:r})}requestErrored(e,t){this.recordResponse({statusCode:H.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.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=S(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.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(e=>{this.frame=document.visibilityState===`hidden`?setTimeout(()=>e(),0):requestAnimationFrame(()=>e())}),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 qt(e){return e>=200&&e<300}var Jt=class{constructor(e){t(this,`progressBar`,new Nt),t(this,`showProgressBar`,()=>{this.progressBar.show()}),this.session=e}visitProposedToLocation(e,t){C(e,this.navigator.rootLocation)?this.navigator.startVisit(e,(t==null?void 0:t.restorationIdentifier)||h(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!=`restore`?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case H.networkFailure:case H.timeoutFailure:case H.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}
17formSubmissionStarted(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;p(`turbo:reload`,{detail:e}),window.location.href=((t=this.redirectedToLocation||this.location)==null?void 0:t.toString())||window.location.href}get navigator(){return this.session.navigator}},Yt=class{constructor(){t(this,`selector`,`[data-turbo-temporary]`),t(this,`started`,!1),t(this,`removeTemporaryElements`,e=>{for(let e of this.temporaryElements)e.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)]}},U=new WeakSet,Xt=class{constructor(e,t){i(this,U),this.session=e,this.element=t,this.linkInterceptor=new vt(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 n(U,this,Qt).call(this,e)}linkClickIntercepted(e,t,r){let i=n(U,this,$t).call(this,e);i&&i.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest(`turbo-frame`)==null&&n(U,this,Zt).call(this,e,t)&&n(U,this,Qt).call(this,e,t)}formSubmitted(e,t){let r=n(U,this,$t).call(this,e,t);r&&r.delegate.formSubmitted(e,t)}};function Zt(e,t){var r;let i=Te(e,t),a=this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`),o=x((r=a==null?void 0:a.content)==null?`/`:r);return n(U,this,Qt).call(this,e,t)&&C(i,o)}function Qt(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let r=n(U,this,$t).call(this,e,t);return r?r!=e.closest(`turbo-frame`):!1}return!1}function $t(e,t){let n=(t==null?void 0:t.getAttribute(`data-turbo-frame`))||e.getAttribute(`data-turbo-frame`);if(n&&n!=`_top`){let e=this.element.querySelector(`#${n}:not([disabled])`);if(e instanceof l)return e}}var en=class{constructor(e){t(this,`location`,void 0),t(this,`restorationIdentifier`,h()),t(this,`restorationData`,{}),t(this,`started`,!1),t(this,`currentIndex`,0),t(this,`onPopState`,e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:e,restorationIndex:n}=t;this.restorationIdentifier=e;let r=n>this.currentIndex?`forward`:`back`;this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,e,r),this.currentIndex=n}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}),this.delegate=e}start(){if(!this.started){var e;addEventListener(`popstate`,this.onPopState,!1),this.currentIndex=((e=history.state)==null||(e=e.turbo)==null?void 0:e.restorationIndex)||0,this.started=!0,this.replace(new URL(window.location.href))}}stop(){this.started&&(removeEventListener(`popstate`,this.onPopState,!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,n=h()){e===history.pushState&&++this.currentIndex;let r={turbo:{restorationIdentifier:n,restorationIndex:this.currentIndex}};e.call(history,r,``,t.href),this.location=t,this.restorationIdentifier=n}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,n=this.restorationData[t];this.restorationData[t]={...n,...e}}assumeControlOfScrollRestoration(){if(!this.previousScrollRestoration){var e;this.previousScrollRestoration=(e=history.scrollRestoration)==null?`auto`:e,history.scrollRestoration=`manual`}}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}},tn=new WeakMap,nn=new WeakMap,rn=new WeakMap,an=new WeakMap,on=new WeakMap,sn=new WeakMap,cn=new WeakSet,ln=class{constructor(e,s){i(this,cn),t(this,`started`,!1),a(this,tn,null),a(this,nn,()=>{this.eventTarget.addEventListener(`mouseenter`,r(rn,this),{capture:!0,passive:!0}),this.eventTarget.addEventListener(`mouseleave`,r(an,this),{capture:!0,passive:!0}),this.eventTarget.addEventListener(`turbo:before-fetch-request`,r(sn,this),!0),this.started=!0}),a(this,rn,e=>{if(me(`turbo-prefetch`)===`false`)return;let t=e.target;if(t.matches&&t.matches(`a[href]:not([target^=_]):not([download])`)&&n(cn,this,dn).call(this,t)){let e=t,r=Oe(e);if(this.delegate.canPrefetchRequestToLocation(e,r)){o(tn,this,e);let i=new E(this,w.get,r,new URLSearchParams,t);i.fetchOptions.priority=`low`,j.putLater(r,i,un.call(n(cn,this)))}}}),a(this,an,e=>{e.target===r(tn,this)&&r(on,this).call(this)}),a(this,on,()=>{j.clear(),o(tn,this,null)}),a(this,sn,e=>{if(e.target.tagName!==`FORM`&&e.detail.fetchOptions.method===`GET`){let t=j.get(e.detail.url);t&&(e.detail.fetchRequest=t),j.clear()}}),this.delegate=e,this.eventTarget=s}start(){this.started||(this.eventTarget.readyState===`loading`?this.eventTarget.addEventListener(`DOMContentLoaded`,r(nn,this),{once:!0}):r(nn,this).call(this))}stop(){this.started&&(this.eventTarget.removeEventListener(`mouseenter`,r(rn,this),{capture:!0,passive:!0}),this.eventTarget.removeEventListener(`mouseleave`,r(an,this),{capture:!0,passive:!0}),this.eventTarget.removeEventListener(`turbo:before-fetch-request`,r(sn,this),!0),this.started=!1)}prepareRequest(e){let t=e.target;e.headers[`X-Sec-Purpose`]=`prefetch`;let n=t.closest(`turbo-frame`),r=t.getAttribute(`data-turbo-frame`)||(n==null?void 0:n.getAttribute(`target`))||(n==null?void 0:n.id);r&&r!==`_top`&&(e.headers[`Turbo-Frame`]=r)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}};function un(){return Number(me(`turbo-prefetch-cache-time`))||et}function dn(e){return!(!e.getAttribute(`href`)||fn(e)||pn(e)||mn(e)||hn(e)||_n(e))}var fn=e=>e.origin!==document.location.origin||![`http:`,`https:`].includes(e.protocol)||e.hasAttribute(`target`),pn=e=>e.pathname+e.search===document.location.pathname+document.location.search||e.href.startsWith(`#`),mn=e=>{if(e.getAttribute(`data-turbo-prefetch`)===`false`||e.getAttribute(`data-turbo`)===`false`)return!0;let t=y(e,`[data-turbo-prefetch]`);return!!(t&&t.getAttribute(`data-turbo-prefetch`)===`false`)},hn=e=>{let t=e.getAttribute(`data-turbo-method`);return!!(t&&t.toLowerCase()!==`get`||gn(e)||e.hasAttribute(`data-turbo-confirm`)||e.hasAttribute(`data-turbo-stream`))},gn=e=>e.hasAttribute(`data-remote`)||e.hasAttribute(`data-behavior`)||e.hasAttribute(`data-confirm`)||e.hasAttribute(`data-method`),_n=e=>p(`turbo:before-prefetch`,{target:e,cancelable:!0}).defaultPrevented,vn=new WeakSet,yn=class{constructor(e){i(this,vn),this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,n={}){this.stop(),this.currentVisit=new Kt(this,x(e),t,{referrer:this.location,...n}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new tt(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted==`function`&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let i=e.isSafe;i||this.view.clearSnapshotCache();let{statusCode:a,redirected:o}=t,s={action:n(vn,this,bn).call(this,e,t),shouldCacheSnapshot:i,response:{statusCode:a,responseHTML:r,redirected:o}};this.proposeVisit(t.location,s)}}}async formSubmissionFailedWithResponse(e,t){let n=await t.responseHTML;if(n){let e=R.fromHTMLString(n);t.serverError?await this.view.renderError(e,this.currentVisit):await this.view.renderPage(e,!1,!0,this.currentVisit),e.refreshScroll!==`preserve`&&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)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}};function bn(e,t){let{submitter:r,formElement:i}=e;return v(r,i)||n(vn,this,xn).call(this,t)}function xn(e){var t;return e.redirected&&e.location.href===((t=this.location)==null?void 0:t.href)?`replace`:`advance`}var W={initial:0,loading:1,interactive:2,complete:3},Sn=class{constructor(e){t(this,`stage`,W.initial),t(this,`started`,!1),t(this,`interpretReadyState`,()=>{let{readyState:e}=this;e==`interactive`?this.pageIsInteractive():e==`complete`&&this.pageIsComplete()}),t(this,`pageWillUnload`,()=>{this.delegate.pageWillUnload()}),this.delegate=e}start(){this.started||(this.stage==W.initial&&(this.stage=W.loading),document.addEventListener(`readystatechange`,this.interpretReadyState,!1),addEventListener(`pagehide`,this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener(`readystatechange`,this.interpretReadyState,!1),removeEventListener(`pagehide`,this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==W.loading&&(this.stage=W.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==W.interactive&&(this.stage=W.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},Cn=class{constructor(e){t(this,`started`,!1),t(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)}},wn=class{render({fragment:e}){xt.preservingPermanentElements(this,Tn(e),()=>{En(e,()=>{Dn(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Tn(e){let t=ut(document.documentElement),n={};for(let r of t){let{id:t}=r;for(let i of e.querySelectorAll(`turbo-stream`)){let e=lt(i.templateElement.content,t);e&&(n[t]=[r,e])}}return n}async function En(e,t){let n=`turbo-stream-autofocus-${h()}`,r=On(e.querySelectorAll(`turbo-stream`)),i=null;
17if(r&&(i=r.id?r.id:n,r.id=i),t(),await m(),(document.activeElement==null||document.activeElement==document.body)&&i){let e=document.getElementById(i);_e(e)&&e.focus(),e&&e.id==n&&e.removeAttribute(`id`)}}async function Dn(e){let[t,n]=await ye(e,()=>document.activeElement),r=t&&t.id;if(r){let e=document.getElementById(r);_e(e)&&e!=n&&e.focus()}}function On(e){for(let t of e){let e=ve(t.templateElement.content);if(e)return e}return null}var G=new WeakMap,kn=class{constructor(e){t(this,`sources`,new Set),a(this,G,!1),t(this,`inspectFetchResponse`,e=>{let t=An(e);t&&jn(t)&&(e.preventDefault(),this.receiveMessageResponse(t))}),t(this,`receiveMessageEvent`,e=>{r(G,this)&&typeof e.data==`string`&&this.receiveMessageHTML(e.data)}),this.delegate=e}start(){r(G,this)||(o(G,this,!0),addEventListener(`turbo:before-fetch-response`,this.inspectFetchResponse,!1))}stop(){r(G,this)&&(o(G,this,!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){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(D.wrap(e))}};function An(e){var t;let n=(t=e.detail)==null?void 0:t.fetchResponse;if(n instanceof Fe)return n}function jn(e){var t;return((t=e.contentType)==null?``:t).startsWith(D.contentType)}var Mn=class extends Ct{static renderElement(e,t){let{documentElement:n,body:r}=document;n.replaceChild(t,r)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let n=f(e);t.replaceChild(n,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll(`script`)}},Nn=new WeakSet,Pn=class extends Ct{constructor(...e){super(...e),i(this,Nn)}static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:`turbo_visit_control_is_reload`};if(!this.trackedElementsAreIdentical)return{reason:`tracked_element_mismatch`}}async prepareToRender(){n(Nn,this,Fn).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(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(ue(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(f(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[n,r]of t.entries()){if(e.tagName==`TITLE`){if(r.tagName!=`TITLE`)continue;if(e.innerHTML==r.innerHTML)return t.splice(n,1),!0}if(r.isEqualNode(e))return t.splice(n,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll(`noscript`))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=f(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute(`data-turbo-track`)===`dynamic`)}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll(`script`)}};function Fn(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:n}
17=this.newSnapshot;n?e.setAttribute(`lang`,n):e.removeAttribute(`lang`),t?e.setAttribute(`dir`,t):e.removeAttribute(`dir`)}var In=class extends Pn{static renderElement(e,t){I(e,t,{callbacks:{beforeNodeMorphed:(e,t)=>Dt(e,t)&&!kt(e)?(e.reload(),!1):!0}}),p(`turbo:morph`,{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return`morph`}get shouldAutofocus(){return!1}},Ln=class extends Ze{constructor(e){super(e,Ae)}get snapshots(){return this.entries}},Rn=class extends gt{constructor(...e){super(...e),t(this,`snapshotCache`,new Ln(10)),t(this,`lastRenderedLocation`,new URL(location.href)),t(this,`forceReloaded`,!1)}shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,n=!0,r){var i;let a=new(this.isPageRefresh(r)&&((r==null||(i=r.refresh)==null?void 0:i.method)||this.snapshot.refreshMethod)===`morph`?In:Pn)(this.snapshot,e,t,n);return a.shouldRender?r==null||r.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t==null||t.changeHistory();let n=new Mn(this.snapshot,e,!1);return this.render(n)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await ie();let n=e.clone();return this.snapshotCache.put(t,n),n}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action===`replace`}shouldPreserveScrollPosition(e){var t;return this.isPageRefresh(e)&&((e==null||(t=e.refresh)==null?void 0:t.scroll)||this.snapshot.refreshScroll)===`preserve`}get snapshot(){return R.fromElement(this.element)}},zn=new WeakMap,Bn=class{constructor(e,n){t(this,`selector`,`a[data-turbo-preload]`),a(this,zn,()=>{this.preloadOnLoadLinksForView(document.body)}),this.delegate=e,this.snapshotCache=n}start(){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,r(zn,this)):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener(`DOMContentLoaded`,r(zn,this))}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);this.snapshotCache.has(t)||await new E(this,w.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers[`X-Sec-Purpose`]=`prefetch`}async requestSucceededWithResponse(e,t){try{let n=await t.responseHTML,r=R.fromHTMLString(n);this.snapshotCache.put(e.url,r)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}},Vn=new WeakSet,Hn=class{constructor(e){i(this,Vn),this.session=e}clear(){this.session.clearCache()}resetCacheControl(){n(Vn,this,Un).call(this,``)}exemptPageFromCache(){n(Vn,this,Un).call(this,`no-cache`)}exemptPageFromPreview(){n(Vn,this,Un).call(this,`no-preview`)}};function Un(e){ge(`turbo-cache-control`,e)}var Wn=new WeakMap,Gn=class{constructor(e){t(this,`navigator`,new yn(this)),t(this,`history`,new en(this)),t(this,`view`,new Rn(this,document.documentElement)),t(this,`adapter`,new Jt(this)),t(this,`pageObserver`,new Sn(this)),t(this,`cacheObserver`,new Yt),t(this,`linkPrefetchObserver`,new ln(this,document)),t(this,`linkClickObserver`,new yt(this,window)),t(this,`formSubmitObserver`,new dt(this,document)),t(this,`scrollObserver`,new Cn(this)),t(this,`streamObserver`,new kn(this)),t(this,`formLinkClickObserver`,new bt(this,document.documentElement)),t(this,`frameRedirector`,new Xt(this,document.documentElement)),t(this,`streamMessageRenderer`,new wn),t(this,`cache`,new Hn(this)),t(this,`enabled`,!0),t(this,`started`,!1),a(this,Wn,150),this.recentRequests=e,this.preloader=new Bn(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let n=t.frame?document.getElementById(t.frame):null;if(n instanceof l){let r=t.action||v(n);n.delegate.proposeVisitIfNavigatedWithAction(n,r),n.src=e.toString()}else this.navigator.proposeVisit(x(e),t)}refresh(e,t={}){t=typeof t==`string`?{requestId:t}:t;let{method:n,requestId:r,scroll:i}=t,a=r&&this.recentRequests.has(r),o=e===document.baseURI;!a&&!this.navigator.currentVisit&&o&&this.visit(e,{action:`replace`,shouldCacheSnapshot:!1,refresh:{method:n,scroll:i}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(D.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){b.drive.progressBarDelay=e}get progressBarDelay(){return b.drive.progressBarDelay}set drive(e){b.drive.enabled=e}get drive(){return b.drive.enabled}set formMode(e){b.forms.mode=e}get formMode(){return b.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return r(Wn,this)}set pageRefreshDebouncePeriod(e){this.refresh=Se(this.debouncedRefresh.bind(this),e),o(Wn,this,e)}shouldPreloadLink(e){let t=e.hasAttribute(`data-turbo-method`),n=e.hasAttribute(`data-turbo-stream`),r=e.getAttribute(`data-turbo-frame`),i=r==`_top`?null:document.getElementById(r)||y(e,`turbo-frame:not([disabled])`);if(t||n||i instanceof l)return!1;{let t=new URL(e.href);return this.elementIsNavigatable(e)&&C(t,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,n){this.enabled?this.navigator.startVisit(e,t,{action:`restore`,historyChanged:!0,direction:n}):this.adapter.pageInvalidated({reason:`turbo_disabled`})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&C(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&C(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,n){return this.elementIsNavigatable(e)&&C(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,n)}followedLinkToLocation(e,t){let n=this.getActionForLink(e),r=e.hasAttribute(`data-turbo-stream`);this.visit(t.href,{action:n,acceptsStreamResponse:r})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Kn(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(_(document.documentElement),this.view.markVisitDirection(e.direction)),Kn(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),le(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let n=Te(e,t);return this.submissionIsNavigatable(e,t)&&C(x(n),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}
17pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let{defaultPrevented:n,detail:{render:r}}=this.notifyApplicationBeforeRender(e,t);return this.view.renderer&&r&&(this.view.renderer.renderElement=r),!n}viewRenderedSnapshot(e,t,n){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(n)}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,n){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,n).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,n){return p(`turbo:click`,{target:e,detail:{url:t.href,originalEvent:n},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return p(`turbo:before-visit`,{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return p(`turbo:visit`,{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return p(`turbo:before-cache`)}
17notifyApplicationBeforeRender(e,t){return p(`turbo:before-render`,{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return p(`turbo:render`,{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return p(`turbo:load`,{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return p(`turbo:frame-load`,{target:e})}notifyApplicationAfterFrameRender(e,t){return p(`turbo:frame-render`,{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(b.forms.mode==`off`)return!1;{let n=!t||this.elementIsNavigatable(t);return b.forms.mode==`optin`?n&&e.closest(`[data-turbo="true"]`)!=null:n&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=y(e,`[data-turbo]`),n=y(e,`turbo-frame`);return b.drive.enabled||n?!t||t.getAttribute(`data-turbo`)!=`false`:t?t.getAttribute(`data-turbo`)==`true`:!1}getActionForLink(e){return v(e)||`advance`}get snapshot(){return this.view.snapshot}};function Kn(e){Object.defineProperties(e,qn)}var qn={absoluteURL:{get(){return this.toString()}}},K=new Gn(Ie),{cache:Jn,navigator:Yn}=K;function Xn(){K.start()}function Zn(e){K.registerAdapter(e)}function Qn(e,t){K.visit(e,t)}function $n(e){K.connectStreamSource(e)}function er(e){K.disconnectStreamSource(e)}function tr(e){K.renderStreamMessage(e)}function nr(e){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.`"),b.drive.progressBarDelay=e}function rr(e){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.`"),b.forms.confirm=e}function ir(e){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.`"),b.forms.mode=e}function ar(e,t){In.renderElement(e,t)}function or(e,t){Mt.renderElement(e,t)}var sr=Object.freeze({__proto__:null,PageRenderer:Pn,PageSnapshot:R,FrameRenderer:F,fetch:Le,config:b,session:K,cache:Jn,navigator:Yn,start:Xn,registerAdapter:Zn,visit:Qn,connectStreamSource:$n,disconnectStreamSource:er,renderStreamMessage:tr,setProgressBarDelay:nr,setConfirmMethod:rr,setFormMode:ir,morphBodyElements:ar,morphTurboFrameElements:or,morphChildren:L,morphElements:I}),cr=class extends Error{},q=new WeakMap,J=new WeakMap,Y=new WeakMap,lr=new WeakMap,ur=new WeakMap,dr=new WeakMap,X=new WeakSet,fr=class{constructor(e){i(this,X),t(this,`fetchResponseLoaded`,e=>Promise.resolve()),a(this,q,null),a(this,J,()=>{}),a(this,Y,!1),a(this,lr,!1),a(this,ur,new Set),a(this,dr,!1),t(this,`action`,null),t(this,`visitCachedSnapshot`,({element:e})=>{let t=e.querySelector(`#`+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement}),this.element=e,this.view=new _t(this,this.element),this.appearanceObserver=new Je(this,this.element),this.formLinkClickObserver=new bt(this,this.element),this.linkInterceptor=new vt(this,this.element),this.restorationIdentifier=h(),this.formSubmitObserver=new dt(this,this.element)}connect(){r(Y,this)||(o(Y,this,!0),this.loadingStyle==c.lazy?this.appearanceObserver.start():n(X,this,Z).call(this),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){if(r(Y,this)&&(o(Y,this,!1),this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),!this.element.hasAttribute(`recurse`))){var e;(e=r(q,this))==null||e.cancel()}}disabledChanged(){if(this.disabled){var e;(e=r(q,this))==null||e.cancel()}else this.loadingStyle==c.eager&&n(X,this,Z).call(this)}sourceURLChanged(){if(!n(X,this,Cr).call(this,`src`)){if(!this.sourceURL){var e;(e=r(q,this))==null||e.cancel()}this.element.isConnected&&(this.complete=!1),(this.loadingStyle==c.eager||r(lr,this))&&n(X,this,Z).call(this)}}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return o(dr,this,t&&e===`morph`),this.element.removeAttribute(`complete`),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==c.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),n(X,this,Z).call(this))}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=ae(t);R.fromDocument(r).isVisitable?await n(X,this,pr).call(this,e,r):await n(X,this,gr).call(this,e)}}
17finally{o(dr,this,!1),this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,v(e)),n(X,this,Z).call(this)}willSubmitFormLinkToLocation(e){return n(X,this,Sr).call(this,e)}submittedFormLinkToLocation(e,t,r){let i=n(X,this,Q).call(this,e);i&&r.setAttribute(`data-turbo-frame`,i.id)}shouldInterceptLinkClick(e,t,r){return n(X,this,Sr).call(this,e)}linkClickIntercepted(e,t){n(X,this,hr).call(this,e,t)}willSubmitForm(e,t){return e.closest(`turbo-frame`)==this.element&&n(X,this,Sr).call(this,e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new tt(this,e,t);let{fetchRequest:r}=this.formSubmission,i=n(X,this,Q).call(this,e,t);this.prepareRequest(r,i),this.formSubmission.start()}prepareRequest(e,t=this){var n;e.headers[`Turbo-Frame`]=t.id,(n=this.currentNavigationElement)!=null&&n.hasAttribute(`data-turbo-stream`)&&e.acceptResponseType(D.contentType)}requestStarted(e){_(this.element)}requestPreventedHandlingResponse(e,t){r(J,this).call(this)}async requestSucceededWithResponse(e,t){await this.loadResponse(t),r(J,this).call(this)}async requestFailedWithResponse(e,t){await this.loadResponse(t),r(J,this).call(this)}requestErrored(e,t){console.error(t),r(J,this).call(this)}requestFinished(e){le(this.element)}formSubmissionStarted({formElement:e}){_(e,n(X,this,Q).call(this,e))}formSubmissionSucceededWithResponse(e,t){let r=n(X,this,Q).call(this,e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,v(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||K.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),K.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){le(e,n(X,this,Q).call(this,e))}allowsImmediateRender({element:e},t){let{defaultPrevented:n,detail:{render:r}}=p(`turbo:before-frame-render`,{target:this.element,detail:{newFrame:e,...t},cancelable:!0});return this.view.renderer&&r&&(this.view.renderer.renderElement=r),!n}viewRenderedSnapshot(e,t,n){}preloadOnLoadLinksForView(e){K.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let t=R.fromElement(e).clone(),{visitCachedSnapshot:n}=e.delegate;e.delegate.fetchResponseLoaded=async r=>{if(e.src){let{statusCode:i,redirected:a}=r,o={response:{statusCode:i,redirected:a,responseHTML:await r.responseHTML},visitCachedSnapshot:n,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:t};this.action&&(o.action=this.action),K.visit(e.src,o)}}}}changeHistory(){if(this.action){let e=de(this.action);K.history.update(e,x(this.element.src||``),this.restorationIdentifier)}}async extractForeignFrameElement(e){let t,n=CSS.escape(this.id);try{if(t=Dr(e.querySelector(`turbo-frame#${n}`),this.sourceURL),t)return t;if(t=Dr(e.querySelector(`turbo-frame[src][recurse~=${n}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(e){return console.error(e),new l}return null}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){n(X,this,wr).call(this,`src`,()=>{this.element.src=e==null?null:e})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||r(J,this).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&&r(Y,this)}get rootLocation(){var e;let t=this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`);return x((e=t==null?void 0:t.content)==null?`/`:e)}};async function Z(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=n(X,this,mr).call(this,x(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,o(lr,this,!0))}async function pr(e,t){let i=await this.extractForeignFrameElement(t.body),a=r(dr,this)?Mt:F;if(i){let t=new N(i),n=new a(this,this.view.snapshot,t,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(n),this.complete=!0,K.frameRendered(e,this.element),K.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else n(X,this,_r).call(this,e)&&n(X,this,vr).call(this,e)}async function mr(e){var t;let n=new E(this,w.get,e,new URLSearchParams,this.element);return(t=r(q,this))==null||t.cancel(),o(q,this,n),new Promise(e=>{o(J,this,()=>{o(J,this,()=>{}),o(q,this,null),e()}),n.perform()})}function hr(e,t,r){let i=n(X,this,Q).call(this,e,r);i.delegate.proposeVisitIfNavigatedWithAction(i,v(r,e,i)),n(X,this,Tr).call(this,e,()=>{i.src=t})}
17async function gr(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 n(X,this,br).call(this,e.response)}function _r(e){this.element.setAttribute(`complete`,``);let t=e.response;return!p(`turbo:frame-missing`,{target:this.element,detail:{response:t,visit:async(e,t)=>{e instanceof Response?n(X,this,br).call(this,e):K.visit(e,t)}},cancelable:!0}).defaultPrevented}function vr(e){this.view.missing(),n(X,this,yr).call(this,e)}function yr(e){throw new cr(`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.`)}async function br(e){let t=new Fe(e),n=await t.responseHTML,{location:r,redirected:i,statusCode:a}=t;return K.visit(r,{response:{redirected:i,statusCode:a,responseHTML:n}})}function Q(e,t){let r=g(`data-turbo-frame`,t,e)||this.element.getAttribute(`target`),i=n(X,this,Er).call(this,r);return i instanceof l?i:this.element}function xr(e,t){return C(x(Te(e,t)),this.rootLocation)}function Sr(e,t){let r=g(`data-turbo-frame`,t,e)||this.element.getAttribute(`target`);if(e instanceof HTMLFormElement&&!n(X,this,xr).call(this,e,t)||!this.enabled||r==`_top`)return!1;if(r){let e=n(X,this,Er).call(this,r);if(e)return!e.disabled;if(r==`_parent`)return!1}return!(!K.elementIsNavigatable(e)||t&&!K.elementIsNavigatable(t))}function Cr(e){return r(ur,this).has(e)}function wr(e,t){r(ur,this).add(e),t(),r(ur,this).delete(e)}function Tr(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}function Er(e){if(e!=null){let t=e===`_parent`?this.element.parentElement.closest(`turbo-frame`):document.getElementById(e);if(t instanceof l)return t}}function Dr(e,t){if(e){let n=e.getAttribute(`src`);if(n!=null&&t!=null&&je(n,t))throw Error(`Matching <turbo-frame id="${e.id}"> element has a source URL which references itself`);if(e.ownerDocument!==document&&(e=document.importNode(e,!0)),e instanceof l)return e.connectedCallback(),e.disconnectedCallback(),e}}var Or={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(e=>{var t;return(t=e.parentElement)==null?void 0:t.insertBefore(this.templateContent,e.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(e=>e.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(e=>{var t;return(t=e.parentElement)==null?void 0:t.insertBefore(this.templateContent,e)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(e=>e.prepend(this.templateContent))},remove(){this.targetElements.forEach(e=>e.remove())},replace(){let e=this.getAttribute(`method`);this.targetElements.forEach(t=>{e===`morph`?I(t,this.templateContent):t.replaceWith(this.templateContent)})},update(){let e=this.getAttribute(`method`);this.targetElements.forEach(t=>{e===`morph`?L(t,this.templateContent):(t.innerHTML=``,t.append(this.templateContent))})},refresh(){let e=this.getAttribute(`method`),t=this.requestId,n=this.getAttribute(`scroll`);K.refresh(this.baseURI,{method:e,requestId:t,scroll:n})}},$=new WeakSet,kr=class e extends HTMLElement{constructor(...e){super(...e),i(this,$)}static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)==null?this.renderPromise=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await m(),await e.detail.render(this))})():e}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(e=>[...e.children]).filter(e=>!!e.getAttribute(`id`)),n=[...((e=this.templateContent)==null?void 0:e.children)||[]].filter(e=>!!e.getAttribute(`id`)).map(e=>e.getAttribute(`id`));return t.filter(e=>n.includes(e.getAttribute(`id`)))}
17removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){var e;let t=this.targetElements.flatMap(e=>[...e.parentElement.children]).filter(e=>!!e.id),n=[...((e=this.templateContent)==null?void 0:e.children)||[]].filter(e=>!!e.id).map(e=>e.id);return t.filter(e=>n.includes(e.id))}get performAction(){if(this.action){let e=Or[this.action];if(e)return e;n($,this,Ar).call(this,`unknown action`)}n($,this,Ar).call(this,`action attribute is missing`)}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;n($,this,Ar).call(this,`target or targets attribute is missing`)}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement(`template`);return this.appendChild(e),e}if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;n($,this,Ar).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 e,t;return(e=((t=this.outerHTML.match(/<[^>]+>/))==null?[]:t)[0])==null?`<turbo-stream>`:e}get beforeRenderEvent(){return new CustomEvent(`turbo:before-stream-render`,{bubbles:!0,cancelable:!0,detail:{newStream:this,render:e.renderElement}})}get targetElementsById(){var e;let t=(e=this.ownerDocument)==null?void 0:e.getElementById(this.target);return t===null?[]:[t]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)==null?void 0:e.querySelectorAll(this.targets);return t.length===0?[]:Array.prototype.slice.call(t)}};function Ar(e){throw Error(`${this.description}: ${e}`)}var jr=class extends HTMLElement{constructor(...e){super(...e),t(this,`streamSource`,null)}connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),$n(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),er(this.streamSource))}get src(){return this.getAttribute(`src`)||``}};l.delegateConstructor=fr,customElements.get(`turbo-frame`)===void 0&&customElements.define(`turbo-frame`,l),customElements.get(`turbo-stream`)===void 0&&customElements.define(`turbo-stream`,kr),customElements.get(`turbo-stream-source`)===void 0&&customElements.define(`turbo-stream-source`,jr),(()=>{let e=document.currentScript;if(!e||e.hasAttribute(`data-turbo-suppress-warning`))return;let t=e.parentElement;for(;t;){if(t==document.body)return console.warn(oe` 18 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 19 20 Load your applicationâs JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 21 22 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 23 24 ââ 25 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 26 `,e.outerHTML);t=t.parentElement}})(),window.Turbo={...sr,StreamActions:Or},Xn();export{K as n,s as r,Or as t}; 27//# sourceMappingURL=turbo.es2017-esm-KZvHhNdI.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.