phoenix_live_view 1.1.21 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/js/phoenix_live_view/dom_patch.js +3 -1
- package/assets/js/phoenix_live_view/index.ts +4 -0
- package/assets/js/types/index.d.ts +4 -0
- package/package.json +1 -1
- package/priv/static/phoenix_live_view.cjs.js +2 -2
- package/priv/static/phoenix_live_view.cjs.js.map +2 -2
- package/priv/static/phoenix_live_view.esm.js +2 -2
- package/priv/static/phoenix_live_view.esm.js.map +2 -2
- package/priv/static/phoenix_live_view.js +2 -2
- package/priv/static/phoenix_live_view.min.js +2 -2
|
@@ -2315,7 +2315,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
|
|
|
2315
2315
|
}
|
|
2316
2316
|
if (this.isCIDPatch()) {
|
|
2317
2317
|
const closestLock = targetContainer.closest(`[${PHX_REF_LOCK}]`);
|
|
2318
|
-
if (closestLock) {
|
|
2318
|
+
if (closestLock && !closestLock.isSameNode(targetContainer)) {
|
|
2319
2319
|
const clonedTree = dom_default.private(closestLock, PHX_REF_LOCK);
|
|
2320
2320
|
if (clonedTree) {
|
|
2321
2321
|
targetContainer = clonedTree.querySelector(
|
|
@@ -5940,7 +5940,7 @@ removing illegal node: "${(childNode.outerHTML || childNode.nodeValue).trim()}"
|
|
|
5940
5940
|
}
|
|
5941
5941
|
// public
|
|
5942
5942
|
version() {
|
|
5943
|
-
return "1.1.
|
|
5943
|
+
return "1.1.23";
|
|
5944
5944
|
}
|
|
5945
5945
|
isProfileEnabled() {
|
|
5946
5946
|
return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
|
|
@@ -5,7 +5,7 @@ var LiveView=(()=>{var ht=Object.defineProperty,Ni=Object.defineProperties,Fi=Ob
|
|
|
5
5
|
|
|
6
6
|
removing illegal node: "${(i.outerHTML||i.nodeValue).trim()}"
|
|
7
7
|
|
|
8
|
-
`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(s,e,t){let i=new Set(["id",q,se,De,Q]);if(s.tagName.toLowerCase()===e.toLowerCase())return Array.from(s.attributes).filter(n=>!i.has(n.name.toLowerCase())).forEach(n=>s.removeAttribute(n.name)),Object.keys(t).filter(n=>!i.has(n.toLowerCase())).forEach(n=>s.setAttribute(n,t[n])),s;{let n=document.createElement(e);return Object.keys(t).forEach(r=>n.setAttribute(r,t[r])),i.forEach(r=>n.setAttribute(r,s.getAttribute(r))),n.innerHTML=s.innerHTML,s.replaceWith(n),n}},getSticky(s,e,t){let i=(Ce.private(s,"sticky")||[]).find(([n])=>e===n);if(i){let[n,r,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(s,e){this.updatePrivate(s,"sticky",[],t=>t.filter(([i,n])=>i!==e))},putSticky(s,e,t){let i=t(s);this.updatePrivate(s,"sticky",[],n=>{let r=n.findIndex(([o])=>e===o);return r>=0?n[r]=[e,t,i]:n.push([e,t,i]),n})},applyStickyOperations(s){let e=Ce.private(s,"sticky");e&&e.forEach(([t,i,n])=>this.putSticky(s,t,i))},isLocked(s){return s.hasAttribute&&s.hasAttribute(C)},attributeIgnored(s,e){return e.some(t=>s.name==t||t==="*"||t.includes("*")&&s.name.match(t)!=null)}},h=Ce;var fe=class{static isActive(e,t){let i=t._phxRef===void 0,r=e.getAttribute(Ge).split(",").indexOf(x.genFileRef(t))>=0;return t.size>0&&(i||r)}static isPreflighted(e,t){return e.getAttribute(Le).split(",").indexOf(x.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,n){this.ref=x.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(Oe,this._onElUpdated),this.autoUpload=n}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,()=>{x.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(Oe,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||x.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Oe,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Ge).split(",").indexOf(this.ref)===-1&&(x.untrackFile(this.fileEl,this.file),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(e){if(this.meta.uploader){let t=e[this.meta.uploader]||w(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:yi}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||w(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var Wi=0,x=class s{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Wi++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(r=>this.genFileRef(r)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return h.findUploadInputs(e).forEach(i=>{i.getAttribute(Le)!==i.getAttribute(ti)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(n=>{let r={path:e.name},o=e.getAttribute(G);i[o]=i[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()),i[o].push(r)}),i}static clearFiles(e){e.value=null,e.removeAttribute(G),h.putPrivate(e,"files",[])}static untrackFile(e,t){h.putPrivate(e,"files",h.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let n=t.filter(r=>!this.activeFiles(e).find(o=>Object.is(o,r)));h.updatePrivate(e,"files",[],r=>r.concat(n)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),h.putPrivate(e,"files",t)}static activeFileInputs(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(h.private(e,"files")||[]).filter(t=>fe.isActive(e,t))}static inputsAwaitingPreflight(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!fe.isPreflighted(e,t)&&!fe.isPreflightInProgress(t))}static markPreflightInProgress(e){e.forEach(t=>fe.markPreflightInProgress(t.file))}constructor(e,t,i){this.autoUpload=h.isAutoUpload(e),this.view=t,this.onComplete=i,this._entries=Array.from(s.filesAwaitingPreflight(e)||[]).map(n=>new fe(e,n,t,this.autoUpload)),s.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(r=>(r.isCancelled()?(this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()):(r.zipPostFlight(e),r.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()})),r));let n=this._entries.reduce((r,o)=>{if(!o.meta)return r;let{name:a,callback:l}=o.uploader(i.uploaders);return r[a]=r[a]||{callback:l,entries:[]},r[a].entries.push(o),r},{});for(let r in n){let{callback:o,entries:a}=n[r];o(a,t,e,i)}}};var Ki={anyOf(s,e){return e.find(t=>s instanceof t)},isFocusable(s,e){return s instanceof HTMLAnchorElement&&s.rel!=="ignore"||s instanceof HTMLAreaElement&&s.href!==void 0||!s.disabled&&this.anyOf(s,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||s instanceof HTMLIFrameElement||s.tabIndex>=0&&s.getAttribute("aria-hidden")!=="true"||!e&&s.getAttribute("tabindex")!==null&&s.getAttribute("aria-hidden")!=="true"},attemptFocus(s,e){if(this.isFocusable(s,e))try{s.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(s)},focusFirstInteractive(s){let e=s.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e))return!0;e=e.nextElementSibling}},focusFirst(s){let e=s.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(s){let e=s.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},V=Ki;var wi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Ge)},preflightedRefs(){return this.el.getAttribute(Le)},mounted(){this.js().ignoreAttributes(this.el,["value"]),this.preflightedWas=this.preflightedRefs()},updated(){let s=this.preflightedRefs();this.preflightedWas!==s&&(this.preflightedWas=s,s===""&&this.__view().cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(Oe))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(G)),x.getEntryDataURL(this.inputEl,this.ref,s=>{this.url=s,this.el.src=s})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.nextElementSibling;V.attemptFocus(e)||V.focusFirst(e)}else V.focusLast(this.el)}),this.focusEnd.addEventListener("focus",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.previousElementSibling;V.attemptFocus(e)||V.focusLast(e)}else V.focusFirst(this.el)}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&V.focusFirst(this.el))}}},Pi=s=>["HTML","BODY"].indexOf(s.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(s).overflowY)>=0?s:Pi(s.parentElement),_i=s=>s?s.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,Bt=s=>s?s.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,jt=s=>s?s.getBoundingClientRect().top:0,qi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.ceil(t.left)>=0&&Math.floor(t.top)<=Bt(e)},Gi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.bottom)>=jt(e)&&Math.ceil(t.left)>=0&&Math.floor(t.bottom)<=Bt(e)},Si=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.ceil(t.left)>=0&&Math.floor(t.top)<=Bt(e)};wi.InfiniteScroll={mounted(){this.scrollContainer=Pi(this.el);let s=_i(this.scrollContainer),e=!1,t=500,i=null,n=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.js().push(this.el,a,{value:{id:l.id,_overran:!0},callback:()=>{i=null}})}),r=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})}})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})}})});this.onScroll=a=>{let l=_i(this.scrollContainer);if(i)return s=l,i();let c=this.findOverrunTarget(),d=this.el.getAttribute(this.liveSocket.binding("viewport-top")),p=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),m=this.el.lastElementChild,g=this.el.firstElementChild,u=l<s,v=l>s;u&&d&&!e&&c.top>=0?(e=!0,n(d,g)):v&&e&&c.top<=0&&(e=!1),d&&u&&qi(g,this.scrollContainer)?r(d,g):p&&v&&Gi(m,this.scrollContainer)&&o(p,m),s=l},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(s,e){let t=0,i;return(...n)=>{let r=Date.now(),o=s-(r-t);o<=0||o>s?(i&&(clearTimeout(i),i=null),t=r,e(...n)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...n)},o))}},findOverrunTarget(){let s,e=this.el.getAttribute(this.liveSocket.binding(ii));if(e){let t=document.getElementById(e);if(t)s=t.getBoundingClientRect();else throw new Error("did not find element with id "+e)}else s=this.el.getBoundingClientRect();return s}};var ki=wi;var ye=class{static onUnlock(e,t){if(!h.isLocked(e)&&!e.closest(`[${C}]`))return t();let i=e.closest(`[${C}]`),n=i.closest(`[${C}]`).getAttribute(C);i.addEventListener(`phx:undo-lock:${n}`,()=>{t()},{once:!0})}constructor(e){this.el=e,this.loadingRef=e.hasAttribute(ge)?parseInt(e.getAttribute(ge),10):null,this.lockRef=e.hasAttribute(C)?parseInt(e.getAttribute(C),10):null}maybeUndo(e,t,i){if(!this.isWithin(e)){h.updatePrivate(this.el,Ct,[],n=>(n.push(e),n));return}this.undoLocks(e,t,i),this.undoLoading(e,t),h.updatePrivate(this.el,Ct,[],n=>n.filter(r=>{let o={detail:{ref:r,event:t},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${r}`,o)),this.lockRef&&this.lockRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${r}`,o)),r>e})),this.isFullyResolvedBy(e)&&this.el.removeAttribute(N)}isWithin(e){return!(this.loadingRef!==null&&this.loadingRef>e&&this.lockRef!==null&&this.lockRef>e)}undoLocks(e,t,i){if(!this.isLockUndoneBy(e))return;let n=h.private(this.el,C);n&&(i(n),h.deletePrivate(this.el,C)),this.el.removeAttribute(C);let r={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,r))}undoLoading(e,t){if(!this.isLoadingUndoneBy(e)){this.canUndoLoading(e)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading");return}if(this.canUndoLoading(e)){this.el.removeAttribute(ge);let i=this.el.getAttribute(be),n=this.el.getAttribute(Ze);n!==null&&(this.el.readOnly=n==="true",this.el.removeAttribute(Ze)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(be));let r=this.el.getAttribute(Me);r!==null&&(this.el.textContent=r,this.el.removeAttribute(Me));let o={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,o))}dt.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(e))&&h.removeClass(this.el,i)})}isLoadingUndoneBy(e){return this.loadingRef===null?!1:this.loadingRef<=e}isLockUndoneBy(e){return this.lockRef===null?!1:this.lockRef<=e}isFullyResolvedBy(e){return(this.loadingRef===null||this.loadingRef<=e)&&(this.lockRef===null||this.lockRef<=e)}canUndoLoading(e){return this.lockRef===null||this.lockRef<=e}};var nt=class{constructor(e,t,i){let n=new Set,r=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(n.add(a.id),r.has(a.id))){let l=a.previousElementSibling&&a.previousElementSibling.id;o.push({elementId:a.id,previousElementId:l})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(a=>!n.has(a))}perform(){let e=h.byId(this.containerId);e&&(this.elementsToModify.forEach(t=>{t.previousElementId?ue(document.getElementById(t.previousElementId),i=>{ue(document.getElementById(t.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",n)})}):ue(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{ue(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))}))}};var Ti=11;function zi(s,e){var t=e.attributes,i,n,r,o,a;if(!(e.nodeType===Ti||s.nodeType===Ti)){for(var l=t.length-1;l>=0;l--)i=t[l],n=i.name,r=i.namespaceURI,o=i.value,r?(n=i.localName||n,a=s.getAttributeNS(r,n),a!==o&&(i.prefix==="xmlns"&&(n=i.name),s.setAttributeNS(r,n,o))):(a=s.getAttribute(n),a!==o&&s.setAttribute(n,o));for(var c=s.attributes,d=c.length-1;d>=0;d--)i=c[d],n=i.name,r=i.namespaceURI,r?(n=i.localName||n,e.hasAttributeNS(r,n)||s.removeAttributeNS(r,n)):e.hasAttribute(n)||s.removeAttribute(n)}}var At,Yi="http://www.w3.org/1999/xhtml",B=typeof document=="undefined"?void 0:document,Qi=!!B&&"content"in B.createElement("template"),Zi=!!B&&B.createRange&&"createContextualFragment"in B.createRange();function en(s){var e=B.createElement("template");return e.innerHTML=s,e.content.childNodes[0]}function tn(s){At||(At=B.createRange(),At.selectNode(B.body));var e=At.createContextualFragment(s);return e.childNodes[0]}function nn(s){var e=B.createElement("body");return e.innerHTML=s,e.childNodes[0]}function sn(s){return s=s.trim(),Qi?en(s):Zi?tn(s):nn(s)}function _t(s,e){var t=s.nodeName,i=e.nodeName,n,r;return t===i?!0:(n=t.charCodeAt(0),r=i.charCodeAt(0),n<=90&&r>=97?t===i.toUpperCase():r<=90&&n>=97?i===t.toUpperCase():!1)}function rn(s,e){return!e||e===Yi?B.createElement(s):B.createElementNS(e,s)}function on(s,e){for(var t=s.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function Jt(s,e,t){s[t]!==e[t]&&(s[t]=e[t],s[t]?s.setAttribute(t,""):s.removeAttribute(t))}var Ci={OPTION:function(s,e){var t=s.parentNode;if(t){var i=t.nodeName.toUpperCase();i==="OPTGROUP"&&(t=t.parentNode,i=t&&t.nodeName.toUpperCase()),i==="SELECT"&&!t.hasAttribute("multiple")&&(s.hasAttribute("selected")&&!e.selected&&(s.setAttribute("selected","selected"),s.removeAttribute("selected")),t.selectedIndex=-1)}Jt(s,e,"selected")},INPUT:function(s,e){Jt(s,e,"checked"),Jt(s,e,"disabled"),s.value!==e.value&&(s.value=e.value),e.hasAttribute("value")||s.removeAttribute("value")},TEXTAREA:function(s,e){var t=e.value;s.value!==t&&(s.value=t);var i=s.firstChild;if(i){var n=i.nodeValue;if(n==t||!t&&n==s.placeholder)return;i.nodeValue=t}},SELECT:function(s,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,n=s.firstChild,r,o;n;)if(o=n.nodeName&&n.nodeName.toUpperCase(),o==="OPTGROUP")r=n,n=r.firstChild,n||(n=r.nextSibling,r=null);else{if(o==="OPTION"){if(n.hasAttribute("selected")){t=i;break}i++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}s.selectedIndex=t}}},st=1,xi=11,Ri=3,Ii=8;function Ae(){}function an(s){if(s)return s.getAttribute&&s.getAttribute("id")||s.id}function ln(s){return function(t,i,n){if(n||(n={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"){var r=i;i=B.createElement("html"),i.innerHTML=r}else if(t.nodeName==="BODY"){var o=i;i=B.createElement("html"),i.innerHTML=o;var a=i.querySelector("body");a&&(i=a)}else i=sn(i);else i.nodeType===xi&&(i=i.firstElementChild);var l=n.getNodeKey||an,c=n.onBeforeNodeAdded||Ae,d=n.onNodeAdded||Ae,p=n.onBeforeElUpdated||Ae,m=n.onElUpdated||Ae,g=n.onBeforeNodeDiscarded||Ae,u=n.onNodeDiscarded||Ae,v=n.onBeforeElChildrenUpdated||Ae,E=n.skipFromChildren||Ae,M=n.addChild||function(y,A){return y.appendChild(A)},j=n.childrenOnly===!0,F=Object.create(null),_=[];function k(y){_.push(y)}function I(y,A){if(y.nodeType===st)for(var L=y.firstChild;L;){var P=void 0;A&&(P=l(L))?k(P):(u(L),L.firstChild&&I(L,A)),L=L.nextSibling}}function Y(y,A,L){g(y)!==!1&&(A&&A.removeChild(y),u(y),I(y,L))}function f(y){if(y.nodeType===st||y.nodeType===xi)for(var A=y.firstChild;A;){var L=l(A);L&&(F[L]=A),f(A),A=A.nextSibling}}f(t);function b(y){d(y);for(var A=y.firstChild;A;){var L=A.nextSibling,P=l(A);if(P){var T=F[P];T&&_t(A,T)?(A.parentNode.replaceChild(T,A),J(T,A)):b(A)}else b(A);A=L}}function U(y,A,L){for(;A;){var P=A.nextSibling;(L=l(A))?k(L):Y(A,y,!0),A=P}}function J(y,A,L){var P=l(A);if(P&&delete F[P],!L){var T=p(y,A);if(T===!1||(T instanceof HTMLElement&&(y=T,f(y)),s(y,A),m(y),v(y,A)===!1))return}y.nodeName!=="TEXTAREA"?D(y,A):Ci.TEXTAREA(y,A)}function D(y,A){var L=E(y,A),P=A.firstChild,T=y.firstChild,Re,oe,Ie,at,pe;e:for(;P;){for(at=P.nextSibling,Re=l(P);!L&&T;){if(Ie=T.nextSibling,P.isSameNode&&P.isSameNode(T)){P=at,T=Ie;continue e}oe=l(T);var lt=T.nodeType,me=void 0;if(lt===P.nodeType&&(lt===st?(Re?Re!==oe&&((pe=F[Re])?Ie===pe?me=!1:(y.insertBefore(pe,T),oe?k(oe):Y(T,y,!0),T=pe,oe=l(T)):me=!1):oe&&(me=!1),me=me!==!1&&_t(T,P),me&&J(T,P)):(lt===Ri||lt==Ii)&&(me=!0,T.nodeValue!==P.nodeValue&&(T.nodeValue=P.nodeValue))),me){P=at,T=Ie;continue e}oe?k(oe):Y(T,y,!0),T=Ie}if(Re&&(pe=F[Re])&&_t(pe,P))L||M(y,pe),J(pe,P);else{var Tt=c(P);Tt!==!1&&(Tt&&(P=Tt),P.actualize&&(P=P.actualize(y.ownerDocument||B)),M(y,P),b(P))}P=at,T=Ie}U(y,T,oe);var Gt=Ci[y.nodeName];Gt&&Gt(y,A)}var H=t,W=H.nodeType,qt=i.nodeType;if(!j){if(W===st)qt===st?_t(t,i)||(u(t),H=on(t,rn(i.nodeName,i.namespaceURI))):H=i;else if(W===Ri||W===Ii){if(qt===W)return H.nodeValue!==i.nodeValue&&(H.nodeValue=i.nodeValue),H;H=i}}if(H===i)u(t);else{if(i.isSameNode&&i.isSameNode(H))return;if(J(H,i,j),_)for(var Pt=0,Mi=_.length;Pt<Mi;Pt++){var kt=F[_[Pt]];kt&&Y(kt,kt.parentNode,!1)}}return!j&&H!==t&&t.parentNode&&(H.actualize&&(H=H.actualize(t.ownerDocument||B)),t.parentNode.replaceChild(H,t)),H}}var hn=ln(zi),rt=hn;var _e=class{constructor(e,t,i,n,r,o,a={}){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.streams=r,this.streamInserts={},this.streamComponentRestore={},this.targetCID=o,this.cidPatch=Z(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(n):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=a.withChildren||a.undoRef||!1,this.undoRef=a.undoRef}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(Fe);h.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(xt,"")})}perform(e){let{view:t,liveSocket:i,html:n,container:r}=this,o=this.targetContainer;if(this.isCIDPatch()&&!this.targetContainer)return;if(this.isCIDPatch()){let _=o.closest(`[${C}]`);if(_){let k=h.private(_,C);k&&(o=k.querySelector(`[data-phx-component="${this.targetCID}"]`))}}let a=i.getActiveElement(),{selectionStart:l,selectionEnd:c}=a&&h.hasSelectionRange(a)?a:{},d=i.binding(Fe),p=i.binding(ze),m=i.binding(Ye),g=i.binding(ni),u=[],v=[],E=[],M=[],j=null,F=(_,k,I=this.withChildren)=>{let Y={childrenOnly:_.getAttribute(K)===null&&!I,getNodeKey:f=>h.isPhxDestroyed(f)?null:e?f.id:f.id||f.getAttribute&&f.getAttribute(gt),skipFromChildren:f=>f.getAttribute(d)===Ue,addChild:(f,b)=>{let{ref:U,streamAt:J}=this.getStreamInsert(b);if(U===void 0)return f.appendChild(b);if(this.setStreamRef(b,U),J===0)f.insertAdjacentElement("afterbegin",b);else if(J===-1){let D=f.lastElementChild;if(D&&!D.hasAttribute(Xe)){let H=Array.from(f.children).find(W=>!W.hasAttribute(Xe));f.insertBefore(b,H)}else f.appendChild(b)}else if(J>0){let D=Array.from(f.children)[J];f.insertBefore(b,D)}},onBeforeNodeAdded:f=>{var U;if((U=this.getStreamInsert(f))!=null&&U.updateOnly&&!this.streamComponentRestore[f.id])return!1;h.maintainPrivateHooks(f,f,p,m),this.trackBefore("added",f);let b=f;return this.streamComponentRestore[f.id]&&(b=this.streamComponentRestore[f.id],delete this.streamComponentRestore[f.id],F(b,f,!0)),b},onNodeAdded:f=>{f.getAttribute&&this.maybeReOrderStream(f,!0),h.isPortalTemplate(f)&&M.push(()=>this.teleport(f,F)),f instanceof HTMLImageElement&&f.srcset?f.srcset=f.srcset:f instanceof HTMLVideoElement&&f.autoplay&&f.play(),h.isNowTriggerFormExternal(f,g)&&(j=f),(h.isPhxChild(f)&&t.ownsElement(f)||h.isPhxSticky(f)&&t.ownsElement(f.parentNode))&&this.trackAfter("phxChildAdded",f),f.nodeName==="SCRIPT"&&f.hasAttribute(Ve)&&this.handleRuntimeHook(f,k),u.push(f)},onNodeDiscarded:f=>this.onNodeDiscarded(f),onBeforeNodeDiscarded:f=>{if(f.getAttribute&&f.getAttribute(xt)!==null)return!0;if(f.parentElement!==null&&f.id&&h.isPhxUpdate(f.parentElement,d,[Ue,"append","prepend"])||f.getAttribute&&f.getAttribute(re)||this.maybePendingRemove(f)||this.skipCIDSibling(f))return!1;if(h.isPortalTemplate(f)){let b=document.getElementById(f.content.firstElementChild.id);b&&(b.remove(),Y.onNodeDiscarded(b),this.view.dropPortalElementId(b.id))}return!0},onElUpdated:f=>{h.isNowTriggerFormExternal(f,g)&&(j=f),v.push(f),this.maybeReOrderStream(f,!1)},onBeforeElUpdated:(f,b)=>{if(f.id&&f.isSameNode(_)&&f.id!==b.id)return Y.onNodeDiscarded(f),f.replaceWith(b),Y.onNodeAdded(b);if(h.syncPendingAttrs(f,b),h.maintainPrivateHooks(f,b,p,m),h.cleanChildNodes(b,d),this.skipCIDSibling(b))return this.maybeReOrderStream(f),!1;if(h.isPhxSticky(f))return[q,se,Q].map(D=>[D,f.getAttribute(D),b.getAttribute(D)]).forEach(([D,H,W])=>{W&&H!==W&&f.setAttribute(D,W)}),!1;if(h.isIgnored(f,d)||f.form&&f.form.isSameNode(j))return this.trackBefore("updated",f,b),h.mergeAttrs(f,b,{isIgnored:h.isIgnored(f,d)}),v.push(f),h.applyStickyOperations(f),!1;if(f.type==="number"&&f.validity&&f.validity.badInput)return!1;let U=a&&f.isSameNode(a)&&h.isFormInput(f),J=U&&this.isChangedSelect(f,b);if(f.hasAttribute(N)){let D=new ye(f);if(D.lockRef&&(!this.undoRef||!D.isLockUndoneBy(this.undoRef))){h.applyStickyOperations(f);let W=f.hasAttribute(C)?h.private(f,C)||f.cloneNode(!0):null;W&&(h.putPrivate(f,C,W),U||(f=W))}}if(h.isPhxChild(b)){let D=f.getAttribute(q);return h.mergeAttrs(f,b,{exclude:[se]}),D!==""&&f.setAttribute(q,D),f.setAttribute(Q,this.rootID),h.applyStickyOperations(f),!1}return this.undoRef&&h.private(b,C)&&h.putPrivate(f,C,h.private(b,C)),h.copyPrivates(b,f),h.isPortalTemplate(b)?(M.push(()=>this.teleport(b,F)),f.innerHTML=b.innerHTML,!1):U&&f.type!=="hidden"&&!J?(this.trackBefore("updated",f,b),h.mergeFocusedInput(f,b),h.syncAttrsToProps(f),v.push(f),h.applyStickyOperations(f),!1):(J&&f.blur(),h.isPhxUpdate(b,d,["append","prepend"])&&E.push(new nt(f,b,b.getAttribute(d))),h.syncAttrsToProps(b),h.applyStickyOperations(b),this.trackBefore("updated",f,b),f)}};rt(_,k,Y)};if(this.trackBefore("added",r),this.trackBefore("updated",r,r),i.time("morphdom",()=>{this.streams.forEach(([k,I,Y,f])=>{I.forEach(([b,U,J,D])=>{this.streamInserts[b]={ref:k,streamAt:U,limit:J,reset:f,updateOnly:D}}),f!==void 0&&h.all(document,`[${Xe}="${k}"]`,b=>{this.removeStreamChildElement(b)}),Y.forEach(b=>{let U=document.getElementById(b);U&&this.removeStreamChildElement(U)})}),e&&h.all(this.container,`[${d}=${Ue}]`).filter(k=>this.view.ownsElement(k)).forEach(k=>{Array.from(k.children).forEach(I=>{this.removeStreamChildElement(I,!0)})}),F(o,n);let _=0;for(;M.length>0&&_<5;){let k=M.slice();M=[],k.forEach(I=>I()),_++}this.view.portalElementIds.forEach(k=>{let I=document.getElementById(k);I&&(document.getElementById(I.getAttribute(Ee))||(I.remove(),this.onNodeDiscarded(I),this.view.dropPortalElementId(k)))})}),i.isDebugEnabled()&&(gi(),vi(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(_=>{_ instanceof HTMLInputElement&&_.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM.
|
|
8
|
+
`),t.push(i))}),t.forEach(i=>i.remove())}},replaceRootContainer(s,e,t){let i=new Set(["id",q,se,De,Q]);if(s.tagName.toLowerCase()===e.toLowerCase())return Array.from(s.attributes).filter(n=>!i.has(n.name.toLowerCase())).forEach(n=>s.removeAttribute(n.name)),Object.keys(t).filter(n=>!i.has(n.toLowerCase())).forEach(n=>s.setAttribute(n,t[n])),s;{let n=document.createElement(e);return Object.keys(t).forEach(r=>n.setAttribute(r,t[r])),i.forEach(r=>n.setAttribute(r,s.getAttribute(r))),n.innerHTML=s.innerHTML,s.replaceWith(n),n}},getSticky(s,e,t){let i=(Ce.private(s,"sticky")||[]).find(([n])=>e===n);if(i){let[n,r,o]=i;return o}else return typeof t=="function"?t():t},deleteSticky(s,e){this.updatePrivate(s,"sticky",[],t=>t.filter(([i,n])=>i!==e))},putSticky(s,e,t){let i=t(s);this.updatePrivate(s,"sticky",[],n=>{let r=n.findIndex(([o])=>e===o);return r>=0?n[r]=[e,t,i]:n.push([e,t,i]),n})},applyStickyOperations(s){let e=Ce.private(s,"sticky");e&&e.forEach(([t,i,n])=>this.putSticky(s,t,i))},isLocked(s){return s.hasAttribute&&s.hasAttribute(C)},attributeIgnored(s,e){return e.some(t=>s.name==t||t==="*"||t.includes("*")&&s.name.match(t)!=null)}},h=Ce;var fe=class{static isActive(e,t){let i=t._phxRef===void 0,r=e.getAttribute(Ge).split(",").indexOf(x.genFileRef(t))>=0;return t.size>0&&(i||r)}static isPreflighted(e,t){return e.getAttribute(Le).split(",").indexOf(x.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,n){this.ref=x.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(Oe,this._onElUpdated),this.autoUpload=n}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,()=>{x.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}isCancelled(){return this._isCancelled}cancel(){this.file._preflightInProgress=!1,this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(Oe,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||x.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Oe,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(Ge).split(",").indexOf(this.ref)===-1&&(x.untrackFile(this.fileEl,this.file),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(e){if(this.meta.uploader){let t=e[this.meta.uploader]||w(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:yi}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||w(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var Wi=0,x=class s{static genFileRef(e){let t=e._phxRef;return t!==void 0?t:(e._phxRef=(Wi++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(r=>this.genFileRef(r)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return h.findUploadInputs(e).forEach(i=>{i.getAttribute(Le)!==i.getAttribute(ti)&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(n=>{let r={path:e.name},o=e.getAttribute(G);i[o]=i[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()),i[o].push(r)}),i}static clearFiles(e){e.value=null,e.removeAttribute(G),h.putPrivate(e,"files",[])}static untrackFile(e,t){h.putPrivate(e,"files",h.private(e,"files").filter(i=>!Object.is(i,t)))}static trackFiles(e,t,i){if(e.getAttribute("multiple")!==null){let n=t.filter(r=>!this.activeFiles(e).find(o=>Object.is(o,r)));h.updatePrivate(e,"files",[],r=>r.concat(n)),e.value=null}else i&&i.files.length>0&&(e.files=i.files),h.putPrivate(e,"files",t)}static activeFileInputs(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>i.files&&this.activeFiles(i).length>0)}static activeFiles(e){return(h.private(e,"files")||[]).filter(t=>fe.isActive(e,t))}static inputsAwaitingPreflight(e){let t=h.findUploadInputs(e);return Array.from(t).filter(i=>this.filesAwaitingPreflight(i).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!fe.isPreflighted(e,t)&&!fe.isPreflightInProgress(t))}static markPreflightInProgress(e){e.forEach(t=>fe.markPreflightInProgress(t.file))}constructor(e,t,i){this.autoUpload=h.isAutoUpload(e),this.view=t,this.onComplete=i,this._entries=Array.from(s.filesAwaitingPreflight(e)||[]).map(n=>new fe(e,n,t,this.autoUpload)),s.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(r=>(r.isCancelled()?(this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()):(r.zipPostFlight(e),r.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()})),r));let n=this._entries.reduce((r,o)=>{if(!o.meta)return r;let{name:a,callback:l}=o.uploader(i.uploaders);return r[a]=r[a]||{callback:l,entries:[]},r[a].entries.push(o),r},{});for(let r in n){let{callback:o,entries:a}=n[r];o(a,t,e,i)}}};var Ki={anyOf(s,e){return e.find(t=>s instanceof t)},isFocusable(s,e){return s instanceof HTMLAnchorElement&&s.rel!=="ignore"||s instanceof HTMLAreaElement&&s.href!==void 0||!s.disabled&&this.anyOf(s,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||s instanceof HTMLIFrameElement||s.tabIndex>=0&&s.getAttribute("aria-hidden")!=="true"||!e&&s.getAttribute("tabindex")!==null&&s.getAttribute("aria-hidden")!=="true"},attemptFocus(s,e){if(this.isFocusable(s,e))try{s.focus()}catch(t){}return!!document.activeElement&&document.activeElement.isSameNode(s)},focusFirstInteractive(s){let e=s.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e))return!0;e=e.nextElementSibling}},focusFirst(s){let e=s.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(s){let e=s.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},V=Ki;var wi={LiveFileUpload:{activeRefs(){return this.el.getAttribute(Ge)},preflightedRefs(){return this.el.getAttribute(Le)},mounted(){this.js().ignoreAttributes(this.el,["value"]),this.preflightedWas=this.preflightedRefs()},updated(){let s=this.preflightedRefs();this.preflightedWas!==s&&(this.preflightedWas=s,s===""&&this.__view().cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(Oe))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(G)),x.getEntryDataURL(this.inputEl,this.ref,s=>{this.url=s,this.el.src=s})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.nextElementSibling;V.attemptFocus(e)||V.focusFirst(e)}else V.focusLast(this.el)}),this.focusEnd.addEventListener("focus",s=>{if(!s.relatedTarget||!this.el.contains(s.relatedTarget)){let e=s.target.previousElementSibling;V.attemptFocus(e)||V.focusLast(e)}else V.focusFirst(this.el)}),this.el.contains(document.activeElement)||(this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&V.focusFirst(this.el))}}},Pi=s=>["HTML","BODY"].indexOf(s.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(s).overflowY)>=0?s:Pi(s.parentElement),_i=s=>s?s.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,Bt=s=>s?s.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,jt=s=>s?s.getBoundingClientRect().top:0,qi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.ceil(t.left)>=0&&Math.floor(t.top)<=Bt(e)},Gi=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.bottom)>=jt(e)&&Math.ceil(t.left)>=0&&Math.floor(t.bottom)<=Bt(e)},Si=(s,e)=>{let t=s.getBoundingClientRect();return Math.ceil(t.top)>=jt(e)&&Math.ceil(t.left)>=0&&Math.floor(t.top)<=Bt(e)};wi.InfiniteScroll={mounted(){this.scrollContainer=Pi(this.el);let s=_i(this.scrollContainer),e=!1,t=500,i=null,n=this.throttle(t,(a,l)=>{i=()=>!0,this.liveSocket.js().push(this.el,a,{value:{id:l.id,_overran:!0},callback:()=>{i=null}})}),r=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"start"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})}})}),o=this.throttle(t,(a,l)=>{i=()=>l.scrollIntoView({block:"end"}),this.liveSocket.js().push(this.el,a,{value:{id:l.id},callback:()=>{i=null,window.requestAnimationFrame(()=>{Si(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})}})});this.onScroll=a=>{let l=_i(this.scrollContainer);if(i)return s=l,i();let c=this.findOverrunTarget(),d=this.el.getAttribute(this.liveSocket.binding("viewport-top")),p=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),m=this.el.lastElementChild,g=this.el.firstElementChild,u=l<s,v=l>s;u&&d&&!e&&c.top>=0?(e=!0,n(d,g)):v&&e&&c.top<=0&&(e=!1),d&&u&&qi(g,this.scrollContainer)?r(d,g):p&&v&&Gi(m,this.scrollContainer)&&o(p,m),s=l},this.scrollContainer?this.scrollContainer.addEventListener("scroll",this.onScroll):window.addEventListener("scroll",this.onScroll)},destroyed(){this.scrollContainer?this.scrollContainer.removeEventListener("scroll",this.onScroll):window.removeEventListener("scroll",this.onScroll)},throttle(s,e){let t=0,i;return(...n)=>{let r=Date.now(),o=s-(r-t);o<=0||o>s?(i&&(clearTimeout(i),i=null),t=r,e(...n)):i||(i=setTimeout(()=>{t=Date.now(),i=null,e(...n)},o))}},findOverrunTarget(){let s,e=this.el.getAttribute(this.liveSocket.binding(ii));if(e){let t=document.getElementById(e);if(t)s=t.getBoundingClientRect();else throw new Error("did not find element with id "+e)}else s=this.el.getBoundingClientRect();return s}};var ki=wi;var ye=class{static onUnlock(e,t){if(!h.isLocked(e)&&!e.closest(`[${C}]`))return t();let i=e.closest(`[${C}]`),n=i.closest(`[${C}]`).getAttribute(C);i.addEventListener(`phx:undo-lock:${n}`,()=>{t()},{once:!0})}constructor(e){this.el=e,this.loadingRef=e.hasAttribute(ge)?parseInt(e.getAttribute(ge),10):null,this.lockRef=e.hasAttribute(C)?parseInt(e.getAttribute(C),10):null}maybeUndo(e,t,i){if(!this.isWithin(e)){h.updatePrivate(this.el,Ct,[],n=>(n.push(e),n));return}this.undoLocks(e,t,i),this.undoLoading(e,t),h.updatePrivate(this.el,Ct,[],n=>n.filter(r=>{let o={detail:{ref:r,event:t},bubbles:!0,cancelable:!1};return this.loadingRef&&this.loadingRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${r}`,o)),this.lockRef&&this.lockRef>r&&this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${r}`,o)),r>e})),this.isFullyResolvedBy(e)&&this.el.removeAttribute(N)}isWithin(e){return!(this.loadingRef!==null&&this.loadingRef>e&&this.lockRef!==null&&this.lockRef>e)}undoLocks(e,t,i){if(!this.isLockUndoneBy(e))return;let n=h.private(this.el,C);n&&(i(n),h.deletePrivate(this.el,C)),this.el.removeAttribute(C);let r={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-lock:${this.lockRef}`,r))}undoLoading(e,t){if(!this.isLoadingUndoneBy(e)){this.canUndoLoading(e)&&this.el.classList.contains("phx-submit-loading")&&this.el.classList.remove("phx-change-loading");return}if(this.canUndoLoading(e)){this.el.removeAttribute(ge);let i=this.el.getAttribute(be),n=this.el.getAttribute(Ze);n!==null&&(this.el.readOnly=n==="true",this.el.removeAttribute(Ze)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(be));let r=this.el.getAttribute(Me);r!==null&&(this.el.textContent=r,this.el.removeAttribute(Me));let o={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,o))}dt.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(e))&&h.removeClass(this.el,i)})}isLoadingUndoneBy(e){return this.loadingRef===null?!1:this.loadingRef<=e}isLockUndoneBy(e){return this.lockRef===null?!1:this.lockRef<=e}isFullyResolvedBy(e){return(this.loadingRef===null||this.loadingRef<=e)&&(this.lockRef===null||this.lockRef<=e)}canUndoLoading(e){return this.lockRef===null||this.lockRef<=e}};var nt=class{constructor(e,t,i){let n=new Set,r=new Set([...t.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(n.add(a.id),r.has(a.id))){let l=a.previousElementSibling&&a.previousElementSibling.id;o.push({elementId:a.id,previousElementId:l})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(a=>!n.has(a))}perform(){let e=h.byId(this.containerId);e&&(this.elementsToModify.forEach(t=>{t.previousElementId?ue(document.getElementById(t.previousElementId),i=>{ue(document.getElementById(t.elementId),n=>{n.previousElementSibling&&n.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",n)})}):ue(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(t=>{ue(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))}))}};var Ti=11;function zi(s,e){var t=e.attributes,i,n,r,o,a;if(!(e.nodeType===Ti||s.nodeType===Ti)){for(var l=t.length-1;l>=0;l--)i=t[l],n=i.name,r=i.namespaceURI,o=i.value,r?(n=i.localName||n,a=s.getAttributeNS(r,n),a!==o&&(i.prefix==="xmlns"&&(n=i.name),s.setAttributeNS(r,n,o))):(a=s.getAttribute(n),a!==o&&s.setAttribute(n,o));for(var c=s.attributes,d=c.length-1;d>=0;d--)i=c[d],n=i.name,r=i.namespaceURI,r?(n=i.localName||n,e.hasAttributeNS(r,n)||s.removeAttributeNS(r,n)):e.hasAttribute(n)||s.removeAttribute(n)}}var At,Yi="http://www.w3.org/1999/xhtml",B=typeof document=="undefined"?void 0:document,Qi=!!B&&"content"in B.createElement("template"),Zi=!!B&&B.createRange&&"createContextualFragment"in B.createRange();function en(s){var e=B.createElement("template");return e.innerHTML=s,e.content.childNodes[0]}function tn(s){At||(At=B.createRange(),At.selectNode(B.body));var e=At.createContextualFragment(s);return e.childNodes[0]}function nn(s){var e=B.createElement("body");return e.innerHTML=s,e.childNodes[0]}function sn(s){return s=s.trim(),Qi?en(s):Zi?tn(s):nn(s)}function _t(s,e){var t=s.nodeName,i=e.nodeName,n,r;return t===i?!0:(n=t.charCodeAt(0),r=i.charCodeAt(0),n<=90&&r>=97?t===i.toUpperCase():r<=90&&n>=97?i===t.toUpperCase():!1)}function rn(s,e){return!e||e===Yi?B.createElement(s):B.createElementNS(e,s)}function on(s,e){for(var t=s.firstChild;t;){var i=t.nextSibling;e.appendChild(t),t=i}return e}function Jt(s,e,t){s[t]!==e[t]&&(s[t]=e[t],s[t]?s.setAttribute(t,""):s.removeAttribute(t))}var Ci={OPTION:function(s,e){var t=s.parentNode;if(t){var i=t.nodeName.toUpperCase();i==="OPTGROUP"&&(t=t.parentNode,i=t&&t.nodeName.toUpperCase()),i==="SELECT"&&!t.hasAttribute("multiple")&&(s.hasAttribute("selected")&&!e.selected&&(s.setAttribute("selected","selected"),s.removeAttribute("selected")),t.selectedIndex=-1)}Jt(s,e,"selected")},INPUT:function(s,e){Jt(s,e,"checked"),Jt(s,e,"disabled"),s.value!==e.value&&(s.value=e.value),e.hasAttribute("value")||s.removeAttribute("value")},TEXTAREA:function(s,e){var t=e.value;s.value!==t&&(s.value=t);var i=s.firstChild;if(i){var n=i.nodeValue;if(n==t||!t&&n==s.placeholder)return;i.nodeValue=t}},SELECT:function(s,e){if(!e.hasAttribute("multiple")){for(var t=-1,i=0,n=s.firstChild,r,o;n;)if(o=n.nodeName&&n.nodeName.toUpperCase(),o==="OPTGROUP")r=n,n=r.firstChild,n||(n=r.nextSibling,r=null);else{if(o==="OPTION"){if(n.hasAttribute("selected")){t=i;break}i++}n=n.nextSibling,!n&&r&&(n=r.nextSibling,r=null)}s.selectedIndex=t}}},st=1,xi=11,Ri=3,Ii=8;function Ae(){}function an(s){if(s)return s.getAttribute&&s.getAttribute("id")||s.id}function ln(s){return function(t,i,n){if(n||(n={}),typeof i=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"){var r=i;i=B.createElement("html"),i.innerHTML=r}else if(t.nodeName==="BODY"){var o=i;i=B.createElement("html"),i.innerHTML=o;var a=i.querySelector("body");a&&(i=a)}else i=sn(i);else i.nodeType===xi&&(i=i.firstElementChild);var l=n.getNodeKey||an,c=n.onBeforeNodeAdded||Ae,d=n.onNodeAdded||Ae,p=n.onBeforeElUpdated||Ae,m=n.onElUpdated||Ae,g=n.onBeforeNodeDiscarded||Ae,u=n.onNodeDiscarded||Ae,v=n.onBeforeElChildrenUpdated||Ae,E=n.skipFromChildren||Ae,M=n.addChild||function(y,A){return y.appendChild(A)},j=n.childrenOnly===!0,F=Object.create(null),_=[];function k(y){_.push(y)}function I(y,A){if(y.nodeType===st)for(var L=y.firstChild;L;){var P=void 0;A&&(P=l(L))?k(P):(u(L),L.firstChild&&I(L,A)),L=L.nextSibling}}function Y(y,A,L){g(y)!==!1&&(A&&A.removeChild(y),u(y),I(y,L))}function f(y){if(y.nodeType===st||y.nodeType===xi)for(var A=y.firstChild;A;){var L=l(A);L&&(F[L]=A),f(A),A=A.nextSibling}}f(t);function b(y){d(y);for(var A=y.firstChild;A;){var L=A.nextSibling,P=l(A);if(P){var T=F[P];T&&_t(A,T)?(A.parentNode.replaceChild(T,A),J(T,A)):b(A)}else b(A);A=L}}function U(y,A,L){for(;A;){var P=A.nextSibling;(L=l(A))?k(L):Y(A,y,!0),A=P}}function J(y,A,L){var P=l(A);if(P&&delete F[P],!L){var T=p(y,A);if(T===!1||(T instanceof HTMLElement&&(y=T,f(y)),s(y,A),m(y),v(y,A)===!1))return}y.nodeName!=="TEXTAREA"?D(y,A):Ci.TEXTAREA(y,A)}function D(y,A){var L=E(y,A),P=A.firstChild,T=y.firstChild,Re,oe,Ie,at,pe;e:for(;P;){for(at=P.nextSibling,Re=l(P);!L&&T;){if(Ie=T.nextSibling,P.isSameNode&&P.isSameNode(T)){P=at,T=Ie;continue e}oe=l(T);var lt=T.nodeType,me=void 0;if(lt===P.nodeType&&(lt===st?(Re?Re!==oe&&((pe=F[Re])?Ie===pe?me=!1:(y.insertBefore(pe,T),oe?k(oe):Y(T,y,!0),T=pe,oe=l(T)):me=!1):oe&&(me=!1),me=me!==!1&&_t(T,P),me&&J(T,P)):(lt===Ri||lt==Ii)&&(me=!0,T.nodeValue!==P.nodeValue&&(T.nodeValue=P.nodeValue))),me){P=at,T=Ie;continue e}oe?k(oe):Y(T,y,!0),T=Ie}if(Re&&(pe=F[Re])&&_t(pe,P))L||M(y,pe),J(pe,P);else{var Tt=c(P);Tt!==!1&&(Tt&&(P=Tt),P.actualize&&(P=P.actualize(y.ownerDocument||B)),M(y,P),b(P))}P=at,T=Ie}U(y,T,oe);var Gt=Ci[y.nodeName];Gt&&Gt(y,A)}var H=t,W=H.nodeType,qt=i.nodeType;if(!j){if(W===st)qt===st?_t(t,i)||(u(t),H=on(t,rn(i.nodeName,i.namespaceURI))):H=i;else if(W===Ri||W===Ii){if(qt===W)return H.nodeValue!==i.nodeValue&&(H.nodeValue=i.nodeValue),H;H=i}}if(H===i)u(t);else{if(i.isSameNode&&i.isSameNode(H))return;if(J(H,i,j),_)for(var Pt=0,Mi=_.length;Pt<Mi;Pt++){var kt=F[_[Pt]];kt&&Y(kt,kt.parentNode,!1)}}return!j&&H!==t&&t.parentNode&&(H.actualize&&(H=H.actualize(t.ownerDocument||B)),t.parentNode.replaceChild(H,t)),H}}var hn=ln(zi),rt=hn;var _e=class{constructor(e,t,i,n,r,o,a={}){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.streams=r,this.streamInserts={},this.streamComponentRestore={},this.targetCID=o,this.cidPatch=Z(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(n):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]},this.withChildren=a.withChildren||a.undoRef||!1,this.undoRef=a.undoRef}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(Fe);h.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(xt,"")})}perform(e){let{view:t,liveSocket:i,html:n,container:r}=this,o=this.targetContainer;if(this.isCIDPatch()&&!this.targetContainer)return;if(this.isCIDPatch()){let _=o.closest(`[${C}]`);if(_&&!_.isSameNode(o)){let k=h.private(_,C);k&&(o=k.querySelector(`[data-phx-component="${this.targetCID}"]`))}}let a=i.getActiveElement(),{selectionStart:l,selectionEnd:c}=a&&h.hasSelectionRange(a)?a:{},d=i.binding(Fe),p=i.binding(ze),m=i.binding(Ye),g=i.binding(ni),u=[],v=[],E=[],M=[],j=null,F=(_,k,I=this.withChildren)=>{let Y={childrenOnly:_.getAttribute(K)===null&&!I,getNodeKey:f=>h.isPhxDestroyed(f)?null:e?f.id:f.id||f.getAttribute&&f.getAttribute(gt),skipFromChildren:f=>f.getAttribute(d)===Ue,addChild:(f,b)=>{let{ref:U,streamAt:J}=this.getStreamInsert(b);if(U===void 0)return f.appendChild(b);if(this.setStreamRef(b,U),J===0)f.insertAdjacentElement("afterbegin",b);else if(J===-1){let D=f.lastElementChild;if(D&&!D.hasAttribute(Xe)){let H=Array.from(f.children).find(W=>!W.hasAttribute(Xe));f.insertBefore(b,H)}else f.appendChild(b)}else if(J>0){let D=Array.from(f.children)[J];f.insertBefore(b,D)}},onBeforeNodeAdded:f=>{var U;if((U=this.getStreamInsert(f))!=null&&U.updateOnly&&!this.streamComponentRestore[f.id])return!1;h.maintainPrivateHooks(f,f,p,m),this.trackBefore("added",f);let b=f;return this.streamComponentRestore[f.id]&&(b=this.streamComponentRestore[f.id],delete this.streamComponentRestore[f.id],F(b,f,!0)),b},onNodeAdded:f=>{f.getAttribute&&this.maybeReOrderStream(f,!0),h.isPortalTemplate(f)&&M.push(()=>this.teleport(f,F)),f instanceof HTMLImageElement&&f.srcset?f.srcset=f.srcset:f instanceof HTMLVideoElement&&f.autoplay&&f.play(),h.isNowTriggerFormExternal(f,g)&&(j=f),(h.isPhxChild(f)&&t.ownsElement(f)||h.isPhxSticky(f)&&t.ownsElement(f.parentNode))&&this.trackAfter("phxChildAdded",f),f.nodeName==="SCRIPT"&&f.hasAttribute(Ve)&&this.handleRuntimeHook(f,k),u.push(f)},onNodeDiscarded:f=>this.onNodeDiscarded(f),onBeforeNodeDiscarded:f=>{if(f.getAttribute&&f.getAttribute(xt)!==null)return!0;if(f.parentElement!==null&&f.id&&h.isPhxUpdate(f.parentElement,d,[Ue,"append","prepend"])||f.getAttribute&&f.getAttribute(re)||this.maybePendingRemove(f)||this.skipCIDSibling(f))return!1;if(h.isPortalTemplate(f)){let b=document.getElementById(f.content.firstElementChild.id);b&&(b.remove(),Y.onNodeDiscarded(b),this.view.dropPortalElementId(b.id))}return!0},onElUpdated:f=>{h.isNowTriggerFormExternal(f,g)&&(j=f),v.push(f),this.maybeReOrderStream(f,!1)},onBeforeElUpdated:(f,b)=>{if(f.id&&f.isSameNode(_)&&f.id!==b.id)return Y.onNodeDiscarded(f),f.replaceWith(b),Y.onNodeAdded(b);if(h.syncPendingAttrs(f,b),h.maintainPrivateHooks(f,b,p,m),h.cleanChildNodes(b,d),this.skipCIDSibling(b))return this.maybeReOrderStream(f),!1;if(h.isPhxSticky(f))return[q,se,Q].map(D=>[D,f.getAttribute(D),b.getAttribute(D)]).forEach(([D,H,W])=>{W&&H!==W&&f.setAttribute(D,W)}),!1;if(h.isIgnored(f,d)||f.form&&f.form.isSameNode(j))return this.trackBefore("updated",f,b),h.mergeAttrs(f,b,{isIgnored:h.isIgnored(f,d)}),v.push(f),h.applyStickyOperations(f),!1;if(f.type==="number"&&f.validity&&f.validity.badInput)return!1;let U=a&&f.isSameNode(a)&&h.isFormInput(f),J=U&&this.isChangedSelect(f,b);if(f.hasAttribute(N)){let D=new ye(f);if(D.lockRef&&(!this.undoRef||!D.isLockUndoneBy(this.undoRef))){h.applyStickyOperations(f);let W=f.hasAttribute(C)?h.private(f,C)||f.cloneNode(!0):null;W&&(h.putPrivate(f,C,W),U||(f=W))}}if(h.isPhxChild(b)){let D=f.getAttribute(q);return h.mergeAttrs(f,b,{exclude:[se]}),D!==""&&f.setAttribute(q,D),f.setAttribute(Q,this.rootID),h.applyStickyOperations(f),!1}return this.undoRef&&h.private(b,C)&&h.putPrivate(f,C,h.private(b,C)),h.copyPrivates(b,f),h.isPortalTemplate(b)?(M.push(()=>this.teleport(b,F)),f.innerHTML=b.innerHTML,!1):U&&f.type!=="hidden"&&!J?(this.trackBefore("updated",f,b),h.mergeFocusedInput(f,b),h.syncAttrsToProps(f),v.push(f),h.applyStickyOperations(f),!1):(J&&f.blur(),h.isPhxUpdate(b,d,["append","prepend"])&&E.push(new nt(f,b,b.getAttribute(d))),h.syncAttrsToProps(b),h.applyStickyOperations(b),this.trackBefore("updated",f,b),f)}};rt(_,k,Y)};if(this.trackBefore("added",r),this.trackBefore("updated",r,r),i.time("morphdom",()=>{this.streams.forEach(([k,I,Y,f])=>{I.forEach(([b,U,J,D])=>{this.streamInserts[b]={ref:k,streamAt:U,limit:J,reset:f,updateOnly:D}}),f!==void 0&&h.all(document,`[${Xe}="${k}"]`,b=>{this.removeStreamChildElement(b)}),Y.forEach(b=>{let U=document.getElementById(b);U&&this.removeStreamChildElement(U)})}),e&&h.all(this.container,`[${d}=${Ue}]`).filter(k=>this.view.ownsElement(k)).forEach(k=>{Array.from(k.children).forEach(I=>{this.removeStreamChildElement(I,!0)})}),F(o,n);let _=0;for(;M.length>0&&_<5;){let k=M.slice();M=[],k.forEach(I=>I()),_++}this.view.portalElementIds.forEach(k=>{let I=document.getElementById(k);I&&(document.getElementById(I.getAttribute(Ee))||(I.remove(),this.onNodeDiscarded(I),this.view.dropPortalElementId(k)))})}),i.isDebugEnabled()&&(gi(),vi(this.streamInserts),Array.from(document.querySelectorAll("input[name=id]")).forEach(_=>{_ instanceof HTMLInputElement&&_.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM.
|
|
9
9
|
`,_)})),E.length>0&&i.time("post-morph append/prepend restoration",()=>{E.forEach(_=>_.perform())}),i.silenceEvents(()=>h.restoreFocus(a,l,c)),h.dispatchEvent(document,"phx:update"),u.forEach(_=>this.trackAfter("added",_)),v.forEach(_=>this.trackAfter("updated",_)),this.transitionPendingRemoves(),j){i.unload();let _=h.private(j,"submitter");if(_&&_.name&&o.contains(_)){let k=document.createElement("input");k.type="hidden";let I=_.getAttribute("form");I&&k.setAttribute("form",I),k.name=_.name,k.value=_.value,_.parentElement.insertBefore(k,_)}Object.getPrototypeOf(j).submit.call(j)}return!0}onNodeDiscarded(e){(h.isPhxChild(e)||h.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}removeStreamChildElement(e,t=!1){!t&&!this.view.ownsElement(e)||(this.streamInserts[e.id]?(this.streamComponentRestore[e.id]=e,e.remove()):this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e)))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}setStreamRef(e,t){h.putSticky(e,Xe,i=>i.setAttribute(Xe,t))}maybeReOrderStream(e,t){let{ref:i,streamAt:n,reset:r}=this.getStreamInsert(e);if(n!==void 0&&(this.setStreamRef(e,i),!(!r&&!t)&&e.parentElement)){if(n===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(n>0){let o=Array.from(e.parentElement.children),a=o.indexOf(e);if(n>=o.length-1)e.parentElement.appendChild(e);else{let l=o[n];a>n?e.parentElement.insertBefore(e,l):e.parentElement.insertBefore(e,l.nextElementSibling)}}this.maybeLimitStream(e)}}maybeLimitStream(e){let{limit:t}=this.getStreamInsert(e),i=t!==null&&Array.from(e.parentElement.children);t&&t<0&&i.length>t*-1?i.slice(0,i.length+t).forEach(n=>this.removeStreamChildElement(n)):t&&t>=0&&i.length>t&&i.slice(t).forEach(n=>this.removeStreamChildElement(n))}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&t.transitionRemoves(e,()=>{e.forEach(i=>{let n=h.firstPhxChild(i);n&&t.destroyViewByEl(n),i.remove()}),this.trackAfter("transitionsDiscarded",e)})}isChangedSelect(e,t){return!(e instanceof HTMLSelectElement)||e.multiple?!1:e.options.length!==t.options.length?!0:(t.value=e.value,!e.isEqualNode(t))}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute(mt)}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=h.findComponentNodeList(this.view.id,this.targetCID);return i.length===0&&h.childNodeLength(e)===1?t:t&&t.parentNode}indexOf(e,t){return Array.from(e.children).indexOf(t)}teleport(e,t){let i=e.getAttribute($e),n=document.querySelector(i);if(!n)throw new Error("portal target with selector "+i+" not found");let r=e.content.firstElementChild;if(this.skipCIDSibling(r))return;if(!(r!=null&&r.id))throw new Error("phx-portal template must have a single root element with ID!");let o=document.getElementById(r.id),a;o?(n.contains(o)||n.appendChild(o),a=o):(a=document.createElement(r.tagName),n.appendChild(a)),r.setAttribute(re,this.view.id),r.setAttribute(Ee,e.id),t(a,r,!0),r.removeAttribute(re),r.removeAttribute(Ee),this.view.pushPortalElementId(r.id)}handleRuntimeHook(e,t){let i=e.getAttribute(Ve),n=e.hasAttribute("nonce")?e.getAttribute("nonce"):null;if(e.hasAttribute("nonce")){let o=document.createElement("template");o.innerHTML=t,n=o.content.querySelector(`script[${Ve}="${CSS.escape(i)}"]`).getAttribute("nonce")}let r=document.createElement("script");r.textContent=e.textContent,h.mergeAttrs(r,e,{isIgnored:!1}),n&&(r.nonce=n),e.replaceWith(r),e=r}};var cn=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),dn=new Set(["'",'"']),Li=(s,e,t)=>{let i=0,n=!1,r,o,a,l,c,d,p=s.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(p===null)throw new Error(`malformed html ${s}`);for(i=p[0].length,r=p[1],a=p[2],l=i,i;i<s.length&&s.charAt(i)!==">";i++)if(s.charAt(i)==="="){let u=s.slice(i-3,i)===" id";i++;let v=s.charAt(i);if(dn.has(v)){let E=i;for(i++,i;i<s.length&&s.charAt(i)!==v;i++);if(u){c=s.slice(E+1,i);break}}}let m=s.length-1;for(n=!1;m>=r.length+a.length;){let u=s.charAt(m);if(n)u==="-"&&s.slice(m-3,m)==="<!-"?(n=!1,m-=4):m-=1;else if(u===">"&&s.slice(m-2,m)==="--")n=!0,m-=3;else{if(u===">")break;m-=1}}o=s.slice(m+1,s.length);let g=Object.keys(e).map(u=>e[u]===!0?u:`${u}="${e[u]}"`).join(" ");if(t){let u=c?` id="${c}"`:"";cn.has(a)?d=`<${a}${u}${g===""?"":" "}${g}/>`:d=`<${a}${u}${g===""?"":" "}${g}></${a}>`}else{let u=s.slice(l,m+1);d=`<${a}${g===""?"":" "}${g}${u}`}return[d,r,o]},Ke=class{static extract(e){let{[Xt]:t,[Ut]:i,[$t]:n}=e;return delete e[Xt],delete e[Ut],delete e[$t],{diff:e,title:n,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.magicId=0,this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){let{buffer:t,streams:i}=this.recursiveToString(this.rendered,this.rendered[X],e,!0,{});return{buffer:t,streams:i}}recursiveToString(e,t=e[X],i,n,r){i=i?new Set(i):null;let o={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,o,n,r),{buffer:o.buffer,streams:o.streams}}componentCIDs(e){return Object.keys(e[X]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[X]?Object.keys(e).length===1:!1}getComponent(e,t){return e[X][t]}resetRender(e){this.rendered[X][e]&&(this.rendered[X][e].reset=!0)}mergeDiff(e){let t=e[X],i={};if(delete e[X],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[X]=this.rendered[X]||{},t){let n=this.rendered[X];for(let r in t)t[r]=this.cachedFindComponent(r,t[r],n,t,i);for(let r in t)n[r]=t[r];e[X]=t}}cachedFindComponent(e,t,i,n,r){if(r[e])return r[e];{let o,a,l=t[z];if(Z(l)){let c;l>0?c=this.cachedFindComponent(l,n[l],i,n,r):c=i[-l],a=c[z],o=this.cloneMerge(c,t,!0),o[z]=a}else o=t[z]!==void 0||i[e]===void 0?t:this.cloneMerge(i[e],t,!1);return r[e]=o,o}}mutableMerge(e,t){return t[z]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){if(t[R])this.mergeKeyed(e,t);else for(let i in t){let n=t[i],r=e[i];Te(n)&&n[z]===void 0&&Te(r)?this.doMutableMerge(r,n):e[i]=n}e[yt]&&(e.newRender=!0)}clone(e){return"structuredClone"in window?structuredClone(e):JSON.parse(JSON.stringify(e))}mergeKeyed(e,t){let i=this.clone(e);if(Object.entries(t[R]).forEach(([n,r])=>{if(n!==ie)if(Array.isArray(r)){let[o,a]=r;e[R][n]=i[R][o],this.doMutableMerge(e[R][n],a)}else if(typeof r=="number"){let o=r;e[R][n]=i[R][o]}else typeof r=="object"&&(e[R][n]||(e[R][n]={}),this.doMutableMerge(e[R][n],r))}),t[R][ie]<e[R][ie])for(let n=t[R][ie];n<e[R][ie];n++)delete e[R][n];e[R][ie]=t[R][ie],t[ke]&&(e[ke]=t[ke]),t[ce]&&(e[ce]=t[ce])}cloneMerge(e,t,i){let n;if(t[R])n=this.clone(e),this.mergeKeyed(n,t);else{n=O(O({},e),t);for(let r in n){let o=t[r],a=e[r];Te(o)&&o[z]===void 0&&Te(a)?n[r]=this.cloneMerge(a,o,i):o===void 0&&Te(a)&&(n[r]=this.cloneMerge(a,{},i))}}return i?(delete n.magicId,delete n.newRender):e[yt]&&(n.newRender=!0),n}componentToString(e){let{buffer:t,streams:i}=this.recursiveCIDToString(this.rendered[X],e,null),[n,r,o]=Li(t,{});return{buffer:n,streams:i}}pruneCIDs(e){e.forEach(t=>delete this.rendered[X][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[z]}templateStatic(e,t){return typeof e=="number"?t[e]:e}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(e,t,i,n,r={}){if(e[R])return this.comprehensionToBuffer(e,t,i,n);e[ce]&&(t=e[ce],delete e[ce]);let{[z]:o}=e;o=this.templateStatic(o,t),e[z]=o;let a=e[yt],l=i.buffer;a&&(i.buffer=""),n&&a&&!e.magicId&&(e.newRender=!0,e.magicId=this.nextMagicID()),i.buffer+=o[0];for(let c=1;c<o.length;c++)this.dynamicToBuffer(e[c-1],t,i,n),i.buffer+=o[c];if(a){let c=!1,d;n||e.magicId?(c=n&&!e.newRender,d=O({[gt]:e.magicId},r)):d=r,c&&(d[mt]=!0);let[p,m,g]=Li(i.buffer,d,c);e.newRender=!1,i.buffer=l+m+p+g}}comprehensionToBuffer(e,t,i,n){let r=t||e[ce],o=this.templateStatic(e[z],t);e[z]=o,delete e[ce];for(let a=0;a<e[R][ie];a++){i.buffer+=o[0];for(let l=1;l<o.length;l++)this.dynamicToBuffer(e[R][a][l-1],r,i,n),i.buffer+=o[l]}if(e[ke]){let a=e[ke],[l,c,d,p]=a||[null,{},[],null];a!==void 0&&(e[R][ie]>0||d.length>0||p)&&(delete e[ke],e[R]={[ie]:0},i.streams.add(a))}}dynamicToBuffer(e,t,i,n){if(typeof e=="number"){let{buffer:r,streams:o}=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=r,i.streams=new Set([...i.streams,...o])}else Te(e)?this.toOutputBuffer(e,t,i,n,{}):i.buffer+=e}recursiveCIDToString(e,t,i){let n=e[t]||w(`no component for CID ${t}`,e),r={[K]:t,[le]:this.viewId},o=i&&!i.has(t);n.newRender=!o,n.magicId=`c${t}-${this.parentViewId()}`;let a=!n.reset,{buffer:l,streams:c}=this.recursiveToString(n,e,i,a,r);return delete n.reset,{buffer:l,streams:c}}};var Oi=[],Hi=200,un={exec(s,e,t,i,n,r){let[o,a]=r||[null,{callback:r&&r.callback}];(t.charAt(0)==="["?JSON.parse(t):[[o,a]]).forEach(([c,d])=>{c===o&&(d=O(O({},a),d),d.callback=d.callback||a.callback),this.filterToEls(i.liveSocket,n,d).forEach(p=>{this[`exec_${c}`](s,e,t,i,n,p,d)})})},isVisible(s){return!!(s.offsetWidth||s.offsetHeight||s.getClientRects().length>0)},isInViewport(s){let e=s.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth;return e.right>0&&e.bottom>0&&e.left<i&&e.top<t},exec_exec(s,e,t,i,n,r,{attr:o,to:a}){let l=r.getAttribute(o);if(!l)throw new Error(`expected ${o} to contain JS command on "${a}"`);i.liveSocket.execJS(r,l,e)},exec_dispatch(s,e,t,i,n,r,{event:o,detail:a,bubbles:l,blocking:c}){if(a=a||{},a.dispatcher=n,c){let d=new Promise((p,m)=>{a.done=p});i.liveSocket.asyncTransition(d)}h.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(s,e,t,i,n,r,o){let{event:a,data:l,target:c,page_loading:d,loading:p,value:m,dispatcher:g,callback:u}=o,v={loading:p,value:m,target:c,page_loading:!!d,originalEvent:s},E=e==="change"&&g?g:n,M=c||E.getAttribute(i.binding("target"))||E,j=(F,_)=>{if(F.isConnected())if(e==="change"){let{newCid:k,_target:I}=o;I=I||(h.isFormInput(n)?n.name:void 0),I&&(v._target=I),F.pushInput(n,_,k,a||t,v,u)}else if(e==="submit"){let{submitter:k}=o;F.submitForm(n,_,a||t,k,v,u)}else F.pushEvent(e,n,_,a||t,l,v,u)};o.targetView&&o.targetCtx?j(o.targetView,o.targetCtx):i.withinTargets(M,j)},exec_navigate(s,e,t,i,n,r,{href:o,replace:a}){i.liveSocket.historyRedirect(s,o,a?"replace":"push",null,n)},exec_patch(s,e,t,i,n,r,{href:o,replace:a}){i.liveSocket.pushHistoryPatch(s,o,a?"replace":"push",n)},exec_focus(s,e,t,i,n,r){V.attemptFocus(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>V.attemptFocus(r))})},exec_focus_first(s,e,t,i,n,r){V.focusFirstInteractive(r)||V.focusFirst(r),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>V.focusFirstInteractive(r)||V.focusFirst(r))})},exec_push_focus(s,e,t,i,n,r){Oi.push(r||n)},exec_pop_focus(s,e,t,i,n,r){let o=Oi.pop();o&&(o.focus(),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>o.focus())}))},exec_add_class(s,e,t,i,n,r,{names:o,transition:a,time:l,blocking:c}){this.addOrRemoveClasses(r,o,[],a,l,i,c)},exec_remove_class(s,e,t,i,n,r,{names:o,transition:a,time:l,blocking:c}){this.addOrRemoveClasses(r,[],o,a,l,i,c)},exec_toggle_class(s,e,t,i,n,r,{names:o,transition:a,time:l,blocking:c}){this.toggleClasses(r,o,a,l,i,c)},exec_toggle_attr(s,e,t,i,n,r,{attr:[o,a,l]}){this.toggleAttr(r,o,a,l)},exec_ignore_attrs(s,e,t,i,n,r,{attrs:o}){this.ignoreAttrs(r,o)},exec_transition(s,e,t,i,n,r,{time:o,transition:a,blocking:l}){this.addOrRemoveClasses(r,[],[],a,o,i,l)},exec_toggle(s,e,t,i,n,r,{display:o,ins:a,outs:l,time:c,blocking:d}){this.toggle(e,i,r,o,a,l,c,d)},exec_show(s,e,t,i,n,r,{display:o,transition:a,time:l,blocking:c}){this.show(e,i,r,o,a,l,c)},exec_hide(s,e,t,i,n,r,{display:o,transition:a,time:l,blocking:c}){this.hide(e,i,r,o,a,l,c)},exec_set_attr(s,e,t,i,n,r,{attr:[o,a]}){this.setOrRemoveAttrs(r,[[o,a]],[])},exec_remove_attr(s,e,t,i,n,r,{attr:o}){this.setOrRemoveAttrs(r,[],[o])},ignoreAttrs(s,e){h.putPrivate(s,"JS:ignore_attrs",{apply:(t,i)=>{let n=Array.from(t.attributes),r=n.map(o=>o.name);Array.from(i.attributes).filter(o=>!r.includes(o.name)).forEach(o=>{h.attributeIgnored(o,e)&&i.removeAttribute(o.name)}),n.forEach(o=>{h.attributeIgnored(o,e)&&i.setAttribute(o.name,o.value)})}})},onBeforeElUpdated(s,e){let t=h.private(s,"JS:ignore_attrs");t&&t.apply(s,e)},show(s,e,t,i,n,r,o){this.isVisible(t)||this.toggle(s,e,t,i,n,null,r,o)},hide(s,e,t,i,n,r,o){this.isVisible(t)&&this.toggle(s,e,t,i,null,n,r,o)},toggle(s,e,t,i,n,r,o,a){o=o||Hi;let[l,c,d]=n||[[],[],[]],[p,m,g]=r||[[],[],[]];if(l.length>0||p.length>0)if(this.isVisible(t)){let u=()=>{this.addOrRemoveClasses(t,m,l.concat(c).concat(d)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,p,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,g,m))})},v=()=>{this.addOrRemoveClasses(t,[],p.concat(g)),h.putSticky(t,"toggle",E=>E.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))};t.dispatchEvent(new Event("phx:hide-start")),a===!1?(u(),setTimeout(v,o)):e.transition(o,u,v)}else{if(s==="remove")return;let u=()=>{this.addOrRemoveClasses(t,c,p.concat(m).concat(g));let E=i||this.defaultDisplay(t);window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,l,[]),window.requestAnimationFrame(()=>{h.putSticky(t,"toggle",M=>M.style.display=E),this.addOrRemoveClasses(t,d,c)})})},v=()=>{this.addOrRemoveClasses(t,[],l.concat(d)),t.dispatchEvent(new Event("phx:show-end"))};t.dispatchEvent(new Event("phx:show-start")),a===!1?(u(),setTimeout(v,o)):e.transition(o,u,v)}else this.isVisible(t)?window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:hide-start")),h.putSticky(t,"toggle",u=>u.style.display="none"),t.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{t.dispatchEvent(new Event("phx:show-start"));let u=i||this.defaultDisplay(t);h.putSticky(t,"toggle",v=>v.style.display=u),t.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(s,e,t,i,n,r){window.requestAnimationFrame(()=>{let[o,a]=h.getSticky(s,"classes",[[],[]]),l=e.filter(d=>o.indexOf(d)<0&&!s.classList.contains(d)),c=e.filter(d=>a.indexOf(d)<0&&s.classList.contains(d));this.addOrRemoveClasses(s,l,c,t,i,n,r)})},toggleAttr(s,e,t,i){s.hasAttribute(e)?i!==void 0?s.getAttribute(e)===t?this.setOrRemoveAttrs(s,[[e,i]],[]):this.setOrRemoveAttrs(s,[[e,t]],[]):this.setOrRemoveAttrs(s,[],[e]):this.setOrRemoveAttrs(s,[[e,t]],[])},addOrRemoveClasses(s,e,t,i,n,r,o){n=n||Hi;let[a,l,c]=i||[[],[],[]];if(a.length>0){let d=()=>{this.addOrRemoveClasses(s,l,[].concat(a).concat(c)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(s,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(s,c,l))})},p=()=>this.addOrRemoveClasses(s,e.concat(c),t.concat(a).concat(l));o===!1?(d(),setTimeout(p,n)):r.transition(n,d,p);return}window.requestAnimationFrame(()=>{let[d,p]=h.getSticky(s,"classes",[[],[]]),m=e.filter(E=>d.indexOf(E)<0&&!s.classList.contains(E)),g=t.filter(E=>p.indexOf(E)<0&&s.classList.contains(E)),u=d.filter(E=>t.indexOf(E)<0).concat(m),v=p.filter(E=>e.indexOf(E)<0).concat(g);h.putSticky(s,"classes",E=>(E.classList.remove(...v),E.classList.add(...u),[u,v]))})},setOrRemoveAttrs(s,e,t){let[i,n]=h.getSticky(s,"attrs",[[],[]]),r=e.map(([l,c])=>l).concat(t),o=i.filter(([l,c])=>!r.includes(l)).concat(e),a=n.filter(l=>!r.includes(l)).concat(t);h.putSticky(s,"attrs",l=>(a.forEach(c=>l.removeAttribute(c)),o.forEach(([c,d])=>l.setAttribute(c,d)),[o,a]))},hasAllClasses(s,e){return e.every(t=>s.classList.contains(t))},isToggledOut(s,e){return!this.isVisible(s)||this.hasAllClasses(s,e)},filterToEls(s,e,{to:t}){let i=()=>{if(typeof t=="string")return document.querySelectorAll(t);if(t.closest){let n=e.closest(t.closest);return n?[n]:[]}else if(t.inner)return e.querySelectorAll(t.inner)};return t?s.jsQuerySelectorAll(e,t,i):[e]},defaultDisplay(s){return{tr:"table-row",td:"table-cell"}[s.tagName.toLowerCase()]||"block"},transitionClasses(s){if(!s)return null;let[e,t,i]=Array.isArray(s)?s:[s.split(" "),[],[]];return e=Array.isArray(e)?e:e.split(" "),t=Array.isArray(t)?t:t.split(" "),i=Array.isArray(i)?i:i.split(" "),[e,t,i]}},S=un;var St=(s,e)=>({exec(t,i){s.execJS(t,i,e)},show(t,i={}){let n=s.owner(t);S.show(e,n,t,i.display,S.transitionClasses(i.transition),i.time,i.blocking)},hide(t,i={}){let n=s.owner(t);S.hide(e,n,t,null,S.transitionClasses(i.transition),i.time,i.blocking)},toggle(t,i={}){let n=s.owner(t),r=S.transitionClasses(i.in),o=S.transitionClasses(i.out);S.toggle(e,n,t,i.display,r,o,i.time,i.blocking)},addClass(t,i,n={}){let r=Array.isArray(i)?i:i.split(" "),o=s.owner(t);S.addOrRemoveClasses(t,r,[],S.transitionClasses(n.transition),n.time,o,n.blocking)},removeClass(t,i,n={}){let r=Array.isArray(i)?i:i.split(" "),o=s.owner(t);S.addOrRemoveClasses(t,[],r,S.transitionClasses(n.transition),n.time,o,n.blocking)},toggleClass(t,i,n={}){let r=Array.isArray(i)?i:i.split(" "),o=s.owner(t);S.toggleClasses(t,r,S.transitionClasses(n.transition),n.time,o,n.blocking)},transition(t,i,n={}){let r=s.owner(t);S.addOrRemoveClasses(t,[],[],S.transitionClasses(i),n.time,r,n.blocking)},setAttribute(t,i,n){S.setOrRemoveAttrs(t,[[i,n]],[])},removeAttribute(t,i){S.setOrRemoveAttrs(t,[],[i])},toggleAttribute(t,i,n,r){S.toggleAttr(t,i,n,r)},push(t,i,n={}){s.withinOwners(t,r=>{let o=n.value||{};delete n.value;let a=new CustomEvent("phx:exec",{detail:{sourceElement:t}});S.exec(a,e,i,r,t,["push",O({data:o},n)])})},navigate(t,i={}){let n=new CustomEvent("phx:exec");s.historyRedirect(n,t,i.replace?"replace":"push",null,null)},patch(t,i={}){let n=new CustomEvent("phx:exec");s.pushHistoryPatch(n,t,i.replace?"replace":"push",null)},ignoreAttributes(t,i){S.ignoreAttrs(t,Array.isArray(i)?i:[i])}});var Wt="hookId",fn=1,ee=class s{get liveSocket(){return this.__liveSocket()}static makeID(){return fn++}static elementID(e){return h.private(e,Wt)}constructor(e,t,i){if(this.el=t,this.__attachView(e),this.__listeners=new Set,this.__isDisconnected=!1,h.putPrivate(this.el,Wt,s.makeID()),i){let n=new Set(["el","liveSocket","__view","__listeners","__isDisconnected","constructor","js","pushEvent","pushEventTo","handleEvent","removeHandleEvent","upload","uploadTo","__mounted","__updated","__beforeUpdate","__destroyed","__reconnected","__disconnected","__cleanup__"]);for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&(this[o]=i[o],n.has(o)&&console.warn(`Hook object for element #${t.id} overwrites core property '${o}'!`));["mounted","beforeUpdate","updated","destroyed","disconnected","reconnected"].forEach(o=>{i[o]&&typeof i[o]=="function"&&(this[o]=i[o])})}}__attachView(e){e?(this.__view=()=>e,this.__liveSocket=()=>e.liveSocket):(this.__view=()=>{throw new Error(`hook not yet attached to a live view: ${this.el.outerHTML}`)},this.__liveSocket=()=>{throw new Error(`hook not yet attached to a live view: ${this.el.outerHTML}`)})}mounted(){}beforeUpdate(){}updated(){}destroyed(){}disconnected(){}reconnected(){}__mounted(){this.mounted()}__updated(){this.updated()}__beforeUpdate(){this.beforeUpdate()}__destroyed(){this.destroyed(),h.deletePrivate(this.el,Wt)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected()}js(){return ae(O({},St(this.__view().liveSocket,"hook")),{exec:e=>{this.__view().liveSocket.execJS(this.el,e,"hook")}})}pushEvent(e,t,i){let n=this.__view().pushHookEvent(this.el,null,e,t||{});if(i===void 0)return n.then(({reply:r})=>r);n.then(({reply:r,ref:o})=>i(r,o)).catch(()=>{})}pushEventTo(e,t,i,n){if(n===void 0){let r=[];this.__view().withinTargets(e,(a,l)=>{r.push({view:a,targetCtx:l})});let o=r.map(({view:a,targetCtx:l})=>a.pushHookEvent(this.el,l,t,i||{}));return Promise.allSettled(o)}this.__view().withinTargets(e,(r,o)=>{r.pushHookEvent(this.el,o,t,i||{}).then(({reply:a,ref:l})=>n(a,l)).catch(()=>{})})}handleEvent(e,t){let i={event:e,callback:n=>t(n.detail)};return window.addEventListener(`phx:${e}`,i.callback),this.__listeners.add(i),i}removeHandleEvent(e){window.removeEventListener(`phx:${e.event}`,e.callback),this.__listeners.delete(e)}upload(e,t){return this.__view().dispatchUploads(null,e,t)}uploadTo(e,t,i){return this.__view().withinTargets(e,(n,r)=>{n.dispatchUploads(r,t,i)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}};var pn=(s,e)=>{let t=s.endsWith("[]"),i=t?s.slice(0,-2):s;return i=i.replace(/([^\[\]]+)(\]?$)/,`${e}$1$2`),t&&(i+="[]"),i},wt=(s,e,t=[])=>{let{submitter:i}=e,n;if(i&&i.name){let d=document.createElement("input");d.type="hidden";let p=i.getAttribute("form");p&&d.setAttribute("form",p),d.name=i.name,d.value=i.value,i.parentElement.insertBefore(d,i),n=d}let r=new FormData(s),o=[];r.forEach((d,p,m)=>{d instanceof File&&o.push(p)}),o.forEach(d=>r.delete(d));let a=new URLSearchParams,{inputsUnused:l,onlyHiddenInputs:c}=Array.from(s.elements).reduce((d,p)=>{let{inputsUnused:m,onlyHiddenInputs:g}=d,u=p.name;if(!u)return d;m[u]===void 0&&(m[u]=!0),g[u]===void 0&&(g[u]=!0);let v=h.private(p,we)||h.private(p,Pe),E=p.type==="hidden";return m[u]=m[u]&&!v,g[u]=g[u]&&E,d},{inputsUnused:{},onlyHiddenInputs:{}});for(let[d,p]of r.entries())if(t.length===0||t.indexOf(d)>=0){let m=l[d],g=c[d];m&&!(i&&i.name==d)&&!g&&a.append(pn(d,"_unused_"),""),typeof p=="string"&&a.append(d,p)}return i&&n&&i.parentElement.removeChild(n),a.toString()},xe=class s{static closestView(e){let t=e.closest(he);return t?h.private(t,"view"):null}constructor(e,t,i,n,r){this.isDead=!1,this.liveSocket=t,this.flash=n,this.parent=i,this.root=i?i.root:this,this.el=e;let o=h.private(this.el,"view");if(o!==void 0&&o.isDead!==!0)throw w(`The DOM element for this view has already been bound to a view.
|
|
10
10
|
|
|
11
11
|
An element can only ever be associated with a single view!
|
|
@@ -18,4 +18,4 @@ removing illegal node: "${(i.outerHTML||i.nodeValue).trim()}"
|
|
|
18
18
|
import {Socket} from "phoenix"
|
|
19
19
|
import {LiveSocket} from "phoenix_live_view"
|
|
20
20
|
let liveSocket = new LiveSocket("/live", Socket, {...})
|
|
21
|
-
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||fi,this.opts=i,this.params=Je(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(We(mi),i.defaults||{}),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=We(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||ci,this.disconnectedTimeout=i.disconnectedTimeout||ui,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||10,this.reloadJitterMin=i.reloadJitterMin||5e3,this.reloadJitterMax=i.reloadJitterMax||1e4,this.failsafeJitter=i.failsafeJitter||3e4,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.boundEventNames=new Set,this.blockPhxChangeWhileComposing=i.blockPhxChangeWhileComposing||!1,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:Je(),onPatchEnd:Je(),onNodeAdded:Je(),onBeforeElUpdated:Je()},i.dom||{}),this.transitions=new Kt,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(tt))||0,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.1.21"}isProfileEnabled(){return this.sessionStorage.getItem(bt)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(et)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(et)==="false"}enableDebug(){this.sessionStorage.setItem(et,"true")}enableProfiling(){this.sessionStorage.setItem(bt,"true")}disableDebug(){this.sessionStorage.setItem(et,"false")}disableProfiling(){this.sessionStorage.removeItem(bt)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(Et,e)}disableLatencySim(){this.sessionStorage.removeItem(Et)}getLatencySim(){let e=this.sessionStorage.getItem(Et);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.resetReloadStatus(),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.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){let n=new CustomEvent("phx:exec",{detail:{sourceElement:e}});this.owner(e,r=>S.exec(n,i,t,r,e))}js(){return St(this,"js")}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[n,r]=i();this.viewLogger(e,t,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();bi(e,t,n,r)}}requestDOMUpdate(e){this.transitions.after(e)}asyncTransition(e){this.transitions.addAsyncTransition(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,n=>{let r=this.getLatencySim();r?setTimeout(()=>i(n),r):i(n)})}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,r=Math.floor(Math.random()*(n-i+1))+i,o=$.updateLocal(this.localStorage,window.location.pathname,ct,0,a=>a+1);o>=this.maxReloads&&(r=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{e.isDestroyed()||e.isConnected()||(e.destroy(),t?t():this.log(e,"join",()=>[`encountered ${o} consecutive reloads`]),o>=this.maxReloads&&this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},r)}getHookDefinition(e){if(e)return this.maybeInternalHook(e)||this.hooks[e]||this.maybeRuntimeHook(e)}maybeInternalHook(e){return e&&e.startsWith("Phoenix.")&&ki[e.split(".")[1]]}maybeRuntimeHook(e){let t=document.querySelector(`script[${Ve}="${CSS.escape(e)}"]`);if(!t)return;let i=window[`phx_hook_${e}`];if(!i||typeof i!="function"){w("a runtime hook must be a function",t);return}let n=i();if(n&&(typeof n=="object"||typeof n=="function"))return n;w("runtime hook must return an object with hook callbacks or an instance of ViewHook",t)}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(()=>{var i;t.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let e=!1;return h.all(document,`${he}:not([${ne}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);h.isPhxSticky(t)||i.setHref(this.getHref()),i.join(),t.hasAttribute(De)&&(this.main=i)}e=!0}),e}redirect(e,t,i){i&&$.setCookie(Dt,i,60),this.unload(),$.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=h.findPhxSticky(document)||[],a=h.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(c=>!h.isChildOfAny(c,o)),l=h.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(l,t,r),this.main.setRedirect(e),this.transitionRemoves(a),this.main.join((c,d)=>{c===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{a.forEach(p=>p.remove()),o.forEach(p=>l.appendChild(p)),this.outgoingMainEl.replaceWith(l),this.outgoingMainEl=null,i&&i(n),d()})})}transitionRemoves(e,t){let i=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};e.forEach(r=>{for(let o of this.boundEventNames)r.addEventListener(o,n,!0);this.execJS(r,r.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{e.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),t&&t()})}isPhxView(e){return e.getAttribute&&e.getAttribute(q)!==null}newRootView(e,t,i){let n=new xe(e,this,null,t,i);return this.roots[n.id]=n,n}owner(e,t){let i,n=h.closestViewEl(e);if(n)i=this.getViewByEl(n);else{if(!e.isConnected)return null;i=this.main}return i&&t?t(i):i}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(Q);return ue(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(Q));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}getActiveElement(){return document.activeElement}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.blur()}bindTopLevelEvents({dead:e}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(t=>{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,n,r,o,a)=>{let l=r.getAttribute(this.binding(li)),c=t.key&&t.key.toLowerCase();if(l&&l.toLowerCase()!==c)return;let d=O({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:d}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,n,r,o,a)=>{if(!a){let l=O({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:l}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,n,r,o,a)=>{if(a==="window"){let l=this.eventMeta(i,t,r);S.exec(t,i,o,n,r,["push",{data:l}])}}),this.on("dragover",t=>t.preventDefault()),this.on("dragenter",t=>{let i=de(t.target,this.binding(qe));!i||!(i instanceof HTMLElement)||Ai(t)&&this.js().addClass(i,ut)}),this.on("dragleave",t=>{let i=de(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;let n=i.getBoundingClientRect();(t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&this.js().removeClass(i,ut)}),this.on("drop",t=>{t.preventDefault();let i=de(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;this.js().removeClass(i,ut);let n=i.getAttribute(this.binding(qe)),r=n&&document.getElementById(n),o=Array.from(t.dataTransfer.files||[]);!r||!(r instanceof HTMLInputElement)||r.disabled||o.length===0||!(r.files instanceof FileList)||(x.trackFiles(r,o,t.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(pt,t=>{let i=t.target;if(!h.isUploadInput(i))return;let n=Array.from(t.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);x.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){$.deleteCookie(Dt)}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 n=e[i];this.on(n,r=>{let o=this.binding(i),a=this.binding(`window-${i}`),l=r.target.getAttribute&&r.target.getAttribute(o);l?this.debounce(r.target,r,n,()=>{this.withinOwners(r.target,c=>{t(r,i,c,r.target,l,null)})}):h.all(document,`[${a}]`,c=>{let d=c.getAttribute(a);this.debounce(c,r,n,()=>{this.withinOwners(c,p=>{t(r,i,p,c,d,"window")})})})})}}bindClicks(){this.on("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click")}bindClick(e,t){let i=this.binding(t);window.addEventListener(e,n=>{let r=null;n.detail===0&&(this.clickStartedAtTarget=n.target);let o=this.clickStartedAtTarget||n.target;r=de(n.target,i),this.dispatchClickAway(n,o),this.clickStartedAtTarget=null;let a=r&&r.getAttribute(i);if(!a){h.isNewPageClick(n,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),!r.hasAttribute(N)&&this.debounce(r,n,"click",()=>{this.withinOwners(r,l=>{S.exec(n,"click",a,l,r,["push",{data:this.eventMeta("click",n,r)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away");h.all(document,`[${i}]`,n=>{n.isSameNode(t)||n.contains(t)||!S.isVisible(t)||this.withinOwners(n,r=>{let o=n.getAttribute(i);S.isVisible(n)&&S.isInViewport(n)&&S.exec(e,"click",o,r,n,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!$.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{$.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:n,id:r,scroll:o,position:a}=t.state||{},l=window.location.href,c=a>this.currentHistoryPosition,d=c?i:n||i;this.currentHistoryPosition=a||0,this.sessionStorage.setItem(tt,this.currentHistoryPosition.toString()),h.dispatchEvent(window,"phx:navigate",{detail:{href:l,patch:d==="patch",pop:!0,direction:c?"forward":"backward"}}),this.requestDOMUpdate(()=>{let p=()=>{this.maybeScroll(o)};this.main.isConnected()&&d==="patch"&&r===this.main.id?this.main.pushLinkPatch(t,l,null,p):this.replaceMain(l,null,p)})},!1),window.addEventListener("click",t=>{let i=de(t.target,ft),n=i&&i.getAttribute(ft);if(!n||!this.isConnected()||!this.main||h.wantsNewTab(t))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(ei);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(t,r,o,i);else if(n==="redirect")this.historyRedirect(t,r,o,null,i);else throw new Error(`expected ${ft} to be "patch" or "redirect", got: ${n}`);let a=i.getAttribute(this.binding("click"));a&&this.requestDOMUpdate(()=>this.execJS(i,a,"click"))})},!1)}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}dispatchEvent(e,t={}){h.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){h.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>h.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i,n){if(!this.isConnected()||!this.main.isMain())return $.redirect(t);this.withPageLoading({to:t,kind:"patch"},r=>{this.main.pushLinkPatch(e,t,n,o=>{this.historyPatch(t,i,o),r()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(tt,this.currentHistoryPosition.toString()),$.updateCurrentState(n=>ae(O({},n),{backType:"patch"})),$.pushState(t,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},e),h.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i,n,r){let o=r&&e.isTrusted&&e.type!=="popstate";if(o&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return $.redirect(t,n);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:l,host:c}=window.location;t=`${l}//${c}${t}`}let a=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},l=>{this.replaceMain(t,n,c=>{c===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(tt,this.currentHistoryPosition.toString()),$.updateCurrentState(d=>ae(O({},d),{backType:"redirect"})),$.pushState(i,{type:"redirect",id:this.main.id,scroll:a,position:this.currentHistoryPosition},t),h.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o&&r.classList.remove("phx-click-loading"),l()})})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=We(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!t&&r&&!n&&(t=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{h.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit"));if(!n){h.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{S.exec(i,"submit",n,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,n=>{if(n instanceof CustomEvent&&(n.target instanceof HTMLInputElement||n.target instanceof HTMLSelectElement||n.target instanceof HTMLTextAreaElement)&&n.target.form===void 0){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let r=this.binding("change"),o=n.target;if(this.blockPhxChangeWhileComposing&&n.isComposing){let u=`composition-listener-${i}`;h.private(o,u)||(h.putPrivate(o,u,!0),o.addEventListener("compositionend",()=>{o.dispatchEvent(new Event(i,{bubbles:!0})),h.deletePrivate(o,u)},{once:!0}));return}let a=o.getAttribute(r),l=o.form&&o.form.getAttribute(r),c=a||l;if(!c||o.type==="number"&&o.validity&&o.validity.badInput)return;let d=a?o:o.form,p=e;e++;let{at:m,type:g}=h.private(o,"prev-iteration")||{};m===p-1&&i==="change"&&g==="input"||(h.putPrivate(o,"prev-iteration",{at:p,type:i}),this.debounce(o,n,i,()=>{this.withinOwners(d,u=>{h.putPrivate(o,we,!0),S.exec(n,"change",c,u,o,["push",{_target:n.target.name,dispatcher:d}])})}))});this.on("reset",i=>{let n=i.target;h.resetForm(n);let r=Array.from(n.elements).find(o=>o.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,n){if(i==="blur"||i==="focusout")return n();let r=this.binding(ri),o=this.binding(oi),a=this.defaults.debounce.toString(),l=this.defaults.throttle.toString();this.withinOwners(e,c=>{let d=()=>!c.isDestroyed()&&document.body.contains(e);h.debounce(e,t,r,a,o,l,d,()=>{n()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){this.boundEventNames.add(e),window.addEventListener(e,i=>{this.silenced||t(i)})}jsQuerySelectorAll(e,t,i){let n=this.domCallbacks.jsQuerySelectorAll;return n?n(e,t,i):i()}},Kt=class{constructor(){this.transitions=new Set,this.promises=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.promises.clear(),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.flushPendingOps()},e);this.transitions.add(n)}addAsyncTransition(e){this.promises.add(e),e.then(()=>{this.promises.delete(e),this.flushPendingOps()})}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size+this.promises.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var En=ot;function yn(s,e){let t=h.getCustomElHook(s);if(t)return t;s.hasAttribute("id")||w("Elements passed to createHook need to have a unique id attribute",s);let i=new ee(xe.closestView(s),s,e);return h.putCustomElHook(s,i),i}return ji(An);})();
|
|
21
|
+
`);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||fi,this.opts=i,this.params=Je(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(We(mi),i.defaults||{}),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=We(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||ci,this.disconnectedTimeout=i.disconnectedTimeout||ui,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||10,this.reloadJitterMin=i.reloadJitterMin||5e3,this.reloadJitterMax=i.reloadJitterMax||1e4,this.failsafeJitter=i.failsafeJitter||3e4,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.boundEventNames=new Set,this.blockPhxChangeWhileComposing=i.blockPhxChangeWhileComposing||!1,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:Je(),onPatchEnd:Je(),onNodeAdded:Je(),onBeforeElUpdated:Je()},i.dom||{}),this.transitions=new Kt,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(tt))||0,window.addEventListener("pagehide",n=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.1.23"}isProfileEnabled(){return this.sessionStorage.getItem(bt)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(et)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(et)==="false"}enableDebug(){this.sessionStorage.setItem(et,"true")}enableProfiling(){this.sessionStorage.setItem(bt,"true")}disableDebug(){this.sessionStorage.setItem(et,"false")}disableProfiling(){this.sessionStorage.removeItem(bt)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(Et,e)}disableLatencySim(){this.sessionStorage.removeItem(Et)}getLatencySim(){let e=this.sessionStorage.getItem(Et);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug();let e=()=>{this.resetReloadStatus(),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.serverCloseRef&&(this.socket.off(this.serverCloseRef),this.serverCloseRef=null),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,t,i=null){let n=new CustomEvent("phx:exec",{detail:{sourceElement:e}});this.owner(e,r=>S.exec(n,i,t,r,e))}js(){return St(this,"js")}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[n,r]=i();this.viewLogger(e,t,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();bi(e,t,n,r)}}requestDOMUpdate(e){this.transitions.after(e)}asyncTransition(e){this.transitions.addAsyncTransition(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}onChannel(e,t,i){e.on(t,n=>{let r=this.getLatencySim();r?setTimeout(()=>i(n),r):i(n)})}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,n=this.reloadJitterMax,r=Math.floor(Math.random()*(n-i+1))+i,o=$.updateLocal(this.localStorage,window.location.pathname,ct,0,a=>a+1);o>=this.maxReloads&&(r=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{e.isDestroyed()||e.isConnected()||(e.destroy(),t?t():this.log(e,"join",()=>[`encountered ${o} consecutive reloads`]),o>=this.maxReloads&&this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},r)}getHookDefinition(e){if(e)return this.maybeInternalHook(e)||this.hooks[e]||this.maybeRuntimeHook(e)}maybeInternalHook(e){return e&&e.startsWith("Phoenix.")&&ki[e.split(".")[1]]}maybeRuntimeHook(e){let t=document.querySelector(`script[${Ve}="${CSS.escape(e)}"]`);if(!t)return;let i=window[`phx_hook_${e}`];if(!i||typeof i!="function"){w("a runtime hook must be a function",t);return}let n=i();if(n&&(typeof n=="object"||typeof n=="function"))return n;w("runtime hook must return an object with hook callbacks or an instance of ViewHook",t)}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(()=>{var i;t.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let e=!1;return h.all(document,`${he}:not([${ne}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);h.isPhxSticky(t)||i.setHref(this.getHref()),i.join(),t.hasAttribute(De)&&(this.main=i)}e=!0}),e}redirect(e,t,i){i&&$.setCookie(Dt,i,60),this.unload(),$.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=h.findPhxSticky(document)||[],a=h.all(this.outgoingMainEl,`[${this.binding("remove")}]`).filter(c=>!h.isChildOfAny(c,o)),l=h.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(l,t,r),this.main.setRedirect(e),this.transitionRemoves(a),this.main.join((c,d)=>{c===1&&this.commitPendingLink(n)&&this.requestDOMUpdate(()=>{a.forEach(p=>p.remove()),o.forEach(p=>l.appendChild(p)),this.outgoingMainEl.replaceWith(l),this.outgoingMainEl=null,i&&i(n),d()})})}transitionRemoves(e,t){let i=this.binding("remove"),n=r=>{r.preventDefault(),r.stopImmediatePropagation()};e.forEach(r=>{for(let o of this.boundEventNames)r.addEventListener(o,n,!0);this.execJS(r,r.getAttribute(i),"remove")}),this.requestDOMUpdate(()=>{e.forEach(r=>{for(let o of this.boundEventNames)r.removeEventListener(o,n,!0)}),t&&t()})}isPhxView(e){return e.getAttribute&&e.getAttribute(q)!==null}newRootView(e,t,i){let n=new xe(e,this,null,t,i);return this.roots[n.id]=n,n}owner(e,t){let i,n=h.closestViewEl(e);if(n)i=this.getViewByEl(n);else{if(!e.isConnected)return null;i=this.main}return i&&t?t(i):i}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(Q);return ue(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(Q));t&&t.id===e.id?(t.destroy(),delete this.roots[t.id]):t&&t.destroyDescendent(e.id)}getActiveElement(){return document.activeElement}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive instanceof HTMLElement&&this.prevActive.blur()}bindTopLevelEvents({dead:e}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.serverCloseRef=this.socket.onClose(t=>{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,n,r,o,a)=>{let l=r.getAttribute(this.binding(li)),c=t.key&&t.key.toLowerCase();if(l&&l.toLowerCase()!==c)return;let d=O({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:d}])}),this.bind({blur:"focusout",focus:"focusin"},(t,i,n,r,o,a)=>{if(!a){let l=O({key:t.key},this.eventMeta(i,t,r));S.exec(t,i,o,n,r,["push",{data:l}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,n,r,o,a)=>{if(a==="window"){let l=this.eventMeta(i,t,r);S.exec(t,i,o,n,r,["push",{data:l}])}}),this.on("dragover",t=>t.preventDefault()),this.on("dragenter",t=>{let i=de(t.target,this.binding(qe));!i||!(i instanceof HTMLElement)||Ai(t)&&this.js().addClass(i,ut)}),this.on("dragleave",t=>{let i=de(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;let n=i.getBoundingClientRect();(t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&this.js().removeClass(i,ut)}),this.on("drop",t=>{t.preventDefault();let i=de(t.target,this.binding(qe));if(!i||!(i instanceof HTMLElement))return;this.js().removeClass(i,ut);let n=i.getAttribute(this.binding(qe)),r=n&&document.getElementById(n),o=Array.from(t.dataTransfer.files||[]);!r||!(r instanceof HTMLInputElement)||r.disabled||o.length===0||!(r.files instanceof FileList)||(x.trackFiles(r,o,t.dataTransfer),r.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(pt,t=>{let i=t.target;if(!h.isUploadInput(i))return;let n=Array.from(t.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);x.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){$.deleteCookie(Dt)}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 n=e[i];this.on(n,r=>{let o=this.binding(i),a=this.binding(`window-${i}`),l=r.target.getAttribute&&r.target.getAttribute(o);l?this.debounce(r.target,r,n,()=>{this.withinOwners(r.target,c=>{t(r,i,c,r.target,l,null)})}):h.all(document,`[${a}]`,c=>{let d=c.getAttribute(a);this.debounce(c,r,n,()=>{this.withinOwners(c,p=>{t(r,i,p,c,d,"window")})})})})}}bindClicks(){this.on("mousedown",e=>this.clickStartedAtTarget=e.target),this.bindClick("click","click")}bindClick(e,t){let i=this.binding(t);window.addEventListener(e,n=>{let r=null;n.detail===0&&(this.clickStartedAtTarget=n.target);let o=this.clickStartedAtTarget||n.target;r=de(n.target,i),this.dispatchClickAway(n,o),this.clickStartedAtTarget=null;let a=r&&r.getAttribute(i);if(!a){h.isNewPageClick(n,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&n.preventDefault(),!r.hasAttribute(N)&&this.debounce(r,n,"click",()=>{this.withinOwners(r,l=>{S.exec(n,"click",a,l,r,["push",{data:this.eventMeta("click",n,r)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away");h.all(document,`[${i}]`,n=>{n.isSameNode(t)||n.contains(t)||!S.isVisible(t)||this.withinOwners(n,r=>{let o=n.getAttribute(i);S.isVisible(n)&&S.isInViewport(n)&&S.exec(e,"click",o,r,n,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!$.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{$.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:n,id:r,scroll:o,position:a}=t.state||{},l=window.location.href,c=a>this.currentHistoryPosition,d=c?i:n||i;this.currentHistoryPosition=a||0,this.sessionStorage.setItem(tt,this.currentHistoryPosition.toString()),h.dispatchEvent(window,"phx:navigate",{detail:{href:l,patch:d==="patch",pop:!0,direction:c?"forward":"backward"}}),this.requestDOMUpdate(()=>{let p=()=>{this.maybeScroll(o)};this.main.isConnected()&&d==="patch"&&r===this.main.id?this.main.pushLinkPatch(t,l,null,p):this.replaceMain(l,null,p)})},!1),window.addEventListener("click",t=>{let i=de(t.target,ft),n=i&&i.getAttribute(ft);if(!n||!this.isConnected()||!this.main||h.wantsNewTab(t))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,o=i.getAttribute(ei);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(n==="patch")this.pushHistoryPatch(t,r,o,i);else if(n==="redirect")this.historyRedirect(t,r,o,null,i);else throw new Error(`expected ${ft} to be "patch" or "redirect", got: ${n}`);let a=i.getAttribute(this.binding("click"));a&&this.requestDOMUpdate(()=>this.execJS(i,a,"click"))})},!1)}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}dispatchEvent(e,t={}){h.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){h.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>h.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i,n){if(!this.isConnected()||!this.main.isMain())return $.redirect(t);this.withPageLoading({to:t,kind:"patch"},r=>{this.main.pushLinkPatch(e,t,n,o=>{this.historyPatch(t,i,o),r()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(tt,this.currentHistoryPosition.toString()),$.updateCurrentState(n=>ae(O({},n),{backType:"patch"})),$.pushState(t,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},e),h.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i,n,r){let o=r&&e.isTrusted&&e.type!=="popstate";if(o&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return $.redirect(t,n);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:l,host:c}=window.location;t=`${l}//${c}${t}`}let a=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},l=>{this.replaceMain(t,n,c=>{c===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(tt,this.currentHistoryPosition.toString()),$.updateCurrentState(d=>ae(O({},d),{backType:"redirect"})),$.pushState(i,{type:"redirect",id:this.main.id,scroll:a,position:this.currentHistoryPosition},t),h.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o&&r.classList.remove("phx-click-loading"),l()})})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=We(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!t&&r&&!n&&(t=!0,i.preventDefault(),this.withinOwners(i.target,o=>{o.disableForm(i.target),window.requestAnimationFrame(()=>{h.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let n=i.target.getAttribute(this.binding("submit"));if(!n){h.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{S.exec(i,"submit",n,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,n=>{if(n instanceof CustomEvent&&(n.target instanceof HTMLInputElement||n.target instanceof HTMLSelectElement||n.target instanceof HTMLTextAreaElement)&&n.target.form===void 0){if(n.detail&&n.detail.dispatcher)throw new Error(`dispatching a custom ${i} event is only supported on input elements inside a form`);return}let r=this.binding("change"),o=n.target;if(this.blockPhxChangeWhileComposing&&n.isComposing){let u=`composition-listener-${i}`;h.private(o,u)||(h.putPrivate(o,u,!0),o.addEventListener("compositionend",()=>{o.dispatchEvent(new Event(i,{bubbles:!0})),h.deletePrivate(o,u)},{once:!0}));return}let a=o.getAttribute(r),l=o.form&&o.form.getAttribute(r),c=a||l;if(!c||o.type==="number"&&o.validity&&o.validity.badInput)return;let d=a?o:o.form,p=e;e++;let{at:m,type:g}=h.private(o,"prev-iteration")||{};m===p-1&&i==="change"&&g==="input"||(h.putPrivate(o,"prev-iteration",{at:p,type:i}),this.debounce(o,n,i,()=>{this.withinOwners(d,u=>{h.putPrivate(o,we,!0),S.exec(n,"change",c,u,o,["push",{_target:n.target.name,dispatcher:d}])})}))});this.on("reset",i=>{let n=i.target;h.resetForm(n);let r=Array.from(n.elements).find(o=>o.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,n){if(i==="blur"||i==="focusout")return n();let r=this.binding(ri),o=this.binding(oi),a=this.defaults.debounce.toString(),l=this.defaults.throttle.toString();this.withinOwners(e,c=>{let d=()=>!c.isDestroyed()&&document.body.contains(e);h.debounce(e,t,r,a,o,l,d,()=>{n()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){this.boundEventNames.add(e),window.addEventListener(e,i=>{this.silenced||t(i)})}jsQuerySelectorAll(e,t,i){let n=this.domCallbacks.jsQuerySelectorAll;return n?n(e,t,i):i()}},Kt=class{constructor(){this.transitions=new Set,this.promises=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.promises.clear(),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let n=setTimeout(()=>{this.transitions.delete(n),i(),this.flushPendingOps()},e);this.transitions.add(n)}addAsyncTransition(e){this.promises.add(e),e.then(()=>{this.promises.delete(e),this.flushPendingOps()})}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size+this.promises.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var En=ot;function yn(s,e){let t=h.getCustomElHook(s);if(t)return t;s.hasAttribute("id")||w("Elements passed to createHook need to have a unique id attribute",s);let i=new ee(xe.closestView(s),s,e);return h.putCustomElHook(s,i),i}return ji(An);})();
|