1var Ni=Object.defineProperty;var $=(s,e,t)=>()=>{if(t)throw t[0];try{return s&&(e=s(s=0)),e}catch(r){throw t=[r],r}};var Er=(s,e)=>{for(var t in e)Ni(s,t,{get:e[t],enumerable:!0})};var J,Je=$(()=>{J={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0}});var C,de=$(()=>{Je();C={log(...s){this.enabled&&(s.push(Date.now()),J.logger.log("[ActionCable]",...s))}}});var Ee,Qe,Ae,Ze,Rs=$(()=>{de();Ee=()=>new Date().getTime(),Qe=s=>(Ee()-s)/1e3,Ae=class{constructor(e){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=e,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Ee(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),C.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Ee(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),C.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=Ee()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,C.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Ee(),C.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:e,reconnectionBackoffRate:t}=this.constructor,r=Math.pow(1+t,Math.min(this.reconnectAttempts,10)),n=(this.reconnectAttempts===0?1:t)*Math.random();return e*1e3*r*(1+n)}reconnectIfStale(){this.connectionIsStale()&&(C.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${Qe(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?C.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${Qe(this.disconnectedAt)} s`):(C.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return Qe(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&Qe(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(C.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};Ae.staleThreshold=6;Ae.reconnectionBackoffRate=.15;Ze=Ae});var Te,Os=$(()=>{Te={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]}});var Ce,Fs,_n,ii,ke,et,Ps=$(()=>{Je();Rs();Os();de();({message_types:Ce,protocols:Fs}=Te),_n=Fs.slice(0,Fs.length-1),ii=[].indexOf,ke=class{constructor(e){this.open=this.open.bind(this),this.consumer=e,this.subscriptions=this.consumer.subscriptions,this.monitor=new Ze(this),this.disconnected=!0}send(e){return this.isOpen()?(this.webSocket.send(JSON.stringify(e)),!0):!1}open(){if(this.isActive())return C.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let e=[...Fs,...this.consumer.subprotocols||[]];return C.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${e}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new J.WebSocket(this.consumer.url,e),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:e}={allowReconnect:!0}){if(e||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(C.log(`Reopening WebSocket, current state is ${this.get
1State()}`),this.isActive())try{return this.close()}catch(e){C.log("Failed to reopen WebSocket",e)}finally{C.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return ii.call(_n,this.getProtocol())>=0}isState(...e){return ii.call(e,this.getState())>=0}getState(){if(this.webSocket){for(let e in J.WebSocket)if(J.WebSocket[e]===this.webSocket.readyState)return e.toLowerCase()}return null}installEventHandlers(){for(let e in this.events){let t=this.events[e].bind(this);this.webSocket[`on${e}`]=t}}uninstallEventHandlers(){for(let e in this.events)this.webSocket[`on${e}`]=function(){}}};ke.reopenDelay=500;ke.prototype.events={message(s){if(!this.isProtocolSupported())return;let{identifier:e,message:t,reason:r,reconnect:i,type:n}=JSON.parse(s.data);switch(this.monitor.recordMessage(),n){case Ce.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case Ce.disconnect:return C.log(`Disconnecting. Reason: ${r}`),this.close({allowReconnect:i});case Ce.ping:return null;case Ce.confirmation:return this.subscriptions.confirmSubscription(e),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(e,"connected",{reconnected:!0})):this.subscriptions.notify(e,"connected",{reconnected:!1});case Ce.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",t)}},open(){if(C.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return C.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(s){if(C.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){C.log("WebSocket onerror event")}};et=ke});var Un,te,xs=$(()=>{Un=function(s,e){if(e!=null)for(let t in e){let r=e[t];s[t]=r}return s},te=class{constructor(e,t={},r){this.consumer=e,this.identifier=JSON.stringify(t),Un(this,r)}perform(e,t={}){return t.action=e,this.send(t)}send(e){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(e)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}});var Is,tt,Bs=$(()=>{de();Is=class{constructor(e){this.subscriptions=e,this.pendingSubscriptions=[]}guarantee(e){this.pendingSubscriptions.indexOf(e)==-1?(C.log(`SubscriptionGuarantor guaranteeing ${e.identifier}`),this.pendingSubscriptions.push(e)):C.log(`SubscriptionGuarantor already guaranteeing ${e.identifier}`),this.startGuaranteeing()}forget(e){C.log(`SubscriptionGuarantor forgetting ${e.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(t=>t!==e)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(e=>{C.log(`SubscriptionGuarantor resubscribing ${e.identifier}`),this.subscriptions.subscribe(e)})},500)}},tt=Is});var se,Ns=$(()=>{de();xs();Bs();se=class{constructor(e){this.consumer=e,this.guarantor=new tt(this),this.subscriptions=[]}create(e,t){let r=e,i=typeof r=="object"?r:{channel:r},n=new te(this.consumer,i,t);return this.add(n)}add(e){return this.subscriptions.push(e),this.consumer.ensureActiveConnection(),this.notify(e,"initialized"),this.subscribe(e),e}remove(e){return this.forget(e),this.findAll(e.identifier).length||this.sendCommand(e,"unsubscribe"),e}reject(e){return this.findAll(e).map(t=>(this.forget(t),this.notify(t,"rejected"),t))}forget(e){return this.guarantor.forget(e),this.subscriptions=this.subscriptions.filter(t=>t!==e),e}findAll(e){return this.subscriptions.filter(t=>t.identifier===e)}reload(){return this.subscriptions.map(e=>this.subscribe(e))}notifyAll(e,...t){return this.subscriptions.map(r=>this.notify(r,e,...t))}notify(e,t,...r){let i;return typeof e=="string"?i=this.findAll(e):i=[e],i.map(n=>typeof n[t]=="function"?n[t](...r):void 0)}subscribe(e){this.sendCommand(e,"subscribe")&&this.guarantor.guarantee(e)}confirmSubscription(e){C.log(`Subscription confirmed ${e}`),this.findAll(e).map(t=>this.guarantor.forget(t))}sendCommand(e,t){let{identifier:r}=e;return this.consumer.send({command:t,identifier:r})}}});
1function Ds(s){if(typeof s=="function"&&(s=s()),s&&!/^wss?:/i.test(s)){let e=document.createElement("a");return e.href=s,e.href=e.href,e.protocol=e.protocol.replace("http","ws"),e.href}else return s}var me,ni=$(()=>{Ps();Ns();me=class{constructor(e){this._url=e,this.subscriptions=new se(this),this.connection=new et(this),this.subprotocols=[]}get url(){return Ds(this._url)}send(e){return this.connection.send(e)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(e){this.subprotocols=[...this.subprotocols,e]}}});var ai={};Er(ai,{Connection:()=>et,ConnectionMonitor:()=>Ze,Consumer:()=>me,INTERNAL:()=>Te,Subscription:()=>te,SubscriptionGuarantor:()=>tt,Subscriptions:()=>se,adapters:()=>J,createConsumer:()=>qs,createWebSocketURL:()=>Ds,getConfig:()=>oi,logger:()=>C});function qs(s=oi("url")||Te.default_mount_path){return new me(s)}function oi(s){let e=document.head.querySelector(`meta[name='action-cable-${s}']`);if(e)return e.getAttribute("content")}var Vs=$(()=>{Je();Ps();Rs();ni();Os();de();xs();Bs();Ns()});var Ms={};Er(Ms,{FetchEnctype:()=>K,FetchMethod:()=>N,FetchRequest:()=>Y,FetchResponse:()=>ce,FrameElement:()=>D,FrameLoadingStyle:()=>Z,FrameRenderer:()=>he,PageRenderer:()=>ue,PageSnapshot:()=>q,StreamActions:()=>Ls,StreamElement:()=>ze,StreamSourceElement:()=>Ke,cache:()=>Gr,config:()=>F,connectStreamSource:()=>we,disconnectStreamSource:()=>Se,fetch:()=>Cs,fetchEnctypeFromString:()=>$r,fetchMethodFromString:()=>Ge,isSafe:()=>Ye,morphBodyElements:()=>si,morphChildren:()=>Xe,morphElements:()=>ye,morphTurboFrameElements:()=>ri,navigator:()=>Yr,registerAdapter:()=>Xr,renderStreamMessage:()=>Qr,session:()=>O,setConfirmMethod:()=>ei,setFormMode:()=>ti,setProgressBarDelay:()=>Zr,start:()=>ks,visit:()=>Jr});var Z={eager:"eager",lazy:"lazy"},D=class s extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new s.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return Di(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function Di(s){return s.toLowerCase()==="lazy"?Z.lazy:Z.eager}var qi={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function ge(s){if(s.getAttribute("data-turbo-eval")=="false")return s;{let e=document.createElement("script"),t=Ir();return t&&(e.nonce=t),e.textContent=s.textContent,e.async=!1,Vi(e,s),e}}function Vi(s,e){for(let{name:t,value:r}of e.attributes)s.setAttribute(t,r)}function Hi(s){let e=document.createElement("template");return e.innerHTML=s,e.content}
1function R(s,{target:e,cancelable:t,detail:r}={}){let i=new CustomEvent(s,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(i):document.documentElement.dispatchEvent(i),i}function Ar(s){s.preventDefault(),s.stopImmediatePropagation()}function fe(){return document.visibilityState==="hidden"?Or():Rr()}function Rr(){return new Promise(s=>requestAnimationFrame(()=>s()))}function Or(){return new Promise(s=>setTimeout(()=>s(),0))}function Fr(s=""){return new DOMParser().parseFromString(s,"text/html")}function Pr(s,...e){let t=$i(s,e).replace(/^\n/,"").split(` 2`),r=t[0].match(/^\s+/),i=r?r[0].length:0;return t.map(n=>n.slice(i)).join(` 3`)}function $i(s,e){return s.reduce((t,r,i)=>{let n=e[i]==null?"":e[i];return t+r+n},"")}function G(){return Array.from({length:36}).map((s,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*16).toString(16)).join("")}function xe(s,...e){for(let t of e.map(r=>r?.getAttribute(s)))if(typeof t=="string")return t;return null}function Wi(s,...e){return e.some(t=>t&&t.hasAttribute(s))}function Ie(...s){for(let e of s)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function Be(...s){for(let e of s)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function _i(s,e=2e3){return new Promise(t=>{let r=()=>{s.removeEventListener("error",r),s.removeEventListener("load",r),t()};s.addEventListener("load",r,{once:!0}),s.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function xr(s){switch(s){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Ui(s){return s=="advance"||s=="replace"||s=="restore"}function ee(...s){let e=xe("data-turbo-action",...s);return Ui(e)?e:null}function Es(s){return document.querySelector(`meta[name="${s}"]`)}function Ne(s){let e=Es(s);return e&&e.content}function Ir(){let s=Es("csp-nonce");if(s){let{nonce:e,content:t}=s;return e==""?t:e}}
3function ji(s,e){let t=Es(s);return t||(t=document.createElement("meta"),t.setAttribute("name",s),document.head.appendChild(t)),t.setAttribute("content",e),t}function oe(s,e){if(s instanceof Element)return s.closest(e)||oe(s.assignedSlot||s.getRootNode()?.host,e)}function As(s){return!!s&&s.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof s.focus=="function"}function Br(s){return Array.from(s.querySelectorAll("[autofocus]")).find(As)}async function zi(s,e){let t=e();s(),await Rr();let r=e();return[t,r]}function Nr(s){if(s==="_blank")return!1;if(s){for(let e of document.getElementsByName(s))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Dr(s){let e=oe(s,"a[href], a[xlink\\:href]");if(!e||e.href.startsWith("#")||e.hasAttribute("download"))return null;let t=e.getAttribute("target");return t&&t!=="_self"?null:e}function Ki(s,e){let t=null;return(...r)=>{let i=()=>s.apply(this,r);clearTimeout(t),t=setTimeout(i,e)}}var Gi={"aria-disabled":{beforeSubmit:s=>{s.setAttribute("aria-disabled","true"),s.addEventListener("click",Ar)},afterSubmit:s=>{s.removeAttribute("aria-disabled"),s.removeEventListener("click",Ar)}},disabled:{beforeSubmit:s=>s.disabled=!0,afterSubmit:s=>s.disabled=!1}},Gt=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=Gi[e]||e}},Yi=new Gt({mode:"on",submitter:"disabled"}),F={drive:qi,forms:Yi};function x(s){return new URL(s.toString(),document.baseURI)}function pe(s){let e;if(s.hash)return s.hash.slice(1);if(e=s.href.match(/#(.*)$/))return e[1]}function Ts(s,e){let t=e?.getAttribute("formaction")||s.getAttribute("action")||s.action;return x(t)}function Xi(s){return(en(s).match(/\.[^.]*$/)||[])[0]||""}function Ji(s,e){let t=Tr(e.origin+e.pathname);return Tr(s.href)===t||s.href.startsWith(t)}function z(s,e){return Ji(s,e)&&!F.drive.unvisitableExtensions.has(Xi(s))}function qr(s){return x(s.getAttribute("href")||"")}function Qi(s){let e=pe(s);return e!=null?s.href.slice(0,-(e.length+1)):s.href}function Pe(s){return Qi(s)}function Vr(s,e){return x(s).href==x(e).href}function Zi(s){return s.pathname.split("/").slice(1)}function en(s){return Zi(s).slice(-1)[0]}function Tr(s){return s.endsWith("/")?s:s+"/"}var ce=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return x(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},Yt=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Hr=new Yt(20);function Cs(s,e={}){let t=new Headers(e.headers||{}),r=G();return Hr.add(r),t.append("X-Turbo-Request-Id",r),window.fetch(s,{...e,headers:t})}function Ge(s){switch(s.toLowerCase()){case"get":return N.get;case"post":return N.post;case"put":return N.put;case"patch":return N.patch;case"delete":return N.delete}}var N={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function $r(s){switch(s.toLowerCase()){case K.multipart:return K.multipart;case K.plain:return K.plain;default:return K.urlEncoded}}var K={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Y=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,i=new URLSearchParams,n=null,c=K.urlEncoded){let[m,S]=Cr(x(r),t,i,c);this.delegate=e,this.url=m,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders}
3,body:S,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=c}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Ge(e)||N.get;this.url.search="";let[i,n]=Cr(this.url,r,t,this.enctype);this.url=i,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Cs(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#s(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new ce(e);return R("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Ye(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(i=>this.#e=i),r=R("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#s(e){return!R("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function Ye(s){return Ge(s)==N.get}function Cr(s,e,t,r){let i=Array.from(t).length>0?new URLSearchParams(Wr(t)):s.searchParams;return Ye(e)?[tn(s,i),null]:r==K.urlEncoded?[s,i]:[s,t]}function Wr(s){let e=[];for(let[t,r]of s)r instanceof File||e.push([t,r]);return e}function tn(s,e){let t=new URLSearchParams(Wr(e));return s.search=t.toString(),s}var Xt=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},X=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(Hi(e)):e}constructor(e){this.fragment=sn(e)}};function sn(s){for(let e of s.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(ge(r));e.replaceWith(t)}return s}var rn=s=>s,De=class{keys=[];entries={};#e;constructor(e,t=rn){this.size=e,this.#e=t}has(e){return this.#e(e)in this.entries}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){for(let e of Object.keys(this.entries))this.evict(e)}read(e){return this.entries[this.#e(e)]}write(e,t){this.entries[this.#e(e)]=t}touch(e){e=this.#e(e);let t=this.keys.indexOf(e);t>-1&&this.keys.splice(t,1),this.keys.unshift(e),this.trim()}trim(){for(let e of this.keys.splice(this.size))this.evict(e)}evict(e){delete this.entries[e]}},nn=100,Jt=class extends De{#e=null;#t={};constructor(e=1,t=nn){super(e,Pe),this.prefetchDelay=t}putLater(e,t,r){this.#e=setTimeout(()=>{t.perform(),this.put(e,t,r),this.#e=null},this.prefetchDelay)}put(e,t,r=_r){super.put(e,t),this.#t[Pe(e)]=new Date(new Date().getTime()+r)}clear(){super.clear(),this.#e&&clearTimeout(this.#e)}evict(e){super.evict(e),delete this.#t[e]}has(e){if(super.has(e)){let t=this.#t[Pe(e)];return t&&t>Date.now()}else return!1}},_r=10*1e3,ne=new Jt,ie={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},qe=class s{state=ie.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,i=!1){let n=un(t,r),c=hn(ln(t,r),n),m=on(t,r),S=dn(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new Y(this,n,c,m,t,S),this.mustRedirect=i}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=x(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=ie,r=xe("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof F.forms.confirm=="function"?F.forms.confirm:s.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=ie;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=an(Ne("csrf-param"))||Ne("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(X.contentType)}requestStarted(e){this.state=ie.waiting,this.submitter&&F.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Ie(this.formElement),R("turbo:submit-start",{target:this.formElement,detail
3:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){ne.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(ne.clear(),this.requestMustRedirect(e)&&cn(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=ie.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=ie.stopped,this.submitter&&F.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),Be(this.formElement),R("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Wi("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function on(s,e){let t=new FormData(s),r=e?.getAttribute("name"),i=e?.getAttribute("value");return r&&t.append(r,i||""),t}function an(s){if(s!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(s));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function cn(s){return s.statusCode==200&&!s.redirected}function ln(s,e){let t=typeof s.action=="string"?s.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":s.getAttribute("action")||t||""}function hn(s,e){let t=x(s);return Ye(e)&&(t.search=""),t}function un(s,e){let t=e?.getAttribute("formmethod")||s.getAttribute("method")||"";return Ge(t.toLowerCase())||N.get}function dn(s,e){return $r(e?.getAttribute("formenctype")||s.enctype)}var le=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Br(this.element)}get permanentElements(){return jr(this.element)}getPermanentElementById(e){return Ur(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:i}=r,n=e.getPermanentElementById(i);n&&(t[i]=[r,n])}return t}};function Ur(s,e){return s.querySelector(`#${e}[data-turbo-permanent]`)}function jr(s){return s.querySelectorAll("[id][data-turbo-permanent]")}var be=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&mn(t,r)&&fn(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function mn(s,e){return(e?.getAttribute("formmethod")||s.getAttribute("method"))!="dialog"}function fn(s,e){let t=e?.getAttribute("formtarget")||s.getAttribute("target");return Nr(t)}var Ve=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.focusElement(t),this.scrollToElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(pe(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}
3async render(e){let{isPreview:t,shouldRender:r,willRender:i,newSnapshot:n}=e,c=i;if(r)try{this.renderPromise=new Promise(I=>this.#e=I),this.renderer=e,await this.prepareToRenderSnapshot(e);let m=new Promise(I=>this.#t=I),S={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,S)||await m,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else c&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Qt=class extends Ve{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new le(this.element)}},He=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=Dr(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},$e=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=Dr(t);if(r&&Nr(r.target)){let i=qr(r);this.delegate.willFollowLinkToLocation(r,i,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,i))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},We=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new $e(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),i="hidden";for(let[j,b]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:i,name:j,value:b}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let c=e.getAttribute("data-turbo-method");c&&r.setAttribute("method",c);let m=e.getAttribute("data-turbo-frame");m&&r.setAttribute("data-turbo-frame",m);let S=ee(e);S&&r.setAttribute("data-turbo-action",S);let P=e.getAttribute("data-turbo-confirm");P&&r.setAttribute("data-turbo-confirm",P),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},_e=class{static async preservingPermanentElements(e,t,r){let i=new this(e,t);i.enter(),await r(),i.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=pn(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function pn(s){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",s.id),e}var ve=class{#e=null;static renderElement(e,t){}
3constructor(e,t,r,i=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=i,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,c)=>this.resolvingFunctions={resolve:n,reject:c})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await _e.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},he=class extends ve{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let i=t,n=i.ownerDocument?.createRange();n&&(n.selectNodeContents(i),e.appendChild(n.extractContents()))}constructor(e,t,r,i,n,c=!0){super(t,r,i,n,c),this.delegate=e}get shouldRender(){return!0}async render(){await fe(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await fe(),this.focusFirstAutofocusableElement(),await fe(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=gn(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=bn(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=ge(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function gn(s,e){return s=="end"||s=="start"||s=="center"||s=="nearest"?s:e}function bn(s,e){return s=="auto"||s=="smooth"?s:e}var vn=(function(){let s=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:s,afterNodeAdded:s,beforeNodeMorphed:s,afterNodeMorphed:s,beforeNodeRemoved:s,afterNodeRemoved:s,beforeAttributeUpdated:s},head:{style:"merge",shouldPreserve:b=>b.getAttribute("im-preserve")==="true",shouldReAppend:b=>b.getAttribute("im-re-append")==="true",shouldRemove:s,afterHeadMorphed:s},restoreFocus:!0};function t(b,M,w={}){b=I(b);let T=j(M),E=P(b,T,w),v=i(E,()=>m(E,b,T,l=>l.morphStyle==="innerHTML"?(n(l,b,T),Array.from(b.childNodes)):r(l,b,T)));return E.pantry.remove(),v}function r(b,M,w){let T=j(M);return n(b,T,w,M,M.nextSibling),Array.from(T.childNodes)}function i(b,M){if(!b.config.restoreFocus)return M();let w=document.activeElement;if(!(w instanceof HTMLInputElement||w instanceof HTMLTextAreaElement))return M();let{id:T,selectionStart:E,selectionEnd:v}=w,l=M();return T&&T!==document.activeElement?.getAttribute("id")&&(w=b.target.querySelector(`[id="${T}"]`),w?.focus()),w&&!w.selectionEnd&&v&&w.setSelectionRange(E,v),l}let n=(function(){function b(o,a,u,h=null,p=null){a instanceof HTMLTemplateElement&&u instanceof HTMLTemplateElement&&(a=a.content,u=u.content),h||=a.firstChild;for(let g of u.childNodes){if(h&&h!=p){let k=w(o,g,h,p);if(k){k!==h&&E(o,h,k),c(k,g,o),h=k.nextSibling;continue}}if(g instanceof Element){let k=g.getAttribute("id");if(o.persistentIds.has(k)){let W=v(a,k,h,o);c(W,g,o),h=W.nextSibling;continue}}let y=M(a,g,h,o);y&&(h=y.nextSibling)}for(;h&&h!=p;){let g=h;h=h.nextSibling,T(o,g)}}function M(o,a,u,h){if(h.callbacks.beforeNodeAdded(a)===!1)return null;if(h.idMap.has(a)){let p=document.createElement(a.tagName);return o.insertBefore(p,u),c(p,a,h),h.callbacks.afterNodeAdded(p),p}else{let p=document.importNode(a,!0);return o.insertBefore(p,u),h.callbacks.afterNodeAdded(p),p}}
3let w=(function(){function o(h,p,g,y){let k=null,W=p.nextSibling,Sr=0,H=g;for(;H&&H!=y;){if(u(H,p)){if(a(h,H,p))return H;k===null&&(h.idMap.has(H)||(k=H))}if(k===null&&W&&u(H,W)&&(Sr++,W=W.nextSibling,Sr>=2&&(k=void 0)),h.activeElementAndParents.includes(H))break;H=H.nextSibling}return k||null}function a(h,p,g){let y=h.idMap.get(p),k=h.idMap.get(g);if(!k||!y)return!1;for(let W of y)if(k.has(W))return!0;return!1}function u(h,p){let g=h,y=p;return g.nodeType===y.nodeType&&g.tagName===y.tagName&&(!g.getAttribute?.("id")||g.getAttribute?.("id")===y.getAttribute?.("id"))}return o})();function T(o,a){if(o.idMap.has(a))f(o.pantry,a,null);else{if(o.callbacks.beforeNodeRemoved(a)===!1)return;a.parentNode?.removeChild(a),o.callbacks.afterNodeRemoved(a)}}function E(o,a,u){let h=a;for(;h&&h!==u;){let p=h;h=h.nextSibling,T(o,p)}return h}function v(o,a,u,h){let p=h.target.getAttribute?.("id")===a&&h.target||h.target.querySelector(`[id="${a}"]`)||h.pantry.querySelector(`[id="${a}"]`);return l(p,h),f(o,p,u),p}function l(o,a){let u=o.getAttribute("id");for(;o=o.parentNode;){let h=a.idMap.get(o);h&&(h.delete(u),h.size||a.idMap.delete(o))}}function f(o,a,u){if(o.moveBefore)try{o.moveBefore(a,u)}catch{o.insertBefore(a,u)}else o.insertBefore(a,u)}return b})(),c=(function(){function b(l,f,o){return o.ignoreActive&&l===document.activeElement?null:(o.callbacks.beforeNodeMorphed(l,f)===!1||(l instanceof HTMLHeadElement&&o.head.ignore||(l instanceof HTMLHeadElement&&o.head.style!=="morph"?S(l,f,o):(M(l,f,o),v(l,o)||n(o,l,f))),o.callbacks.afterNodeMorphed(l,f)),l)}function M(l,f,o){let a=f.nodeType;if(a===1){let u=l,h=f,p=u.attributes,g=h.attributes;for(let y of g)E(y.name,u,"update",o)||u.getAttribute(y.name)!==y.value&&u.setAttribute(y.name,y.value);for(let y=p.length-1;0<=y;y--){let k=p[y];if(k&&!h.hasAttribute(k.name)){if(E(k.name,u,"remove",o))continue;u.removeAttribute(k.name)}}v(u,o)||w(u,h,o)}(a===8||a===3)&&l.nodeValue!==f.nodeValue&&(l.nodeValue=f.nodeValue)}function w(l,f,o){if(l instanceof HTMLInputElement&&f instanceof HTMLInputElement&&f.type!=="file"){let a=f.value,u=l.value;T(l,f,"checked",o),T(l,f,"disabled",o),f.hasAttribute("value")?u!==a&&(E("value",l,"update",o)||(l.setAttribute("value",a),l.value=a)):E("value",l,"remove",o)||(l.value="",l.removeAttribute("value"))}else if(l instanceof HTMLOptionElement&&f instanceof HTMLOptionElement)T(l,f,"selected",o);else if(l instanceof HTMLTextAreaElement&&f instanceof HTMLTextAreaElement){let a=f.value,u=l.value;if(E("value",l,"update",o))return;a!==u&&(l.value=a),l.firstChild&&l.firstChild.nodeValue!==a&&(l.firstChild.nodeValue=a)}}function T(l,f,o,a){let u=f[o],h=l[o];if(u!==h){let p=E(o,l,"update",a);p||(l[o]=f[o]),u?p||l.setAttribute(o,""):E(o,l,"remove",a)||l.removeAttribute(o)}}function E(l,f,o,a){return l==="value"&&a.ignoreActiveValue&&f===document.activeElement?!0:a.callbacks.beforeAttributeUpdated(l,f,o)===!1}function v(l,f){return!!f.ignoreActiveValue&&l===document.activeElement&&l!==document.body}return b})();function m(b,M,w,T){if(b.head.block){let E=M.querySelector("head"),v=w.querySelector("head");if(E&&v){let l=S(E,v,b);return Promise.all(l).then(()=>{let f=Object.assign(b,{head:{block:!1,ignore:!0}});return T(f)})}}return T(b)}function S(b,M,w){let T=[],E=[],v=[],l=[],f=new Map;for(let a of M.children)f.set(a.outerHTML,a);for(let a of b.children){let u=f.has(a.outerHTML),h=w.head.shouldReAppend(a),p=w.head.shouldPreserve(a);u||p?h?E.push(a):(f.delete(a.outerHTML),v.push(a)):w.head.style==="append"?h&&(E.push(a),l.push(a)):w.head.shouldRemove(a)!==!1&&E.push(a)}l.push(...f.values());let o=[];for(let a of l){let u=document.createRange().createContextualFragment(a.outerHTML).firstChild;if(w.callbacks.beforeNodeAdded(u)!==!1){if("href"in u&&u.href||"src"in u&&u.src){let h,p=new Promise(function(g){h=g});u.addEventListener("load",function(){h()}),o.push(p)}b.appendChild(u),w.callbacks.afterNodeAdded(u),T.push(u)}}for(let a of E)w.callbacks.beforeNodeRemoved(a)!==!1&&(b.removeChild(a),w.callbacks.afterNodeRemoved(a));return w.head.afterHeadMorphed(b,{added:T,kept:v,removed:E}),o}let P=(function(){function b(o,a,u){let{persistentIds:h,idMap:p}=l(o,a),g=M(u),y=g.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(y))throw`Do not understand how to morph style ${y}`;return{target:o,newContent:a,config:g,morphStyle:y,ignoreActive:g.ignoreActive,ignoreActiveValue:g.ignoreActiveValue,restoreFocus:g.restoreFocus,idMap:p,persistentIds:h,pantry:w(),activeElementAndParents:T(o),callbacks:g.callbacks,head:g.head}}function M(o){let a=Object.assign({},e);return Object.assign(a,o),a.callbacks=Object.assign({},e.callbacks,o.callbacks),a.head=Object.assign({},e.head,o.head),a}function w(){let o=document.createElement("div");return o.hidden=!0,document.body.insertAdjacentElement("afterend",o),o}function T(o){let a=[],u=document.activeElement;if(u?.tagName!=="BODY"&&o.contains(u))for(;u&&(a.push(u),u!==o);)u=u.parentElement;return a}function E(o){let a=Array.from(o.querySelectorAll("[id]"));return o.getAttribute?.("id")&&a.push(o),a}function v(o,a,u,h){for(let p of h){let g=p.getAttribute("id");if(a.has(g)){let y=p;for(;y;){let k=o.get(y);if(k==null&&(k=new Set,o.set(y,k)),k.add(g),y===u)break;y=y.parentElement}}}}function l(o,a){let u=E(o),h=E(a),p=f(u,h),g=new Map;v(g,p,o,u);let y=a.__idiomorphRoot||a;return v(g,p,y,h),{persistentIds:p,idMap:g}}function f(o,a){let u=new Set,h=new Map;for(let{id:g,tagName:y}of o)h.has(g)?u.add(g):h.set(g,y);let p=new Set;for(let{id:g,tagName:y}of a)p.has(g)?u.add(g):h.get(g)===y&&p.add(g);for(let g of u)p.delete(g);return p}return b})(),{normalizeElement:I,normalizeParent:j}=(function(){let b=new WeakSet;function M(v){return v instanceof Document?v.documentElement:v}function w(v){if(v==null)return document.createElement("div");if(typeof v=="string")return w(E(v));if(b.has(v))return v;if(v instanceof Node){if(v.parentNode)return new T(v);{let l=document.createElement("div");return l.append(v),l}}else{let l=document.createElement("div");for(let f of[...v])l.append(f);return l}}class T{constructor(l){this.originalNode=l,this.realParentNode=l.parentNode,this.previousSibling=l.previousSibling,this.nextSibling=l.nextSibling}get childNodes(){let l=[],f=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;f&&f!=this.nextSibling;)l.push(f),f=f.nextSibling;return l}querySelectorAll(l){return this.childNodes.reduce((f,o)=>{if(o instanceof Element){o.matches(l)&&f.push(o);let a=o.querySelectorAll(l);for(let u=0;u<a.length;u++)f.push(a[u])}return f},[])}insertBefore(l,f){return this.realParentNode.insertBefore(l,f)}moveBefore(l,f){return this.realParentNode.moveBefore(l,f)}get __idiomorphRoot(){return this.originalNode}}function E(v){let l=new DOMParser,f=v.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(f.match(/<\/html>/)||f.match(/<\/head>/)||f.match(/<\/body>/)){let o=l.parseFromString(v,"text/html");if(f.match(/<\/html>/))return b.add(o),o;{let a=o.firstChild;return a&&b.add(a),a}}else{let a=l.parseFromString("<body><template>"+v+"</template></body>","text/html").body.querySelector("template").content;return b.add(a),a}}return{normalizeElement:M,normalizeParent:w}})();return{morph:t,defaults:e}})();function ye(s,e,{callbacks:t,...r}={}){vn.morph(s,e,{...r,callbacks:new Zt(t)})}function Xe(s,e,t={}){ye(s,e.childNodes,{...t,morphStyle:"innerHTML"})}function zr(s,e){return s instanceof D&&s.shouldReloadWithMorph&&(!e||yn(s,e))&&!s.closest("[data-turbo-permanent]")}function yn(s,e){return e instanceof Element&&e.nodeName==="TURBO-FRAME"&&s.id===e.id&&(!e.getAttribute("src")||Vr(s.src,e.getAttribute("src")))}function Kr(s){return s.parentElement.closest("turbo-frame[src][refresh=morph]")}var Zt=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!R("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!R("turbo:before-morph-attribute",{cancelable:!0,target:t,detail
3:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&R("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},Ue=class extends he{static renderElement(e,t){R("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),Xe(e,t,{callbacks:{beforeNodeMorphed:(r,i)=>zr(r,i)&&Kr(r)===e?(r.reload(),!1):!0}})}async preservingPermanentElements(e){return await e()}},es=class s{static animationDuration=300;static get defaultCSS(){return Pr` 4 .turbo-progress-bar { 5 position: fixed; 6 display: block; 7 top: 0; 8 left: 0; 9 height: 3px; 10 background: #0076ff; 11 z-index: 2147483647; 12 transition: 13 width ${s.animationDuration}ms ease-out, 14 opacity ${s.animationDuration/2}ms ${s.animationDuration/2}ms ease-in; 15 transform: translate3d(0, 0, 0); 16 } 17 `}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,s.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,s.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=s.defaultCSS;let t=Ir();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},ts=class extends le{detailsByOuterHTML=this.children.filter(e=>!An(e)).map(e=>kn(e)).reduce((e,t)=>{let{outerHTML:r}=t,i=r in e?e[r]:{type:wn(t),tracked:Sn(t),elements:[]};return{...e,[r]:{...i,elements:[...i.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:i,elements:n}=this.detailsByOuterHTML[t];return r==null&&!i?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[i]}=this.detailsByOuterHTML[r];return Cn(i,e)?i:t},void 0|void 0)}};function wn(s){if(En(s))return"script";if(Tn(s))return"stylesheet"}function Sn(s){return s.getAttribute("data-turbo-track")=="reload"}function En(s){return s.localName=="script"}function An(s){return s.localName=="noscript"}function Tn(s){let e=s.localName;return e=="style"||e=="link"&&s.getAttribute("rel")=="stylesheet"}function Cn(s,e){return s.localName=="meta"&&s.getAttribute("name")==e}function kn(s){return s.hasAttribute("nonce")&&s.setAttribute("nonce",""),s}var q=class s extends le{static fromHTMLString(e=""){return this.fromDocument(Fr(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new ts(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[i,n]of t.entries()){let c=r[i];for(let m of c.selectedOptions)m.selected=!1;for(let m of n.selectedOptions)c.options[m.index].selected=!0}for(let i of e.querySelectorAll('input[type="password"]'))i.value="";for(let i of e.querySelectorAll("noscript"))i.remove();return new s(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get dir(){return this.documentElement.getAttribute("dir")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return x(e)}
17get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return(this.getSetting("view-transition")==="true"||this.headSnapshot.getMetaValue("view-transition")==="same-origin")&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches}get refreshMethod(){return this.getSetting("refresh-method")}get refreshScroll(){return this.getSetting("refresh-scroll")}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},ss=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Ln={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1,refresh:{}},Fe={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},_={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ae={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Mn={advance:"forward",restore:"back",replace:"none"},rs=class{identifier=G();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=_.initialized;viewTransitioner=new ss;constructor(e,t,r,i={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||G();let{action:n,historyChanged:c,referrer:m,snapshot:S,snapshotHTML:P,response:I,visitCachedSnapshot:j,willRender:b,updateHistory:M,shouldCacheSnapshot:w,acceptsStreamResponse:T,direction:E,refresh:v}={...Ln,...i};this.action=n,this.historyChanged=c,this.referrer=m,this.snapshot=S,this.snapshotHTML=P,this.response=I,this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=j,this.willRender=b,this.updateHistory=M,this.scrolled=!b,this.shouldCacheSnapshot=w,this.acceptsStreamResponse=T,this.direction=E||Mn[n],this.refresh=v}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}start(){this.state==_.initialized&&(this.recordTimingMetric(Fe.visitStart),this.state=_.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==_.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=_.canceled)}complete(){this.state==_.started&&(this.recordTimingMetric(Fe.visitEnd),this.adapter.visitCompleted(this),this.state=_.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==_.started&&(this.state=_.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=xr(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Y(this,N.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(Fe.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;kr(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric(Fe.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,kr(e)&&t!=null){let r=q.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(q.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!pe(this.location)||e.hasAnchor(pe(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return q.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(X.contentType)}
17requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:i,statusCode:n}=t;r==null?this.recordResponse({statusCode:ae.contentTypeMismatch,redirected:i}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:i}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:i,statusCode:n}=t;r==null?this.recordResponse({statusCode:ae.contentTypeMismatch,redirected:i}):this.recordResponse({statusCode:n,responseHTML:r,redirected:i})}requestErrored(e,t){this.recordResponse({statusCode:ae.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=pe(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function kr(s){return s>=200&&s<300}var is=class{progressBar=new es;constructor(e){this.session=e}visitProposedToLocation(e,t){z(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||G(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,this.redirectedToLocation=null,e.loadCachedSnapshot(),e.issueRequest()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse(),e.response.redirected&&(this.redirectedToLocation=e.redirectedToLocation)}visitRequestFailedWithStatusCode(e,t){switch(t){case ae.networkFailure:case ae.timeoutFailure:case ae.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){R("turbo:reload",{detail:e}),window.location.href=(this.redirectedToLocation||this.location)?.toString()||window.location.href}get navigator(){return this.session.navigator}},ns=class{selector="[data-turbo-temporary]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector)]}},os=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new He(this,t),this.formSubmitObserver=new be(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let i=this.#s(e);i&&i.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#s(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Ts(e,t),i=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=x(i?.content??"/");return this.#t(e,t)&&z(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let i=this.#s(e,t);return i?i!=e.closest("turbo-frame"):!1}else return!1}#s(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");
17if(r&&r!="_top"){let i=this.element.querySelector(`#${r}:not([disabled])`);if(i instanceof D)return i}}},as=class{location;restorationIdentifier=G();restorationData={};started=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=G()){e===history.pushState&&++this.currentIndex;let i={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,i,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{let{turbo:t}=e.state||{};if(this.location=new URL(window.location.href),t){let{restorationIdentifier:r,restorationIndex:i}=t;this.restorationIdentifier=r;let n=i>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=i}else this.currentIndex++,this.delegate.historyPoppedWithEmptyState(this.location)}},cs=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#s,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#o,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#s,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#o,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#i,!0),this.started=!0};#s=e=>{if(Ne("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#c(t)){let i=t,n=qr(i);if(this.delegate.canPrefetchRequestToLocation(i,n)){this.#e=i;let c=new Y(this,N.get,n,new URLSearchParams,t);c.fetchOptions.priority="low",ne.putLater(n,c,this.#r)}}};#o=e=>{e.target===this.#e&&this.#a()};#a=()=>{ne.clear(),this.#e=null};#i=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=ne.get(e.detail.url);t&&(e.detail.fetchRequest=t),ne.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),i=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;i&&i!=="_top"&&(e.headers["Turbo-Frame"]=i)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#r(){return Number(Ne("turbo-prefetch-cache-time"))||_r}#c(e){return!(!e.getAttribute("href")||Rn(e)||On(e)||Fn(e)||Pn(e)||In(e))}},Rn=s=>s.origin!==document.location.origin||!["http:","https:"].includes(s.protocol)||s.hasAttribute("target"),On=s=>s.pathname+s.search===document.location.pathname+document.location.search||s.href.startsWith("#"),Fn=s=>{if(s.getAttribute("data-turbo-prefetch")==="false"||s.getAttribute("data-turbo")==="false")return!0;let e=oe(s,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Pn=s=>{let e=s.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||xn(s)||s.hasAttribute("data-turbo-confirm")||s.hasAttribute("data-turbo-stream"))},xn=s=>s.hasAttribute("data-remote")||s.hasAttribute("data-behavior")||s.hasAttribute("data-confirm")||s.hasAttribute("data-method"),In=s=>R("turbo:before-prefetch",{target:s,cancelable:!0}).defaultPrevented,ls=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new rs(this,x(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new qe(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let i=e.isSafe;i||this.view.clearSnapshotCache();let{statusCode:n,redirected:c}=t,S={action:this.#e(e,t),shouldCacheSnapshot:i,response:{statusCode:n,responseHTML:r,redirected:c}};this.proposeVisit(t.location,S)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let i=q.fromHTMLString(r);t.serverError?await this.view.renderError(i,this.currentVisit):await this.view.renderPage(i,!1,!0,this.currentVisit),i.refreshScroll!=="preserve"&&this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){return!1}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:i}=e;return ee(r,i)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},Q={initial:0,loading:1,interactive:2,complete:3},hs=class{stage=Q.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==Q.initial&&(this.stage=Q.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;
17e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Q.loading&&(this.stage=Q.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Q.interactive&&(this.stage=Q.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},us=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},ds=class{render({fragment:e}){_e.preservingPermanentElements(this,Bn(e),()=>{Nn(e,()=>{Dn(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function Bn(s){let e=jr(document.documentElement),t={};for(let r of e){let{id:i}=r;for(let n of s.querySelectorAll("turbo-stream")){let c=Ur(n.templateElement.content,i);c&&(t[i]=[r,c])}}return t}async function Nn(s,e){let t=`turbo-stream-autofocus-${G()}`,r=s.querySelectorAll("turbo-stream"),i=qn(r),n=null;if(i&&(i.id?n=i.id:n=t,i.id=n),e(),await fe(),(document.activeElement==null||document.activeElement==document.body)&&n){let m=document.getElementById(n);As(m)&&m.focus(),m&&m.id==t&&m.removeAttribute("id")}}async function Dn(s){let[e,t]=await zi(s,()=>document.activeElement),r=e&&e.id;if(r){let i=document.getElementById(r);As(i)&&i!=t&&i.focus()}}function qn(s){for(let e of s){let t=Br(e.templateElement.content);if(t)return t}return null}var ms=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=Vn(e);t&&Hn(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(X.wrap(e))}};function Vn(s){let e=s.detail?.fetchResponse;if(e instanceof ce)return e}function Hn(s){return(s.contentType??"").startsWith(X.contentType)}var fs=class extends ve{static renderElement(e,t){let{documentElement:r,body:i}=document;r.replaceChild(t,i)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=ge(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},ue=class extends ve{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}
17get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{dir:t,lang:r}=this.newSnapshot;r?e.setAttribute("lang",r):e.removeAttribute("lang"),t?e.setAttribute("dir",t):e.removeAttribute("dir")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(_i(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(ge(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,i]of t.entries()){if(e.tagName=="TITLE"){if(i.tagName!="TITLE")continue;if(e.innerHTML==i.innerHTML)return t.splice(r,1),!0}if(i.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.removeNoscriptElements(),this.activateNewBodyScriptElements()}removeNoscriptElements(){for(let e of this.newElement.querySelectorAll("noscript"))e.remove()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=ge(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},je=class extends ue{static renderElement(e,t){ye(e,t,{callbacks:{beforeNodeMorphed:(r,i)=>zr(r,i)&&!Kr(r)?(r.reload(),!1):!0}}),R("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}},ps=class extends De{constructor(e){super(e,Pe)}get snapshots(){return this.entries}},gs=class extends Ve{snapshotCache=new ps(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,i){let c=this.isPageRefresh(i)&&(i?.refresh?.method||this.snapshot.refreshMethod)==="morph"?je:ue,m=new c(this.snapshot,e,t,r);return m.shouldRender?i?.changeHistory():this.forceReloaded=!0,this.render(m)}renderError(e,t){t?.changeHistory();let r=new fs(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Or();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&(e?.refresh?.scroll||this.snapshot.refreshScroll)==="preserve"}
17get snapshot(){return q.fromElement(this.element)}},bs=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Y(this,N.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,i=q.fromHTMLString(r);this.snapshotCache.put(e.url,i)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},vs=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){ji("turbo-cache-control",e)}},ys=class{navigator=new ls(this);history=new as(this);view=new gs(this,document.documentElement);adapter=new is(this);pageObserver=new hs(this);cacheObserver=new ns;linkPrefetchObserver=new cs(this,document);linkClickObserver=new $e(this,window);formSubmitObserver=new be(this,document);scrollObserver=new us(this);streamObserver=new ms(this);formLinkClickObserver=new We(this,document.documentElement);frameRedirector=new os(this,document.documentElement);streamMessageRenderer=new ds;cache=new vs(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new bs(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof D){let i=t.action||ee(r);r.delegate.proposeVisitIfNavigatedWithAction(r,i),r.src=e.toString()}else this.navigator.proposeVisit(x(e),t)}refresh(e,t={}){t=typeof t=="string"?{requestId:t}:t;let{method:r,requestId:i,scroll:n}=t,c=i&&this.recentRequests.has(i),m=e===document.baseURI;!c&&!this.navigator.currentVisit&&m&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1,refresh:{method:r,scroll:n}})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(X.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){F.drive.progressBarDelay=e}get progressBarDelay(){return F.drive.progressBarDelay}set drive(e){F.drive.enabled=e}get drive(){return F.drive.enabled}set formMode(e){F.forms.mode=e}get formMode(){return F.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=Ki(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),i=e.getAttribute("data-turbo-frame"),n=i=="_top"?null:d
17ocument.getElementById(i)||oe(e,"turbo-frame:not([disabled])");if(t||r||n instanceof D)return!1;{let c=new URL(e.href);return this.elementIsNavigatable(e)&&z(c,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}historyPoppedWithEmptyState(e){this.history.replace(e),this.view.lastRenderedLocation=e,this.view.cacheSnapshot()}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&z(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&z(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&z(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),i=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:i})}allowsVisitingLocationWithAction(e,t){return this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Lr(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Ie(document.documentElement),this.view.markVisitDirection(e.direction)),Lr(e.location),this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),Be(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}willSubmitForm(e,t){let r=Ts(e,t);return this.submissionIsNavigatable(e,t)&&z(x(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:i,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!i}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return R("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return R("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return R("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return R("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return R("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return R("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return R("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterFrameLoad(e){return R("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return R("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(F.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return F.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=oe(e,"[data-turbo]"),r=oe(e,"turbo-frame");return F.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return ee(e)||"advance"}get snapshot(){return this.view.snapshot}};function Lr(s){Object.defineProperties(s,$n)}var $n={absoluteURL:{get(){return this.toString()}}},O=new ys(Hr),{cache:Gr,navigator:Yr}=O;function ks(){O.start()}function Xr(s){O.registerAdapter(s)}function Jr(s,e){O.visit(s,e)}function we(s){O.connectStreamSource(s)}function Se(s){O.disconnectStreamSource(s)}function Qr(s){O.renderStreamMessage(s)}function Zr(s){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),F.drive.progressBarDelay=s}function ei(s){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),F.forms.confirm=s}function ti(s){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),F.forms.mode=s}function si(s,e){je.renderElement(s,e)}function ri(s,e){Ue.renderElement(s,e)}var Wn=Object.freeze({__proto__:null,PageRenderer:ue,PageSnapshot:q,FrameRenderer:he,fetch:Cs,config:F,session:O,cache:Gr,navigator:Yr,start:ks,registerAdapter
17:Xr,visit:Jr,connectStreamSource:we,disconnectStreamSource:Se,renderStreamMessage:Qr,setProgressBarDelay:Zr,setConfirmMethod:ei,setFormMode:ti,morphBodyElements:si,morphTurboFrameElements:ri,morphChildren:Xe,morphElements:ye}),ws=class extends Error{},Ss=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#s=!1;#o=!1;#a=new Set;#i=!1;action=null;constructor(e){this.element=e,this.view=new Qt(this,this.element),this.appearanceObserver=new Xt(this,this.element),this.formLinkClickObserver=new We(this,this.element),this.linkInterceptor=new He(this,this.element),this.restorationIdentifier=G(),this.formSubmitObserver=new be(this,this.element)}connect(){this.#s||(this.#s=!0,this.loadingStyle==Z.lazy?this.appearanceObserver.start():this.#r(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#s&&(this.#s=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop(),this.element.hasAttribute("recurse")||this.#e?.cancel())}disabledChanged(){this.disabled?this.#e?.cancel():this.loadingStyle==Z.eager&&this.#r()}sourceURLChanged(){this.#y("src")||(this.sourceURL||this.#e?.cancel(),this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Z.eager||this.#o)&&this.#r())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#i=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Z.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#r())}async#r(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#d(x(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#o=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=Fr(t);q.fromDocument(r).isVisitable?await this.#c(e,r):await this.#f(e)}}finally{this.#i=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,ee(e)),this.#r()}willSubmitFormLinkToLocation(e){return this.#l(e)}submittedFormLinkToLocation(e,t,r){let i=this.#n(e);i&&r.setAttribute("data-turbo-frame",i.id)}shouldInterceptLinkClick(e,t,r){return this.#l(e)}linkClickIntercepted(e,t){this.#m(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#l(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new qe(this,e,t);let{fetchRequest:r}=this.formSubmission,i=this.#n(e,t);this.prepareRequest(r,i),this.formSubmission.start()}prepareRequest(e,t=this){e.headers["Turbo-Frame"]=t.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(X.contentType)}requestStarted(e){Ie(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){Be(this.element)}formSubmissionStarted({formElement:e}){Ie(e,this.#n(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#n(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,ee(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||O.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),O.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){Be(e,this.#n(e))}allowsImmediateRender({element:e},t){let r=R("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:i,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!i}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){O.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>
17{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#c(e,t){let r=await this.extractForeignFrameElement(t.body),i=this.#i?Ue:he;if(r){let n=new le(r),c=new i(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(c),this.complete=!0,O.frameRendered(e,this.element),O.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#p(e)&&this.#g(e)}async#d(e){let t=new Y(this,N.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#m(e,t,r){let i=this.#n(e,r);i.delegate.proposeVisitIfNavigatedWithAction(i,ee(r,e,i)),this.#S(e,()=>{i.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=q.fromElement(e).clone(),{visitCachedSnapshot:i}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:c,redirected:m}=n,S=await n.responseHTML,I={response:{statusCode:c,redirected:m,responseHTML:S},visitCachedSnapshot:i,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(I.action=this.action),O.visit(e.src,I)}}}}changeHistory(){if(this.action){let e=xr(this.action);O.history.update(e,x(this.element.src||""),this.restorationIdentifier)}}async#f(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#h(e.response)}#p(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,c)=>{n instanceof Response?this.#h(n):O.visit(n,c)};return!R("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#g(e){this.view.missing(),this.#b(e)}#b(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new ws(t)}async#h(e){let t=new ce(e),r=await t.responseHTML,{location:i,redirected:n,statusCode:c}=t;return O.visit(i,{response:{redirected:n,statusCode:c,responseHTML:r}})}#n(e,t){let r=xe("data-turbo-frame",t,e)||this.element.getAttribute("target"),i=this.#u(r);return i instanceof D?i:this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Mr(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Mr(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(i){return console.error(i),new D}return null}#v(e,t){let r=Ts(e,t);return z(x(r),this.rootLocation)}#l(e,t){let r=xe("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#v(e,t)||!this.enabled||r=="_top")return!1;if(r){let i=this.#u(r);if(i)return!i.disabled;if(r=="_parent")return!1}return!(!O.elementIsNavigatable(e)||t&&!O.elementIsNavigatable(t))}get id(){return this.element.id}get disabled(){return this.element.disabled}get enabled(){return!this.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#w("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#s}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return x(t)}#y(e){return this.#a.has(e)}#w(e,t){this.#a.add(e),t(),this.#a.delete(e)}#S(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}#u(e){if(e!=null){let t=e==="_parent"?this.element.parentElement.closest("turbo-frame"):document.getElementById(e);if(t instanceof D)return t}}};function Mr(s,e){if(s){let t=s.getAttribute("src");if(t!=null&&e!=null&&Vr(t,e))throw new Error(`Matching <turbo-frame id="${s.id}"> element has a source URL which references itself`);if(s.ownerDocument!==document&&(s=document.importNode(s,!0)),s instanceof D)return s.connectedCallback(),s.disconnectedCallback(),s}}var Ls={after(){this.removeDuplicateTargetSiblings(),this.targetElements.forEac
17h(s=>s.parentElement?.insertBefore(this.templateContent,s.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.append(this.templateContent))},before(){this.removeDuplicateTargetSiblings(),this.targetElements.forEach(s=>s.parentElement?.insertBefore(this.templateContent,s))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(s=>s.prepend(this.templateContent))},remove(){this.targetElements.forEach(s=>s.remove())},replace(){let s=this.getAttribute("method");this.targetElements.forEach(e=>{s==="morph"?ye(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let s=this.getAttribute("method");this.targetElements.forEach(e=>{s==="morph"?Xe(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){let s=this.getAttribute("method"),e=this.requestId,t=this.getAttribute("scroll");O.refresh(this.baseURI,{method:s,requestId:e,scroll:t})}},ze=class s extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await fe(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}removeDuplicateTargetSiblings(){this.duplicateSiblings.forEach(e=>e.remove())}get duplicateSiblings(){let e=this.targetElements.flatMap(r=>[...r.parentElement.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=Ls[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:s.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},Ke=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),we(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),Se(this.streamSource))}get src(){return this.getAttribute("src")||""}};D.delegateConstructor=Ss;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",D);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",ze);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",Ke);(()=>{let s=document.currentScript;if(!s||s.hasAttribute("data-turbo-suppress-warning"))return;let e=s.parentElement;for(;e;){if(e==document.body)return console.warn(Pr` 18 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 19 20 Load your applicationâs JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 21 22 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 23 24 ââ 25 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 26 `,s.outerHTML);e=e.parentElement}})();window.Turbo={...Wn,StreamActions:Ls};ks();var li;async function jn(){return li||ci(zn().then(ci))}function ci(s){return li=s}async function zn(){let{createConsumer:s}=await Promise.resolve().then(()=>(Vs(),ai));return s()}async function hi(s,e){let{subscriptions:t}=await jn();return t.create(s,e)}function Le(s){return!s||typeof s!="object"||s instanceof Date||s instanceof RegExp?s:Array.isArray(s)?s.map(Le):Object.keys(s).reduce(function(e,t){var r=t[0].toLowerCase()+t.slice(1).replace(/([A-Z]+)/g,function(i,n){return"_"+n.toLowerCase()});return e[r]=Le(s[t]),e},{})}var Hs=class extends HTMLElement{static observedAttributes=["channel","signed-stream-name"];async connectedCallback(){we(this),this.subscription=await hi(this.channel,{received:this.dispatchMessageEvent.bind(this),connected:this.subscriptionConnected.bind(this),disconnected:this.subscriptionDisconnected.bind(this)})}disconnectedCallback(){Se(this),this.subscription&&this.subscription.unsubscribe(),this.subscriptionDisconnected()}attributeChangedCallback(){this.subscription&&(this.disconnectedCallback(),this.connectedCallback())}dispatchMessageEvent(e){let t=new MessageEvent("message",{data:e});return this.dispatchEvent(t)}subscriptionConnected(){this.setAttribute("connected","")}subscriptionDisconnected(){this.removeAttribute("connected")}get channel(){let e=this.getAttribute("channel"),t=this.getAttribute("signed-stream-name");return{channel:e,signed_stream_name:t,...Le({...this.dataset})}}};customElements.get("turbo-cable-stream-source")===void 0&&customElements.define("turbo-cable-stream-source",Hs);function ui(s){if(s.target instanceof HTMLFormElement){let{target:e,detail:{fetchOptions:t}}=s;
26e.addEventListener("turbo:submit-start",({detail:{formSubmission:{submitter:r}}})=>{let i=Xn(t.body)?t.body:new URLSearchParams,n=Gn(r,i,e);/get/i.test(n)||(/post/i.test(n)?i.delete("_method"):i.set("_method",n),t.method="post")},{once:!0})}}function Gn(s,e,t){let r=Yn(s),i=e.get("_method"),n=t.getAttribute("method")||"get";return typeof r=="string"?r:typeof i=="string"?i:n}function Yn(s){return s instanceof HTMLButtonElement||s instanceof HTMLInputElement?s.name==="_method"?s.value:s.hasAttribute("formmethod")?s.formMethod:null:null}function Xn(s){return s instanceof FormData||s instanceof URLSearchParams}window.Turbo=Ms;addEventListener("turbo:before-fetch-request",ui);var $s=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=Jn(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,i=t.index;return r<i?-1:r>i?1:0})}};function Jn(s){if("immediatePropagationStopped"in s)return s;{let{stopImmediatePropagation:e}=s;return Object.assign(s,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Ws=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:i}=e,n=this.fetchEventListenerMapForEventTarget(t),c=this.cacheKey(r,i);n.delete(c),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:i}=e;return this.fetchEventListener(t,r,i)}fetchEventListener(e,t,r){let i=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r),c=i.get(n);return c||(c=this.createEventListener(e,t,r),i.set(n,c)),c}createEventListener(e,t,r){let i=new $s(e,t,r);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(i=>{r.push(`${t[i]?"":"!"}${i}`)}),r.join(":")}},Qn={stop({event:s,value:e}){return e&&s.stopPropagation(),!0},prevent({event:s,value:e}){return e&&s.preventDefault(),!0},self({event:s,value:e,element:t}){return e?t===s.target:!0}},Zn=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function eo(s){let t=s.trim().match(Zn)||[],r=t[2],i=t[3];return i&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${i}`,i=""),{eventTarget:to(t[4]),eventName:r,eventOptions:t[7]?so(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||i}}function to(s){if(s=="window")return window;if(s=="document")return document}function so(s){return s.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function ro(s){if(s==window)return"window";if(s==document)return"document"}function hr(s){return s.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function _s(s){return hr(s.replace(/--/g,"-").replace(/__/g,"_"))}function Re(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Si(s){return s.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function io(s){return s.match(/[^\s]+/g)||[]}function di(s){return s!=null}function Us(s,e){return Object.prototype.hasOwnProperty.call(s,e)}var mi=["meta","ctrl","alt","shift"],js=class{constructor(e,t,r,i
26){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||no(e)||st("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||st("missing identifier"),this.methodName=r.methodName||st("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=i}static forToken(e,t){return new this(e.element,e.index,eo(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(i=>!mi.includes(i))[0];return r?(Us(this.keyMappings,r)||st(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:i}of Array.from(this.element.attributes)){let n=r.match(t),c=n&&n[1];c&&(e[hr(c)]=oo(i))}return e}get eventTargetName(){return ro(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,i,n,c]=mi.map(m=>t.includes(m));return e.metaKey!==r||e.ctrlKey!==i||e.altKey!==n||e.shiftKey!==c}},fi={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:s=>s.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function no(s){let e=s.tagName.toLowerCase();if(e in fi)return fi[e](s)}function st(s){throw new Error(s)}function oo(s){try{return JSON.parse(s)}catch{return s}}var zs=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:i}=this.context,n=!0;for(let[c,m]of Object.entries(this.eventOptions))if(c in r){let S=r[c];n=n&&S({name:c,value:m,event:e,element:t,controller:i})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(i){let{identifier:n,controller:c,element:m,index:S}=this,P={identifier:n,controller:c,element:m,index:S,event:e};this.context.handleError(i,`invoking action "${this.action}"`,P)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},rt=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes
26),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},it=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new rt(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function ao(s,e,t){Ei(s,e).add(t)}function co(s,e,t){Ei(s,e).delete(t),lo(s,e)}function Ei(s,e){let t=s.get(e);return t||(t=new Set,s.set(e,t)),t}function lo(s,e){let t=s.get(e);t!=null&&t.size==0&&s.delete(e)}var U=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){ao(this.valuesByKey,e,t)}delete(e,t){co(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};
26var Ks=class{constructor(e,t,r,i){this._selector=t,this.details=i,this.elementObserver=new rt(e,this),this.delegate=r,this.matchesByElement=new U}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],i=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return r.concat(i)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let i=this.matchElement(e),n=this.matchesByElement.has(r,e);i&&!n?this.selectorMatched(e,r):!i&&n&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},Gs=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let i=this.element.getAttribute(e);if(this.stringMap.get(e)!=i&&this.stringMapValueChanged(i,r,t),i==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(r,e,n)}else this.stringMap.set(e,i)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},nt=class{constructor(e,t,r){this.attributeObserver=new it(e,t,this),this.delegate=r,this.tokensByElement=new U}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),i=uo(t,r).findIndex(([n,c])=>!mo(n,c));return i==-1?[[],[]]:[t.slice(i),r.slice(i)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return ho(r,e,t)}};function ho(s,e,t){return s.trim().split(/\s+/).filter(r=>r.length).map((r,i)=>({element:e,attributeName:t,content:r,index:i}))}function uo(s,e){let t=Math.max(s.length,e.length);return Array.from({length:t},(r,i)=>[s[i],e[i]])}function mo(s,e){return s&&e&&s.index==e.index&&s.content==e.content}var ot=class{constructor(e,t,r){this.tokenListObserver=new nt(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}
26get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},Ys=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new ot(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new zs(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}
26disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=js.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},Xs=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Gs(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let i=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=i.writer(i.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let i=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,i.writer(this.receiver[e]),r):this.invokeChangedCallback(e,i.writer(i.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:i}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,i(r),void 0)}invokeChangedCallback(e,t,r){let i=`${e}Changed`,n=this.receiver[i];if(typeof n=="function"){let c=this.valueDescriptorNameMap[e];try{let m=c.reader(t),S=r;r&&(S=c.reader(r)),n.call(this.receiver,m,S)}catch(m){throw m instanceof TypeError&&(m.message=`Stimulus Value "${this.context.identifier}.${c.name}" - ${m.message}`),m}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${Re(t.name)}`;return this.receiver[r]}},Js=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new U}start(){this.tokenListObserver||(this.tokenListObserver=new nt(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function Oe(s,e){let t=Ai(s);return Array.from(t.reduce((r,i)=>(po(i,e).forEach(n=>r.add(n)),r),new Set))}function fo(s,e){return Ai(s).reduce((r,i)=>(r.push(...go(i,e)),r),[])}function Ai(s){let e=[];for(;s;)e.push(s),s=Object.getPrototypeOf(s);return e.reverse()}function po(s,e){let t=s[e];return Array.isArray(t)?t:[]}function go(s,e){let t=s[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var Qs=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new U,this.outletElementsByName=new U,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}
26),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let i=this.getOutlet(e,r);i&&this.connectOutlet(i,e,r)}selectorUnmatched(e,t,{outletName:r}){let i=this.getOutletFromMap(e,r);i&&this.disconnectOutlet(i,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),i=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?i&&n&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var i;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(i=this.selectorObserverMap.get(r))===null||i===void 0||i.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var i;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(i=this.selectorObserverMap.get(r))===null||i===void 0||i.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new Ks(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new it(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new U;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;Oe(r,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},Zs=class{constructor(e,t){this.logDebugActivity=(r,i={})=>{let{identifier:n,controller:c,element:m}=this;i=Object.assign({identifier:n,controller:c,element:m},i),this.application.logDebugActivity(this.identifier,r,i)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new Ys(this,this.dispatcher),this.valueObserver=new Xs(this,this.controller),this.targetObserver=new Js(this,this),this.outletObserver=new Qs(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}
26get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:i,controller:n,element:c}=this;r=Object.assign({identifier:i,controller:n,element:c},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${_s(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${_s(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function bo(s){return vo(s,yo(s))}function vo(s,e){let t=Ao(s),r=wo(s.prototype,e);return Object.defineProperties(t.prototype,r),t}function yo(s){return Oe(s,"blessings").reduce((t,r)=>{let i=r(s);for(let n in i){let c=t[n]||{};t[n]=Object.assign(c,i[n])}return t},{})}function wo(s,e){return Eo(e).reduce((t,r)=>{let i=So(s,e,r);return i&&Object.assign(t,{[r]:i}),t},{})}function So(s,e,t){let r=Object.getOwnPropertyDescriptor(s,t);if(!(r&&"value"in r)){let n=Object.getOwnPropertyDescriptor(e,t).value;return r&&(n.get=r.get||n.get,n.set=r.set||n.set),n}}var Eo=typeof Object.getOwnPropertySymbols=="function"?s=>[...Object.getOwnPropertyNames(s),...Object.getOwnPropertySymbols(s)]:Object.getOwnPropertyNames,Ao=(()=>{function s(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=s(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),s}catch{return r=>class extends r{}}})();function To(s){return{identifier:s.identifier,controllerConstructor:bo(s.controllerConstructor)}}var er=class{constructor(e,t){this.application=e,this.definition=To(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new Zs(this,e),this.contextsByScope.set(e,t)),t}},tr=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return io(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},sr=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${Si(e)}`}},rr=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let i=this.warnedKeysByObject.get(e);i||(i=new Set,this.warnedKeysByObject.set(e,i)),i.has(t)||(i.add(t),this.logger.warn(r,e))}};function ir(s,e){return`[${s}~="${e}"]`}var nr=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return ir(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return ir(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,i=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${i}="${r}.${t}" with ${n}="${t}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},or=class{constructor(e,t){this.scope=e,this.controllerElement=t}
26get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(i=>this.matchesElement(i,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(i=>this.matchesElement(i,e,t))}matchesElement(e,t,r){let i=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&i.split(" ").includes(r)}},ar=class s{constructor(e,t,r,i){this.targets=new nr(this),this.classes=new tr(this),this.data=new sr(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new rr(i),this.outlets=new or(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return ir(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new s(this.schema,document.documentElement,this.identifier,this.guide.logger)}},cr=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new ot(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),i=r.get(t);return i||(i=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,i)),i}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},lr=class{constructor(e){this.application=e,this.scopeObserver=new cr(this.element,this.schema,this),this.scopesByIdentifier=new U,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new er(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(i=>i.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new ar(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},Co={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:s=>`data-${s}-target`,outletAttributeForScope:(s,e)=>`data-${s}-${e}
26-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},pi("abcdefghijklmnopqrstuvwxyz".split("").map(s=>[s,s]))),pi("0123456789".split("").map(s=>[s,s])))};function pi(s){return s.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var at=class{constructor(e=document.documentElement,t=Co){this.logger=console,this.debug=!1,this.logDebugActivity=(r,i,n={})=>{this.debug&&this.logFormattedMessage(r,i,n)},this.element=e,this.schema=t,this.dispatcher=new Ws(this),this.router=new lr(this),this.actionDescriptorFilters=Object.assign({},Qn)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await ko(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(i=>{i.controllerConstructor.shouldLoad&&this.router.loadDefinition(i)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(i=>this.router.unloadIdentifier(i))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var i;this.logger.error(`%s 27 28%o 29 30%o`,t,e,r),(i=window.onerror)===null||i===void 0||i.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function ko(){return new Promise(s=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>s()):s()})}function Lo(s){return Oe(s,"classes").reduce((t,r)=>Object.assign(t,Mo(r)),{})}function Mo(s){return{[`${s}Class`]:{get(){let{classes:e}=this;if(e.has(s))return e.get(s);{let t=e.getAttributeName(s);throw new Error(`Missing attribute "${t}"`)}}},[`${s}Classes`]:{get(){return this.classes.getAll(s)}},[`has${Re(s)}Class`]:{get(){return this.classes.has(s)}}}}function Ro(s){return Oe(s,"outlets").reduce((t,r)=>Object.assign(t,Oo(r)),{})}function gi(s,e,t){return s.application.getControllerForElementAndIdentifier(e,t)}function bi(s,e,t){let r=gi(s,e,t);if(r||(s.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=gi(s,e,t),r))return r}function Oo(s){let e=_s(s);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(s),r=this.outlets.getSelectorForOutletName(s);if(t){let i=bi(this,t,s);if(i)return i;throw new Error(`The provided outlet element is missing an outlet controller "${s}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${s}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(s);return t.length>0?t.map(r=>{let i=bi(this,r,s);if(i)return i;console.warn(`The provided outlet element is missing an outlet controller "${s}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(s),r=this.outlets.getSelectorForOutletName(s);if(t)return t;throw new Error(`Missing outlet element "${s}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(s)}},[`has${Re(e)}Outlet`]:{get(){return this.outlets.has(s)}}}}function Fo(s){return Oe(s,"targets").reduce((t,r)=>Object.assign(t,Po(r)),{})}function Po(s){return{[`${s}Target`]:{get(){let e=this.targets.find(s);if(e)return e;throw new Error(`Missing target element "${s}" for "${this.identifier}" controller`)}},[`${s}Targets`]:{get(){return this.targets.findAll(s)}},[`has${Re(s)}Target`]:{get(){return this.targets.has(s)}}}}function xo(s){let e=fo(s,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,i)=>{let n=Ti(i,this.identifier),c=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[c]:n})},{})}}};return e.reduce((r,i)=>Object.assign(r,Io(i)),t)}function Io(s,e){let t=Ti(s,e),{key:r,name:i,reader:n,writer:c}=t;return{[i]:{get(){let m=this.data.get(r);return m!==null?n(m):t.defaultValue},set(m){m===void 0?this.data.delete(r):this.data.set(r,c(m))}},[`has${Re(i)}
30`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function Ti([s,e],t){return qo({controller:t,token:s,typeDefinition:e})}function ct(s){switch(s){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Me(s){switch(typeof s){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(s))return"array";if(Object.prototype.toString.call(s)==="[object Object]")return"object"}function Bo(s){let{controller:e,token:t,typeObject:r}=s,i=di(r.type),n=di(r.default),c=i&&n,m=i&&!n,S=!i&&n,P=ct(r.type),I=Me(s.typeObject.default);if(m)return P;if(S)return I;if(P!==I){let j=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${j}" must match the defined type "${P}". The provided default value of "${r.default}" is of type "${I}".`)}if(c)return P}function No(s){let{controller:e,token:t,typeDefinition:r}=s,n=Bo({controller:e,token:t,typeObject:r}),c=Me(r),m=ct(r),S=n||c||m;if(S)return S;let P=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${P}" for "${t}" value`)}function Do(s){let e=ct(s);if(e)return vi[e];let t=Us(s,"default"),r=Us(s,"type"),i=s;if(t)return i.default;if(r){let{type:n}=i,c=ct(n);if(c)return vi[c]}return s}function qo(s){let{token:e,typeDefinition:t}=s,r=`${Si(e)}-value`,i=No(s);return{type:i,key:r,name:hr(r),get defaultValue(){return Do(t)},get hasCustomDefaultValue(){return Me(t)!==void 0},reader:Vo[i],writer:yi[i]||yi.default}}var vi={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Vo={array(s){let e=JSON.parse(s);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${s}" of type "${Me(e)}"`);return e},boolean(s){return!(s=="0"||String(s).toLowerCase()=="false")},number(s){return Number(s.replace(/_/g,""))},object(s){let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${s}" of type "${Me(e)}"`);return e},string(s){return s}},yi={default:Ho,array:wi,object:wi};function wi(s){return JSON.stringify(s)}function Ho(s){return`${s}`}var d=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:i=this.identifier,bubbles:n=!0,cancelable:c=!0}={}){let m=i?`${i}:${e}`:e,S=new CustomEvent(m,{detail:r,bubbles:n,cancelable:c});return t.dispatchEvent(S),S}};d.blessings=[Lo,Fo,xo,Ro];d.targets=[];d.outlets=[];d.values={};var lt=class extends d{arrive(){this.element.dataset.arrived=""}};var B=()=>matchMedia("(prefers-reduced-motion: reduce)").matches;var $o=.8,ht=class extends d{static targets=["slot"];connect(){this.watch()}watch(){let s=scrollY>innerHeight*$o;s!==this.shown&&(this.shown=s,this.slotTarget.toggleAttribute("data-shown",s),this.slotTarget.inert=!s)}climb(){let s=B();scrollTo({top:0,behavior:s?"instant":"smooth"})}};var Wo=600,ut=class extends d{static targets=["image","link"];static values={slides:Array,interval:Number};connect(){this.index=0,this.seen=new Set,this.observer=new IntersectionObserver(([s])=>this.watch(s.isIntersecting),{threshold:.5}),this.observer.observe(this.element)}disconnect(){this.observer.disconnect(),this.stop()}watch(s){this.inView=s,s?this.start():this.stop()}resume(){this.inView&&this.count(this.slidesValue[this.index])}start(){this.imageTarget.decode().catch(()=>{}).then(()=>this.count(this.slidesValue[this.index])),!(this.slidesValue.length<2||this.timer)&&(this.timer=setInterval(()=>document.hidden||this.next(),this.intervalValue*1e3))}stop(){clearInterval(this.timer),this.timer=null}next(){this.index=(this.index+1)%this.slidesValue.length,this.show(this.slidesValue[this.index])}async show(s){let e=new Image;e.src=s.image,await e.decode().catch(()=>{}),Object.assign(this.imageTarget,{src:s.image,alt:s.name}),this.imageTarget.animate([{opacity:0}
30,{opacity:1}],{duration:Wo,easing:"ease-out"}),this.relink(s.url),this.count(s)}countable(s){let e=document.documentElement.hasAttribute("data-turbo-preview"),t=this.inView&&!document.hidden;return!!s?.view&&t&&!this.seen.has(s.view)&&!e}relink(s){if(this.hasLinkTarget){if(s)return this.linkTarget.setAttribute("href",s);this.linkTarget.removeAttribute("href")}}count(s){if(!this.countable(s))return;this.seen.add(s.view);let e=document.querySelector('meta[name="csrf-token"]')?.content;fetch(s.view,{method:"PUT",headers:{"X-CSRF-Token":e||""},keepalive:!0}).catch(()=>{})}};var dt=s=>s.dataset.fallback??document.body.dataset.coverFallback??"";var mt=class extends d{static targets=["image"];connect(){this.imageTarget.complete&&this.reveal()}reveal(){delete this.element.dataset.loading}fail(){let s=this.imageTarget,e=dt(s);if(e&&s.getAttribute("src")!==e)return s.src=e;this.reveal()}};var Ci=.45,_o={duration:180,easing:"ease-out",fill:"forwards"},Uo={duration:360,easing:"ease-out"},jo=s=>-(Math.cos(Math.PI*s)-1)/2,ft=class extends d{leave(s){this.calm||s.target!==this.element||(this.leaving?.cancel(),this.leaving=this.element.animate([{opacity:1},{opacity:Ci}],_o))}render(s){this.leaving&&(s.preventDefault(),this.leaving.finished.then(()=>s.detail.resume(),()=>s.detail.resume()))}arrive(){this.leaving&&(this.leaving.cancel(),this.leaving=null,this.element.animate([{opacity:Ci},{opacity:1}],Uo))}get calm(){return B()}settle(){let s=parseFloat(getComputedStyle(this.element).scrollMarginTop)||0,e=this.element.getBoundingClientRect().top-s;if(!(e>=0)){if(this.calm)return scrollBy({top:e,behavior:"instant"});this.glide(scrollY,e,Math.min(Math.max(Math.abs(e)*.9,900),1500))}}glide(s,e,t){let r=performance.now(),i=n=>{let c=Math.min((n-r)/t,1);scrollTo({top:s+e*jo(c),behavior:"instant"}),this.frame=c<1?requestAnimationFrame(i):null};this.frame=requestAnimationFrame(i)}halt(){cancelAnimationFrame(this.frame),this.frame=null}disconnect(){this.halt()}};var pt=class extends d{static targets=["capsule"];connect(){this.watch(),this.resizing=new ResizeObserver(()=>this.resized()),this.resizing.observe(this.element)}disconnect(){this.observer?.disconnect(),this.resizing.disconnect(),document.documentElement.removeAttribute("data-days-docked")}watch(){this.observer?.disconnect();let s=parseFloat(getComputedStyle(this.element).top)||0;this.top=s,this.observer=new IntersectionObserver(([e])=>this.dock(!e.isIntersecting&&e.boundingClientRect.top<s),{rootMargin:`-${s}px 0px 0px 0px`}),this.observer.observe(this.element.previousElementSibling)}resized(){(parseFloat(getComputedStyle(this.element).top)||0)!==this.top&&this.watch(),this.measure()}dock(s){document.documentElement.toggleAttribute("data-days-docked",s),this.measure(),this.dispatch("docked",{target:this.capsuleTarget,detail:{docked:s}})}measure(){let s=this.capsuleTarget,t=(this.element.clientWidth-s.offsetWidth)/2-s.offsetLeft;this.element.style.setProperty("--la-days-shift",`${Math.max(t,0)}px`)}};var ur;function zo(){let s=document.querySelector('meta[name="la-hls"]')?.content;return ur??=s?import(s).then(e=>e.default):Promise.resolve(null),ur.catch(e=>{throw ur=null,e})}function gt(s,e){if(s.canPlayType("application/vnd.apple.mpegurl"))return Ko(s,e);let t={gone:!1};return zo().then(r=>Go(r,t,s,e)).catch(()=>{}),()=>{t.gone=!0,t.hls?.destroy()}}function Ko(s,e){return s.src=e,()=>{s.removeAttribute("src"),s.load()}}function Go(s,e,t,r){e.gone||!s?.isSupported()||(e.hls=new s({liveSyncDurationCount:3}),e.recovered=0,e.hls.on(s.Events.ERROR,(i,n)=>Yo(s,e,n)),e.hls.loadSource(r),e.hls.attachMedia(t))}function Yo(s,e,{fatal:t,type:r}){if(t){if(++e.recovered>3)return e.hls.destroy();if(r===s.ErrorTypes.MEDIA_ERROR)return e.hls.recoverMediaError();e.hls.startLoad()}}var Xo=new Set(["connecting","playing"]),Jo=[400,1200,2500,5e3],Qo=1e4,Zo=1500,ea=12e3,ta=/\.m3u8(\?|$)/i,dr=class{constructor(){this.audio=null,this.source=null,this.state="idle",this.tries=0,this.timers={},this.detach=null,this.listeners=new Set,this.volumeListeners=new Set}use(e){!e||this.source===e||(this.stop(),this.source=e)}toggle(){return this.isActive()?this.stop():this.play()}isActive(){return Xo.has(this.state)}play(){this.source&&(this.tries=0,this.announce("connecting"),this.connect())}connect(){this.clear();
30let e=this.element();this.detach?.(),this.detach=null,ta.test(this.source)?this.detach=gt(e,this.source):e.src=this.source,this.timers.connect=setTimeout(()=>this.fail(),Qo),e.play()?.catch(t=>this.refused(t))}refused(e){if(e?.name!=="AbortError"){if(e?.name==="NotAllowedError"&&this.isActive())return this.giveUp();this.fail()}}fail(){if(!this.isActive()||this.timers.retry)return;this.clear();let e=Jo[this.tries++];if(e===void 0)return this.giveUp();this.announce("connecting"),this.timers.retry=setTimeout(()=>{this.isActive()&&this.connect()},e)}giveUp(){this.clear(),this.release(),this.announce("error")}stop(){!this.audio||!this.isActive()||(this.clear(),this.announce("paused"),this.release())}release(){this.audio.pause(),this.detach?.(),this.detach=null,this.audio.removeAttribute("src"),this.audio.load()}playing(){this.clear(),this.tries=0,this.announce("playing")}stalled(){this.state!=="playing"||this.timers.stall||(this.timers.grace=setTimeout(()=>this.announce("connecting"),Zo),this.timers.stall=setTimeout(()=>this.fail(),ea))}clear(){Object.values(this.timers).forEach(clearTimeout),this.timers={}}setVolume(e){this.element().volume=Math.min(Math.max(e,0),1),this.volumeListeners.forEach(t=>t(this.volume))}get volume(){return this.audio?this.audio.volume:1}describe({title:e,artist:t,artwork:r}){!("mediaSession"in navigator)||!e||(navigator.mediaSession.metadata=new MediaMetadata({title:e,artist:t,artwork:r?[{src:r,sizes:"512x512"}]:[]}))}onChange(e){return this.listeners.add(e),e(this.state),()=>this.listeners.delete(e)}onVolume(e){return this.volumeListeners.add(e),e(this.volume),()=>this.volumeListeners.delete(e)}announce(e){e!==this.state&&(this.state=e,"mediaSession"in navigator&&(navigator.mediaSession.playbackState=this.isActive()?"playing":"paused"),this.listeners.forEach(t=>t(e)))}element(){return this.audio?this.audio:(this.audio=new Audio,this.audio.preload="none",this.audio.addEventListener("playing",()=>{this.isActive()&&this.playing()}),this.audio.addEventListener("waiting",()=>this.stalled()),this.audio.addEventListener("error",()=>this.fail()),this.audio.addEventListener("ended",()=>this.fail()),this.bindSystemControls(),this.audio)}bindSystemControls(){"mediaSession"in navigator&&(navigator.mediaSession.setActionHandler("play",()=>this.play()),navigator.mediaSession.setActionHandler("pause",()=>this.stop()))}},L=new dr;var mr=class{constructor(){this.audio=null,this.track=null,this.resumeLive=!1,this.listeners=new Set,this.tickers=new Set,L.onChange(e=>{this.track&&L.isActive()&&this.stop()}),L.onVolume(e=>{this.audio&&(this.audio.volume=e)})}toggle(e){return this.track?.url===e.url?this.stop({resume:!0}):this.play(e)}play(e){this.track||(this.resumeLive=L.isActive()),this.track=e,L.stop();let t=this.element();t.src=e.url,t.play()?.catch(r=>{r?.name!=="AbortError"&&this.stop({resume:!0})}),this.announce()}stop({resume:e=!1}={}){if(!this.track)return;let t=e&&this.resumeLive;this.track=null,this.audio.pause(),this.audio.removeAttribute("src"),this.audio.load(),this.announce(),t&&L.play()}onChange(e){return this.listeners.add(e),e(this.track),()=>this.listeners.delete(e)}onTick(e){return this.tickers.add(e),()=>this.tickers.delete(e)}announce(){"mediaSession"in navigator&&this.track&&(navigator.mediaSession.playbackState="playing"),this.track&&L.describe(this.track),this.listeners.forEach(e=>e(this.track))}element(){return this.audio?this.audio:(this.audio=new Audio,this.audio.volume=L.volume,this.audio.addEventListener("ended",()=>this.stop({resume:!0})),this.audio.addEventListener("error",()=>{this.audio.getAttribute("src")&&this.stop({resume:!0})}),this.audio.addEventListener("timeupdate",()=>{let e=this.audio.duration?this.audio.currentTime/this.audio.duration:0;this.tickers.forEach(t=>t(e))}),this.audio)}},V=new mr;var bt=class extends d{static values={source:String};connect(){L.use(this.sourceValue),this.stopFollowing=L.onChange(()=>this.wear()),this.stopPreview=V.onChange(()=>this.wear())}disconnect(){this.stopFollowing?.(),this.stopPreview?.()}toggle(){if(V.track)return V.stop();L.toggle()}wear(){let s=!!V.track;this.element.dataset.liveState=s?"playing":L.state,this.element.toggleAttribute("data-previewing",s)}};var vt=class extends d{watch(){this.dispatch("watch",{target:window})}listen(){this.dispatch("listen",{target:window})}unmute(){this.dispatch("unmute",{target:window})}};
30var yt=new WeakMap,wt=class extends d{static values={hls:String};static targets=["video"];connect(){this.element.dataset.mode==="video"&&this.attach(),this.stopFollowing=L.onChange(s=>this.yieldTo(s))}disconnect(){this.stopFollowing?.();let s=this.hasVideoTarget&&this.videoTarget;s&&requestAnimationFrame(()=>s.isConnected||this.release(s))}unmute(){this.hasVideoTarget&&(L.stop(),this.element.dataset.sound="on",this.videoTarget.muted=!1,this.videoTarget.play())}toggleSound(){if(this.element.dataset.sound==="on")return this.mute();this.unmute()}watch(){this.element.dataset.mode="video",this.attach()}listen(){this.element.dataset.mode="audio",this.mute(),this.release(),L.play()}attach(){!this.hasVideoTarget||!this.hlsValue||yt.has(this.videoTarget)||yt.set(this.videoTarget,gt(this.videoTarget,this.hlsValue))}release(s=this.hasVideoTarget&&this.videoTarget){s&&(yt.get(s)?.(),yt.delete(s))}yieldTo(s){s==="playing"&&this.mute()}mute(){delete this.element.dataset.sound,this.hasVideoTarget&&(this.videoTarget.muted=!0)}};var St=class extends d{static targets=["text"];connect(){this.resizing=new ResizeObserver(()=>this.measure()),this.resizing.observe(this.element),this.rewriting=new MutationObserver(()=>this.measure()),this.rewriting.observe(this.textTarget,{childList:!0,characterData:!0,subtree:!0})}disconnect(){this.resizing.disconnect(),this.rewriting.disconnect()}measure(){let s=this.element.clientWidth,e=s?this.textTarget.scrollWidth-s:0;this.element.toggleAttribute("data-overflow",e>4),this.element.style.setProperty("--la-scroll",`${-e-12}px`),this.element.style.setProperty("--la-marquee-time",`${Math.max(7,e/18)}s`)}};var Et=class extends d{static targets=["light","link"];connect(){this.rest(),document.fonts?.ready.then(()=>this.rest())}mark(){let s=document.body.dataset.section;this.markWhere(e=>s!==void 0&&e.dataset.section===s)}pick(s){s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||this.markWhere(e=>e===s.currentTarget)}markWhere(s){this.linkTargets.forEach(e=>{e.ariaCurrent=s(e)?"page":"false"}),this.rest()}follow(s){let e=s.currentTarget;s.type==="focus"&&!e.matches(":focus-visible")||this.moveTo(e)}rest(){this.hasLinkTarget&&this.moveTo(this.linkTargets.find(s=>s.ariaCurrent==="page")||this.linkTargets[0])}moveTo(s){this.lightTarget.style.setProperty("--x",`${s.offsetLeft}px`),this.lightTarget.style.setProperty("--w",`${s.offsetWidth}px`)}};Vs();var ki=qs();var fr=new Map,sa=1e3;function At(s,e){let t=fr.get(s)||ra(s);return clearTimeout(t.releaseTimer),t.callbacks.add(e),t.latest&&e(t.latest),()=>ia(s,t,e)}function ra(s){let e={callbacks:new Set,latest:null,releaseTimer:null};return e.subscription=ki.subscriptions.create({channel:"NoarChannel",slug:s},{received(t){e.latest=na(t?.noar),e.callbacks.forEach(r=>r(e.latest))}}),fr.set(s,e),e}function ia(s,e,t){e.callbacks.delete(t),!(e.callbacks.size>0)&&(e.releaseTimer=setTimeout(()=>{e.subscription.unsubscribe(),fr.delete(s)},sa))}function na(s={}){return{song:s.song||"",artist:s.artist||"",artwork:s.artwork||"",program:s.program_name||"",speaker:s.speaker_name||"",programImage:s.program_image||""}}function Tt(s){!s?.dataset.url||s.hasAttribute("busy")||(s.src?s.reload():s.src=s.dataset.url)}var Ct=class extends d{static values={slug:String};static targets=["song","artist","artwork","program","speaker","stage"];connect(){this.wanted=new WeakMap,this.stopFollowing=At(this.slugValue,s=>this.render(s)),this.stopPreview=V.onChange(s=>this.preview(s))}disconnect(){this.stopFollowing?.(),this.stopPreview?.()}render(s){this.followProgram(s.program),s.song&&(this.live=s),s.song&&!V.track&&this.showSong(s)}preview(s){if(s)return this.cover(s);this.previewed&&(this.previewed=!1,this.showSong(this.live))}cover(s){this.previewed||(this.live||=this.drawn()),this.previewed=!0,this.showSong({song:s.title,artist:s.artist,artwork:s.artwork})}drawn(){let s=e=>e[0]?.textContent.trim();return{song:s(this.songTargets),artist:s(this.artistTargets),artwork:this.artworkTargets[0]?.getAttribute("src")}}showSong(s){this.fill(this.songTargets,s.song),this.fill(this.artistTargets,s.artist),this.fill(this.programTargets,s.program),this.fill(this.speakerTargets,s.speaker),this.showArtwork(s.artwork),L.describe({title:s.song,artist:s.artist,artwork:s.artwork}),this.announceSong(s.song)}announceSong(s){this.song&&s!==this.song&&this.dispatch("song",{detail:{song:s}}),this.song=s}followProgram(s){this.baselined&&s&&s!==this.program&&this.stageTargets.forEac
30h(Tt),this.baselined=!0,this.program=s||this.program}fill(s,e){e&&s.forEach(t=>{t.textContent=e})}showArtwork(s){this.artworkTargets.forEach(e=>{let t=s||dt(e);if(this.wanted.set(e,t),!t)return e.hidden=!0;this.swap(e,t)})}async swap(s,e){if(s.getAttribute("src")===e||(await this.decoded(e),this.wanted.get(s)!==e))return;let t=this.ghost(s);Object.assign(s,{hidden:!1,src:e}),this.dissolve(s,t)}decoded(s){let e=new Image;return e.src=s,e.decode().catch(()=>{})}ghost(s){if(s.hidden||!s.getAttribute("src"))return null;let e=s.cloneNode();return e.getAttributeNames().filter(t=>t.startsWith("data-")).forEach(t=>e.removeAttribute(t)),s.after(e),e}dissolve(s,e){let t="cubic-bezier(0.22, 1, 0.36, 1)";if(s.animate([{scale:1.05,filter:"blur(6px)"},{scale:1,filter:"blur(0)"}],{duration:900,easing:t}),!e)return s.animate([{opacity:0},{opacity:1}],{duration:600,easing:t});e.animate([{opacity:1},{opacity:0}],{duration:800,easing:t,fill:"forwards"}).finished.then(()=>e.remove(),()=>e.remove())}};var oa=3e4,aa=1e3,kt=class extends d{static values={startsAt:Number,endsAt:Number,remaining:String,minutes:String};static targets=["bar","remaining"];connect(){this.connectedAt=Date.now(),this.tick(),this.timer=setInterval(()=>this.tick(),oa)}disconnect(){clearInterval(this.timer)}tick(){let s=this.endsAtValue-Date.now();if(s<=0)return this.refresh();this.paint(100-s/(this.endsAtValue-this.startsAtValue)*100),this.hasRemainingTarget&&(this.remainingTarget.textContent=this.remainingValue.replace("{duration}",this.duration(s)))}paint(s){this.barTarget.style.width=`${Math.min(Math.max(s,0),100)}%`}duration(s){let e=Math.ceil(s/6e4);return e<60?this.minutesValue.replace("{count}",e):`${Math.floor(e/60)}h${String(e%60).padStart(2,"0")}`}refresh(){if(this.paint(100),Date.now()-this.connectedAt<aa)return;clearInterval(this.timer);let s=this.element.closest("turbo-frame[data-url]");if(s)return Tt(s);this.hasRemainingTarget&&(this.remainingTarget.hidden=!0)}};var re=s=>String(s||"").normalize("NFD").replace(/[Ì-ͯ]/g,"").toLowerCase();var Lt=class extends d{static targets=["value","trigger","label","panel","query","option","empty"];static values={name:String};toggle(){this.panelTarget.hidden?this.open():this.close()}open(){this.panelTarget.hidden=!1,this.triggerTarget.setAttribute("aria-expanded","true"),this.queryTarget.value="",this.filter(),this.queryTarget.focus()}close(){this.panelTarget.hidden=!0,this.triggerTarget.setAttribute("aria-expanded","false")}dismiss(){this.panelTarget.hidden||(this.close(),this.triggerTarget.focus())}outside({target:s}){this.element.contains(s)||this.close()}filter(){let s=re(this.queryTarget.value.trim());this.optionTargets.forEach(t=>t.hidden=!t.dataset.key.includes(s));let e=this.shown();this.emptyTarget.hidden=e.length>0,this.activate(e.find(t=>t.ariaSelected==="true")??e[0])}next(s){s.preventDefault(),this.step(1)}previous(s){s.preventDefault(),this.step(-1)}hover({currentTarget:s}){this.activate(s)}choose(s){s.preventDefault(),this.active&&this.pick({currentTarget:this.active})}pick({currentTarget:s}){this.show(s.dataset.value),this.dismiss(),this.dispatch("picked")}follow({target:s}){s.id===this.element.closest("form")?.dataset.searchBarFrameValue&&this.show(new URL(s.src||location.href,location.href).searchParams.get(this.nameValue)||"")}shown(){return this.optionTargets.filter(s=>!s.hidden)}step(s){let e=this.shown();e.length&&this.activate(e[(e.indexOf(this.active)+s+e.length)%e.length])}activate(s){this.optionTargets.forEach(e=>e.toggleAttribute("data-active",e===s)),this.active=s,s?.scrollIntoView({block:"nearest"}),this.queryTarget.setAttribute("aria-activedescendant",s?.id??"")}show(s){this.valueTarget.value=s,this.optionTargets.forEach(e=>e.ariaSelected=String(e.dataset.value===s)),this.labelTarget.textContent=this.optionTargets.find(e=>e.dataset.value===s)?.dataset.name??""}};var Mt={corner:"listener-app:pip-corner",folded:"listener-app:pip-folded"},ca=["bottom-left","bottom-right","top-left","top-right"],pr={id:"pip-spring",duration:560,easing:"cubic-bezier(0.34, 1.32, 0.64, 1)"},Li={id:"pip-shape",duration:620,easing:"cubic-bezier(0.32, 0.72, 0, 1)"},gr=40,Rt=class extends d{static targets=["screen"];connect(){let s=this.recall(Mt.corner);document.documentElement.dataset.pipCorner=ca.includes(s)?s:"bottom-left",this.show(this.recall(Mt.folded)==="true"),this.resizing=new ResizeObserver(()=>this.measure()),this.resizing.observe(this.element)}disconnect(){this.resizing.disconnect(),cancelAnimationFrame(this.frame)}sound(){this.dispatch("sound",{target:window,prefix:"pip"})}fold(){this.morph(!0)}unfold(){if(this.dragged)return this.dragged=!1;this.morph(!1)}morph(s){let e=this.shape();if(this.cancel(this.element,Li.id),this.element.dataset.morphed="",this.show(s),this.calm())return this.measure();this.morphing=this.element.animate([e,this.shape()],Li),this.morphing.finished.then(()=>this.measure(),()=>{})}
30cancel(s,e){s.getAnimations().forEach(t=>t.id===e&&t.cancel())}shape(){this.morphing=null;let{offsetWidth:s,offsetHeight:e}=this.element;return{width:`${s}px`,height:`${e}px`,borderRadius:getComputedStyle(this.element).borderRadius}}show(s){document.documentElement.toggleAttribute("data-pip-folded",s),this.keep(Mt.folded,String(s))}turn(){this.element.removeAttribute("data-turning"),this.element.getBoundingClientRect(),this.element.setAttribute("data-turning","")}grab(s){s.button!==0||s.target.closest("button:not([data-pip-handle]), input, .la-volume")||(this.dragged=!1,this.drag={x:s.clientX,y:s.clientY,far:!1})}move(s){this.drag&&(this.pointer=s,this.frame||=requestAnimationFrame(()=>this.follow()))}follow(){if(this.frame=null,!this.drag||!this.pointer)return;let[s,e]=[this.pointer.clientX-this.drag.x,this.pointer.clientY-this.drag.y];this.drag.far||this.takeHold(this.pointer,Math.hypot(s,e)),this.drag.far&&this.carry(s,e)}carry(s,e){this.offset(s,e),this.makeWay({top:this.drag.box.top+e,bottom:this.drag.box.bottom+e,left:this.drag.box.left+s,right:this.drag.box.right+s})}makeWay(s){let e=this.drag.spot;if(!e)return;let t=s.right>e.left-gr&&s.left<e.right+gr&&s.bottom>e.top-gr;this.dodge(t?innerHeight-s.top-this.drag.fabBase+16:0)}
30dodge(s){let e=`${Math.max(Math.round(s),0)}px`;e!==this.dodged&&(this.dodged=e,document.documentElement.style.setProperty("--la-fab-dodge",e))}restingSpot(){let s=document.querySelector(".la-fab");if(!s)return null;let{left:e,right:t,height:r}=s.getBoundingClientRect(),i=innerHeight-this.fabBase()-r;return{left:e,right:t,top:i}}fabBase(){return parseFloat(getComputedStyle(document.documentElement).fontSize)*(matchMedia("(min-width: 64rem)").matches?1.5:5.25)}takeHold(s,e){if(e<5)return;this.cancel(this.element,pr.id);let t=this.element.getBoundingClientRect();Object.assign(this.drag,{far:!0,box:t,spot:this.restingSpot(),fabBase:this.fabBase()}),this.element.setPointerCapture(s.pointerId),document.documentElement.dataset.pipDragging="true"}release(){this.drag&&(cancelAnimationFrame(this.frame),this.frame=null,this.dragged=this.drag.far,this.drag=null,this.letGo())}letGo(){delete document.documentElement.dataset.pipDragging,this.dodged=null,this.dragged&&this.settle()}settle(){let s=this.element.getBoundingClientRect(),e=this.nearest(s);document.documentElement.dataset.pipCorner=e,this.keep(Mt.corner,e),this.offset(0,0);let t=this.element.getBoundingClientRect();this.spring(s.left-t.left,s.top-t.top)}spring(s,e){if(this.calm())return;let t=[{translate:`${s}px ${e}px`},{translate:"0 0"}];this.moving().forEach(r=>{this.cancel(r,pr.id),r.animate(t,pr)})}moving(){let s=document.getElementById("listener-app-live");return s&&getComputedStyle(s).position==="fixed"?[this.element,s]:[this.element]}nearest(s){return`${s.top+s.height/2<innerHeight/2?"top":"bottom"}-${s.left+s.width/2<innerWidth/2?"left":"right"}`}offset(s,e){document.documentElement.style.setProperty("--la-pip-dx",`${s}px`),document.documentElement.style.setProperty("--la-pip-dy",`${e}px`)}measure(){if(this.morphing?.playState==="running")return;let s=this.element.offsetHeight,e=s-(this.hasScreenTarget?this.screenTarget.offsetHeight:0);document.documentElement.style.setProperty("--la-pip-h",`${s}px`),document.documentElement.style.setProperty("--la-pip-bar-h",`${e}px`)}calm(){return B()}recall(s){try{return localStorage.getItem(s)}catch{return null}}keep(s,e){try{localStorage.setItem(s,e)}catch{}}};var la=[{hosts:["www.youtube.com","youtube.com","www.youtube-nocookie.com"],path:/^\/embed\//,shape:"video"},{hosts:["www.dailymotion.com","geo.dailymotion.com"],path:/^\/(embed|player)/,shape:"video"},{hosts:["player.vimeo.com"],path:/^\/video\//,shape:"video"},{hosts:["www.facebook.com"],path:/^\/plugins\/video\.php/,shape:"video"},{hosts:["www.instagram.com"],path:/\/embed/,shape:"portrait"},{hosts:["www.tiktok.com"],path:/^\/embed\//,shape:"tall"},{hosts:["open.spotify.com"],path:/^\/embed\//,shape:"audio"}],ha=/^https:\/\/(?:www\.|m\.)?(?:youtube\.com\/(?:watch\?(?:.*&)?v=|shorts\/)|youtu\.be\/)([\w-]{11})/,Mi=/(<iframe\b[^>]*>(?:\s*<\/iframe>)?)/i,Ri="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture; web-share";function Oi(s){let e=URL.canParse(s)?new URL(s):null;if(e?.protocol!=="https:")return null;let t=la.find(({hosts:r,path:i})=>r.includes(e.hostname)&&i.test(e.pathname));return t&&{url:e,shape:t.shape}}function br(s){let[,e]=s.match(ha)??[];return e&&`https://www.youtube.com/embed/${e}`}function vr(s,e){return s.match(new RegExp(`\\b${e}=["']([^"']+)["']`,"i"))?.[1]}var Ot=class extends d{static values={title:String};connect(){this.pastedCodes().forEach(s=>this.replaceCodes(s)),this.pastedLinks().forEach(s=>s.replaceWith(this.embed(br(s.href))))}pastedCodes(){let s=document.createTreeWalker(this.element,NodeFilter.SHOW_TEXT),e=[];for(;s.nextNode();)s.currentNode.data.includes("<iframe")&&e.push(s.currentNode);return e}replaceCodes(s){let e=s.data.split(Mi).map((t,r)=>r%2&&this.fromCode(t)||t);s.replaceWith(...e)}fromCode(s){let e=vr(s,"src");return e&&this.embed(e,vr(s,"title"))}pastedLinks(){return[...this.element.querySelectorAll("a[href]")].filter(s=>s.textContent.trim()===s.getAttribute("href")&&br(s.href))}embed(s,e){let t=Oi(s);if(!t)return null;let r=document.createElement("figure");return r.className=`la-embed la-embed-${t.shape}`,r.append(this.frame(t.url,e)),r}frame(s,e){let t=document.createElement("iframe");return Object.assign(t,{src:s.href,title:e||this.titleValue,loading:"lazy",allow:Ri}
30),Object.assign(t,{allowFullscreen:!0,referrerPolicy:"strict-origin-when-cross-origin"}),t}};var ua=260;function Ft(s){if(!(!s.open||s.hasAttribute("data-closing"))){if(B())return s.close();s.toggleAttribute("data-closing",!0),setTimeout(()=>{s.removeAttribute("data-closing"),s.close()},ua)}}var Pt=class extends d{static targets=["dialog","frame"];open(s){s.preventDefault();let e=s.currentTarget.closest("li")||s.currentTarget;this.origin(e.getBoundingClientRect()),this.press(e),this.frameTarget.replaceChildren(),this.frameTarget.src=s.currentTarget.href,this.dialogTarget.showModal()}origin(s){let e=this.dialogTarget.style;e.setProperty("--la-peek-x",`${s.left+s.width/2-innerWidth/2}px`),e.setProperty("--la-peek-y",`${s.top+s.height/2-innerHeight/2}px`)}press(s){this.calm||s.animate([{scale:1},{scale:.97},{scale:1}],{duration:320,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"})}close(){Ft(this.dialogTarget)}cancel(s){s.preventDefault(),this.close()}dismiss(s){s.target===this.dialogTarget&&this.close()}closed(){this.frameTarget.removeAttribute("src")}get calm(){return B()}};var xt=class extends d{static targets=["text"];connect(){this.resizing=new ResizeObserver(()=>this.measure()),this.resizing.observe(this.element)}disconnect(){this.resizing.disconnect()}measure(){let s=this.textTarget.scrollHeight;this.element.style.setProperty("--la-peek-full",`${s}px`),this.element.parentElement.style.setProperty("--la-peek-extra",`${Math.max(s-this.element.clientHeight,0)}px`)}};var da=6,It=class extends d{static targets=["track","current"];connect(){this.focusing=requestAnimationFrame(()=>this.focusCurrent())}disconnect(){cancelAnimationFrame(this.focusing),cancelAnimationFrame(this.glide)}focusCurrent(){!this.hasCurrentTarget||this.moved||(this.trackTarget.scrollLeft+=this.offset(this.currentTarget),this.watch())}recenter(){this.hasCurrentTarget&&this.trackTarget.scrollBy({left:this.offset(this.currentTarget),behavior:"smooth"})}watch(){if(!this.hasCurrentTarget)return;let s=this.offset(this.currentTarget);this.element.toggleAttribute("data-away",s<-this.currentTarget.offsetWidth/2||s>this.trackTarget.clientWidth*.75)}offset(s){let e=parseFloat(getComputedStyle(this.trackTarget).paddingLeft);return s.getBoundingClientRect().left-this.trackTarget.getBoundingClientRect().left-e}back(){this.page(-1)}forward(){this.page(1)}page(s){this.moved=!0,this.trackTarget.scrollBy({left:s*this.trackTarget.clientWidth*.8,behavior:"smooth"})}grab(s){this.moved=!0,this.dragged=!1,!(s.pointerType!=="mouse"||s.button!==0)&&(cancelAnimationFrame(this.glide),this.drag={x:s.clientX,left:this.trackTarget.scrollLeft,last:s.clientX,at:s.timeStamp,speed:0,id:s.pointerId})}move(s){!this.drag||!this.dragged&&Math.abs(s.clientX-this.drag.x)<da||(this.hold(),this.follow(s))}hold(){this.dragged||(this.dragged=!0,this.trackTarget.setPointerCapture(this.drag.id),this.trackTarget.dataset.dragging="true")}follow(s){this.drag.speed=(s.clientX-this.drag.last)/Math.max(s.timeStamp-this.drag.at,1),Object.assign(this.drag,{last:s.clientX,at:s.timeStamp}),this.trackTarget.scrollLeft=this.drag.left-(s.clientX-this.drag.x)}release(s){if(!this.drag)return;let e=s.timeStamp-this.drag.at>80?0:this.drag.speed*16;this.drag=null,delete this.trackTarget.dataset.dragging,this.dragged&&this.coast(e)}swallow(s){this.dragged&&(s.preventDefault(),s.stopPropagation(),this.dragged=!1)}coast(s){if(Math.abs(s)<.6)return this.settle();this.trackTarget.scrollLeft-=s,this.glide=requestAnimationFrame(()=>this.coast(s*.94))}settle(){let e=[...this.trackTarget.children].map(t=>this.offset(t)).reduce((t,r)=>Math.abs(r)<Math.abs(t)?r:t,1/0);this.trackTarget.scrollBy({left:e,behavior:"smooth"})}};var Bt=class extends d{static values={title:String,artist:String,artwork:String};connect(){this.dispatch("sent",{prefix:"song-request",detail:{title:this.titleValue,artist:this.artistValue,artwork:this.artworkValue}}),this.element.removeAttribute("data-controller")}};var Nt=class extends d{connect(){this.resizing=new ResizeObserver(()=>this.fade()),this.resizing.observe(this.element),this.fade()}disconnect(){this.resizing.disconnect()}fade(){let{scrollTop:s,clientHeight:e,scrollHeight:t}=this.element;this.element.toggleAttribute("data-more",s+e<t-4)}};var ma=1100,fa=24,pa=36,Dt=class extends d{connect(){this.place()}disconnect(){clearTimeout(this.hiding),cancelAnimationFrame(this.frame)}show(){this.place(),this.reveal()}near(s){innerWidth-s.clientX<fa&&this.scrollable&&this.reveal()}reveal(){this.element.toggleAttribute("data-shown",!0),clearTimeout(this.hiding),this.hiding=setTimeout(()=>{this.dragging||this.element.removeAttribute("data-shown")},ma)}place(){let{scrollHeight:s}=document.documentElement,e=Math.max(innerHeight/s*innerHeight,pa),t=scrollY/Math.max(s-innerHeight,1)*(innerHeight-e);Object.assign(this.element.style,{height:`${e}px`,transform:`translateY(${t}px)`}),this.element.hidden=s<=innerHeight+1}get scrollable(){return document.documentElement.scrollHeight>innerHeight+1}grab(s){this.dragging={y:s.clientY,scroll:scrollY},this.element.toggleAttribute("data-dragging",!0),s.preventDefault()}drag(s){this.dragging&&(this.pointerY=s.clientY,this.frame||=requestAnimationFrame(()=>this.follow()))}follow(){if(this.frame=null,!this.dragging)return;let{scrollHeight:s}=document.documentElement,e=(s-innerHeight)/(innerHeight-this.element.offsetHeight);scrollTo({top:this.dragging.scroll+(this.pointerY-this.dragging.y)*e,behavior:"instant"})}release(){this.dragging&&(this.dragging=null,this.element.removeAttribute("data-dragging"),this.reveal())}};var qt=class extends d{static targets=["field","clear"];static values={frame:String};connect(){this.showClear()}disconnect(){clearTimeout(this.typing)}type(){this.showClear(),clearTimeout(this.typing),this.typing=setTimeout(()=>this.submit(),320)}submit(){clearTimeout(this.typing),this.typing=null,this.element.requestSubmit()}trim({formData:s}){[...s].filter(([,e])=>!e).forEach(([e])=>s.delete(e))}clear(){this.fieldTarget.value&&(this.fieldTarget.value="",this.fieldTarget.focu
30s(),this.showClear(),this.submit())}settle({target:s}){s.id===this.frameValue&&(this.follow(new URL(s.src||location.href,location.href).searchParams),s.getBoundingClientRect().top<0&&s.scrollIntoView({block:"start"}))}follow(s){this.typing||(this.fieldTarget.value=s.get("q")||""),this.showClear()}showClear(){this.clearTarget.hidden=!this.fieldTarget.value}};var Vt=class extends d{static targets=["native"];static values={url:String,title:String};connect(){navigator.share&&this.nativeTargets.forEach(s=>s.hidden=!1)}disconnect(){clearTimeout(this.settling)}async copy(){try{await navigator.clipboard.writeText(this.urlValue),this.copied()}catch{}}copied(){this.element.toggleAttribute("data-copied",!0),clearTimeout(this.settling),this.settling=setTimeout(()=>this.element.toggleAttribute("data-copied",!1),2200)}open(){navigator.share({title:this.titleValue,url:this.urlValue}).catch(()=>{})}};var Ht=class extends d{static targets=["button"];static values={url:String,title:String,artist:String,artwork:String};connect(){this.stopFollowing=V.onChange(s=>this.mark(s?.url===this.urlValue)),this.stopTicking=V.onTick(s=>{this.playing&&this.element.style.setProperty("--la-preview",s)})}disconnect(){this.stopFollowing?.(),this.stopTicking?.()}toggle(){V.toggle({url:this.urlValue,title:this.titleValue,artist:this.artistValue,artwork:this.artworkValue})}mark(s){this.playing=s,this.element.toggleAttribute("data-previewing",s),(this.hasButtonTarget?this.buttonTargets:[this.element]).forEac
30h(t=>t.setAttribute("aria-pressed",s)),s||this.element.style.removeProperty("--la-preview")}};var ga="la-song-requests",ba=720*60*1e3,va=20,$t=s=>re(s).replace(/[([][^)\]]*[)\]]/g," ").replace(/[^a-z0-9]+/g," ").trim(),ya=new Set(["e","and","feat","ft","part","participacao","com","x","vs"]),Fi=s=>new Set($t(s).split(" ").filter(e=>e.length>1&&!ya.has(e))),wa=(s,e)=>{let[t,r]=[Fi(s),Fi(e)];return t.size===0||r.size===0||[...t].some(i=>r.has(i))};function yr(s){try{return(JSON.parse(localStorage.getItem(s))||[]).filter(t=>Date.now()-t.at<ba)}catch{return[]}}function Pi(s,e){try{localStorage.setItem(s,JSON.stringify(e.slice(0,va)))}catch{}}var Sa=(s,e,t)=>!s.playedAt&&!s.onAir&&$t(s.title)===e&&wa(s.artist,t);function xi(s){let e=`${ga}:${s}`;return{today:()=>yr(e),add({title:t,artist:r,artwork:i},n){Pi(e,[{title:t,artist:r,artwork:i,onAir:$t(n)||null,at:Date.now(),playedAt:null},...yr(e)])},played(t,r){let i=yr(e),n=$t(t);i.forEach(m=>{m.onAir&&m.onAir!==n&&(m.onAir=null)});let c=i.find(m=>Sa(m,n,r));return c&&(c.playedAt=Date.now()),Pi(e,i),c||null}}}function Ii(s,e,t){let r=t?.getBoundingClientRect();if(!s||!e||!r?.width||B())return;let i=Object.assign(new Image,{src:s,alt:"",className:"la-fly-cover"});Object.assign(i.style,{left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`}),document.body.append(i);let[n,c,m]=[r.left-e.left,r.top-e.top,r.width/e.width];i.animate([{transform:"none",opacity:1},{transform:`translate(${n}px, ${c}px) scale(${m})`,opacity:.35}],{duration:950,easing:"cubic-bezier(0.55, 0, 0.2, 1)"}).finished.then(()=>i.remove(),()=>i.remove())}var Ea=250,Aa=1800,Ta=7e3,Ca={songId:"song_id",trackName:"track_name",artistName:"artist_name",artworkUrl:"artwork_url",previewUrl:"preview_url"},Wt=class extends d{static targets=["dialog","frame","input","mine","mineList","mineItem","toast","toastArt","toastSong"];connect(){this.hasDialogTarget&&(this.log=xi(this.dialogTarget.dataset.slug),this.list(),this.stopFollowing=At(this.dialogTarget.dataset.slug,s=>this.heard(s)))}disconnect(){this.stopFollowing?.(),clearTimeout(this.typing),clearTimeout(this.closing),clearTimeout(this.toasting)}open(s){if(!this.hasDialogTarget)return;let e=this.songQuery(s?.params);this.frameTarget.src=e?`${this.dialogTarget.dataset.newUrl}?${e}`:this.dialogTarget.dataset.searchUrl,this.dialogTarget.open||this.dialogTarget.showModal(),e||this.inputTarget.focus()}songQuery(s={}){let e=Object.entries(Ca).filter(([t])=>s[t]).map(([t,r])=>[r,s[t]]);return e.length?new URLSearchParams(e).toString():null}close(){let s=this.dialogTarget;!s.open||s.hasAttribute("data-closing")||(this.flight&&(this.flight.from=this.flight.cover?.getBoundingClientRect()),Ft(s))}cancel(s){s.preventDefault(),this.close()}dismiss(s){s.target===this.dialogTarget&&this.close()}search(){clearTimeout(this.typing),this.typing=setTimeout(()=>this.find(),Ea)}find(){let s=this.inputTarget.value.trim(),e=this.dialogTarget.dataset.searchUrl;this.frameTarget.src=s?`${e}?q=${encodeURIComponent(s)}`:e}shortcut(s){s.key!=="/"||!this.hasDialogTarget||this.dialogTarget.open||this.typingIn(s.target)||(s.preventDefault(),this.open())}typingIn(s){return s.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(s.tagName)}sent({detail:s,target:e}){this.log.add(s,this.onAir),this.list(),this.flight={...s,cover:e.querySelector("[data-request-cover]")},clearTimeout(this.closing),this.closing=setTimeout(()=>this.close(),Aa)}closed(){clearTimeout(this.closing);let s=this.flight;this.flight=null,s?.from&&Ii(s.artwork,s.from,this.playerCover())}playerCover(){return[...document.querySelectorAll('[data-now-playing-target="artwork"]')].find(e=>e.getBoundingClientRect().width>0&&e.checkVisibility?.()!==!1)}heard(s){this.onAir=s?.song;let e=s?.song&&this.log.played(s.song,s.artist);e&&(this.list(),this.announce(e))}announce(s){Object.assign(this.toastArtTarget,{src:s.artwork||"",hidden:!s.artwork}),this.toastSongTarget.textContent=`${s.title} \xB7 ${s.artist}`,this.toastTarget.toggleAttribute("data-shown",!0),clearTimeout(this.toasting),this.toasting=setTimeout(()=>this.toastTarget.removeAttribute("data-shown"),Ta)}list(){let s=this.log.today();this.mineTarget.hidden=s.length===0,this.mineListTarget.replaceChildren(...s.map(e=>this.item(e)))}item(s){let e=this.mineItemTarget.content.firstElementChild.cloneNode(!0),t=r=>
30e.querySelector(`[data-part="${r}"]`);return Object.assign(t("art"),{src:s.artwork||"",hidden:!s.artwork}),t("title").textContent=s.title,t("artist").textContent=s.artist,this.status(t("status"),s.playedAt),e}status(s,e){let t=e&&new Date(e).toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"});s.textContent=t?this.dialogTarget.dataset.played.replace("{time}",t):this.dialogTarget.dataset.waiting,s.toggleAttribute("data-played",!!t)}};var _t=class extends d{connect(){this.observer=new IntersectionObserver(([s])=>this.announce(s.isIntersecting),{threshold:.2}),this.observer.observe(this.element)}disconnect(){this.observer?.disconnect()}announce(s){document.body.dataset.heroVisible=String(s)}};var Ut=class extends d{static targets=["input","item","empty"];filter(){let s=re(this.inputTarget.value).trim(),e=this.itemTargets.filter(t=>(t.hidden=!re(t.dataset.text).includes(s),!t.hidden));this.emptyTarget.hidden=e.length>0,this.dispatch("filtered")}};var wr=12,jt=class extends d{static targets=["button","menu"];place(s){if(s.newState!=="open")return;let e=this.buttonTarget.getBoundingClientRect(),t=Math.max(wr,Math.min(e.left,innerWidth-wr-this.width)),r=this.menuTarget.style;r.setProperty("--la-pick-top",`${e.bottom+10}px`),r.setProperty("--la-pick-left",`${t}px`),r.setProperty("--la-pick-origin",`${e.left+e.width/2-t}px`)}get width(){let s=parseFloat(getComputedStyle(document.documentElement).fontSize);return Math.min(20*s,innerWidth-2*wr)}};var zt=class extends d{static values={strength:{type:Number,default:2.5}};disconnect(){cancelAnimationFrame(this.frame)}measure(s){this.box=this.element.getBoundingClientRect(),this.move(s)}move(s){s.pointerType!=="mouse"||this.prefersLessMotion()||(this.pointer=s,this.frame||=requestAnimationFrame(()=>this.draw()))}reset(){cancelAnimationFrame(this.frame),this.frame=null,this.lean(.5,.5)}draw(){this.frame=null;let s=this.box||this.element.getBoundingClientRect();this.paint((this.pointer.clientX-s.left)/s.width,(this.pointer.clientY-s.top)/s.height)}paint(s,e){this.lean(s,e),this.element.style.setProperty("--mx",`${(s*100).toFixed(1)}%`),this.element.style.setProperty("--my",`${(e*100).toFixed(1)}%`)}lean(s,e){this.element.style.setProperty("--rx",`${((.5-e)*this.strengthValue).toFixed(2)}deg`),this.element.style.setProperty("--ry",`${((s-.5)*this.strengthValue).toFixed(2)}deg`)}prefersLessMotion(){return B()}};var Kt=class extends d{static targets=["input","fill"];static values={level:{type:Number,default:100},restore:{type:Number,default:80}};initialize(){this.levelValue=Math.round(L.volume*100)}connect(){this.inputTarget.value=this.levelValue,this.stopFollowing=L.onVolume(s=>this.follow(Math.round(s*100)))}disconnect(){this.stopFollowing?.()}follow(s){s===this.levelValue&&this.inputTarget.value===String(s)||(this.inputTarget.matches(":active")||(this.element.dataset.gliding="true"),s>0&&(this.restoreValue=s),this.levelValue=s,this.inputTarget.value=s)}change(){delete this.element.dataset.gliding,this.levelValue=Number(this.inputTarget.value),this.levelValue>0&&(this.restoreValue=this.levelValue),this.publish()}toggleMute(){this.element.dataset.gliding="true",this.levelValue=this.levelValue>0?0:this.restoreValue,this.inputTarget.value=this.levelValue,this.publish()}settle({target:s}){s===this.fillTarget&&delete this.element.dataset.gliding}publish(){L.setVolume(this.levelValue/100)}levelValueChanged(){this.element.style.setProperty("--la-level",`${this.levelValue}%`),this.element.dataset.band=this.band()}band(){return this.levelValue===0?"off":this.levelValue<50?"low":"high"}};var A=at.start();A.register("arrival",lt);A.register("back-to-top",ht);A.register("banner",ut);A.register("cover",mt);A.register("day-frame",ft);A.register("days-dock",pt);A.register("live-player",bt);A.register("live-remote",vt);A.register("live-video",wt);A.register("marquee",St);A.register("nav-indicator",Et);A.register("now-playing",Ct);A.register("on-air-clock",kt);A.register("peek",xt);A.register("picker",Lt);A.register("pip",Rt);A.register("post-embeds",Ot);A.register("program-peek",Pt);A.register("rail",It);A.register("request-sent",Bt);A.register("scroll-fade",Nt);A.register("scroll-thumb",Dt);A.register("search-bar",qt);A.register("share",Vt);A.register("song-preview",Ht);A.register("song-request",Wt);A.register("stage-watch",_t);A.register("station-filter",Ut);A.register("station-picker",jt);A.register("tilt",zt);A.register("volume",Kt);function Bi(){let s=document.querySelector('meta[name="la-google-analytics"]')?.content;s&&(window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",s))}Bi(); 31/*! Bundled license information: 32 33@hotwired/turbo/dist/turbo.es2017-esm.js: 34 (*! 35 Turbo 8.0.23 36 Copyright © 2026 37signals LLC 37 *) 38*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.