1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
(()=>{(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.polyfillWrapFlushCallback)return;let r=HTMLElement,e={HTMLElement:function(){return Reflect.construct(r,[],this.constructor)}};window.HTMLElement=e.HTMLElement,HTMLElement.prototype=r.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,r)})();var Z=new WeakMap;function dt(r){let e=r instanceof Element?r:r instanceof Node?r.parentElement:null,t=e?e.closest("input, button"):null;return(t==null?void 0:t.type)=="submit"?t:null}function ft(r){let e=dt(r.target);e&&e.form&&Z.set(e.form,e)}(function(){"SubmitEvent"in window||(addEventListener("click",ft,!0),Object.defineProperty(Event.prototype,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Z.get(this.target)}}))})();var w;(function(r){r.eager="eager",r.lazy="lazy"})(w||(w={}));var v=class extends HTMLElement{constructor(){super();this.loaded=Promise.resolve(),this.delegate=new v.delegateConstructor(this)}static get observedAttributes(){return["disabled","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){let{src:e}=this;this.src=null,this.src=e}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get loading(){return pt(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,t;return(t=(e=this.ownerDocument)===null||e===void 0?void 0:e.documentElement)===null||t===void 0?void 0:t.hasAttribute("data-turbo-preview")}};function pt(r){switch(r.toLowerCase()){case"lazy":return w.lazy;default:return w.eager}}function m(r){return new URL(r.toString(),document.baseURI)}function P(r){let e;if(r.hash)return r.hash.slice(1);if(e=r.href.match(/#(.*)$/))return e[1]}function mt(r){return(wt(r).match(/\.[^.]*$/)||[])[0]||""}function gt(r){return!!mt(r).match(/^(?:|\.(?:htm|html|xhtml))$/)}function vt(r,e){let t=Et(e);return r.href===m(t).href||r.href.startsWith(t)}function _(r){let e=P(r);return e!=null?r.href.slice(0,-(e.length+1)):r.href}function F(r){return _(r)}function bt(r,e){return m(r).href==m(e).href}function yt(r){return r.pathname.split("/").slice(1)}function wt(r){return yt(r).slice(-1)[0]}function Et(r){return St(r.origin+r.pathname)}function St(r){return r.endsWith("/")?r:r+"/"}var W=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 m(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.text()}get responseHTML(){return this.isHTML?this.response.text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}};function u(r,{target:e,cancelable:t,detail:n}={}){let i=new CustomEvent(r,{cancelable:t,bubbles:!0,detail:n});return(e||document.documentElement).dispatchEvent(i),i}function B(){return new Promise(r=>requestAnimationFrame(()=>r()))}function At(){return new Promise(r=>setTimeout(()=>r(),0))}function Pt(){return Promise.resolve()}function ee(r=""){return new DOMParser().parseFromString(r,"text/html")}function te(r,...e){let t=Lt(r,e).replace(/^\n/,"").split(`
`),n=t[0].match(/^\s+/),i=n?n[0].length:0;return t.map(s=>s.slice(i)).join(`
`)}function Lt(r,e){return r.reduce((t,n,i)=>{let s=e[i]==null?"":e[i];return t+n+s},"")}function k(){return Array.apply(null,{length:36}).map((r,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}var h;(function(r){r[r.get=0]="get",r[r.post=1]="post",r[r.put=2]="put",r[r.patch=3]="patch",r[r.delete=4]="delete"})(h||(h={}));function Tt(r){switch(r.toLowerCase()){case"get":return h.get;case"post":return h.post;case"put":return h.put;case"patch":return h.patch;case"delete":return h.delete}}var I=class{constructor(e,t,n,i=new URLSearchParams){this.abortController=new AbortController,this.resolveRequestPromise=s=>{},this.delegate=e,this.method=t,this.headers=this.defaultHeaders,this.isIdempotent?this.url=Ct(n,[...i.entries()]):(this.body=i,this.url=n)}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(){var e,t;let{fetchOptions:n}=this;(t=(e=this.delegate).prepareHeadersForRequest)===null||t===void 0||t.call(e,this.headers,this),await this.allowRequestToBeIntercepted(n);try{this.delegate.requestStarted(this);let i=await fetch(this.url.href,n);return await this.receive(i)}catch(i){if(i.name!=="AbortError")throw this.delegate.requestErrored(this,i),i}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new W(e);return u("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t}}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get fetchOptions(){var e;return{method:h[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.body,signal:this.abortSignal,referrer:(e=this.delegate.referrer)===null||e===void 0?void 0:e.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isIdempotent(){return this.method==h.get}get abortSignal(){return this.abortController.signal}async allowRequestToBeIntercepted(e){let t=new Promise(i=>this.resolveRequestPromise=i);u("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url.href,resume:this.resolveRequestPromise}}).defaultPrevented&&await t}};function Ct(r,e){let t=new URLSearchParams(r.search);for(let[n,i]of e)i instanceof File||(t.has(n)?(t.delete(n),r.searchParams.set(n,i)):r.searchParams.append(n,i));return r}var re=class{constructor(e,t){this.started=!1,this.intersect=n=>{let i=n.slice(-1)[0];(i==null?void 0:i.isIntersecting)&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},L=class{constructor(e){this.templateElement=document.createElement("template"),this.templateElement.innerHTML=e}static wrap(e){return typeof e=="string"?new this(e):e}get fragment(){let e=document.createDocumentFragment();for(let t of this.foreignElements)e.appendChild(document.importNode(t,!0));return e}get foreignElements(){return this.templateChildren.reduce((e,t)=>t.tagName.toLowerCase()=="turbo-stream"?[...e,t]:e,[])}get templateChildren(){return Array.from(this.templateElement.content.children)}};L.contentType="text/vnd.turbo-stream.html";var E;(function(r){r[r.initialized=0]="initialized",r[r.requesting=1]="requesting",r[r.waiting=2]="waiting",r[r.receiving=3]="receiving",r[r.stopping=4]="stopping",r[r.stopped=5]="stopped"})(E||(E={}));var S;(function(r){r.urlEncoded="application/x-www-form-urlencoded",r.multipart="multipart/form-data",r.plain="text/plain"})(S||(S={}));function Ot(r){switch(r.toLowerCase()){case S.multipart:return S.multipart;case S.plain:return S.plain;default:return S.urlEncoded}}var U=class{constructor(e,t,n,i=!1){this.state=E.initialized,this.delegate=e,this.formElement=t,this.submitter=n,this.formData=Rt(t,n),this.fetchRequest=new I(this,this.method,this.location,this.body),this.mustRedirect=i}get method(){var e;let t=((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"";return Tt(t.toLowerCase())||h.get}get action(){var e;let t=typeof this.formElement.action=="string"?this.formElement.action:null;return((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formaction"))||this.formElement.getAttribute("action")||t||""}get location(){return m(this.action)}get body(){return this.enctype==S.urlEncoded||this.method==h.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var e;return Ot(((e=this.submitter)===null||e===void 0?void 0:e.getAttribute("formenctype"))||this.formElement.enctype)}get isIdempotent(){return this.fetchRequest.isIdempotent}get stringFormData(){return[...this.formData].reduce((e,[t,n])=>e.concat(typeof n=="string"?[[t,n]]:[]),[])}async start(){let{initialized:e,requesting:t}=E;if(this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=E;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareHeadersForRequest(e,t){if(!t.isIdempotent){let n=kt(ne("csrf-param"))||ne("csrf-token");n&&(e["X-CSRF-Token"]=n),e.Accept=[L.contentType,e.Accept].join(", ")}}requestStarted(e){this.state=E.waiting,u("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError)this.delegate.formSubmissionFailedWithResponse(this,t);else if(this.requestMustRedirect(e)&&Mt(t)){let n=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,n)}else this.state=E.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=E.stopped,u("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}requestMustRedirect(e){return!e.isIdempotent&&this.mustRedirect}};function Rt(r,e){let t=new FormData(r),n=e==null?void 0:e.getAttribute("name"),i=e==null?void 0:e.getAttribute("value");return n&&i!=null&&t.get(n)!=i&&t.append(n,i),t}function kt(r){if(r!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(n=>n.startsWith(r));if(t){let n=t.split("=").slice(1).join("=");return n?decodeURIComponent(n):void 0}}}function ne(r){let e=document.querySelector(`meta[name="${r}"]`);return e&&e.content}function Mt(r){return r.statusCode==200&&!r.redirected}var M=class{constructor(e){this.element=e}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 this.element.querySelector("[autofocus]")}get permanentElements(){return[...this.element.querySelectorAll("[id][data-turbo-permanent]")]}getPermanentElementById(e){return this.element.querySelector(`#${e}[data-turbo-permanent]`)}getPermanentElementMapForSnapshot(e){let t={};for(let n of this.permanentElements){let{id:i}=n,s=e.getPermanentElementById(i);s&&(t[i]=[n,s])}return t}},K=class{constructor(e,t){this.submitBubbled=n=>{if(n.target instanceof HTMLFormElement){let i=n.target,s=n.submitter||void 0;this.delegate.shouldInterceptFormSubmission(i,s)&&(n.preventDefault(),n.stopImmediatePropagation(),this.delegate.formSubmissionIntercepted(i,s))}},this.delegate=e,this.element=t}start(){this.element.addEventListener("submit",this.submitBubbled)}stop(){this.element.removeEventListener("submit",this.submitBubbled)}},z=class{constructor(e,t){this.resolveRenderPromise=n=>{},this.resolveInterceptionPromise=n=>{},this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(P(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:n,newSnapshot:i}=e;if(n)try{this.renderPromise=new Promise(c=>this.resolveRenderPromise=c),this.renderer=e,this.prepareToRenderSnapshot(e);let s=new Promise(c=>this.resolveInterceptionPromise=c);this.delegate.allowsImmediateRender(i,this.resolveInterceptionPromise)||await s,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(i,t),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate()}invalidate(){this.delegate.viewInvalidated()}prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},ie=class extends z{invalidate(){this.element.innerHTML=""}get snapshot(){return new M(this.element)}},$=class{constructor(e,t){this.clickBubbled=n=>{this.respondsToEventTarget(n.target)?this.clickEvent=n:delete this.clickEvent},this.linkClicked=n=>{this.clickEvent&&this.respondsToEventTarget(n.target)&&n.target instanceof Element&&this.delegate.shouldInterceptLinkClick(n.target,n.detail.url)&&(this.clickEvent.preventDefault(),n.preventDefault(),this.delegate.linkClickIntercepted(n.target,n.detail.url)),delete this.clickEvent},this.willVisit=()=>{delete this.clickEvent},this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(e){let t=e instanceof Element?e:e instanceof Node?e.parentElement:null;return t&&t.closest("turbo-frame, html")==this.element}},se=class{constructor(e){this.permanentElementMap=e}static preservingPermanentElements(e,t){let n=new this(e);n.enter(),t(),n.leave()}enter(){for(let e in this.permanentElementMap){let[,t]=this.permanentElementMap[e];this.replaceNewPermanentElementWithPlaceholder(t)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=xt(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 xt(r){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",r.id),e}var N=class{constructor(e,t,n){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=n,this.promise=new Promise((i,s)=>this.resolvingFunctions={resolve:i,reject:s})}get shouldRender(){return!0}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}createScriptElement(e){if(e.getAttribute("data-turbo-eval")=="false")return e;{let t=document.createElement("script");return this.cspNonce&&(t.nonce=this.cspNonce),t.textContent=e.textContent,t.async=!1,Ft(t,e),t}}preservingPermanentElements(e){se.preservingPermanentElements(this.permanentElementMap,e)}focusFirstAutofocusableElement(){let e=this.connectedSnapshot.firstAutofocusableElement;Bt(e)&&e.focus()}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 cspNonce(){var e;return(e=document.head.querySelector('meta[name="csp-nonce"]'))===null||e===void 0?void 0:e.getAttribute("content")}};function Ft(r,e){for(let{name:t,value:n}of[...e.attributes])r.setAttribute(t,n)}function Bt(r){return r&&typeof r.focus=="function"}var oe=class extends N{get shouldRender(){return!0}async render(){await B(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await B(),this.focusFirstAutofocusableElement(),await B(),this.activateScriptElements()}loadFrameElement(){var e;let t=document.createRange();t.selectNodeContents(this.currentElement),t.deleteContents();let n=this.newElement,i=(e=n.ownerDocument)===null||e===void 0?void 0:e.createRange();i&&(i.selectNodeContents(n),this.currentElement.appendChild(i.extractContents()))}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=It(this.currentElement.getAttribute("data-autoscroll-block"),"end");if(e)return e.scrollIntoView({block:t}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function It(r,e){return r=="end"||r=="start"||r=="center"||r=="nearest"?r:e}var g=class{constructor(){this.hiding=!1,this.value=0,this.visible=!1,this.trickle=()=>{this.setValue(this.value+Math.random()/100)},this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return te`
.turbo-progress-bar {
position: fixed;
display: block;
top: 0;
left: 0;
height: 3px;
background: #0076ff;
z-index: 9999;
transition:
width ${g.animationDuration}ms ease-out,
opacity ${g.animationDuration/2}ms ${g.animationDuration/2}ms ease-in;
transform: translate3d(0, 0, 0);
}
`}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,g.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,g.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");return e.type="text/css",e.textContent=g.defaultCSS,e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}};g.animationDuration=300;var ae=class extends M{constructor(){super(...arguments);this.detailsByOuterHTML=this.children.filter(e=>!jt(e)).reduce((e,t)=>{let{outerHTML:n}=t,i=n in e?e[n]:{type:Nt(t),tracked:qt(t),elements:[]};return Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},i),{elements:[...i.elements,t]})})},{})}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(n=>!(n in t.detailsByOuterHTML)).map(n=>this.detailsByOuterHTML[n]).filter(({type:n})=>n==e).map(({elements:[n]})=>n)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:n,tracked:i,elements:s}=this.detailsByOuterHTML[t];return n==null&&!i?[...e,...s]:s.length>1?[...e,...s.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:[i]}=this.detailsByOuterHTML[n];return Ht(i,e)?i:t},void 0)}};function Nt(r){if(Vt(r))return"script";if(Dt(r))return"stylesheet"}function qt(r){return r.getAttribute("data-turbo-track")=="reload"}function Vt(r){return r.tagName.toLowerCase()=="script"}function jt(r){return r.tagName.toLowerCase()=="noscript"}function Dt(r){let e=r.tagName.toLowerCase();return e=="style"||e=="link"&&r.getAttribute("rel")=="stylesheet"}function Ht(r,e){return r.tagName.toLowerCase()=="meta"&&r.getAttribute("name")==e}var b=class extends M{constructor(e,t){super(e);this.headSnapshot=t}static fromHTMLString(e=""){return this.fromDocument(ee(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({head:e,body:t}){return new this(t,new ae(e))}clone(){return new b(this.element.cloneNode(!0),this.headSnapshot)}get headElement(){return this.headSnapshot.element}get rootLocation(){var e;let t=(e=this.getSetting("root"))!==null&&e!==void 0?e:"/";return m(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},T;(function(r){r.visitStart="visitStart",r.requestStart="requestStart",r.requestEnd="requestEnd",r.visitEnd="visitEnd"})(T||(T={}));var p;(function(r){r.initialized="initialized",r.started="started",r.canceled="canceled",r.failed="failed",r.completed="completed"})(p||(p={}));var _t={action:"advance",historyChanged:!1},A;(function(r){r[r.networkFailure=0]="networkFailure",r[r.timeoutFailure=-1]="timeoutFailure",r[r.contentTypeMismatch=-2]="contentTypeMismatch"})(A||(A={}));var ce=class{constructor(e,t,n,i={}){this.identifier=k(),this.timingMetrics={},this.followedRedirect=!1,this.historyChanged=!1,this.scrolled=!1,this.snapshotCached=!1,this.state=p.initialized,this.delegate=e,this.location=t,this.restorationIdentifier=n||k();let{action:s,historyChanged:o,referrer:c,snapshotHTML:l,response:a}=Object.assign(Object.assign({},_t),i);this.action=s,this.historyChanged=o,this.referrer=c,this.snapshotHTML=l,this.response=a,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==p.initialized&&(this.recordTimingMetric(T.visitStart),this.state=p.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==p.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=p.canceled)}complete(){this.state==p.started&&(this.recordTimingMetric(T.visitEnd),this.state=p.completed,this.adapter.visitCompleted(this),this.delegate.visitCompleted(this),this.followRedirect())}fail(){this.state==p.started&&(this.state=p.failed,this.adapter.visitFailed(this))}changeHistory(){var e;if(!this.historyChanged){let t=this.location.href===((e=this.referrer)===null||e===void 0?void 0:e.href)?"replace":this.action,n=this.getHistoryMethodForAction(t);this.history.update(n,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new I(this,h.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(T.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;le(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(T.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,le(e)&&t!=null?(await this.view.renderPage(b.fromHTMLString(t)),this.adapter.visitRendered(this),this.complete()):(await this.view.renderError(b.fromHTMLString(t)),this.adapter.visitRendered(this),this.fail())})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!P(this.location)||e.hasAnchor(P(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return b.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.view.renderPage(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.adapter.visitRendered(this)})}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let n=await t.responseHTML;n==null?this.recordResponse({statusCode:A.contentTypeMismatch}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:t.statusCode,responseHTML:n}))}async requestFailedWithResponse(e,t){let n=await t.responseHTML;n==null?this.recordResponse({statusCode:A.contentTypeMismatch}):this.recordResponse({statusCode:t.statusCode,responseHTML:n})}requestErrored(e,t){this.recordResponse({statusCode:A.networkFailure})}requestFinished(){this.finishRequest()}performScroll(){this.scrolled||(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=P(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return Object.assign({},this.timingMetrics)}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():!0}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=requestAnimationFrame(()=>t())}),await e(),delete this.frame,this.performScroll()}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function le(r){return r>=200&&r<300}var ue=class{constructor(e){this.progressBar=new g,this.showProgressBar=()=>{this.progressBar.show()},this.session=e}visitProposedToLocation(e,t){this.navigator.startVisit(e,k(),t)}visitStarted(e){e.issueRequest(),e.changeHistory(),e.goToSamePageAnchor(),e.loadCachedSnapshot()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case A.networkFailure:case A.timeoutFailure:case A.contentTypeMismatch:return this.reload();default:return e.loadResponse()}}visitRequestFinished(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitCompleted(e){}pageInvalidated(){this.reload()}visitFailed(e){}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(){window.location.reload()}get navigator(){return this.session.navigator}},he=class{constructor(){this.started=!1}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeStaleElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeStaleElements,!1))}removeStaleElements(){let e=[...document.querySelectorAll('[data-turbo-cache="false"]')];for(let t of e)t.remove()}},de=class{constructor(e){this.started=!1,this.submitCaptured=()=>{removeEventListener("submit",this.submitBubbled,!1),addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=t=>{if(!t.defaultPrevented){let n=t.target instanceof HTMLFormElement?t.target:void 0,i=t.submitter||void 0;n&&((i==null?void 0:i.getAttribute("formmethod"))||n.method)!="dialog"&&this.delegate.willSubmitForm(n,i)&&(t.preventDefault(),this.delegate.formSubmitted(n,i))}},this.delegate=e}start(){this.started||(addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}},fe=class{constructor(e){this.element=e,this.linkInterceptor=new $(this,e),this.formInterceptor=new K(this,e)}start(){this.linkInterceptor.start(),this.formInterceptor.start()}stop(){this.linkInterceptor.stop(),this.formInterceptor.stop()}shouldInterceptLinkClick(e,t){return this.shouldRedirect(e)}linkClickIntercepted(e,t){let n=this.findFrameElement(e);n&&(n.setAttribute("reloadable",""),n.src=t)}shouldInterceptFormSubmission(e,t){return this.shouldRedirect(e,t)}formSubmissionIntercepted(e,t){let n=this.findFrameElement(e);n&&(n.removeAttribute("reloadable"),n.delegate.formSubmissionIntercepted(e,t))}shouldRedirect(e,t){let n=this.findFrameElement(e);return n?n!=e.closest("turbo-frame"):!1}findFrameElement(e){let t=e.getAttribute("data-turbo-frame");if(t&&t!="_top"){let n=this.element.querySelector(`#${t}:not([disabled])`);if(n instanceof v)return n}}},pe=class{constructor(e){this.restorationIdentifier=k(),this.restorationData={},this.started=!1,this.pageLoaded=!1,this.onPopState=t=>{if(this.shouldHandlePopState()){let{turbo:n}=t.state||{};if(n){this.location=new URL(window.location.href);let{restorationIdentifier:i}=n;this.restorationIdentifier=i,this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location,i)}}},this.onPageLoad=async t=>{await Pt(),this.pageLoaded=!0},this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,n=k()){let i={turbo:{restorationIdentifier:n}};e.call(history,i,"",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]=Object.assign(Object.assign({},n),e)}assumeControlOfScrollRestoration(){var e;this.previousScrollRestoration||(this.previousScrollRestoration=(e=history.scrollRestoration)!==null&&e!==void 0?e:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},me=class{constructor(e){this.started=!1,this.clickCaptured=()=>{removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=t=>{if(this.clickEventIsSignificant(t)){let n=t.composedPath&&t.composedPath()[0]||t.target,i=this.findLinkFromClickTarget(n);if(i){let s=this.getLocationForLink(i);this.delegate.willFollowLinkToLocation(i,s)&&(t.preventDefault(),this.delegate.followedLinkToLocation(i,s))}}},this.delegate=e}start(){this.started||(addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(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)}findLinkFromClickTarget(e){if(e instanceof Element)return e.closest("a[href]:not([target^=_]):not([download])")}getLocationForLink(e){return m(e.getAttribute("href")||"")}};function ge(r){return r=="advance"||r=="replace"||r=="restore"}var ve=class{constructor(e){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 ce(this,m(e),t,Object.assign({referrer:this.location},n)),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new U(this,e,t,!0),this.formSubmission.isIdempotent?this.proposeVisit(this.formSubmission.fetchRequest.url,{action:this.getActionForFormSubmission(this.formSubmission)}):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 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 n=await t.responseHTML;if(n){e.method!=h.get&&this.view.clearSnapshotCache();let{statusCode:i}=t,s={response:{statusCode:i,responseHTML:n}};this.proposeVisit(t.location,s)}}}async formSubmissionFailedWithResponse(e,t){let n=await t.responseHTML;if(n){let i=b.fromHTMLString(n);t.serverError?await this.view.renderError(i):await this.view.renderPage(i),this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e)}locationWithActionIsSamePage(e,t){let n=P(e),i=P(this.view.lastRenderedLocation),s=t==="restore"&&typeof n=="undefined";return t!=="replace"&&_(e)===_(this.view.lastRenderedLocation)&&(s||n!=null&&n!==i)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}getActionForFormSubmission(e){let{formElement:t,submitter:n}=e,i=(n==null?void 0:n.getAttribute("data-turbo-action"))||t.getAttribute("data-turbo-action");return ge(i)?i:"advance"}},y;(function(r){r[r.initial=0]="initial",r[r.loading=1]="loading",r[r.interactive=2]="interactive",r[r.complete=3]="complete"})(y||(y={}));var be=class{constructor(e){this.stage=y.initial,this.started=!1,this.interpretReadyState=()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()},this.pageWillUnload=()=>{this.delegate.pageWillUnload()},this.delegate=e}start(){this.started||(this.stage==y.initial&&(this.stage=y.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==y.loading&&(this.stage=y.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==y.interactive&&(this.stage=y.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},ye=class{constructor(e){this.started=!1,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)}},we=class{constructor(e){this.sources=new Set,this.started=!1,this.inspectFetchResponse=t=>{let n=Wt(t);n&&Ut(n)&&(t.preventDefault(),this.receiveMessageResponse(n))},this.receiveMessageEvent=t=>{this.started&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)},this.delegate=e}start(){this.started||(this.started=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.started&&(this.started=!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(new L(e))}};function Wt(r){var e;let t=(e=r.detail)===null||e===void 0?void 0:e.fetchResponse;if(t instanceof W)return t}function Ut(r){var e;return((e=r.contentType)!==null&&e!==void 0?e:"").startsWith(L.contentType)}var Ee=class extends N{async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t,body:n}=document;e.replaceChild(this.newHead,t),e.replaceChild(this.newElement,n)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let n=this.createScriptElement(e);t.replaceChild(n,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return[...document.documentElement.querySelectorAll("script")]}},J=class extends N{get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}prepareToRender(){this.mergeHead()}async render(){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}mergeHead(){this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()}replaceBody(){this.preservingPermanentElements(()=>{this.activateNewBody(),this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}copyNewHeadStylesheetElements(){for(let e of this.newHeadStylesheetElements)document.head.appendChild(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(this.createScriptElement(e))}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=this.createScriptElement(e);e.replaceWith(t)}}assignNewBody(){document.body&&this.newElement instanceof HTMLBodyElement?document.body.replaceWith(this.newElement):document.documentElement.appendChild(this.newElement)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},Se=class{constructor(e){this.keys=[],this.snapshots={},this.size=e}has(e){return F(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[F(e)]}write(e,t){this.snapshots[F(e)]=t}touch(e){let t=F(e),n=this.keys.indexOf(t);n>-1&&this.keys.splice(n,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},Ae=class extends z{constructor(){super(...arguments);this.snapshotCache=new Se(10),this.lastRenderedLocation=new URL(location.href)}renderPage(e,t=!1){let n=new J(this.snapshot,e,t);return this.render(n)}renderError(e){let t=new Ee(this.snapshot,e,!1);return this.render(t)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(){if(this.shouldCacheSnapshot){this.delegate.viewWillCacheSnapshot();let{snapshot:e,lastRenderedLocation:t}=this;await At(),this.snapshotCache.put(t,e.clone())}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}get snapshot(){return b.fromElement(this.element)}get shouldCacheSnapshot(){return this.snapshot.isCacheable}},Pe=class{constructor(){this.navigator=new ve(this),this.history=new pe(this),this.view=new Ae(this,document.documentElement),this.adapter=new ue(this),this.pageObserver=new be(this),this.cacheObserver=new he,this.linkClickObserver=new me(this),this.formSubmitObserver=new de(this),this.scrollObserver=new ye(this),this.streamObserver=new we(this),this.frameRedirector=new fe(document.documentElement),this.drive=!0,this.enabled=!0,this.progressBarDelay=500,this.started=!1}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){this.navigator.proposeVisit(m(e),t)}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){document.documentElement.appendChild(L.wrap(e).fragment)}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){this.progressBarDelay=e}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}historyPoppedToLocationWithRestorationIdentifier(e,t){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0}):this.adapter.pageInvalidated()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willFollowLinkToLocation(e,t){return this.elementDriveEnabled(e)&&this.locationIsVisitable(t)&&this.applicationAllowsFollowingLinkToLocation(e,t)}followedLinkToLocation(e,t){let n=this.getActionForLink(e);this.convertLinkWithMethodClickToFormSubmission(e)||this.visit(t.href,{action:n})}convertLinkWithMethodClickToFormSubmission(e){let t=e.getAttribute("data-turbo-method");if(t){let n=document.createElement("form");return n.method=t,n.action=e.getAttribute("href")||"undefined",document.body.appendChild(n),u("submit",{cancelable:!0,target:n})}else return!1}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Le(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){Le(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){return this.elementDriveEnabled(e)&&this.elementDriveEnabled(t)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){var e;((e=this.navigator.currentVisit)===null||e===void 0?void 0:e.silent)||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){return!this.notifyApplicationBeforeRender(e,t).defaultPrevented}viewRenderedSnapshot(e,t){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender()}viewInvalidated(){this.adapter.pageInvalidated()}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t){return!this.notifyApplicationAfterClickingLinkToLocation(e,t).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t){return u("turbo:click",{target:e,detail:{url:t.href},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return u("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return u("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return u("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return u("turbo:before-render",{detail:{newBody:e,resume:t},cancelable:!0})}notifyApplicationAfterRender(){return u("turbo:render")}notifyApplicationAfterPageLoad(e={}){return u("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return u("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return u("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}elementDriveEnabled(e){let t=e==null?void 0:e.closest("[data-turbo]");return this.drive?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){let t=e.getAttribute("data-turbo-action");return ge(t)?t:"advance"}locationIsVisitable(e){return vt(e,this.snapshot.rootLocation)&>(e)}get snapshot(){return this.view.snapshot}};function Le(r){Object.defineProperties(r,Kt)}var Kt={absoluteURL:{get(){return this.toString()}}},d=new Pe,{navigator:zt}=d;function Te(){d.start()}function $t(r){d.registerAdapter(r)}function Jt(r,e){d.visit(r,e)}function Gt(r){d.connectStreamSource(r)}function Qt(r){d.disconnectStreamSource(r)}function Xt(r){d.renderStreamMessage(r)}function Yt(){d.clearCache()}function Zt(r){d.setProgressBarDelay(r)}var er=Object.freeze({__proto__:null,navigator:zt,session:d,PageRenderer:J,PageSnapshot:b,start:Te,registerAdapter:$t,visit:Jt,connectStreamSource:Gt,disconnectStreamSource:Qt,renderStreamMessage:Xt,clearCache:Yt,setProgressBarDelay:Zt}),Ce=class{constructor(e){this.resolveVisitPromise=()=>{},this.connected=!1,this.hasBeenLoaded=!1,this.settingSourceURL=!1,this.element=e,this.view=new ie(this,this.element),this.appearanceObserver=new re(this,this.element),this.linkInterceptor=new $(this,this.element),this.formInterceptor=new K(this,this.element)}connect(){this.connected||(this.connected=!0,this.reloadable=!1,this.loadingStyle==w.lazy&&this.appearanceObserver.start(),this.linkInterceptor.start(),this.formInterceptor.start(),this.sourceURLChanged())}disconnect(){this.connected&&(this.connected=!1,this.appearanceObserver.stop(),this.linkInterceptor.stop(),this.formInterceptor.stop())}disabledChanged(){this.loadingStyle==w.eager&&this.loadSourceURL()}sourceURLChanged(){(this.loadingStyle==w.eager||this.hasBeenLoaded)&&this.loadSourceURL()}loadingStyleChanged(){this.loadingStyle==w.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.loadSourceURL())}async loadSourceURL(){if(!this.settingSourceURL&&this.enabled&&this.isActive&&(this.reloadable||this.sourceURL!=this.currentURL)){let e=this.currentURL;if(this.currentURL=this.sourceURL,this.sourceURL)try{this.element.loaded=this.visit(this.sourceURL),this.appearanceObserver.stop(),await this.element.loaded,this.hasBeenLoaded=!0,d.frameLoaded(this.element)}catch(t){throw this.currentURL=e,t}}}async loadResponse(e){e.redirected&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let{body:n}=ee(t),i=new M(await this.extractForeignFrameElement(n)),s=new oe(this.view.snapshot,i,!1);this.view.renderPromise&&await this.view.renderPromise,await this.view.render(s),d.frameRendered(e,this.element)}}catch(t){console.error(t),this.view.invalidate()}}elementAppearedInViewport(e){this.loadSourceURL()}shouldInterceptLinkClick(e,t){return e.hasAttribute("data-turbo-method")?!1:this.shouldInterceptNavigation(e)}linkClickIntercepted(e,t){this.reloadable=!0,this.navigateFrame(e,t)}shouldInterceptFormSubmission(e,t){return this.shouldInterceptNavigation(e,t)}formSubmissionIntercepted(e,t){if(this.formSubmission&&this.formSubmission.stop(),this.reloadable=!1,this.formSubmission=new U(this,e,t),this.formSubmission.fetchRequest.isIdempotent)this.navigateFrame(e,this.formSubmission.fetchRequest.url.href);else{let{fetchRequest:n}=this.formSubmission;this.prepareHeadersForRequest(n.headers,n),this.formSubmission.start()}}prepareHeadersForRequest(e,t){e["Turbo-Frame"]=this.id}requestStarted(e){this.element.setAttribute("busy","")}requestPreventedHandlingResponse(e,t){this.resolveVisitPromise()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.resolveVisitPromise()}requestFailedWithResponse(e,t){console.error(t),this.resolveVisitPromise()}requestErrored(e,t){console.error(t),this.resolveVisitPromise()}requestFinished(e){this.element.removeAttribute("busy")}formSubmissionStarted(e){this.findFrameElement(e.formElement).setAttribute("busy","")}formSubmissionSucceededWithResponse(e,t){this.findFrameElement(e.formElement).delegate.loadResponse(t)}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t)}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){this.findFrameElement(e.formElement).removeAttribute("busy")}allowsImmediateRender(e,t){return!0}viewRenderedSnapshot(e,t){}viewInvalidated(){}async visit(e){let t=new I(this,h.get,m(e));return new Promise(n=>{this.resolveVisitPromise=()=>{this.resolveVisitPromise=()=>{},n()},t.perform()})}navigateFrame(e,t){let n=this.findFrameElement(e);n.src=t}findFrameElement(e){var t;let n=e.getAttribute("data-turbo-frame")||this.element.getAttribute("target");return(t=Oe(n))!==null&&t!==void 0?t:this.element}async extractForeignFrameElement(e){let t,n=CSS.escape(this.id);try{if(t=Re(e.querySelector(`turbo-frame#${n}`),this.currentURL))return t;if(t=Re(e.querySelector(`turbo-frame[src][recurse~=${n}]`),this.currentURL))return await t.loaded,await this.extractForeignFrameElement(t);console.error(`Response has no matching <turbo-frame id="${n}"> element`)}catch(i){console.error(i)}return new v}shouldInterceptNavigation(e,t){let n=e.getAttribute("data-turbo-frame")||this.element.getAttribute("target");if(!this.enabled||n=="_top")return!1;if(n){let i=Oe(n);if(i)return!i.disabled}return!(!d.elementDriveEnabled(e)||t&&!d.elementDriveEnabled(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}get reloadable(){return this.findFrameElement(this.element).hasAttribute("reloadable")}set reloadable(e){let t=this.findFrameElement(this.element);e?t.setAttribute("reloadable",""):t.removeAttribute("reloadable")}set sourceURL(e){this.settingSourceURL=!0,this.element.src=e??null,this.currentURL=this.element.src,this.settingSourceURL=!1}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.resolveVisitPromise()!==void 0}get isActive(){return this.element.isActive&&this.connected}};function Oe(r){if(r!=null){let e=document.getElementById(r);if(e instanceof v)return e}}function Re(r,e){if(r){let t=r.getAttribute("src");if(t!=null&&e!=null&&bt(t,e))throw new Error(`Matching <turbo-frame id="${r.id}"> element has a source URL which references itself`);if(r.ownerDocument!==document&&(r=document.importNode(r,!0)),r instanceof v)return r.connectedCallback(),r}}var tr={after(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,r.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.append(this.templateContent))},before(){this.targetElements.forEach(r=>{var e;return(e=r.parentElement)===null||e===void 0?void 0:e.insertBefore(this.templateContent,r)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(r=>r.prepend(this.templateContent))},remove(){this.targetElements.forEach(r=>r.remove())},replace(){this.targetElements.forEach(r=>r.replaceWith(this.templateContent))},update(){this.targetElements.forEach(r=>{r.innerHTML="",r.append(this.templateContent)})}},ke=class extends HTMLElement{async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){var e;return(e=this.renderPromise)!==null&&e!==void 0?e:this.renderPromise=(async()=>{this.dispatchEvent(this.beforeRenderEvent)&&(await B(),this.performAction())})()}disconnect(){try{this.remove()}catch(e){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){var e;let t=this.targetElements.flatMap(i=>[...i.children]).filter(i=>!!i.id),n=[...(e=this.templateContent)===null||e===void 0?void 0:e.children].filter(i=>!!i.id).map(i=>i.id);return t.filter(i=>n.includes(i.id))}get performAction(){if(this.action){let e=tr[this.action];if(e)return e;this.raise("unknown action")}this.raise("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.raise("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.raise("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")}raise(e){throw new Error(`${this.description}: ${e}`)}get description(){var e,t;return(t=((e=this.outerHTML.match(/<[^>]+>/))!==null&&e!==void 0?e:[])[0])!==null&&t!==void 0?t:"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0})}get targetElementsById(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.target);return t!==null?[t]:[]}get targetElementsByQuery(){var e;let t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll(this.targets);return t.length!==0?Array.prototype.slice.call(t):[]}};v.delegateConstructor=Ce;customElements.define("turbo-frame",v);customElements.define("turbo-stream",ke);(()=>{let r=document.currentScript;if(!!r&&!r.hasAttribute("data-turbo-suppress-warning")){for(;r=r.parentElement;)if(r==document.body)return console.warn(te`
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements
——
Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
`,r.outerHTML)}})();window.Turbo=er;Te();var Me=function(){function r(e,t,n){this.eventTarget=e,this.eventName=t,this.eventOptions=n,this.unorderedBindings=new Set}return r.prototype.connect=function(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)},r.prototype.disconnect=function(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)},r.prototype.bindingConnected=function(e){this.unorderedBindings.add(e)},r.prototype.bindingDisconnected=function(e){this.unorderedBindings.delete(e)},r.prototype.handleEvent=function(e){for(var t=rr(e),n=0,i=this.bindings;n<i.length;n++){var s=i[n];if(t.immediatePropagationStopped)break;s.handleEvent(t)}},Object.defineProperty(r.prototype,"bindings",{get:function(){return Array.from(this.unorderedBindings).sort(function(e,t){var n=e.index,i=t.index;return n<i?-1:n>i?1:0})},enumerable:!1,configurable:!0}),r}();function rr(r){if("immediatePropagationStopped"in r)return r;var e=r.stopImmediatePropagation;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation:function(){this.immediatePropagationStopped=!0,e.call(this)}})}var xe=function(){function r(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}return r.prototype.start=function(){this.started||(this.started=!0,this.eventListeners.forEach(function(e){return e.connect()}))},r.prototype.stop=function(){this.started&&(this.started=!1,this.eventListeners.forEach(function(e){return e.disconnect()}))},Object.defineProperty(r.prototype,"eventListeners",{get:function(){return Array.from(this.eventListenerMaps.values()).reduce(function(e,t){return e.concat(Array.from(t.values()))},[])},enumerable:!1,configurable:!0}),r.prototype.bindingConnected=function(e){this.fetchEventListenerForBinding(e).bindingConnected(e)},r.prototype.bindingDisconnected=function(e){this.fetchEventListenerForBinding(e).bindingDisconnected(e)},r.prototype.handleError=function(e,t,n){n===void 0&&(n={}),this.application.handleError(e,"Error "+t,n)},r.prototype.fetchEventListenerForBinding=function(e){var t=e.eventTarget,n=e.eventName,i=e.eventOptions;return this.fetchEventListener(t,n,i)},r.prototype.fetchEventListener=function(e,t,n){var i=this.fetchEventListenerMapForEventTarget(e),s=this.cacheKey(t,n),o=i.get(s);return o||(o=this.createEventListener(e,t,n),i.set(s,o)),o},r.prototype.createEventListener=function(e,t,n){var i=new Me(e,t,n);return this.started&&i.connect(),i},r.prototype.fetchEventListenerMapForEventTarget=function(e){var t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t},r.prototype.cacheKey=function(e,t){var n=[e];return Object.keys(t).sort().forEach(function(i){n.push(""+(t[i]?"":"!")+i)}),n.join(":")},r}();var nr=/^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;function Fe(r){var e=r.trim(),t=e.match(nr)||[];return{eventTarget:ir(t[4]),eventName:t[2],eventOptions:t[9]?sr(t[9]):{},identifier:t[5],methodName:t[7]}}function ir(r){if(r=="window")return window;if(r=="document")return document}function sr(r){return r.split(":").reduce(function(e,t){var n;return Object.assign(e,(n={},n[t.replace(/^!/,"")]=!/^!/.test(t),n))},{})}function Be(r){if(r==window)return"window";if(r==document)return"document"}var Ie=function(){function r(e,t,n){this.element=e,this.index=t,this.eventTarget=n.eventTarget||e,this.eventName=n.eventName||or(e)||G("missing event name"),this.eventOptions=n.eventOptions||{},this.identifier=n.identifier||G("missing identifier"),this.methodName=n.methodName||G("missing method name")}return r.forToken=function(e){return new this(e.element,e.index,Fe(e.content))},r.prototype.toString=function(){var e=this.eventTargetName?"@"+this.eventTargetName:"";return""+this.eventName+e+"->"+this.identifier+"#"+this.methodName},Object.defineProperty(r.prototype,"eventTargetName",{get:function(){return Be(this.eventTarget)},enumerable:!1,configurable:!0}),r}();var Ne={a:function(r){return"click"},button:function(r){return"click"},form:function(r){return"submit"},input:function(r){return r.getAttribute("type")=="submit"?"click":"input"},select:function(r){return"change"},textarea:function(r){return"input"}};function or(r){var e=r.tagName.toLowerCase();if(e in Ne)return Ne[e](r)}function G(r){throw new Error(r)}var qe=function(){function r(e,t){this.context=e,this.action=t}return Object.defineProperty(r.prototype,"index",{get:function(){return this.action.index},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"eventTarget",{get:function(){return this.action.eventTarget},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"eventOptions",{get:function(){return this.action.eventOptions},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),r.prototype.handleEvent=function(e){this.willBeInvokedByEvent(e)&&this.invokeWithEvent(e)},Object.defineProperty(r.prototype,"eventName",{get:function(){return this.action.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"method",{get:function(){var e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error('Action "'+this.action+'" references undefined method "'+this.methodName+'"')},enumerable:!1,configurable:!0}),r.prototype.invokeWithEvent=function(e){try{this.method.call(this.controller,e)}catch(l){var t=this,n=t.identifier,i=t.controller,s=t.element,o=t.index,c={identifier:n,controller:i,element:s,index:o,event:e};this.context.handleError(l,'invoking action "'+this.action+'"',c)}},r.prototype.willBeInvokedByEvent=function(e){var t=e.target;return this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)},Object.defineProperty(r.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"methodName",{get:function(){return this.action.methodName},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),r}();var Ve=function(){function r(e,t){var n=this;this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(function(i){return n.processMutations(i)})}return r.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,childList:!0,subtree:!0}),this.refresh())},r.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},r.prototype.refresh=function(){if(this.started){for(var e=new Set(this.matchElementsInTree()),t=0,n=Array.from(this.elements);t<n.length;t++){var i=n[t];e.has(i)||this.removeElement(i)}for(var s=0,o=Array.from(e);s<o.length;s++){var i=o[s];this.addElement(i)}}},r.prototype.processMutations=function(e){if(this.started)for(var t=0,n=e;t<n.length;t++){var i=n[t];this.processMutation(i)}},r.prototype.processMutation=function(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))},r.prototype.processAttributeChange=function(e,t){var n=e;this.elements.has(n)?this.delegate.elementAttributeChanged&&this.matchElement(n)?this.delegate.elementAttributeChanged(n,t):this.removeElement(n):this.matchElement(n)&&this.addElement(n)},r.prototype.processRemovedNodes=function(e){for(var t=0,n=Array.from(e);t<n.length;t++){var i=n[t],s=this.elementFromNode(i);s&&this.processTree(s,this.removeElement)}},r.prototype.processAddedNodes=function(e){for(var t=0,n=Array.from(e);t<n.length;t++){var i=n[t],s=this.elementFromNode(i);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}},r.prototype.matchElement=function(e){return this.delegate.matchElement(e)},r.prototype.matchElementsInTree=function(e){return e===void 0&&(e=this.element),this.delegate.matchElementsInTree(e)},r.prototype.processTree=function(e,t){for(var n=0,i=this.matchElementsInTree(e);n<i.length;n++){var s=i[n];t.call(this,s)}},r.prototype.elementFromNode=function(e){if(e.nodeType==Node.ELEMENT_NODE)return e},r.prototype.elementIsActive=function(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)},r.prototype.addElement=function(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))},r.prototype.removeElement=function(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))},r}();var je=function(){function r(e,t,n){this.attributeName=t,this.delegate=n,this.elementObserver=new Ve(e,this)}return Object.defineProperty(r.prototype,"element",{get:function(){return this.elementObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selector",{get:function(){return"["+this.attributeName+"]"},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.elementObserver.start()},r.prototype.stop=function(){this.elementObserver.stop()},r.prototype.refresh=function(){this.elementObserver.refresh()},Object.defineProperty(r.prototype,"started",{get:function(){return this.elementObserver.started},enumerable:!1,configurable:!0}),r.prototype.matchElement=function(e){return e.hasAttribute(this.attributeName)},r.prototype.matchElementsInTree=function(e){var t=this.matchElement(e)?[e]:[],n=Array.from(e.querySelectorAll(this.selector));return t.concat(n)},r.prototype.elementMatched=function(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)},r.prototype.elementUnmatched=function(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)},r.prototype.elementAttributeChanged=function(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)},r}();var De=function(){function r(e,t){var n=this;this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(function(i){return n.processMutations(i)})}return r.prototype.start=function(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0}),this.refresh())},r.prototype.stop=function(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)},r.prototype.refresh=function(){if(this.started)for(var e=0,t=this.knownAttributeNames;e<t.length;e++){var n=t[e];this.refreshAttribute(n)}},r.prototype.processMutations=function(e){if(this.started)for(var t=0,n=e;t<n.length;t++){var i=n[t];this.processMutation(i)}},r.prototype.processMutation=function(e){var t=e.attributeName;t&&this.refreshAttribute(t)},r.prototype.refreshAttribute=function(e){var t=this.delegate.getStringMapKeyForAttribute(e);if(t!=null){this.stringMap.has(e)||this.stringMapKeyAdded(t,e);var n=this.element.getAttribute(e);this.stringMap.get(e)!=n&&this.stringMapValueChanged(n,t),n==null?(this.stringMap.delete(e),this.stringMapKeyRemoved(t,e)):this.stringMap.set(e,n)}},r.prototype.stringMapKeyAdded=function(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)},r.prototype.stringMapValueChanged=function(e,t){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t)},r.prototype.stringMapKeyRemoved=function(e,t){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t)},Object.defineProperty(r.prototype,"knownAttributeNames",{get:function(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentAttributeNames",{get:function(){return Array.from(this.element.attributes).map(function(e){return e.name})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"recordedAttributeNames",{get:function(){return Array.from(this.stringMap.keys())},enumerable:!1,configurable:!0}),r}();function q(r,e,t){He(r,e).add(t)}function V(r,e,t){He(r,e).delete(t),ar(r,e)}function He(r,e){var t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function ar(r,e){var t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var C=function(){function r(){this.valuesByKey=new Map}return Object.defineProperty(r.prototype,"values",{get:function(){var e=Array.from(this.valuesByKey.values());return e.reduce(function(t,n){return t.concat(Array.from(n))},[])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){var e=Array.from(this.valuesByKey.values());return e.reduce(function(t,n){return t+n.size},0)},enumerable:!1,configurable:!0}),r.prototype.add=function(e,t){q(this.valuesByKey,e,t)},r.prototype.delete=function(e,t){V(this.valuesByKey,e,t)},r.prototype.has=function(e,t){var n=this.valuesByKey.get(e);return n!=null&&n.has(t)},r.prototype.hasKey=function(e){return this.valuesByKey.has(e)},r.prototype.hasValue=function(e){var t=Array.from(this.valuesByKey.values());return t.some(function(n){return n.has(e)})},r.prototype.getValuesForKey=function(e){var t=this.valuesByKey.get(e);return t?Array.from(t):[]},r.prototype.getKeysForValue=function(e){return Array.from(this.valuesByKey).filter(function(t){var n=t[0],i=t[1];return i.has(e)}).map(function(t){var n=t[0],i=t[1];return n})},r}();var cr=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),en=function(r){cr(e,r);function e(){var t=r.call(this)||this;return t.keysByValue=new Map,t}return Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.keysByValue.keys())},enumerable:!1,configurable:!0}),e.prototype.add=function(t,n){r.prototype.add.call(this,t,n),q(this.keysByValue,n,t)},e.prototype.delete=function(t,n){r.prototype.delete.call(this,t,n),V(this.keysByValue,n,t)},e.prototype.hasValue=function(t){return this.keysByValue.has(t)},e.prototype.getKeysForValue=function(t){var n=this.keysByValue.get(t);return n?Array.from(n):[]},e}(C);var _e=function(){function r(e,t,n){this.attributeObserver=new je(e,t,this),this.delegate=n,this.tokensByElement=new C}return Object.defineProperty(r.prototype,"started",{get:function(){return this.attributeObserver.started},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.attributeObserver.start()},r.prototype.stop=function(){this.attributeObserver.stop()},r.prototype.refresh=function(){this.attributeObserver.refresh()},Object.defineProperty(r.prototype,"element",{get:function(){return this.attributeObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"attributeName",{get:function(){return this.attributeObserver.attributeName},enumerable:!1,configurable:!0}),r.prototype.elementMatchedAttribute=function(e){this.tokensMatched(this.readTokensForElement(e))},r.prototype.elementAttributeValueChanged=function(e){var t=this.refreshTokensForElement(e),n=t[0],i=t[1];this.tokensUnmatched(n),this.tokensMatched(i)},r.prototype.elementUnmatchedAttribute=function(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))},r.prototype.tokensMatched=function(e){var t=this;e.forEach(function(n){return t.tokenMatched(n)})},r.prototype.tokensUnmatched=function(e){var t=this;e.forEach(function(n){return t.tokenUnmatched(n)})},r.prototype.tokenMatched=function(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)},r.prototype.tokenUnmatched=function(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)},r.prototype.refreshTokensForElement=function(e){var t=this.tokensByElement.getValuesForKey(e),n=this.readTokensForElement(e),i=ur(t,n).findIndex(function(s){var o=s[0],c=s[1];return!hr(o,c)});return i==-1?[[],[]]:[t.slice(i),n.slice(i)]},r.prototype.readTokensForElement=function(e){var t=this.attributeName,n=e.getAttribute(t)||"";return lr(n,e,t)},r}();function lr(r,e,t){return r.trim().split(/\s+/).filter(function(n){return n.length}).map(function(n,i){return{element:e,attributeName:t,content:n,index:i}})}function ur(r,e){var t=Math.max(r.length,e.length);return Array.from({length:t},function(n,i){return[r[i],e[i]]})}function hr(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var j=function(){function r(e,t,n){this.tokenListObserver=new _e(e,t,this),this.delegate=n,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}return Object.defineProperty(r.prototype,"started",{get:function(){return this.tokenListObserver.started},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.tokenListObserver.start()},r.prototype.stop=function(){this.tokenListObserver.stop()},r.prototype.refresh=function(){this.tokenListObserver.refresh()},Object.defineProperty(r.prototype,"element",{get:function(){return this.tokenListObserver.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"attributeName",{get:function(){return this.tokenListObserver.attributeName},enumerable:!1,configurable:!0}),r.prototype.tokenMatched=function(e){var t=e.element,n=this.fetchParseResultForToken(e).value;n&&(this.fetchValuesByTokenForElement(t).set(e,n),this.delegate.elementMatchedValue(t,n))},r.prototype.tokenUnmatched=function(e){var t=e.element,n=this.fetchParseResultForToken(e).value;n&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,n))},r.prototype.fetchParseResultForToken=function(e){var t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t},r.prototype.fetchValuesByTokenForElement=function(e){var t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t},r.prototype.parseToken=function(e){try{var t=this.delegate.parseValueForToken(e);return{value:t}}catch(n){return{error:n}}},r}();var We=function(){function r(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}return r.prototype.start=function(){this.valueListObserver||(this.valueListObserver=new j(this.element,this.actionAttribute,this),this.valueListObserver.start())},r.prototype.stop=function(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())},Object.defineProperty(r.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"identifier",{get:function(){return this.context.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"actionAttribute",{get:function(){return this.schema.actionAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"schema",{get:function(){return this.context.schema},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bindings",{get:function(){return Array.from(this.bindingsByAction.values())},enumerable:!1,configurable:!0}),r.prototype.connectAction=function(e){var t=new qe(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)},r.prototype.disconnectAction=function(e){var t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))},r.prototype.disconnectAllActions=function(){var e=this;this.bindings.forEach(function(t){return e.delegate.bindingDisconnected(t)}),this.bindingsByAction.clear()},r.prototype.parseValueForToken=function(e){var t=Ie.forToken(e);if(t.identifier==this.identifier)return t},r.prototype.elementMatchedValue=function(e,t){this.connectAction(t)},r.prototype.elementUnmatchedValue=function(e,t){this.disconnectAction(t)},r}();var Ue=function(){function r(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new De(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap,this.invokeChangedCallbacksForDefaultValues()}return r.prototype.start=function(){this.stringMapObserver.start()},r.prototype.stop=function(){this.stringMapObserver.stop()},Object.defineProperty(r.prototype,"element",{get:function(){return this.context.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"controller",{get:function(){return this.context.controller},enumerable:!1,configurable:!0}),r.prototype.getStringMapKeyForAttribute=function(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name},r.prototype.stringMapValueChanged=function(e,t){this.invokeChangedCallbackForValue(t)},r.prototype.invokeChangedCallbacksForDefaultValues=function(){for(var e=0,t=this.valueDescriptors;e<t.length;e++){var n=t[e],i=n.key,s=n.name,o=n.defaultValue;o!=null&&!this.controller.data.has(i)&&this.invokeChangedCallbackForValue(s)}},r.prototype.invokeChangedCallbackForValue=function(e){var t=e+"Changed",n=this.receiver[t];if(typeof n=="function"){var i=this.receiver[e];n.call(this.receiver,i)}},Object.defineProperty(r.prototype,"valueDescriptors",{get:function(){var e=this.valueDescriptorMap;return Object.keys(e).map(function(t){return e[t]})},enumerable:!1,configurable:!0}),r}();var Q=function(){function r(e,t){this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new We(this,this.dispatcher),this.valueObserver=new Ue(this,this.controller);try{this.controller.initialize()}catch(n){this.handleError(n,"initializing controller")}}return r.prototype.connect=function(){this.bindingObserver.start(),this.valueObserver.start();try{this.controller.connect()}catch(e){this.handleError(e,"connecting controller")}},r.prototype.disconnect=function(){try{this.controller.disconnect()}catch(e){this.handleError(e,"disconnecting controller")}this.valueObserver.stop(),this.bindingObserver.stop()},Object.defineProperty(r.prototype,"application",{get:function(){return this.module.application},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"identifier",{get:function(){return this.module.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dispatcher",{get:function(){return this.application.dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parentElement",{get:function(){return this.element.parentElement},enumerable:!1,configurable:!0}),r.prototype.handleError=function(e,t,n){n===void 0&&(n={});var i=this,s=i.identifier,o=i.controller,c=i.element;n=Object.assign({identifier:s,controller:o,element:c},n),this.application.handleError(e,"Error "+t,n)},r}();function O(r,e){var t=ze(r);return Array.from(t.reduce(function(n,i){return dr(i,e).forEach(function(s){return n.add(s)}),n},new Set))}function Ke(r,e){var t=ze(r);return t.reduce(function(n,i){return n.push.apply(n,fr(i,e)),n},[])}function ze(r){for(var e=[];r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function dr(r,e){var t=r[e];return Array.isArray(t)?t:[]}function fr(r,e){var t=r[e];return t?Object.keys(t).map(function(n){return[n,t[n]]}):[]}var pr=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),mr=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var s=arguments[e],o=0,c=s.length;o<c;o++,i++)n[i]=s[o];return n};function $e(r){return gr(r,vr(r))}function gr(r,e){var t=Er(r),n=br(r.prototype,e);return Object.defineProperties(t.prototype,n),t}function vr(r){var e=O(r,"blessings");return e.reduce(function(t,n){var i=n(r);for(var s in i){var o=t[s]||{};t[s]=Object.assign(o,i[s])}return t},{})}function br(r,e){return wr(e).reduce(function(t,n){var i,s=yr(r,e,n);return s&&Object.assign(t,(i={},i[n]=s,i)),t},{})}function yr(r,e,t){var n=Object.getOwnPropertyDescriptor(r,t),i=n&&"value"in n;if(!i){var s=Object.getOwnPropertyDescriptor(e,t).value;return n&&(s.get=n.get||s.get,s.set=n.set||s.set),s}}var wr=function(){return typeof Object.getOwnPropertySymbols=="function"?function(r){return mr(Object.getOwnPropertyNames(r),Object.getOwnPropertySymbols(r))}:Object.getOwnPropertyNames}(),Er=function(){function r(t){function n(){var i=this&&this instanceof n?this.constructor:void 0;return Reflect.construct(t,arguments,i)}return n.prototype=Object.create(t.prototype,{constructor:{value:n}}),Reflect.setPrototypeOf(n,t),n}function e(){var t=function(){this.a.call(this)},n=r(t);return n.prototype.a=function(){},new n}try{return e(),r}catch(t){return function(n){return function(i){pr(s,i);function s(){return i!==null&&i.apply(this,arguments)||this}return s}(n)}}}();function Je(r){return{identifier:r.identifier,controllerConstructor:$e(r.controllerConstructor)}}var Ge=function(){function r(e,t){this.application=e,this.definition=Je(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}return Object.defineProperty(r.prototype,"identifier",{get:function(){return this.definition.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"controllerConstructor",{get:function(){return this.definition.controllerConstructor},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"contexts",{get:function(){return Array.from(this.connectedContexts)},enumerable:!1,configurable:!0}),r.prototype.connectContextForScope=function(e){var t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()},r.prototype.disconnectContextForScope=function(e){var t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())},r.prototype.fetchContextForScope=function(e){var t=this.contextsByScope.get(e);return t||(t=new Q(this,e),this.contextsByScope.set(e,t)),t},r}();var Qe=function(){function r(e){this.scope=e}return r.prototype.has=function(e){return this.data.has(this.getDataKey(e))},r.prototype.get=function(e){return this.data.get(this.getDataKey(e))},r.prototype.getAttributeName=function(e){return this.data.getAttributeNameForKey(this.getDataKey(e))},r.prototype.getDataKey=function(e){return e+"-class"},Object.defineProperty(r.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),r}();function Xe(r){return r.replace(/(?:[_-])([a-z0-9])/g,function(e,t){return t.toUpperCase()})}function R(r){return r.charAt(0).toUpperCase()+r.slice(1)}function D(r){return r.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()})}var Ye=function(){function r(e){this.scope=e}return Object.defineProperty(r.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),r.prototype.get=function(e){var t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)},r.prototype.set=function(e,t){var n=this.getAttributeNameForKey(e);return this.element.setAttribute(n,t),this.get(e)},r.prototype.has=function(e){var t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)},r.prototype.delete=function(e){if(this.has(e)){var t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1},r.prototype.getAttributeNameForKey=function(e){return"data-"+this.identifier+"-"+D(e)},r}();var Ze=function(){function r(e){this.warnedKeysByObject=new WeakMap,this.logger=e}return r.prototype.warn=function(e,t,n){var i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(n,e))},r}();function x(r,e){return"["+r+'~="'+e+'"]'}var Sr=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var s=arguments[e],o=0,c=s.length;o<c;o++,i++)n[i]=s[o];return n},et=function(){function r(e){this.scope=e}return Object.defineProperty(r.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"schema",{get:function(){return this.scope.schema},enumerable:!1,configurable:!0}),r.prototype.has=function(e){return this.find(e)!=null},r.prototype.find=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.reduce(function(i,s){return i||e.findTarget(s)||e.findLegacyTarget(s)},void 0)},r.prototype.findAll=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.reduce(function(i,s){return Sr(i,e.findAllTargets(s),e.findAllLegacyTargets(s))},[])},r.prototype.findTarget=function(e){var t=this.getSelectorForTargetName(e);return this.scope.findElement(t)},r.prototype.findAllTargets=function(e){var t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)},r.prototype.getSelectorForTargetName=function(e){var t="data-"+this.identifier+"-target";return x(t,e)},r.prototype.findLegacyTarget=function(e){var t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)},r.prototype.findAllLegacyTargets=function(e){var t=this,n=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(n).map(function(i){return t.deprecate(i,e)})},r.prototype.getLegacySelectorForTargetName=function(e){var t=this.identifier+"."+e;return x(this.schema.targetAttribute,t)},r.prototype.deprecate=function(e,t){if(e){var n=this.identifier,i=this.schema.targetAttribute;this.guide.warn(e,"target:"+t,"Please replace "+i+'="'+n+"."+t+'" with data-'+n+'-target="'+t+'". '+("The "+i+" attribute is deprecated and will be removed in a future version of Stimulus."))}return e},Object.defineProperty(r.prototype,"guide",{get:function(){return this.scope.guide},enumerable:!1,configurable:!0}),r}();var Ar=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var s=arguments[e],o=0,c=s.length;o<c;o++,i++)n[i]=s[o];return n},tt=function(){function r(e,t,n,i){var s=this;this.targets=new et(this),this.classes=new Qe(this),this.data=new Ye(this),this.containsElement=function(o){return o.closest(s.controllerSelector)===s.element},this.schema=e,this.element=t,this.identifier=n,this.guide=new Ze(i)}return r.prototype.findElement=function(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)},r.prototype.findAllElements=function(e){return Ar(this.element.matches(e)?[this.element]:[],this.queryElements(e).filter(this.containsElement))},r.prototype.queryElements=function(e){return Array.from(this.element.querySelectorAll(e))},Object.defineProperty(r.prototype,"controllerSelector",{get:function(){return x(this.schema.controllerAttribute,this.identifier)},enumerable:!1,configurable:!0}),r}();var rt=function(){function r(e,t,n){this.element=e,this.schema=t,this.delegate=n,this.valueListObserver=new j(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}return r.prototype.start=function(){this.valueListObserver.start()},r.prototype.stop=function(){this.valueListObserver.stop()},Object.defineProperty(r.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),r.prototype.parseValueForToken=function(e){var t=e.element,n=e.content,i=this.fetchScopesByIdentifierForElement(t),s=i.get(n);return s||(s=this.delegate.createScopeForElementAndIdentifier(t,n),i.set(n,s)),s},r.prototype.elementMatchedValue=function(e,t){var n=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,n),n==1&&this.delegate.scopeConnected(t)},r.prototype.elementUnmatchedValue=function(e,t){var n=this.scopeReferenceCounts.get(t);n&&(this.scopeReferenceCounts.set(t,n-1),n==1&&this.delegate.scopeDisconnected(t))},r.prototype.fetchScopesByIdentifierForElement=function(e){var t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t},r}();var nt=function(){function r(e){this.application=e,this.scopeObserver=new rt(this.element,this.schema,this),this.scopesByIdentifier=new C,this.modulesByIdentifier=new Map}return Object.defineProperty(r.prototype,"element",{get:function(){return this.application.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"schema",{get:function(){return this.application.schema},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"logger",{get:function(){return this.application.logger},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"controllerAttribute",{get:function(){return this.schema.controllerAttribute},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"modules",{get:function(){return Array.from(this.modulesByIdentifier.values())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"contexts",{get:function(){return this.modules.reduce(function(e,t){return e.concat(t.contexts)},[])},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.scopeObserver.start()},r.prototype.stop=function(){this.scopeObserver.stop()},r.prototype.loadDefinition=function(e){this.unloadIdentifier(e.identifier);var t=new Ge(this.application,e);this.connectModule(t)},r.prototype.unloadIdentifier=function(e){var t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)},r.prototype.getContextForElementAndIdentifier=function(e,t){var n=this.modulesByIdentifier.get(t);if(n)return n.contexts.find(function(i){return i.element==e})},r.prototype.handleError=function(e,t,n){this.application.handleError(e,t,n)},r.prototype.createScopeForElementAndIdentifier=function(e,t){return new tt(this.schema,e,t,this.logger)},r.prototype.scopeConnected=function(e){this.scopesByIdentifier.add(e.identifier,e);var t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)},r.prototype.scopeDisconnected=function(e){this.scopesByIdentifier.delete(e.identifier,e);var t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)},r.prototype.connectModule=function(e){this.modulesByIdentifier.set(e.identifier,e);var t=this.scopesByIdentifier.getValuesForKey(e.identifier);t.forEach(function(n){return e.connectContextForScope(n)})},r.prototype.disconnectModule=function(e){this.modulesByIdentifier.delete(e.identifier);var t=this.scopesByIdentifier.getValuesForKey(e.identifier);t.forEach(function(n){return e.disconnectContextForScope(n)})},r}();var X={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target"};var Pr=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function c(f){try{a(n.next(f))}catch(H){o(H)}}function l(f){try{a(n.throw(f))}catch(H){o(H)}}function a(f){f.done?s(f.value):i(f.value).then(c,l)}a((n=n.apply(r,e||[])).next())})},Lr=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(f){return l([a,f])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(s=a[0]&2?i.return:a[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;switch(i=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,i=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1],s=a;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(a);break}s[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(r,t)}catch(f){a=[6,f],i=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},it=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var s=arguments[e],o=0,c=s.length;o<c;o++,i++)n[i]=s[o];return n},Y=function(){function r(e,t){e===void 0&&(e=document.documentElement),t===void 0&&(t=X),this.logger=console,this.element=e,this.schema=t,this.dispatcher=new xe(this),this.router=new nt(this)}return r.start=function(e,t){var n=new r(e,t);return n.start(),n},r.prototype.start=function(){return Pr(this,void 0,void 0,function(){return Lr(this,function(e){switch(e.label){case 0:return[4,Tr()];case 1:return e.sent(),this.dispatcher.start(),this.router.start(),[2]}})})},r.prototype.stop=function(){this.dispatcher.stop(),this.router.stop()},r.prototype.register=function(e,t){this.load({identifier:e,controllerConstructor:t})},r.prototype.load=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=Array.isArray(e)?e:it([e],n);s.forEach(function(o){return t.router.loadDefinition(o)})},r.prototype.unload=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=Array.isArray(e)?e:it([e],n);s.forEach(function(o){return t.router.unloadIdentifier(o)})},Object.defineProperty(r.prototype,"controllers",{get:function(){return this.router.contexts.map(function(e){return e.controller})},enumerable:!1,configurable:!0}),r.prototype.getControllerForElementAndIdentifier=function(e,t){var n=this.router.getContextForElementAndIdentifier(e,t);return n?n.controller:null},r.prototype.handleError=function(e,t,n){this.logger.error(`%s
%o
%o`,t,e,n)},r}();function Tr(){return new Promise(function(r){document.readyState=="loading"?document.addEventListener("DOMContentLoaded",r):r()})}function st(r){var e=O(r,"classes");return e.reduce(function(t,n){return Object.assign(t,Cr(n))},{})}function Cr(r){var e,t=r+"Class";return e={},e[t]={get:function(){var n=this.classes;if(n.has(r))return n.get(r);var i=n.getAttributeName(r);throw new Error('Missing attribute "'+i+'"')}},e["has"+R(t)]={get:function(){return this.classes.has(r)}},e}function ot(r){var e=O(r,"targets");return e.reduce(function(t,n){return Object.assign(t,Or(n))},{})}function Or(r){var e;return e={},e[r+"Target"]={get:function(){var t=this.targets.find(r);if(t)return t;throw new Error('Missing target element "'+this.identifier+"."+r+'"')}},e[r+"Targets"]={get:function(){return this.targets.findAll(r)}},e["has"+R(r)+"Target"]={get:function(){return this.targets.has(r)}},e}function at(r){var e=Ke(r,"values"),t={valueDescriptorMap:{get:function(){var n=this;return e.reduce(function(i,s){var o,c=ct(s),l=n.data.getAttributeNameForKey(c.key);return Object.assign(i,(o={},o[l]=c,o))},{})}}};return e.reduce(function(n,i){return Object.assign(n,Rr(i))},t)}function Rr(r){var e,t=ct(r),n=t.type,i=t.key,s=t.name,o=Fr[n],c=lt[n]||lt.default;return e={},e[s]={get:function(){var l=this.data.get(i);return l!==null?o(l):t.defaultValue},set:function(l){l===void 0?this.data.delete(i):this.data.set(i,c(l))}},e["has"+R(s)]={get:function(){return this.data.has(i)}},e}function ct(r){var e=r[0],t=r[1],n=kr(t);return Mr(e,n)}function kr(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}throw new Error('Unknown value type constant "'+r+'"')}function Mr(r,e){var t=D(r)+"-value";return{type:e,key:t,name:Xe(t),get defaultValue(){return xr[e]}}}var xr={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Fr={array:function(r){var e=JSON.parse(r);if(!Array.isArray(e))throw new TypeError("Expected array");return e},boolean:function(r){return!(r=="0"||r=="false")},number:function(r){return parseFloat(r)},object:function(r){var e=JSON.parse(r);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("Expected object");return e},string:function(r){return r}},lt={default:Br,array:ut,object:ut};function ut(r){return JSON.stringify(r)}function Br(r){return""+r}var Ir=function(){function r(e){this.context=e}return Object.defineProperty(r.prototype,"application",{get:function(){return this.context.application},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"scope",{get:function(){return this.context.scope},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"element",{get:function(){return this.scope.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"identifier",{get:function(){return this.scope.identifier},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"targets",{get:function(){return this.scope.targets},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"classes",{get:function(){return this.scope.classes},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"data",{get:function(){return this.scope.data},enumerable:!1,configurable:!0}),r.prototype.initialize=function(){},r.prototype.connect=function(){},r.prototype.disconnect=function(){},r.blessings=[st,ot,at],r.targets=[],r.values={},r}();var ht=[];var Nr=Y.start();Nr.load(ht);})();
|