1(()=>{var wi=Object.create;var it=Object.defineProperty,yi=Object.defineProperties,Ai=Object.getOwnPropertyDescriptor,ki=Object.getOwnPropertyDescriptors,Si=Object.getOwnPropertyNames,He=Object.getOwnPropertySymbols,Ci=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var St=(e,t,i)=>t in e?it(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,O=(e,t)=>{for(var i in t||(t={}))st.call(t,i)&&St(e,i,t[i]);if(He)for(var i of He(t))Ct.call(t,i)&&St(e,i,t[i]);return e},Ne=(e,t)=>yi(e,ki(t));var Et=(e,t)=>{var i={};for(var s in e)st.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(e!=null&&He)for(var s of He(e))t.indexOf(s)<0&&Ct.call(e,s)&&(i[s]=e[s]);return i};var Ei=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ti=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Si(t))!st.call(e,r)&&r!==i&&it(e,r,{get:()=>t[r],enumerable:!(s=Ai(t,r))||s.enumerable});return e};var _i=(e,t,i)=>(i=e!=null?wi(Ci(e)):{},Ti(t||!e||!e.__esModule?it(i,"default",{value:e,enumerable:!0}):i,e));var gi=Ei((pi,Ye)=>{(function(e,t){"use strict";(function(){for(var g=0,c=["ms","moz","webkit","o"],v=0;v<c.length&&!e.requestAnimationFrame;++v)e.requestAnimationFrame=e[c[v]+"RequestAnimationFrame"],e.cancelAnimationFrame=e[c[v]+"CancelAnimationFrame"]||e[c[v]+"CancelRequestAnimationFrame"];e.requestAnimationFrame||(e.requestAnimationFrame=function(b,x){var S=new Date().getTime(),R=Math.max(0,16-(S-g)),H=e.setTimeout(function(){b(S+R)},R);return g=S+R,H}),e.cancelAnimationFrame||(e.cancelAnimationFrame=function(b){clearTimeout(b)})})();var i,s,r,n=null,o=null,a=null,l=function(g,c,v){g.addEventListener?g.addEventListener(c,v,!1):g.attachEvent?g.attachEvent("on"+c,v):g["on"+c]=v},h={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},p=function(){i.width=e.innerWidth,i.height=h.barThickness*5;var g=i.getContext("2d");g.shadowBlur=h.shadowBlur,g.shadowColor=h.shadowColor;var c=g.createLinearGradient(0,0,i.width,0);for(var v in h.barColors)c.addColorStop(v,h.barColors[v]);g.lineWidth=h.barThickness,g.beginPath(),g.moveTo(0,h.barThickness/2),g.lineTo(Math.ceil(s*i.width),h.barThickness/2),g.strokeStyle=c,g.stroke()},f=function(){i=t.createElement("canvas");var g=i.style;g.position="fixed",g.top=g.left=g.right=g.margin=g.padding=0,g.zIndex=100001,g.display="none",h.className&&i.classList.add(h.className),t.body.appendChild(i),l(e,"resize",p)},m={config:function(g){for(var c in g)h.hasOwnProperty(c)&&(h[c]=g[c])},show:function(g){if(!r)if(g){if(a)return;a=setTimeout(()=>m.show(),g)}else r=!0,o!==null&&e.cancelAnimationFrame(o),i||f(),i.style.opacity=1,i.style.display="block",m.progress(0),h.autoRun&&function c(){n=e.requestAnimationFrame(c),m.progress("+"+.05*Math.pow(1-Math.sqrt(s),2))}()},progress:function(g){return typeof g=="undefined"||(typeof g=="string"&&(g=(g.indexOf("+")>=0||g.indexOf("-")>=0?s:0)+parseFloat(g)),s=g>1?1:g,p()),s},hide:function(){clearTimeout(a),a=null,r&&(r=!1,n!=null&&(e.cancelAnimationFrame(n),n=null),function g(){if(m.progress("+.1")>=1&&(i.style.opacity-=.05,i.style.opacity<=.05)){i.style.display="none",o=null;return}o=e.requestAnimationFrame(g)}())}};typeof Ye=="object"&&typeof Ye.exports=="object"?Ye.exports=m:typeof define=="function"&&define.amd?define(function(){return m}):this.topbar=m}).call(pi,window,document)});(function(){var e=t();function t(){if(typeof window.CustomEvent=="function")return window.CustomEvent;function r(n,o){o=o||{bubbles:!1,cancelable:!1,detail:void 0};var a=document.createEvent("CustomEvent");return a.initCustomEvent(n,o.bubbles,o.cancelable,o.detail),a}return r.prototype=window.Event.prototype,r}function i(r,n){var o=document.createElement("input");return o.type="hidden",o.name=r,o.value=n,o}function s(r,n){var o=r.getAttribute("data-to"),a=i("_method",r.getAttribute("data-method")),l=i("_csrf_token",r.getAttribute("data-csrf")),h=document.createElement("form"),p=document.createElement("input"),f=r.getAttribute("target");h.method=r.getAttribute("data-method")==="get"?"get":"post",h.action=o,h.style.display="none",f?h.target=f:n&&(h.target="_blank"),h.appendChild(l),h.appendChild(a),document.body.appendChild(h),p.type="submit",h.appendChild(p),p.click()}window.addEventListener("click",function(r){var n=r.target;if(!r.defaultPrevented)for(;n&&n.getAttribute;){var o=new e("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!n.dispatchEvent(o))return r.preventDefault(),r.stopImmediatePropagation(),!1;if(n.getAttribute("data-method")&&n.getAttribute("data-to"))return s(n,r.metaKey||r.shiftKey),r.preventDefault(),!1;n=n.parentNode}},!1),window.addEventListener("phoenix.link.click",function(r){var n=r.target.getAttribute("data-confirm");n&&!window.confirm(n)&&r.preventDefault()},!1)})();var ye=e=>typeof e=="function"?e:function(){return e},Ri=typeof self!="undefined"?self:null,we=typeof window!="undefined"?window:null,ne=Ri||we||ne,Pi="2.0.0",W={connecting:0,open:1,closing:2,closed:3},xi=1e4,Li=1e3,U={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},G={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},rt={longpoll:"longpoll",websocket:"websocket"},Ii={complete:4},Me=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHo
vendor: 5,122 bytes, line 1
1oks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Tt=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Oi=class{constructor(e,t,i){this.state=U.closed,this.topic=e,this.params=ye(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Me(this,G.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Tt(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=U.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=U.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=U.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=U.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Me(this,G.leave,ye({}),this.timeout).send(),this.state=U.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(G.reply,(s,r)=>{this.trigger(this.replyEventName(r),s)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(G.close,e)}onError(e){return this.on(G.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t=="undefined"||t===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new Me(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=U.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(G.close,"leave")},i=new Me(this,G.leave,ye({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=U.joining,this.joinPush.resend(e))}trigger(e,t,i,s){let r=this.onMessage(e,t,i,s);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let n=this.bindings.filter(o=>o.event===e);for(let o=0;o<n.length;o++)n[o].callback(r,i,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===U.closed}isErrored(){return this.state===U.errored}isJoined(){return this.state===U.joined}isJoining(){return this.state===U.joining}
vendor: 13,008 bytes, lines 1-2
1isLeaving(){return this.state===U.leaving}},Ue=class{static request(e,t,i,s,r,n,o){if(ne.XDomainRequest){let a=new ne.XDomainRequest;return this.xdomainRequest(a,e,t,s,r,n,o)}else{let a=new ne.XMLHttpRequest;return this.xhrRequest(a,e,t,i,s,r,n,o)}}static xdomainRequest(e,t,i,s,r,n,o){return e.timeout=r,e.open(t,i),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},n&&(e.ontimeout=n),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,r,n,o,a){return e.open(t,i,!0),e.timeout=n,e.setRequestHeader("Content-Type",s),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===Ii.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(r),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let r=t?`${t}[${s}]`:s,n=e[s];typeof n=="object"?i.push(this.serialize(n,r)):i.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return`${e}${i}${this.serialize(t)}`}},Di=e=>{let t="",i=new Uint8Array(e),s=i.byteLength;for(let r=0;r<s;r++)t+=String.fromCharCode(i[r]);return btoa(t)},be=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=W.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+rt.websocket),"$1/"+rt.longpoll)}endpointURL(){return Ue.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=W.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===W.open||this.readyState===W.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:i,messages:s}=e;this.token=i}else t=0;switch(t){case 200:s.forEach(r=>{setTimeout(()=>this.onmessage({data:r}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=W.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){typeof e!="string"&&(e=Di(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(` 2`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,i){for(let r of this.reqs)r.abort();this.readyState=W.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent!="undefined"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,i,s,r){let n,o=()=>{this.reqs.delete(n),s()};n=Ue.request(e,this.endpointURL(),t,i,this.timeout,o,a=>{this.reqs.delete(n),this.isActive()&&r(a)}),this.reqs.add(n)}};var Fe={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,r,n,o]=JSON.parse(e);return t({join_ref:i,ref:s,topic:r,event:n,payload:o})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:r,payload:n}=e,o=this.META_LENGTH+t.length+i.length+r.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),h=0;l.setUint8(h++,this.KINDS.push),l.setUint8(h++,t.length),l.setUint8(h++,i.length),l.setUint8(h++,r.length),l.setUint8(h++,s.length),Array.from(t,f=>l.setUint8(h++,f.charCodeAt(0))),Array.from(i,f=>l.setUint8(h++,f.charCodeAt(0))),Array.from(r,f=>l.setUint8(h++,f.charCodeAt(0))),Array.from(s,f=>l.setUint8(h++,f.charCodeAt(0)));var p=new Uint8Array(a.byteLength+n.byteLength);return p.set(new Uint8Array(a),0),p.set(new Uint8Array(n),a.byteLength),p.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+r));o=o+r;let h=i.decode(e.slice(o,o+n));o=o+n;let p=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:h,payload:p}},decodeReply(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=i.decode(e.slice(a,a+s));a=a+s;let h=i.decode(e.slice(a,a+r));a=a+r;let p=i.decode(e.slice(a,a+n));a=a+n;let f=i.decode(e.slice(a,a+o));a=a+o;let m=e.slice(a,e.byteLength),g={status:f,response:m};return{join_ref:l,ref:h,topic:p,event:G.reply,payload:g}},decodeBroadcast(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=this.HEADER_LENGTH+2,o=i.decode(e.slice(n,n+s));n=n+s;let a=i.decode(e.slice(n,n+r));n=n+r;let l=e.slice(n,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},_t=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||xi,this.transport=t.transport||ne.WebSocket||be,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||ne&&ne.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Fe.encode.bind(Fe),this.defaultDecoder=Fe.decode.bind(Fe),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==be?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;we&&we.addEventListener&&(we.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),we.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,r,n)=>{console.log(`${s}: ${r}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ye(t.params||{}),this.endPoint=`${e}/${rt.websocket}`,this.vsn=t.vsn||Pi,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Tt(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return be}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Ue.appendParams(Ue.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,i)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ye(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==be?this.connectWithFallback(be,this.longPollFallbackMs):this.transportConnect())}log(e,t,i){this.logger&&this.logger(e,t,i)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(r=>{r.ref===t&&(this.off([s]),e(Date.now()-i))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let i=!1,s=!0,r,n,o=a=>{this.log("transport",`falling back to ${e.name}...`,a),this.off([r,n]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),n=this.onError(a=>{this.log("transport","error",a),s&&!i&&(clearTimeout(this.fallbackTimer),o(a))}),this.onOpen(()=>{if(i=!0,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(a=>{this.log("transport","connected to primary after",a),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Li,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,i){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===W.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i)}),(t===this.transport||i>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(G.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case W.connecting:return"connecting";case W.open:return"open";case W.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1)}
2channel(e,t={}){let i=new Oi(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:r,join_ref:n}=e;this.log("push",`${t} ${i} (${n}, ${r})`,s)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:r,ref:n,join_ref:o}=t;n&&n===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${i} ${s} ${n&&"("+n+")"||""}`,r);for(let a=0;a<this.channels.length;a++){let l=this.channels[a];l.isMember(i,s,r,o)&&l.trigger(s,r,n,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,l]=this.stateChangeCallbacks.message[a];l(t)}})}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};var ri="consecutive-reloads",Hi=10,Ni=5e3,Mi=1e4,Fi=3e4,ni=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],Q="data-phx-component",nt="data-phx-link",Ui="track-static",$i="data-phx-link-state",me="data-phx-ref-loading",B="data-phx-ref-src",$="data-phx-ref-lock",oi="track-uploads",Z="data-phx-upload-ref",vt="data-phx-preflighted-refs",ji="data-phx-done-refs",Rt="drop-target",ut="data-phx-active-refs",Xe="phx:live-file:updated",ai="data-phx-skip",li="data-phx-id",Pt="data-phx-prune",xt="phx-connected",oe="phx-loading",fe="phx-error",Lt="phx-client-error",Ae="phx-server-error",he="data-phx-parent-id",bt="data-phx-main",re="data-phx-root-id",ft="viewport-top",pt="viewport-bottom",It="trigger-action",Ke="phx-has-focused",Bi=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],hi=["checkbox","radio"],Ie="phx-has-submitted",z="data-phx-session",de=`[${z}]`,Ot="data-phx-sticky",le="data-phx-static",gt="data-phx-readonly",ge="data-phx-disabled",Dt="disable-with",Ge="data-phx-disable-with-restore",ke="hook",Vi="debounce",Ji="throttle",xe="update",ot="stream",Se="data-phx-stream",Wi="key",q="phxPrivate",Ht="auto-recover",$e="phx:live-socket:debug",at="phx:live-socket:profiling",lt="phx:live-socket:latency-sim",je="phx:nav-history-position",qi="progress",Nt="mounted",Mt="__phoenix_reload_status__",Xi=1,Ft=3,zi=200,Ki="phx-",Gi=3e4,Ce="debounce-trigger",Ee="throttled",Ut="debounce-prev-key",Yi={debounce:300,throttle:300},$t=[me,B,$],Be="d",X="s",ht="r",D="c",jt="e",Bt="r",Vt="t",Qi="p",Jt="stream",Zi=class{constructor(e,t,i){let{chunk_size:s,chunk_timeout:r}=t;this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=s,this.chunkTimeout=r,this.chunkTimer=null,this.errored=!1,this.uploadChannel=i.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){this.errored||(this.uploadChannel.leave(),this.errored=!0,clearTimeout(this.chunkTimer),this.entry.error(e))}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=i=>{if(i.target.error===null)this.offset+=i.target.result.byteLength,this.pushChunk(i.target.result);else return M("Read error: "+i.target.error)},e.readAsArrayBuffer(t)}pushChunk(e){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e,this.chunkTimeout).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:t})=>this.error(t))}},M=(e,t)=>console.error&&console.error(e,t),Y=e=>{let t=typeof e;return t==="number"||t==="string"&&/^(0|[1-9]\d*)$/.test(e)};function es(){let e=new Set,t=document.querySelectorAll("*[id]");for(let i=0,s=t.length;i<s;i++)e.has(t[i].id)?console.error(`Multiple IDs detected: ${t[i].id}. Ensure unique element ids.`):e.add(t[i].id)}var ts=(e,t,i,s)=>{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,s)},Te=e=>typeof e=="function"?e:function(){return e},ze=e=>JSON.parse(JSON.stringify(e)),Le=(e,t,i)=>{do{if(e.matches(`[${t}]`)&&!e.disabled)return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1&&!(i&&i.isSameNode(e)||e.matches(de)));return null},pe=e=>e!==null&&typeof e=="object"&&!(e instanceof Array),is=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Wt=e=>{for(let t in e)return!1;return!0},se=(e,t)=>e&&t(e),ss=function(e,t,i,s){e.forEach(r=>{new Zi(r,i.config,s).upload()})},rs={canPushState(){return typeof history.pushState!="undefined"},dropLocal(e,t,i){return e.removeItem(this.localKey(t,i))},updateLocal(e,t,i,s,r){let n=this.getLocal(e,t,i),o=this.localKey(t,i),a=n===null?s:r(n);return e.setItem(o,JSON.stringify(a)),a},getLocal(e,t,i){return JSON.parse(e.getItem(this.localKey(t,i)))},updateCurrentState(e){this.canPushState()&&history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,i){if(this.canPushState()){if(i!==window.location.href){if(t.type=="redirect"&&t.scroll){let s=history.state||{};s.scroll=t.scroll,history.replaceState(s,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null),window.requestAnimationFrame(()=>{let s=this.getHashTargetEl(window.location.hash);s?s.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)})}}else this.redirect(i)}
2,setCookie(e,t,i){let s=typeof i=="number"?` max-age=${i};`:"";document.cookie=`${e}=${t};${s} path=/`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},deleteCookie(e){document.cookie=`${e}=; max-age=-1; path=/`},redirect(e,t){t&&this.setCookie("__phoenix_flash__",t,60),window.location=e},localKey(e,t){return`${e}-${t}`},getHashTargetEl(e){let t=e.toString().substring(1);if(t!=="")return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},N=rs,ae={byId(e){return document.getElementById(e)||M(`no id found for ${e}`)},removeClass(e,t){e.classList.remove(t),e.classList.length===0&&e.removeAttribute("class")},all(e,t,i){if(!e)return[];let s=Array.from(e.querySelectorAll(t));return i?s.forEach(i):s},childNodeLength(e){let t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput(e){return e.type==="file"&&e.getAttribute(Z)!==null},isAutoUpload(e){return e.hasAttribute("data-phx-auto-upload")},findUploadInputs(e){let t=e.id,i=this.all(document,`input[type="file"][${Z}][form="${t}"]`);return this.all(e,`input[type="file"][${Z}]`).concat(i)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${Q}="${t}"]`),e)},isPhxDestroyed(e){return!!(e.id&&ae.private(e,"destroyed"))},wantsNewTab(e){let t=e.ctrlKey||e.shiftKey||e.metaKey||e.button&&e.button===1,i=e.target instanceof HTMLAnchorElement&&e.target.hasAttribute("download"),s=e.target.hasAttribute("target")&&e.target.getAttribute("target").toLowerCase()==="_blank",r=e.target.hasAttribute("target")&&!e.target.getAttribute("target").startsWith("_");return t||s||i||r},isUnloadableFormSubmit(e){return e.target&&e.target.getAttribute("method")==="dialog"||e.submitter&&e.submitter.getAttribute("formmethod")==="dialog"?!1:!e.defaultPrevented&&!this.wantsNewTab(e)},isNewPageClick(e,t){let i=e.target instanceof HTMLAnchorElement?e.target.getAttribute("href"):null,s;if(e.defaultPrevented||i===null||this.wantsNewTab(e)||i.startsWith("mailto:")||i.startsWith("tel:")||e.target.isContentEditable)return!1;try{s=new URL(i)}catch(r){try{s=new URL(i,t)}catch(n){return!0}}return s.host===t.host&&s.protocol===t.protocol&&s.pathname===t.pathname&&s.search===t.search?s.hash===""&&!s.href.endsWith("#"):s.protocol.startsWith("http")},markPhxChildDestroyed(e){this.isPhxChild(e)&&e.setAttribute(z,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment(e,t){let i=document.createElement("template");return i.innerHTML=e,this.findPhxChildren(i.content,t)},isIgnored(e,t){return(e.getAttribute(t)||e.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(e,t,i){return e.getAttribute&&i.indexOf(e.getAttribute(t))>=0},findPhxSticky(e){return this.all(e,`[${Ot}]`)},findPhxChildren(e,t){return this.all(e,`${de}[${he}="${t}"]`)},findExistingParentCIDs(e,t){let i=new Set,s=new Set;return t.forEach(r=>{this.filterWithinSameLiveView(this.all(e,`[${Q}="${r}"]`),e).forEach(n=>{i.add(r),this.all(n,`[${Q}]`).map(o=>parseInt(o.getAttribute(Q))).forEach(o=>s.add(o))})}),s.forEach(r=>i.delete(r)),i},filterWithinSameLiveView(e,t){return t.querySelector(de)?e.filter(i=>this.withinSameLiveView(i,t)):e},withinSameLiveView(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(e.getAttribute(z)!==null)return!1}},private(e,t){return e[q]&&e[q][t]},deletePrivate(e,t){e[q]&&delete e[q][t]},putPrivate(e,t,i){e[q]||(e[q]={}),e[q][t]=i},updatePrivate(e,t,i,s){let r=this.private(e,t);r===void 0?this.putPrivate(e,t,s(i)):this.putPrivate(e,t,s(r))},syncPendingAttrs(e,t){e.hasAttribute(B)&&(ni.forEach(i=>{e.classList.contains(i)&&t.classList.add(i)}),$t.filter(i=>e.hasAttribute(i)).forEach(i=>{t.setAttribute(i,e.getAttribute(i))}))},copyPrivates(e,t){t[q]&&(e[q]=t[q])},putTitle(e){let t=document.querySelector("title");if(t){let{prefix:i,suffix:s,default:r}=t.dataset,n=typeof e!="string"||e.trim()==="";if(n&&typeof r!="string")return;let o=n?r:e;document.title=`${i||""}${o||""}${s||""}`}else document.title=e},debounce(e,t,i,s,r,n,o,a){let l=e.getAttribute(i),h=e.getAttribute(r);l===""&&(l=s),h===""&&(h=n);let p=l||h;switch(p){case null:return a();case"blur":this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>{o()&&a()});return;default:let f=parseInt(p),m=()=>h?this.deletePrivate(e,Ee):a(),g=this.incCycle(e,Ce,m);
2if(isNaN(f))return M(`invalid throttle/debounce value: ${p}`);if(h){let v=!1;if(t.type==="keydown"){let b=this.private(e,Ut);this.putPrivate(e,Ut,t.key),v=b!==t.key}if(!v&&this.private(e,Ee))return!1;{a();let b=setTimeout(()=>{o()&&this.triggerCycle(e,Ce)},f);this.putPrivate(e,Ee,b)}}else setTimeout(()=>{o()&&this.triggerCycle(e,Ce,g)},f);let c=e.form;c&&this.once(c,"bind-debounce")&&c.addEventListener("submit",()=>{Array.from(new FormData(c).entries(),([v])=>{let b=c.querySelector(`[name="${v}"]`);this.incCycle(b,Ce),this.deletePrivate(b,Ee)})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>{clearTimeout(this.private(e,Ee)),this.triggerCycle(e,Ce)})}},triggerCycle(e,t,i){let[s,r]=this.private(e,t);i||(i=s),i===s&&(this.incCycle(e,t),r())},once(e,t){return this.private(e,t)===!0?!1:(this.putPrivate(e,t,!0),!0)},incCycle(e,t,i=function(){}){let[s]=this.private(e,t)||[0,i];return s++,this.putPrivate(e,t,[s,i]),s},maintainPrivateHooks(e,t,i,s){e.hasAttribute&&e.hasAttribute("data-phx-hook")&&!t.hasAttribute("data-phx-hook")&&t.setAttribute("data-phx-hook",e.getAttribute("data-phx-hook")),t.hasAttribute&&(t.hasAttribute(i)||t.hasAttribute(s))&&t.setAttribute("data-phx-hook","Phoenix.InfiniteScroll")},putCustomElHook(e,t){e.isConnected?e.setAttribute("data-phx-hook",""):console.error(` 3 hook attached to non-connected DOM element 4 ensure you are calling createHook within your connectedCallback. ${e.outerHTML} 5 `),this.putPrivate(e,"custom-el-hook",t)},getCustomElHook(e){return this.private(e,"custom-el-hook")},isUsedInput(e){return e.nodeType===Node.ELEMENT_NODE&&(this.private(e,Ke)||this.private(e,Ie))},resetForm(e){Array.from(e.elements).forEach(t=>{this.deletePrivate(t,Ke),this.deletePrivate(t,Ie)})},isPhxChild(e){return e.getAttribute&&e.getAttribute(he)},isPhxSticky(e){return e.getAttribute&&e.getAttribute(Ot)!==null},isChildOfAny(e,t){return!!t.find(i=>i.contains(e))},firstPhxChild(e){return this.isPhxChild(e)?e:this.all(e,`[${he}]`)[0]},dispatchEvent(e,t,i={}){let s=!0;e.nodeName==="INPUT"&&e.type==="file"&&t==="click"&&(s=!1);let o={bubbles:i.bubbles===void 0?s:!!i.bubbles,cancelable:!0,detail:i.detail||{}},a=t==="click"?new MouseEvent("click",o):new CustomEvent(t,o);e.dispatchEvent(a)},cloneNode(e,t){if(typeof t=="undefined")return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let s=new Set(i.exclude||[]),r=i.isIgnored,n=t.attributes;for(let a=n.length-1;a>=0;a--){let l=n[a].name;if(s.has(l))l==="value"&&e.value===t.value&&e.setAttribute("value",t.getAttribute(l));else{let h=t.getAttribute(l);e.getAttribute(l)!==h&&(!r||r&&l.startsWith("data-"))&&e.setAttribute(l,h)}}let o=e.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;r?l.startsWith("data-")&&!t.hasAttribute(l)&&!$t.includes(l)&&e.removeAttribute(l):t.hasAttribute(l)||e.removeAttribute(l)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||ae.mergeAttrs(e,t,{exclude:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange(e){return e.setSelectionRange&&(e.type==="text"||e.type==="textarea")},restoreFocus(e,t,i){if(e instanceof HTMLSelectElement&&e.focus(),!ae.isTextualInput(e))return;e.matches(":focus")||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput(e){return/^(?:input|select|textarea)$/i.test(e.tagName)&&e.type!=="button"},syncAttrsToProps(e){e instanceof HTMLInputElement&&hi.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=e.getAttribute("checked")!==null)},isTextualInput(e){return Bi.indexOf(e.type)>=0},isNowTriggerFormExternal(e,t){return e.getAttribute&&e.getAttribute(t)!==null&&document.body.contains(e)},cleanChildNodes(e,t){if(ae.isPhxUpdate(e,t,["append","prepend"])){let i=[];e.childNodes.forEach(s=>{s.id||(!(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()==="")&&s.nodeType!==Node.COMMENT_NODE&&M(`only HTML element tags with an id are allowed inside containers with phx-update. 6 7removing illegal node: "${(s.outerHTML||s.nodeValue).trim()}" 8 9`),i.push(s))}
9),i.forEach(s=>s.remove())}},replaceRootContainer(e,t,i){let s=new Set(["id",z,le,bt,re]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(r=>!s.has(r.name.toLowerCase())).forEach(r=>e.removeAttribute(r.name)),Object.keys(i).filter(r=>!s.has(r.toLowerCase())).forEach(r=>e.setAttribute(r,i[r])),e;{let r=document.createElement(t);return Object.keys(i).forEach(n=>r.setAttribute(n,i[n])),s.forEach(n=>r.setAttribute(n,e.getAttribute(n))),r.innerHTML=e.innerHTML,e.replaceWith(r),r}},getSticky(e,t,i){let s=(ae.private(e,"sticky")||[]).find(([r])=>t===r);if(s){let[r,n,o]=s;return o}else return typeof i=="function"?i():i},deleteSticky(e,t){this.updatePrivate(e,"sticky",[],i=>i.filter(([s,r])=>s!==t))},putSticky(e,t,i){let s=i(e);this.updatePrivate(e,"sticky",[],r=>{let n=r.findIndex(([o])=>t===o);return n>=0?r[n]=[t,i,s]:r.push([t,i,s]),r})},applyStickyOperations(e){let t=ae.private(e,"sticky");t&&t.forEach(([i,s,r])=>this.putSticky(e,i,s))}},d=ae,_e=class{static isActive(e,t){let i=t._phxRef===void 0,r=e.getAttribute(ut).split(",").indexOf(P.genFileRef(t))>=0;return t.size>0&&(i||r)}static isPreflighted(e,t){return e.getAttribute(vt).split(",").indexOf(P.genFileRef(t))>=0&&this.isActive(e,t)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,t,i,s){this.ref=P.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(Xe,this._onElUpdated),this.autoUpload=s}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,()=>{P.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(Xe,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),this.isAutoUpload()||P.clearFiles(this.fileEl)}isAutoUpload(){return this.autoUpload}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(Xe,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(ut).split(",").indexOf(this.ref)===-1&&(P.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]||M(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:t}}else return{name:"channel",callback:ss}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||M(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}},ns=0,P=class mt{static genFileRef(t){let i=t._phxRef;return i!==void 0?i:(t._phxRef=(ns++).toString(),t._phxRef)}static getEntryDataURL(t,i,s){let r=this.activeFiles(t).find(n=>this.genFileRef(n)===i);s(URL.createObjectURL(r))}static hasUploadsInProgress(t){let i=0;return d.findUploadInputs(t).forEach(s=>{s.getAttribute(vt)!==s.getAttribute(ji)&&i++}
9),i>0}static serializeUploads(t){let i=this.activeFiles(t),s={};return i.forEach(r=>{let n={path:t.name},o=t.getAttribute(Z);s[o]=s[o]||[],n.ref=this.genFileRef(r),n.last_modified=r.lastModified,n.name=r.name||n.ref,n.relative_path=r.webkitRelativePath,n.type=r.type,n.size=r.size,typeof r.meta=="function"&&(n.meta=r.meta()),s[o].push(n)}),s}static clearFiles(t){t.value=null,t.removeAttribute(Z),d.putPrivate(t,"files",[])}static untrackFile(t,i){d.putPrivate(t,"files",d.private(t,"files").filter(s=>!Object.is(s,i)))}static trackFiles(t,i,s){if(t.getAttribute("multiple")!==null){let r=i.filter(n=>!this.activeFiles(t).find(o=>Object.is(o,n)));d.updatePrivate(t,"files",[],n=>n.concat(r)),t.value=null}else s&&s.files.length>0&&(t.files=s.files),d.putPrivate(t,"files",i)}static activeFileInputs(t){let i=d.findUploadInputs(t);return Array.from(i).filter(s=>s.files&&this.activeFiles(s).length>0)}static activeFiles(t){return(d.private(t,"files")||[]).filter(i=>_e.isActive(t,i))}static inputsAwaitingPreflight(t){let i=d.findUploadInputs(t);return Array.from(i).filter(s=>this.filesAwaitingPreflight(s).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(i=>!_e.isPreflighted(t,i)&&!_e.isPreflightInProgress(i))}static markPreflightInProgress(t){t.forEach(i=>_e.markPreflightInProgress(i.file))}constructor(t,i,s){this.autoUpload=d.isAutoUpload(t),this.view=i,this.onComplete=s,this._entries=Array.from(mt.filesAwaitingPreflight(t)||[]).map(r=>new _e(t,r,i,this.autoUpload)),mt.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}isAutoUpload(){return this.autoUpload}entries(){return this._entries}initAdapterUpload(t,i,s){this._entries=this._entries.map(n=>(n.isCancelled()?(this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()):(n.zipPostFlight(t),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()})),n));let r=this._entries.reduce((n,o)=>{if(!o.meta)return n;let{name:a,callback:l}=o.uploader(s.uploaders);return n[a]=n[a]||{callback:l,entries:[]},n[a].entries.push(o),n},{});for(let n in r){let{callback:o,entries:a}=r[n];o(a,i,t,s)}}},os={anyOf(e,t){return t.find(i=>e instanceof i)},isFocusable(e,t){return e instanceof HTMLAnchorElement&&e.rel!=="ignore"||e instanceof HTMLAreaElement&&e.href!==void 0||!e.disabled&&this.anyOf(e,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||e instanceof HTMLIFrameElement||e.tabIndex>0||!t&&e.getAttribute("tabindex")!==null&&e.getAttribute("aria-hidden")!=="true"},attemptFocus(e,t){if(this.isFocusable(e,t))try{e.focus()}catch(i){}return!!document.activeElement&&document.activeElement.isSameNode(e)},focusFirstInteractive(e){let t=e.firstElementChild;for(;t;){if(this.attemptFocus(t,!0)||this.focusFirstInteractive(t,!0))return!0;t=t.nextElementSibling}},focusFirst(e){let t=e.firstElementChild;for(;t;){if(this.attemptFocus(t)||this.focusFirst(t))return!0;t=t.nextElementSibling}},focusLast(e){let t=e.lastElementChild;for(;t;){if(this.attemptFocus(t)||this.focusLast(t))return!0;t=t.previousElementSibling}}},ve=os,di={LiveFileUpload:{activeRefs(){return this.el.getAttribute(ut)},preflightedRefs(){return this.el.getAttribute(vt)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,e===""&&this.__view().cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(Xe))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(Z)),P.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>ve.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>ve.focusFirst(this.el)),this.el.addEventListener("phx:show-end",()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&ve.focusFirst(this.el)}}},ci=e=>["HTML","BODY"].indexOf(e.nodeName.toUpperCase())>=0?null:["scroll","auto"].indexOf(getComputedStyle(e).overflowY)>=0?e:ci(e.parentElement),qt=e=>e?e.scrollTop:document.documentElement.scrollTop||document.body.scrollTop,wt=e=>e?e.getBoundingClientRect().bottom:window.innerHeight||document.documentElement.clientHeight,yt=e=>e?e.getBoundingClientRect().top:0,as=(e,t)=>{let i=e.getBoundingClientRect();return Math.ceil(i.top)>=yt(t)&&Math.ceil(i.left)>=0&&Math.floor(i.top)<=wt(t)},ls=(e,t)=>{let i=e.getBoundingClientRect();return Math.ceil(i.bottom)>=yt(t)&&Math.ceil(i.left)>=0&&Math.floor(i.bottom)<=wt(t)},Xt=(e,t)=>
9{let i=e.getBoundingClientRect();return Math.ceil(i.top)>=yt(t)&&Math.ceil(i.left)>=0&&Math.floor(i.top)<=wt(t)};di.InfiniteScroll={mounted(){this.scrollContainer=ci(this.el);let e=qt(this.scrollContainer),t=!1,i=500,s=null,r=this.throttle(i,(a,l)=>{s=()=>!0,this.liveSocket.execJSHookPush(this.el,a,{id:l.id,_overran:!0},()=>{s=null})}),n=this.throttle(i,(a,l)=>{s=()=>l.scrollIntoView({block:"start"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{s=null,window.requestAnimationFrame(()=>{Xt(l,this.scrollContainer)||l.scrollIntoView({block:"start"})})})}),o=this.throttle(i,(a,l)=>{s=()=>l.scrollIntoView({block:"end"}),this.liveSocket.execJSHookPush(this.el,a,{id:l.id},()=>{s=null,window.requestAnimationFrame(()=>{Xt(l,this.scrollContainer)||l.scrollIntoView({block:"end"})})})});this.onScroll=a=>{let l=qt(this.scrollContainer);if(s)return e=l,s();let h=this.el.getBoundingClientRect(),p=this.el.getAttribute(this.liveSocket.binding("viewport-top")),f=this.el.getAttribute(this.liveSocket.binding("viewport-bottom")),m=this.el.lastElementChild,g=this.el.firstElementChild,c=l<e,v=l>e;c&&p&&!t&&h.top>=0?(t=!0,r(p,g)):v&&t&&h.top<=0&&(t=!1),p&&c&&as(g,this.scrollContainer)?n(p,g):f&&v&&ls(m,this.scrollContainer)&&o(f,m),e=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(e,t){let i=0,s;return(...r)=>{let n=Date.now(),o=e-(n-i);o<=0||o>e?(s&&(clearTimeout(s),s=null),i=n,t(...r)):s||(s=setTimeout(()=>{i=Date.now(),s=null,t(...r)},o))}}};var hs=di,ds=class{constructor(e){this.el=e,this.loadingRef=e.hasAttribute(me)?parseInt(e.getAttribute(me),10):null,this.lockRef=e.hasAttribute($)?parseInt(e.getAttribute($),10):null}maybeUndo(e,t,i){this.isWithin(e)&&(this.undoLocks(e,t,i),this.undoLoading(e,t),this.isFullyResolvedBy(e)&&this.el.removeAttribute(B))}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 s=d.private(this.el,$);s&&(i(s),d.deletePrivate(this.el,$)),this.el.removeAttribute($);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(me);let i=this.el.getAttribute(ge),s=this.el.getAttribute(gt);s!==null&&(this.el.readOnly=s==="true",this.el.removeAttribute(gt)),i!==null&&(this.el.disabled=i==="true",this.el.removeAttribute(ge));let r=this.el.getAttribute(Ge);r!==null&&(this.el.innerText=r,this.el.removeAttribute(Ge));let n={detail:{ref:e,event:t},bubbles:!0,cancelable:!1};this.el.dispatchEvent(new CustomEvent(`phx:undo-loading:${this.loadingRef}`,n))}ni.forEach(i=>{(i!=="phx-submit-loading"||this.canUndoLoading(e))&&d.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}},cs=class{constructor(e,t,i){let s=new Set,r=new Set([...t.children].map(o=>o.id)),n=[];Array.from(e.children).forEach(o=>{if(o.id&&(s.add(o.id),r.has(o.id))){let a=o.previousElementSibling&&o.previousElementSibling.id;n.push({elementId:o.id,previousElementId:a})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=n,this.elementIdsToAdd=[...r].filter(o=>!s.has(o))}perform(){let e=d.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?se(document.getElementById(t.previousElementId),i=>{se(document.getElementById(t.elementId),s=>{s.previousElementSibling&&s.previousElementSibling.id==i.id||i.insertAdjacentElement("afterend",s)})}):se(document.getElementById(t.elementId),i=>{i.previousElementSibling==null||e.insertAdjacentElement("afterbegin",i)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEac
vendor: 4,766 bytes, line 9
9h(t=>{se(document.getElementById(t),i=>e.insertAdjacentElement("afterbegin",i))})}},zt=11;function us(e,t){var i=t.attributes,s,r,n,o,a;if(!(t.nodeType===zt||e.nodeType===zt)){for(var l=i.length-1;l>=0;l--)s=i[l],r=s.name,n=s.namespaceURI,o=s.value,n?(r=s.localName||r,a=e.getAttributeNS(n,r),a!==o&&(s.prefix==="xmlns"&&(r=s.name),e.setAttributeNS(n,r,o))):(a=e.getAttribute(r),a!==o&&e.setAttribute(r,o));for(var h=e.attributes,p=h.length-1;p>=0;p--)s=h[p],r=s.name,n=s.namespaceURI,n?(r=s.localName||r,t.hasAttributeNS(n,r)||e.removeAttributeNS(n,r)):t.hasAttribute(r)||e.removeAttribute(r)}}var Ve,fs="http://www.w3.org/1999/xhtml",F=typeof document=="undefined"?void 0:document,ps=!!F&&"content"in F.createElement("template"),gs=!!F&&F.createRange&&"createContextualFragment"in F.createRange();function ms(e){var t=F.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function vs(e){Ve||(Ve=F.createRange(),Ve.selectNode(F.body));var t=Ve.createContextualFragment(e);return t.childNodes[0]}function bs(e){var t=F.createElement("body");return t.innerHTML=e,t.childNodes[0]}function ws(e){return e=e.trim(),ps?ms(e):gs?vs(e):bs(e)}function Je(e,t){var i=e.nodeName,s=t.nodeName,r,n;return i===s?!0:(r=i.charCodeAt(0),n=s.charCodeAt(0),r<=90&&n>=97?i===s.toUpperCase():n<=90&&r>=97?s===i.toUpperCase():!1)}function ys(e,t){return!t||t===fs?F.createElement(e):F.createElementNS(t,e)}function As(e,t){for(var i=e.firstChild;i;){var s=i.nextSibling;t.appendChild(i),i=s}return t}function dt(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var Kt={OPTION:function(e,t){var i=e.parentNode;if(i){var s=i.nodeName.toUpperCase();s==="OPTGROUP"&&(i=i.parentNode,s=i&&i.nodeName.toUpperCase()),s==="SELECT"&&!i.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}dt(e,t,"selected")},INPUT:function(e,t){dt(e,t,"checked"),dt(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var s=e.firstChild;if(s){var r=s.nodeValue;if(r==i||!i&&r==e.placeholder)return;s.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i=-1,s=0,r=e.firstChild,n,o;r;)if(o=r.nodeName&&r.nodeName.toUpperCase(),o==="OPTGROUP")n=r,r=n.firstChild;else{if(o==="OPTION"){if(r.hasAttribute("selected")){i=s;break}s++}r=r.nextSibling,!r&&n&&(r=n.nextSibling,n=null)}e.selectedIndex=i}}},Re=1,Gt=11,Yt=3,Qt=8;function ie(){}function ks(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function Ss(e){return function(i,s,r){if(r||(r={}),typeof s=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var n=s;s=F.createElement("html"),s.innerHTML=n}else s=ws(s);else s.nodeType===Gt&&(s=s.firstElementChild);var o=r.getNodeKey||ks,a=r.onBeforeNodeAdded||ie,l=r.onNodeAdded||ie,h=r.onBeforeElUpdated||ie,p=r.onElUpdated||ie,f=r.onBeforeNodeDiscarded||ie,m=r.onNodeDiscarded||ie,g=r.onBeforeElChildrenUpdated||ie,c=r.skipFromChildren||ie,v=r.addChild||function(y,A){return y.appendChild(A)},b=r.childrenOnly===!0,x=Object.create(null),S=[];function R(y){S.push(y)}function H(y,A){if(y.nodeType===Re)for(var _=y.firstChild;_;){var k=void 0;A&&(k=o(_))?R(k):(m(_),_.firstChild&&H(_,A)),_=_.nextSibling}}function I(y,A,_){f(y)!==!1&&(A&&A.removeChild(y),m(y),H(y,_))}function u(y){if(y.nodeType===Re||y.nodeType===Gt)for(var A=y.firstChild;A;){var _=o(A);_&&(x[_]=A),u(A),A=A.nextSibling}}u(i);function w(y){l(y);for(var A=y.firstChild;A;){var _=A.nextSibling,k=o(A);if(k){var C=x[k];C&&Je(A,C)?(A.parentNode.replaceChild(C,A),j(C,A)):w(A)}else w(A);A=_}}function V(y,A,_){for(;A;){var k=A.nextSibling;(_=o(A))?R(_):I(A,y,!0),A=k}}function j(y,A,_){var k=o(A);if(k&&delete x[k],!_){var C=h(y,A);if(C===!1||(C instanceof HTMLElement&&(y=C,u(y)),e(y,A),p(y),g(y,A)===!1))return}y.nodeName!=="TEXTAREA"?L(y,A):Kt.TEXTAREA(y,A)}function L(y,A){var _=c(y,A),k=A.firstChild,C=y.firstChild,ce,K,ue,Oe,ee;e:for(;k;){for(Oe=k.nextSibling,ce=o(k);!_&&C;){if(ue=C.nextSibling,k.isSameNode&&k.isSameNode(C)){k=Oe,C=ue;continue e}K=o(C);var De=C.nodeType,te=void 0;if(De===k.nodeType&&(De===Re?(ce?ce!==K&&((ee=x[ce])?ue===ee?te=!1:(y.insertBefore(ee,C),K?R(K):I(C,y,!0),C=ee,K=o(C)):te=!1):K&&(te=!1),te=te!==!1&&Je(C,k),te&&j(C,k)):(De===Yt||De==Qt)&&(te=!0,C.nodeValue!==k.nodeValue&&(C.nodeValue=k.nodeValue))),te){k=Oe,C=ue;continue e}K?R(K):I(C,y,!0),C=ue}if(ce&&(ee=x[ce])&&Je(ee,k))_||v(y,ee),j(ee,k);else{var tt=a(k);tt!==!1&&(tt&&(k=tt),k.actualize&&(k=k.actualize(y.ownerDocument||F)),v(y,k),w(k))}k=Oe,C=ue}V(y,C,K);var kt=Kt[y.nodeName];kt&&kt(y,A)}var T=i,J=T.nodeType,At=s.nodeType;
9if(!b){if(J===Re)At===Re?Je(i,s)||(m(i),T=As(i,ys(s.nodeName,s.namespaceURI))):T=s;else if(J===Yt||J===Qt){if(At===J)return T.nodeValue!==s.nodeValue&&(T.nodeValue=s.nodeValue),T;T=s}}if(T===s)m(i);else{if(s.isSameNode&&s.isSameNode(T))return;if(j(T,s,b),S)for(var Ze=0,bi=S.length;Ze<bi;Ze++){var et=x[S[Ze]];et&&I(et,et.parentNode,!1)}}return!b&&T!==i&&i.parentNode&&(T.actualize&&(T=T.actualize(i.ownerDocument||F)),i.parentNode.replaceChild(T,i)),T}}var Cs=Ss(us),Zt=Cs,We=class{static patchWithClonedTree(e,t,i){let s=i.getActiveElement(),{selectionStart:r,selectionEnd:n}=s&&d.hasSelectionRange(s)?s:{},o=i.binding(xe),a=null;Zt(e,t,{childrenOnly:!1,onBeforeElUpdated:(l,h)=>{if(d.syncPendingAttrs(l,h),!e.isSameNode(l)&&l.hasAttribute($)||d.isIgnored(l,o))return!1;if(s&&s.isSameNode(l)&&d.isFormInput(l))return d.mergeFocusedInput(l,h),!1;d.isNowTriggerFormExternal(h,i.binding(It))&&(a=h)}}),a&&(i.unload(),Object.getPrototypeOf(a).submit.call(a)),i.silenceEvents(()=>d.restoreFocus(s,r,n))}constructor(e,t,i,s,r,n){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=s,this.streams=r,this.streamInserts={},this.streamComponentRestore={},this.targetCID=n,this.cidPatch=Y(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.targetContainer=this.isCIDPatch()?this.targetCIDContainer(s):t,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,t){this.callbacks[`before${e}`].push(t)}after(e,t){this.callbacks[`after${e}`].push(t)}trackBefore(e,...t){this.callbacks[`before${e}`].forEach(i=>i(...t))}trackAfter(e,...t){this.callbacks[`after${e}`].forEach(i=>i(...t))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(xe);d.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,t=>{t.setAttribute(Pt,"")})}perform(e){let{view:t,liveSocket:i,html:s,container:r,targetContainer:n}=this;if(this.isCIDPatch()&&!n)return;let o=i.getActiveElement(),{selectionStart:a,selectionEnd:l}=o&&d.hasSelectionRange(o)?o:{},h=i.binding(xe),p=i.binding(ft),f=i.binding(pt),m=i.binding(It),g=[],c=[],v=[],b=null;function x(S,R,H=!1){let I={childrenOnly:S.getAttribute(Q)===null&&!H,getNodeKey:u=>d.isPhxDestroyed(u)?null:e?u.id:u.id||u.getAttribute&&u.getAttribute(li),skipFromChildren:u=>u.getAttribute(h)===ot,addChild:(u,w)=>{let{ref:V,streamAt:j}=this.getStreamInsert(w);if(V===void 0)return u.appendChild(w);if(this.setStreamRef(w,V),j===0)u.insertAdjacentElement("afterbegin",w);else if(j===-1){let L=u.lastElementChild;if(L&&!L.hasAttribute(Se)){let T=Array.from(u.children).find(J=>!J.hasAttribute(Se));u.insertBefore(w,T)}else u.appendChild(w)}else if(j>0){let L=Array.from(u.children)[j];u.insertBefore(w,L)}},onBeforeNodeAdded:u=>{d.maintainPrivateHooks(u,u,p,f),this.trackBefore("added",u);let w=u;return this.streamComponentRestore[u.id]&&(w=this.streamComponentRestore[u.id],delete this.streamComponentRestore[u.id],x.call(this,w,u,!0)),w},onNodeAdded:u=>{u.getAttribute&&this.maybeReOrderStream(u,!0),u instanceof HTMLImageElement&&u.srcset?u.srcset=u.srcset:u instanceof HTMLVideoElement&&u.autoplay&&u.play(),d.isNowTriggerFormExternal(u,m)&&(b=u),(d.isPhxChild(u)&&t.ownsElement(u)||d.isPhxSticky(u)&&t.ownsElement(u.parentNode))&&this.trackAfter("phxChildAdded",u),g.push(u)},onNodeDiscarded:u=>this.onNodeDiscarded(u),onBeforeNodeDiscarded:u=>u.getAttribute&&u.getAttribute(Pt)!==null?!0:!(u.parentElement!==null&&u.id&&d.isPhxUpdate(u.parentElement,h,[ot,"append","prepend"])||this.maybePendingRemove(u)||this.skipCIDSibling(u)),onElUpdated:u=>{d.isNowTriggerFormExternal(u,m)&&(b=u),c.push(u),this.maybeReOrderStream(u,!1)},onBeforeElUpdated:(u,w)=>{if(u.id&&u.isSameNode(S)&&u.id!==w.id)return I.onNodeDiscarded(u),u.replaceWith(w),I.onNodeAdded(w);if(d.syncPendingAttrs(u,w),d.maintainPrivateHooks(u,w,p,f),d.cleanChildNodes(w,h),this.skipCIDSibling(w))return this.maybeReOrderStream(u),!1;if(d.isPhxSticky(u))return[z,le,re].map(L=>
9[L,u.getAttribute(L),w.getAttribute(L)]).forEach(([L,T,J])=>{J&&T!==J&&u.setAttribute(L,J)}),!1;if(d.isIgnored(u,h)||u.form&&u.form.isSameNode(b))return this.trackBefore("updated",u,w),d.mergeAttrs(u,w,{isIgnored:d.isIgnored(u,h)}),c.push(u),d.applyStickyOperations(u),!1;if(u.type==="number"&&u.validity&&u.validity.badInput)return!1;let V=o&&u.isSameNode(o)&&d.isFormInput(u),j=V&&this.isChangedSelect(u,w);if(u.hasAttribute(B)){d.isUploadInput(u)&&(d.mergeAttrs(u,w,{isIgnored:!0}),this.trackBefore("updated",u,w),c.push(u)),d.applyStickyOperations(u);let T=u.hasAttribute($)?d.private(u,$)||u.cloneNode(!0):null;T&&(d.putPrivate(u,$,T),V||(u=T))}if(d.isPhxChild(w)){let L=u.getAttribute(z);return d.mergeAttrs(u,w,{exclude:[le]}),L!==""&&u.setAttribute(z,L),u.setAttribute(re,this.rootID),d.applyStickyOperations(u),!1}return d.copyPrivates(w,u),V&&u.type!=="hidden"&&!j?(this.trackBefore("updated",u,w),d.mergeFocusedInput(u,w),d.syncAttrsToProps(u),c.push(u),d.applyStickyOperations(u),!1):(j&&u.blur(),d.isPhxUpdate(w,h,["append","prepend"])&&v.push(new cs(u,w,w.getAttribute(h))),d.syncAttrsToProps(w),d.applyStickyOperations(w),this.trackBefore("updated",u,w),u)}};Zt(S,R,I)}return this.trackBefore("added",r),this.trackBefore("updated",r,r),i.time("morphdom",()=>{this.streams.forEach(([S,R,H,I])=>{R.forEach(([u,w,V])=>{this.streamInserts[u]={ref:S,streamAt:w,limit:V,reset:I}}),I!==void 0&&d.all(r,`[${Se}="${S}"]`,u=>{this.removeStreamChildElement(u)}),H.forEach(u=>{let w=r.querySelector(`[id="${u}"]`);w&&this.removeStreamChildElement(w)})}),e&&d.all(this.container,`[${h}=${ot}]`,S=>{this.liveSocket.owner(S,R=>{R===this.view&&Array.from(S.children).forEach(H=>{this.removeStreamChildElement(H)})})}),x.call(this,n,s)}),i.isDebugEnabled()&&(es(),Array.from(document.querySelectorAll("input[name=id]")).forEach(S=>{S.form&&console.error(`Detected an input with name="id" inside a form! This will cause problems when patching the DOM. 10`,S)})),v.length>0&&i.time("post-morph append/prepend restoration",()=>{v.forEach(S=>S.perform())}),i.silenceEvents(()=>d.restoreFocus(o,a,l)),d.dispatchEvent(document,"phx:update"),g.forEach(S=>this.trackAfter("added",S)),c.forEach(S=>this.trackAfter("updated",S)),this.transitionPendingRemoves(),b&&(i.unload(),Object.getPrototypeOf(b).submit.call(b)),!0}onNodeDiscarded(e){(d.isPhxChild(e)||d.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){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){d.putSticky(e,Se,i=>i.setAttribute(Se,t))}maybeReOrderStream(e,t){let{ref:i,streamAt:s,reset:r}=this.getStreamInsert(e);if(s!==void 0&&(this.setStreamRef(e,i),!(!r&&!t)&&e.parentElement)){if(s===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(s>0){let n=Array.from(e.parentElement.children),o=n.indexOf(e);if(s>=n.length-1)e.parentElement.appendChild(e);else{let a=n[s];o>s?e.parentElement.insertBefore(e,a):e.parentElement.insertBefore(e,a.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(s=>this.removeStreamChildElement(s)):t&&t>=0&&i.length>t&&i.slice(t).forEach(s=>this.removeStreamChildElement(s))}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:t}=this;e.length>0&&t.transitionRemoves(e,!1,()=>{e.forEach(i=>{let s=d.firstPhxChild(i);s&&t.destroyViewByEl(s),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(ai)}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=d.findComponentNodeList(this.container,this.targetCID);return i.length===0&&d.childNodeLength(e)===1?t:t&&t.parentNode}indexOf(e,t){return Array.from(e.children).indexOf(t)}},Es=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),Ts=new Set(["'",'"']),ei=(e,t,i)=>{let s=0,r=!1,n,o,a,l,h,p,f=e.match(/^(\s*(?:<!--.*?-->\s*)*)<([^\s\/>]+)/);if(f===null)throw new Error(`malformed html ${e}`);for(s=f[0].length,n=f[1],a=f[2],l=s,s;s<e.length&&e.charAt(s)!==">";s++)if(e.charAt(s)==="="){let c=e.slice(s-3,s)===" id";s++;let v=e.charAt(s);if(Ts.has(v)){let b=s;for(s++,s;s<e.length&&e.charAt(s)!==v;s++);if(c){h=e.slice(b+1,s);break}}}let m=e.length-1;for(r=!1;m>=n.length+a.length;){let c=e.charAt(m);
10if(r)c==="-"&&e.slice(m-3,m)==="<!-"?(r=!1,m-=4):m-=1;else if(c===">"&&e.slice(m-2,m)==="--")r=!0,m-=3;else{if(c===">")break;m-=1}}o=e.slice(m+1,e.length);let g=Object.keys(t).map(c=>t[c]===!0?c:`${c}="${t[c]}"`).join(" ");if(i){let c=h?` id="${h}"`:"";Es.has(a)?p=`<${a}${c}${g===""?"":" "}${g}/>`:p=`<${a}${c}${g===""?"":" "}${g}></${a}>`}else{let c=e.slice(l,m+1);p=`<${a}${g===""?"":" "}${g}${c}`}return[p,n,o]},ti=class{static extract(e){let{[Bt]:t,[jt]:i,[Vt]:s}=e;return delete e[Bt],delete e[jt],delete e[Vt],{diff:e,title:s,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[t,i]=this.recursiveToString(this.rendered,this.rendered[D],e,!0,{});return[t,i]}recursiveToString(e,t=e[D],i,s,r){i=i?new Set(i):null;let n={buffer:"",components:t,onlyCids:i,streams:new Set};return this.toOutputBuffer(e,null,n,s,r),[n.buffer,n.streams]}componentCIDs(e){return Object.keys(e[D]||{}).map(t=>parseInt(t))}isComponentOnlyDiff(e){return e[D]?Object.keys(e).length===1:!1}getComponent(e,t){return e[D][t]}resetRender(e){this.rendered[D][e]&&(this.rendered[D][e].reset=!0)}mergeDiff(e){let t=e[D],i={};if(delete e[D],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[D]=this.rendered[D]||{},t){let s=this.rendered[D];for(let r in t)t[r]=this.cachedFindComponent(r,t[r],s,t,i);for(let r in t)s[r]=t[r];e[D]=t}}cachedFindComponent(e,t,i,s,r){if(r[e])return r[e];{let n,o,a=t[X];if(Y(a)){let l;a>0?l=this.cachedFindComponent(a,s[a],i,s,r):l=i[-a],o=l[X],n=this.cloneMerge(l,t,!0),n[X]=o}else n=t[X]!==void 0||i[e]===void 0?t:this.cloneMerge(i[e],t,!1);return r[e]=n,n}}mutableMerge(e,t){return t[X]!==void 0?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let s=t[i],r=e[i];pe(s)&&s[X]===void 0&&pe(r)?this.doMutableMerge(r,s):e[i]=s}e[ht]&&(e.newRender=!0)}cloneMerge(e,t,i){let s=O(O({},e),t);for(let r in s){let n=t[r],o=e[r];pe(n)&&n[X]===void 0&&pe(o)?s[r]=this.cloneMerge(o,n,i):n===void 0&&pe(o)&&(s[r]=this.cloneMerge(o,{},i))}return i?(delete s.magicId,delete s.newRender):e[ht]&&(s.newRender=!0),s}componentToString(e){let[t,i]=this.recursiveCIDToString(this.rendered[D],e,null),[s,r,n]=ei(t,{});return[s,i]}pruneCIDs(e){e.forEach(t=>delete this.rendered[D][t])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[X]}templateStatic(e,t){return typeof e=="number"?t[e]:e}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(e,t,i,s,r={}){if(e[Be])return this.comprehensionToBuffer(e,t,i);let{[X]:n}=e;n=this.templateStatic(n,t);let o=e[ht],a=i.buffer;o&&(i.buffer=""),s&&o&&!e.magicId&&(e.newRender=!0,e.magicId=this.nextMagicID()),i.buffer+=n[0];for(let l=1;l<n.length;l++)this.dynamicToBuffer(e[l-1],t,i,s),i.buffer+=n[l];if(o){let l=!1,h;s||e.magicId?(l=s&&!e.newRender,h=O({[li]:e.magicId},r)):h=r,l&&(h[ai]=!0);let[p,f,m]=ei(i.buffer,h,l);e.newRender=!1,i.buffer=a+f+p+m}}comprehensionToBuffer(e,t,i){let{[Be]:s,[X]:r,[Jt]:n}=e,[o,a,l,h]=n||[null,{},[],null];r=this.templateStatic(r,t);let p=t||e[Qi];for(let f=0;f<s.length;f++){let m=s[f];i.buffer+=r[0];for(let g=1;g<r.length;g++){let c=!1;this.dynamicToBuffer(m[g-1],p,i,c),i.buffer+=r[g]}}n!==void 0&&(e[Be].length>0||l.length>0||h)&&(delete e[Jt],e[Be]=[],i.streams.add(n))}dynamicToBuffer(e,t,i,s){if(typeof e=="number"){let[r,n]=this.recursiveCIDToString(i.components,e,i.onlyCids);i.buffer+=r,i.streams=new Set([...i.streams,...n])}else pe(e)?this.toOutputBuffer(e,t,i,s,{}):i.buffer+=e}recursiveCIDToString(e,t,i){let s=e[t]||M(`no component for CID ${t}`,e),r={[Q]:t},n=i&&!i.has(t);s.newRender=!n,s.magicId=`c${t}-${this.parentViewId()}`;let o=!s.reset,[a,l]=this.recursiveToString(s,e,i,o,r);return delete s.reset,[a,l]}},ii=[],si=200,_s={exec(e,t,i,s,r,n){let[o,a]=n||[null,{callback:n&&n.callback}];(i.charAt(0)==="["?JSON.parse(i):[[o,a]]).forEach(([h,p])=>{h===o&&(p=O(O({},a),p),p.callback=p.callback||a.callback),this.filterToEls(s.liveSocket,r,p).forEach(f=>{this[`exec_${h}`](e,t,i,s,r,f,p)})})},isVisible(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length>0)},isInViewport(e){let t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth;return t.right>0&&t.bottom>0&&t.left<s&&t.top<i},exec_exec(e,t,i,s,r,n,{attr:o,to:a}
10){(a?d.all(document,a):[r]).forEach(h=>{let p=h.getAttribute(o);if(!p)throw new Error(`expected ${o} to contain JS command on "${a}"`);s.liveSocket.execJS(h,p,t)})},exec_dispatch(e,t,i,s,r,n,{event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=r,d.dispatchEvent(n,o,{detail:a,bubbles:l})},exec_push(e,t,i,s,r,n,o){let{event:a,data:l,target:h,page_loading:p,loading:f,value:m,dispatcher:g,callback:c}=o,v={loading:f,value:m,target:h,page_loading:!!p},b=t==="change"&&g?g:r,x=h||b.getAttribute(s.binding("target"))||b,S=(R,H)=>{if(R.isConnected())if(t==="change"){let{newCid:I,_target:u}=o;u=u||(d.isFormInput(r)?r.name:void 0),u&&(v._target=u),R.pushInput(r,H,I,a||i,v,c)}else if(t==="submit"){let{submitter:I}=o;R.submitForm(r,H,a||i,I,v,c)}else R.pushEvent(t,r,H,a||i,l,v,c)};o.targetView&&o.targetCtx?S(o.targetView,o.targetCtx):s.withinTargets(x,S)},exec_navigate(e,t,i,s,r,n,{href:o,replace:a}){s.liveSocket.historyRedirect(e,o,a?"replace":"push",null,r)},exec_patch(e,t,i,s,r,n,{href:o,replace:a}){s.liveSocket.pushHistoryPatch(e,o,a?"replace":"push",r)},exec_focus(e,t,i,s,r,n){window.requestAnimationFrame(()=>ve.attemptFocus(n))},exec_focus_first(e,t,i,s,r,n){window.requestAnimationFrame(()=>ve.focusFirstInteractive(n)||ve.focusFirst(n))},exec_push_focus(e,t,i,s,r,n){window.requestAnimationFrame(()=>ii.push(n||r))},exec_pop_focus(e,t,i,s,r,n){window.requestAnimationFrame(()=>{let o=ii.pop();o&&o.focus()})},exec_add_class(e,t,i,s,r,n,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(n,o,[],a,l,s,h)},exec_remove_class(e,t,i,s,r,n,{names:o,transition:a,time:l,blocking:h}){this.addOrRemoveClasses(n,[],o,a,l,s,h)},exec_toggle_class(e,t,i,s,r,n,{names:o,transition:a,time:l,blocking:h}){this.toggleClasses(n,o,a,l,s,h)},exec_toggle_attr(e,t,i,s,r,n,{attr:[o,a,l]}){this.toggleAttr(n,o,a,l)},exec_transition(e,t,i,s,r,n,{time:o,transition:a,blocking:l}){this.addOrRemoveClasses(n,[],[],a,o,s,l)},exec_toggle(e,t,i,s,r,n,{display:o,ins:a,outs:l,time:h,blocking:p}){this.toggle(t,s,n,o,a,l,h,p)},exec_show(e,t,i,s,r,n,{display:o,transition:a,time:l,blocking:h}){this.show(t,s,n,o,a,l,h)},exec_hide(e,t,i,s,r,n,{display:o,transition:a,time:l,blocking:h}){this.hide(t,s,n,o,a,l,h)},exec_set_attr(e,t,i,s,r,n,{attr:[o,a]}){this.setOrRemoveAttrs(n,[[o,a]],[])},exec_remove_attr(e,t,i,s,r,n,{attr:o}){this.setOrRemoveAttrs(n,[],[o])},show(e,t,i,s,r,n,o){this.isVisible(i)||this.toggle(e,t,i,s,r,null,n,o)},hide(e,t,i,s,r,n,o){this.isVisible(i)&&this.toggle(e,t,i,s,null,r,n,o)},toggle(e,t,i,s,r,n,o,a){o=o||si;let[l,h,p]=r||[[],[],[]],[f,m,g]=n||[[],[],[]];if(l.length>0||f.length>0)if(this.isVisible(i)){let c=()=>{this.addOrRemoveClasses(i,m,l.concat(h).concat(p)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,f,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,g,m))})},v=()=>{this.addOrRemoveClasses(i,[],f.concat(g)),d.putSticky(i,"toggle",b=>b.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))};i.dispatchEvent(new Event("phx:hide-start")),a===!1?(c(),setTimeout(v,o)):t.transition(o,c,v)}else{if(e==="remove")return;let c=()=>{this.addOrRemoveClasses(i,h,f.concat(m).concat(g));let b=s||this.defaultDisplay(i);d.putSticky(i,"toggle",x=>x.style.display=b),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,l,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,p,h))})},v=()=>{this.addOrRemoveClasses(i,[],l.concat(p)),i.dispatchEvent(new Event("phx:show-end"))};i.dispatchEvent(new Event("phx:show-start")),a===!1?(c(),setTimeout(v,o)):t.transition(o,c,v)}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:hide-start")),d.putSticky(i,"toggle",c=>c.style.display="none"),i.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event("phx:show-start"));let c=s||this.defaultDisplay(i);d.putSticky(i,"toggle",v=>v.style.display=c),i.dispatchEvent(new Event("phx:show-end"))})},toggleClasses(e,t,i,s,r,n){window.requestAnimationFrame(()=>{let[o,a]=d.getSticky(e,"classes",[[],[]]),l=t.filter(p=>o.indexOf(p)<0&&!e.classList.contains(p)),h=t.filter(p=>a.indexOf(p)<0&&e.classList.contains(p));this.addOrRemoveClasses(e,l,h,i,s,r,n)})},toggleAttr(e,t,i,s){e.hasAttribute(t)?s!==void 0?e.getAttribute(t)===i?this.setOrRemoveAttrs(e,[[t,s]],[]):this.setOrRemoveAttrs(e,[[t,i]],[]):this.setOrRemoveAttrs(e,[],[t]):this.setOrRemoveAttrs(e,[[t,i]],[])},addOrRemoveClasses(e,t,i,s,r,n,o){r=r||si;let[a,l,h]=s||[[],[],[]];if(a.length>0){let p=()=>{this.addOrRemoveClasses(e,l,[].concat(a).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(e,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(e,h,l))})},f=()=>this.addOrRemoveClasses(e,t.concat(h),i.concat(a).concat(l));o===!1?(p(),setTimeout(f,r)):n.transition(r,p,f);return}window.requestAnimationFrame(()=>{let[p,f]=d.getSticky(e,"classes",[[],[]]),m=t.filter(b=>p.indexOf(b)<0&&!e.classList.contains(b)),g=i.filter(b=>f.indexOf(b)<0&&e.classList.contains(b)),c=p.filter(b=>i.indexOf(b)<0).concat(m),v=f.filter(b=>t.indexOf(b)<0).concat(g);d.putSticky(e,"classes",b=>(b.classList.remove(...v),b.classList.add(...c),[c,v]))})},setOrRemoveAttrs(e,t,i){let[s,r]=d.getSticky(e,"attrs",[[],[]]),n=t.map(([l,h])=>l).concat(i),o=s.filter(([l,h])=>!n.includes(l)).concat(t),a=r.filter(l=>!n.includes(l)).concat(i);d.putSticky(e,"attrs",l=>
10(a.forEach(h=>l.removeAttribute(h)),o.forEach(([h,p])=>l.setAttribute(h,p)),[o,a]))},hasAllClasses(e,t){return t.every(i=>e.classList.contains(i))},isToggledOut(e,t){return!this.isVisible(e)||this.hasAllClasses(e,t)},filterToEls(e,t,{to:i}){let s=()=>{if(typeof i=="string")return document.querySelectorAll(i);if(i.closest){let r=t.closest(i.closest);return r?[r]:[]}else if(i.inner)return t.querySelectorAll(i.inner)};return i?e.jsQuerySelectorAll(t,i,s):[t]},defaultDisplay(e){return{tr:"table-row",td:"table-cell"}[e.tagName.toLowerCase()]||"block"},transitionClasses(e){if(!e)return null;let[t,i,s]=Array.isArray(e)?e:[e.split(" "),[],[]];return t=Array.isArray(t)?t:t.split(" "),i=Array.isArray(i)?i:i.split(" "),s=Array.isArray(s)?s:s.split(" "),[t,i,s]}},E=_s,ct="hookId",Rs=1,Pe=class{static makeID(){return Rs++}static elementID(e){return d.private(e,ct)}constructor(e,t,i){this.el=t,this.__attachView(e),this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,d.putPrivate(this.el,ct,this.constructor.makeID());for(let s in this.__callbacks)this[s]=this.__callbacks[s]}__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=null)}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed(),d.deletePrivate(this.el,ct)}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}js(){let e=this;return{exec(t){e.__view().liveSocket.execJS(e.el,t,"hook")},show(t,i={}){let s=e.__view().liveSocket.owner(t);E.show("hook",s,t,i.display,i.transition,i.time,i.blocking)},hide(t,i={}){let s=e.__view().liveSocket.owner(t);E.hide("hook",s,t,null,i.transition,i.time,i.blocking)},toggle(t,i={}){let s=e.__view().liveSocket.owner(t);i.in=E.transitionClasses(i.in),i.out=E.transitionClasses(i.out),E.toggle("hook",s,t,i.display,i.in,i.out,i.time,i.blocking)},addClass(t,i,s={}){i=Array.isArray(i)?i:i.split(" ");let r=e.__view().liveSocket.owner(t);E.addOrRemoveClasses(t,i,[],s.transition,s.time,r,s.blocking)},removeClass(t,i,s={}){s.transition=E.transitionClasses(s.transition),i=Array.isArray(i)?i:i.split(" ");let r=e.__view().liveSocket.owner(t);E.addOrRemoveClasses(t,[],i,s.transition,s.time,r,s.blocking)},toggleClass(t,i,s={}){s.transition=E.transitionClasses(s.transition),i=Array.isArray(i)?i:i.split(" ");let r=e.__view().liveSocket.owner(t);E.toggleClasses(t,i,s.transition,s.time,r,s.blocking)},transition(t,i,s={}){let r=e.__view().liveSocket.owner(t);E.addOrRemoveClasses(t,[],[],E.transitionClasses(i),s.time,r,s.blocking)},setAttribute(t,i,s){E.setOrRemoveAttrs(t,[[i,s]],[])},removeAttribute(t,i){E.setOrRemoveAttrs(t,[],[i])},toggleAttribute(t,i,s,r){E.toggleAttr(t,i,s,r)}}}pushEvent(e,t={},i){return i===void 0?new Promise((s,r)=>{try{this.__view().pushHookEvent(this.el,null,e,t,(o,a)=>s(o))===!1&&r(new Error("unable to push hook event. LiveView not connected"))}catch(n){r(n)}}):this.__view().pushHookEvent(this.el,null,e,t,i)}pushEventTo(e,t,i={},s){return s===void 0?new Promise((r,n)=>{try{this.__view().withinTargets(e,(o,a)=>{o.pushHookEvent(this.el,a,t,i,(h,p)=>r(h))===!1&&n(new Error("unable to push hook event. LiveView not connected"))})}catch(o){n(o)}}):this.__view().withinTargets(e,(r,n)=>r.pushHookEvent(this.el,n,t,i,s))}handleEvent(e,t){let i=(s,r)=>r?e:t(s.detail);return window.addEventListener(`phx:${e}`,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener(`phx:${t}`,e),this.__listeners.delete(e)}upload(e,t){return this.__view().dispatchUploads(null,e,t)}uploadTo(e,t,i){return this.__view().withinTargets(e,(s,r)=>{s.dispatchUploads(r,t,i)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},Ps=(e,t)=>{let i=e.endsWith("[]"),s=i?e.slice(0,-2):e;return s=s.replace(/([^\[\]]+)(\]?$)/,`${t}$1$2`),i&&(s+="[]"),s},qe=(e,t,i=[])=>{let p=t,{submitter:s}
10=p,r=Et(p,["submitter"]),n;if(s&&s.name){let f=document.createElement("input");f.type="hidden";let m=s.getAttribute("form");m&&f.setAttribute("form",m),f.name=s.name,f.value=s.value,s.parentElement.insertBefore(f,s),n=f}let o=new FormData(e),a=[];o.forEach((f,m,g)=>{f instanceof File&&a.push(m)}),a.forEach(f=>o.delete(f));let l=new URLSearchParams,h=Array.from(e.elements);for(let[f,m]of o.entries())if(i.length===0||i.indexOf(f)>=0){let g=h.filter(b=>b.name===f),c=!g.some(b=>d.private(b,Ke)||d.private(b,Ie)),v=g.every(b=>b.type==="hidden");c&&!(s&&s.name==f)&&!v&&l.append(Ps(f,"_unused_"),""),l.append(f,m)}s&&n&&s.parentElement.removeChild(n);for(let f in r)l.append(f,r[f]);return l.toString()},xs=class ui{static closestView(t){let i=t.closest(de);return i?d.private(i,"view"):null}constructor(t,i,s,r,n){this.isDead=!1,this.liveSocket=i,this.flash=r,this.parent=s,this.root=s?s.root:this,this.el=t,d.putPrivate(this.el,"view",this),this.id=this.el.id,this.ref=0,this.lastAckRef=null,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pendingForms=new Set,this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinAttempts=0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(o){o&&o()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.formsForRecovery={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{let o=this.href&&this.expandURL(this.href);return{redirect:this.redirect?o:void 0,url:this.redirect?void 0:o||void 0,params:this.connectParams(n),session:this.getSession(),static:this.getStatic(),flash:this.flash}})}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return this.el.hasAttribute(bt)}connectParams(t){let i=this.liveSocket.params(this.el),s=d.all(document,`[${this.binding(Ui)}]`).map(r=>r.src||r.href).filter(r=>typeof r=="string");return s.length>0&&(i._track_static=s),i._mounts=this.joinCount,i._mount_attempts=this.joinAttempts,i._live_referer=t,this.joinAttempts++,i}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(z)}getStatic(){let t=this.el.getAttribute(le);return t===""?null:t}destroy(t=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let i=()=>{t();for(let s in this.viewHooks)this.destroyHook(this.viewHooks[s])};d.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",i).receive("error",i).receive("timeout",i)}setContainerClasses(...t){this.el.classList.remove(xt,oe,fe,Lt,Ae),this.el.classList.add(...t)}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(let i in this.viewHooks)this.viewHooks[i].__disconnected();this.setContainerClasses(oe)}}execAll(t){d.all(this.el,`[${t}]`,i=>this.liveSocket.execJS(i,i.getAttribute(t)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(xt),this.execAll(this.binding("connected"))}triggerReconnected(){for(let t in this.viewHooks)this.viewHooks[t].__reconnected()}log(t,i){this.liveSocket.log(this,t,i)}transition(t,i,s=function(){}){this.liveSocket.transition(t,i,s)}withinTargets(t,i,s=document,r){if(t instanceof HTMLElement||t instanceof SVGElement)return this.liveSocket.owner(t,n=>i(n,t));if(Y(t))d.findComponentNodeList(r||this.el,t).length===0?M(`no component found matching phx-target of ${t}`):i(this,parseInt(t));else{let n=Array.from(s.querySelectorAll(t));n.length===0&&M(`nothing found matching the phx-target selector "${t}"`),n.forEach(o=>this.liveSocket.owner(o,a=>i(a,o)))}}applyDiff(t,i,s){this.log(t,()=>["",ze(i)]);let{diff:r,reply:n,events:o,title:a}=ti.extract(i);s({diff:r,reply:n,events:o}),(typeof a=="string"||t=="mount")&&window.requestAnimationFrame(()=>d.putTitle(a))}onJoin(t){let{rendered:i,container:s,liveview_version:r}=t;if(s){let[n,o]=s;this.el=d.replaceRootContainer(this.el,n,o)}this.childJoins=0,this.joinPending=!0,this.flash=null,this.root===this&&(this.formsForRecovery=this.getFormsForRecovery()),this.isMain()&&window.history.state===null&&this.liveSocket.replaceRootHistory(),r!==this.liveSocket.version()&&console.error(`LiveView asset version mismatch. JavaScript version ${this.liveSocket.version()} vs. server ${r}. To avoid issues, please ensure that your assets use the same version as the server.`),N.dropLocal(this.liveSocket.localStorage,window.location.pathname,ri),this.applyDiff("mount",i,({diff:n,events:o})=>{this.rendered=new ti(this.id,n);let[a,l]=this.renderContainer(null,"join");this.dropPendingRefs(),this.joinCount++,this.joinAttempts=0,this.maybeRecoverForms(a,()=>{this.onJoinComplete(t,a,l,o)})})}dropPendingRefs(){d.all(document,`[${B}="${this.refSrc()}"]`,t=>{t.removeAttribute(me),t.removeAttribute(B),t.removeAttribute($)})}onJoinComplete({live_patch:t},i,s,r){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,i,s,r);d.findPhxChildrenInFragment(i,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),l=a&&a.getAttribute(le);return l&&o.setAttribute(le,l),a&&a.setAttribute(re,this.root.id),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,i,s,r)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(t,i,s,r)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,i,s,r)])}attachTrueDocEl(){this.el=d.byId(this.id),this.el.setAttribute(re,this.root.id)}execNewMounted(t=this.el){let i=this.binding(ft),s=this.binding(pt);d.all(t,`[${i}], [${s}]`,r=>{this.ownsElement(r)&&(d.maintainPrivateHooks(r,r,i,s),this.maybeAddNewHook(r))}),d.all(t,`[${this.binding(ke)}], [data-phx-${ke}]`,r=>{this.ownsElement(r)&&this.maybeAddNewHook(r)}),d.all(t,`[${this.binding(Nt)}]`,r=>{this.ownsElement(r)&&this.maybeMounted(r)})}applyJoinPatch(t,i,s,r){this.attachTrueDocEl();let n=new We(this,this.el,this.id,i,s,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(r),this.applyPendingUpdates(),t){let{kind:o,to:a}=t;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(t,i){this.liveSocket.triggerDOM("onBeforeElUpdated",[t,i]);let s=this.getHook(t),r=s&&d.isIgnored(t,this.binding(xe));if(s&&!t.isEqualNode(i)&&!(r&&is(t.dataset,i.dataset)))return s.__beforeUpdate(),s}maybeMounted(t){let i=t.getAttribute(this.binding(Nt)),s=i&&d.private(t,"mounted");i&&!s&&(this.liveSocket.execJS(t,i),d.putPrivate(t,"mounted",!0))}maybeAddNewHook(t){let i=this.addHook(t);i&&i.__mounted()}performPatch(t,i,s=!1){let r=[],n=!1,o=new Set;return this.liveSocket.triggerDOM("onPatchStart",[t.targetContainer]),t.after("added",a=>{this.liveSocket.triggerDOM("onNodeAdded",[a]);let l=this.binding(ft),h=this.binding(pt);d.maintainPrivateHooks(a,a,l,h),this.maybeAddNewHook(a),a.getAttribute&&this.maybeMounted(a)}),t.after("phxChildAdded",a=>{d.isPhxSticky(a)?this.liveSocket.joinRootViews():n=!0}),t.before("updated",(a,l)=>{this.triggerBeforeUpdateHook(a,l)&&o.add(a.id)}),t.after("updated",a=>{o.has(a.id)&&this.getHook(a).__updated()}),t.after("discarded",a=>{a.nodeType===Node.ELEMENT_NODE&&r.push(a)}),t.after("transitionsDiscarded",a=>
10this.afterElementsRemoved(a,i)),t.perform(s),this.afterElementsRemoved(r,i),this.liveSocket.triggerDOM("onPatchEnd",[t.targetContainer]),n}afterElementsRemoved(t,i){let s=[];t.forEach(r=>{let n=d.all(r,`[${Q}]`),o=d.all(r,`[${this.binding(ke)}], [data-phx-hook]`);n.concat(r).forEach(a=>{let l=this.componentID(a);Y(l)&&s.indexOf(l)===-1&&s.push(l)}),o.concat(r).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),i&&this.maybePushComponentsDestroyed(s)}joinNewChildren(){d.findPhxChildren(this.el,this.id).forEach(t=>this.joinChild(t))}maybeRecoverForms(t,i){let s=this.binding("change"),r=this.root.formsForRecovery,n=document.createElement("template");n.innerHTML=t;let o=n.content.firstElementChild;o.id=this.id,o.setAttribute(re,this.root.id),o.setAttribute(z,this.getSession()),o.setAttribute(le,this.getStatic()),o.setAttribute(he,this.parent?this.parent.id:null);let a=d.all(n.content,"form").filter(l=>l.id&&r[l.id]).filter(l=>!this.pendingForms.has(l.id)).filter(l=>r[l.id].getAttribute(s)===l.getAttribute(s)).map(l=>[r[l.id],l]);if(a.length===0)return i();a.forEach(([l,h],p)=>{this.pendingForms.add(h.id),this.pushFormRecovery(l,h,n.content.firstElementChild,()=>{this.pendingForms.delete(h.id),p===a.length-1&&i()})})}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){var i;return t.id===this.id?this:(i=this.children[t.getAttribute(he)])==null?void 0:i[t.id]}destroyDescendent(t){for(let i in this.root.children)for(let s in this.root.children[i])if(s===t)return this.root.children[i][s].destroy()}joinChild(t){if(!this.getChildById(t.id)){let s=new ui(t,this.liveSocket,this);return this.root.children[this.id][s.id]=s,s.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(t){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.pendingForms.clear(),this.formsForRecovery={},this.joinCallback(()=>{this.pendingJoinOps.forEach(([t,i])=>{t.isDestroyed()||i()}),this.pendingJoinOps=[]})}update(t,i){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:t,events:i});this.rendered.mergeDiff(t);let s=!1;this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{d.findExistingParentCIDs(this.el,this.rendered.componentCIDs(t)).forEach(n=>{this.componentPatch(this.rendered.getComponent(t,n),n)&&(s=!0)})}):Wt(t)||this.liveSocket.time("full patch complete",()=>{let[r,n]=this.renderContainer(t,"update"),o=new We(this,this.el,this.id,r,n,null);s=this.performPatch(o,!0)}),this.liveSocket.dispatchEvents(i),s&&this.joinNewChildren()}renderContainer(t,i){return this.liveSocket.time(`toString diff (${i})`,()=>{let s=this.el.tagName,r=t?this.rendered.componentCIDs(t):null,[n,o]=this.rendered.toString(r);return[`<${s}>${n}</${s}>`,o]})}componentPatch(t,i){if(Wt(t))return!1;let[s,r]=this.rendered.componentToString(i),n=new We(this,this.el,this.id,s,r,i);return this.performPatch(n,!0)}getHook(t){return this.viewHooks[Pe.elementID(t)]}addHook(t){let i=Pe.elementID(t);if(i&&!this.viewHooks[i]){let s=d.getCustomElHook(t)||M(`no hook found for custom element: ${t.id}`);return this.viewHooks[i]=s,s.__attachView(this),s}else{if(i||!t.getAttribute)return;{let s=t.getAttribute(`data-phx-${ke}`)||t.getAttribute(this.binding(ke));if(s&&!this.ownsElement(t))return;let r=this.liveSocket.getHookCallbacks(s);if(r){t.id||M(`no DOM ID for hook "${s}". Hooks require a unique ID on each element.`,t);let n=new Pe(this,t,r);return this.viewHooks[Pe.elementID(n.el)]=n,n}
10else s!==null&&M(`unknown hook found for "${s}"`,t)}}}destroyHook(t){t.__destroyed(),t.__cleanup__(),delete this.viewHooks[Pe.elementID(t.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:t,events:i})=>this.update(t,i)),this.pendingDiffs=[],this.eachChild(t=>t.applyPendingUpdates())}eachChild(t){let i=this.root.children[this.id]||{};for(let s in i)t(this.getChildById(s))}onChannel(t,i){this.liveSocket.onChannel(this.channel,t,s=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>i(s)]):this.liveSocket.requestDOMUpdate(()=>i(s))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",t=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",t,({diff:i,events:s})=>this.update(i,s))})}),this.onChannel("redirect",({to:t,flash:i})=>this.onRedirect({to:t,flash:i})),this.onChannel("live_patch",t=>this.onLivePatch(t)),this.onChannel("live_redirect",t=>this.onLiveRedirect(t)),this.channel.onError(t=>this.onError(t)),this.channel.onClose(t=>this.onClose(t))}destroyAllChildren(){this.eachChild(t=>t.destroy())}onLiveRedirect(t){let{to:i,kind:s,flash:r}=t,n=this.expandURL(i),o=new CustomEvent("phx:server-navigate",{detail:{to:i,kind:s,flash:r}});this.liveSocket.historyRedirect(o,n,s,r)}onLivePatch(t){let{to:i,kind:s}=t;this.href=this.expandURL(i),this.liveSocket.historyPatch(i,s)}expandURL(t){return t.startsWith("/")?`${window.location.protocol}//${window.location.host}${t}`:t}onRedirect({to:t,flash:i,reloadToken:s}){this.liveSocket.redirect(t,i,s)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}joinPush(){return this.joinPush=this.joinPush||this.channel.join(),this.joinPush}join(t){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=i=>{i=i||function(){},t?t(this.joinCount,i):i()},this.wrapPush(()=>this.channel.join(),{ok:i=>this.liveSocket.requestDOMUpdate(()=>this.onJoin(i)),error:i=>this.onJoinError(i),timeout:()=>this.onJoinError({reason:"timeout"})})}onJoinError(t){if(t.reason==="reload"){this.log("error",()=>[`failed mount with ${t.status}. Falling back to page reload`,t]),this.onRedirect({to:this.root.href,reloadToken:t.token});return}else if(t.reason==="unauthorized"||t.reason==="stale"){this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),this.onRedirect({to:this.root.href});return}if((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect)return this.onRedirect(t.redirect);if(t.live_redirect)return this.onLiveRedirect(t.live_redirect);if(this.log("error",()=>["unable to join",t]),this.isMain())this.displayError([oe,fe,Ae]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this);else{this.joinAttempts>=Ft&&(this.root.displayError([oe,fe,Ae]),this.log("error",()=>[`giving up trying to mount after ${Ft} tries`,t]),this.destroy());let i=d.byId(this.el.id);i?(d.mergeAttrs(i,this.el),this.displayError([oe,fe,Ae]),this.el=i):this.destroy()}}onClose(t){if(!this.isDestroyed()){if(this.isMain()&&this.liveSocket.hasPendingLink()&&t!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(zi)}}onError(t){this.onClose(t),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([oe,fe,Ae]):this.displayError([oe,fe,Lt]))}displayError(t){this.isMain()&&d.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(...t),this.execAll(this.binding("disconnected"))}wrapPush(t,i){let s=this.liveSocket.getLatencySim(),r=s?n=>setTimeout(()=>!this.isDestroyed()&&n(),s):n=>!this.isDestroyed()&&n();r(()=>{t().receive("ok",n=>r(()=>i.ok&&i.ok(n))).receive("error",n=>r(()=>i.error&&i.error(n))).receive("timeout",()=>r(()=>i.timeout&&i.timeout()))})}pushWithReply(t,i,s){if(!this.isConnected())return Promise.reject({error:"noconnection"});let[r,[n],o]=t?t():[null,[],{}],a=this.joinCount,l=function(){};return o.page_loading&&(l=this.liveSocket.withPageLoading({kind:"element",target:n})),typeof s.cid!="number"&&delete s.cid,new Promise((h,p)=>{this.wrapPush(()=>this.channel.push(i,s,Gi),{ok:f=>{r!==null&&(this.lastAckRef=r);let m=g=>{f.redirect&&this.onRedirect(f.redirect),f.live_patch&&this.onLivePatch(f.live_patch),f.live_redirect&&this.onLiveRedirect(f.live_redirect),l(),h({resp:f,reply:g})};f.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",f.diff,({diff:g,reply:c,events:v})=>{r!==null&&this.undoRefs(r,s.event),this.update(g,v),m(c)})}):(r!==null&&this.undoRefs(r,s.event),m(null))},error:f=>p({error:f}),timeout:()=>{p({timeout:!0}),this.joinCount===a&&this.liveSocket.reloadWithJitter(this,()=>{this.log("timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}})})}undoRefs(t,i,s){if(!this.isConnected())return;let r=`[${B}="${this.refSrc()}"]`;s?(s=new Set(s),d.all(document,r,n=>{s&&!s.has(n)||(d.all(n,r,o=>this.undoElRef(o,t,i)),this.undoElRef(n,t,i))})):d.all(document,r,n=>this.undoElRef(n,t,i))}undoElRef(t,i,s){new ds(t).maybeUndo(i,s,n=>{let o=this.triggerBeforeUpdateHook(t,n);We.patchWithClonedTree(t,n,this.liveSocket),d.all(t,`[${B}="${this.refSrc()}"]`,a=>this.undoElRef(a,i,s)),this.execNewMounted(t),o&&o.__updated()})}refSrc(){return this.el.id}putRef(t,i,s,r={}){let n=this.ref++,o=this.binding(Dt);if(r.loading){let a=d.all(document,r.loading).map(l=>({el:l,lock:!0,loading:!0}));t=t.concat(a)}for(let{el:a,lock:l,loading:h}of t){if(!l&&!h)throw new Error("putRef requires lock or loading");if(a.setAttribute(B,this.refSrc()),h&&a.setAttribute(me,n),l&&a.setAttribute($,n),!h||r.submitter&&!(a===r.submitter||a===r.form))continue;let p=new Promise(c=>{a.addEventListener(`phx:undo-lock:${n}`,()=>c(g),{once:!0})}),f=new Promise(c=>{a.addEventListener(`phx:undo-loading:${n}`,()=>c(g),{once:!0})});a.classList.add(`phx-${s}-loading`);let m=a.getAttribute(o);m!==null&&(a.getAttribute(Ge)||a.setAttribute(Ge,a.innerText),m!==""&&(a.innerText=m),a.setAttribute(ge,a.getAttribute(ge)||a.disabled),a.setAttribute("disabled",""));let g={event:i,eventType:s,ref:n,isLoading:h,isLocked:l,lockElements:t.filter(({lock:c})=>c).map(({el:c})=>c),loadingElements:t.filter(({loading:c})=>c).map(({el:c})=>c),unlock:c=>{c=Array.isArray(c)?c:[c],this.undoRefs(n,i,c)},lockComplete:p,loadingComplete:f,lock:c=>new Promise(v=>{if(this.isAcked(n))return v(g);c.setAttribute($,n),c.setAttribute(B,this.refSrc()),c.addEventListener(`phx:lock-stop:${n}`,()=>v(g),{once:!0})})};a.dispatchEvent(new CustomEvent("phx:push",{detail:g,bubbles:!0,cancelable:!1})),i&&a.dispatchEvent(new CustomEvent(`phx:push:${i}`,{detail:g,bubbles:!0,cancelable:!1}))}return[n,t.map(({el:a})=>a),r]}isAcked(t){return this.lastAckRef!==null&&this.lastAckRef>=t}componentID(t){let i=t.getAttribute&&t.getAttribute(Q);return i?parseInt(i):null}targetComponentID(t,i,s={}){if(Y(i))return i;let r=s.target||t.getAttribute(this.binding("target"));return Y(r)?parseInt(r):i&&(r!==null||s.target)?this.closestComponentID(i):null}closestComponentID(t){return Y(t)?t:t?se(t.closest(`[${Q}]`),i=>this.ownsElement(i)&&this.componentID(i)):null}pushHookEvent(t,i,s,r,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",s,r]),!1;let[o,a,l]=this.putRef([{el:t,loading:!0,lock:!0}],s,"hook");return this.pushWithReply(()=>[o,a,l],"event",{type:"hook",event:s,value:r,cid:this.closestComponentID(i)}).then(({resp:h,reply:p})=>n(p,o)),o}extractMeta(t,i,s){let r=this.binding("value-");for(let n=0;n<t.attributes.length;n++){i||(i={});let o=t.attributes[n].name;o.startsWith(r)&&(i[o.replace(r,"")]=t.getAttribute(o))}if(t.value!==void 0&&!(t instanceof HTMLFormElement)&&(i||(i={}),i.value=t.value,t.tagName==="INPUT"&&hi.indexOf(t.type)>=0&&!t.checked&&delete i.value),s){i||(i={});for(let n in s)i[n]=s[n]}return i}pushEvent(t,i,s,r,n,o={},a){this.pushWithReply(()=>this.putRef([{el:i,loading:!0,lock:!0}],r,t,o),"event",{type:t,event:r,value:this.extractMeta(i,n,o.value),
10cid:this.targetComponentID(i,s,o)}).then(({reply:l})=>a&&a(l))}pushFileProgress(t,i,s,r=function(){}){this.liveSocket.withinOwners(t.form,(n,o)=>{n.pushWithReply(null,"progress",{event:t.getAttribute(n.binding(qi)),ref:t.getAttribute(Z),entry_ref:i,progress:s,cid:n.targetComponentID(t.form,o)}).then(({resp:a})=>r(a))})}pushInput(t,i,s,r,n,o){if(!t.form)throw new Error("form events require the input to be inside a form");let a,l=Y(s)?s:this.targetComponentID(t.form,i,n),h=()=>this.putRef([{el:t,loading:!0,lock:!0},{el:t.form,loading:!0,lock:!0}],r,"change",n),p,f=this.extractMeta(t.form);t instanceof HTMLButtonElement&&(f.submitter=t),t.getAttribute(this.binding("change"))?p=qe(t.form,O({_target:n._target},f),[t.name]):p=qe(t.form,O({_target:n._target},f)),d.isUploadInput(t)&&t.files&&t.files.length>0&&P.trackFiles(t,Array.from(t.files)),a=P.serializeUploads(t);let m={type:"form",event:r,value:p,uploads:a,cid:l};this.pushWithReply(h,"event",m).then(({resp:g})=>{if(d.isUploadInput(t)&&d.isAutoUpload(t)){if(P.filesAwaitingPreflight(t).length>0){let[c,v]=h();this.undoRefs(c,r,[t.form]),this.uploadFiles(t.form,r,i,c,l,b=>{o&&o(g),this.triggerAwaitingSubmit(t.form,r),this.undoRefs(c,r)})}}else o&&o(g)})}triggerAwaitingSubmit(t,i){let s=this.getScheduledSubmit(t);if(s){let[r,n,o,a]=s;this.cancelSubmit(t,i),a()}}getScheduledSubmit(t){return this.formSubmits.find(([i,s,r,n])=>i.isSameNode(t))}scheduleSubmit(t,i,s,r){if(this.getScheduledSubmit(t))return!0;this.formSubmits.push([t,i,s,r])}cancelSubmit(t,i){this.formSubmits=this.formSubmits.filter(([s,r,n,o])=>s.isSameNode(t)?(this.undoRefs(r,i),!1):!0)}disableForm(t,i,s={}){let r=c=>!(Le(c,`${this.binding(xe)}=ignore`,c.form)||Le(c,"data-phx-update=ignore",c.form)),n=c=>c.hasAttribute(this.binding(Dt)),o=c=>c.tagName=="BUTTON",a=c=>["INPUT","TEXTAREA","SELECT"].includes(c.tagName),l=Array.from(t.elements),h=l.filter(n),p=l.filter(o).filter(r),f=l.filter(a).filter(r);p.forEach(c=>{c.setAttribute(ge,c.disabled),c.disabled=!0}),f.forEach(c=>{c.setAttribute(gt,c.readOnly),c.readOnly=!0,c.files&&(c.setAttribute(ge,c.disabled),c.disabled=!0)});let m=h.concat(p).concat(f).map(c=>({el:c,loading:!0,lock:!0})),g=[{el:t,loading:!0,lock:!1}].concat(m).reverse();return this.putRef(g,i,"submit",s)}pushFormSubmit(t,i,s,r,n,o){let a=()=>this.disableForm(t,s,Ne(O({},n),{form:t,submitter:r})),l=this.targetComponentID(t,i);if(P.hasUploadsInProgress(t)){let[h,p]=a(),f=()=>this.pushFormSubmit(t,i,s,r,n,o);return this.scheduleSubmit(t,h,n,f)}else if(P.inputsAwaitingPreflight(t).length>0){let[h,p]=a(),f=()=>[h,p,n];this.uploadFiles(t,s,i,h,l,m=>{if(P.inputsAwaitingPreflight(t).length>0)return this.undoRefs(h,s);let g=this.extractMeta(t),c=qe(t,O({submitter:r},g));this.pushWithReply(f,"event",{type:"form",event:s,value:c,cid:l}).then(({resp:v})=>o(v))})}else if(!(t.hasAttribute(B)&&t.classList.contains("phx-submit-loading"))){let h=this.extractMeta(t),p=qe(t,O({submitter:r},h));this.pushWithReply(a,"event",{type:"form",event:s,value:p,cid:l}).then(({resp:f})=>o(f))}}uploadFiles(t,i,s,r,n,o){let a=this.joinCount,l=P.activeFileInputs(t),h=l.length;l.forEach(p=>{let f=new P(p,this,()=>{h--,h===0&&o()}),m=f.entries().map(c=>c.toPreflightPayload());if(m.length===0){h--;return}let g={ref:p.getAttribute(Z),entries:m,cid:this.targetComponentID(p.form,s)};this.log("upload",()=>["sending preflight request",g]),this.pushWithReply(null,"allow_upload",g).then(({resp:c})=>{if(this.log("upload",()=>["got preflight response",c]),f.entries().forEach(v=>{c.entries&&!c.entries[v.ref]&&this.handleFailedEntryPreflight(v.ref,"failed preflight",f)}),c.error||Object.keys(c.entries).length===0)this.undoRefs(r,i),(c.error||[]).map(([b,x])=>{this.handleFailedEntryPreflight(b,x,f)});else{let v=b=>{this.channel.onError(()=>{this.joinCount===a&&b()})};f.initAdapterUpload(c,v,this.liveSocket)}})})}handleFailedEntryPreflight(t,i,s){if(s.isAutoUpload()){let r=s.entries().find(n=>n.ref===t.toString());r&&r.cancel()}else s.entries().map(r=>r.cancel());this.log("upload",()=>[`error for entry ${t}`,i])}dispatchUploads(t,i,s){let r=this.targetCtxElement(t)||this.el,n=d.findUploadInput
10s(r).filter(o=>o.name===i);n.length===0?M(`no live file inputs found matching the name "${i}"`):n.length>1?M(`duplicate live file inputs found matching the name "${i}"`):d.dispatchEvent(n[0],oi,{detail:{files:s}})}targetCtxElement(t){if(Y(t)){let[i]=d.findComponentNodeList(this.el,t);return i}else return t||null}pushFormRecovery(t,i,s,r){let n=this.binding("change"),o=i.getAttribute(this.binding("target"))||i,a=i.getAttribute(this.binding(Ht))||i.getAttribute(this.binding("change")),l=Array.from(t.elements).filter(f=>d.isFormInput(f)&&f.name&&!f.hasAttribute(n));if(l.length===0)return;l.forEach(f=>f.hasAttribute(Z)&&P.clearFiles(f));let h=l.find(f=>f.type!=="hidden")||l[0],p=0;this.withinTargets(o,(f,m)=>{let g=this.targetComponentID(i,m);p++;let c=new CustomEvent("phx:form-recovery",{detail:{sourceElement:t}});E.exec(c,"change",a,this,h,["push",{_target:h.name,targetView:f,targetCtx:m,newCid:g,callback:()=>{p--,p===0&&r()}}])},s,s)}pushLinkPatch(t,i,s,r){let n=this.liveSocket.setPendingLink(i),o=t.isTrusted&&t.type!=="popstate",a=s?()=>this.putRef([{el:s,loading:o,lock:!0}],null,"click"):null,l=()=>this.liveSocket.redirect(window.location.href),h=i.startsWith("/")?`${location.protocol}//${location.host}${i}`:i;this.pushWithReply(a,"live_patch",{url:h}).then(({resp:p})=>{this.liveSocket.requestDOMUpdate(()=>{p.link_redirect?this.liveSocket.replaceMain(i,null,r,n):(this.liveSocket.commitPendingLink(n)&&(this.href=i),this.applyPendingUpdates(),r&&r(n))})},({error:p,timeout:f})=>l())}getFormsForRecovery(){if(this.joinCount===0)return{};let t=this.binding("change");return d.all(this.el,`form[${t}]`).filter(i=>i.id).filter(i=>i.elements.length>0).filter(i=>i.getAttribute(this.binding(Ht))!=="ignore").map(i=>i.cloneNode(!0)).reduce((i,s)=>(i[s.id]=s,i),{})}maybePushComponentsDestroyed(t){let i=t.filter(s=>d.findComponentNodeList(this.el,s).length===0);i.length>0&&(i.forEach(s=>this.rendered.resetRender(s)),this.pushWithReply(null,"cids_will_destroy",{cids:i}).then(()=>{this.liveSocket.requestDOMUpdate(()=>{let s=i.filter(r=>d.findComponentNodeList(this.el,r).length===0);s.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:s}).then(({resp:r})=>{this.rendered.pruneCIDs(r.cids)})})}))}ownsElement(t){let i=t.closest(de);return t.getAttribute(he)===this.id||i&&i.id===this.id||!i&&this.isDead}submitForm(t,i,s,r,n={}){d.putPrivate(t,Ie,!0),Array.from(t.elements).forEach(a=>d.putPrivate(a,Ie,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,i,s,r,n,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}};var fi=class{constructor(e,t,i={}){if(this.unloaded=!1,!t||t.constructor.name==="Object")throw new Error(` 11 a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example: 12 13 import {Socket} from "phoenix" 14 import {LiveSocket} from "phoenix_live_view" 15 let liveSocket = new LiveSocket("/live", Socket, {...}) 16 `);this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||Ki,this.opts=i,this.params=Te(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(ze(Yi),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=ze(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||Xi,this.reloadWithJitterTimer=null,this.maxReloads=i.maxReloads||Hi,this.reloadJitterMin=i.reloadJitterMin||Ni,this.reloadJitterMax=i.reloadJitterMax||Mi,this.failsafeJitter=i.failsafeJitter||Fi,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.boundEventNames=new Set,this.serverCloseRef=null,this.domCallbacks=Object.assign({jsQuerySelectorAll:null,onPatchStart:Te(),onPatchEnd:Te(),onNodeAdded:Te(),onBeforeElUpdated:Te()},i.dom||{}),this.transitions=new Ls,this.currentHistoryPosition=parseInt(this.sessionStorage.getItem(je))||0,window.addEventListener("pagehide",s=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}version(){return"1.0.2"}isProfileEnabled(){return this.sessionStorage.getItem(at)==="true"}isDebugEnabled(){return this.sessionStorage.getItem($e)==="true"}isDebugDisabled(){return this.sessionStorage.getItem($e)==="false"}enableDebug(){this.sessionStorage.setItem($e,"true")}enableProfiling(){this.sessionStorage.setItem(at,"true")}disableDebug(){this.sessionStorage.setItem($e,"false")}disableProfiling(){this.sessionStorage.removeItem(at)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(lt,e)}disableLatencySim(){this.sessionStorage.removeItem(lt)}getLatencySim(){let e=this.sessionStorage.getItem(lt);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 s=new CustomEvent("phx:exec",{detail:{sourceElement:e}});this.owner(e,r=>E.exec(s,i,t,r,e))}execJSHookPush(e,t,i,s){this.withinOwners(e,r=>{let n=new CustomEvent("phx:exec",{detail:{sourceElement:e}});E.exec(n,"hook",t,r,e,["push",{data:i,callback:s}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[s,r]=i();this.viewLogger(e,t,s,r)}else if(this.isDebugEnabled()){let[s,r]=i();ts(e,t,s,r)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,t,i=function(){}){this.transitions.addTransition(e,t,i)}
16onChannel(e,t,i){e.on(t,s=>{let r=this.getLatencySim();r?setTimeout(()=>i(s),r):i(s)})}reloadWithJitter(e,t){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let i=this.reloadJitterMin,s=this.reloadJitterMax,r=Math.floor(Math.random()*(s-i+1))+i,n=N.updateLocal(this.localStorage,window.location.pathname,ri,0,o=>o+1);n>=this.maxReloads&&(r=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{e.isDestroyed()||e.isConnected()||(e.destroy(),t?t():this.log(e,"join",()=>[`encountered ${n} consecutive reloads`]),n>=this.maxReloads&&this.log(e,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),this.hasPendingLink()?window.location=this.pendingLink:window.location.reload())},r)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?hs[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinDeadView(){let e=document.body;if(e&&!this.isPhxView(e)&&!this.isPhxView(document.firstElementChild)){let t=this.newRootView(e);t.setHref(this.getHref()),t.joinDead(),this.main||(this.main=t),window.requestAnimationFrame(()=>{var i;t.execNewMounted(),this.maybeScroll((i=history.state)==null?void 0:i.scroll)})}}joinRootViews(){let e=!1;return d.all(document,`${de}:not([${he}])`,t=>{if(!this.getRootById(t.id)){let i=this.newRootView(t);i.setHref(this.getHref()),i.join(),t.hasAttribute(bt)&&(this.main=i)}e=!0}),e}redirect(e,t,i){i&&N.setCookie(Mt,i,60),this.unload(),N.redirect(e,t)}replaceMain(e,t,i=null,s=this.setPendingLink(e)){let r=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let n=d.all(this.outgoingMainEl,`[${this.binding("remove")}]`),o=d.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,t,r),this.main.setRedirect(e),this.transitionRemoves(n,!0),this.main.join((a,l)=>{a===1&&this.commitPendingLink(s)&&this.requestDOMUpdate(()=>{n.forEach(h=>h.remove()),d.findPhxSticky(document).forEach(h=>o.appendChild(h)),this.outgoingMainEl.replaceWith(o),this.outgoingMainEl=null,i&&i(s),l()})})}transitionRemoves(e,t,i){let s=this.binding("remove");if(t){let n=d.findPhxSticky(document)||[];e=e.filter(o=>!d.isChildOfAny(o,n))}let r=n=>{n.preventDefault(),n.stopImmediatePropagation()};e.forEach(n=>{for(let o of this.boundEventNames)n.addEventListener(o,r,!0);this.execJS(n,n.getAttribute(s),"remove")}),this.requestDOMUpdate(()=>{e.forEach(n=>{for(let o of this.boundEventNames)n.removeEventListener(o,r,!0)}),i&&i()})}isPhxView(e){return e.getAttribute&&e.getAttribute(z)!==null}newRootView(e,t,i){let s=new xs(e,this,null,t,i);return this.roots[s.id]=s,s}owner(e,t){let i=se(e.closest(de),s=>this.getViewByEl(s))||this.main;return i&&t?t(i):i}withinOwners(e,t){this.owner(e,i=>t(i,e))}getViewByEl(e){let t=e.getAttribute(re);return se(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(re));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.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&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,s,r,n,o)=>{let a=r.getAttribute(this.binding(Wi)),l=t.key&&t.key.toLowerCase();if(a&&a.toLowerCase()!==l)return;let h=O({key:t.key},this.eventMeta(i,t,r));E.exec(t,i,n,s,r,["push",{data:h}])}
16),this.bind({blur:"focusout",focus:"focusin"},(t,i,s,r,n,o)=>{if(!o){let a=O({key:t.key},this.eventMeta(i,t,r));E.exec(t,i,n,s,r,["push",{data:a}])}}),this.bind({blur:"blur",focus:"focus"},(t,i,s,r,n,o)=>{if(o==="window"){let a=this.eventMeta(i,t,r);E.exec(t,i,n,s,r,["push",{data:a}])}}),this.on("dragover",t=>t.preventDefault()),this.on("drop",t=>{t.preventDefault();let i=se(Le(t.target,this.binding(Rt)),n=>n.getAttribute(this.binding(Rt))),s=i&&document.getElementById(i),r=Array.from(t.dataTransfer.files||[]);!s||s.disabled||r.length===0||!(s.files instanceof FileList)||(P.trackFiles(s,r,t.dataTransfer),s.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on(oi,t=>{let i=t.target;if(!d.isUploadInput(i))return;let s=Array.from(t.detail.files||[]).filter(r=>r instanceof File||r instanceof Blob);P.trackFiles(i,s),i.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let s=this.metadataCallbacks[e];return s?s(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.resetReloadStatus(),this.linkRef}resetReloadStatus(){N.deleteCookie(Mt)}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let s=e[i];this.on(s,r=>{let n=this.binding(i),o=this.binding(`window-${i}`),a=r.target.getAttribute&&r.target.getAttribute(n);a?this.debounce(r.target,r,s,()=>{this.withinOwners(r.target,l=>{t(r,i,l,r.target,a,null)})}):d.all(document,`[${o}]`,l=>{let h=l.getAttribute(o);this.debounce(l,r,s,()=>{this.withinOwners(l,p=>{t(r,i,p,l,h,"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,s=>{let r=null;s.detail===0&&(this.clickStartedAtTarget=s.target);let n=this.clickStartedAtTarget||s.target;r=Le(s.target,i),this.dispatchClickAway(s,n),this.clickStartedAtTarget=null;let o=r&&r.getAttribute(i);if(!o){d.isNewPageClick(s,window.location)&&this.unload();return}r.getAttribute("href")==="#"&&s.preventDefault(),!r.hasAttribute(B)&&this.debounce(r,s,"click",()=>{this.withinOwners(r,a=>{E.exec(s,"click",o,a,r,["push",{data:this.eventMeta("click",s,r)}])})})},!1)}dispatchClickAway(e,t){let i=this.binding("click-away");d.all(document,`[${i}]`,s=>{s.isSameNode(t)||s.contains(t)||this.withinOwners(s,r=>{let n=s.getAttribute(i);E.isVisible(s)&&E.isInViewport(s)&&E.exec(e,"click",n,r,s,["push",{data:this.eventMeta("click",e,e.target)}])})})}bindNav(){if(!N.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{N.updateCurrentState(i=>Object.assign(i,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:i,backType:s,id:r,root:n,scroll:o,position:a}=t.state||{},l=window.location.href,h=a>this.currentHistoryPosition;i=h?i:s||i,this.currentHistoryPosition=a||0,this.sessionStorage.setItem(je,this.currentHistoryPosition.toString()),d.dispatchEvent(window,"phx:navigate",{detail:{href:l,patch:i==="patch",pop:!0,direction:h?"forward":"backward"}}),this.requestDOMUpdate(()=>{this.main.isConnected()&&i==="patch"&&r===this.main.id?this.main.pushLinkPatch(t,l,null,()=>{this.maybeScroll(o)}):this.replaceMain(l,null,()=>{n&&this.replaceRootHistory(),this.maybeScroll(o)})})},!1),window.addEventListener("click",t=>{let i=Le(t.target,nt),s=i&&i.getAttribute(nt);if(!s||!this.isConnected()||!this.main||d.wantsNewTab(t))return;let r=i.href instanceof SVGAnimatedString?i.href.baseVal:i.href,n=i.getAttribute($i);t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if(s==="patch")this.pushHistoryPatch(t,r,n,i);else if(s==="redirect")this.historyRedirect(t,r,n,null,i);else throw new Error(`expected ${nt} to be "patch" or "redirect", got: ${s}`);let o=i.getAttribute(this.binding("click"));o&&this.requestDOMUpdate(()=>this.execJS(i,o,"click"))})},!1)}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}dispatchEvent(e,t={}){d.dispatchEvent(window,`phx:${e}`,{detail:t})}dispatchEvents(e){e.forEach(([t,i])=>this.dispatchEvent(t,i))}withPageLoading(e,t){d.dispatchEvent(window,"phx:page-loading-start",{detail:e});let i=()=>d.dispatchEvent(window,"phx:page-loading-stop",{detail:e});return t?t(i):i}pushHistoryPatch(e,t,i,s){if(!this.isConnected()||!this.main.isMain())return N.redirect(t);this.withPageLoading({to:t,kind:"patch"},r=>{this.main.pushLinkPatch(e,t,s,n=>{this.historyPatch(t,i,n),r()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(this.currentHistoryPosition++,this.sessionStorage.setItem(je,this.currentHistoryPosition.toString()),N.updateCurrentState(s=>Ne(O({},s),{backType:"patch"})),N.pushState(t,{type:"patch",id:this.main.id,position:this.currentHistoryPosition},e),d.dispatchEvent(window,"phx:navigate",{detail:{patch:!0,href:e,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location))}historyRedirect(e,t,i,s,r){if(r&&e.isTrusted&&e.type!=="popstate"&&r.classList.add("phx-click-loading"),!this.isConnected()||!this.main.isMain())return N.redirect(t,s);if(/^\/$|^\/[^\/]+.*$/.test(t)){let{protocol:o,host:a}=window.location;t=`${o}//${a}${t}`}let n=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},o=>{this.replaceMain(t,s,a=>{a===this.linkRef&&(this.currentHistoryPosition++,this.sessionStorage.setItem(je,this.currentHistoryPosition.toString()),N.updateCurrentState(l=>Ne(O({},l),{backType:"redirect"})),N.pushState(i,{type:"redirect",id:this.main.id,scroll:n,position:this.currentHistoryPosition},t),d.dispatchEvent(window,"phx:navigate",{detail:{href:t,patch:!1,pop:!1,direction:"forward"}}),this.registerNewLocation(window.location)),o()})})}replaceRootHistory(){N.pushState("replace",{root:!0,type:"patch",id:this.main.id,position:this.currentHistoryPosition})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i===e.pathname+e.search?!1:(this.currentLocation=ze(e),!0)}bindForms(){let e=0,t=!1;this.on("submit",i=>{let s=i.target.getAttribute(this.binding("submit")),r=i.target.getAttribute(this.binding("change"));!t&&r&&!s&&(t=!0,i.preventDefault(),this.withinOwners(i.target,n=>{n.disableForm(i.target),window.requestAnimationFrame(()=>{d.isUnloadableFormSubmit(i)&&this.unload(),i.target.submit()})}))}),this.on("submit",i=>{let s=i.target.getAttribute(this.binding("submit"));if(!s){d.isUnloadableFormSubmit(i)&&this.unload();return}i.preventDefault(),i.target.disabled=!0,this.withinOwners(i.target,r=>{E.exec(i,"submit",s,r,i.target,["push",{submitter:i.submitter}])})});for(let i of["change","input"])this.on(i,s=>
16{if(s instanceof CustomEvent&&s.target.form===void 0){if(s.detail&&s.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"),n=s.target;if(s.isComposing){let g=`composition-listener-${i}`;d.private(n,g)||(d.putPrivate(n,g,!0),n.addEventListener("compositionend",()=>{n.dispatchEvent(new Event(i,{bubbles:!0})),d.deletePrivate(n,g)},{once:!0}));return}let o=n.getAttribute(r),a=n.form&&n.form.getAttribute(r),l=o||a;if(!l||n.type==="number"&&n.validity&&n.validity.badInput)return;let h=o?n:n.form,p=e;e++;let{at:f,type:m}=d.private(n,"prev-iteration")||{};f===p-1&&i==="change"&&m==="input"||(d.putPrivate(n,"prev-iteration",{at:p,type:i}),this.debounce(n,s,i,()=>{this.withinOwners(h,g=>{d.putPrivate(n,Ke,!0),E.exec(s,"change",l,g,n,["push",{_target:s.target.name,dispatcher:h}])})}))});this.on("reset",i=>{let s=i.target;d.resetForm(s);let r=Array.from(s.elements).find(n=>n.type==="reset");r&&window.requestAnimationFrame(()=>{r.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,t,i,s){if(i==="blur"||i==="focusout")return s();let r=this.binding(Vi),n=this.binding(Ji),o=this.defaults.debounce.toString(),a=this.defaults.throttle.toString();this.withinOwners(e,l=>{let h=()=>!l.isDestroyed()&&document.body.contains(e);d.debounce(e,t,r,o,n,a,h,()=>{s()})})}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 s=this.domCallbacks.jsQuerySelectorAll;return s?s(e,t,i):i()}},Ls=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,t,i){t();let s=setTimeout(()=>{this.transitions.delete(s),i(),this.flushPendingOps()},e);this.transitions.add(s)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var Qe=_i(gi()),Is=document.querySelector("meta[name='csrf-token']").getAttribute("content"),mi=new fi("/live",_t,{params:{_csrf_token:Is}});Qe.default.config({barColors:{0:"#29d"},shadowColor:"rgba(0, 0, 0, .3)"});window.addEventListener("phx:page-loading-start",e=>Qe.default.show(300));window.addEventListener("phx:page-loading-stop",e=>Qe.default.hide());mi.connect();window.liveSocket=mi;window.dataLayer=window.dataLayer||[];function vi(){dataLayer.push(arguments)}vi("js",new Date);vi("config","G-0QTMN8DLCG");window.addEventListener("custom:event",e=>{if(Array.isArray(e.detail)){let[t,i]=e.detail;if(t=="set_disabled_state"){[elem,_rest]=i;let s=document.getElementById(elem).value!="true";e.target.disabled=s}}else throw"lad:exec expected command's arguments as an array"});})(); 17/** 18 * @license MIT 19 * topbar 2.0.0, 2023-02-04 20 * https://buunguyen.github.io/topbar 21 * Copyright (c) 2021 Buu Nguyen 22 */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.