diff --git a/static/assets/app.js b/static/assets/app.js index a1e82a355..adc790812 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -156,7 +156,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho removing illegal node: "${(n.outerHTML||n.nodeValue).trim()}" -`),t.push(n))}),t.forEach(n=>n.remove())}},replaceRootContainer(i,e,t){let n=new Set(["id",Jc,xg,Jk,Sg]);if(i.tagName.toLowerCase()===e.toLowerCase())return Array.from(i.attributes).filter(r=>!n.has(r.name.toLowerCase())).forEach(r=>i.removeAttribute(r.name)),Object.keys(t).filter(r=>!n.has(r.toLowerCase())).forEach(r=>i.setAttribute(r,t[r])),i;{let r=document.createElement(e);return Object.keys(t).forEach(o=>r.setAttribute(o,t[o])),n.forEach(o=>r.setAttribute(o,i.getAttribute(o))),r.innerHTML=i.innerHTML,i.replaceWith(r),r}},getSticky(i,e,t){let n=(os.private(i,"sticky")||[]).find(([r])=>e===r);if(n){let[r,o,s]=n;return s}else return typeof t=="function"?t():t},deleteSticky(i,e){this.updatePrivate(i,"sticky",[],t=>t.filter(([n,r])=>n!==e))},putSticky(i,e,t){let n=t(i);this.updatePrivate(i,"sticky",[],r=>{let o=r.findIndex(([s])=>e===s);return o>=0?r[o]=[e,t,n]:r.push([e,t,n]),r})},applyStickyOperations(i){let e=os.private(i,"sticky");e&&e.forEach(([t,n,r])=>this.putSticky(i,t,n))}},pe=os,Kk=class{static isActive(i,e){let t=e._phxRef===void 0,r=i.getAttribute(Gk).split(",").indexOf(mr.genFileRef(e))>=0;return e.size>0&&(t||r)}static isPreflighted(i,e){return i.getAttribute(Zk).split(",").indexOf(mr.genFileRef(e))>=0&&this.isActive(i,e)}constructor(i,e,t){this.ref=mr.genFileRef(e),this.fileEl=i,this.file=e,this.view=t,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(xy,this._onElUpdated)}metadata(){return this.meta}progress(i){this._progress=Math.floor(i),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{mr.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(i="failed"){this.fileEl.removeEventListener(xy,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:i}),pe.isAutoUpload(this.fileEl)||mr.clearFiles(this.fileEl)}onDone(i){this._onDone=()=>{this.fileEl.removeEventListener(xy,this._onElUpdated),i()}}onElUpdated(){this.fileEl.getAttribute(Gk).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,meta:typeof this.file.meta=="function"?this.file.meta():void 0}}uploader(i){if(this.meta.uploader){let e=i[this.meta.uploader]||Rr(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:e}}else return{name:"channel",callback:Jre}}zipPostFlight(i){this.meta=i.entries[this.ref],this.meta||Rr(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:i})}},eoe=0,mr=class{static genFileRef(i){let e=i._phxRef;return e!==void 0?e:(i._phxRef=(eoe++).toString(),i._phxRef)}static getEntryDataURL(i,e,t){let n=this.activeFiles(i).find(r=>this.genFileRef(r)===e);t(URL.createObjectURL(n))}static hasUploadsInProgress(i){let e=0;return pe.findUploadInputs(i).forEach(t=>{t.getAttribute(Zk)!==t.getAttribute(Ore)&&e++}),e>0}static serializeUploads(i){let e=this.activeFiles(i),t={};return e.forEach(n=>{let r={path:i.name},o=i.getAttribute(Zc);t[o]=t[o]||[],r.ref=this.genFileRef(n),r.last_modified=n.lastModified,r.name=n.name||r.ref,r.relative_path=n.webkitRelativePath,r.type=n.type,r.size=n.size,typeof n.meta=="function"&&(r.meta=n.meta()),t[o].push(r)}),t}static clearFiles(i){i.value=null,i.removeAttribute(Zc),pe.putPrivate(i,"files",[])}static untrackFile(i,e){pe.putPrivate(i,"files",pe.private(i,"files").filter(t=>!Object.is(t,e)))}static trackFiles(i,e,t){if(i.getAttribute("multiple")!==null){let n=e.filter(r=>!this.activeFiles(i).find(o=>Object.is(o,r)));pe.putPrivate(i,"files",this.activeFiles(i).concat(n)),i.value=null}else t&&t.files.length>0&&(i.files=t.files),pe.putPrivate(i,"files",e)}static activeFileInputs(i){let e=pe.findUploadInputs(i);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(i){return(pe.private(i,"files")||[]).filter(e=>Kk.isActive(i,e))}static inputsAwaitingPreflight(i){let e=pe.findUploadInputs(i);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(i){return this.activeFiles(i).filter(e=>!Kk.isPreflighted(i,e))}constructor(i,e,t){this.view=e,this.onComplete=t,this._entries=Array.from(mr.filesAwaitingPreflight(i)||[]).map(n=>new Kk(i,n,e)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(i,e,t){this._entries=this._entries.map(r=>(r.zipPostFlight(i),r.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),r));let n=this._entries.reduce((r,o)=>{if(!o.meta)return r;let{name:s,callback:a}=o.uploader(t.uploaders);return r[s]=r[s]||{callback:a,entries:[]},r[s].entries.push(o),r},{});for(let r in n){let{callback:o,entries:s}=n[r];o(s,e,i,t)}}},toe={focusMain(){let i=document.querySelector("main h1, main, h1");if(i){let e=i.tabIndex;i.tabIndex=-1,i.focus(),i.tabIndex=e}},anyOf(i,e){return e.find(t=>i instanceof t)},isFocusable(i,e){return i instanceof HTMLAnchorElement&&i.rel!=="ignore"||i instanceof HTMLAreaElement&&i.href!==void 0||!i.disabled&&this.anyOf(i,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||i instanceof HTMLIFrameElement||i.tabIndex>0||!e&&i.tabIndex===0&&i.getAttribute("tabindex")!==null&&i.getAttribute("aria-hidden")!=="true"},attemptFocus(i,e){if(this.isFocusable(i,e))try{i.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(i)},focusFirstInteractive(i){let e=i.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(i){let e=i.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(i){let e=i.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},If=toe,iB={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Gk)},preflightedRefs(){return this.el.getAttribute(Zk)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let i=this.preflightedRefs();this.preflightedWas!==i&&(this.preflightedWas=i,i===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(xy))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(Zc)),mr.getEntryDataURL(this.inputEl,this.ref,i=>{this.url=i,this.el.src=i})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>If.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>If.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&If.focusFirst(this.el)}}},Hz=()=>document.documentElement.scrollTop||document.body.scrollTop,eE=()=>window.innerHeight||document.documentElement.clientHeight,ioe=i=>{let e=i.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=eE()},noe=i=>{let e=i.getBoundingClientRect();return e.right>=0&&e.left>=0&&e.bottom<=eE()},Uz=i=>{let e=i.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=eE()};iB.InfiniteScroll={mounted(){let i=Hz(),e=!1,t=500,n=null,r=this.throttle(t,(a,l)=>{n=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{n=null})}),o=this.throttle(t,(a,l)=>{n=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{n=null,Uz(l)||l.scrollIntoView({block:"start"})})}),s=this.throttle(t,(a,l)=>{n=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{n=null,Uz(l)||l.scrollIntoView({block:"end"})})});this.onScroll=a=>{let l=Hz();if(n)return i=l,n();let c=this.el.getBoundingClientRect(),d=this.el.getAttribute(this.liveSocket.binding("viewport-top")),u=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),h=this.el.lastElementChild,f=this.el.firstElementChild,m=li;m&&d&&!e&&c.top>=0?(e=!0,r(d,f)):g&&e&&c.top<=0&&(e=!1),d&&m&&ioe(f)?o(d,f):u&&g&&noe(h)&&s(u,h),i=l},window.addEventListener("scroll",this.onScroll)},destroyed(){window.removeEventListener("scroll",this.onScroll)},throttle(i,e){let t=0,n;return(...r)=>{let o=Date.now(),s=i-(o-t);s<=0||s>i?(n&&(clearTimeout(n),n=null),t=o,e(...r)):n||(n=setTimeout(()=>{t=Date.now(),n=null,e(...r)},s))}}};var roe=iB,ooe=class{constructor(i,e,t){let n=new Set,r=new Set([...e.children].map(s=>s.id)),o=[];Array.from(i.children).forEach(s=>{if(s.id&&(n.add(s.id),r.has(s.id))){let a=s.previousElementSibling&&s.previousElementSibling.id;o.push({elementId:s.id,previousElementId:a})}}),this.containerId=e.id,this.updateType=t,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(s=>!n.has(s))}perform(){let i=pe.byId(this.containerId);this.elementsToModify.forEach(e=>{e.previousElementId?Qc(document.getElementById(e.previousElementId),t=>{Qc(document.getElementById(e.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",n)})}):Qc(document.getElementById(e.elementId),t=>{t.previousElementSibling==null||i.insertAdjacentElement("afterbegin",t)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(e=>{Qc(document.getElementById(e),t=>i.insertAdjacentElement("afterbegin",t))})}},jz=11;function soe(i,e){var t=e.attributes,n,r,o,s,a;if(!(e.nodeType===jz||i.nodeType===jz)){for(var l=t.length-1;l>=0;l--)n=t[l],r=n.name,o=n.namespaceURI,s=n.value,o?(r=n.localName||r,a=i.getAttributeNS(o,r),a!==s&&(n.prefix==="xmlns"&&(r=n.name),i.setAttributeNS(o,r,s))):(a=i.getAttribute(r),a!==s&&i.setAttribute(r,s));for(var c=i.attributes,d=c.length-1;d>=0;d--)n=c[d],r=n.name,o=n.namespaceURI,o?(r=n.localName||r,e.hasAttributeNS(o,r)||i.removeAttributeNS(o,r)):e.hasAttribute(r)||i.removeAttribute(r)}}var by,aoe="http://www.w3.org/1999/xhtml",co=typeof document=="undefined"?void 0:document,loe=!!co&&"content"in co.createElement("template"),coe=!!co&&co.createRange&&"createContextualFragment"in co.createRange();function doe(i){var e=co.createElement("template");return e.innerHTML=i,e.content.childNodes[0]}function uoe(i){by||(by=co.createRange(),by.selectNode(co.body));var e=by.createContextualFragment(i);return e.childNodes[0]}function hoe(i){var e=co.createElement("body");return e.innerHTML=i,e.childNodes[0]}function foe(i){return i=i.trim(),loe?doe(i):coe?uoe(i):hoe(i)}function vy(i,e){var t=i.nodeName,n=e.nodeName,r,o;return t===n?!0:(r=t.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?t===n.toUpperCase():o<=90&&r>=97?n===t.toUpperCase():!1)}function poe(i,e){return!e||e===aoe?co.createElement(i):co.createElementNS(e,i)}function moe(i,e){for(var t=i.firstChild;t;){var n=t.nextSibling;e.appendChild(t),t=n}return e}function $k(i,e,t){i[t]!==e[t]&&(i[t]=e[t],i[t]?i.setAttribute(t,""):i.removeAttribute(t))}var Wz={OPTION:function(i,e){var t=i.parentNode;if(t){var n=t.nodeName.toUpperCase();n==="OPTGROUP"&&(t=t.parentNode,n=t&&t.nodeName.toUpperCase()),n==="SELECT"&&!t.hasAttribute("multiple")&&(i.hasAttribute("selected")&&!e.selected&&(i.setAttribute("selected","selected"),i.removeAttribute("selected")),t.selectedIndex=-1)}$k(i,e,"selected")},INPUT:function(i,e){$k(i,e,"checked"),$k(i,e,"disabled"),i.value!==e.value&&(i.value=e.value),e.hasAttribute("value")||i.removeAttribute("value")},TEXTAREA:function(i,e){var t=e.value;i.value!==t&&(i.value=t);var n=i.firstChild;if(n){var r=n.nodeValue;if(r==t||!t&&r==i.placeholder)return;n.nodeValue=t}},SELECT:function(i,e){if(!e.hasAttribute("multiple")){for(var t=-1,n=0,r=i.firstChild,o,s;r;)if(s=r.nodeName&&r.nodeName.toUpperCase(),s==="OPTGROUP")o=r,r=o.firstChild;else{if(s==="OPTION"){if(r.hasAttribute("selected")){t=n;break}n++}r=r.nextSibling,!r&&o&&(r=o.nextSibling,o=null)}i.selectedIndex=t}}},yg=1,Vz=11,qz=3,Kz=8;function Xc(){}function goe(i){if(i)return i.getAttribute&&i.getAttribute("id")||i.id}function boe(i){return function(t,n,r){if(r||(r={}),typeof n=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var o=n;n=co.createElement("html"),n.innerHTML=o}else n=foe(n);else n.nodeType===Vz&&(n=n.firstElementChild);var s=r.getNodeKey||goe,a=r.onBeforeNodeAdded||Xc,l=r.onNodeAdded||Xc,c=r.onBeforeElUpdated||Xc,d=r.onElUpdated||Xc,u=r.onBeforeNodeDiscarded||Xc,h=r.onNodeDiscarded||Xc,f=r.onBeforeElChildrenUpdated||Xc,m=r.skipFromChildren||Xc,g=r.addChild||function(be,we){return be.appendChild(we)},w=r.childrenOnly===!0,_=Object.create(null),E=[];function A(be){E.push(be)}function L(be,we){if(be.nodeType===yg)for(var Y=be.firstChild;Y;){var R=void 0;we&&(R=s(Y))?A(R):(h(Y),Y.firstChild&&L(Y,we)),Y=Y.nextSibling}}function O(be,we,Y){u(be)!==!1&&(we&&we.removeChild(be),h(be),L(be,Y))}function U(be){if(be.nodeType===yg||be.nodeType===Vz)for(var we=be.firstChild;we;){var Y=s(we);Y&&(_[Y]=we),U(we),we=we.nextSibling}}U(t);function Q(be){l(be);for(var we=be.firstChild;we;){var Y=we.nextSibling,R=s(we);if(R){var re=_[R];re&&vy(we,re)?(we.parentNode.replaceChild(re,we),te(re,we)):Q(we)}else Q(we);we=Y}}function ae(be,we,Y){for(;we;){var R=we.nextSibling;(Y=s(we))?A(Y):O(we,be,!0),we=R}}function te(be,we,Y){var R=s(we);R&&delete _[R],!(!Y&&(c(be,we)===!1||(i(be,we),d(be),f(be,we)===!1)))&&(be.nodeName!=="TEXTAREA"?Z(be,we):Wz.TEXTAREA(be,we))}function Z(be,we){var Y=m(be,we),R=we.firstChild,re=be.firstChild,me,G,Tt,Ft,li;e:for(;R;){for(Ft=R.nextSibling,me=s(R);!Y&&re;){if(Tt=re.nextSibling,R.isSameNode&&R.isSameNode(re)){R=Ft,re=Tt;continue e}G=s(re);var Li=re.nodeType,Et=void 0;if(Li===R.nodeType&&(Li===yg?(me?me!==G&&((li=_[me])?Tt===li?Et=!1:(be.insertBefore(li,re),G?A(G):O(re,be,!0),re=li):Et=!1):G&&(Et=!1),Et=Et!==!1&&vy(re,R),Et&&te(re,R)):(Li===qz||Li==Kz)&&(Et=!0,re.nodeValue!==R.nodeValue&&(re.nodeValue=R.nodeValue))),Et){R=Ft,re=Tt;continue e}G?A(G):O(re,be,!0),re=Tt}if(me&&(li=_[me])&&vy(li,R))Y||g(be,li),te(li,R);else{var Ii=a(R);Ii!==!1&&(Ii&&(R=Ii),R.actualize&&(R=R.actualize(be.ownerDocument||co)),g(be,R),Q(R))}R=Ft,re=Tt}ae(be,re,G);var pi=Wz[be.nodeName];pi&&pi(be,we)}var ve=t,Pe=ve.nodeType,Ee=n.nodeType;if(!w){if(Pe===yg)Ee===yg?vy(t,n)||(h(t),ve=moe(t,poe(n.nodeName,n.namespaceURI))):ve=n;else if(Pe===qz||Pe===Kz){if(Ee===Pe)return ve.nodeValue!==n.nodeValue&&(ve.nodeValue=n.nodeValue),ve;ve=n}}if(ve===n)h(t);else{if(n.isSameNode&&n.isSameNode(ve))return;if(te(ve,n,w),E)for(var Oe=0,Xe=E.length;Oe{if(t&&t.isSameNode(n)&&pe.isFormInput(n))return pe.mergeFocusedInput(n,r),!1}})}constructor(i,e,t,n,r,o){this.view=i,this.liveSocket=i.liveSocket,this.container=e,this.id=t,this.rootID=i.root.id,this.html=n,this.streams=r,this.streamInserts={},this.targetCID=o,this.cidPatch=Al(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(i,e){this.callbacks[`before${i}`].push(e)}after(i,e){this.callbacks[`after${i}`].push(e)}trackBefore(i,...e){this.callbacks[`before${i}`].forEach(t=>t(...e))}trackAfter(i,...e){this.callbacks[`after${i}`].forEach(t=>t(...e))}markPrunableContentForRemoval(){let i=this.liveSocket.binding(Ey);pe.all(this.container,`[${i}=${jk}]`,e=>e.innerHTML=""),pe.all(this.container,`[${i}=append] > *, [${i}=prepend] > *`,e=>{e.setAttribute(Tz,"")})}perform(){let{view:i,liveSocket:e,container:t,html:n}=this,r=this.isCIDPatch()?this.targetCIDContainer(n):t;if(this.isCIDPatch()&&!r)return;let o=e.getActiveElement(),{selectionStart:s,selectionEnd:a}=o&&pe.hasSelectionRange(o)?o:{},l=e.binding(Ey),c=e.binding(Sy),d=e.binding(Qk),u=e.binding(Zz),h=e.binding(Jz),f=e.binding(Fre),m=[],g=[],w=[],_=[],E=null,A=e.time("premorph container prep",()=>this.buildDiffHTML(t,n,l,r));return this.trackBefore("added",t),this.trackBefore("updated",t,t),e.time("morphdom",()=>{this.streams.forEach(([L,O,U,Q])=>{Object.entries(O).forEach(([ae,[te,Z]])=>{this.streamInserts[ae]={ref:L,streamAt:te,limit:Z}}),Q!==void 0&&pe.all(t,`[${bg}="${L}"]`,ae=>{O[ae.id]||this.removeStreamChildElement(ae)}),U.forEach(ae=>{let te=t.querySelector(`[id="${ae}"]`);te&&this.removeStreamChildElement(te)})}),$z(r,A,{childrenOnly:r.getAttribute(Fo)===null,getNodeKey:L=>pe.isPhxDestroyed(L)?null:L.id,skipFromChildren:L=>L.getAttribute(l)===jk,addChild:(L,O)=>{let{ref:U,streamAt:Q,limit:ae}=this.getStreamInsert(O);if(U===void 0)return L.appendChild(O);if(pe.putSticky(O,bg,ve=>ve.setAttribute(bg,U)),Q===0)L.insertAdjacentElement("afterbegin",O);else if(Q===-1)L.appendChild(O);else if(Q>0){let ve=Array.from(L.children)[Q];L.insertBefore(O,ve)}let te=ae!==null&&Array.from(L.children),Z=[];ae&&ae<0&&te.length>ae*-1?Z=te.slice(0,te.length+ae):ae&&ae>=0&&te.length>ae&&(Z=te.slice(ae)),Z.forEach(ve=>{this.streamInserts[ve.id]||this.removeStreamChildElement(ve)})},onBeforeNodeAdded:L=>(pe.maybeAddPrivateHooks(L,u,h),this.trackBefore("added",L),L),onNodeAdded:L=>{L.getAttribute&&this.maybeReOrderStream(L),L instanceof HTMLImageElement&&L.srcset?L.srcset=L.srcset:L instanceof HTMLVideoElement&&L.autoplay&&L.play(),pe.isNowTriggerFormExternal(L,f)&&(E=L),L.getAttribute&&L.getAttribute("name")&&pe.isFormInput(L)&&g.push(L),(pe.isPhxChild(L)&&i.ownsElement(L)||pe.isPhxSticky(L)&&i.ownsElement(L.parentNode))&&this.trackAfter("phxChildAdded",L),m.push(L)},onNodeDiscarded:L=>this.onNodeDiscarded(L),onBeforeNodeDiscarded:L=>L.getAttribute&&L.getAttribute(Tz)!==null?!0:!(L.parentElement!==null&&L.id&&pe.isPhxUpdate(L.parentElement,l,[jk,"append","prepend"])||this.maybePendingRemove(L)||this.skipCIDSibling(L)),onElUpdated:L=>{pe.isNowTriggerFormExternal(L,f)&&(E=L),w.push(L),this.maybeReOrderStream(L)},onBeforeElUpdated:(L,O)=>{if(pe.maybeAddPrivateHooks(O,u,h),pe.cleanChildNodes(O,l),this.skipCIDSibling(O)||pe.isPhxSticky(L))return!1;if(pe.isIgnored(L,l)||L.form&&L.form.isSameNode(E))return this.trackBefore("updated",L,O),pe.mergeAttrs(L,O,{isIgnored:!0}),w.push(L),pe.applyStickyOperations(L),!1;if(L.type==="number"&&L.validity&&L.validity.badInput)return!1;if(!pe.syncPendingRef(L,O,d))return pe.isUploadInput(L)&&(this.trackBefore("updated",L,O),w.push(L)),pe.applyStickyOperations(L),!1;if(pe.isPhxChild(O)){let Q=L.getAttribute(Jc);return pe.mergeAttrs(L,O,{exclude:[xg]}),Q!==""&&L.setAttribute(Jc,Q),L.setAttribute(Sg,this.rootID),pe.applyStickyOperations(L),!1}return pe.copyPrivates(O,L),o&&L.isSameNode(o)&&pe.isFormInput(L)&&L.type!=="hidden"?(this.trackBefore("updated",L,O),pe.mergeFocusedInput(L,O),pe.syncAttrsToProps(L),w.push(L),pe.applyStickyOperations(L),g.push(L),!1):(pe.isPhxUpdate(O,l,["append","prepend"])&&_.push(new ooe(L,O,O.getAttribute(l))),pe.syncAttrsToProps(O),pe.applyStickyOperations(O),O.getAttribute("name")&&pe.isFormInput(O)&&g.push(O),this.trackBefore("updated",L,O),!0)}})}),e.isDebugEnabled()&&Xre(),_.length>0&&e.time("post-morph append/prepend restoration",()=>{_.forEach(L=>L.perform())}),g.forEach(L=>{pe.maybeHideFeedback(r,L,c)}),e.silenceEvents(()=>pe.restoreFocus(o,s,a)),pe.dispatchEvent(document,"phx:update"),m.forEach(L=>this.trackAfter("added",L)),w.forEach(L=>this.trackAfter("updated",L)),this.transitionPendingRemoves(),E&&(e.unload(),Object.getPrototypeOf(E).submit.call(E)),!0}onNodeDiscarded(i){(pe.isPhxChild(i)||pe.isPhxSticky(i))&&this.liveSocket.destroyViewByEl(i),this.trackAfter("discarded",i)}maybePendingRemove(i){return i.getAttribute&&i.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(i),!0):!1}removeStreamChildElement(i){this.maybePendingRemove(i)||(i.remove(),this.onNodeDiscarded(i))}getStreamInsert(i){return(i.id?this.streamInserts[i.id]:{})||{}}maybeReOrderStream(i){let{ref:e,streamAt:t,limit:n}=this.getStreamInsert(i);if(t!==void 0){if(pe.putSticky(i,bg,r=>r.setAttribute(bg,e)),t===0)i.parentElement.insertBefore(i,i.parentElement.firstElementChild);else if(t>0){let r=Array.from(i.parentElement.children),o=r.indexOf(i);if(t>=r.length-1)i.parentElement.appendChild(i);else{let s=r[t];o>t?i.parentElement.insertBefore(i,s):i.parentElement.insertBefore(i,s.nextElementSibling)}}}}transitionPendingRemoves(){let{pendingRemoves:i,liveSocket:e}=this;i.length>0&&(e.transitionRemoves(i),e.requestDOMUpdate(()=>{i.forEach(t=>{let n=pe.firstPhxChild(t);n&&e.destroyViewByEl(n),t.remove()}),this.trackAfter("transitionsDiscarded",i)}))}isCIDPatch(){return this.cidPatch}skipCIDSibling(i){return i.nodeType===Node.ELEMENT_NODE&&i.getAttribute(Yk)!==null}targetCIDContainer(i){if(!this.isCIDPatch())return;let[e,...t]=pe.findComponentNodeList(this.container,this.targetCID);return t.length===0&&pe.childNodeLength(i)===1?e:e&&e.parentNode}buildDiffHTML(i,e,t,n){let r=this.isCIDPatch(),o=r&&n.getAttribute(Fo)===this.targetCID.toString();if(!r||o)return e;{let s=null,a=document.createElement("template");s=pe.cloneNode(n);let[l,...c]=pe.findComponentNodeList(s,this.targetCID);return a.innerHTML=e,c.forEach(d=>d.remove()),Array.from(s.childNodes).forEach(d=>{d.id&&d.nodeType===Node.ELEMENT_NODE&&d.getAttribute(Fo)!==this.targetCID.toString()&&(d.setAttribute(Yk,""),d.innerHTML="")}),Array.from(a.content.childNodes).forEach(d=>s.insertBefore(d,l)),l.remove(),s.outerHTML}}indexOf(i,e){return Array.from(i.children).indexOf(e)}},Gz=class{static extract(i){let{[Oz]:e,[Pz]:t,[Fz]:n}=i;return delete i[Oz],delete i[Pz],delete i[Fz],{diff:i,title:n,reply:e||null,events:t||[]}}constructor(i,e){this.viewId=i,this.rendered={},this.mergeDiff(e)}parentViewId(){return this.viewId}toString(i){let[e,t]=this.recursiveToString(this.rendered,this.rendered[Oo],i);return[e,t]}recursiveToString(i,e=i[Oo],t){t=t?new Set(t):null;let n={buffer:"",components:e,onlyCids:t,streams:new Set};return this.toOutputBuffer(i,null,n),[n.buffer,n.streams]}componentCIDs(i){return Object.keys(i[Oo]||{}).map(e=>parseInt(e))}isComponentOnlyDiff(i){return i[Oo]?Object.keys(i).length===1:!1}getComponent(i,e){return i[Oo][e]}mergeDiff(i){let e=i[Oo],t={};if(delete i[Oo],this.rendered=this.mutableMerge(this.rendered,i),this.rendered[Oo]=this.rendered[Oo]||{},e){let n=this.rendered[Oo];for(let r in e)e[r]=this.cachedFindComponent(r,e[r],n,e,t);for(let r in e)n[r]=e[r];i[Oo]=e}}cachedFindComponent(i,e,t,n,r){if(r[i])return r[i];{let o,s,a=e[Ta];if(Al(a)){let l;a>0?l=this.cachedFindComponent(a,n[a],t,n,r):l=t[-a],s=l[Ta],o=this.cloneMerge(l,e),o[Ta]=s}else o=e[Ta]!==void 0?e:this.cloneMerge(t[i]||{},e);return r[i]=o,o}}mutableMerge(i,e){return e[Ta]!==void 0?e:(this.doMutableMerge(i,e),i)}doMutableMerge(i,e){for(let t in e){let n=e[t],r=i[t];_g(n)&&n[Ta]===void 0&&_g(r)?this.doMutableMerge(r,n):i[t]=n}}cloneMerge(i,e){let t=ue(ue({},i),e);for(let n in t){let r=e[n],o=i[n];_g(r)&&r[Ta]===void 0&&_g(o)&&(t[n]=this.cloneMerge(o,r))}return t}componentToString(i){let[e,t]=this.recursiveCIDToString(this.rendered[Oo],i,null,!1);return[e,t]}pruneCIDs(i){i.forEach(e=>delete this.rendered[Oo][e])}get(){return this.rendered}isNewFingerprint(i={}){return!!i[Ta]}templateStatic(i,e){return typeof i=="number"?e[i]:i}toOutputBuffer(i,e,t){if(i[gy])return this.comprehensionToBuffer(i,e,t);let{[Ta]:n}=i;n=this.templateStatic(n,e),t.buffer+=n[0];for(let r=1;r0||l.length>0||c)&&(delete i[zz],i[gy]=[],t.streams.add(o))}dynamicToBuffer(i,e,t){if(typeof i=="number"){let[n,r]=this.recursiveCIDToString(t.components,i,t.onlyCids);t.buffer+=n,t.streams=new Set([...t.streams,...r])}else _g(i)?this.toOutputBuffer(i,e,t):t.buffer+=i}recursiveCIDToString(i,e,t,n=!0){let r=i[e]||Rr(`no component for CID ${e}`,i),o=document.createElement("template"),[s,a]=this.recursiveToString(r,i,t);o.innerHTML=s;let l=o.content,c=t&&!t.has(e),[d,u]=Array.from(l.childNodes).reduce(([h,f],m,g)=>m.nodeType===Node.ELEMENT_NODE?m.getAttribute(Fo)?[h,!0]:(m.setAttribute(Fo,e),m.id||(m.id=`${this.parentViewId()}-${e}-${g}`),c&&(m.setAttribute(Yk,""),m.innerHTML=""),[!0,f]):m.nodeType===Node.COMMENT_NODE?(n||m.remove(),[h,f]):m.nodeValue.trim()!==""?(Rr(`only HTML element tags are allowed at the root of components. +`),t.push(n))}),t.forEach(n=>n.remove())}},replaceRootContainer(i,e,t){let n=new Set(["id",Jc,xg,Jk,Sg]);if(i.tagName.toLowerCase()===e.toLowerCase())return Array.from(i.attributes).filter(r=>!n.has(r.name.toLowerCase())).forEach(r=>i.removeAttribute(r.name)),Object.keys(t).filter(r=>!n.has(r.toLowerCase())).forEach(r=>i.setAttribute(r,t[r])),i;{let r=document.createElement(e);return Object.keys(t).forEach(o=>r.setAttribute(o,t[o])),n.forEach(o=>r.setAttribute(o,i.getAttribute(o))),r.innerHTML=i.innerHTML,i.replaceWith(r),r}},getSticky(i,e,t){let n=(os.private(i,"sticky")||[]).find(([r])=>e===r);if(n){let[r,o,s]=n;return s}else return typeof t=="function"?t():t},deleteSticky(i,e){this.updatePrivate(i,"sticky",[],t=>t.filter(([n,r])=>n!==e))},putSticky(i,e,t){let n=t(i);this.updatePrivate(i,"sticky",[],r=>{let o=r.findIndex(([s])=>e===s);return o>=0?r[o]=[e,t,n]:r.push([e,t,n]),r})},applyStickyOperations(i){let e=os.private(i,"sticky");e&&e.forEach(([t,n,r])=>this.putSticky(i,t,n))}},pe=os,Kk=class{static isActive(i,e){let t=e._phxRef===void 0,r=i.getAttribute(Gk).split(",").indexOf(mr.genFileRef(e))>=0;return e.size>0&&(t||r)}static isPreflighted(i,e){return i.getAttribute(Zk).split(",").indexOf(mr.genFileRef(e))>=0&&this.isActive(i,e)}constructor(i,e,t){this.ref=mr.genFileRef(e),this.fileEl=i,this.file=e,this.view=t,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(xy,this._onElUpdated)}metadata(){return this.meta}progress(i){this._progress=Math.floor(i),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{mr.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(i="failed"){this.fileEl.removeEventListener(xy,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:i}),pe.isAutoUpload(this.fileEl)||mr.clearFiles(this.fileEl)}onDone(i){this._onDone=()=>{this.fileEl.removeEventListener(xy,this._onElUpdated),i()}}onElUpdated(){this.fileEl.getAttribute(Gk).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,meta:typeof this.file.meta=="function"?this.file.meta():void 0}}uploader(i){if(this.meta.uploader){let e=i[this.meta.uploader]||Rr(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:e}}else return{name:"channel",callback:Jre}}zipPostFlight(i){this.meta=i.entries[this.ref],this.meta||Rr(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:i})}},eoe=0,mr=class{static genFileRef(i){let e=i._phxRef;return e!==void 0?e:(i._phxRef=(eoe++).toString(),i._phxRef)}static getEntryDataURL(i,e,t){let n=this.activeFiles(i).find(r=>this.genFileRef(r)===e);t(URL.createObjectURL(n))}static hasUploadsInProgress(i){let e=0;return pe.findUploadInputs(i).forEach(t=>{t.getAttribute(Zk)!==t.getAttribute(Ore)&&e++}),e>0}static serializeUploads(i){let e=this.activeFiles(i),t={};return e.forEach(n=>{let r={path:i.name},o=i.getAttribute(Zc);t[o]=t[o]||[],r.ref=this.genFileRef(n),r.last_modified=n.lastModified,r.name=n.name||r.ref,r.relative_path=n.webkitRelativePath,r.type=n.type,r.size=n.size,typeof n.meta=="function"&&(r.meta=n.meta()),t[o].push(r)}),t}static clearFiles(i){i.value=null,i.removeAttribute(Zc),pe.putPrivate(i,"files",[])}static untrackFile(i,e){pe.putPrivate(i,"files",pe.private(i,"files").filter(t=>!Object.is(t,e)))}static trackFiles(i,e,t){if(i.getAttribute("multiple")!==null){let n=e.filter(r=>!this.activeFiles(i).find(o=>Object.is(o,r)));pe.putPrivate(i,"files",this.activeFiles(i).concat(n)),i.value=null}else t&&t.files.length>0&&(i.files=t.files),pe.putPrivate(i,"files",e)}static activeFileInputs(i){let e=pe.findUploadInputs(i);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(i){return(pe.private(i,"files")||[]).filter(e=>Kk.isActive(i,e))}static inputsAwaitingPreflight(i){let e=pe.findUploadInputs(i);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(i){return this.activeFiles(i).filter(e=>!Kk.isPreflighted(i,e))}constructor(i,e,t){this.view=e,this.onComplete=t,this._entries=Array.from(mr.filesAwaitingPreflight(i)||[]).map(n=>new Kk(i,n,e)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(i,e,t){this._entries=this._entries.map(r=>(r.zipPostFlight(i),r.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),r));let n=this._entries.reduce((r,o)=>{if(!o.meta)return r;let{name:s,callback:a}=o.uploader(t.uploaders);return r[s]=r[s]||{callback:a,entries:[]},r[s].entries.push(o),r},{});for(let r in n){let{callback:o,entries:s}=n[r];o(s,e,i,t)}}},toe={focusMain(){let i=document.querySelector("main h1, main, h1");if(i){let e=i.tabIndex;i.tabIndex=-1,i.focus(),i.tabIndex=e}},anyOf(i,e){return e.find(t=>i instanceof t)},isFocusable(i,e){return i instanceof HTMLAnchorElement&&i.rel!=="ignore"||i instanceof HTMLAreaElement&&i.href!==void 0||!i.disabled&&this.anyOf(i,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||i instanceof HTMLIFrameElement||i.tabIndex>0||!e&&i.tabIndex===0&&i.getAttribute("tabindex")!==null&&i.getAttribute("aria-hidden")!=="true"},attemptFocus(i,e){if(this.isFocusable(i,e))try{i.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(i)},focusFirstInteractive(i){let e=i.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(i){let e=i.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(i){let e=i.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},If=toe,iB={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Gk)},preflightedRefs(){return this.el.getAttribute(Zk)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let i=this.preflightedRefs();this.preflightedWas!==i&&(this.preflightedWas=i,i===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(xy))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(Zc)),mr.getEntryDataURL(this.inputEl,this.ref,i=>{this.url=i,this.el.src=i})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>If.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>If.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&If.focusFirst(this.el)}}},Hz=()=>document.documentElement.scrollTop||document.body.scrollTop,eE=()=>window.innerHeight||document.documentElement.clientHeight,ioe=i=>{let e=i.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=eE()},noe=i=>{let e=i.getBoundingClientRect();return e.right>=0&&e.left>=0&&e.bottom<=eE()},Uz=i=>{let e=i.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.top<=eE()};iB.InfiniteScroll={mounted(){let i=Hz(),e=!1,t=500,n=null,r=this.throttle(t,(a,l)=>{n=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{n=null})}),o=this.throttle(t,(a,l)=>{n=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{n=null,Uz(l)||l.scrollIntoView({block:"start"})})}),s=this.throttle(t,(a,l)=>{n=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{n=null,Uz(l)||l.scrollIntoView({block:"end"})})});this.onScroll=a=>{let l=Hz();if(n)return i=l,n();let c=this.el.getBoundingClientRect(),d=this.el.getAttribute(this.liveSocket.binding("viewport-top")),u=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),h=this.el.lastElementChild,f=this.el.firstElementChild,m=li;m&&d&&!e&&c.top>=0?(e=!0,r(d,f)):g&&e&&c.top<=0&&(e=!1),d&&m&&ioe(f)?o(d,f):u&&g&&noe(h)&&s(u,h),i=l},window.addEventListener("scroll",this.onScroll)},destroyed(){window.removeEventListener("scroll",this.onScroll)},throttle(i,e){let t=0,n;return(...r)=>{let o=Date.now(),s=i-(o-t);s<=0||s>i?(n&&(clearTimeout(n),n=null),t=o,e(...r)):n||(n=setTimeout(()=>{t=Date.now(),n=null,e(...r)},s))}}};var roe=iB,ooe=class{constructor(i,e,t){let n=new Set,r=new Set([...e.children].map(s=>s.id)),o=[];Array.from(i.children).forEach(s=>{if(s.id&&(n.add(s.id),r.has(s.id))){let a=s.previousElementSibling&&s.previousElementSibling.id;o.push({elementId:s.id,previousElementId:a})}}),this.containerId=e.id,this.updateType=t,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(s=>!n.has(s))}perform(){let i=pe.byId(this.containerId);this.elementsToModify.forEach(e=>{e.previousElementId?Qc(document.getElementById(e.previousElementId),t=>{Qc(document.getElementById(e.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",n)})}):Qc(document.getElementById(e.elementId),t=>{t.previousElementSibling==null||i.insertAdjacentElement("afterbegin",t)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(e=>{Qc(document.getElementById(e),t=>i.insertAdjacentElement("afterbegin",t))})}},jz=11;function soe(i,e){var t=e.attributes,n,r,o,s,a;if(!(e.nodeType===jz||i.nodeType===jz)){for(var l=t.length-1;l>=0;l--)n=t[l],r=n.name,o=n.namespaceURI,s=n.value,o?(r=n.localName||r,a=i.getAttributeNS(o,r),a!==s&&(n.prefix==="xmlns"&&(r=n.name),i.setAttributeNS(o,r,s))):(a=i.getAttribute(r),a!==s&&i.setAttribute(r,s));for(var c=i.attributes,d=c.length-1;d>=0;d--)n=c[d],r=n.name,o=n.namespaceURI,o?(r=n.localName||r,e.hasAttributeNS(o,r)||i.removeAttributeNS(o,r)):e.hasAttribute(r)||i.removeAttribute(r)}}var by,aoe="http://www.w3.org/1999/xhtml",co=typeof document=="undefined"?void 0:document,loe=!!co&&"content"in co.createElement("template"),coe=!!co&&co.createRange&&"createContextualFragment"in co.createRange();function doe(i){var e=co.createElement("template");return e.innerHTML=i,e.content.childNodes[0]}function uoe(i){by||(by=co.createRange(),by.selectNode(co.body));var e=by.createContextualFragment(i);return e.childNodes[0]}function hoe(i){var e=co.createElement("body");return e.innerHTML=i,e.childNodes[0]}function foe(i){return i=i.trim(),loe?doe(i):coe?uoe(i):hoe(i)}function vy(i,e){var t=i.nodeName,n=e.nodeName,r,o;return t===n?!0:(r=t.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?t===n.toUpperCase():o<=90&&r>=97?n===t.toUpperCase():!1)}function poe(i,e){return!e||e===aoe?co.createElement(i):co.createElementNS(e,i)}function moe(i,e){for(var t=i.firstChild;t;){var n=t.nextSibling;e.appendChild(t),t=n}return e}function $k(i,e,t){i[t]!==e[t]&&(i[t]=e[t],i[t]?i.setAttribute(t,""):i.removeAttribute(t))}var Wz={OPTION:function(i,e){var t=i.parentNode;if(t){var n=t.nodeName.toUpperCase();n==="OPTGROUP"&&(t=t.parentNode,n=t&&t.nodeName.toUpperCase()),n==="SELECT"&&!t.hasAttribute("multiple")&&(i.hasAttribute("selected")&&!e.selected&&(i.setAttribute("selected","selected"),i.removeAttribute("selected")),t.selectedIndex=-1)}$k(i,e,"selected")},INPUT:function(i,e){$k(i,e,"checked"),$k(i,e,"disabled"),i.value!==e.value&&(i.value=e.value),e.hasAttribute("value")||i.removeAttribute("value")},TEXTAREA:function(i,e){var t=e.value;i.value!==t&&(i.value=t);var n=i.firstChild;if(n){var r=n.nodeValue;if(r==t||!t&&r==i.placeholder)return;n.nodeValue=t}},SELECT:function(i,e){if(!e.hasAttribute("multiple")){for(var t=-1,n=0,r=i.firstChild,o,s;r;)if(s=r.nodeName&&r.nodeName.toUpperCase(),s==="OPTGROUP")o=r,r=o.firstChild;else{if(s==="OPTION"){if(r.hasAttribute("selected")){t=n;break}n++}r=r.nextSibling,!r&&o&&(r=o.nextSibling,o=null)}i.selectedIndex=t}}},yg=1,Vz=11,qz=3,Kz=8;function Xc(){}function goe(i){if(i)return i.getAttribute&&i.getAttribute("id")||i.id}function boe(i){return function(t,n,r){if(r||(r={}),typeof n=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var o=n;n=co.createElement("html"),n.innerHTML=o}else n=foe(n);else n.nodeType===Vz&&(n=n.firstElementChild);var s=r.getNodeKey||goe,a=r.onBeforeNodeAdded||Xc,l=r.onNodeAdded||Xc,c=r.onBeforeElUpdated||Xc,d=r.onElUpdated||Xc,u=r.onBeforeNodeDiscarded||Xc,h=r.onNodeDiscarded||Xc,f=r.onBeforeElChildrenUpdated||Xc,m=r.skipFromChildren||Xc,g=r.addChild||function(be,we){return be.appendChild(we)},w=r.childrenOnly===!0,_=Object.create(null),E=[];function A(be){E.push(be)}function L(be,we){if(be.nodeType===yg)for(var Y=be.firstChild;Y;){var R=void 0;we&&(R=s(Y))?A(R):(h(Y),Y.firstChild&&L(Y,we)),Y=Y.nextSibling}}function O(be,we,Y){u(be)!==!1&&(we&&we.removeChild(be),h(be),L(be,Y))}function U(be){if(be.nodeType===yg||be.nodeType===Vz)for(var we=be.firstChild;we;){var Y=s(we);Y&&(_[Y]=we),U(we),we=we.nextSibling}}U(t);function Q(be){l(be);for(var we=be.firstChild;we;){var Y=we.nextSibling,R=s(we);if(R){var re=_[R];re&&vy(we,re)?(we.parentNode.replaceChild(re,we),te(re,we)):Q(we)}else Q(we);we=Y}}function ae(be,we,Y){for(;we;){var R=we.nextSibling;(Y=s(we))?A(Y):O(we,be,!0),we=R}}function te(be,we,Y){var R=s(we);R&&delete _[R],!(!Y&&(c(be,we)===!1||(i(be,we),d(be),f(be,we)===!1)))&&(be.nodeName!=="TEXTAREA"?Z(be,we):Wz.TEXTAREA(be,we))}function Z(be,we){var Y=m(be),R=we.firstChild,re=be.firstChild,me,G,Tt,Ft,li;e:for(;R;){for(Ft=R.nextSibling,me=s(R);!Y&&re;){if(Tt=re.nextSibling,R.isSameNode&&R.isSameNode(re)){R=Ft,re=Tt;continue e}G=s(re);var Li=re.nodeType,Et=void 0;if(Li===R.nodeType&&(Li===yg?(me?me!==G&&((li=_[me])?Tt===li?Et=!1:(be.insertBefore(li,re),G?A(G):O(re,be,!0),re=li):Et=!1):G&&(Et=!1),Et=Et!==!1&&vy(re,R),Et&&te(re,R)):(Li===qz||Li==Kz)&&(Et=!0,re.nodeValue!==R.nodeValue&&(re.nodeValue=R.nodeValue))),Et){R=Ft,re=Tt;continue e}G?A(G):O(re,be,!0),re=Tt}if(me&&(li=_[me])&&vy(li,R))Y||g(be,li),te(li,R);else{var Ii=a(R);Ii!==!1&&(Ii&&(R=Ii),R.actualize&&(R=R.actualize(be.ownerDocument||co)),g(be,R),Q(R))}R=Ft,re=Tt}ae(be,re,G);var pi=Wz[be.nodeName];pi&&pi(be,we)}var ve=t,Pe=ve.nodeType,Ee=n.nodeType;if(!w){if(Pe===yg)Ee===yg?vy(t,n)||(h(t),ve=moe(t,poe(n.nodeName,n.namespaceURI))):ve=n;else if(Pe===qz||Pe===Kz){if(Ee===Pe)return ve.nodeValue!==n.nodeValue&&(ve.nodeValue=n.nodeValue),ve;ve=n}}if(ve===n)h(t);else{if(n.isSameNode&&n.isSameNode(ve))return;if(te(ve,n,w),E)for(var Oe=0,Xe=E.length;Oe{if(t&&t.isSameNode(n)&&pe.isFormInput(n))return pe.mergeFocusedInput(n,r),!1}})}constructor(i,e,t,n,r,o){this.view=i,this.liveSocket=i.liveSocket,this.container=e,this.id=t,this.rootID=i.root.id,this.html=n,this.streams=r,this.streamInserts={},this.targetCID=o,this.cidPatch=Al(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(i,e){this.callbacks[`before${i}`].push(e)}after(i,e){this.callbacks[`after${i}`].push(e)}trackBefore(i,...e){this.callbacks[`before${i}`].forEach(t=>t(...e))}trackAfter(i,...e){this.callbacks[`after${i}`].forEach(t=>t(...e))}markPrunableContentForRemoval(){let i=this.liveSocket.binding(Ey);pe.all(this.container,`[${i}=${jk}]`,e=>e.innerHTML=""),pe.all(this.container,`[${i}=append] > *, [${i}=prepend] > *`,e=>{e.setAttribute(Tz,"")})}perform(){let{view:i,liveSocket:e,container:t,html:n}=this,r=this.isCIDPatch()?this.targetCIDContainer(n):t;if(this.isCIDPatch()&&!r)return;let o=e.getActiveElement(),{selectionStart:s,selectionEnd:a}=o&&pe.hasSelectionRange(o)?o:{},l=e.binding(Ey),c=e.binding(Sy),d=e.binding(Qk),u=e.binding(Zz),h=e.binding(Jz),f=e.binding(Fre),m=[],g=[],w=[],_=[],E=null,A=e.time("premorph container prep",()=>this.buildDiffHTML(t,n,l,r));return this.trackBefore("added",t),this.trackBefore("updated",t,t),e.time("morphdom",()=>{this.streams.forEach(([L,O,U,Q])=>{Object.entries(O).forEach(([ae,[te,Z]])=>{this.streamInserts[ae]={ref:L,streamAt:te,limit:Z}}),Q!==void 0&&pe.all(t,`[${bg}="${L}"]`,ae=>{O[ae.id]||this.removeStreamChildElement(ae)}),U.forEach(ae=>{let te=t.querySelector(`[id="${ae}"]`);te&&this.removeStreamChildElement(te)})}),$z(r,A,{childrenOnly:r.getAttribute(Fo)===null,getNodeKey:L=>pe.isPhxDestroyed(L)?null:L.id,skipFromChildren:L=>L.getAttribute(l)===jk,addChild:(L,O)=>{let{ref:U,streamAt:Q,limit:ae}=this.getStreamInsert(O);if(U===void 0)return L.appendChild(O);if(pe.putSticky(O,bg,ve=>ve.setAttribute(bg,U)),Q===0)L.insertAdjacentElement("afterbegin",O);else if(Q===-1)L.appendChild(O);else if(Q>0){let ve=Array.from(L.children)[Q];L.insertBefore(O,ve)}let te=ae!==null&&Array.from(L.children),Z=[];ae&&ae<0&&te.length>ae*-1?Z=te.slice(0,te.length+ae):ae&&ae>=0&&te.length>ae&&(Z=te.slice(ae)),Z.forEach(ve=>{this.streamInserts[ve.id]||this.removeStreamChildElement(ve)})},onBeforeNodeAdded:L=>(pe.maybeAddPrivateHooks(L,u,h),this.trackBefore("added",L),L),onNodeAdded:L=>{L.getAttribute&&this.maybeReOrderStream(L),L instanceof HTMLImageElement&&L.srcset?L.srcset=L.srcset:L instanceof HTMLVideoElement&&L.autoplay&&L.play(),pe.isNowTriggerFormExternal(L,f)&&(E=L),L.getAttribute&&L.getAttribute("name")&&pe.isFormInput(L)&&g.push(L),(pe.isPhxChild(L)&&i.ownsElement(L)||pe.isPhxSticky(L)&&i.ownsElement(L.parentNode))&&this.trackAfter("phxChildAdded",L),m.push(L)},onNodeDiscarded:L=>this.onNodeDiscarded(L),onBeforeNodeDiscarded:L=>L.getAttribute&&L.getAttribute(Tz)!==null?!0:!(L.parentElement!==null&&L.id&&pe.isPhxUpdate(L.parentElement,l,[jk,"append","prepend"])||this.maybePendingRemove(L)||this.skipCIDSibling(L)),onElUpdated:L=>{pe.isNowTriggerFormExternal(L,f)&&(E=L),w.push(L),this.maybeReOrderStream(L)},onBeforeElUpdated:(L,O)=>{if(pe.maybeAddPrivateHooks(O,u,h),pe.cleanChildNodes(O,l),this.skipCIDSibling(O)||pe.isPhxSticky(L))return!1;if(pe.isIgnored(L,l)||L.form&&L.form.isSameNode(E))return this.trackBefore("updated",L,O),pe.mergeAttrs(L,O,{isIgnored:!0}),w.push(L),pe.applyStickyOperations(L),!1;if(L.type==="number"&&L.validity&&L.validity.badInput)return!1;if(!pe.syncPendingRef(L,O,d))return pe.isUploadInput(L)&&(this.trackBefore("updated",L,O),w.push(L)),pe.applyStickyOperations(L),!1;if(pe.isPhxChild(O)){let Q=L.getAttribute(Jc);return pe.mergeAttrs(L,O,{exclude:[xg]}),Q!==""&&L.setAttribute(Jc,Q),L.setAttribute(Sg,this.rootID),pe.applyStickyOperations(L),!1}return pe.copyPrivates(O,L),o&&L.isSameNode(o)&&pe.isFormInput(L)&&L.type!=="hidden"?(this.trackBefore("updated",L,O),pe.mergeFocusedInput(L,O),pe.syncAttrsToProps(L),w.push(L),pe.applyStickyOperations(L),g.push(L),!1):(pe.isPhxUpdate(O,l,["append","prepend"])&&_.push(new ooe(L,O,O.getAttribute(l))),pe.syncAttrsToProps(O),pe.applyStickyOperations(O),O.getAttribute("name")&&pe.isFormInput(O)&&g.push(O),this.trackBefore("updated",L,O),!0)}})}),e.isDebugEnabled()&&Xre(),_.length>0&&e.time("post-morph append/prepend restoration",()=>{_.forEach(L=>L.perform())}),g.forEach(L=>{pe.maybeHideFeedback(r,L,c)}),e.silenceEvents(()=>pe.restoreFocus(o,s,a)),pe.dispatchEvent(document,"phx:update"),m.forEach(L=>this.trackAfter("added",L)),w.forEach(L=>this.trackAfter("updated",L)),this.transitionPendingRemoves(),E&&(e.unload(),Object.getPrototypeOf(E).submit.call(E)),!0}onNodeDiscarded(i){(pe.isPhxChild(i)||pe.isPhxSticky(i))&&this.liveSocket.destroyViewByEl(i),this.trackAfter("discarded",i)}maybePendingRemove(i){return i.getAttribute&&i.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(i),!0):!1}removeStreamChildElement(i){this.maybePendingRemove(i)||(i.remove(),this.onNodeDiscarded(i))}getStreamInsert(i){return(i.id?this.streamInserts[i.id]:{})||{}}maybeReOrderStream(i){let{ref:e,streamAt:t,limit:n}=this.getStreamInsert(i);if(t!==void 0){if(pe.putSticky(i,bg,r=>r.setAttribute(bg,e)),t===0)i.parentElement.insertBefore(i,i.parentElement.firstElementChild);else if(t>0){let r=Array.from(i.parentElement.children),o=r.indexOf(i);if(t>=r.length-1)i.parentElement.appendChild(i);else{let s=r[t];o>t?i.parentElement.insertBefore(i,s):i.parentElement.insertBefore(i,s.nextElementSibling)}}}}transitionPendingRemoves(){let{pendingRemoves:i,liveSocket:e}=this;i.length>0&&(e.transitionRemoves(i),e.requestDOMUpdate(()=>{i.forEach(t=>{let n=pe.firstPhxChild(t);n&&e.destroyViewByEl(n),t.remove()}),this.trackAfter("transitionsDiscarded",i)}))}isCIDPatch(){return this.cidPatch}skipCIDSibling(i){return i.nodeType===Node.ELEMENT_NODE&&i.getAttribute(Yk)!==null}targetCIDContainer(i){if(!this.isCIDPatch())return;let[e,...t]=pe.findComponentNodeList(this.container,this.targetCID);return t.length===0&&pe.childNodeLength(i)===1?e:e&&e.parentNode}buildDiffHTML(i,e,t,n){let r=this.isCIDPatch(),o=r&&n.getAttribute(Fo)===this.targetCID.toString();if(!r||o)return e;{let s=null,a=document.createElement("template");s=pe.cloneNode(n);let[l,...c]=pe.findComponentNodeList(s,this.targetCID);return a.innerHTML=e,c.forEach(d=>d.remove()),Array.from(s.childNodes).forEach(d=>{d.id&&d.nodeType===Node.ELEMENT_NODE&&d.getAttribute(Fo)!==this.targetCID.toString()&&(d.setAttribute(Yk,""),d.innerHTML="")}),Array.from(a.content.childNodes).forEach(d=>s.insertBefore(d,l)),l.remove(),s.outerHTML}}indexOf(i,e){return Array.from(i.children).indexOf(e)}},Gz=class{static extract(i){let{[Oz]:e,[Pz]:t,[Fz]:n}=i;return delete i[Oz],delete i[Pz],delete i[Fz],{diff:i,title:n,reply:e||null,events:t||[]}}constructor(i,e){this.viewId=i,this.rendered={},this.mergeDiff(e)}parentViewId(){return this.viewId}toString(i){let[e,t]=this.recursiveToString(this.rendered,this.rendered[Oo],i);return[e,t]}recursiveToString(i,e=i[Oo],t){t=t?new Set(t):null;let n={buffer:"",components:e,onlyCids:t,streams:new Set};return this.toOutputBuffer(i,null,n),[n.buffer,n.streams]}componentCIDs(i){return Object.keys(i[Oo]||{}).map(e=>parseInt(e))}isComponentOnlyDiff(i){return i[Oo]?Object.keys(i).length===1:!1}getComponent(i,e){return i[Oo][e]}mergeDiff(i){let e=i[Oo],t={};if(delete i[Oo],this.rendered=this.mutableMerge(this.rendered,i),this.rendered[Oo]=this.rendered[Oo]||{},e){let n=this.rendered[Oo];for(let r in e)e[r]=this.cachedFindComponent(r,e[r],n,e,t);for(let r in e)n[r]=e[r];i[Oo]=e}}cachedFindComponent(i,e,t,n,r){if(r[i])return r[i];{let o,s,a=e[Ta];if(Al(a)){let l;a>0?l=this.cachedFindComponent(a,n[a],t,n,r):l=t[-a],s=l[Ta],o=this.cloneMerge(l,e),o[Ta]=s}else o=e[Ta]!==void 0?e:this.cloneMerge(t[i]||{},e);return r[i]=o,o}}mutableMerge(i,e){return e[Ta]!==void 0?e:(this.doMutableMerge(i,e),i)}doMutableMerge(i,e){for(let t in e){let n=e[t],r=i[t];_g(n)&&n[Ta]===void 0&&_g(r)?this.doMutableMerge(r,n):i[t]=n}}cloneMerge(i,e){let t=ue(ue({},i),e);for(let n in t){let r=e[n],o=i[n];_g(r)&&r[Ta]===void 0&&_g(o)&&(t[n]=this.cloneMerge(o,r))}return t}componentToString(i){let[e,t]=this.recursiveCIDToString(this.rendered[Oo],i,null,!1);return[e,t]}pruneCIDs(i){i.forEach(e=>delete this.rendered[Oo][e])}get(){return this.rendered}isNewFingerprint(i={}){return!!i[Ta]}templateStatic(i,e){return typeof i=="number"?e[i]:i}toOutputBuffer(i,e,t){if(i[gy])return this.comprehensionToBuffer(i,e,t);let{[Ta]:n}=i;n=this.templateStatic(n,e),t.buffer+=n[0];for(let r=1;r0||l.length>0||c)&&(delete i[zz],i[gy]=[],t.streams.add(o))}dynamicToBuffer(i,e,t){if(typeof i=="number"){let[n,r]=this.recursiveCIDToString(t.components,i,t.onlyCids);t.buffer+=n,t.streams=new Set([...t.streams,...r])}else _g(i)?this.toOutputBuffer(i,e,t):t.buffer+=i}recursiveCIDToString(i,e,t,n=!0){let r=i[e]||Rr(`no component for CID ${e}`,i),o=document.createElement("template"),[s,a]=this.recursiveToString(r,i,t);o.innerHTML=s;let l=o.content,c=t&&!t.has(e),[d,u]=Array.from(l.childNodes).reduce(([h,f],m,g)=>m.nodeType===Node.ELEMENT_NODE?m.getAttribute(Fo)?[h,!0]:(m.setAttribute(Fo,e),m.id||(m.id=`${this.parentViewId()}-${e}-${g}`),c&&(m.setAttribute(Yk,""),m.innerHTML=""),[!0,f]):m.nodeType===Node.COMMENT_NODE?(n||m.remove(),[h,f]):m.nodeValue.trim()!==""?(Rr(`only HTML element tags are allowed at the root of components. got: "${m.nodeValue.trim()}"