ash_admin/priv/static/assets/app.js

21 lines
113 KiB
JavaScript

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