Current section

Files

Jump to
phoenix_storybook priv static js iframe.js
Raw

priv/static/js/iframe.js

(()=>{var _t="consecutive-reloads",$t=10,jt=5e3,Bt=1e4,Jt=3e4,Pt=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],D="data-phx-component",$e="data-phx-link",Vt="track-static",Xt="data-phx-link-state",F="data-phx-ref",K="data-phx-ref-src",Rt="track-uploads",G="data-phx-upload-ref",et="data-phx-preflighted-refs",qt="data-phx-done-refs",at="drop-target",Ge="data-phx-active-refs",Pe="phx:live-file:updated",Ye="data-phx-skip",ht="data-phx-prune",lt="page-loading",dt="phx-connected",je="phx-loading",Be="phx-no-feedback",ct="phx-error",Z="data-phx-parent-id",tt="data-phx-main",le="data-phx-root-id",Wt="trigger-action",xe="feedback-for",Qe="phx-has-focused",zt=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],xt=["checkbox","radio"],Le="phx-has-submitted",z="data-phx-session",te=`[${z}]`,ut="data-phx-sticky",ae="data-phx-static",Je="data-phx-readonly",be="data-phx-disabled",Ze="disable-with",ye="data-phx-disable-with-restore",ie="hook",Kt="debounce",Gt="throttle",De="update",Ve="stream",Yt="key",H="phxPrivate",ft="auto-recover",we="phx:live-socket:debug",Xe="phx:live-socket:profiling",qe="phx:live-socket:latency-sim",Qt="progress",pt="mounted",Zt=1,ei=200,ti="phx-",ii=3e4,se="debounce-trigger",Se="throttled",gt="debounce-prev-key",si={debounce:300,throttle:300},Ae="d",N="s",L="c",mt="e",vt="r",bt="t",ni="p",ri="stream",oi=class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(e)}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return _("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}},_=(e,t)=>console.error&&console.error(e,t),q=e=>{let t=typeof e;return t==="number"||t==="string"&&/^(0|[1-9]\d*)$/.test(e)};function ai(){let e=new Set,t=document.querySelectorAll("*[id]");for(let i=0,s=t.length;i<s;i++)e.has(t[i].id)?console.error(`Multiple IDs detected: ${t[i].id}. Ensure unique element ids.`):e.add(t[i].id)}var hi=(e,t,i,s)=>{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,s)},We=e=>typeof e=="function"?e:function(){return e},Re=e=>JSON.parse(JSON.stringify(e)),he=(e,t,i)=>{do{if(e.matches(`[${t}]`)&&!e.disabled)return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1&&!(i&&i.isSameNode(e)||e.matches(te)));return null},ne=e=>e!==null&&typeof e=="object"&&!(e instanceof Array),li=(e,t)=>JSON.stringify(e)===JSON.stringify(t),yt=e=>{for(let t in e)return!1;return!0},W=(e,t)=>e&&t(e),di=function(e,t,i,s){e.forEach(n=>{new oi(n,i.config.chunk_size,s).upload()})},Lt={canPushState(){return typeof history.pushState<"u"},dropLocal(e,t,i){return e.removeItem(this.localKey(t,i))},updateLocal(e,t,i,s,n){let r=this.getLocal(e,t,i),o=this.localKey(t,i),a=r===null?s:n(r);return e.setItem(o,JSON.stringify(a)),a},getLocal(e,t,i){return JSON.parse(e.getItem(this.localKey(t,i)))},updateCurrentState(e){this.canPushState()&&history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,i){if(this.canPushState()){if(i!==window.location.href){if(t.type=="redirect"&&t.scroll){let n=history.state||{};n.scroll=t.scroll,history.replaceState(n,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null);let s=this.getHashTargetEl(window.location.hash);s?s.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)}}else this.redirect(i)},setCookie(e,t){document.cookie=`${e}=${t}`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(e,t){t&&Lt.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey(e,t){return`${e}-${t}`},getHashTargetEl(e){let t=e.toString().substring(1);if(t!=="")return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},M=Lt,O={byId(e){return document.getElementById(e)||_(`no id found for ${e}`)},removeClass(e,t){e.classList.remove(t),e.classList.length===0&&e.removeAttribute("class")},all(e,t,i){if(!e)return[];let s=Array.from(e.querySelectorAll(t));return i?s.forEach(i):s},childNodeLength(e){let t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput(e){return e.type==="file"&&e.getAttribute(G)!==null},findUploadInputs(e){return this.all(e,`input[type="file"][${G}]`)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${D}="${t}"]`),e)},isPhxDestroyed(e){return!!(e.id&&O.private(e,"destroyed"))},wantsNewTab(e){return e.ctrlKey||e.shiftKey||e.metaKey||e.button&&e.button===1||e.target.getAttribute("target")==="_blank"},isUnloadableFormSubmit(e){return!e.defaultPrevented&&!this.wantsNewTab(e)},isNewPageHref(e,t){let i;try{i=new URL(e)}catch{try{i=new URL(e,t)}catch{return!0}}return i.host===t.host&&i.protocol===t.protocol&&i.pathname===t.pathname&&i.search===t.search?i.hash===""&&!i.href.endsWith("#"):!0},markPhxChildDestroyed(e){this.isPhxChild(e)&&e.setAttribute(z,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment(e,t){let i=document.createElement("template");return i.innerHTML=e,this.findPhxChildren(i.content,t)},isIgnored(e,t){return(e.getAttribute(t)||e.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(e,t,i){return e.getAttribute&&i.indexOf(e.getAttribute(t))>=0},findPhxSticky(e){return this.all(e,`[${ut}]`)},findPhxChildren(e,t){return this.all(e,`${te}[${Z}="${t}"]`)},findParentCIDs(e,t){let i=new Set(t),s=t.reduce((n,r)=>{let o=`[${D}="${r}"] [${D}]`;return this.filterWithinSameLiveView(this.all(e,o),e).map(a=>parseInt(a.getAttribute(D))).forEach(a=>n.delete(a)),n},i);return s.size===0?new Set(t):s},filterWithinSameLiveView(e,t){return t.querySelector(te)?e.filter(i=>this.withinSameLiveView(i,t)):e},withinSameLiveView(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(e.getAttribute(z)!==null)return!1}},private(e,t){return e[H]&&e[H][t]},deletePrivate(e,t){e[H]&&delete e[H][t]},putPrivate(e,t,i){e[H]||(e[H]={}),e[H][t]=i},updatePrivate(e,t,i,s){let n=this.private(e,t);n===void 0?this.putPrivate(e,t,s(i)):this.putPrivate(e,t,s(n))},copyPrivates(e,t){t[H]&&(e[H]=t[H])},putTitle(e){let t=document.querySelector("title");if(t){let{prefix:i,suffix:s}=t.dataset;document.title=`${i||""}${e}${s||""}`}else document.title=e},debounce(e,t,i,s,n,r,o,a){let h=e.getAttribute(i),u=e.getAttribute(n);h===""&&(h=s),u===""&&(u=r);let c=h||u;switch(c){case null:return a();case"blur":this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>a());return;default:let f=parseInt(c),g=()=>u?this.deletePrivate(e,Se):a(),p=this.incCycle(e,se,g);if(isNaN(f))return _(`invalid throttle/debounce value: ${c}`);if(u){let S=!1;if(t.type==="keydown"){let P=this.private(e,gt);this.putPrivate(e,gt,t.key),S=P!==t.key}if(!S&&this.private(e,Se))return!1;a(),this.putPrivate(e,Se,!0),setTimeout(()=>{o()&&this.triggerCycle(e,se)},f)}else setTimeout(()=>{o()&&this.triggerCycle(e,se,p)},f);let w=e.form;w&&this.once(w,"bind-debounce")&&w.addEventListener("submit",()=>{Array.from(new FormData(w).entries(),([S])=>{let P=w.querySelector(`[name="${S}"]`);this.incCycle(P,se),this.deletePrivate(P,Se)})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>this.triggerCycle(e,se))}},triggerCycle(e,t,i){let[s,n]=this.private(e,t);i||(i=s),i===s&&(this.incCycle(e,t),n())},once(e,t){return this.private(e,t)===!0?!1:(this.putPrivate(e,t,!0),!0)},incCycle(e,t,i=function(){}){let[s]=this.private(e,t)||[0,i];return s++,this.putPrivate(e,t,[s,i]),s},discardError(e,t,i){let s=t.getAttribute&&t.getAttribute(i),n=s&&e.querySelector(`[id="${s}"], [name="${s}"], [name="${s}[]"]`);n&&(this.private(n,Qe)||this.private(n,Le)||t.classList.add(Be))},resetForm(e,t){Array.from(e.elements).forEach(i=>{let s=`[${t}="${i.id}"],
[${t}="${i.name}"],
[${t}="${i.name.replace(/\[\]$/,"")}"]`;this.deletePrivate(i,Qe),this.deletePrivate(i,Le),this.all(document,s,n=>{n.classList.add(Be)})})},showError(e,t){(e.id||e.name)&&this.all(e.form,`[${t}="${e.id}"], [${t}="${e.name}"]`,i=>{this.removeClass(i,Be)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(Z)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(ut)!==null},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${Z}]`)[0]},dispatchEvent(e,t,i={}){let n={bubbles:i.bubbles===void 0?!0:!!i.bubbles,cancelable:!0,detail:i.detail||{}},r=t==="click"?new MouseEvent("click",n):new CustomEvent(t,n);e.dispatchEvent(r)},cloneNode(e,t){if(typeof t>"u")return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let s=i.exclude||[],n=i.isIgnored,r=t.attributes;for(let a=r.length-1;a>=0;a--){let h=r[a].name;s.indexOf(h)<0&&e.setAttribute(h,t.getAttribute(h))}let o=e.attributes;for(let a=o.length-1;a>=0;a--){let h=o[a].name;n?h.startsWith("data-")&&!t.hasAttribute(h)&&e.removeAttribute(h):t.hasAttribute(h)||e.removeAttribute(h)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||O.mergeAttrs(e,t,{exclude:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange(e){return e.setSelectionRange&&(e.type==="text"||e.type==="textarea")},restoreFocus(e,t,i){if(!O.isTextualInput(e))return;let s=e.matches(":focus");e.readOnly&&e.blur(),s||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&e.type!=="button"},syncAttrsToProps(e){e instanceof HTMLInputElement&&xt.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return zt.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null},syncPendingRef(e,t,i){let s=e.getAttribute(F);if(s===null)return!0;let n=e.getAttribute(K);return O.isFormInput(e)||e.getAttribute(i)!==null?(O.isUploadInput(e)&&O.mergeAttrs(e,t,{isIgnored:!0}),O.putPrivate(e,F,t),!1):(Pt.forEach(r=>{e.classList.contains(r)&&t.classList.add(r)}),t.setAttribute(F,s),t.setAttribute(K,n),!0)},cleanChildNodes(e,t){if(O.isPhxUpdate(e,t,["append","prepend"])){let i=[];e.childNodes.forEach(s=>{s.id||(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()===""||_(`only HTML element tags with an id are allowed inside containers with phx-update.
removing illegal node: "${(s.outerHTML||s.nodeValue).trim()}"
`),i.push(s))}),i.forEach(s=>s.remove())}},replaceRootContainer(e,t,i){let s=new Set(["id",z,ae,tt,le]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(n=>!s.has(n.name.toLowerCase())).forEach(n=>e.removeAttribute(n.name)),Object.keys(i).filter(n=>!s.has(n.toLowerCase())).forEach(n=>e.setAttribute(n,i[n])),e;{let n=document.createElement(t);return Object.keys(i).forEach(r=>n.setAttribute(r,i[r])),s.forEach(r=>n.setAttribute(r,e.getAttribute(r))),n.innerHTML=e.innerHTML,e.replaceWith(n),n}},getSticky(e,t,i){let s=(O.private(e,"sticky")||[]).find(([n])=>t===n);if(s){let[n,r,o]=s;return o}else return typeof i=="function"?i():i},deleteSticky(e,t){this.updatePrivate(e,"sticky",[],i=>i.filter(([s,n])=>s!==t))},putSticky(e,t,i){let s=i(e);this.updatePrivate(e,"sticky",[],n=>{let r=n.findIndex(([o])=>t===o);return r>=0?n[r]=[t,i,s]:n.push([t,i,s]),n})},applyStickyOperations(e){let t=O.private(e,"sticky");t&&t.forEach(([i,s,n])=>this.putSticky(e,i,s))}},l=O,ze=class{static isActive(e,t){let i=t._phxRef===void 0,n=e.getAttribute(Ge).split(",").indexOf(T.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute(et).split(",").indexOf(T.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=T.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(Pe,this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{T.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(Pe,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),T.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Pe,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Ge).split(",").indexOf(this.ref)===-1&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(e){if(this.meta.uploader){let t=e[this.meta.uploader]||_(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:di}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||_(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},ci=0,T=class{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(ci++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let s=this.activeFiles(e).find(n=>this.genFileRef(n)===t);i(URL.createObjectURL(s))}static hasUploadsInProgress(e){let t=0;return l.findUploadInputs(e).forEach(i=>{i.getAttribute(et)!==i.getAttribute(qt)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(s=>{let n={path:e.name},r=e.getAttribute(G);i[r]=i[r]||[],n.ref=this.genFileRef(s),n.last_modified=s.lastModified,n.name=s.name||n.ref,n.relative_path=s.webkitRelativePath,n.type=s.type,n.size=s.size,i[r].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(G),l.putPrivate(e,"files",[])}static untrackFile(e,t){l.putPrivate(e,"files",l.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let s=t.filter(n=>!this.activeFiles(e).find(r=>Object.is(r,n)));l.putPrivate(e,"files",this.activeFiles(e).concat(s)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),l.putPrivate(e,"files",t)}static activeFileInputs(e){let t=l.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(l.private(e,"files")||[]).filter(t=>ze.isActive(e,t))}static inputsAwaitingPreflight(e){let t=l.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!ze.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(T.filesAwaitingPreflight(e)||[]).map(s=>new ze(e,s,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(n=>(n.zipPostFlight(e),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),n));let s=this._entries.reduce((n,r)=>{let{name:o,callback:a}=r.uploader(i.uploaders);return n[o]=n[o]||{callback:a,entries:[]},n[o].entries.push(r),n},{});for(let n in s){let{callback:r,entries:o}=s[n];r(o,t,e,i)}}},ui={focusMain(){let e=document.querySelector("main h1, main, h1");if(e){let t=e.tabIndex;e.tabIndex=-1,e.focus(),e.tabIndex=t}},anyOf(e,t){return t.find(i=>e instanceof i)},isFocusable(e,t){return e instanceof HTMLAnchorElement&&e.rel!=="ignore"||e instanceof HTMLAreaElement&&e.href!==void 0||!e.disabled&&this.anyOf(e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||e instanceof HTMLIFrameElement||e.tabIndex>0||!t&&e.tabIndex===0&&e.getAttribute("tabindex")!==null&&e.getAttribute("aria-hidden")!=="true"},attemptFocus(e,t){if(this.isFocusable(e,t))try{e.focus()}catch{}return!!document.activeElement&&document.activeElement.isSameNode(e)},focusFirstInteractive(e){let t=e.firstElementChild;for(;t;){if(this.attemptFocus(t,!0)||this.focusFirstInteractive(t,!0))return!0;t=t.nextElementSibling}},focusFirst(e){let t=e.firstElementChild;for(;t;){if(this.attemptFocus(t)||this.focusFirst(t))return!0;t=t.nextElementSibling}},focusLast(e){let t=e.lastElementChild;for(;t;){if(this.attemptFocus(t)||this.focusLast(t))return!0;t=t.previousElementSibling}}},ee=ui,fi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Ge)},preflightedRefs(){return this.el.getAttribute(et)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,e===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(Pe))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(G)),T.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>ee.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>ee.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&ee.focusFirst(this.el)}}},pi=fi,gi=class{constructor(e,t,i){let s=new Set,n=new Set([...t.children].map(o=>o.id)),r=[];Array.from(e.children).forEach(o=>{if(o.id&&(s.add(o.id),n.has(o.id))){let a=o.previousElementSibling&&o.previousElementSibling.id;r.push({elementId:o.id,previousElementId:a})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=r,this.elementIdsToAdd=[...n].filter(o=>!s.has(o))}perform(){let e=l.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?W(document.getElementById(t.previousElementId),i=>{W(document.getElementById(t.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):W(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{W(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}},wt=11;function mi(e,t){var i=t.attributes,s,n,r,o,a;if(!(t.nodeType===wt||e.nodeType===wt)){for(var h=i.length-1;h>=0;h--)s=i[h],n=s.name,r=s.namespaceURI,o=s.value,r?(n=s.localName||n,a=e.getAttributeNS(r,n),a!==o&&(s.prefix==="xmlns"&&(n=s.name),e.setAttributeNS(r,n,o))):(a=e.getAttribute(n),a!==o&&e.setAttribute(n,o));for(var u=e.attributes,c=u.length-1;c>=0;c--)s=u[c],n=s.name,r=s.namespaceURI,r?(n=s.localName||n,t.hasAttributeNS(r,n)||e.removeAttributeNS(r,n)):t.hasAttribute(n)||e.removeAttribute(n)}}var ke,vi="http://www.w3.org/1999/xhtml",x=typeof document>"u"?void 0:document,bi=!!x&&"content"in x.createElement("template"),yi=!!x&&x.createRange&&"createContextualFragment"in x.createRange();function wi(e){var t=x.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function Si(e){ke||(ke=x.createRange(),ke.selectNode(x.body));var t=ke.createContextualFragment(e);return t.childNodes[0]}function Ai(e){var t=x.createElement("body");return t.innerHTML=e,t.childNodes[0]}function ki(e){return e=e.trim(),bi?wi(e):yi?Si(e):Ai(e)}function Ee(e,t){var i=e.nodeName,s=t.nodeName,n,r;return i===s?!0:(n=i.charCodeAt(0),r=s.charCodeAt(0),n<=90&&r>=97?i===s.toUpperCase():r<=90&&n>=97?s===i.toUpperCase():!1)}function Ei(e,t){return!t||t===vi?x.createElement(e):x.createElementNS(t,e)}function Ci(e,t){for(var i=e.firstChild;i;){var s=i.nextSibling;t.appendChild(i),i=s}return t}function Ke(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var St={OPTION:function(e,t){var i=e.parentNode;if(i){var s=i.nodeName.toUpperCase();s==="OPTGROUP"&&(i=i.parentNode,s=i&&i.nodeName.toUpperCase()),s==="SELECT"&&!i.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}Ke(e,t,"selected")},INPUT:function(e,t){Ke(e,t,"checked"),Ke(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var s=e.firstChild;if(s){var n=s.nodeValue;if(n==i||!i&&n==e.placeholder)return;s.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i=-1,s=0,n=e.firstChild,r,o;n;)if(o=n.nodeName&&n.nodeName.toUpperCase(),o==="OPTGROUP")r=n,n=r.firstChild;else{if(o==="OPTION"){if(n.hasAttribute("selected")){i=s;break}s++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}e.selectedIndex=i}}},re=1,At=11,kt=3,Et=8;function X(){}function Ti(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function _i(e){return function(i,s,n){if(n||(n={}),typeof s=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var r=s;s=x.createElement("html"),s.innerHTML=r}else s=ki(s);else s.nodeType===At&&(s=s.firstElementChild);var o=n.getNodeKey||Ti,a=n.onBeforeNodeAdded||X,h=n.onNodeAdded||X,u=n.onBeforeElUpdated||X,c=n.onElUpdated||X,f=n.onBeforeNodeDiscarded||X,g=n.onNodeDiscarded||X,p=n.onBeforeElChildrenUpdated||X,w=n.skipFromChildren||X,S=n.addChild||function(v,m){return v.appendChild(m)},P=n.childrenOnly===!0,d=Object.create(null),b=[];function E(v){b.push(v)}function R(v,m){if(v.nodeType===re)for(var k=v.firstChild;k;){var y=void 0;m&&(y=o(k))?E(y):(g(k),k.firstChild&&R(k,m)),k=k.nextSibling}}function fe(v,m,k){f(v)!==!1&&(m&&m.removeChild(v),g(v),R(v,k))}function nt(v){if(v.nodeType===re||v.nodeType===At)for(var m=v.firstChild;m;){var k=o(m);k&&(d[k]=m),nt(m),m=m.nextSibling}}nt(i);function Ne(v){h(v);for(var m=v.firstChild;m;){var k=m.nextSibling,y=o(m);if(y){var A=d[y];A&&Ee(m,A)?(m.parentNode.replaceChild(A,m),pe(A,m)):Ne(m)}else Ne(m);m=k}}function Mt(v,m,k){for(;m;){var y=m.nextSibling;(k=o(m))?E(k):fe(m,v,!0),m=y}}function pe(v,m,k){var y=o(m);y&&delete d[y],!(!k&&(u(v,m)===!1||(e(v,m),c(v),p(v,m)===!1)))&&(v.nodeName!=="TEXTAREA"?Ut(v,m):St.TEXTAREA(v,m))}function Ut(v,m){var k=w(v),y=m.firstChild,A=v.firstChild,Y,B,Q,me,J;e:for(;y;){for(me=y.nextSibling,Y=o(y);!k&&A;){if(Q=A.nextSibling,y.isSameNode&&y.isSameNode(A)){y=me,A=Q;continue e}B=o(A);var ve=A.nodeType,V=void 0;if(ve===y.nodeType&&(ve===re?(Y?Y!==B&&((J=d[Y])?Q===J?V=!1:(v.insertBefore(J,A),B?E(B):fe(A,v,!0),A=J):V=!1):B&&(V=!1),V=V!==!1&&Ee(A,y),V&&pe(A,y)):(ve===kt||ve==Et)&&(V=!0,A.nodeValue!==y.nodeValue&&(A.nodeValue=y.nodeValue))),V){y=me,A=Q;continue e}B?E(B):fe(A,v,!0),A=Q}if(Y&&(J=d[Y])&&Ee(J,y))k||S(v,J),pe(J,y);else{var Fe=a(y);Fe!==!1&&(Fe&&(y=Fe),y.actualize&&(y=y.actualize(v.ownerDocument||x)),S(v,y),Ne(y))}y=me,A=Q}Mt(v,A,B);var ot=St[v.nodeName];ot&&ot(v,m)}var C=i,ge=C.nodeType,rt=s.nodeType;if(!P){if(ge===re)rt===re?Ee(i,s)||(g(i),C=Ci(i,Ei(s.nodeName,s.namespaceURI))):C=s;else if(ge===kt||ge===Et){if(rt===ge)return C.nodeValue!==s.nodeValue&&(C.nodeValue=s.nodeValue),C;C=s}}if(C===s)g(i);else{if(s.isSameNode&&s.isSameNode(C))return;if(pe(C,s,P),b)for(var Me=0,Ft=b.length;Me<Ft;Me++){var Ue=d[b[Me]];Ue&&fe(Ue,Ue.parentNode,!1)}}return!P&&C!==i&&i.parentNode&&(C.actualize&&(C=C.actualize(i.ownerDocument||x)),i.parentNode.replaceChild(C,i)),C}}var Pi=_i(mi),Ct=Pi,Ce=class{static patchEl(e,t,i){Ct(e,t,{childrenOnly:!1,onBeforeElUpdated:(s,n)=>{if(i&&i.isSameNode(s)&&l.isFormInput(s))return l.mergeFocusedInput(s,n),!1}})}constructor(e,t,i,s,n,r){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=s,this.streams=n,this.streamInserts={},this.targetCID=r,this.cidPatch=q(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(De);l.all(this.container,`[${e}=${Ve}]`,t=>t.innerHTML=""),l.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(ht,"")})}perform(){let{view:e,liveSocket:t,container:i,html:s}=this,n=this.isCIDPatch()?this.targetCIDContainer(s):i;if(this.isCIDPatch()&&!n)return;let r=t.getActiveElement(),{selectionStart:o,selectionEnd:a}=r&&l.hasSelectionRange(r)?r:{},h=t.binding(De),u=t.binding(xe),c=t.binding(Ze),f=t.binding(Wt),g=[],p=[],w=[],S=null,P=t.time("premorph container prep",()=>this.buildDiffHTML(i,s,h,n));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{this.streams.forEach(([d,b])=>{this.streamInserts=Object.assign(this.streamInserts,d),b.forEach(E=>{let R=i.querySelector(`[id="${E}"]`);R&&(this.maybePendingRemove(R)||(R.remove(),this.onNodeDiscarded(R)))})}),Ct(n,P,{childrenOnly:n.getAttribute(D)===null,getNodeKey:d=>l.isPhxDestroyed(d)?null:d.id,skipFromChildren:d=>d.getAttribute(h)===Ve,addChild:(d,b)=>{let E=b.id?this.streamInserts[b.id]:void 0;if(E===void 0)return d.appendChild(b);if(E===0)d.insertAdjacentElement("afterbegin",b);else if(E===-1)d.appendChild(b);else if(E>0){let R=Array.from(d.children)[E];d.insertBefore(b,R)}},onBeforeNodeAdded:d=>(this.trackBefore("added",d),d),onNodeAdded:d=>{d instanceof HTMLImageElement&&d.srcset?d.srcset=d.srcset:d instanceof HTMLVideoElement&&d.autoplay&&d.play(),l.isNowTriggerFormExternal(d,f)&&(S=d),l.discardError(n,d,u),(l.isPhxChild(d)&&e.ownsElement(d)||l.isPhxSticky(d)&&e.ownsElement(d.parentNode))&&this.trackAfter("phxChildAdded",d),g.push(d)},onNodeDiscarded:d=>this.onNodeDiscarded(d),onBeforeNodeDiscarded:d=>d.getAttribute&&d.getAttribute(ht)!==null?!0:!(d.parentElement!==null&&d.id&&l.isPhxUpdate(d.parentElement,h,[Ve,"append","prepend"])||this.maybePendingRemove(d)||this.skipCIDSibling(d)),onElUpdated:d=>{l.isNowTriggerFormExternal(d,f)&&(S=d),p.push(d),this.maybeReOrderStream(d)},onBeforeElUpdated:(d,b)=>{if(l.cleanChildNodes(b,h),this.skipCIDSibling(b)||l.isPhxSticky(d))return!1;if(l.isIgnored(d,h)||d.form&&d.form.isSameNode(S))return this.trackBefore("updated",d,b),l.mergeAttrs(d,b,{isIgnored:!0}),p.push(d),l.applyStickyOperations(d),!1;if(d.type==="number"&&d.validity&&d.validity.badInput)return!1;if(!l.syncPendingRef(d,b,c))return l.isUploadInput(d)&&(this.trackBefore("updated",d,b),p.push(d)),l.applyStickyOperations(d),!1;if(l.isPhxChild(b)){let R=d.getAttribute(z);return l.mergeAttrs(d,b,{exclude:[ae]}),R!==""&&d.setAttribute(z,R),d.setAttribute(le,this.rootID),l.applyStickyOperations(d),!1}return l.copyPrivates(b,d),l.discardError(n,b,u),r&&d.isSameNode(r)&&l.isFormInput(d)&&d.type!=="hidden"?(this.trackBefore("updated",d,b),l.mergeFocusedInput(d,b),l.syncAttrsToProps(d),p.push(d),l.applyStickyOperations(d),!1):(l.isPhxUpdate(b,h,["append","prepend"])&&w.push(new gi(d,b,b.getAttribute(h))),l.syncAttrsToProps(b),l.applyStickyOperations(b),this.trackBefore("updated",d,b),!0)}})}),t.isDebugEnabled()&&ai(),w.length>0&&t.time("post-morph append/prepend restoration",()=>{w.forEach(d=>d.perform())}),t.silenceEvents(()=>l.restoreFocus(r,o,a)),l.dispatchEvent(document,"phx:update"),g.forEach(d=>this.trackAfter("added",d)),p.forEach(d=>this.trackAfter("updated",d)),this.transitionPendingRemoves(),S&&(t.unload(),S.submit()),!0}onNodeDiscarded(e){(l.isPhxChild(e)||l.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}maybeReOrderStream(e){let t=e.id?this.streamInserts[e.id]:void 0;if(t!==void 0){if(t===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(t>0){let i=Array.from(e.parentElement.children),s=i.indexOf(e);if(t>=i.length-1)e.parentElement.appendChild(e);else{let n=i[t];s>t?e.parentElement.insertBefore(e,n):e.parentElement.insertBefore(e,n.nextElementSibling)}}}}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&(t.transitionRemoves(e),t.requestDOMUpdate(()=>{e.forEach(i=>{let s=l.firstPhxChild(i);s&&t.destroyViewByEl(s),i.remove()}),this.trackAfter("transitionsDiscarded",e)}))}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(Ye)!==null}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=l.findComponentNodeList(this.container,this.targetCID);return i.length===0&&l.childNodeLength(e)===1?t:t&&t.parentNode}buildDiffHTML(e,t,i,s){let n=this.isCIDPatch(),r=n&&s.getAttribute(D)===this.targetCID.toString();if(!n||r)return t;{let o=null,a=document.createElement("template");o=l.cloneNode(s);let[h,...u]=l.findComponentNodeList(o,this.targetCID);return a.innerHTML=t,u.forEach(c=>c.remove()),Array.from(o.childNodes).forEach(c=>{c.id&&c.nodeType===Node.ELEMENT_NODE&&c.getAttribute(D)!==this.targetCID.toString()&&(c.setAttribute(Ye,""),c.innerHTML="")}),Array.from(a.content.childNodes).forEach(c=>o.insertBefore(c,h)),h.remove(),o.outerHTML}}indexOf(e,t){return Array.from(e.children).indexOf(t)}},Tt=class{static extract(e){let{[vt]:t,[mt]:i,[bt]:s}=e;return delete e[vt],delete e[mt],delete e[bt],{diff:e,title:s,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){let[t,i]=this.recursiveToString(this.rendered,this.rendered[L],e);return[t,i]}recursiveToString(e,t=e[L],i){i=i?new Set(i):null;let s={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,s),[s.buffer,s.streams]}componentCIDs(e){return Object.keys(e[L]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[L]?Object.keys(e).length===1:!1}getComponent(e,t){return e[L][t]}mergeDiff(e){let t=e[L],i={};if(delete e[L],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[L]=this.rendered[L]||{},t){let s=this.rendered[L];for(let n in t)t[n]=this.cachedFindComponent(n,t[n],s,t,i);for(let n in t)s[n]=t[n];e[L]=t}}cachedFindComponent(e,t,i,s,n){if(n[e])return n[e];{let r,o,a=t[N];if(q(a)){let h;a>0?h=this.cachedFindComponent(a,s[a],i,s,n):h=i[-a],o=h[N],r=this.cloneMerge(h,t),r[N]=o}else r=t[N]!==void 0?t:this.cloneMerge(i[e]||{},t);return n[e]=r,r}}mutableMerge(e,t){return t[N]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let s=t[i],n=e[i];ne(s)&&s[N]===void 0&&ne(n)?this.doMutableMerge(n,s):e[i]=s}}cloneMerge(e,t){let i={...e,...t};for(let s in i){let n=t[s],r=e[s];ne(n)&&n[N]===void 0&&ne(r)&&(i[s]=this.cloneMerge(r,n))}return i}componentToString(e){let[t,i]=this.recursiveCIDToString(this.rendered[L],e);return[t,i]}pruneCIDs(e){e.forEach(t=>delete this.rendered[L][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[N]}templateStatic(e,t){return typeof e=="number"?t[e]:e}toOutputBuffer(e,t,i){if(e[Ae])return this.comprehensionToBuffer(e,t,i);let{[N]:s}=e;s=this.templateStatic(s,t),i.buffer+=s[0];for(let n=1;n<s.length;n++)this.dynamicToBuffer(e[n-1],t,i),i.buffer+=s[n]}comprehensionToBuffer(e,t,i){let{[Ae]:s,[N]:n,[ri]:r}=e,[o,a]=r||[{},[]];n=this.templateStatic(n,t);let h=t||e[ni];for(let u=0;u<s.length;u++){let c=s[u];i.buffer+=n[0];for(let f=1;f<n.length;f++)this.dynamicToBuffer(c[f-1],h,i),i.buffer+=n[f]}r!==void 0&&(e[Ae].length>0||a.length>0)&&(e[Ae]=[],i.streams.add(r))}dynamicToBuffer(e,t,i){if(typeof e=="number"){let[s,n]=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=s,i.streams=new Set([...i.streams,...n])}else ne(e)?this.toOutputBuffer(e,t,i):i.buffer+=e}recursiveCIDToString(e,t,i){let s=e[t]||_(`no component for CID ${t}`,e),n=document.createElement("template"),[r,o]=this.recursiveToString(s,e,i);n.innerHTML=r;let a=n.content,h=i&&!i.has(t),[u,c]=Array.from(a.childNodes).reduce(([f,g],p,w)=>p.nodeType===Node.ELEMENT_NODE?p.getAttribute(D)?[f,!0]:(p.setAttribute(D,t),p.id||(p.id=`${this.parentViewId()}-${t}-${w}`),h&&(p.setAttribute(Ye,""),p.innerHTML=""),[!0,g]):p.nodeValue.trim()!==""?(_(`only HTML element tags are allowed at the root of components.
got: "${p.nodeValue.trim()}"
within:
`,n.innerHTML.trim()),p.replaceWith(this.createSpan(p.nodeValue,t)),[!0,g]):(p.remove(),[f,g]),[!1,!1]);return!u&&!c?(_(`expected at least one HTML element tag inside a component, but the component is empty:
`,n.innerHTML.trim()),[this.createSpan("",t).outerHTML,o]):!u&&c?(_("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",n.innerHTML.trim()),[n.innerHTML,o]):[n.innerHTML,o]}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(D,t),i}},Ri=1,oe=class{static makeID(){return Ri++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let s in this.__callbacks)this[s]=this.__callbacks[s]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,t={},i=function(){}){return this.__view.pushHookEvent(null,e,t,i)}pushEventTo(e,t,i={},s=function(){}){return this.__view.withinTargets(e,(n,r)=>n.pushHookEvent(r,t,i,s))}handleEvent(e,t){let i=(s,n)=>n?e:t(s.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,s=>s.dispatchUploads(t,i))}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},Te=null,xi={exec(e,t,i,s,n){let[r,o]=n||[null,{}];(t.charAt(0)==="["?JSON.parse(t):[[r,o]]).forEach(([h,u])=>{h===r&&o.data&&(u.data=Object.assign(u.data||{},o.data)),this.filterToEls(s,u).forEach(c=>{this[`exec_${h}`](e,t,i,s,c,u)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},exec_exec(e,t,i,s,n,[r,o]){(o?l.all(document,o):[s]).forEach(h=>{let u=h.getAttribute(r);if(!u)throw new Error(`expected ${r} to contain JS command on "${o}"`);i.liveSocket.execJS(h,u,e)})},exec_dispatch(e,t,i,s,n,{to:r,event:o,detail:a,bubbles:h}){a=a||{},a.dispatcher=s,l.dispatchEvent(n,o,{detail:a,bubbles:h})},exec_push(e,t,i,s,n,r){if(!i.isConnected())return;let{event:o,data:a,target:h,page_loading:u,loading:c,value:f,dispatcher:g}=r,p={loading:c,value:f,target:h,page_loading:!!u},w=e==="change"&&g?g:s,S=h||w.getAttribute(i.binding("target"))||w;i.withinTargets(S,(P,d)=>{if(e==="change"){let{newCid:b,_target:E,callback:R}=r;E=E||(l.isFormInput(s)?s.name:void 0),E&&(p._target=E),P.pushInput(s,d,b,o||t,p,R)}else if(e==="submit"){let{submitter:b}=r;P.submitForm(s,d,o||t,b,p)}else P.pushEvent(e,s,d,o||t,a,p)})},exec_navigate(e,t,i,s,n,{href:r,replace:o}){i.liveSocket.historyRedirect(r,o?"replace":"push")},exec_patch(e,t,i,s,n,{href:r,replace:o}){i.liveSocket.pushHistoryPatch(r,o?"replace":"push",s)},exec_focus(e,t,i,s,n){window.requestAnimationFrame(()=>ee.attemptFocus(n))},exec_focus_first(e,t,i,s,n){window.requestAnimationFrame(()=>ee.focusFirstInteractive(n)||ee.focusFirst(n))},exec_push_focus(e,t,i,s,n){window.requestAnimationFrame(()=>Te=n||s)},exec_pop_focus(e,t,i,s,n){window.requestAnimationFrame(()=>{Te&&Te.focus(),Te=null})},exec_add_class(e,t,i,s,n,{names:r,transition:o,time:a}){this.addOrRemoveClasses(n,r,[],o,a,i)},exec_remove_class(e,t,i,s,n,{names:r,transition:o,time:a}){this.addOrRemoveClasses(n,[],r,o,a,i)},exec_transition(e,t,i,s,n,{time:r,transition:o}){this.addOrRemoveClasses(n,[],[],o,r,i)},exec_toggle(e,t,i,s,n,{display:r,ins:o,outs:a,time:h}){this.toggle(e,i,n,r,o,a,h)},exec_show(e,t,i,s,n,{display:r,transition:o,time:a}){this.show(e,i,n,r,o,a)},exec_hide(e,t,i,s,n,{display:r,transition:o,time:a}){this.hide(e,i,n,r,o,a)},exec_set_attr(e,t,i,s,n,{attr:[r,o]}){this.setOrRemoveAttrs(n,[[r,o]],[])},exec_remove_attr(e,t,i,s,n,{attr:r}){this.setOrRemoveAttrs(n,[],[r])},show(e,t,i,s,n,r){this.isVisible(i)||this.toggle(e,t,i,s,n,null,r)},hide(e,t,i,s,n,r){this.isVisible(i)&&this.toggle(e,t,i,s,null,n,r)},toggle(e,t,i,s,n,r,o){let[a,h,u]=n||[[],[],[]],[c,f,g]=r||[[],[],[]];if(a.length>0||c.length>0)if(this.isVisible(i)){let p=()=>{this.addOrRemoveClasses(i,f,a.concat(h).concat(u)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,c,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,g,f))})};i.dispatchEvent(new Event("phx:hide-start")),t.transition(o,p,()=>{this.addOrRemoveClasses(i,[],c.concat(g)),l.putSticky(i,"toggle",w=>w.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))})}else{if(e==="remove")return;let p=()=>{this.addOrRemoveClasses(i,h,c.concat(f).concat(g));let w=s||this.defaultDisplay(i);l.putSticky(i,"toggle",S=>S.style.display=w),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,u,h))})};i.dispatchEvent(new Event("phx:show-start")),t.transition(o,p,()=>{this.addOrRemoveClasses(i,[],a.concat(u)),i.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),l.putSticky(i,"toggle",p=>p.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start"));let p=s||this.defaultDisplay(i);l.putSticky(i,"toggle",w=>w.style.display=p),i.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(e,t,i,s,n,r){let[o,a,h]=s||[[],[],[]];if(o.length>0){let u=()=>this.addOrRemoveClasses(e,a.concat(o),[]),c=()=>this.addOrRemoveClasses(e,t.concat(h),i.concat(o).concat(a));return r.transition(n,u,c)}window.requestAnimationFrame(()=>{let[u,c]=l.getSticky(e,"classes",[[],[]]),f=t.filter(S=>u.indexOf(S)<0&&!e.classList.contains(S)),g=i.filter(S=>c.indexOf(S)<0&&e.classList.contains(S)),p=u.filter(S=>i.indexOf(S)<0).concat(f),w=c.filter(S=>t.indexOf(S)<0).concat(g);l.putSticky(e,"classes",S=>(S.classList.remove(...w),S.classList.add(...p),[p,w]))})},setOrRemoveAttrs(e,t,i){let[s,n]=l.getSticky(e,"attrs",[[],[]]),r=t.map(([h,u])=>h).concat(i),o=s.filter(([h,u])=>!r.includes(h)).concat(t),a=n.filter(h=>!r.includes(h)).concat(i);l.putSticky(e,"attrs",h=>(a.forEach(u=>h.removeAttribute(u)),o.forEach(([u,c])=>h.setAttribute(u,c)),[o,a]))},hasAllClasses(e,t){return t.every(i=>e.classList.contains(i))},isToggledOut(e,t){return!this.isVisible(e)||this.hasAllClasses(e,t)},filterToEls(e,{to:t}){return t?l.all(document,t):[e]},defaultDisplay(e){return{tr:"table-row",td:"table-cell"}[e.tagName.toLowerCase()]||"block"}},U=xi,_e=(e,t,i=[])=>{let{submitter:s,...n}=t,r=new FormData(e);s&&s.hasAttribute("name")&&s.form&&s.form===e&&r.append(s.name,s.value);let o=[];r.forEach((h,u,c)=>{h instanceof File&&o.push(u)}),o.forEach(h=>r.delete(h));let a=new URLSearchParams;for(let[h,u]of r.entries())(i.length===0||i.indexOf(h)>=0)&&a.append(h,u);for(let h in n)a.append(h,n[h]);return a.toString()},Dt=class{constructor(e,t,i,s,n){this.isDead=!1,this.liveSocket=t,this.flash=s,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(r){r&&r()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(n),session:this.getSession(),static:this.getStatic(),flash:this.flash}))}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(tt)}connectParams(e){let t=this.liveSocket.params(this.el),i=l.all(document,`[${this.binding(Vt)}]`).map(s=>s.src||s.href).filter(s=>typeof s=="string");return i.length>0&&(t._track_static=i),t._mounts=this.joinCount,t._live_referer=e,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(z)}getStatic(){let e=this.el.getAttribute(ae);return e===""?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let t=()=>{e();for(let i in this.viewHooks)this.destroyHook(this.viewHooks[i])};l.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove(dt,je,ct),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses(je)}}execAll(e){l.all(this.el,`[${e}]`,t=>this.liveSocket.execJS(t,t.getAttribute(e)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(dt),this.execAll(this.binding("connected"))}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}transition(e,t,i=function(){}){this.liveSocket.transition(e,t,i)}withinTargets(e,t){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,i=>t(i,e));if(q(e))l.findComponentNodeList(this.el,e).length===0?_(`no component found matching phx-target of ${e}`):t(this,parseInt(e));else{let i=Array.from(document.querySelectorAll(e));i.length===0&&_(`nothing found matching the phx-target selector "${e}"`),i.forEach(s=>this.liveSocket.owner(s,n=>t(n,s)))}}applyDiff(e,t,i){this.log(e,()=>["",Re(t)]);let{diff:s,reply:n,events:r,title:o}=Tt.extract(t);i({diff:s,reply:n,events:r}),o&&window.requestAnimationFrame(()=>l.putTitle(o))}onJoin(e){let{rendered:t,container:i}=e;if(i){let[s,n]=i;this.el=l.replaceRootContainer(this.el,s,n)}this.childJoins=0,this.joinPending=!0,this.flash=null,M.dropLocal(this.liveSocket.localStorage,window.location.pathname,_t),this.applyDiff("mount",t,({diff:s,events:n})=>{this.rendered=new Tt(this.id,s);let[r,o]=this.renderContainer(null,"join");this.dropPendingRefs();let a=this.formsForRecovery(r);this.joinCount++,a.length>0?a.forEach(([h,u,c],f)=>{this.pushFormRecovery(h,c,g=>{f===a.length-1&&this.onJoinComplete(g,r,o,n)})}):this.onJoinComplete(e,r,o,n)})}dropPendingRefs(){l.all(document,`[${K}="${this.id}"][${F}]`,e=>{e.removeAttribute(F),e.removeAttribute(K)})}onJoinComplete({live_patch:e},t,i,s){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i,s);l.findPhxChildrenInFragment(t,this.id).filter(r=>{let o=r.id&&this.el.querySelector(`[id="${r.id}"]`),a=o&&o.getAttribute(ae);return a&&r.setAttribute(ae,a),this.joinChild(r)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,s)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i,s)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i,s)])}attachTrueDocEl(){this.el=l.byId(this.id),this.el.setAttribute(le,this.root.id)}execNewMounted(){l.all(this.el,`[${this.binding(ie)}], [data-phx-${ie}]`,e=>{this.maybeAddNewHook(e)}),l.all(this.el,`[${this.binding(pt)}]`,e=>this.maybeMounted(e))}applyJoinPatch(e,t,i,s){this.attachTrueDocEl();let n=new Ce(this,this.el,this.id,t,i,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(s),this.applyPendingUpdates(),e){let{kind:r,to:o}=e;this.liveSocket.historyPatch(o,r)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),s=i&&l.isIgnored(e,this.binding(De));if(i&&!e.isEqualNode(t)&&!(s&&li(e.dataset,t.dataset)))return i.__beforeUpdate(),i}maybeMounted(e){let t=e.getAttribute(this.binding(pt)),i=t&&l.private(e,"mounted");t&&!i&&(this.liveSocket.execJS(e,t),l.putPrivate(e,"mounted",!0))}maybeAddNewHook(e,t){let i=this.addHook(e);i&&i.__mounted()}performPatch(e,t){let i=[],s=!1,n=new Set;return e.after("added",r=>{this.liveSocket.triggerDOM("onNodeAdded",[r]),this.maybeAddNewHook(r),r.getAttribute&&this.maybeMounted(r)}),e.after("phxChildAdded",r=>{l.isPhxSticky(r)?this.liveSocket.joinRootViews():s=!0}),e.before("updated",(r,o)=>{this.triggerBeforeUpdateHook(r,o)&&n.add(r.id)}),e.after("updated",r=>{n.has(r.id)&&this.getHook(r).__updated()}),e.after("discarded",r=>{r.nodeType===Node.ELEMENT_NODE&&i.push(r)}),e.after("transitionsDiscarded",r=>this.afterElementsRemoved(r,t)),e.perform(),this.afterElementsRemoved(i,t),s}afterElementsRemoved(e,t){let i=[];e.forEach(s=>{let n=l.all(s,`[${D}]`),r=l.all(s,`[${this.binding(ie)}]`);n.concat(s).forEach(o=>{let a=this.componentID(o);q(a)&&i.indexOf(a)===-1&&i.push(a)}),r.concat(s).forEach(o=>{let a=this.getHook(o);a&&this.destroyHook(a)})}),t&&this.maybePushComponentsDestroyed(i)}joinNewChildren(){l.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(Z)][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let i=new Dt(e,this.liveSocket,this);return this.root.children[this.id][i.id]=i,i.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]})}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{l.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(n=>{this.componentPatch(this.rendered.getComponent(e,n),n)&&(i=!0)})}):yt(e)||this.liveSocket.time("full patch complete",()=>{let[s,n]=this.renderContainer(e,"update"),r=new Ce(this,this.el,this.id,s,n,null);i=this.performPatch(r,!0)}),this.liveSocket.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let i=this.el.tagName,s=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null,[n,r]=this.rendered.toString(s);return[`<${i}>${n}</${i}>`,r]})}componentPatch(e,t){if(yt(e))return!1;let[i,s]=this.rendered.componentToString(t),n=new Ce(this,this.el,this.id,i,s,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[oe.elementID(e)]}addHook(e){if(oe.elementID(e)||!e.getAttribute)return;let t=e.getAttribute(`data-phx-${ie}`)||e.getAttribute(this.binding(ie));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||_(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let s=new oe(this,e,i);return this.viewHooks[oe.elementID(s.el)]=s,s}else t!==null&&_(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[oe.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[],this.eachChild(e=>e.applyPendingUpdates())}eachChild(e){let t=this.root.children[this.id]||{};for(let i in t)e(this.getChildById(i))}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,i=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(i)]):this.liveSocket.requestDOMUpdate(()=>t(i))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:t,events:i})=>this.update(t,i))})}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){this.eachChild(e=>e.destroy())}onLiveRedirect(e){let{to:t,kind:i,flash:s}=e,n=this.expandURL(t);this.liveSocket.historyRedirect(n,i,s)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(e){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=t=>{t=t||function(){},e?e(this.joinCount,t):t()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",t=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(t))}).receive("error",t=>!this.isDestroyed()&&this.onJoinError(t)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){if(e.reason==="reload")return this.log("error",()=>[`failed mount with ${e.status}. Falling back to page request`,e]),this.onRedirect({to:this.href});if(e.reason==="unauthorized"||e.reason==="stale")return this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href});if((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect)return this.onRedirect(e.redirect);if(e.live_redirect)return this.onLiveRedirect(e.live_redirect);this.log("error",()=>["unable to join",e]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this)}onClose(e){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(ei)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&l.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(je,ct),this.execAll(this.binding("disconnected"))}pushWithReply(e,t,i,s=function(){}){if(!this.isConnected())return;let[n,[r],o]=e?e():[null,[],{}],a=function(){};return(o.page_loading||r&&r.getAttribute(this.binding(lt))!==null)&&(a=this.liveSocket.withPageLoading({kind:"element",target:r})),typeof i.cid!="number"&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,ii).receive("ok",h=>{let u=c=>{h.redirect&&this.onRedirect(h.redirect),h.live_patch&&this.onLivePatch(h.live_patch),h.live_redirect&&this.onLiveRedirect(h.live_redirect),n!==null&&this.undoRefs(n),a(),s(h,c)};h.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",h.diff,({diff:c,reply:f,events:g})=>{this.update(c,g),u(f)})}):u(null)}))}undoRefs(e){this.isConnected()&&l.all(document,`[${K}="${this.id}"][${F}="${e}"]`,t=>{let i=t.getAttribute(be);t.removeAttribute(F),t.removeAttribute(K),t.getAttribute(Je)!==null&&(t.readOnly=!1,t.removeAttribute(Je)),i!==null&&(t.disabled=i==="true",t.removeAttribute(be)),Pt.forEach(r=>l.removeClass(t,r));let s=t.getAttribute(ye);s!==null&&(t.innerText=s,t.removeAttribute(ye));let n=l.private(t,F);if(n){let r=this.triggerBeforeUpdateHook(t,n);Ce.patchEl(t,n,this.liveSocket.getActiveElement()),r&&r.__updated(),l.deletePrivate(t,F)}})}putRef(e,t,i={}){let s=this.ref++,n=this.binding(Ze);return i.loading&&(e=e.concat(l.all(document,i.loading))),e.forEach(r=>{r.classList.add(`phx-${t}-loading`),r.setAttribute(F,s),r.setAttribute(K,this.el.id);let o=r.getAttribute(n);o!==null&&(r.getAttribute(ye)||r.setAttribute(ye,r.innerText),o!==""&&(r.innerText=o),r.setAttribute("disabled",""))}),[s,e,i]}componentID(e){let t=e.getAttribute&&e.getAttribute(D);return t?parseInt(t):null}targetComponentID(e,t,i={}){if(q(t))return t;let s=e.getAttribute(this.binding("target"));return q(s)?parseInt(s):t&&(s!==null||i.target)?this.closestComponentID(t):null}closestComponentID(e){return q(e)?e:e?W(e.closest(`[${D}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(e,t,i,s){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",t,i]),!1;let[n,r,o]=this.putRef([],"hook");return this.pushWithReply(()=>[n,r,o],"event",{type:"hook",event:t,value:i,cid:this.closestComponentID(e)},(a,h)=>s(h,n)),n}extractMeta(e,t,i){let s=this.binding("value-");for(let n=0;n<e.attributes.length;n++){t||(t={});let r=e.attributes[n].name;r.startsWith(s)&&(t[r.replace(s,"")]=e.getAttribute(r))}if(e.value!==void 0&&(t||(t={}),t.value=e.value,e.tagName==="INPUT"&&xt.indexOf(e.type)>=0&&!e.checked&&delete t.value),i){t||(t={});for(let n in i)t[n]=i[n]}return t}pushEvent(e,t,i,s,n,r={}){this.pushWithReply(()=>this.putRef([t],e,r),"event",{type:e,event:s,value:this.extractMeta(t,n,r.value),cid:this.targetComponentID(t,i,r)})}pushFileProgress(e,t,i,s=function(){}){this.liveSocket.withinOwners(e.form,(n,r)=>{n.pushWithReply(null,"progress",{event:e.getAttribute(n.binding(Qt)),ref:e.getAttribute(G),entry_ref:t,progress:i,cid:n.targetComponentID(e.form,r)},s)})}pushInput(e,t,i,s,n,r){let o,a=q(i)?i:this.targetComponentID(e.form,t),h=()=>this.putRef([e,e.form],"change",n),u;e.getAttribute(this.binding("change"))?u=_e(e.form,{_target:n._target},[e.name]):u=_e(e.form,{_target:n._target}),l.isUploadInput(e)&&e.files&&e.files.length>0&&T.trackFiles(e,Array.from(e.files)),o=T.serializeUploads(e);let c={type:"form",event:s,value:u,uploads:o,cid:a};this.pushWithReply(h,"event",c,f=>{if(l.showError(e,this.liveSocket.binding(xe)),l.isUploadInput(e)&&e.getAttribute("data-phx-auto-upload")!==null){if(T.filesAwaitingPreflight(e).length>0){let[g,p]=h();this.uploadFiles(e.form,t,g,a,w=>{r&&r(f),this.triggerAwaitingSubmit(e.form)})}}else r&&r(f)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,s,n,r]=t;this.cancelSubmit(e),r()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i,s,n])=>t.isSameNode(e))}scheduleSubmit(e,t,i,s){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i,s])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,s])=>t.isSameNode(e)?(this.undoRefs(i),!1):!0)}disableForm(e,t={}){let i=c=>!(he(c,`${this.binding(De)}=ignore`,c.form)||he(c,"data-phx-update=ignore",c.form)),s=c=>c.hasAttribute(this.binding(Ze)),n=c=>c.tagName=="BUTTON",r=c=>["INPUT","TEXTAREA","SELECT"].includes(c.tagName),o=Array.from(e.elements),a=o.filter(s),h=o.filter(n).filter(i),u=o.filter(r).filter(i);return h.forEach(c=>{c.setAttribute(be,c.disabled),c.disabled=!0}),u.forEach(c=>{c.setAttribute(Je,c.readOnly),c.readOnly=!0,c.files&&(c.setAttribute(be,c.disabled),c.disabled=!0)}),e.setAttribute(this.binding(lt),""),this.putRef([e].concat(a).concat(h).concat(u),"submit",t)}pushFormSubmit(e,t,i,s,n,r){let o=()=>this.disableForm(e,n),a=this.targetComponentID(e,t);if(T.hasUploadsInProgress(e)){let[h,u]=o(),c=()=>this.pushFormSubmit(e,s,t,i,n,r);return this.scheduleSubmit(e,h,n,c)}else if(T.inputsAwaitingPreflight(e).length>0){let[h,u]=o(),c=()=>[h,u,n];this.uploadFiles(e,t,h,a,f=>{let g=_e(e,{submitter:s});this.pushWithReply(c,"event",{type:"form",event:i,value:g,cid:a},r)})}else{let h=_e(e,{submitter:s});this.pushWithReply(o,"event",{type:"form",event:i,value:h,cid:a},r)}}uploadFiles(e,t,i,s,n){let r=this.joinCount,o=T.activeFileInputs(e),a=o.length;o.forEach(h=>{let u=new T(h,this,()=>{a--,a===0&&n()});this.uploaders[h]=u;let c=u.entries().map(g=>g.toPreflightPayload()),f={ref:h.getAttribute(G),entries:c,cid:this.targetComponentID(h.form,t)};this.log("upload",()=>["sending preflight request",f]),this.pushWithReply(null,"allow_upload",f,g=>{if(this.log("upload",()=>["got preflight response",g]),g.error){this.undoRefs(i);let[p,w]=g.error;this.log("upload",()=>[`error for entry ${p}`,w])}else{let p=w=>{this.channel.onError(()=>{this.joinCount===r&&w()})};u.initAdapterUpload(g,p,this.liveSocket)}})})}dispatchUploads(e,t){let i=l.findUploadInputs(this.el).filter(s=>s.name===e);i.length===0?_(`no live file inputs found matching the name "${e}"`):i.length>1?_(`duplicate live file inputs found matching the name "${e}"`):l.dispatchEvent(i[0],Rt,{detail:{files:t}})}pushFormRecovery(e,t,i){this.liveSocket.withinOwners(e,(s,n)=>{let r=Array.from(e.elements).find(a=>l.isFormInput(a)&&a.type!=="hidden"&&!a.hasAttribute(this.binding("change"))),o=e.getAttribute(this.binding(ft))||e.getAttribute(this.binding("change"));U.exec("change",o,s,r,["push",{_target:r.name,newCid:t,callback:i}])})}pushLinkPatch(e,t,i){let s=this.liveSocket.setPendingLink(e),n=t?()=>this.putRef([t],"click"):null,r=()=>this.liveSocket.redirect(window.location.href),o=this.pushWithReply(n,"live_patch",{url:e},a=>{this.liveSocket.requestDOMUpdate(()=>{a.link_redirect?this.liveSocket.replaceMain(e,null,i,s):(this.liveSocket.commitPendingLink(s)&&(this.href=e),this.applyPendingUpdates(),i&&i(s))})});o?o.receive("timeout",r):r()}formsForRecovery(e){if(this.joinCount===0)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,l.all(this.el,`form[${t}]`).filter(s=>s.id&&this.ownsElement(s)).filter(s=>s.elements.length>0).filter(s=>s.getAttribute(this.binding(ft))!=="ignore").map(s=>{let n=i.content.querySelector(`form[id="${s.id}"][${t}="${s.getAttribute(t)}"]`);return n?[s,n,this.targetComponentID(n)]:[s,null,null]}).filter(([s,n,r])=>n)}maybePushComponentsDestroyed(e){let t=e.filter(i=>l.findComponentNodeList(this.el,i).length===0);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(s=>t.indexOf(s)!==-1);let i=t.filter(s=>l.findComponentNodeList(this.el,s).length===0);i.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:i},s=>{this.rendered.pruneCIDs(s.cids)})}))}ownsElement(e){let t=e.closest(te);return e.getAttribute(Z)===this.id||t&&t.id===this.id||!t&&this.isDead}submitForm(e,t,i,s,n={}){l.putPrivate(e,Le,!0);let r=this.liveSocket.binding(xe),o=Array.from(e.elements);o.forEach(a=>l.putPrivate(a,Le,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,s,n,()=>{o.forEach(a=>l.showError(a,r)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}},It=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.constructor.name==="Object")throw new Error(`
a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:
import {Socket} from "phoenix"
import {LiveSocket} from "phoenix_live_view"
let liveSocket = new LiveSocket("/live", Socket, {...})
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||ti,this.opts=i,this.params=We(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(Re(si),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=Re(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||Zt,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||$t,this.reloadJitterMin=i.reloadJitterMin||jt,this.reloadJitterMax=i.reloadJitterMax||Bt,this.failsafeJitter=i.failsafeJitter||Jt,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:We(),onBeforeElUpdated:We()},i.dom||{}),this.transitions=new Li,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return this.sessionStorage.getItem(Xe)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(we)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(we)==="false"}enableDebug(){this.sessionStorage.setItem(we,"true")}enableProfiling(){this.sessionStorage.setItem(Xe,"true")}disableDebug(){this.sessionStorage.setItem(we,"false")}disableProfiling(){this.sessionStorage.removeItem(Xe)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(qe,e)}disableLatencySim(){this.sessionStorage.removeItem(qe)}getLatencySim(){let e=this.sessionStorage.getItem(qe);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.joinRootViews()?(this.bindTopLevelEvents(),this.socket.connect()):this.main?this.socket.connect():this.bindTopLevelEvents({dead:!0}),this.joinDeadView()};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){this.owner(e,s=>U.exec(i,t,s,e))}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[s,n]=i();this.viewLogger(e,t,s,n)}else if(this.isDebugEnabled()){let[s,n]=i();hi(e,t,s,n)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,s=>{let n=this.getLatencySim();n?setTimeout(()=>i(s),n):i(s)})}wrapPush(e,t,i){let s=this.getLatencySim(),n=e.joinCount;if(!s)return this.isConnected()&&t.timeout?i().receive("timeout",()=>{e.joinCount===n&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();let r={receives:[],receive(o,a){this.receives.push([o,a])}};return setTimeout(()=>{e.isDestroyed()||r.receives.reduce((o,[a,h])=>o.receive(a,h),i())},s),r}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,s=this.reloadJitterMax,n=Math.floor(Math.random()*(s-i+1))+i,r=M.updateLocal(this.localStorage,window.location.pathname,_t,0,o=>o+1);r>this.maxReloads&&(n=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{e.isDestroyed()||e.isConnected()||(e.destroy(),t?t():this.log(e,"join",()=>[`encountered ${r} consecutive reloads`]),r>this.maxReloads&&this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},n)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?pi[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinDeadView(){let e=document.body;if(e&&!this.isPhxView(e)&&!this.isPhxView(document.firstElementChild)){let t=this.newRootView(e);t.setHref(this.getHref()),t.joinDead(),this.main||(this.main=t),window.requestAnimationFrame(()=>t.execNewMounted())}}joinRootViews(){let e=!1;return l.all(document,`${te}:not([${Z}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);i.setHref(this.getHref()),i.join(),t.hasAttribute(tt)&&(this.main=i)}e=!0}),e}redirect(e,t){this.unload(),M.redirect(e,t)}replaceMain(e,t,i=null,s=this.setPendingLink(e)){let n=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let r=l.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(r,t,n),this.main.setRedirect(e),this.transitionRemoves(),this.main.join((o,a)=>{o===1&&this.commitPendingLink(s)&&this.requestDOMUpdate(()=>{l.findPhxSticky(document).forEach(h=>r.appendChild(h)),this.outgoingMainEl.replaceWith(r),this.outgoingMainEl=null,i&&requestAnimationFrame(i),a()})})}transitionRemoves(e){let t=this.binding("remove");e=e||l.all(document,`[${t}]`),e.forEach(i=>{document.body.contains(i)&&this.execJS(i,i.getAttribute(t),"remove")})}isPhxView(e){return e.getAttribute&&e.getAttribute(z)!==null}newRootView(e,t,i){let s=new Dt(e,this,null,t,i);return this.roots[s.id]=s,s}owner(e,t){let i=W(e.closest(te),s=>this.getViewByEl(s))||this.main;i&&t(i)}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(le);return W(this.getRootById(t),i=>i.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e];this.main=null}destroyViewByEl(e){let t=this.getRootById(e.getAttribute(le));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let t=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",t),e.addEventListener("touchend",t)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:e}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(t=>{if(t&&t.code===1001)return this.unload();if(t&&t.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),document.body.addEventListener("click",function(){}),window.addEventListener("pageshow",t=>{t.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),e||this.bindNav(),this.bindClicks(),e||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,i,s,n,r,o)=>{let a=n.getAttribute(this.binding(Yt)),h=t.key&&t.key.toLowerCase();if(a&&a.toLowerCase()!==h)return;let u={key:t.key,...this.eventMeta(i,t,n)};U.exec(i,r,s,n,["push",{data:u}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,s,n,r,o)=>{if(!o){let a={key:t.key,...this.eventMeta(i,t,n)};U.exec(i,r,s,n,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,s,n,r,o,a)=>{if(a==="window"){let h=this.eventMeta(i,t,n);U.exec(i,o,s,n,["push",{data:h}])}}),window.addEventListener("dragover",t=>t.preventDefault()),window.addEventListener("drop",t=>{t.preventDefault();let i=W(he(t.target,this.binding(at)),r=>r.getAttribute(this.binding(at))),s=i&&document.getElementById(i),n=Array.from(t.dataTransfer.files||[]);!s||s.disabled||n.length===0||!(s.files instanceof FileList)||(T.trackFiles(s,n,t.dataTransfer),s.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(Rt,t=>{let i=t.target;if(!l.isUploadInput(i))return;let s=Array.from(t.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);T.trackFiles(i,s),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let s=this.metadataCallbacks[e];return s?s(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let s=e[i];this.on(s,n=>{let r=this.binding(i),o=this.binding(`window-${i}`),a=n.target.getAttribute&&n.target.getAttribute(r);a?this.debounce(n.target,n,s,()=>{this.withinOwners(n.target,h=>{t(n,i,h,n.target,a,null)})}):l.all(document,`[${o}]`,h=>{let u=h.getAttribute(o);this.debounce(h,n,s,()=>{this.withinOwners(h,c=>{t(n,i,c,h,u,"window")})})})})}}bindClicks(){window.addEventListener("click",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(e,t,i){let s=this.binding(t);window.addEventListener(e,n=>{let r=null;if(i)r=n.target.matches(`[${s}]`)?n.target:n.target.querySelector(`[${s}]`);else{let a=this.clickStartedAtTarget||n.target;r=he(a,s),this.dispatchClickAway(n,a),this.clickStartedAtTarget=null}let o=r&&r.getAttribute(s);if(!o){let a=n.target instanceof HTMLAnchorElement?n.target.getAttribute("href"):null;!i&&a!==null&&!l.wantsNewTab(n)&&l.isNewPageHref(a,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),this.debounce(r,n,"click",()=>{this.withinOwners(r,a=>{U.exec("click",o,a,r,["push",{data:this.eventMeta("click",n,r)}])})})},i)}dispatchClickAway(e,t){let i=this.binding("click-away");l.all(document,`[${i}]`,s=>{s.isSameNode(t)||s.contains(t)||this.withinOwners(e.target,n=>{let r=s.getAttribute(i);U.isVisible(s)&&U.exec("click",r,n,s,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!M.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{M.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,id:s,root:n,scroll:r}=t.state||{},o=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&s===this.main.id?this.main.pushLinkPatch(o,null,()=>{this.maybeScroll(r)}):this.replaceMain(o,null,()=>{n&&this.replaceRootHistory(),this.maybeScroll(r)})})},!1),window.addEventListener("click",t=>{let i=he(t.target,$e),s=i&&i.getAttribute($e);if(!s||!this.isConnected()||!this.main||l.wantsNewTab(t))return;let n=i.href,r=i.getAttribute(Xt);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==n&&this.requestDOMUpdate(()=>{if(s==="patch")this.pushHistoryPatch(n,r,i);else if(s==="redirect")this.historyRedirect(n,r);else throw new Error(`expected ${$e} to be "patch" or "redirect", got: ${s}`);let o=i.getAttribute(this.binding("click"));o&&this.requestDOMUpdate(()=>this.execJS(i,o,"click"))})},!1)}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}dispatchEvent(e,t={}){l.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){l.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>l.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i){if(!this.isConnected())return M.redirect(e);this.withPageLoading({to:e,kind:"patch"},s=>{this.main.pushLinkPatch(e,i,n=>{this.historyPatch(e,t,n),s()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(M.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location))}historyRedirect(e,t,i){if(!this.isConnected())return M.redirect(e,i);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:n,host:r}=window.location;e=`${n}//${r}${e}`}let s=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},n=>{this.replaceMain(e,i,()=>{M.pushState(t,{type:"redirect",id:this.main.id,scroll:s},e),this.registerNewLocation(window.location),n()})})}replaceRootHistory(){M.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=Re(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let s=i.target.getAttribute(this.binding("submit")),n=i.target.getAttribute(this.binding("change"));!t&&n&&!s&&(t=!0,i.preventDefault(),this.withinOwners(i.target,r=>{r.disableForm(i.target),window.requestAnimationFrame(()=>{l.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))},!0),this.on("submit",i=>{let s=i.target.getAttribute(this.binding("submit"));if(!s){l.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,n=>{U.exec("submit",s,n,i.target,["push",{submitter:i.submitter}])})},!1);for(let i of["change","input"])this.on(i,s=>{let n=this.binding("change"),r=s.target,o=r.getAttribute(n),a=r.form&&r.form.getAttribute(n),h=o||a;if(!h||r.type==="number"&&r.validity&&r.validity.badInput)return;let u=o?r:r.form,c=e;e++;let{at:f,type:g}=l.private(r,"prev-iteration")||{};f===c-1&&i!==g||(l.putPrivate(r,"prev-iteration",{at:c,type:i}),this.debounce(r,s,i,()=>{this.withinOwners(u,p=>{l.putPrivate(r,Qe,!0),l.isTextualInput(r)||this.setActiveElement(r),U.exec("change",h,p,r,["push",{_target:s.target.name,dispatcher:u}])})}))},!1);this.on("reset",i=>{let s=i.target;l.resetForm(s,this.binding(xe));let n=Array.from(s.elements).find(r=>r.type==="reset");window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,s){if(i==="blur"||i==="focusout")return s();let n=this.binding(Kt),r=this.binding(Gt),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(e,h=>{let u=()=>!h.isDestroyed()&&document.body.contains(e);l.debounce(e,t,n,o,r,a,u,()=>{s()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){window.addEventListener(e,i=>{this.silenced||t(i)})}},Li=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let s=setTimeout(()=>{this.transitions.delete(s),i(),this.flushPendingOps()},e);this.transitions.add(s)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var ce=e=>typeof e=="function"?e:function(){return e},Di=typeof self<"u"?self:null,de=typeof window<"u"?window:null,ue=Di||de||ue,Ii="2.0.0",$={connecting:0,open:1,closing:2,closed:3},Oi=1e4,Hi=1e3,I={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},j={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},st={longpoll:"longpoll",websocket:"websocket"},Ni={complete:4},Ie=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Ot=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Mi=class{constructor(e,t,i){this.state=I.closed,this.topic=e,this.params=ce(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ie(this,j.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ot(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=I.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=I.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=I.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=I.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Ie(this,j.leave,ce({}),this.timeout).send(),this.state=I.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(j.reply,(s,n)=>{this.trigger(this.replyEventName(n),s)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(j.close,e)}onError(e){return this.on(j.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t>"u"||t===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new Ie(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=I.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(j.close,"leave")},i=new Ie(this,j.leave,ce({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=I.joining,this.joinPush.resend(e))}trigger(e,t,i,s){let n=this.onMessage(e,t,i,s);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===e);for(let o=0;o<r.length;o++)r[o].callback(n,i,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===I.closed}isErrored(){return this.state===I.errored}isJoined(){return this.state===I.joined}isJoining(){return this.state===I.joining}isLeaving(){return this.state===I.leaving}},He=class{static request(e,t,i,s,n,r,o){if(ue.XDomainRequest){let a=new ue.XDomainRequest;return this.xdomainRequest(a,e,t,s,n,r,o)}else{let a=new ue.XMLHttpRequest;return this.xhrRequest(a,e,t,i,s,n,r,o)}}static xdomainRequest(e,t,i,s,n,r,o){return e.timeout=n,e.open(t,i),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,n,r,o,a){return e.open(t,i,!0),e.timeout=r,e.setRequestHeader("Content-Type",s),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===Ni.complete&&a){let h=this.parseJSON(e.responseText);a(h)}},o&&(e.ontimeout=o),e.send(n),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let n=t?`${t}[${s}]`:s,r=e[s];typeof r=="object"?i.push(this.serialize(r,n)):i.push(encodeURIComponent(n)+"="+encodeURIComponent(r))}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return`${e}${i}${this.serialize(t)}`}},it=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=$.connecting,this.poll()}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+st.websocket),"$1/"+st.longpoll)}endpointURL(){return He.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=$.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===$.open||this.readyState===$.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:i,messages:s}=e;this.token=i}else t=0;switch(t){case 200:s.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=$.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(`
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,i){for(let n of this.reqs)n.abort();this.readyState=$.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,i,s,n){let r,o=()=>{this.reqs.delete(r),s()};r=He.request(e,this.endpointURL(),t,i,this.timeout,o,a=>{this.reqs.delete(r),this.isActive()&&n(a)}),this.reqs.add(r)}};var Oe={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,n,r,o]=JSON.parse(e);return t({join_ref:i,ref:s,topic:n,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:n,payload:r}=e,o=this.META_LENGTH+t.length+i.length+n.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),h=new DataView(a),u=0;h.setUint8(u++,this.KINDS.push),h.setUint8(u++,t.length),h.setUint8(u++,i.length),h.setUint8(u++,n.length),h.setUint8(u++,s.length),Array.from(t,f=>h.setUint8(u++,f.charCodeAt(0))),Array.from(i,f=>h.setUint8(u++,f.charCodeAt(0))),Array.from(n,f=>h.setUint8(u++,f.charCodeAt(0))),Array.from(s,f=>h.setUint8(u++,f.charCodeAt(0)));var c=new Uint8Array(a.byteLength+r.byteLength);return c.set(new Uint8Array(a),0),c.set(new Uint8Array(r),a.byteLength),c.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(o,o+s));o=o+s;let h=i.decode(e.slice(o,o+n));o=o+n;let u=i.decode(e.slice(o,o+r));o=o+r;let c=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:h,event:u,payload:c}},decodeReply(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,h=i.decode(e.slice(a,a+s));a=a+s;let u=i.decode(e.slice(a,a+n));a=a+n;let c=i.decode(e.slice(a,a+r));a=a+r;let f=i.decode(e.slice(a,a+o));a=a+o;let g=e.slice(a,e.byteLength),p={status:f,response:g};return{join_ref:h,ref:u,topic:c,event:j.reply,payload:p}},decodeBroadcast(e,t,i){let s=t.getUint8(1),n=t.getUint8(2),r=this.HEADER_LENGTH+2,o=i.decode(e.slice(r,r+s));r=r+s;let a=i.decode(e.slice(r,r+n));r=r+n;let h=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:h}}},Ht=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Oi,this.transport=t.transport||ue.WebSocket||it,this.establishedConnections=0,this.defaultEncoder=Oe.encode.bind(Oe),this.defaultDecoder=Oe.decode.bind(Oe),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==it?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;de&&de.addEventListener&&(de.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),de.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ce(t.params||{}),this.endPoint=`${e}/${st.websocket}`,this.vsn=t.vsn||Ii,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ot(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return it}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=He.appendParams(He.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,i)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ce(e)),!this.conn&&(this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(e,t,i){this.logger(e,t,i)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(n=>{n.ref===t&&(this.off([s]),e(Date.now()-i))});return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Hi,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,i){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===$.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i)}),(t===this.transport||i>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(j.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case $.connecting:return"connecting";case $.open:return"open";case $.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t.joinRef()!==e.joinRef())}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1)}channel(e,t={}){let i=new Mi(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:n,join_ref:r}=e;this.log("push",`${t} ${i} (${r}, ${n})`,s)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:n,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${n.status||""} ${i} ${s} ${r&&"("+r+")"||""}`,n);for(let a=0;a<this.channels.length;a++){let h=this.channels[a];h.isMember(i,s,n,o)&&h.trigger(s,n,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,h]=this.stateChangeCallbacks.message[a];h(t)}})}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};window.storybook===void 0&&(console.warn("No storybook configuration detected."),console.warn("If you need to use custom hooks or uploaders, please define them in JS file and declare this file in your in your Elixir backend module options (:js_path key)."),window.storybook={});var Ui=document.querySelector("html").getAttribute("phx-socket")||"/live",Fi=window.parent.document.querySelector("meta[name='csrf-token']").getAttribute("content"),Nt=new It(Ui,Ht,{hooks:{...window.storybook.Hooks},uploaders:window.storybook.Uploaders,params:e=>({_csrf_token:Fi}),...window.storybook.LiveSocketOptions});Nt.connect();window.liveSocket=Nt;})();