From b30db2939757c83786950c28b48c77293197744d Mon Sep 17 00:00:00 2001 From: Anantha Kumaran Date: Tue, 21 Jun 2022 08:41:05 +0530 Subject: [PATCH] respect live_socket_path config option --- assets/js/app.js | 5 ++++- dev.exs | 6 ++++-- lib/exq_ui_web/templates/layout/root.html.heex | 2 +- lib/exq_ui_web/views/layout_view.ex | 4 ++++ priv/static/js/app.js | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index f3719f7..26a05f3 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -25,7 +25,10 @@ import { Timestamp } from "./hooks/timestamp"; let csrfToken = document .querySelector("meta[name='csrf-token']") .getAttribute("content"); -let liveSocket = new LiveSocket("/live", Socket, { +let socketPath = + document.querySelector("html").getAttribute("phx-socket") || "/live"; + +let liveSocket = new LiveSocket(socketPath, Socket, { params: { _csrf_token: csrfToken }, hooks: { Table: Table, diff --git a/dev.exs b/dev.exs index b83a125..e18b2a9 100644 --- a/dev.exs +++ b/dev.exs @@ -41,7 +41,7 @@ defmodule DemoWeb.Router do scope "/", DemoWeb do pipe_through :browser - live_exq_ui("/exq") + live_exq_ui("/exq", live_socket_path: "/exq/live") end end @@ -54,7 +54,9 @@ defmodule DemoWeb.Endpoint do signing_salt: "Y3AT90O7" ] - socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]] + socket "/exq/live", Phoenix.LiveView.Socket, + websocket: [connect_info: [session: @session_options]] + socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket plug Phoenix.LiveReloader plug Phoenix.CodeReloader diff --git a/lib/exq_ui_web/templates/layout/root.html.heex b/lib/exq_ui_web/templates/layout/root.html.heex index c574b5d..dce89e5 100644 --- a/lib/exq_ui_web/templates/layout/root.html.heex +++ b/lib/exq_ui_web/templates/layout/root.html.heex @@ -1,5 +1,5 @@ - + diff --git a/lib/exq_ui_web/views/layout_view.ex b/lib/exq_ui_web/views/layout_view.ex index a351f25..5deb3c1 100644 --- a/lib/exq_ui_web/views/layout_view.ex +++ b/lib/exq_ui_web/views/layout_view.ex @@ -13,4 +13,8 @@ defmodule ExqUIWeb.LayoutView do def render("app.js", _), do: @app_js def render("app.css", _), do: @app_css + + def live_socket_path(conn) do + [Enum.map(conn.script_name, &["/" | &1]) | conn.private.live_socket_path] + end end diff --git a/priv/static/js/app.js b/priv/static/js/app.js index d8a052a..7eade66 100644 --- a/priv/static/js/app.js +++ b/priv/static/js/app.js @@ -1,2 +1,2 @@ /*! For license information please see app.js.LICENSE.txt */ -!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/js/",n(n.s=10)}([,,function(t,e,n){var i;(function(r,o){"use strict";!function(){for(var t=0,e=["ms","moz","webkit","o"],n=0;n=0||t.indexOf("-")>=0?u:0)+parseFloat(t)),u=t>1?1:t,d()),u},hide:function(){h&&(h=!1,null!=a&&(r.cancelAnimationFrame(a),a=null),function t(){if(f.progress("+.1")>=1&&(s.style.opacity-=.05,s.style.opacity<=.05))return s.style.display="none",void(l=null);l=r.requestAnimationFrame(t)}())}};"object"==typeof t.exports?t.exports=f:void 0===(i=function(){return f}.call(e,n,e,t))||(t.exports=i)}).call(this,window,document)},,,,,,,,function(t,e,n){t.exports=n(13)},function(t,e,n){},function(t,e,n){"use strict";!function(){var t=function(){if("function"==typeof window.CustomEvent)return window.CustomEvent;function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}return t.prototype=window.Event.prototype,t}();function e(t,e){var n=document.createElement("input");return n.type="hidden",n.name=t,n.value=e,n}function n(t,n){var i=t.getAttribute("data-to"),r=e("_method",t.getAttribute("data-method")),o=e("_csrf_token",t.getAttribute("data-csrf")),s=document.createElement("form"),a=t.getAttribute("target");s.method="get"===t.getAttribute("data-method")?"get":"post",s.action=i,s.style.display="hidden",a?s.target=a:n&&(s.target="_blank"),s.appendChild(o),s.appendChild(r),document.body.appendChild(s),s.submit()}window.addEventListener("click",(function(e){var i=e.target;if(!e.defaultPrevented)for(;i&&i.getAttribute;){var r=new t("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!i.dispatchEvent(r))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(i.getAttribute("data-method"))return n(i,e.metaKey||e.shiftKey),e.preventDefault(),!1;i=i.parentNode}}),!1),window.addEventListener("phoenix.link.click",(function(t){var e=t.target.getAttribute("data-confirm");e&&!window.confirm(e)&&t.preventDefault()}),!1)}()},function(t,e,n){"use strict";n.r(e);n(11),n(12);var i=t=>{if("function"==typeof t)return t;return function(){return t}},r="undefined"!=typeof self?self:null,o="undefined"!=typeof window?window:null,s=r||o||void 0,a=0,l=1,u=2,h=3,c="closed",d="errored",f="joined",p="joining",g="leaving",m="phx_close",v="phx_error",y="phx_join",b="phx_reply",w="phx_leave",_="longpoll",k="websocket",C=4,x=class{constructor(t,e,n,i){this.channel=t,this.event=e,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(t){this.timeout=t,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(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:t,response:e,_ref:n}){this.recHooks.filter(e=>e.status===t).forEach(t=>t.callback(e))}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,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},E=class{constructor(t,e){this.callback=t,this.timerCalc=e,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))}},A=class{static request(t,e,n,i,r,o,a){if(s.XDomainRequest){let n=new s.XDomainRequest;this.xdomainRequest(n,t,e,i,r,o,a)}else{let l=new s.XMLHttpRequest;this.xhrRequest(l,t,e,n,i,r,o,a)}}static xdomainRequest(t,e,n,i,r,o,s){t.timeout=r,t.open(e,n),t.onload=()=>{let e=this.parseJSON(t.responseText);s&&s(e)},o&&(t.ontimeout=o),t.onprogress=()=>{},t.send(i)}static xhrRequest(t,e,n,i,r,o,s,a){t.open(e,n,!0),t.timeout=o,t.setRequestHeader("Content-Type",i),t.onerror=()=>{a&&a(null)},t.onreadystatechange=()=>{if(t.readyState===C&&a){let e=this.parseJSON(t.responseText);a(e)}},s&&(t.ontimeout=s),t.send(r)}static parseJSON(t){if(!t||""===t)return null;try{return JSON.parse(t)}catch(e){return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let n=[];for(var i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let r=e?`${e}[${i}]`:i,o=t[i];"object"==typeof o?n.push(this.serialize(o,r)):n.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}return n.join("&")}static appendParams(t,e){if(0===Object.keys(e).length)return t;let n=t.match(/\?/)?"&":"?";return`${t}${n}${this.serialize(e)}`}},S=class{constructor(t){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=a,this.poll()}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+k),"$1/"+_)}endpointURL(){return A.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(){this.close(),this.readyState=a}ontimeout(){this.onerror("timeout"),this.closeAndRetry()}poll(){this.readyState!==l&&this.readyState!==a||A.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),t=>{if(t){var{status:e,token:n,messages:i}=t;this.token=n}else e=0;switch(e){case 200:i.forEach(t=>{setTimeout(()=>{this.onmessage({data:t})},0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=l,this.onopen(),this.poll();break;case 403:this.onerror(),this.close();break;case 0:case 500:this.onerror(),this.closeAndRetry();break;default:throw new Error("unhandled poll status "+e)}})}send(t){A.request("POST",this.endpointURL(),"application/json",t,this.timeout,this.onerror.bind(this,"timeout"),t=>{t&&200===t.status||(this.onerror(t&&t.status),this.closeAndRetry())})}close(t,e){this.readyState=h,this.onclose()}},T={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(n))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[n,i,r,o,s]=JSON.parse(t);return e({join_ref:n,ref:i,topic:r,event:o,payload:s})}},binaryEncode(t){let{join_ref:e,ref:n,event:i,topic:r,payload:o}=t,s=this.META_LENGTH+e.length+n.length+r.length+i.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),l=new DataView(a),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,e.length),l.setUint8(u++,n.length),l.setUint8(u++,r.length),l.setUint8(u++,i.length),Array.from(e,t=>l.setUint8(u++,t.charCodeAt(0))),Array.from(n,t=>l.setUint8(u++,t.charCodeAt(0))),Array.from(r,t=>l.setUint8(u++,t.charCodeAt(0))),Array.from(i,t=>l.setUint8(u++,t.charCodeAt(0)));var h=new Uint8Array(a.byteLength+o.byteLength);return h.set(new Uint8Array(a),0),h.set(new Uint8Array(o),a.byteLength),h.buffer},binaryDecode(t){let e=new DataView(t),n=e.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(t,e,i);case this.KINDS.reply:return this.decodeReply(t,e,i);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,i)}},decodePush(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),o=e.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(t.slice(s,s+i));s+=i;let l=n.decode(t.slice(s,s+r));s+=r;let u=n.decode(t.slice(s,s+o));return s+=o,{join_ref:a,ref:null,topic:l,event:u,payload:t.slice(s,t.byteLength)}},decodeReply(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),o=e.getUint8(3),s=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(t.slice(a,a+i));a+=i;let u=n.decode(t.slice(a,a+r));a+=r;let h=n.decode(t.slice(a,a+o));a+=o;let c=n.decode(t.slice(a,a+s));a+=s;let d=t.slice(a,t.byteLength);return{join_ref:l,ref:u,topic:h,event:b,payload:{status:c,response:d}}},decodeBroadcast(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),o=this.HEADER_LENGTH+2,s=n.decode(t.slice(o,o+i));o+=i;let a=n.decode(t.slice(o,o+r));return o+=r,{join_ref:null,ref:null,topic:s,event:a,payload:t.slice(o,t.byteLength)}}},M=n(2),L=n.n(M),D=[1e3,3e3],P=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],N="data-phx-component",R="data-phx-ref",I="data-phx-upload-ref",U="data-phx-parent-id",O="data-phx-root-id",j=["text","textarea","number","email","password","search","tel","url","date","time"],F=["checkbox","radio"],H="data-phx-session",$=`[${H}]`,B="data-phx-static",q={debounce:300,throttle:300},V="d",J="s",z="e",Y="r",W="t",X=(t,e)=>console.error&&console.error(t,e),G=t=>{let e=typeof t;return"number"===e||"string"===e&&/^(0|[1-9]\d*)$/.test(t)};var K,Z=t=>"function"==typeof t?t:function(){return t},Q=t=>JSON.parse(JSON.stringify(t)),tt=(t,e,n)=>{do{if(t.matches(`[${e}]`))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType&&!(n&&n.isSameNode(t)||t.matches($)));return null},et=t=>null!==t&&"object"==typeof t&&!(t instanceof Array),nt=t=>{for(let e in t)return!1;return!0},it=(t,e)=>t&&e(t),rt=function(t,e,n,i){t.forEach(t=>{new class{constructor(t,e,n){this.liveSocket=n,this.entry=t,this.offset=0,this.chunkSize=e,this.chunkTimer=null,this.uploadChannel=n.channel("lvu:"+t.ref,{token:t.metadata()})}error(t){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(t)}upload(){this.uploadChannel.onError(t=>this.error(t)),this.uploadChannel.join().receive("ok",t=>this.readNextChunk()).receive("error",t=>this.error(t))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let t=new window.FileReader,e=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=t=>{if(null!==t.target.error)return X("Read error: "+t.target.error);this.offset+=t.target.result.byteLength,this.pushChunk(t.target.result)},t.readAsArrayBuffer(e)}pushChunk(t){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",t).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}}(t,n.config.chunk_size,i).upload()})},ot={canPushState:()=>void 0!==history.pushState,dropLocal(t,e,n){return t.removeItem(this.localKey(e,n))},updateLocal(t,e,n,i,r){let o=this.getLocal(t,e,n),s=this.localKey(e,n),a=null===o?i:r(o);return t.setItem(s,JSON.stringify(a)),a},getLocal(t,e,n){return JSON.parse(t.getItem(this.localKey(e,n)))},updateCurrentState(t){this.canPushState()&&history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,n){if(this.canPushState()){if(n!==window.location.href){if("redirect"==e.type&&e.scroll){let t=history.state||{};t.scroll=e.scroll,history.replaceState(t,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",n||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():"redirect"===e.type&&window.scroll(0,0)}}else this.redirect(n)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie:t=>document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1"),redirect(t,e){e&&ot.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey:(t,e)=>`${t}-${e}`,getHashTargetEl(t){let e=t.toString().substring(1);if(""!==e)return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},st=ot,at={byId:t=>document.getElementById(t)||X("no id found for "+t),removeClass(t,e){t.classList.remove(e),0===t.classList.length&&t.removeAttribute("class")},all(t,e,n){if(!t)return[];let i=Array.from(t.querySelectorAll(e));return n?i.forEach(n):i},childNodeLength(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput:t=>"file"===t.type&&null!==t.getAttribute(I),findUploadInputs(t){return this.all(t,`input[type="file"][${I}]`)},findComponentNodeList(t,e){return this.filterWithinSameLiveView(this.all(t,`[${N}="${e}"]`),t)},isPhxDestroyed:t=>!(!t.id||!at.private(t,"destroyed")),markPhxChildDestroyed(t){this.isPhxChild(t)&&t.setAttribute(H,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){let n=document.createElement("template");return n.innerHTML=t,this.findPhxChildren(n.content,e)},isIgnored:(t,e)=>"ignore"===(t.getAttribute(e)||t.getAttribute("data-phx-update")),isPhxUpdate:(t,e,n)=>t.getAttribute&&n.indexOf(t.getAttribute(e))>=0,findPhxChildren(t,e){return this.all(t,`${$}[${U}="${e}"]`)},findParentCIDs(t,e){let n=new Set(e);return e.reduce((e,n)=>{let i=`[${N}="${n}"] [${N}]`;return this.filterWithinSameLiveView(this.all(t,i),t).map(t=>parseInt(t.getAttribute(N))).forEach(t=>e.delete(t)),e},n)},filterWithinSameLiveView(t,e){return e.querySelector($)?t.filter(t=>this.withinSameLiveView(t,e)):t},withinSameLiveView(t,e){for(;t=t.parentNode;){if(t.isSameNode(e))return!0;if(null!==t.getAttribute(H))return!1}},private:(t,e)=>t.phxPrivate&&t.phxPrivate[e],deletePrivate(t,e){t.phxPrivate&&delete t.phxPrivate[e]},putPrivate(t,e,n){t.phxPrivate||(t.phxPrivate={}),t.phxPrivate[e]=n},updatePrivate(t,e,n,i){let r=this.private(t,e);void 0===r?this.putPrivate(t,e,i(n)):this.putPrivate(t,e,i(r))},copyPrivates(t,e){e.phxPrivate&&(t.phxPrivate=e.phxPrivate)},putTitle(t){let e=document.querySelector("title"),{prefix:n,suffix:i}=e.dataset;document.title=`${n||""}${t}${i||""}`},debounce(t,e,n,i,r,o,s){let a=t.getAttribute(n),l=t.getAttribute(r);""===a&&(a=i),""===l&&(l=o);let u=a||l;switch(u){case null:return s();case"blur":return void(this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>s()));default:let n=parseInt(u),i=()=>l?this.deletePrivate(t,"throttled"):s(),r=this.incCycle(t,"debounce-trigger",i);if(isNaN(n))return X("invalid throttle/debounce value: "+u);if(l){let i=!1;if("keydown"===e.type){let n=this.private(t,"debounce-prev-key");this.putPrivate(t,"debounce-prev-key",e.key),i=n!==e.key}if(!i&&this.private(t,"throttled"))return!1;s(),this.putPrivate(t,"throttled",!0),setTimeout(()=>this.triggerCycle(t,"debounce-trigger"),n)}else setTimeout(()=>this.triggerCycle(t,"debounce-trigger",r),n);let o=t.form;o&&this.once(o,"bind-debounce")&&o.addEventListener("submit",()=>{Array.from(new FormData(o).entries(),([t])=>{let e=o.querySelector(`[name="${t}"]`);this.incCycle(e,"debounce-trigger"),this.deletePrivate(e,"throttled")})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>this.triggerCycle(t,"debounce-trigger"))}},triggerCycle(t,e,n){let[i,r]=this.private(t,e);n||(n=i),n===i&&(this.incCycle(t,e),r())},once(t,e){return!0!==this.private(t,e)&&(this.putPrivate(t,e,!0),!0)},incCycle(t,e,n=function(){}){let[i]=this.private(t,e)||[0,n];return i++,this.putPrivate(t,e,[i,n]),i},discardError(t,e,n){let i=e.getAttribute&&e.getAttribute(n),r=i&&t.querySelector(`[id="${i}"], [name="${i}"]`);r&&(this.private(r,"phx-has-focused")||this.private(r.form,"phx-has-submitted")||e.classList.add("phx-no-feedback"))},showError(t,e){(t.id||t.name)&&this.all(t.form,`[${e}="${t.id}"], [${e}="${t.name}"]`,t=>{this.removeClass(t,"phx-no-feedback")})},isPhxChild:t=>t.getAttribute&&t.getAttribute(U),firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${U}]`)[0]},dispatchEvent(t,e,n={}){let i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t.dispatchEvent(i)},cloneNode(t,e){if(void 0===e)return t.cloneNode(!0);{let n=t.cloneNode(!1);return n.innerHTML=e,n}},mergeAttrs(t,e,n={}){let i=n.exclude||[],r=n.isIgnored,o=e.attributes;for(let n=o.length-1;n>=0;n--){let r=o[n].name;i.indexOf(r)<0&&t.setAttribute(r,e.getAttribute(r))}let s=t.attributes;for(let n=s.length-1;n>=0;n--){let i=s[n].name;r?i.startsWith("data-")&&!e.hasAttribute(i)&&t.removeAttribute(i):e.hasAttribute(i)||t.removeAttribute(i)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||at.mergeAttrs(t,e,{except:["value"]}),e.readOnly?t.setAttribute("readonly",!0):t.removeAttribute("readonly")},hasSelectionRange:t=>t.setSelectionRange&&("text"===t.type||"textarea"===t.type),restoreFocus(t,e,n){if(!at.isTextualInput(t))return;let i=t.matches(":focus");t.readOnly&&t.blur(),i||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,n)},isFormInput:t=>/^(?:input|select|textarea)$/i.test(t.tagName)&&"button"!==t.type,syncAttrsToProps(t){t instanceof HTMLInputElement&&F.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=null!==t.getAttribute("checked"))},isTextualInput:t=>j.indexOf(t.type)>=0,isNowTriggerFormExternal:(t,e)=>t.getAttribute&&null!==t.getAttribute(e),syncPendingRef(t,e,n){let i=t.getAttribute(R);return null===i||(at.isFormInput(t)||null!==t.getAttribute(n)?(at.isUploadInput(t)&&at.mergeAttrs(t,e,{isIgnored:!0}),at.putPrivate(t,R,e),!1):(P.forEach(n=>{t.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(R,i),!0))},cleanChildNodes(t,e){if(at.isPhxUpdate(t,e,["append","prepend"])){let e=[];t.childNodes.forEach(t=>{if(!t.id){t.nodeType===Node.TEXT_NODE&&""===t.nodeValue.trim()||X(`only HTML element tags with an id are allowed inside containers with phx-update.\n\nremoving illegal node: "${(t.outerHTML||t.nodeValue).trim()}"\n\n`),e.push(t)}}),e.forEach(t=>t.remove())}},replaceRootContainer(t,e,n){let i=new Set(["id",H,B,"data-phx-main",O]);if(t.tagName.toLowerCase()===e.toLowerCase())return Array.from(t.attributes).filter(t=>!i.has(t.name.toLowerCase())).forEach(e=>t.removeAttribute(e.name)),Object.keys(n).filter(t=>!i.has(t.toLowerCase())).forEach(e=>t.setAttribute(e,n[e])),t;{let r=document.createElement(e);return Object.keys(n).forEach(t=>r.setAttribute(t,n[t])),i.forEach(e=>r.setAttribute(e,t.getAttribute(e))),r.innerHTML=t.innerHTML,t.replaceWith(r),r}},getSticky(t,e,n){let i=(at.private(t,"sticky")||[]).find(([t])=>e===t);if(i){let[t,e,n]=i;return n}return"function"==typeof n?n():n},deleteSticky(t,e){this.updatePrivate(t,"sticky",[],t=>t.filter(([t,n])=>t!==e))},putSticky(t,e,n){let i=n(t);this.updatePrivate(t,"sticky",[],t=>{let r=t.findIndex(([t])=>e===t);return r>=0?t[r]=[e,n,i]:t.push([e,n,i]),t})},applyStickyOperations(t){let e=at.private(t,"sticky");e&&e.forEach(([e,n,i])=>this.putSticky(t,e,n))}},lt=at,ut=class{static isActive(t,e){let n=void 0===e._phxRef,i=t.getAttribute("data-phx-active-refs").split(",").indexOf(ct.genFileRef(e))>=0;return e.size>0&&(n||i)}static isPreflighted(t,e){return t.getAttribute("data-phx-preflighted-refs").split(",").indexOf(ct.genFileRef(e))>=0&&this.isActive(t,e)}constructor(t,e,n){this.ref=ct.genFileRef(e),this.fileEl=t,this.file=e,this.view=n,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("phx:live-file:updated",this._onElUpdated)}metadata(){return this.meta}progress(t){this._progress=Math.floor(t),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{ct.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(t="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),ct.clearFiles(this.fileEl)}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener("phx:live-file:updated",this._onElUpdated),t()}}onElUpdated(){-1===this.fileEl.getAttribute("data-phx-active-refs").split(",").indexOf(this.ref)&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(t){if(this.meta.uploader){let e=t[this.meta.uploader]||X("no uploader configured for "+this.meta.uploader);return{name:this.meta.uploader,callback:e}}return{name:"channel",callback:rt}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||X("no preflight upload response returned with ref "+this.ref,{input:this.fileEl,response:t})}},ht=0,ct=class{static genFileRef(t){let e=t._phxRef;return void 0!==e?e:(t._phxRef=(ht++).toString(),t._phxRef)}static getEntryDataURL(t,e,n){let i=this.activeFiles(t).find(t=>this.genFileRef(t)===e);n(URL.createObjectURL(i))}static hasUploadsInProgress(t){let e=0;return lt.findUploadInputs(t).forEach(t=>{t.getAttribute("data-phx-preflighted-refs")!==t.getAttribute("data-phx-done-refs")&&e++}),e>0}static serializeUploads(t){let e=this.activeFiles(t),n={};return e.forEach(e=>{let i={path:t.name},r=t.getAttribute(I);n[r]=n[r]||[],i.ref=this.genFileRef(e),i.name=e.name||i.ref,i.type=e.type,i.size=e.size,n[r].push(i)}),n}static clearFiles(t){t.value=null,t.removeAttribute(I),lt.putPrivate(t,"files",[])}static untrackFile(t,e){lt.putPrivate(t,"files",lt.private(t,"files").filter(t=>!Object.is(t,e)))}static trackFiles(t,e){if(null!==t.getAttribute("multiple")){let n=e.filter(e=>!this.activeFiles(t).find(t=>Object.is(t,e)));lt.putPrivate(t,"files",this.activeFiles(t).concat(n)),t.value=null}else lt.putPrivate(t,"files",e)}static activeFileInputs(t){let e=lt.findUploadInputs(t);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(t){return(lt.private(t,"files")||[]).filter(e=>ut.isActive(t,e))}static inputsAwaitingPreflight(t){let e=lt.findUploadInputs(t);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(e=>!ut.isPreflighted(t,e))}constructor(t,e,n){this.view=e,this.onComplete=n,this._entries=Array.from(ct.filesAwaitingPreflight(t)||[]).map(n=>new ut(t,n,e)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(t,e,n){this._entries=this._entries.map(e=>(e.zipPostFlight(t),e.onDone(()=>{this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()}),e));let i=this._entries.reduce((t,e)=>{let{name:i,callback:r}=e.uploader(n.uploaders);return t[i]=t[i]||{callback:r,entries:[]},t[i].entries.push(e),t},{});for(let r in i){let{callback:o,entries:s}=i[r];o(s,e,t,n)}}},dt={LiveFileUpload:{activeRefs(){return this.el.getAttribute("data-phx-active-refs")},preflightedRefs(){return this.el.getAttribute("data-phx-preflighted-refs")},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let t=this.preflightedRefs();this.preflightedWas!==t&&(this.preflightedWas=t,""===t&&this.__view.cancelSubmit(this.el.form)),""===this.activeRefs()&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent("phx:live-file:updated"))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(I)),ct.getEntryDataURL(this.inputEl,this.ref,t=>{this.url=t,this.el.src=t})},destroyed(){URL.revokeObjectURL(this.url)}}};var ft="undefined"==typeof document?void 0:document,pt=!!ft&&"content"in ft.createElement("template"),gt=!!ft&&ft.createRange&&"createContextualFragment"in ft.createRange();function mt(t){return t=t.trim(),pt?function(t){var e=ft.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):gt?function(t){return K||(K=ft.createRange()).selectNode(ft.body),K.createContextualFragment(t).childNodes[0]}(t):function(t){var e=ft.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function vt(t,e){var n,i,r=t.nodeName,o=e.nodeName;return r===o||(n=r.charCodeAt(0),i=o.charCodeAt(0),n<=90&&i>=97?r===o.toUpperCase():i<=90&&n>=97&&o===r.toUpperCase())}function yt(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var bt={OPTION:function(t,e){var n=t.parentNode;if(n){var i=n.nodeName.toUpperCase();"OPTGROUP"===i&&(i=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==i||n.hasAttribute("multiple")||(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),n.selectedIndex=-1)}yt(t,e,"selected")},INPUT:function(t,e){yt(t,e,"checked"),yt(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n=e.value;t.value!==n&&(t.value=n);var i=t.firstChild;if(i){var r=i.nodeValue;if(r==n||!n&&r==t.placeholder)return;i.nodeValue=n}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var n,i,r=-1,o=0,s=t.firstChild;s;)if("OPTGROUP"===(i=s.nodeName&&s.nodeName.toUpperCase()))s=(n=s).firstChild;else{if("OPTION"===i){if(s.hasAttribute("selected")){r=o;break}o++}!(s=s.nextSibling)&&n&&(s=n.nextSibling,n=null)}t.selectedIndex=r}}};function wt(){}function _t(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var kt,Ct=(kt=function(t,e){var n,i,r,o,s=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var a=s.length-1;a>=0;a--)i=(n=s[a]).name,r=n.namespaceURI,o=n.value,r?(i=n.localName||i,t.getAttributeNS(r,i)!==o&&("xmlns"===n.prefix&&(i=n.name),t.setAttributeNS(r,i,o))):t.getAttribute(i)!==o&&t.setAttribute(i,o);for(var l=t.attributes,u=l.length-1;u>=0;u--)i=(n=l[u]).name,(r=n.namespaceURI)?(i=n.localName||i,e.hasAttributeNS(r,i)||t.removeAttributeNS(r,i)):e.hasAttribute(i)||t.removeAttribute(i)}},function(t,e,n){if(n||(n={}),"string"==typeof e)if("#document"===t.nodeName||"HTML"===t.nodeName||"BODY"===t.nodeName){var i=e;(e=ft.createElement("html")).innerHTML=i}else e=mt(e);var r=n.getNodeKey||_t,o=n.onBeforeNodeAdded||wt,s=n.onNodeAdded||wt,a=n.onBeforeElUpdated||wt,l=n.onElUpdated||wt,u=n.onBeforeNodeDiscarded||wt,h=n.onNodeDiscarded||wt,c=n.onBeforeElChildrenUpdated||wt,d=!0===n.childrenOnly,f=Object.create(null),p=[];function g(t){p.push(t)}function m(t,e,n){!1!==u(t)&&(e&&e.removeChild(t),h(t),function t(e,n){if(1===e.nodeType)for(var i=e.firstChild;i;){var o=void 0;n&&(o=r(i))?g(o):(h(i),i.firstChild&&t(i,n)),i=i.nextSibling}}(t,n))}function v(t){s(t);for(var e=t.firstChild;e;){var n=e.nextSibling,i=r(e);if(i){var o=f[i];o&&vt(e,o)?(e.parentNode.replaceChild(o,e),y(o,e)):v(e)}else v(e);e=n}}function y(t,e,n){var i=r(e);if(i&&delete f[i],!n){if(!1===a(t,e))return;if(kt(t,e),l(t),!1===c(t,e))return}"TEXTAREA"!==t.nodeName?function(t,e){var n,i,s,a,l,u=e.firstChild,h=t.firstChild;t:for(;u;){for(a=u.nextSibling,n=r(u);h;){if(s=h.nextSibling,u.isSameNode&&u.isSameNode(h)){u=a,h=s;continue t}i=r(h);var c=h.nodeType,d=void 0;if(c===u.nodeType&&(1===c?(n?n!==i&&((l=f[n])?s===l?d=!1:(t.insertBefore(l,h),i?g(i):m(h,t,!0),h=l):d=!1):i&&(d=!1),(d=!1!==d&&vt(h,u))&&y(h,u)):3!==c&&8!=c||(d=!0,h.nodeValue!==u.nodeValue&&(h.nodeValue=u.nodeValue))),d){u=a,h=s;continue t}i?g(i):m(h,t,!0),h=s}if(n&&(l=f[n])&&vt(l,u))t.appendChild(l),y(l,u);else{var p=o(u);!1!==p&&(p&&(u=p),u.actualize&&(u=u.actualize(t.ownerDocument||ft)),t.appendChild(u),v(u))}u=a,h=s}!function(t,e,n){for(;e;){var i=e.nextSibling;(n=r(e))?g(n):m(e,t,!0),e=i}}(t,h,i);var b=bt[t.nodeName];b&&b(t,e)}(t,e):bt.TEXTAREA(t,e)}!function t(e){if(1===e.nodeType||11===e.nodeType)for(var n=e.firstChild;n;){var i=r(n);i&&(f[i]=n),t(n),n=n.nextSibling}}(t);var b,w,_=t,k=_.nodeType,C=e.nodeType;if(!d)if(1===k)1===C?vt(t,e)||(h(t),_=function(t,e){for(var n=t.firstChild;n;){var i=n.nextSibling;e.appendChild(n),n=i}return e}(t,(b=e.nodeName,(w=e.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==w?ft.createElementNS(w,b):ft.createElement(b)))):_=e;else if(3===k||8===k){if(C===k)return _.nodeValue!==e.nodeValue&&(_.nodeValue=e.nodeValue),_;_=e}if(_===e)h(t);else{if(e.isSameNode&&e.isSameNode(_))return;if(y(_,e,d),p)for(var x=0,E=p.length;x{if(n&&n.isSameNode(t)&<.isFormInput(t))return lt.mergeFocusedInput(t,e),!1}})}constructor(t,e,n,i,r){this.view=t,this.liveSocket=t.liveSocket,this.container=e,this.id=n,this.rootID=t.root.id,this.html=i,this.targetCID=r,this.cidPatch=G(this.targetCID),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(t,e){this.callbacks["before"+t].push(e)}after(t,e){this.callbacks["after"+t].push(e)}trackBefore(t,...e){this.callbacks["before"+t].forEach(t=>t(...e))}trackAfter(t,...e){this.callbacks["after"+t].forEach(t=>t(...e))}markPrunableContentForRemoval(){lt.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",t=>{t.setAttribute("data-phx-prune","")})}perform(){let{view:t,liveSocket:e,container:n,html:i}=this,r=this.isCIDPatch()?this.targetCIDContainer(i):n;if(this.isCIDPatch()&&!r)return;let o=e.getActiveElement(),{selectionStart:s,selectionEnd:a}=o&<.hasSelectionRange(o)?o:{},l=e.binding("update"),u=e.binding("feedback-for"),h=e.binding("disable-with"),c=e.binding("trigger-action"),d=e.binding("remove"),f=[],p=[],g=[],m=[],v=null,y=e.time("premorph container prep",()=>this.buildDiffHTML(n,i,l,r));return this.trackBefore("added",n),this.trackBefore("updated",n,n),e.time("morphdom",()=>{Ct(r,y,{childrenOnly:null===r.getAttribute(N),getNodeKey:t=>lt.isPhxDestroyed(t)?null:t.id,onBeforeNodeAdded:t=>(this.trackBefore("added",t),t),onNodeAdded:e=>{e instanceof HTMLImageElement&&e.srcset?e.srcset=e.srcset:e instanceof HTMLVideoElement&&e.autoplay&&e.play(),lt.isNowTriggerFormExternal(e,c)&&(v=e),lt.discardError(r,e,u),lt.isPhxChild(e)&&t.ownsElement(e)&&this.trackAfter("phxChildAdded",e),f.push(e)},onNodeDiscarded:t=>{lt.isPhxChild(t)&&e.destroyViewByEl(t),this.trackAfter("discarded",t)},onBeforeNodeDiscarded:t=>!(!t.getAttribute||null===t.getAttribute("data-phx-prune"))||(null===t.parentNode||!lt.isPhxUpdate(t.parentNode,l,["append","prepend"])||!t.id)&&(t.getAttribute&&t.getAttribute(d)?(m.push(t),!1):!this.skipCIDSibling(t)),onElUpdated:t=>{lt.isNowTriggerFormExternal(t,c)&&(v=t),p.push(t)},onBeforeElUpdated:(t,e)=>{if(lt.cleanChildNodes(e,l),this.skipCIDSibling(e))return!1;if(lt.isIgnored(t,l))return this.trackBefore("updated",t,e),lt.mergeAttrs(t,e,{isIgnored:!0}),p.push(t),lt.applyStickyOperations(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;if(!lt.syncPendingRef(t,e,h))return lt.isUploadInput(t)&&(this.trackBefore("updated",t,e),p.push(t)),lt.applyStickyOperations(t),!1;if(lt.isPhxChild(e)){let n=t.getAttribute(H);return lt.mergeAttrs(t,e,{exclude:[B]}),""!==n&&t.setAttribute(H,n),t.setAttribute(O,this.rootID),lt.applyStickyOperations(t),!1}return lt.copyPrivates(e,t),lt.discardError(r,e,u),o&&t.isSameNode(o)&<.isFormInput(t)?(this.trackBefore("updated",t,e),lt.mergeFocusedInput(t,e),lt.syncAttrsToProps(t),p.push(t),lt.applyStickyOperations(t),!1):(lt.isPhxUpdate(e,l,["append","prepend"])&&g.push(new class{constructor(t,e,n){let i=new Set,r=new Set([...e.children].map(t=>t.id)),o=[];Array.from(t.children).forEach(t=>{if(t.id&&(i.add(t.id),r.has(t.id))){let e=t.previousElementSibling&&t.previousElementSibling.id;o.push({elementId:t.id,previousElementId:e})}}),this.containerId=e.id,this.updateType=n,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(t=>!i.has(t))}perform(){let t=lt.byId(this.containerId);this.elementsToModify.forEach(e=>{e.previousElementId?it(document.getElementById(e.previousElementId),t=>{it(document.getElementById(e.elementId),e=>{e.previousElementSibling&&e.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",e)})}):it(document.getElementById(e.elementId),e=>{null==e.previousElementSibling||t.insertAdjacentElement("afterbegin",e)})}),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach(e=>{it(document.getElementById(e),e=>t.insertAdjacentElement("afterbegin",e))})}}(t,e,e.getAttribute(l))),lt.syncAttrsToProps(e),lt.applyStickyOperations(e),this.trackBefore("updated",t,e),!0)}})}),e.isDebugEnabled()&&function(){let t=new Set,e=document.querySelectorAll("*[id]");for(let n=0,i=e.length;n0&&e.time("post-morph append/prepend restoration",()=>{g.forEach(t=>t.perform())}),e.silenceEvents(()=>lt.restoreFocus(o,s,a)),lt.dispatchEvent(document,"phx:update"),f.forEach(t=>this.trackAfter("added",t)),p.forEach(t=>this.trackAfter("updated",t)),m.length>0&&(e.transitionRemoves(m),e.requestDOMUpdate(()=>{m.forEach(t=>{let n=lt.firstPhxChild(t);n&&e.destroyViewByEl(n),t.remove()}),this.trackAfter("transitionsDiscarded",m)})),v&&(e.disconnect(),v.submit()),!0}isCIDPatch(){return this.cidPatch}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&null!==t.getAttribute("data-phx-skip")}targetCIDContainer(t){if(!this.isCIDPatch())return;let[e,...n]=lt.findComponentNodeList(this.container,this.targetCID);return 0===n.length&&1===lt.childNodeLength(t)?e:e&&e.parentNode}buildDiffHTML(t,e,n,i){let r=this.isCIDPatch(),o=r&&i.getAttribute(N)===this.targetCID.toString();if(!r||o)return e;{let t=null,n=document.createElement("template");t=lt.cloneNode(i);let[r,...o]=lt.findComponentNodeList(t,this.targetCID);return n.innerHTML=e,o.forEach(t=>t.remove()),Array.from(t.childNodes).forEach(t=>{t.id&&t.nodeType===Node.ELEMENT_NODE&&t.getAttribute(N)!==this.targetCID.toString()&&(t.setAttribute("data-phx-skip",""),t.innerHTML="")}),Array.from(n.content.childNodes).forEach(e=>t.insertBefore(e,r)),r.remove(),t.outerHTML}}},Et=class{static extract(t){let{[Y]:e,[z]:n,[W]:i}=t;return delete t[Y],delete t[z],delete t[W],{diff:t,title:i,reply:e||null,events:n||[]}}constructor(t,e){this.viewId=t,this.rendered={},this.mergeDiff(e)}parentViewId(){return this.viewId}toString(t){return this.recursiveToString(this.rendered,this.rendered.c,t)}recursiveToString(t,e=t.c,n){let i={buffer:"",components:e,onlyCids:n=n?new Set(n):null};return this.toOutputBuffer(t,null,i),i.buffer}componentCIDs(t){return Object.keys(t.c||{}).map(t=>parseInt(t))}isComponentOnlyDiff(t){return!!t.c&&1===Object.keys(t).length}getComponent(t,e){return t.c[e]}mergeDiff(t){let e=t.c,n={};if(delete t.c,this.rendered=this.mutableMerge(this.rendered,t),this.rendered.c=this.rendered.c||{},e){let i=this.rendered.c;for(let t in e)e[t]=this.cachedFindComponent(t,e[t],i,e,n);for(let t in e)i[t]=e[t];t.c=e}}cachedFindComponent(t,e,n,i,r){if(r[t])return r[t];{let o,s,a=e[J];if(G(a)){let t;t=a>0?this.cachedFindComponent(a,i[a],n,i,r):n[-a],s=t[J],o=this.cloneMerge(t,e),o[J]=s}else o=void 0!==e[J]?e:this.cloneMerge(n[t]||{},e);return r[t]=o,o}}mutableMerge(t,e){return void 0!==e[J]?e:(this.doMutableMerge(t,e),t)}doMutableMerge(t,e){for(let n in e){let i=e[n],r=t[n];et(i)&&void 0===i[J]&&et(r)?this.doMutableMerge(r,i):t[n]=i}}cloneMerge(t,e){let n={...t,...e};for(let i in n){let r=e[i],o=t[i];et(r)&&void 0===r[J]&&et(o)&&(n[i]=this.cloneMerge(o,r))}return n}componentToString(t){return this.recursiveCIDToString(this.rendered.c,t)}pruneCIDs(t){t.forEach(t=>delete this.rendered.c[t])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[J]}templateStatic(t,e){return"number"==typeof t?e[t]:t}toOutputBuffer(t,e,n){if(t[V])return this.comprehensionToBuffer(t,e,n);let{[J]:i}=t;i=this.templateStatic(i,e),n.buffer+=i[0];for(let r=1;ri.nodeType===Node.ELEMENT_NODE?i.getAttribute(N)?[t,!0]:(i.setAttribute(N,e),i.id||(i.id=`${this.parentViewId()}-${e}-${o}`),s&&(i.setAttribute("data-phx-skip",""),i.innerHTML=""),[!0,n]):""!==i.nodeValue.trim()?(X(`only HTML element tags are allowed at the root of components.\n\ngot: "${i.nodeValue.trim()}"\n\nwithin:\n`,r.innerHTML.trim()),i.replaceWith(this.createSpan(i.nodeValue,e)),[!0,n]):(i.remove(),[t,n]),[!1,!1]);return a||l?!a&&l?(X("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",r.innerHTML.trim()),r.innerHTML):r.innerHTML:(X("expected at least one HTML element tag inside a component, but the component is empty:\n",r.innerHTML.trim()),this.createSpan("",e).outerHTML)}createSpan(t,e){let n=document.createElement("span");return n.innerText=t,n.setAttribute(N,e),n}},At=1,St=class{static makeID(){return At++}static elementID(t){return t.phxHookId}constructor(t,e,n){this.__view=t,this.__liveSocket=t.liveSocket,this.__callbacks=n,this.__listeners=new Set,this.__isDisconnected=!1,this.el=e,this.el.phxHookId=this.constructor.makeID();for(let t in this.__callbacks)this[t]=this.__callbacks[t]}__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(t,e={},n=function(){}){return this.__view.pushHookEvent(null,t,e,n)}pushEventTo(t,e,n={},i=function(){}){return this.__view.withinTargets(t,(t,r)=>t.pushHookEvent(r,e,n,i))}handleEvent(t,e){let n=(n,i)=>i?t:e(n.detail);return window.addEventListener("phx:"+t,n),this.__listeners.add(n),n}removeHandleEvent(t){let e=t(null,!0);window.removeEventListener("phx:"+e,t),this.__listeners.delete(t)}upload(t,e){return this.__view.dispatchUploads(t,e)}uploadTo(t,e,n){return this.__view.withinTargets(t,t=>t.dispatchUploads(e,n))}__cleanup__(){this.__listeners.forEach(t=>this.removeHandleEvent(t))}},Tt={exec(t,e,n,i,r){let[o,s]=r||[null,{}];("["===e.charAt(0)?JSON.parse(e):[[o,s]]).forEach(([r,a])=>{r===o&&s.data&&(a.data=Object.assign(a.data||{},s.data)),this["exec_"+r](t,e,n,i,a)})},isVisible(t){let e=window.getComputedStyle(t);return!(0===e.opacity||"none"===e.display)},exec_dispatch(t,e,n,i,{to:r,event:o,detail:s}){r?lt.all(document,r,t=>lt.dispatchEvent(t,o,s)):lt.dispatchEvent(i,o,s)},exec_push(t,e,n,i,r){let{event:o,data:s,target:a,page_loading:l,loading:u,value:h}=r,c={page_loading:!!l,loading:u,value:h},d="change"===t?i.form:i,f=a||d.getAttribute(n.binding("target"))||d;n.withinTargets(f,(n,a)=>{if("change"===t){let{newCid:t,_target:s,callback:l}=r;s&&(c._target=s),n.pushInput(i,a,t,o||e,c,l)}else"submit"===t?n.submitForm(i,a,o||e,c):n.pushEvent(t,i,a,o||e,s,c)})},exec_add_class(t,e,n,i,{to:r,names:o,transition:s,time:a}){r?lt.all(document,r,t=>this.addOrRemoveClasses(t,o,[],s,a,n)):this.addOrRemoveClasses(i,o,[],s,n)},exec_remove_class(t,e,n,i,{to:r,names:o,transition:s,time:a}){r?lt.all(document,r,t=>this.addOrRemoveClasses(t,[],o,s,a,n)):this.addOrRemoveClasses(i,[],o,s,a,n)},exec_transition(t,e,n,i,{time:r,to:o,transition:s}){let a=o?lt.all(document,o):[i],[l,u,h]=s;a.forEach(t=>{n.transition(r,()=>this.addOrRemoveClasses(t,l.concat(u),[]),()=>this.addOrRemoveClasses(t,h,l.concat(u)))})},exec_toggle(t,e,n,i,{to:r,display:o,ins:s,outs:a,time:l}){r?lt.all(document,r,e=>this.toggle(t,n,e,o,s,a,l)):this.toggle(t,n,i,o,s,a,l)},exec_show(t,e,n,i,{to:r,display:o,transition:s,time:a}){r?lt.all(document,r,e=>this.show(t,n,e,o,s,a)):this.show(t,n,i,s,a)},exec_hide(t,e,n,i,{to:r,display:o,transition:s,time:a}){r?lt.all(document,r,e=>this.hide(t,n,e,o,s,a)):this.hide(t,n,i,o,s,a)},show(t,e,n,i,r,o){this.isVisible(n)||this.toggle(t,e,n,i,r,null,o)},hide(t,e,n,i,r,o){this.isVisible(n)&&this.toggle(t,e,n,i,null,r,o)},toggle(t,e,n,i,r,o,s){let[a,l,u]=r||[[],[],[]],[h,c,d]=o||[[],[],[]];if(a.length>0||h.length>0)if(this.isVisible(n)){let t=()=>{this.addOrRemoveClasses(n,c,a.concat(l).concat(u)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,h,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,d,c))})};e.transition(s,t,()=>{this.addOrRemoveClasses(n,[],h.concat(d)),lt.putSticky(n,"toggle",t=>t.style.display="none")})}else{if("remove"===t)return;let r=()=>{this.addOrRemoveClasses(n,l,h.concat(c).concat(d)),lt.putSticky(n,"toggle",t=>t.style.display=i||"block"),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,u,l))})};e.transition(s,r,()=>{this.addOrRemoveClasses(n,[],a.concat(u))})}else{let t=this.isVisible(n)?"none":i||"block";lt.putSticky(n,"toggle",e=>e.style.display=t)}},addOrRemoveClasses(t,e,n,i,r,o){let[s,a,l]=i||[[],[],[]];if(s.length>0){let i=()=>this.addOrRemoveClasses(t,a.concat(s),[]),u=()=>this.addOrRemoveClasses(t,e.concat(l),n.concat(s).concat(a));return o.transition(r,i,u)}window.requestAnimationFrame(()=>{let[i,r]=lt.getSticky(t,"classes",[[],[]]),o=e.filter(e=>i.indexOf(e)<0&&!t.classList.contains(e)),s=n.filter(e=>r.indexOf(e)<0&&t.classList.contains(e)),a=i.filter(t=>n.indexOf(t)<0).concat(o),l=r.filter(t=>e.indexOf(t)<0).concat(s);lt.putSticky(t,"classes",t=>(t.classList.remove(...l),t.classList.add(...a),[a,l]))})},hasAllClasses:(t,e)=>e.every(e=>t.classList.contains(e)),isToggledOut(t,e){return!this.isVisible(t)||this.hasAllClasses(t,e)}},Mt=(t,e={})=>{let n=new FormData(t),i=[];n.forEach((t,e,n)=>{t instanceof File&&i.push(e)}),i.forEach(t=>n.delete(t));let r=new URLSearchParams;for(let[t,e]of n.entries())r.append(t,e);for(let t in e)r.append(t,e[t]);return r.toString()},Lt=class{constructor(t,e,n,i){this.liveSocket=e,this.flash=i,this.parent=n,this.root=n?n.root:this,this.el=t,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(t){t&&t()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel("lv:"+this.id,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(),session:this.getSession(),static:this.getStatic(),flash:this.flash})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return this.liveSocket.main===this}connectParams(){let t=this.liveSocket.params(this.el),e=lt.all(document,`[${this.binding("track-static")}]`).map(t=>t.src||t.href).filter(t=>"string"==typeof t);return e.length>0&&(t._track_static=e),t._mounts=this.joinCount,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(H)}getStatic(){let t=this.el.getAttribute(B);return""===t?null:t}destroy(t=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let e=()=>{t();for(let t in this.viewHooks)this.destroyHook(this.viewHooks[t])};lt.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",e).receive("error",e).receive("timeout",e)}setContainerClasses(...t){this.el.classList.remove("phx-connected","phx-loading","phx-error"),this.el.classList.add(...t)}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses("phx-loading")}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses("phx-connected")}triggerReconnected(){for(let t in this.viewHooks)this.viewHooks[t].__reconnected()}log(t,e){this.liveSocket.log(this,t,e)}transition(t,e,n=function(){}){this.liveSocket.transition(t,e,n)}withinTargets(t,e){if(t instanceof HTMLElement||t instanceof SVGElement)return this.liveSocket.owner(t,n=>e(n,t));if(G(t)){0===lt.findComponentNodeList(this.el,t).length?X("no component found matching phx-target of "+t):e(this,parseInt(t))}else{let n=Array.from(document.querySelectorAll(t));0===n.length&&X(`nothing found matching the phx-target selector "${t}"`),n.forEach(t=>this.liveSocket.owner(t,n=>e(n,t)))}}applyDiff(t,e,n){this.log(t,()=>["",Q(e)]);let{diff:i,reply:r,events:o,title:s}=Et.extract(e);return s&<.putTitle(s),n({diff:i,reply:r,events:o}),r}onJoin(t){let{rendered:e,container:n}=t;if(n){let[t,e]=n;this.el=lt.replaceRootContainer(this.el,t,e)}this.childJoins=0,this.joinPending=!0,this.flash=null,st.dropLocal(this.liveSocket.localStorage,window.location.pathname,"consecutive-reloads"),this.applyDiff("mount",e,({diff:e,events:n})=>{this.rendered=new Et(this.id,e);let i=this.renderContainer(null,"join");this.dropPendingRefs();let r=this.formsForRecovery(i);this.joinCount++,r.length>0?r.forEach(([t,e,o],s)=>{this.pushFormRecovery(t,o,t=>{s===r.length-1&&this.onJoinComplete(t,i,n)})}):this.onJoinComplete(t,i,n)})}dropPendingRefs(){lt.all(this.el,`[${R}]`,t=>t.removeAttribute(R))}onJoinComplete({live_patch:t},e,n){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,e,n);0===lt.findPhxChildrenInFragment(e,this.id).filter(t=>{let e=t.id&&this.el.querySelector(`[id="${t.id}"]`),n=e&&e.getAttribute(B);return n&&t.setAttribute(B,n),this.joinChild(t)}).length?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(t,e,n)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n)])}attachTrueDocEl(){this.el=lt.byId(this.id),this.el.setAttribute(O,this.root.id)}applyJoinPatch(t,e,n){this.attachTrueDocEl();let i=new xt(this,this.el,this.id,e,null);if(i.markPrunableContentForRemoval(),this.performPatch(i,!1),this.joinNewChildren(),lt.all(this.el,`[${this.binding("hook")}], [data-phx-hook]`,t=>{let e=this.addHook(t);e&&e.__mounted()}),this.joinPending=!1,this.liveSocket.dispatchEvents(n),this.applyPendingUpdates(),t){let{kind:e,to:n}=t;this.liveSocket.historyPatch(n,e)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(t,e){this.liveSocket.triggerDOM("onBeforeElUpdated",[t,e]);let n=this.getHook(t),i=n&<.isIgnored(t,this.binding("update"));if(n&&!t.isEqualNode(e)&&(!i||(r=t.dataset,o=e.dataset,JSON.stringify(r)!==JSON.stringify(o))))return n.__beforeUpdate(),n;var r,o}performPatch(t,e){let n=[],i=!1,r=new Set;return t.after("added",t=>{this.liveSocket.triggerDOM("onNodeAdded",[t]);let e=this.addHook(t);e&&e.__mounted()}),t.after("phxChildAdded",t=>i=!0),t.before("updated",(t,e)=>{this.triggerBeforeUpdateHook(t,e)&&r.add(t.id)}),t.after("updated",t=>{r.has(t.id)&&this.getHook(t).__updated()}),t.after("discarded",t=>{t.nodeType===Node.ELEMENT_NODE&&n.push(t)}),t.after("transitionsDiscarded",t=>this.afterElementsRemoved(t,e)),t.perform(),this.afterElementsRemoved(n,e),i}afterElementsRemoved(t,e){let n=[];t.forEach(t=>{lt.all(t,`[${N}]`).concat(t).forEach(t=>{let e=this.componentID(t);G(e)&&-1===n.indexOf(e)&&n.push(e);let i=this.getHook(t);i&&this.destroyHook(i)})}),e&&this.maybePushComponentsDestroyed(n)}joinNewChildren(){lt.findPhxChildren(this.el,this.id).forEach(t=>this.joinChild(t))}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){return t.id===this.id?this:this.children[t.getAttribute(U)][t.id]}destroyDescendent(t){for(let e in this.root.children)for(let n in this.root.children[e])if(n===t)return this.root.children[e][n].destroy()}joinChild(t){if(!this.getChildById(t.id)){let e=new Lt(t,this.liveSocket,this);return this.root.children[this.id][e.id]=e,e.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(t){this.childJoins--,0===this.childJoins&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([t,e])=>{t.isDestroyed()||e()}),this.pendingJoinOps=[]})}update(t,e){if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.pendingDiffs.push({diff:t,events:e});this.rendered.mergeDiff(t);let n=!1;this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{lt.findParentCIDs(this.el,this.rendered.componentCIDs(t)).forEach(e=>{this.componentPatch(this.rendered.getComponent(t,e),e)&&(n=!0)})}):nt(t)||this.liveSocket.time("full patch complete",()=>{let e=this.renderContainer(t,"update"),i=new xt(this,this.el,this.id,e,null);n=this.performPatch(i,!0)}),this.liveSocket.dispatchEvents(e),n&&this.joinNewChildren()}renderContainer(t,e){return this.liveSocket.time(`toString diff (${e})`,()=>{let e=this.el.tagName,n=t?this.rendered.componentCIDs(t).concat(this.pruningCIDs):null;return`<${e}>${this.rendered.toString(n)}`})}componentPatch(t,e){if(nt(t))return!1;let n=this.rendered.componentToString(e),i=new xt(this,this.el,this.id,n,e);return this.performPatch(i,!0)}getHook(t){return this.viewHooks[St.elementID(t)]}addHook(t){if(St.elementID(t)||!t.getAttribute)return;let e=t.getAttribute("data-phx-hook")||t.getAttribute(this.binding("hook"));if(e&&!this.ownsElement(t))return;let n=this.liveSocket.getHookCallbacks(e);if(n){t.id||X(`no DOM ID for hook "${e}". Hooks require a unique ID on each element.`,t);let i=new St(this,t,n);return this.viewHooks[St.elementID(i.el)]=i,i}null!==e&&X(`unknown hook found for "${e}"`,t)}destroyHook(t){t.__destroyed(),t.__cleanup__(),delete this.viewHooks[St.elementID(t.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:t,events:e})=>this.update(t,e)),this.pendingDiffs=[]}onChannel(t,e){this.liveSocket.onChannel(this.channel,t,t=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>e(t)]):this.liveSocket.requestDOMUpdate(()=>e(t))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",t=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",t,({diff:t,events:e})=>this.update(t,e))})}),this.onChannel("redirect",({to:t,flash:e})=>this.onRedirect({to:t,flash:e})),this.onChannel("live_patch",t=>this.onLivePatch(t)),this.onChannel("live_redirect",t=>this.onLiveRedirect(t)),this.channel.onError(t=>this.onError(t)),this.channel.onClose(t=>this.onClose(t))}destroyAllChildren(){for(let t in this.root.children[this.id])this.getChildById(t).destroy()}onLiveRedirect(t){let{to:e,kind:n,flash:i}=t,r=this.expandURL(e);this.liveSocket.historyRedirect(r,n,i)}onLivePatch(t){let{to:e,kind:n}=t;this.href=this.expandURL(e),this.liveSocket.historyPatch(e,n)}expandURL(t){return t.startsWith("/")?`${window.location.protocol}//${window.location.host}${t}`:t}onRedirect({to:t,flash:e}){this.liveSocket.redirect(t,e)}isDestroyed(){return this.destroyed}join(t){this.parent||(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=e=>{e=e||function(){},t?t(this.joinCount,e):e()},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(t){return"unauthorized"===t.reason||"stale"===t.reason?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),this.onRedirect({to:this.href})):((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect?this.onRedirect(t.redirect):t.live_redirect?this.onLiveRedirect(t.live_redirect):(this.log("error",()=>["unable to join",t]),this.liveSocket.reloadWithJitter(this)))}onClose(t){if(!this.isDestroyed()){if(this.isJoinPending()&&"hidden"!==document.visibilityState||this.liveSocket.hasPendingLink()&&"leave"!==t)return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(200)}}onError(t){this.onClose(t),this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&<.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses("phx-loading","phx-error")}pushWithReply(t,e,n,i=function(){}){if(!this.isConnected())return;let[r,[o],s]=t?t():[null,[],{}],a=function(){};return(s.page_loading||o&&null!==o.getAttribute(this.binding("page-loading")))&&(a=this.liveSocket.withPageLoading({kind:"element",target:o})),"number"!=typeof n.cid&&delete n.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(e,n,3e4).receive("ok",t=>{this.liveSocket.requestDOMUpdate(()=>{let e=null;null!==r&&this.undoRefs(r),t.diff&&(e=this.applyDiff("update",t.diff,({diff:t,events:e})=>{this.update(t,e)})),t.redirect&&this.onRedirect(t.redirect),t.live_patch&&this.onLivePatch(t.live_patch),t.live_redirect&&this.onLiveRedirect(t.live_redirect),a(),i(t,e)})}))}undoRefs(t){lt.all(this.el,`[${R}="${t}"]`,t=>{let e=t.getAttribute("data-phx-disabled");t.removeAttribute(R),null!==t.getAttribute("data-phx-readonly")&&(t.readOnly=!1,t.removeAttribute("data-phx-readonly")),null!==e&&(t.disabled="true"===e,t.removeAttribute("data-phx-disabled")),P.forEach(e=>lt.removeClass(t,e));let n=t.getAttribute("data-phx-disable-with-restore");null!==n&&(t.innerText=n,t.removeAttribute("data-phx-disable-with-restore"));let i=lt.private(t,R);if(i){let e=this.triggerBeforeUpdateHook(t,i);xt.patchEl(t,i,this.liveSocket.getActiveElement()),e&&e.__updated(),lt.deletePrivate(t,R)}})}putRef(t,e,n={}){let i=this.ref++,r=this.binding("disable-with");return n.loading&&(t=t.concat(lt.all(document,n.loading))),t.forEach(t=>{t.classList.add(`phx-${e}-loading`),t.setAttribute(R,i);let n=t.getAttribute(r);null!==n&&(t.getAttribute("data-phx-disable-with-restore")||t.setAttribute("data-phx-disable-with-restore",t.innerText),t.innerText=n)}),[i,t,n]}componentID(t){let e=t.getAttribute&&t.getAttribute(N);return e?parseInt(e):null}targetComponentID(t,e){if(G(e))return e;let n=t.getAttribute(this.binding("target"));return G(n)?parseInt(n):e&&null!==n?this.closestComponentID(e):null}closestComponentID(t){return G(t)?t:t?it(t.closest(`[${N}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(t,e,n,i){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",e,n]),!1;let[r,o,s]=this.putRef([],"hook");return this.pushWithReply(()=>[r,o,s],"event",{type:"hook",event:e,value:n,cid:this.closestComponentID(t)},(t,e)=>i(e,r)),r}extractMeta(t,e,n){let i=this.binding("value-");for(let n=0;n=0&&!t.checked&&delete e.value),n){e||(e={});for(let t in n)e[t]=n[t]}return e}pushEvent(t,e,n,i,r,o={}){this.pushWithReply(()=>this.putRef([e],t,o),"event",{type:t,event:i,value:this.extractMeta(e,r,o.value),cid:this.targetComponentID(e,n)})}pushFileProgress(t,e,n,i=function(){}){this.liveSocket.withinOwners(t.form,(r,o)=>{r.pushWithReply(null,"progress",{event:t.getAttribute(r.binding("progress")),ref:t.getAttribute(I),entry_ref:e,progress:n,cid:r.targetComponentID(t.form,o)},i)})}pushInput(t,e,n,i,r,o){let s,a=G(n)?n:this.targetComponentID(t.form,e),l=()=>this.putRef([t,t.form],"change",r),u=Mt(t.form,{_target:r._target});lt.isUploadInput(t)&&t.files&&t.files.length>0&&ct.trackFiles(t,Array.from(t.files)),s=ct.serializeUploads(t);let h={type:"form",event:i,value:u,uploads:s,cid:a};this.pushWithReply(l,"event",h,n=>{if(lt.showError(t,this.liveSocket.binding("feedback-for")),lt.isUploadInput(t)&&null!==t.getAttribute("data-phx-auto-upload")){if(ct.filesAwaitingPreflight(t).length>0){let[i,r]=l();this.uploadFiles(t.form,e,i,a,e=>{o&&o(n),this.triggerAwaitingSubmit(t.form)})}}else o&&o(n)})}triggerAwaitingSubmit(t){let e=this.getScheduledSubmit(t);if(e){let[n,i,r,o]=e;this.cancelSubmit(t),o()}}getScheduledSubmit(t){return this.formSubmits.find(([e,n,i,r])=>e.isSameNode(t))}scheduleSubmit(t,e,n,i){if(this.getScheduledSubmit(t))return!0;this.formSubmits.push([t,e,n,i])}cancelSubmit(t){this.formSubmits=this.formSubmits.filter(([e,n,i])=>!e.isSameNode(t)||(this.undoRefs(n),!1))}pushFormSubmit(t,e,n,i,r){let o=t=>!(tt(t,this.binding("update")+"=ignore",t.form)||tt(t,"data-phx-update=ignore",t.form)),s=t=>t.hasAttribute(this.binding("disable-with")),a=t=>"BUTTON"==t.tagName,l=t=>["INPUT","TEXTAREA","SELECT"].includes(t.tagName),u=()=>{let e=Array.from(t.elements),n=e.filter(s),r=e.filter(a).filter(o),u=e.filter(l).filter(o);return r.forEach(t=>{t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0}),u.forEach(t=>{t.setAttribute("data-phx-readonly",t.readOnly),t.readOnly=!0,t.files&&(t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0)}),t.setAttribute(this.binding("page-loading"),""),this.putRef([t].concat(n).concat(r).concat(u),"submit",i)},h=this.targetComponentID(t,e);if(ct.hasUploadsInProgress(t)){let[o,s]=u(),a=()=>this.pushFormSubmit(t,e,n,i,r);return this.scheduleSubmit(t,o,i,a)}if(ct.inputsAwaitingPreflight(t).length>0){let[o,s]=u(),a=()=>[o,s,i];this.uploadFiles(t,e,o,h,e=>{let i=Mt(t,{});this.pushWithReply(a,"event",{type:"form",event:n,value:i,cid:h},r)})}else{let e=Mt(t);this.pushWithReply(u,"event",{type:"form",event:n,value:e,cid:h},r)}}uploadFiles(t,e,n,i,r){let o=this.joinCount,s=ct.activeFileInputs(t),a=s.length;s.forEach(t=>{let i=new ct(t,this,()=>{a--,0===a&&r()});this.uploaders[t]=i;let s=i.entries().map(t=>t.toPreflightPayload()),l={ref:t.getAttribute(I),entries:s,cid:this.targetComponentID(t.form,e)};this.log("upload",()=>["sending preflight request",l]),this.pushWithReply(null,"allow_upload",l,t=>{if(this.log("upload",()=>["got preflight response",t]),t.error){this.undoRefs(n);let[e,i]=t.error;this.log("upload",()=>["error for entry "+e,i])}else{let e=t=>{this.channel.onError(()=>{this.joinCount===o&&t()})};i.initAdapterUpload(t,e,this.liveSocket)}})})}dispatchUploads(t,e){let n=lt.findUploadInputs(this.el).filter(e=>e.name===t);0===n.length?X(`no live file inputs found matching the name "${t}"`):n.length>1?X(`duplicate live file inputs found matching the name "${t}"`):lt.dispatchEvent(n[0],"track-uploads",{files:e})}pushFormRecovery(t,e,n){this.liveSocket.withinOwners(t,(i,r)=>{let o=t.elements[0],s=t.getAttribute(this.binding("auto-recover"))||t.getAttribute(this.binding("change"));Tt.exec("change",s,i,o,["push",{_target:o.name,newCid:e,callback:n}])})}pushLinkPatch(t,e,n){let i=this.liveSocket.setPendingLink(t),r=e?()=>this.putRef([e],"click"):null;this.pushWithReply(r,"live_patch",{url:t},e=>{this.liveSocket.requestDOMUpdate(()=>{e.link_redirect?this.liveSocket.replaceMain(t,null,n,i):(this.liveSocket.commitPendingLink(i)&&(this.href=t),this.applyPendingUpdates(),n&&n(i))})}).receive("timeout",()=>this.liveSocket.redirect(window.location.href))}formsForRecovery(t){if(0===this.joinCount)return[];let e=this.binding("change"),n=document.createElement("template");return n.innerHTML=t,lt.all(this.el,`form[${e}]`).filter(t=>t.id&&this.ownsElement(t)).filter(t=>t.elements.length>0).filter(t=>"ignore"!==t.getAttribute(this.binding("auto-recover"))).map(t=>{let i=n.content.querySelector(`form[id="${t.id}"][${e}="${t.getAttribute(e)}"]`);return i?[t,i,this.targetComponentID(i)]:[t,null,null]}).filter(([t,e,n])=>e)}maybePushComponentsDestroyed(t){let e=t.filter(t=>0===lt.findComponentNodeList(this.el,t).length);e.length>0&&(this.pruningCIDs.push(...e),this.pushWithReply(null,"cids_will_destroy",{cids:e},()=>{this.pruningCIDs=this.pruningCIDs.filter(t=>-1!==e.indexOf(t));let t=e.filter(t=>0===lt.findComponentNodeList(this.el,t).length);t.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:t},t=>{this.rendered.pruneCIDs(t.cids)})}))}ownsElement(t){return t.getAttribute(U)===this.id||it(t.closest($),t=>t.id)===this.id}submitForm(t,e,n,i={}){lt.putPrivate(t,"phx-has-submitted",!0),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,e,n,i,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}},Dt=class{constructor(){this.transitions=new Set,this.pendingOps=[],this.reset()}reset(){this.transitions.forEach(t=>{cancelTimeout(t),this.transitions.delete(t)}),this.flushPendingOps()}after(t){0===this.size()?t():this.pushPendingOp(t)}addTransition(t,e,n){e();let i=setTimeout(()=>{this.transitions.delete(i),n(),0===this.size()&&this.flushPendingOps()},t);this.transitions.add(i)}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size}flushPendingOps(){this.pendingOps.forEach(t=>t()),this.pendingOps=[]}},Pt=function(t){return t};function Nt(t){return"translate("+t+",0)"}function Rt(t){return"translate(0,"+t+")"}function It(t){return e=>+t(e)}function Ut(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Ot(){return!this.__axis}function jt(t,e){var n=[],i=null,r=null,o=6,s=6,a=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,u=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",c=1===t||3===t?Nt:Rt;function d(d){var f=null==i?e.ticks?e.ticks.apply(e,n):e.domain():i,p=null==r?e.tickFormat?e.tickFormat.apply(e,n):Pt:r,g=Math.max(o,0)+a,m=e.range(),v=+m[0]+l,y=+m[m.length-1]+l,b=(e.bandwidth?Ut:It)(e.copy(),l),w=d.selection?d.selection():d,_=w.selectAll(".domain").data([null]),k=w.selectAll(".tick").data(f,e).order(),C=k.exit(),x=k.enter().append("g").attr("class","tick"),E=k.select("line"),A=k.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(x),E=E.merge(x.append("line").attr("stroke","currentColor").attr(h+"2",u*o)),A=A.merge(x.append("text").attr("fill","currentColor").attr(h,u*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(_=_.transition(d),k=k.transition(d),E=E.transition(d),A=A.transition(d),C=C.transition(d).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=b(t))?c(t+l):this.getAttribute("transform")})),x.attr("opacity",1e-6).attr("transform",(function(t){var e=this.parentNode.__axis;return c((e&&isFinite(e=e(t))?e:b(t))+l)}))),C.remove(),_.attr("d",4===t||2===t?s?"M"+u*s+","+v+"H"+l+"V"+y+"H"+u*s:"M"+l+","+v+"V"+y:s?"M"+v+","+u*s+"V"+l+"H"+y+"V"+u*s:"M"+v+","+l+"H"+y),k.attr("opacity",1).attr("transform",(function(t){return c(b(t)+l)})),E.attr(h+"2",u*o),A.attr(h,u*g).text(p),w.filter(Ot).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=b}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(i=null==t?null:Array.from(t),d):i&&i.slice()},d.tickFormat=function(t){return arguments.length?(r=t,d):r},d.tickSize=function(t){return arguments.length?(o=s=+t,d):o},d.tickSizeInner=function(t){return arguments.length?(o=+t,d):o},d.tickSizeOuter=function(t){return arguments.length?(s=+t,d):s},d.tickPadding=function(t){return arguments.length?(a=+t,d):a},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Ft(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function Ht(t){let e=t,n=t,i=t;function r(t,e,r=0,o=t.length){if(r>>1;i(t[n],e)<0?r=n+1:o=n}while(rt(e)-n,n=Ft,i=(e,n)=>Ft(t(e),n)),{left:r,center:function(t,n,i=0,o=t.length){const s=r(t,n,i,o-1);return s>i&&e(t[s-1],n)>-e(t[s],n)?s-1:s},right:function(t,e,r=0,o=t.length){if(r>>1;i(t[n],e)<=0?r=n+1:o=n}while(r=0?(o>=$t?10:o>=Bt?5:o>=qt?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=$t?10:o>=Bt?5:o>=qt?2:1)}function Jt(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=$t?r*=10:o>=Bt?r*=5:o>=qt&&(r*=2),e0))return a;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return zt.setTime(+e),Yt.setTime(+i),t(zt),t(Yt),Math.floor(n(zt,Yt))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var Xt=Wt((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Xt.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Wt((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Xt:null};var Gt=Xt,Kt=(Xt.range,Wt((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()}))),Zt=Kt,Qt=(Kt.range,Wt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()}))),te=Qt,ee=(Qt.range,Wt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()}))),ne=ee,ie=(ee.range,Wt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5,t=>t.getDate()-1)),re=ie;ie.range;function oe(t){return Wt((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var se=oe(0),ae=oe(1),le=oe(2),ue=oe(3),he=oe(4),ce=oe(5),de=oe(6),fe=(se.range,ae.range,le.range,ue.range,he.range,ce.range,de.range,Wt((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),pe=fe,ge=(fe.range,Wt((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()})));ge.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Wt((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var me=ge,ve=(ge.range,Wt((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()}))),ye=ve,be=(ve.range,Wt((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()}))),we=be,_e=(be.range,Wt((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),ke=_e;_e.range;function Ce(t){return Wt((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var xe=Ce(0),Ee=Ce(1),Ae=Ce(2),Se=Ce(3),Te=Ce(4),Me=Ce(5),Le=Ce(6),De=(xe.range,Ee.range,Ae.range,Se.range,Te.range,Me.range,Le.range,Wt((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),Pe=De,Ne=(De.range,Wt((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));Ne.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Wt((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Re=Ne;Ne.range;function Ie(t,e,n,i,r,o){const s=[[Zt,1,1e3],[Zt,5,5e3],[Zt,15,15e3],[Zt,30,3e4],[o,1,6e4],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,36e5],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,864e5],[i,2,1728e5],[n,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function a(e,n,i){const r=Math.abs(n-e)/i,o=Ht(([,,t])=>t).right(s,r);if(o===s.length)return t.every(Jt(e/31536e6,n/31536e6,i));if(0===o)return Gt.every(Math.max(Jt(e,n,i),1));const[a,l]=s[r/s[o-1][2][t.toLowerCase(),e]))}function Qe(t,e,n){var i=ze.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function tn(t,e,n){var i=ze.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function en(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function nn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function rn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function on(t,e,n){var i=ze.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function sn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function an(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function ln(t,e,n){var i=ze.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function un(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function hn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function cn(t,e,n){var i=ze.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function dn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function fn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function pn(t,e,n){var i=ze.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function gn(t,e,n){var i=ze.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function mn(t,e,n){var i=ze.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function vn(t,e,n){var i=Ye.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function yn(t,e,n){var i=ze.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function bn(t,e,n){var i=ze.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function wn(t,e){return Xe(t.getDate(),e,2)}function _n(t,e){return Xe(t.getHours(),e,2)}function kn(t,e){return Xe(t.getHours()%12||12,e,2)}function Cn(t,e){return Xe(1+re.count(me(t),t),e,3)}function xn(t,e){return Xe(t.getMilliseconds(),e,3)}function En(t,e){return xn(t,e)+"000"}function An(t,e){return Xe(t.getMonth()+1,e,2)}function Sn(t,e){return Xe(t.getMinutes(),e,2)}function Tn(t,e){return Xe(t.getSeconds(),e,2)}function Mn(t){var e=t.getDay();return 0===e?7:e}function Ln(t,e){return Xe(se.count(me(t)-1,t),e,2)}function Dn(t){var e=t.getDay();return e>=4||0===e?he(t):he.ceil(t)}function Pn(t,e){return t=Dn(t),Xe(he.count(me(t),t)+(4===me(t).getDay()),e,2)}function Nn(t){return t.getDay()}function Rn(t,e){return Xe(ae.count(me(t)-1,t),e,2)}function In(t,e){return Xe(t.getFullYear()%100,e,2)}function Un(t,e){return Xe((t=Dn(t)).getFullYear()%100,e,2)}function On(t,e){return Xe(t.getFullYear()%1e4,e,4)}function jn(t,e){var n=t.getDay();return Xe((t=n>=4||0===n?he(t):he.ceil(t)).getFullYear()%1e4,e,4)}function Fn(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Xe(e/60|0,"0",2)+Xe(e%60,"0",2)}function Hn(t,e){return Xe(t.getUTCDate(),e,2)}function $n(t,e){return Xe(t.getUTCHours(),e,2)}function Bn(t,e){return Xe(t.getUTCHours()%12||12,e,2)}function qn(t,e){return Xe(1+ke.count(Re(t),t),e,3)}function Vn(t,e){return Xe(t.getUTCMilliseconds(),e,3)}function Jn(t,e){return Vn(t,e)+"000"}function zn(t,e){return Xe(t.getUTCMonth()+1,e,2)}function Yn(t,e){return Xe(t.getUTCMinutes(),e,2)}function Wn(t,e){return Xe(t.getUTCSeconds(),e,2)}function Xn(t){var e=t.getUTCDay();return 0===e?7:e}function Gn(t,e){return Xe(xe.count(Re(t)-1,t),e,2)}function Kn(t){var e=t.getUTCDay();return e>=4||0===e?Te(t):Te.ceil(t)}function Zn(t,e){return t=Kn(t),Xe(Te.count(Re(t),t)+(4===Re(t).getUTCDay()),e,2)}function Qn(t){return t.getUTCDay()}function ti(t,e){return Xe(Ee.count(Re(t)-1,t),e,2)}function ei(t,e){return Xe(t.getUTCFullYear()%100,e,2)}function ni(t,e){return Xe((t=Kn(t)).getUTCFullYear()%100,e,2)}function ii(t,e){return Xe(t.getUTCFullYear()%1e4,e,4)}function ri(t,e){var n=t.getUTCDay();return Xe((t=n>=4||0===n?Te(t):Te.ceil(t)).getUTCFullYear()%1e4,e,4)}function oi(){return"+0000"}function si(){return"%"}function ai(t){return+t}function li(t){return Math.floor(+t/1e3)}qe=function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,s=t.shortDays,a=t.months,l=t.shortMonths,u=Ke(r),h=Ze(r),c=Ke(o),d=Ze(o),f=Ke(s),p=Ze(s),g=Ke(a),m=Ze(a),v=Ke(l),y=Ze(l),b={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:wn,e:wn,f:En,g:Un,G:jn,H:_n,I:kn,j:Cn,L:xn,m:An,M:Sn,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ai,s:li,S:Tn,u:Mn,U:Ln,V:Pn,w:Nn,W:Rn,x:null,X:null,y:In,Y:On,Z:Fn,"%":si},w={a:function(t){return s[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:Hn,e:Hn,f:Jn,g:ni,G:ri,H:$n,I:Bn,j:qn,L:Vn,m:zn,M:Yn,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ai,s:li,S:Wn,u:Xn,U:Gn,V:Zn,w:Qn,W:ti,x:null,X:null,y:ei,Y:ii,Z:oi,"%":si},_={a:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=v.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return x(t,e,n,i)},d:hn,e:hn,f:mn,g:sn,G:on,H:dn,I:dn,j:cn,L:gn,m:un,M:fn,p:function(t,e,n){var i=u.exec(e.slice(n));return i?(t.p=h.get(i[0].toLowerCase()),n+i[0].length):-1},q:ln,Q:yn,s:bn,S:pn,u:tn,U:en,V:nn,w:Qe,W:rn,x:function(t,e,i){return x(t,n,e,i)},X:function(t,e,n){return x(t,i,e,n)},y:sn,Y:on,Z:an,"%":vn};function k(t,e){return function(n){var i,r,o,s=[],a=-1,l=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++a53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=$e(Be(o.y,0,1))).getUTCDay(),i=r>4||0===r?Ee.ceil(i):Ee(i),i=ke.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=He(Be(o.y,0,1))).getDay(),i=r>4||0===r?ae.ceil(i):ae(i),i=re.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?$e(Be(o.y,0,1)).getUTCDay():He(Be(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,$e(o)):He(o)}}function x(t,e,n,i){for(var r,o,s=0,a=e.length,l=n.length;s=l)return-1;if(37===(r=e.charCodeAt(s++))){if(r=e.charAt(s++),!(o=_[r in Je?e.charAt(s++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=k(n,b),b.X=k(i,b),b.c=k(e,b),w.x=k(n,w),w.X=k(i,w),w.c=k(e,w),{format:function(t){var e=k(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=C(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=k(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=C(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Ve=qe.format,qe.parse,qe.utcFormat,qe.utcParse;const ui=Ht(Ft),hi=ui.right;ui.left,Ht((function(t){return null===t?NaN:+t})).center;var ci=hi,di=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function fi(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function pi(){}var gi="\\s*([+-]?\\d+)\\s*",mi="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",vi="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yi=/^#([0-9a-f]{3,8})$/,bi=new RegExp("^rgb\\("+[gi,gi,gi]+"\\)$"),wi=new RegExp("^rgb\\("+[vi,vi,vi]+"\\)$"),_i=new RegExp("^rgba\\("+[gi,gi,gi,mi]+"\\)$"),ki=new RegExp("^rgba\\("+[vi,vi,vi,mi]+"\\)$"),Ci=new RegExp("^hsl\\("+[mi,vi,vi]+"\\)$"),xi=new RegExp("^hsla\\("+[mi,vi,vi,mi]+"\\)$"),Ei={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ai(){return this.rgb().formatHex()}function Si(){return this.rgb().formatRgb()}function Ti(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=yi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Mi(e):3===n?new Ni(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Li(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Li(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=bi.exec(t))?new Ni(e[1],e[2],e[3],1):(e=wi.exec(t))?new Ni(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=_i.exec(t))?Li(e[1],e[2],e[3],e[4]):(e=ki.exec(t))?Li(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ci.exec(t))?Oi(e[1],e[2]/100,e[3]/100,1):(e=xi.exec(t))?Oi(e[1],e[2]/100,e[3]/100,e[4]):Ei.hasOwnProperty(t)?Mi(Ei[t]):"transparent"===t?new Ni(NaN,NaN,NaN,0):null}function Mi(t){return new Ni(t>>16&255,t>>8&255,255&t,1)}function Li(t,e,n,i){return i<=0&&(t=e=n=NaN),new Ni(t,e,n,i)}function Di(t){return t instanceof pi||(t=Ti(t)),t?new Ni((t=t.rgb()).r,t.g,t.b,t.opacity):new Ni}function Pi(t,e,n,i){return 1===arguments.length?Di(t):new Ni(t,e,n,null==i?1:i)}function Ni(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Ri(){return"#"+Ui(this.r)+Ui(this.g)+Ui(this.b)}function Ii(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Ui(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Oi(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fi(t,e,n,i)}function ji(t){if(t instanceof Fi)return new Fi(t.h,t.s,t.l,t.opacity);if(t instanceof pi||(t=Ti(t)),!t)return new Fi;if(t instanceof Fi)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=NaN,a=o-r,l=(o+r)/2;return a?(s=e===o?(n-i)/a+6*(n0&&l<1?0:s,new Fi(s,a,l,t.opacity)}function Fi(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function Hi(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function $i(t,e,n,i,r){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*n+(1+3*t+3*o-3*s)*i+s*r)/6}di(pi,Ti,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Ai,formatHex:Ai,formatHsl:function(){return ji(this).formatHsl()},formatRgb:Si,toString:Si}),di(Ni,Pi,fi(pi,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ni(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ni(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ri,formatHex:Ri,formatRgb:Ii,toString:Ii})),di(Fi,(function(t,e,n,i){return 1===arguments.length?ji(t):new Fi(t,e,n,null==i?1:i)}),fi(pi,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Fi(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Fi(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Ni(Hi(t>=240?t-240:t+120,r,i),Hi(t,r,i),Hi(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Bi=t=>()=>t;function qi(t,e){return function(n){return t+n*e}}function Vi(t){return 1==(t=+t)?Ji:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Bi(isNaN(e)?n:e)}}function Ji(t,e){var n=e-t;return n?qi(t,n):Bi(isNaN(t)?e:t)}var zi=function t(e){var n=Vi(e);function i(t,e){var i=n((t=Pi(t)).r,(e=Pi(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),s=Ji(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function Yi(t){return function(e){var n,i,r=e.length,o=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),r=t[i],o=t[i+1],s=i>0?t[i-1]:2*r-o,a=io&&(r=e.slice(o,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Zi(n,i)})),o=er.lastIndex;return oe&&(n=t,t=e,e=n),u=function(n){return Math.max(t,Math.min(e,n))}),i=l>2?hr:ur,r=o=null,c}function c(e){return null==e||isNaN(e=+e)?n:(r||(r=i(s.map(t),a,l)))(t(u(e)))}return c.invert=function(n){return u(e((o||(o=i(a,s.map(t),Zi)))(n)))},c.domain=function(t){return arguments.length?(s=Array.from(t,or),h()):s.slice()},c.range=function(t){return arguments.length?(a=Array.from(t),h()):a.slice()},c.rangeRound=function(t){return a=Array.from(t),l=rr,h()},c.clamp=function(t){return arguments.length?(u=!!t||ar,h()):u!==ar},c.interpolate=function(t){return arguments.length?(l=t,h()):l},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,i){return t=n,e=i,h()}}function fr(){return dr()(ar,ar)}function pr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function gr(t){return new Date(t)}function mr(t){return t instanceof Date?+t:+new Date(+t)}function vr(t,e,n,i,r,o,s,a,l,u){var h=fr(),c=h.invert,d=h.domain,f=u(".%L"),p=u(":%S"),g=u("%I:%M"),m=u("%I %p"),v=u("%a %d"),y=u("%b %d"),b=u("%B"),w=u("%Y");function _(t){return(l(t)=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function br(t){if(!(e=yr.exec(t)))throw new Error("invalid format: "+t);var e;return new wr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function wr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}br.prototype=wr.prototype,wr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};function _r(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}var kr,Cr,xr,Er,Ar=function(t){return(t=_r(Math.abs(t)))?t[1]:NaN},Sr=function(t,e){var n=_r(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")},Tr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Sr(100*t,e),r:Sr,s:function(t,e){var n=_r(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(kr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+_r(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)},Mr=function(t){return t},Lr=Array.prototype.map,Dr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Pr=function(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Mr:(e=Lr.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],s=0,a=e[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),o.push(t.substring(r-=a,r+a)),!((l+=a+1)>i));)a=e[s=(s+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Mr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Lr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=br(t)).fill,n=t.align,c=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Tr[y]||(void 0===m&&(m=12),v=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?l:"",_=Tr[y],k=/[defgprs%]/.test(y);function C(t){var r,o,l,d=b,C=w;if("c"===y)C=_(t)+C,t="";else{var x=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:_(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),x&&0==+t&&"+"!==c&&(x=!1),d=(x?"("===c?c:u:"-"===c||"("===c?"":c)+d,C=("s"===y?Dr[8+kr/3]:"")+C+(x&&"("===c?")":""),k)for(r=-1,o=t.length;++r(l=t.charCodeAt(r))||l>57){C=(46===l?s+t.slice(r+1):t.slice(r))+C,t=t.slice(0,r);break}}g&&!f&&(t=i(t,1/0));var E=d.length+t.length+C.length,A=E>1)+d+t+C+A.slice(E);break;default:t=A+d+t+C}return a(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),C.toString=function(){return t+""},C}return{format:c,formatPrefix:function(t,e){var n=c(((t=br(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Ar(e)/3))),r=Math.pow(10,-i),o=Dr[8+i/3];return function(t){return n(r*t)+o}}}};!function(t){Cr=Pr(t),xr=Cr.format,Er=Cr.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});function Nr(t,e,n,i){var r,o=Jt(t,e,n);switch((i=br(null==i?",f":i)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ar(e)/3)))-Ar(Math.abs(t)))}(o,s))||(i.precision=r),Er(i,s);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ar(e)-Ar(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-Ar(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return xr(i)}function Rr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var i,r,o,s,a=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((i=e0){let n=Math.round(t/s),i=Math.round(e/s);for(n*se&&--i,o=new Array(r=i-n+1);++ae&&--i,o=new Array(r=i-n+1);++a0;){if((r=Vt(l,u,n))===i)return o[s]=l,o[a]=u,e(o);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return t},t}function Ir(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n=r)&&(n=r)}return n}const Ur=Math.PI,Or=2*Ur,jr=Or-1e-6;function Fr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Hr(){return new Fr}Fr.prototype=Hr.prototype={constructor:Fr,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+o)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var o=this._x1,s=this._y1,a=n-t,l=i-e,u=o-t,h=s-e,c=u*u+h*h;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(c>1e-6)if(Math.abs(h*a-l*u)>1e-6&&r){var d=n-o,f=i-s,p=a*a+l*l,g=d*d+f*f,m=Math.sqrt(p),v=Math.sqrt(c),y=r*Math.tan((Ur-Math.acos((p+c-g)/(2*m*v)))/2),b=y/v,w=y/m;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(e+b*h)),this._+="A"+r+","+r+",0,0,"+ +(h*d>u*f)+","+(this._x1=t+w*a)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var s=(n=+n)*Math.cos(i),a=n*Math.sin(i),l=t+s,u=e+a,h=1^o,c=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+u:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+l+","+u),n&&(c<0&&(c=c%Or+Or),c>jr?this._+="A"+n+","+n+",0,1,"+h+","+(t-s)+","+(e-a)+"A"+n+","+n+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):c>1e-6&&(this._+="A"+n+","+n+",0,"+ +(c>=Ur)+","+h+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var $r=Hr,Br=(Array.prototype.slice,function(t){return function(){return t}});function qr(t){this._context=t}qr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Vr=function(t){return new qr(t)};function Jr(t){return t[0]}function zr(t){return t[1]}var Yr=function(t,e){var n=Br(!0),i=null,r=Vr,o=null;function s(s){var a,l,u,h=(s=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(s)).length,c=!1;for(null==i&&(o=r(u=$r())),a=0;a<=h;++a)!(ae?1:t>=e?0:NaN}var po="http://www.w3.org/1999/xhtml",go={svg:"http://www.w3.org/2000/svg",xhtml:po,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},mo=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),go.hasOwnProperty(e)?{space:go[e],local:t}:t};function vo(t){return function(){this.removeAttribute(t)}}function yo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bo(t,e){return function(){this.setAttribute(t,e)}}function wo(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _o(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function ko(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var Co=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function xo(t){return function(){this.style.removeProperty(t)}}function Eo(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ao(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function So(t,e){return t.style.getPropertyValue(e)||Co(t).getComputedStyle(t,null).getPropertyValue(e)}function To(t){return function(){delete this[t]}}function Mo(t,e){return function(){this[t]=e}}function Lo(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Do(t){return t.trim().split(/^|\s+/)}function Po(t){return t.classList||new No(t)}function No(t){this._node=t,this._names=Do(t.getAttribute("class")||"")}function Ro(t,e){for(var n=Po(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Fo(){this.textContent=""}function Ho(t){return function(){this.textContent=t}}function $o(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Bo(){this.innerHTML=""}function qo(t){return function(){this.innerHTML=t}}function Vo(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Jo(){this.nextSibling&&this.parentNode.appendChild(this)}function zo(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yo(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===po&&e.documentElement.namespaceURI===po?e.createElement(t):e.createElementNS(n,t)}}function Wo(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var Xo=function(t){var e=mo(t);return(e.local?Wo:Yo)(e)};function Go(){return null}function Ko(){var t=this.parentNode;t&&t.removeChild(this)}function Zo(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Qo(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ts(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function es(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i=_&&(_=w+1);!(b=m[_])&&++_=0;)(i=r[o])&&(s&&4^i.compareDocumentPosition(s)&&s.parentNode.insertBefore(i,s),s=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=fo);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==e?xo:"function"==typeof e?Ao:Eo)(t,e,null==n?"":n)):So(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?To:"function"==typeof e?Lo:Mo)(t,e)):this.node()[t]},classed:function(t,e){var n=Do(t+"");if(arguments.length<2){for(var i=Po(this.node()),r=-1,o=n.length;++r{}};function cs(){for(var t,e=0,n=arguments.length,i={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function ps(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--bs}()}finally{bs=0,function(){var t,e,n=ms,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:ms=e);vs=t,Ns(i)}(),Cs=0}}function Ps(){var t=Es.now(),e=t-ks;e>1e3&&(xs-=e,ks=t)}function Ns(t){bs||(ws&&(ws=clearTimeout(ws)),t-Cs>24?(t<1/0&&(ws=setTimeout(Ds,t-Es.now()-xs)),_s&&(_s=clearInterval(_s))):(_s||(ks=Es.now(),_s=setInterval(Ps,1e3)),bs=1,As(Ds)))}Ms.prototype=Ls.prototype={constructor:Ms,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Ss():+n)+(null==e?0:+e),this._next||vs===this||(vs?vs._next=this:ms=this,vs=this),this._call=t,this._time=n,Ns()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ns())}};var Rs=function(t,e,n){var i=new Ms;return e=null==e?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,n),i},Is=ys("start","end","cancel","interrupt"),Us=[],Os=function(t,e,n,i,r,o){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function o(l){var u,h,c,d;if(1!==n.state)return a();for(u in r)if((d=r[u]).name===n.name){if(3===d.state)return Rs(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[u]):+u0)throw new Error("too late; already scheduled");return n}function Fs(t,e){var n=Hs(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Hs(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var $s,Bs=180/Math.PI,qs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Vs=function(t,e,n,i,r,o){var s,a,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),t*i180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Zi(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,s.rotate,a,l),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Zi(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,s.skewX,a,l),function(t,e,n,i,o,s){if(t!==n||e!==i){var a=o.push(r(o)+"scale(",null,",",null,")");s.push({i:a-4,x:Zi(t,n)},{i:a-2,x:Zi(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,l),o=s=null,function(t){for(var e,n=-1,i=l.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?js:Fs;return function(){var s=o(this,t),a=s.on;a!==i&&(r=(i=a).copy()).on(e,n),s.on=r}}var pa=us.prototype.constructor;function ga(t){return function(){this.style.removeProperty(t)}}function ma(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function va(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&ma(t,o,n)),i}return o._value=e,o}function ya(t){return function(e){this.textContent=t.call(this,e)}}function ba(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ya(i)),e}return i._value=t,i}var wa=0;function _a(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function ka(){return++wa}var Ca=us.prototype;_a.prototype=function(t){return us().transition(t)}.prototype={constructor:_a,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Xr(t));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s=e&&(n=i=e):(n>e&&(n=e),i=o&&(n=i=o):(n>o&&(n=o),i2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[r]):s=!1;s&&delete t.__transition}}(this,t)}))},us.prototype.transition=function(t){var e,n;t instanceof _a?(e=t._id,t=t._name):(e=ka(),(n=xa).time=Ss(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,o=0;o{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return"true"===this.sessionStorage.getItem("phx:live-socket:profiling")}isDebugEnabled(){return"true"===this.sessionStorage.getItem("phx:live-socket:debug")}enableDebug(){this.sessionStorage.setItem("phx:live-socket:debug","true")}enableProfiling(){this.sessionStorage.setItem("phx:live-socket:profiling","true")}disableDebug(){this.sessionStorage.removeItem("phx:live-socket:debug")}disableProfiling(){this.sessionStorage.removeItem("phx:live-socket:profiling")}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem("phx:live-socket:latency-sim",t)}disableLatencySim(){this.sessionStorage.removeItem("phx:live-socket:latency-sim")}getLatencySim(){let t=this.sessionStorage.getItem("phx:live-socket:latency-sim");return t?parseInt(t):null}getSocket(){return this.socket}connect(){let t=()=>{this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){this.socket.disconnect(t)}execJS(t,e,n=null){this.owner(t,i=>Tt.exec(n,e,i,t))}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let n=e();return console.timeEnd(t),n}log(t,e,n){if(this.viewLogger){let[i,r]=n();this.viewLogger(t,e,i,r)}else if(this.isDebugEnabled()){let[i,r]=n();((t,e,n,i)=>{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${n} - `,i)})(t,e,i,r)}}requestDOMUpdate(t){this.transitions.after(t)}transition(t,e,n=function(){}){this.transitions.addTransition(t,e,n)}onChannel(t,e,n){t.on(e,t=>{let e=this.getLatencySim();e?(console.log(`simulating ${e}ms of latency from server to client`),setTimeout(()=>n(t),e)):n(t)})}wrapPush(t,e,n){let i=this.getLatencySim(),r=t.joinCount;if(!i)return e.timeout?n().receive("timeout",()=>{t.joinCount!==r||t.isDestroyed()||this.reloadWithJitter(t,()=>{this.log(t,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):n();console.log(`simulating ${i}ms of latency from client to server`);let o={receives:[],receive(t,e){this.receives.push([t,e])}};return setTimeout(()=>{t.isDestroyed()||o.receives.reduce((t,[e,n])=>t.receive(e,n),n())},i),o}reloadWithJitter(t,e){t.destroy(),this.disconnect();let[n,i]=D,r=Math.floor(Math.random()*(i-n+1))+n,o=st.updateLocal(this.localStorage,window.location.pathname,"consecutive-reloads",0,t=>t+1);e?e():this.log(t,"join",()=>[`encountered ${o} consecutive reloads`]),o>10&&(this.log(t,"join",()=>["exceeded 10 consecutive reloads. Entering failsafe mode"]),r=3e4),setTimeout(()=>{this.hasPendingLink()?window.location=this.pendingLink:window.location.reload()},r)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?dt[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinRootViews(){let t=!1;return lt.all(document,`${$}:not([${U}])`,e=>{if(!this.getRootById(e.id)){let t=this.newRootView(e);t.setHref(this.getHref()),t.join(),e.getAttribute("data-phx-main")&&(this.main=t)}t=!0}),t}redirect(t,e){this.disconnect(),st.redirect(t,e)}replaceMain(t,e,n=null,i=this.setPendingLink(t)){let r=this.main.el,o=lt.cloneNode(r,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,e),this.main.setRedirect(t),this.transitionRemoves(),this.main.join((t,e)=>{1===t&&this.commitPendingLink(i)&&this.requestDOMUpdate(()=>{r.replaceWith(o),n&&n(),e()})})}transitionRemoves(t){let e=this.binding("remove");(t=t||lt.all(document,`[${e}]`)).forEach(t=>{document.body.contains(t)&&this.execJS(t,t.getAttribute(e),"remove")})}isPhxView(t){return t.getAttribute&&null!==t.getAttribute(H)}newRootView(t,e){let n=new Lt(t,this,null,e);return this.roots[n.id]=n,n}owner(t,e){let n=it(t.closest($),t=>this.getViewByEl(t))||this.main;n&&e(n)}withinOwners(t,e){this.owner(t,n=>e(n,t))}getViewByEl(t){let e=t.getAttribute(O);return it(this.getRootById(e),e=>e.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t]}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(O));e&&e.destroyDescendent(t.id)}setActiveElement(t){if(this.activeElement===t)return;this.activeElement=t;let e=()=>{t===this.activeElement&&(this.activeElement=null),t.removeEventListener("mouseup",this),t.removeEventListener("touchend",this)};t.addEventListener("mouseup",e),t.addEventListener("touchend",e)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(t){this.prevActive&&t.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(){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,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),this.bindNav(),this.bindClicks(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,e,n,i,r,o)=>{let s=i.getAttribute(this.binding("key")),a=t.key&&t.key.toLowerCase();if(s&&s.toLowerCase()!==a)return;let l={key:t.key,...this.eventMeta(e,t,i)};Tt.exec(e,r,n,i,["push",{data:l}])}),this.bind({blur:"focusout",focus:"focusin"},(t,e,n,i,r,o)=>{if(!o){let o={key:t.key,...this.eventMeta(e,t,i)};Tt.exec(e,r,n,i,["push",{data:o}])}}),this.bind({blur:"blur",focus:"focus"},(t,e,n,i,r,o,s)=>{if("window"===s){let r=this.eventMeta(e,t,i);Tt.exec(e,o,n,i,["push",{data:r}])}}),window.addEventListener("dragover",t=>t.preventDefault()),window.addEventListener("drop",t=>{t.preventDefault();let e=it(tt(t.target,this.binding("drop-target")),t=>t.getAttribute(this.binding("drop-target"))),n=e&&document.getElementById(e),i=Array.from(t.dataTransfer.files||[]);n&&!n.disabled&&0!==i.length&&n.files instanceof FileList&&(ct.trackFiles(n,i),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on("track-uploads",t=>{let e=t.target;if(!lt.isUploadInput(e))return;let n=Array.from(t.detail.files||[]).filter(t=>t instanceof File||t instanceof Blob);ct.trackFiles(e,n),e.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,n){let i=this.metadataCallbacks[t];return i?i(e,n):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.linkRef}commitPendingLink(t){return this.linkRef===t&&(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let n in t){let i=t[n];this.on(i,t=>{let i=this.binding(n),r=this.binding("window-"+n),o=t.target.getAttribute&&t.target.getAttribute(i);o?this.debounce(t.target,t,()=>{this.withinOwners(t.target,i=>{e(t,n,i,t.target,o,null)})}):lt.all(document,`[${r}]`,i=>{let o=i.getAttribute(r);this.debounce(i,t,()=>{this.withinOwners(i,r=>{e(t,n,r,i,o,"window")})})})})}}bindClicks(){this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(t,e,n){let i=this.binding(e);window.addEventListener(t,t=>{if(!this.isConnected())return;let e=null;n?e=t.target.matches(`[${i}]`)?t.target:t.target.querySelector(`[${i}]`):(e=tt(t.target,i),this.dispatchClickAway(t));let r=e&&e.getAttribute(i);r&&("#"===e.getAttribute("href")&&t.preventDefault(),this.debounce(e,t,()=>{this.withinOwners(e,n=>{Tt.exec("click",r,n,e,["push",{data:this.eventMeta("click",t,e)}])})}))},n)}dispatchClickAway(t){let e=this.binding("click-away");lt.all(document,`[${e}]`,n=>{n.isSameNode(t.target)||n.contains(t.target)||this.withinOwners(t.target,i=>{let r=n.getAttribute(e);Tt.isVisible(n)&&Tt.exec("click",r,i,t.target,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!st.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{st.updateCurrentState(t=>Object.assign(t,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:e,id:n,root:i,scroll:r}=t.state||{},o=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&"patch"===e&&n===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{i&&this.replaceRootHistory(),"number"==typeof r&&setTimeout(()=>{window.scrollTo(0,r)},0)})})},!1),window.addEventListener("click",t=>{let e=tt(t.target,"data-phx-link"),n=e&&e.getAttribute("data-phx-link"),i=t.metaKey||t.ctrlKey||1===t.button;if(!n||!this.isConnected()||!this.main||i)return;let r=e.href,o=e.getAttribute("data-phx-link-state");t.preventDefault(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if("patch"===n)this.pushHistoryPatch(r,o,e);else{if("redirect"!==n)throw new Error('expected data-phx-link to be "patch" or "redirect", got: '+n);this.historyRedirect(r,o)}})},!1)}dispatchEvent(t,e={}){lt.dispatchEvent(window,"phx:"+t,e)}dispatchEvents(t){t.forEach(([t,e])=>this.dispatchEvent(t,e))}withPageLoading(t,e){lt.dispatchEvent(window,"phx:page-loading-start",t);let n=()=>lt.dispatchEvent(window,"phx:page-loading-stop",t);return e?e(n):n}pushHistoryPatch(t,e,n){this.withPageLoading({to:t,kind:"patch"},i=>{this.main.pushLinkPatch(t,n,n=>{this.historyPatch(t,e,n),i()})})}historyPatch(t,e,n=this.setPendingLink(t)){this.commitPendingLink(n)&&(st.pushState(e,{type:"patch",id:this.main.id},t),this.registerNewLocation(window.location))}historyRedirect(t,e,n){let i=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},r=>{this.replaceMain(t,n,()=>{st.pushState(e,{type:"redirect",id:this.main.id,scroll:i},t),this.registerNewLocation(window.location),r()})})}replaceRootHistory(){st.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(t){let{pathname:e,search:n}=this.currentLocation;return e+n!==t.pathname+t.search&&(this.currentLocation=Q(t),!0)}bindForms(){let t=0;this.on("submit",t=>{let e=t.target.getAttribute(this.binding("submit"));e&&(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,n=>{Tt.exec("submit",e,n,t.target,["push",{}])}))},!1);for(let e of["change","input"])this.on(e,n=>{let i=n.target,r=i.form&&i.form.getAttribute(this.binding("change"));if(!r)return;if("number"===i.type&&i.validity&&i.validity.badInput)return;let o=t;t++;let{at:s,type:a}=lt.private(i,"prev-iteration")||{};s===o-1&&e!==a||(lt.putPrivate(i,"prev-iteration",{at:o,type:e}),this.debounce(i,n,()=>{this.withinOwners(i.form,t=>{lt.putPrivate(i,"phx-has-focused",!0),lt.isTextualInput(i)||this.setActiveElement(i),Tt.exec("change",r,t,i,["push",{_target:n.target.name}])})}))},!1)}debounce(t,e,n){let i=this.binding("debounce"),r=this.binding("throttle"),o=this.defaults.debounce.toString(),s=this.defaults.throttle.toString();lt.debounce(t,e,i,o,r,s,n)}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){window.addEventListener(t,t=>{this.silenced||e(t)})}}("/live",class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||1e4,this.transport=e.transport||s.WebSocket||S,this.establishedConnections=0,this.defaultEncoder=T.encode.bind(T),this.defaultDecoder=T.decode.bind(T),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==S?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;o&&o.addEventListener&&(o.addEventListener("pagehide",t=>{this.conn&&(this.disconnect(),n=this.connectClock)}),o.addEventListener("pageshow",t=>{n===this.connectClock&&(n=null,this.connect())})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.rejoinAfterMs=t=>e.rejoinAfterMs?e.rejoinAfterMs(t):[1e3,2e3,5e3][t-1]||1e4,this.reconnectAfterMs=t=>e.reconnectAfterMs?e.reconnectAfterMs(t):[10,50,100,150,200,250,500,1e3,2e3][t-1]||5e3,this.logger=e.logger||null,this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=i(e.params||{}),this.endPoint=`${t}/${k}`,this.vsn=e.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new E(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}replaceTransport(t){this.disconnect(),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=A.appendParams(A.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==t.charAt(0)?t:"/"===t.charAt(1)?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,n){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(t,e,n)}connect(t){this.connectClock++,t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=i(t)),this.conn||(this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(t,e,n){this.logger(t,e,n)}hasLogger(){return null!==this.logger}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onConnOpen(){this.hasLogger()&&this.log("transport","connected to "+this.endPointURL()),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,t])=>t())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,n){if(!this.conn)return t&&t();this.waitForBufferDone(()=>{this.conn&&(e?this.conn.close(e,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e=1){5!==e&&this.conn&&this.conn.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(t,e+1)},150*e):t()}waitForSocketClosed(t,e=1){5!==e&&this.conn&&this.conn.readyState!==h?setTimeout(()=>{this.waitForSocketClosed(t,e+1)},150*e):t()}onConnClose(t){let e=t&&t.code;this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||1e3===e||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,e])=>e(t))}onConnError(t){this.hasLogger()&&this.log("transport",t);let e=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(t,e,n)}),(e===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(v)})}connectionState(){switch(this.conn&&this.conn.readyState){case a:return"connecting";case l:return"open";case u:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e.joinRef()!==t.joinRef())}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([e])=>-1===t.indexOf(e))}channel(t,e={}){let n=new class{constructor(t,e,n){this.state=c,this.topic=t,this.params=i(e||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new x(this,y,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new E(()=>{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,this.rejoinTimer.reset(),this.pushBuffer.forEach(t=>t.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=d,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=c,this.socket.remove(this)}),this.onError(t=>{this.socket.hasLogger()&&this.socket.log("channel","error "+this.topic,t),this.isJoining()&&this.joinPush.reset(),this.state=d,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 x(this,w,i({}),this.timeout).send(),this.state=d,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(b,(t,e)=>{this.trigger(this.replyEventName(e),t)})}join(t=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=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(t){this.on(m,t)}onError(t){return this.on(v,e=>t(e))}on(t,e){let n=this.bindingRef++;return this.bindings.push({event:t,ref:n,callback:e}),n}off(t,e){this.bindings=this.bindings.filter(n=>!(n.event===t&&(void 0===e||e===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,n=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new x(this,t,(function(){return e}),n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=g;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel","leave "+this.topic),this.trigger(m,"leave")},n=new x(this,w,i({}),t);return n.receive("ok",()=>e()).receive("timeout",()=>e()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(t,e,n){return e}isMember(t,e,n,i){return this.topic===t&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:n,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(t))}trigger(t,e,n,i){let r=this.onMessage(t,e,n,i);if(e&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(e=>e.event===t);for(let t=0;tthis.conn.send(t)):this.sendBuffer.push(()=>this.encode(t,t=>this.conn.send(t)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}abnormalClose(t){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,t)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,t=>{let{topic:e,event:n,payload:i,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${i.status||""} ${e} ${n} ${r&&"("+r+")"||""}`,i);for(let t=0;te.topic===t&&(e.isJoined()||e.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}},{params:{_csrf_token:Pa},hooks:{Table:{mounted:function(){var t=this.el,e=t.querySelector(".js-hidden-submit"),n=t.querySelector(".js-submit-button");t.querySelector(".js-select-all-rows").addEventListener("change",(function(){var e=this;t.querySelectorAll(".js-select-row").forEach((function(t){t.checked=e.checked}))})),t.querySelectorAll(".js-action").forEach((function(t){t.addEventListener("click",(function(){e.value=this.dataset.name,n.click()}))}))}},RealtimePlot:Sa,HistoricalPlot:Ta,Refresh:Ma,Timestamp:Da}});L.a.config({barColors:{0:"#B5179E"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",(function(t){return L.a.show()})),window.addEventListener("phx:page-loading-stop",(function(t){return L.a.hide()})),Na.connect(),window.liveSocket=Na}]); \ No newline at end of file +!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/js/",n(n.s=10)}([,,function(t,e,n){var i;(function(r,o){"use strict";!function(){for(var t=0,e=["ms","moz","webkit","o"],n=0;n=0||t.indexOf("-")>=0?h:0)+parseFloat(t)),h=t>1?1:t,d()),h},hide:function(){u&&(u=!1,null!=a&&(r.cancelAnimationFrame(a),a=null),function t(){if(f.progress("+.1")>=1&&(s.style.opacity-=.05,s.style.opacity<=.05))return s.style.display="none",void(l=null);l=r.requestAnimationFrame(t)}())}};"object"==typeof t.exports?t.exports=f:void 0===(i=function(){return f}.call(e,n,e,t))||(t.exports=i)}).call(this,window,document)},,,,,,,,function(t,e,n){t.exports=n(13)},function(t,e,n){},function(t,e,n){"use strict";!function(){var t=function(){if("function"==typeof window.CustomEvent)return window.CustomEvent;function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}return t.prototype=window.Event.prototype,t}();function e(t,e){var n=document.createElement("input");return n.type="hidden",n.name=t,n.value=e,n}function n(t,n){var i=t.getAttribute("data-to"),r=e("_method",t.getAttribute("data-method")),o=e("_csrf_token",t.getAttribute("data-csrf")),s=document.createElement("form"),a=t.getAttribute("target");s.method="get"===t.getAttribute("data-method")?"get":"post",s.action=i,s.style.display="hidden",a?s.target=a:n&&(s.target="_blank"),s.appendChild(o),s.appendChild(r),document.body.appendChild(s),s.submit()}window.addEventListener("click",(function(e){var i=e.target;if(!e.defaultPrevented)for(;i&&i.getAttribute;){var r=new t("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!i.dispatchEvent(r))return e.preventDefault(),e.stopImmediatePropagation(),!1;if(i.getAttribute("data-method"))return n(i,e.metaKey||e.shiftKey),e.preventDefault(),!1;i=i.parentNode}}),!1),window.addEventListener("phoenix.link.click",(function(t){var e=t.target.getAttribute("data-confirm");e&&!window.confirm(e)&&t.preventDefault()}),!1)}()},function(t,e,n){"use strict";n.r(e);n(11),n(12);var i=t=>{if("function"==typeof t)return t;return function(){return t}},r="undefined"!=typeof self?self:null,o="undefined"!=typeof window?window:null,s=r||o||s,a=0,l=1,h=2,u=3,c="closed",d="errored",f="joined",p="joining",g="leaving",m="phx_close",v="phx_error",y="phx_join",b="phx_reply",w="phx_leave",k="longpoll",_="websocket",x=4,C=class{constructor(t,e,n,i){this.channel=t,this.event=e,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(t){this.timeout=t,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(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:t,response:e,_ref:n}){this.recHooks.filter(e=>e.status===t).forEach(t=>t.callback(e))}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,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},E=class{constructor(t,e){this.callback=t,this.timerCalc=e,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))}},A=class{static request(t,e,n,i,r,o,a){if(s.XDomainRequest){let n=new s.XDomainRequest;this.xdomainRequest(n,t,e,i,r,o,a)}else{let l=new s.XMLHttpRequest;this.xhrRequest(l,t,e,n,i,r,o,a)}}static xdomainRequest(t,e,n,i,r,o,s){t.timeout=r,t.open(e,n),t.onload=()=>{let e=this.parseJSON(t.responseText);s&&s(e)},o&&(t.ontimeout=o),t.onprogress=()=>{},t.send(i)}static xhrRequest(t,e,n,i,r,o,s,a){t.open(e,n,!0),t.timeout=o,t.setRequestHeader("Content-Type",i),t.onerror=()=>{a&&a(null)},t.onreadystatechange=()=>{if(t.readyState===x&&a){let e=this.parseJSON(t.responseText);a(e)}},s&&(t.ontimeout=s),t.send(r)}static parseJSON(t){if(!t||""===t)return null;try{return JSON.parse(t)}catch(e){return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let n=[];for(var i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let r=e?`${e}[${i}]`:i,o=t[i];"object"==typeof o?n.push(this.serialize(o,r)):n.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}return n.join("&")}static appendParams(t,e){if(0===Object.keys(e).length)return t;let n=t.match(/\?/)?"&":"?";return`${t}${n}${this.serialize(e)}`}},S=class{constructor(t){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=a,this.poll()}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+_),"$1/"+k)}endpointURL(){return A.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,n){this.close(t,e,n),this.readyState=a}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}poll(){this.readyState!==l&&this.readyState!==a||A.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),t=>{if(t){var{status:e,token:n,messages:i}=t;this.token=n}else e=0;switch(e){case 200:i.forEach(t=>{setTimeout(()=>{this.onmessage({data:t})},0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=l,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 "+e)}})}send(t){A.request("POST",this.endpointURL(),"application/json",t,this.timeout,this.onerror.bind(this,"timeout"),t=>{t&&200===t.status||(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1))})}close(t,e,n){this.readyState=u;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:n});"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}},T={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(n))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[n,i,r,o,s]=JSON.parse(t);return e({join_ref:n,ref:i,topic:r,event:o,payload:s})}},binaryEncode(t){let{join_ref:e,ref:n,event:i,topic:r,payload:o}=t,s=this.META_LENGTH+e.length+n.length+r.length+i.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),l=new DataView(a),h=0;l.setUint8(h++,this.KINDS.push),l.setUint8(h++,e.length),l.setUint8(h++,n.length),l.setUint8(h++,r.length),l.setUint8(h++,i.length),Array.from(e,t=>l.setUint8(h++,t.charCodeAt(0))),Array.from(n,t=>l.setUint8(h++,t.charCodeAt(0))),Array.from(r,t=>l.setUint8(h++,t.charCodeAt(0))),Array.from(i,t=>l.setUint8(h++,t.charCodeAt(0)));var u=new Uint8Array(a.byteLength+o.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(o),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),n=e.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(t,e,i);case this.KINDS.reply:return this.decodeReply(t,e,i);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,i)}},decodePush(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),o=e.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(t.slice(s,s+i));s+=i;let l=n.decode(t.slice(s,s+r));s+=r;let h=n.decode(t.slice(s,s+o));return s+=o,{join_ref:a,ref:null,topic:l,event:h,payload:t.slice(s,t.byteLength)}},decodeReply(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),o=e.getUint8(3),s=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(t.slice(a,a+i));a+=i;let h=n.decode(t.slice(a,a+r));a+=r;let u=n.decode(t.slice(a,a+o));a+=o;let c=n.decode(t.slice(a,a+s));a+=s;let d=t.slice(a,t.byteLength);return{join_ref:l,ref:h,topic:u,event:b,payload:{status:c,response:d}}},decodeBroadcast(t,e,n){let i=e.getUint8(1),r=e.getUint8(2),o=this.HEADER_LENGTH+2,s=n.decode(t.slice(o,o+i));o+=i;let a=n.decode(t.slice(o,o+r));return o+=r,{join_ref:null,ref:null,topic:s,event:a,payload:t.slice(o,t.byteLength)}}},M=n(2),L=n.n(M),D=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],P="data-phx-component",N="data-phx-ref",R="data-phx-ref-src",I="data-phx-upload-ref",U="data-phx-parent-id",O="data-phx-root-id",j=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],F=["checkbox","radio"],H="data-phx-session",$=`[${H}]`,B="data-phx-static",q="phx:live-socket:debug",J={debounce:300,throttle:300},V="d",z="s",W="e",Y="r",X="t",G=(t,e)=>console.error&&console.error(t,e),K=t=>{let e=typeof t;return"number"===e||"string"===e&&/^(0|[1-9]\d*)$/.test(t)};var Z,Q=t=>"function"==typeof t?t:function(){return t},tt=t=>JSON.parse(JSON.stringify(t)),et=(t,e,n)=>{do{if(t.matches(`[${e}]`))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType&&!(n&&n.isSameNode(t)||t.matches($)));return null},nt=t=>null!==t&&"object"==typeof t&&!(t instanceof Array),it=t=>{for(let e in t)return!1;return!0},rt=(t,e)=>t&&e(t),ot=function(t,e,n,i){t.forEach(t=>{new class{constructor(t,e,n){this.liveSocket=n,this.entry=t,this.offset=0,this.chunkSize=e,this.chunkTimer=null,this.uploadChannel=n.channel("lvu:"+t.ref,{token:t.metadata()})}error(t){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(t)}upload(){this.uploadChannel.onError(t=>this.error(t)),this.uploadChannel.join().receive("ok",t=>this.readNextChunk()).receive("error",t=>this.error(t))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let t=new window.FileReader,e=this.entry.file.slice(this.offset,this.chunkSize+this.offset);t.onload=t=>{if(null!==t.target.error)return G("Read error: "+t.target.error);this.offset+=t.target.result.byteLength,this.pushChunk(t.target.result)},t.readAsArrayBuffer(e)}pushChunk(t){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",t).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}}(t,n.config.chunk_size,i).upload()})},st={canPushState:()=>void 0!==history.pushState,dropLocal(t,e,n){return t.removeItem(this.localKey(e,n))},updateLocal(t,e,n,i,r){let o=this.getLocal(t,e,n),s=this.localKey(e,n),a=null===o?i:r(o);return t.setItem(s,JSON.stringify(a)),a},getLocal(t,e,n){return JSON.parse(t.getItem(this.localKey(e,n)))},updateCurrentState(t){this.canPushState()&&history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,n){if(this.canPushState()){if(n!==window.location.href){if("redirect"==e.type&&e.scroll){let t=history.state||{};t.scroll=e.scroll,history.replaceState(t,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",n||null);let i=this.getHashTargetEl(window.location.hash);i?i.scrollIntoView():"redirect"===e.type&&window.scroll(0,0)}}else this.redirect(n)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie:t=>document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1"),redirect(t,e){e&&st.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey:(t,e)=>`${t}-${e}`,getHashTargetEl(t){let e=t.toString().substring(1);if(""!==e)return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},at=st,lt={byId:t=>document.getElementById(t)||G("no id found for "+t),removeClass(t,e){t.classList.remove(e),0===t.classList.length&&t.removeAttribute("class")},all(t,e,n){if(!t)return[];let i=Array.from(t.querySelectorAll(e));return n?i.forEach(n):i},childNodeLength(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput:t=>"file"===t.type&&null!==t.getAttribute(I),findUploadInputs(t){return this.all(t,`input[type="file"][${I}]`)},findComponentNodeList(t,e){return this.filterWithinSameLiveView(this.all(t,`[${P}="${e}"]`),t)},isPhxDestroyed:t=>!(!t.id||!lt.private(t,"destroyed")),markPhxChildDestroyed(t){this.isPhxChild(t)&&t.setAttribute(H,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){let n=document.createElement("template");return n.innerHTML=t,this.findPhxChildren(n.content,e)},isIgnored:(t,e)=>"ignore"===(t.getAttribute(e)||t.getAttribute("data-phx-update")),isPhxUpdate:(t,e,n)=>t.getAttribute&&n.indexOf(t.getAttribute(e))>=0,findPhxSticky(t){return this.all(t,"[data-phx-sticky]")},findPhxChildren(t,e){return this.all(t,`${$}[${U}="${e}"]`)},findParentCIDs(t,e){let n=new Set(e);return e.reduce((e,n)=>{let i=`[${P}="${n}"] [${P}]`;return this.filterWithinSameLiveView(this.all(t,i),t).map(t=>parseInt(t.getAttribute(P))).forEach(t=>e.delete(t)),e},n)},filterWithinSameLiveView(t,e){return e.querySelector($)?t.filter(t=>this.withinSameLiveView(t,e)):t},withinSameLiveView(t,e){for(;t=t.parentNode;){if(t.isSameNode(e))return!0;if(null!==t.getAttribute(H))return!1}},private:(t,e)=>t.phxPrivate&&t.phxPrivate[e],deletePrivate(t,e){t.phxPrivate&&delete t.phxPrivate[e]},putPrivate(t,e,n){t.phxPrivate||(t.phxPrivate={}),t.phxPrivate[e]=n},updatePrivate(t,e,n,i){let r=this.private(t,e);void 0===r?this.putPrivate(t,e,i(n)):this.putPrivate(t,e,i(r))},copyPrivates(t,e){e.phxPrivate&&(t.phxPrivate=e.phxPrivate)},putTitle(t){let e=document.querySelector("title"),{prefix:n,suffix:i}=e.dataset;document.title=`${n||""}${t}${i||""}`},debounce(t,e,n,i,r,o,s){let a=t.getAttribute(n),l=t.getAttribute(r);""===a&&(a=i),""===l&&(l=o);let h=a||l;switch(h){case null:return s();case"blur":return void(this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>s()));default:let n=parseInt(h),i=()=>l?this.deletePrivate(t,"throttled"):s(),r=this.incCycle(t,"debounce-trigger",i);if(isNaN(n))return G("invalid throttle/debounce value: "+h);if(l){let i=!1;if("keydown"===e.type){let n=this.private(t,"debounce-prev-key");this.putPrivate(t,"debounce-prev-key",e.key),i=n!==e.key}if(!i&&this.private(t,"throttled"))return!1;s(),this.putPrivate(t,"throttled",!0),setTimeout(()=>this.triggerCycle(t,"debounce-trigger"),n)}else setTimeout(()=>this.triggerCycle(t,"debounce-trigger",r),n);let o=t.form;o&&this.once(o,"bind-debounce")&&o.addEventListener("submit",()=>{Array.from(new FormData(o).entries(),([t])=>{let e=o.querySelector(`[name="${t}"]`);this.incCycle(e,"debounce-trigger"),this.deletePrivate(e,"throttled")})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>this.triggerCycle(t,"debounce-trigger"))}},triggerCycle(t,e,n){let[i,r]=this.private(t,e);n||(n=i),n===i&&(this.incCycle(t,e),r())},once(t,e){return!0!==this.private(t,e)&&(this.putPrivate(t,e,!0),!0)},incCycle(t,e,n=function(){}){let[i]=this.private(t,e)||[0,n];return i++,this.putPrivate(t,e,[i,n]),i},discardError(t,e,n){let i=e.getAttribute&&e.getAttribute(n),r=i&&t.querySelector(`[id="${i}"], [name="${i}"]`);r&&(this.private(r,"phx-has-focused")||this.private(r.form,"phx-has-submitted")||e.classList.add("phx-no-feedback"))},showError(t,e){(t.id||t.name)&&this.all(t.form,`[${e}="${t.id}"], [${e}="${t.name}"]`,t=>{this.removeClass(t,"phx-no-feedback")})},isPhxChild:t=>t.getAttribute&&t.getAttribute(U),isPhxSticky:t=>t.getAttribute&&null!==t.getAttribute("data-phx-sticky"),firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${U}]`)[0]},dispatchEvent(t,e,n={}){let i={bubbles:void 0===n.bubbles||!!n.bubbles,cancelable:!0,detail:n.detail||{}},r="click"===e?new MouseEvent("click",i):new CustomEvent(e,i);t.dispatchEvent(r)},cloneNode(t,e){if(void 0===e)return t.cloneNode(!0);{let n=t.cloneNode(!1);return n.innerHTML=e,n}},mergeAttrs(t,e,n={}){let i=n.exclude||[],r=n.isIgnored,o=e.attributes;for(let n=o.length-1;n>=0;n--){let r=o[n].name;i.indexOf(r)<0&&t.setAttribute(r,e.getAttribute(r))}let s=t.attributes;for(let n=s.length-1;n>=0;n--){let i=s[n].name;r?i.startsWith("data-")&&!e.hasAttribute(i)&&t.removeAttribute(i):e.hasAttribute(i)||t.removeAttribute(i)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||lt.mergeAttrs(t,e,{exclude:["value"]}),e.readOnly?t.setAttribute("readonly",!0):t.removeAttribute("readonly")},hasSelectionRange:t=>t.setSelectionRange&&("text"===t.type||"textarea"===t.type),restoreFocus(t,e,n){if(!lt.isTextualInput(t))return;let i=t.matches(":focus");t.readOnly&&t.blur(),i||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,n)},isFormInput:t=>/^(?:input|select|textarea)$/i.test(t.tagName)&&"button"!==t.type,syncAttrsToProps(t){t instanceof HTMLInputElement&&F.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=null!==t.getAttribute("checked"))},isTextualInput:t=>j.indexOf(t.type)>=0,isNowTriggerFormExternal:(t,e)=>t.getAttribute&&null!==t.getAttribute(e),syncPendingRef(t,e,n){let i=t.getAttribute(N);if(null===i)return!0;let r=t.getAttribute(R);return lt.isFormInput(t)||null!==t.getAttribute(n)?(lt.isUploadInput(t)&<.mergeAttrs(t,e,{isIgnored:!0}),lt.putPrivate(t,N,e),!1):(D.forEach(n=>{t.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(N,i),e.setAttribute(R,r),!0)},cleanChildNodes(t,e){if(lt.isPhxUpdate(t,e,["append","prepend"])){let e=[];t.childNodes.forEach(t=>{if(!t.id){t.nodeType===Node.TEXT_NODE&&""===t.nodeValue.trim()||G(`only HTML element tags with an id are allowed inside containers with phx-update.\n\nremoving illegal node: "${(t.outerHTML||t.nodeValue).trim()}"\n\n`),e.push(t)}}),e.forEach(t=>t.remove())}},replaceRootContainer(t,e,n){let i=new Set(["id",H,B,"data-phx-main",O]);if(t.tagName.toLowerCase()===e.toLowerCase())return Array.from(t.attributes).filter(t=>!i.has(t.name.toLowerCase())).forEach(e=>t.removeAttribute(e.name)),Object.keys(n).filter(t=>!i.has(t.toLowerCase())).forEach(e=>t.setAttribute(e,n[e])),t;{let r=document.createElement(e);return Object.keys(n).forEach(t=>r.setAttribute(t,n[t])),i.forEach(e=>r.setAttribute(e,t.getAttribute(e))),r.innerHTML=t.innerHTML,t.replaceWith(r),r}},getSticky(t,e,n){let i=(lt.private(t,"sticky")||[]).find(([t])=>e===t);if(i){let[t,e,n]=i;return n}return"function"==typeof n?n():n},deleteSticky(t,e){this.updatePrivate(t,"sticky",[],t=>t.filter(([t,n])=>t!==e))},putSticky(t,e,n){let i=n(t);this.updatePrivate(t,"sticky",[],t=>{let r=t.findIndex(([t])=>e===t);return r>=0?t[r]=[e,n,i]:t.push([e,n,i]),t})},applyStickyOperations(t){let e=lt.private(t,"sticky");e&&e.forEach(([e,n,i])=>this.putSticky(t,e,n))}},ht=lt,ut=class{static isActive(t,e){let n=void 0===e._phxRef,i=t.getAttribute("data-phx-active-refs").split(",").indexOf(dt.genFileRef(e))>=0;return e.size>0&&(n||i)}static isPreflighted(t,e){return t.getAttribute("data-phx-preflighted-refs").split(",").indexOf(dt.genFileRef(e))>=0&&this.isActive(t,e)}constructor(t,e,n){this.ref=dt.genFileRef(e),this.fileEl=t,this.file=e,this.view=n,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("phx:live-file:updated",this._onElUpdated)}metadata(){return this.meta}progress(t){this._progress=Math.floor(t),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{dt.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(t="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:t}),dt.clearFiles(this.fileEl)}onDone(t){this._onDone=()=>{this.fileEl.removeEventListener("phx:live-file:updated",this._onElUpdated),t()}}onElUpdated(){-1===this.fileEl.getAttribute("data-phx-active-refs").split(",").indexOf(this.ref)&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,size:this.file.size,type:this.file.type,ref:this.ref}}uploader(t){if(this.meta.uploader){let e=t[this.meta.uploader]||G("no uploader configured for "+this.meta.uploader);return{name:this.meta.uploader,callback:e}}return{name:"channel",callback:ot}}zipPostFlight(t){this.meta=t.entries[this.ref],this.meta||G("no preflight upload response returned with ref "+this.ref,{input:this.fileEl,response:t})}},ct=0,dt=class{static genFileRef(t){let e=t._phxRef;return void 0!==e?e:(t._phxRef=(ct++).toString(),t._phxRef)}static getEntryDataURL(t,e,n){let i=this.activeFiles(t).find(t=>this.genFileRef(t)===e);n(URL.createObjectURL(i))}static hasUploadsInProgress(t){let e=0;return ht.findUploadInputs(t).forEach(t=>{t.getAttribute("data-phx-preflighted-refs")!==t.getAttribute("data-phx-done-refs")&&e++}),e>0}static serializeUploads(t){let e=this.activeFiles(t),n={};return e.forEach(e=>{let i={path:t.name},r=t.getAttribute(I);n[r]=n[r]||[],i.ref=this.genFileRef(e),i.name=e.name||i.ref,i.type=e.type,i.size=e.size,n[r].push(i)}),n}static clearFiles(t){t.value=null,t.removeAttribute(I),ht.putPrivate(t,"files",[])}static untrackFile(t,e){ht.putPrivate(t,"files",ht.private(t,"files").filter(t=>!Object.is(t,e)))}static trackFiles(t,e){if(null!==t.getAttribute("multiple")){let n=e.filter(e=>!this.activeFiles(t).find(t=>Object.is(t,e)));ht.putPrivate(t,"files",this.activeFiles(t).concat(n)),t.value=null}else ht.putPrivate(t,"files",e)}static activeFileInputs(t){let e=ht.findUploadInputs(t);return Array.from(e).filter(t=>t.files&&this.activeFiles(t).length>0)}static activeFiles(t){return(ht.private(t,"files")||[]).filter(e=>ut.isActive(t,e))}static inputsAwaitingPreflight(t){let e=ht.findUploadInputs(t);return Array.from(e).filter(t=>this.filesAwaitingPreflight(t).length>0)}static filesAwaitingPreflight(t){return this.activeFiles(t).filter(e=>!ut.isPreflighted(t,e))}constructor(t,e,n){this.view=e,this.onComplete=n,this._entries=Array.from(dt.filesAwaitingPreflight(t)||[]).map(n=>new ut(t,n,e)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(t,e,n){this._entries=this._entries.map(e=>(e.zipPostFlight(t),e.onDone(()=>{this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()}),e));let i=this._entries.reduce((t,e)=>{let{name:i,callback:r}=e.uploader(n.uploaders);return t[i]=t[i]||{callback:r,entries:[]},t[i].entries.push(e),t},{});for(let r in i){let{callback:o,entries:s}=i[r];o(s,e,t,n)}}},ft={LiveFileUpload:{activeRefs(){return this.el.getAttribute("data-phx-active-refs")},preflightedRefs(){return this.el.getAttribute("data-phx-preflighted-refs")},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let t=this.preflightedRefs();this.preflightedWas!==t&&(this.preflightedWas=t,""===t&&this.__view.cancelSubmit(this.el.form)),""===this.activeRefs()&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent("phx:live-file:updated"))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(I)),dt.getEntryDataURL(this.inputEl,this.ref,t=>{this.url=t,this.el.src=t})},destroyed(){URL.revokeObjectURL(this.url)}}};var pt="undefined"==typeof document?void 0:document,gt=!!pt&&"content"in pt.createElement("template"),mt=!!pt&&pt.createRange&&"createContextualFragment"in pt.createRange();function vt(t){return t=t.trim(),gt?function(t){var e=pt.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}(t):mt?function(t){return Z||(Z=pt.createRange()).selectNode(pt.body),Z.createContextualFragment(t).childNodes[0]}(t):function(t){var e=pt.createElement("body");return e.innerHTML=t,e.childNodes[0]}(t)}function yt(t,e){var n,i,r=t.nodeName,o=e.nodeName;return r===o||(n=r.charCodeAt(0),i=o.charCodeAt(0),n<=90&&i>=97?r===o.toUpperCase():i<=90&&n>=97&&o===r.toUpperCase())}function bt(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n))}var wt={OPTION:function(t,e){var n=t.parentNode;if(n){var i=n.nodeName.toUpperCase();"OPTGROUP"===i&&(i=(n=n.parentNode)&&n.nodeName.toUpperCase()),"SELECT"!==i||n.hasAttribute("multiple")||(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),n.selectedIndex=-1)}bt(t,e,"selected")},INPUT:function(t,e){bt(t,e,"checked"),bt(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n=e.value;t.value!==n&&(t.value=n);var i=t.firstChild;if(i){var r=i.nodeValue;if(r==n||!n&&r==t.placeholder)return;i.nodeValue=n}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var n,i,r=-1,o=0,s=t.firstChild;s;)if("OPTGROUP"===(i=s.nodeName&&s.nodeName.toUpperCase()))s=(n=s).firstChild;else{if("OPTION"===i){if(s.hasAttribute("selected")){r=o;break}o++}!(s=s.nextSibling)&&n&&(s=n.nextSibling,n=null)}t.selectedIndex=r}}};function kt(){}function _t(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}var xt,Ct=(xt=function(t,e){var n,i,r,o,s=e.attributes;if(11!==e.nodeType&&11!==t.nodeType){for(var a=s.length-1;a>=0;a--)i=(n=s[a]).name,r=n.namespaceURI,o=n.value,r?(i=n.localName||i,t.getAttributeNS(r,i)!==o&&("xmlns"===n.prefix&&(i=n.name),t.setAttributeNS(r,i,o))):t.getAttribute(i)!==o&&t.setAttribute(i,o);for(var l=t.attributes,h=l.length-1;h>=0;h--)i=(n=l[h]).name,(r=n.namespaceURI)?(i=n.localName||i,e.hasAttributeNS(r,i)||t.removeAttributeNS(r,i)):e.hasAttribute(i)||t.removeAttribute(i)}},function(t,e,n){if(n||(n={}),"string"==typeof e)if("#document"===t.nodeName||"HTML"===t.nodeName||"BODY"===t.nodeName){var i=e;(e=pt.createElement("html")).innerHTML=i}else e=vt(e);var r=n.getNodeKey||_t,o=n.onBeforeNodeAdded||kt,s=n.onNodeAdded||kt,a=n.onBeforeElUpdated||kt,l=n.onElUpdated||kt,h=n.onBeforeNodeDiscarded||kt,u=n.onNodeDiscarded||kt,c=n.onBeforeElChildrenUpdated||kt,d=!0===n.childrenOnly,f=Object.create(null),p=[];function g(t){p.push(t)}function m(t,e,n){!1!==h(t)&&(e&&e.removeChild(t),u(t),function t(e,n){if(1===e.nodeType)for(var i=e.firstChild;i;){var o=void 0;n&&(o=r(i))?g(o):(u(i),i.firstChild&&t(i,n)),i=i.nextSibling}}(t,n))}function v(t){s(t);for(var e=t.firstChild;e;){var n=e.nextSibling,i=r(e);if(i){var o=f[i];o&&yt(e,o)?(e.parentNode.replaceChild(o,e),y(o,e)):v(e)}else v(e);e=n}}function y(t,e,n){var i=r(e);if(i&&delete f[i],!n){if(!1===a(t,e))return;if(xt(t,e),l(t),!1===c(t,e))return}"TEXTAREA"!==t.nodeName?function(t,e){var n,i,s,a,l,h=e.firstChild,u=t.firstChild;t:for(;h;){for(a=h.nextSibling,n=r(h);u;){if(s=u.nextSibling,h.isSameNode&&h.isSameNode(u)){h=a,u=s;continue t}i=r(u);var c=u.nodeType,d=void 0;if(c===h.nodeType&&(1===c?(n?n!==i&&((l=f[n])?s===l?d=!1:(t.insertBefore(l,u),i?g(i):m(u,t,!0),u=l):d=!1):i&&(d=!1),(d=!1!==d&&yt(u,h))&&y(u,h)):3!==c&&8!=c||(d=!0,u.nodeValue!==h.nodeValue&&(u.nodeValue=h.nodeValue))),d){h=a,u=s;continue t}i?g(i):m(u,t,!0),u=s}if(n&&(l=f[n])&&yt(l,h))t.appendChild(l),y(l,h);else{var p=o(h);!1!==p&&(p&&(h=p),h.actualize&&(h=h.actualize(t.ownerDocument||pt)),t.appendChild(h),v(h))}h=a,u=s}!function(t,e,n){for(;e;){var i=e.nextSibling;(n=r(e))?g(n):m(e,t,!0),e=i}}(t,u,i);var b=wt[t.nodeName];b&&b(t,e)}(t,e):wt.TEXTAREA(t,e)}!function t(e){if(1===e.nodeType||11===e.nodeType)for(var n=e.firstChild;n;){var i=r(n);i&&(f[i]=n),t(n),n=n.nextSibling}}(t);var b,w,k=t,_=k.nodeType,x=e.nodeType;if(!d)if(1===_)1===x?yt(t,e)||(u(t),k=function(t,e){for(var n=t.firstChild;n;){var i=n.nextSibling;e.appendChild(n),n=i}return e}(t,(b=e.nodeName,(w=e.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==w?pt.createElementNS(w,b):pt.createElement(b)))):k=e;else if(3===_||8===_){if(x===_)return k.nodeValue!==e.nodeValue&&(k.nodeValue=e.nodeValue),k;k=e}if(k===e)u(t);else{if(e.isSameNode&&e.isSameNode(k))return;if(y(k,e,d),p)for(var C=0,E=p.length;C{if(n&&n.isSameNode(t)&&ht.isFormInput(t))return ht.mergeFocusedInput(t,e),!1}})}constructor(t,e,n,i,r){this.view=t,this.liveSocket=t.liveSocket,this.container=e,this.id=n,this.rootID=t.root.id,this.html=i,this.targetCID=r,this.cidPatch=K(this.targetCID),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(t,e){this.callbacks["before"+t].push(e)}after(t,e){this.callbacks["after"+t].push(e)}trackBefore(t,...e){this.callbacks["before"+t].forEach(t=>t(...e))}trackAfter(t,...e){this.callbacks["after"+t].forEach(t=>t(...e))}markPrunableContentForRemoval(){ht.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",t=>{t.setAttribute("data-phx-prune","")})}perform(){let{view:t,liveSocket:e,container:n,html:i}=this,r=this.isCIDPatch()?this.targetCIDContainer(i):n;if(this.isCIDPatch()&&!r)return;let o=e.getActiveElement(),{selectionStart:s,selectionEnd:a}=o&&ht.hasSelectionRange(o)?o:{},l=e.binding("update"),h=e.binding("feedback-for"),u=e.binding("disable-with"),c=e.binding("trigger-action"),d=e.binding("remove"),f=[],p=[],g=[],m=[],v=null,y=e.time("premorph container prep",()=>this.buildDiffHTML(n,i,l,r));return this.trackBefore("added",n),this.trackBefore("updated",n,n),e.time("morphdom",()=>{Ct(r,y,{childrenOnly:null===r.getAttribute(P),getNodeKey:t=>ht.isPhxDestroyed(t)?null:t.id,onBeforeNodeAdded:t=>(this.trackBefore("added",t),t),onNodeAdded:e=>{e instanceof HTMLImageElement&&e.srcset?e.srcset=e.srcset:e instanceof HTMLVideoElement&&e.autoplay&&e.play(),ht.isNowTriggerFormExternal(e,c)&&(v=e),ht.discardError(r,e,h),(ht.isPhxChild(e)&&t.ownsElement(e)||ht.isPhxSticky(e)&&t.ownsElement(e.parentNode))&&this.trackAfter("phxChildAdded",e),f.push(e)},onNodeDiscarded:t=>{(ht.isPhxChild(t)||ht.isPhxSticky(t))&&e.destroyViewByEl(t),this.trackAfter("discarded",t)},onBeforeNodeDiscarded:t=>!(!t.getAttribute||null===t.getAttribute("data-phx-prune"))||(null===t.parentNode||!ht.isPhxUpdate(t.parentNode,l,["append","prepend"])||!t.id)&&(t.getAttribute&&t.getAttribute(d)?(m.push(t),!1):!this.skipCIDSibling(t)),onElUpdated:t=>{ht.isNowTriggerFormExternal(t,c)&&(v=t),p.push(t)},onBeforeElUpdated:(t,e)=>{if(ht.cleanChildNodes(e,l),this.skipCIDSibling(e))return!1;if(ht.isPhxSticky(t))return!1;if(ht.isIgnored(t,l))return this.trackBefore("updated",t,e),ht.mergeAttrs(t,e,{isIgnored:!0}),p.push(t),ht.applyStickyOperations(t),!1;if("number"===t.type&&t.validity&&t.validity.badInput)return!1;if(!ht.syncPendingRef(t,e,u))return ht.isUploadInput(t)&&(this.trackBefore("updated",t,e),p.push(t)),ht.applyStickyOperations(t),!1;if(ht.isPhxChild(e)){let n=t.getAttribute(H);return ht.mergeAttrs(t,e,{exclude:[B]}),""!==n&&t.setAttribute(H,n),t.setAttribute(O,this.rootID),ht.applyStickyOperations(t),!1}return ht.copyPrivates(e,t),ht.discardError(r,e,h),o&&t.isSameNode(o)&&ht.isFormInput(t)?(this.trackBefore("updated",t,e),ht.mergeFocusedInput(t,e),ht.syncAttrsToProps(t),p.push(t),ht.applyStickyOperations(t),!1):(ht.isPhxUpdate(e,l,["append","prepend"])&&g.push(new class{constructor(t,e,n){let i=new Set,r=new Set([...e.children].map(t=>t.id)),o=[];Array.from(t.children).forEach(t=>{if(t.id&&(i.add(t.id),r.has(t.id))){let e=t.previousElementSibling&&t.previousElementSibling.id;o.push({elementId:t.id,previousElementId:e})}}),this.containerId=e.id,this.updateType=n,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(t=>!i.has(t))}perform(){let t=ht.byId(this.containerId);this.elementsToModify.forEach(e=>{e.previousElementId?rt(document.getElementById(e.previousElementId),t=>{rt(document.getElementById(e.elementId),e=>{e.previousElementSibling&&e.previousElementSibling.id==t.id||t.insertAdjacentElement("afterend",e)})}):rt(document.getElementById(e.elementId),e=>{null==e.previousElementSibling||t.insertAdjacentElement("afterbegin",e)})}),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach(e=>{rt(document.getElementById(e),e=>t.insertAdjacentElement("afterbegin",e))})}}(t,e,e.getAttribute(l))),ht.syncAttrsToProps(e),ht.applyStickyOperations(e),this.trackBefore("updated",t,e),!0)}})}),e.isDebugEnabled()&&function(){let t=new Set,e=document.querySelectorAll("*[id]");for(let n=0,i=e.length;n0&&e.time("post-morph append/prepend restoration",()=>{g.forEach(t=>t.perform())}),e.silenceEvents(()=>ht.restoreFocus(o,s,a)),ht.dispatchEvent(document,"phx:update"),f.forEach(t=>this.trackAfter("added",t)),p.forEach(t=>this.trackAfter("updated",t)),m.length>0&&(e.transitionRemoves(m),e.requestDOMUpdate(()=>{m.forEach(t=>{let n=ht.firstPhxChild(t);n&&e.destroyViewByEl(n),t.remove()}),this.trackAfter("transitionsDiscarded",m)})),v&&(e.disconnect(),v.submit()),!0}isCIDPatch(){return this.cidPatch}skipCIDSibling(t){return t.nodeType===Node.ELEMENT_NODE&&null!==t.getAttribute("data-phx-skip")}targetCIDContainer(t){if(!this.isCIDPatch())return;let[e,...n]=ht.findComponentNodeList(this.container,this.targetCID);return 0===n.length&&1===ht.childNodeLength(t)?e:e&&e.parentNode}buildDiffHTML(t,e,n,i){let r=this.isCIDPatch(),o=r&&i.getAttribute(P)===this.targetCID.toString();if(!r||o)return e;{let t=null,n=document.createElement("template");t=ht.cloneNode(i);let[r,...o]=ht.findComponentNodeList(t,this.targetCID);return n.innerHTML=e,o.forEach(t=>t.remove()),Array.from(t.childNodes).forEach(t=>{t.id&&t.nodeType===Node.ELEMENT_NODE&&t.getAttribute(P)!==this.targetCID.toString()&&(t.setAttribute("data-phx-skip",""),t.innerHTML="")}),Array.from(n.content.childNodes).forEach(e=>t.insertBefore(e,r)),r.remove(),t.outerHTML}}},At=class{static extract(t){let{[Y]:e,[W]:n,[X]:i}=t;return delete t[Y],delete t[W],delete t[X],{diff:t,title:i,reply:e||null,events:n||[]}}constructor(t,e){this.viewId=t,this.rendered={},this.mergeDiff(e)}parentViewId(){return this.viewId}toString(t){return this.recursiveToString(this.rendered,this.rendered.c,t)}recursiveToString(t,e=t.c,n){let i={buffer:"",components:e,onlyCids:n=n?new Set(n):null};return this.toOutputBuffer(t,null,i),i.buffer}componentCIDs(t){return Object.keys(t.c||{}).map(t=>parseInt(t))}isComponentOnlyDiff(t){return!!t.c&&1===Object.keys(t).length}getComponent(t,e){return t.c[e]}mergeDiff(t){let e=t.c,n={};if(delete t.c,this.rendered=this.mutableMerge(this.rendered,t),this.rendered.c=this.rendered.c||{},e){let i=this.rendered.c;for(let t in e)e[t]=this.cachedFindComponent(t,e[t],i,e,n);for(let t in e)i[t]=e[t];t.c=e}}cachedFindComponent(t,e,n,i,r){if(r[t])return r[t];{let o,s,a=e[z];if(K(a)){let t;t=a>0?this.cachedFindComponent(a,i[a],n,i,r):n[-a],s=t[z],o=this.cloneMerge(t,e),o[z]=s}else o=void 0!==e[z]?e:this.cloneMerge(n[t]||{},e);return r[t]=o,o}}mutableMerge(t,e){return void 0!==e[z]?e:(this.doMutableMerge(t,e),t)}doMutableMerge(t,e){for(let n in e){let i=e[n],r=t[n];nt(i)&&void 0===i[z]&&nt(r)?this.doMutableMerge(r,i):t[n]=i}}cloneMerge(t,e){let n={...t,...e};for(let i in n){let r=e[i],o=t[i];nt(r)&&void 0===r[z]&&nt(o)&&(n[i]=this.cloneMerge(o,r))}return n}componentToString(t){return this.recursiveCIDToString(this.rendered.c,t)}pruneCIDs(t){t.forEach(t=>delete this.rendered.c[t])}get(){return this.rendered}isNewFingerprint(t={}){return!!t[z]}templateStatic(t,e){return"number"==typeof t?e[t]:t}toOutputBuffer(t,e,n){if(t[V])return this.comprehensionToBuffer(t,e,n);let{[z]:i}=t;i=this.templateStatic(i,e),n.buffer+=i[0];for(let r=1;ri.nodeType===Node.ELEMENT_NODE?i.getAttribute(P)?[t,!0]:(i.setAttribute(P,e),i.id||(i.id=`${this.parentViewId()}-${e}-${o}`),s&&(i.setAttribute("data-phx-skip",""),i.innerHTML=""),[!0,n]):""!==i.nodeValue.trim()?(G(`only HTML element tags are allowed at the root of components.\n\ngot: "${i.nodeValue.trim()}"\n\nwithin:\n`,r.innerHTML.trim()),i.replaceWith(this.createSpan(i.nodeValue,e)),[!0,n]):(i.remove(),[t,n]),[!1,!1]);return a||l?!a&&l?(G("expected at least one HTML element tag directly inside a component, but only subcomponents were found. A component must render at least one HTML tag directly inside itself.",r.innerHTML.trim()),r.innerHTML):r.innerHTML:(G("expected at least one HTML element tag inside a component, but the component is empty:\n",r.innerHTML.trim()),this.createSpan("",e).outerHTML)}createSpan(t,e){let n=document.createElement("span");return n.innerText=t,n.setAttribute(P,e),n}},St=1,Tt=class{static makeID(){return St++}static elementID(t){return t.phxHookId}constructor(t,e,n){this.__view=t,this.liveSocket=t.liveSocket,this.__callbacks=n,this.__listeners=new Set,this.__isDisconnected=!1,this.el=e,this.el.phxHookId=this.constructor.makeID();for(let t in this.__callbacks)this[t]=this.__callbacks[t]}__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(t,e={},n=function(){}){return this.__view.pushHookEvent(null,t,e,n)}pushEventTo(t,e,n={},i=function(){}){return this.__view.withinTargets(t,(t,r)=>t.pushHookEvent(r,e,n,i))}handleEvent(t,e){let n=(n,i)=>i?t:e(n.detail);return window.addEventListener("phx:"+t,n),this.__listeners.add(n),n}removeHandleEvent(t){let e=t(null,!0);window.removeEventListener("phx:"+e,t),this.__listeners.delete(t)}upload(t,e){return this.__view.dispatchUploads(t,e)}uploadTo(t,e,n){return this.__view.withinTargets(t,t=>t.dispatchUploads(e,n))}__cleanup__(){this.__listeners.forEach(t=>this.removeHandleEvent(t))}},Mt={exec(t,e,n,i,r){let[o,s]=r||[null,{}];("["===e.charAt(0)?JSON.parse(e):[[o,s]]).forEach(([r,a])=>{r===o&&s.data&&(a.data=Object.assign(a.data||{},s.data)),this.filterToEls(i,a).forEach(o=>{this["exec_"+r](t,e,n,i,o,a)})})},isVisible:t=>!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length>0),exec_dispatch(t,e,n,i,r,{to:o,event:s,detail:a,bubbles:l}){(a=a||{}).dispatcher=i,ht.dispatchEvent(r,s,{detail:a,bubbles:l})},exec_push(t,e,n,i,r,o){if(!n.isConnected())return;let{event:s,data:a,target:l,page_loading:h,loading:u,value:c,dispatcher:d}=o,f={loading:u,value:c,target:l,page_loading:!!h},p="change"===t&&d?d:i,g=l||p.getAttribute(n.binding("target"))||p;n.withinTargets(g,(n,r)=>{if("change"===t){let{newCid:t,_target:a,callback:l}=o;a=a||(i instanceof HTMLInputElement?i.name:void 0),a&&(f._target=a),n.pushInput(i,r,t,s||e,f,l)}else"submit"===t?n.submitForm(i,r,s||e,f):n.pushEvent(t,i,r,s||e,a,f)})},exec_add_class(t,e,n,i,r,{names:o,transition:s,time:a}){this.addOrRemoveClasses(r,o,[],s,a,n)},exec_remove_class(t,e,n,i,r,{names:o,transition:s,time:a}){this.addOrRemoveClasses(r,[],o,s,a,n)},exec_transition(t,e,n,i,r,{time:o,transition:s}){let[a,l,h]=s;n.transition(o,()=>this.addOrRemoveClasses(r,a.concat(l),[]),()=>this.addOrRemoveClasses(r,h,a.concat(l)))},exec_toggle(t,e,n,i,r,{display:o,ins:s,outs:a,time:l}){this.toggle(t,n,r,o,s,a,l)},exec_show(t,e,n,i,r,{display:o,transition:s,time:a}){this.show(t,n,r,o,s,a)},exec_hide(t,e,n,i,r,{display:o,transition:s,time:a}){this.hide(t,n,r,o,s,a)},exec_set_attr(t,e,n,i,r,{attr:[o,s]}){this.setOrRemoveAttrs(r,[[o,s]],[])},exec_remove_attr(t,e,n,i,r,{attr:o}){this.setOrRemoveAttrs(r,[],[o])},show(t,e,n,i,r,o){this.isVisible(n)||this.toggle(t,e,n,i,r,null,o)},hide(t,e,n,i,r,o){this.isVisible(n)&&this.toggle(t,e,n,i,null,r,o)},toggle(t,e,n,i,r,o,s){let[a,l,h]=r||[[],[],[]],[u,c,d]=o||[[],[],[]];if(a.length>0||u.length>0)if(this.isVisible(n)){let t=()=>{this.addOrRemoveClasses(n,c,a.concat(l).concat(h)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,u,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,d,c))})};n.dispatchEvent(new Event("phx:hide-start")),e.transition(s,t,()=>{this.addOrRemoveClasses(n,[],u.concat(d)),ht.putSticky(n,"toggle",t=>t.style.display="none"),n.dispatchEvent(new Event("phx:hide-end"))})}else{if("remove"===t)return;let r=()=>{this.addOrRemoveClasses(n,l,u.concat(c).concat(d)),ht.putSticky(n,"toggle",t=>t.style.display=i||"block"),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(n,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(n,h,l))})};n.dispatchEvent(new Event("phx:show-start")),e.transition(s,r,()=>{this.addOrRemoveClasses(n,[],a.concat(h)),n.dispatchEvent(new Event("phx:show-end"))})}else this.isVisible(n)?window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("phx:hide-start")),ht.putSticky(n,"toggle",t=>t.style.display="none"),n.dispatchEvent(new Event("phx:hide-end"))}):window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("phx:show-start")),ht.putSticky(n,"toggle",t=>t.style.display=i||"block"),n.dispatchEvent(new Event("phx:show-end"))})},addOrRemoveClasses(t,e,n,i,r,o){let[s,a,l]=i||[[],[],[]];if(s.length>0){let i=()=>this.addOrRemoveClasses(t,a.concat(s),[]),h=()=>this.addOrRemoveClasses(t,e.concat(l),n.concat(s).concat(a));return o.transition(r,i,h)}window.requestAnimationFrame(()=>{let[i,r]=ht.getSticky(t,"classes",[[],[]]),o=e.filter(e=>i.indexOf(e)<0&&!t.classList.contains(e)),s=n.filter(e=>r.indexOf(e)<0&&t.classList.contains(e)),a=i.filter(t=>n.indexOf(t)<0).concat(o),l=r.filter(t=>e.indexOf(t)<0).concat(s);ht.putSticky(t,"classes",t=>(t.classList.remove(...l),t.classList.add(...a),[a,l]))})},setOrRemoveAttrs(t,e,n){let[i,r]=ht.getSticky(t,"attrs",[[],[]]),o=e.map(([t,e])=>t).concat(n),s=i.filter(([t,e])=>!o.includes(t)).concat(e),a=r.filter(t=>!o.includes(t)).concat(n);ht.putSticky(t,"attrs",t=>(a.forEach(e=>t.removeAttribute(e)),s.forEach(([e,n])=>t.setAttribute(e,n)),[s,a]))},hasAllClasses:(t,e)=>e.every(e=>t.classList.contains(e)),isToggledOut(t,e){return!this.isVisible(t)||this.hasAllClasses(t,e)},filterToEls:(t,{to:e})=>e?ht.all(document,e):[t]},Lt=(t,e,n=[])=>{let i=new FormData(t),r=[];i.forEach((t,e,n)=>{t instanceof File&&r.push(e)}),r.forEach(t=>i.delete(t));let o=new URLSearchParams;for(let[t,e]of i.entries())(0===n.length||n.indexOf(t)>=0)&&o.append(t,e);for(let t in e)o.append(t,e[t]);return o.toString()},Dt=class{constructor(t,e,n,i){this.liveSocket=e,this.flash=i,this.parent=n,this.root=n?n.root:this,this.el=t,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.pruningCIDs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(t){t&&t()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.uploaders={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel("lv:"+this.id,()=>({redirect:this.redirect?this.href:void 0,url:this.redirect?void 0:this.href||void 0,params:this.connectParams(),session:this.getSession(),static:this.getStatic(),flash:this.flash})),this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel()}setHref(t){this.href=t}setRedirect(t){this.redirect=!0,this.href=t}isMain(){return null!==this.el.getAttribute("data-phx-main")}connectParams(){let t=this.liveSocket.params(this.el),e=ht.all(document,`[${this.binding("track-static")}]`).map(t=>t.src||t.href).filter(t=>"string"==typeof t);return e.length>0&&(t._track_static=e),t._mounts=this.joinCount,t}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(H)}getStatic(){let t=this.el.getAttribute(B);return""===t?null:t}destroy(t=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let e=()=>{t();for(let t in this.viewHooks)this.destroyHook(this.viewHooks[t])};ht.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",e).receive("error",e).receive("timeout",e)}setContainerClasses(...t){this.el.classList.remove("phx-connected","phx-loading","phx-error"),this.el.classList.add(...t)}showLoader(t){if(clearTimeout(this.loaderTimer),t)this.loaderTimer=setTimeout(()=>this.showLoader(),t);else{for(let t in this.viewHooks)this.viewHooks[t].__disconnected();this.setContainerClasses("phx-loading")}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses("phx-connected")}triggerReconnected(){for(let t in this.viewHooks)this.viewHooks[t].__reconnected()}log(t,e){this.liveSocket.log(this,t,e)}transition(t,e,n=function(){}){this.liveSocket.transition(t,e,n)}withinTargets(t,e){if(t instanceof HTMLElement||t instanceof SVGElement)return this.liveSocket.owner(t,n=>e(n,t));if(K(t)){0===ht.findComponentNodeList(this.el,t).length?G("no component found matching phx-target of "+t):e(this,parseInt(t))}else{let n=Array.from(document.querySelectorAll(t));0===n.length&&G(`nothing found matching the phx-target selector "${t}"`),n.forEach(t=>this.liveSocket.owner(t,n=>e(n,t)))}}applyDiff(t,e,n){this.log(t,()=>["",tt(e)]);let{diff:i,reply:r,events:o,title:s}=At.extract(e);return s&&ht.putTitle(s),n({diff:i,reply:r,events:o}),r}onJoin(t){let{rendered:e,container:n}=t;if(n){let[t,e]=n;this.el=ht.replaceRootContainer(this.el,t,e)}this.childJoins=0,this.joinPending=!0,this.flash=null,at.dropLocal(this.liveSocket.localStorage,window.location.pathname,"consecutive-reloads"),this.applyDiff("mount",e,({diff:e,events:n})=>{this.rendered=new At(this.id,e);let i=this.renderContainer(null,"join");this.dropPendingRefs();let r=this.formsForRecovery(i);this.joinCount++,r.length>0?r.forEach(([t,e,o],s)=>{this.pushFormRecovery(t,o,t=>{s===r.length-1&&this.onJoinComplete(t,i,n)})}):this.onJoinComplete(t,i,n)})}dropPendingRefs(){ht.all(document,`[${R}="${this.id}"][${N}]`,t=>{t.removeAttribute(N),t.removeAttribute(R)})}onJoinComplete({live_patch:t},e,n){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(t,e,n);0===ht.findPhxChildrenInFragment(e,this.id).filter(t=>{let e=t.id&&this.el.querySelector(`[id="${t.id}"]`),n=e&&e.getAttribute(B);return n&&t.setAttribute(B,n),this.joinChild(t)}).length?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(t,e,n)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(t,e,n)])}attachTrueDocEl(){this.el=ht.byId(this.id),this.el.setAttribute(O,this.root.id)}applyJoinPatch(t,e,n){this.attachTrueDocEl();let i=new Et(this,this.el,this.id,e,null);if(i.markPrunableContentForRemoval(),this.performPatch(i,!1),this.joinNewChildren(),ht.all(this.el,`[${this.binding("hook")}], [data-phx-hook]`,t=>{let e=this.addHook(t);e&&e.__mounted()}),this.joinPending=!1,this.liveSocket.dispatchEvents(n),this.applyPendingUpdates(),t){let{kind:e,to:n}=t;this.liveSocket.historyPatch(n,e)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(t,e){this.liveSocket.triggerDOM("onBeforeElUpdated",[t,e]);let n=this.getHook(t),i=n&&ht.isIgnored(t,this.binding("update"));if(n&&!t.isEqualNode(e)&&(!i||(r=t.dataset,o=e.dataset,JSON.stringify(r)!==JSON.stringify(o))))return n.__beforeUpdate(),n;var r,o}performPatch(t,e){let n=[],i=!1,r=new Set;return t.after("added",t=>{this.liveSocket.triggerDOM("onNodeAdded",[t]);let e=this.addHook(t);e&&e.__mounted()}),t.after("phxChildAdded",t=>{ht.isPhxSticky(t)?this.liveSocket.joinRootViews():i=!0}),t.before("updated",(t,e)=>{this.triggerBeforeUpdateHook(t,e)&&r.add(t.id)}),t.after("updated",t=>{r.has(t.id)&&this.getHook(t).__updated()}),t.after("discarded",t=>{t.nodeType===Node.ELEMENT_NODE&&n.push(t)}),t.after("transitionsDiscarded",t=>this.afterElementsRemoved(t,e)),t.perform(),this.afterElementsRemoved(n,e),i}afterElementsRemoved(t,e){let n=[];t.forEach(t=>{let e=ht.all(t,`[${P}]`),i=ht.all(t,`[${this.binding("hook")}]`);e.concat(t).forEach(t=>{let e=this.componentID(t);K(e)&&-1===n.indexOf(e)&&n.push(e)}),i.concat(t).forEach(t=>{let e=this.getHook(t);e&&this.destroyHook(e)})}),e&&this.maybePushComponentsDestroyed(n)}joinNewChildren(){ht.findPhxChildren(this.el,this.id).forEach(t=>this.joinChild(t))}getChildById(t){return this.root.children[this.id][t]}getDescendentByEl(t){return t.id===this.id?this:this.children[t.getAttribute(U)][t.id]}destroyDescendent(t){for(let e in this.root.children)for(let n in this.root.children[e])if(n===t)return this.root.children[e][n].destroy()}joinChild(t){if(!this.getChildById(t.id)){let e=new Dt(t,this.liveSocket,this);return this.root.children[this.id][e.id]=e,e.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(t){this.childJoins--,0===this.childJoins&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([t,e])=>{t.isDestroyed()||e()}),this.pendingJoinOps=[]})}update(t,e){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&!ht.isPhxSticky(this.el))return this.pendingDiffs.push({diff:t,events:e});this.rendered.mergeDiff(t);let n=!1;this.rendered.isComponentOnlyDiff(t)?this.liveSocket.time("component patch complete",()=>{ht.findParentCIDs(this.el,this.rendered.componentCIDs(t)).forEach(e=>{this.componentPatch(this.rendered.getComponent(t,e),e)&&(n=!0)})}):it(t)||this.liveSocket.time("full patch complete",()=>{let e=this.renderContainer(t,"update"),i=new Et(this,this.el,this.id,e,null);n=this.performPatch(i,!0)}),this.liveSocket.dispatchEvents(e),n&&this.joinNewChildren()}renderContainer(t,e){return this.liveSocket.time(`toString diff (${e})`,()=>{let e=this.el.tagName,n=t?this.rendered.componentCIDs(t).concat(this.pruningCIDs):null;return`<${e}>${this.rendered.toString(n)}`})}componentPatch(t,e){if(it(t))return!1;let n=this.rendered.componentToString(e),i=new Et(this,this.el,this.id,n,e);return this.performPatch(i,!0)}getHook(t){return this.viewHooks[Tt.elementID(t)]}addHook(t){if(Tt.elementID(t)||!t.getAttribute)return;let e=t.getAttribute("data-phx-hook")||t.getAttribute(this.binding("hook"));if(e&&!this.ownsElement(t))return;let n=this.liveSocket.getHookCallbacks(e);if(n){t.id||G(`no DOM ID for hook "${e}". Hooks require a unique ID on each element.`,t);let i=new Tt(this,t,n);return this.viewHooks[Tt.elementID(i.el)]=i,i}null!==e&&G(`unknown hook found for "${e}"`,t)}destroyHook(t){t.__destroyed(),t.__cleanup__(),delete this.viewHooks[Tt.elementID(t.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:t,events:e})=>this.update(t,e)),this.pendingDiffs=[]}onChannel(t,e){this.liveSocket.onChannel(this.channel,t,t=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>e(t)]):this.liveSocket.requestDOMUpdate(()=>e(t))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",t=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",t,({diff:t,events:e})=>this.update(t,e))})}),this.onChannel("redirect",({to:t,flash:e})=>this.onRedirect({to:t,flash:e})),this.onChannel("live_patch",t=>this.onLivePatch(t)),this.onChannel("live_redirect",t=>this.onLiveRedirect(t)),this.channel.onError(t=>this.onError(t)),this.channel.onClose(t=>this.onClose(t))}destroyAllChildren(){for(let t in this.root.children[this.id])this.getChildById(t).destroy()}onLiveRedirect(t){let{to:e,kind:n,flash:i}=t,r=this.expandURL(e);this.liveSocket.historyRedirect(r,n,i)}onLivePatch(t){let{to:e,kind:n}=t;this.href=this.expandURL(e),this.liveSocket.historyPatch(e,n)}expandURL(t){return t.startsWith("/")?`${window.location.protocol}//${window.location.host}${t}`:t}onRedirect({to:t,flash:e}){this.liveSocket.redirect(t,e)}isDestroyed(){return this.destroyed}join(t){this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=e=>{e=e||function(){},t?t(this.joinCount,e):e()},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(t){return"unauthorized"===t.reason||"stale"===t.reason?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",t]),this.onRedirect({to:this.href})):((t.redirect||t.live_redirect)&&(this.joinPending=!1,this.channel.leave()),t.redirect?this.onRedirect(t.redirect):t.live_redirect?this.onLiveRedirect(t.live_redirect):(this.log("error",()=>["unable to join",t]),this.liveSocket.reloadWithJitter(this)))}onClose(t){if(!this.isDestroyed()){if(this.isJoinPending()&&"hidden"!==document.visibilityState||this.liveSocket.hasPendingLink()&&"leave"!==t)return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(200)}}onError(t){this.onClose(t),this.log("error",()=>["view crashed",t]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&ht.dispatchEvent(window,"phx:page-loading-start",{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses("phx-loading","phx-error")}pushWithReply(t,e,n,i=function(){}){if(!this.isConnected())return;let[r,[o],s]=t?t():[null,[],{}],a=function(){};return(s.page_loading||o&&null!==o.getAttribute(this.binding("page-loading")))&&(a=this.liveSocket.withPageLoading({kind:"element",target:o})),"number"!=typeof n.cid&&delete n.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(e,n,3e4).receive("ok",t=>{null!==r&&this.undoRefs(r);let e=e=>{t.redirect&&this.onRedirect(t.redirect),t.live_patch&&this.onLivePatch(t.live_patch),t.live_redirect&&this.onLiveRedirect(t.live_redirect),a(),i(t,e)};t.diff?this.liveSocket.requestDOMUpdate(()=>{let n=this.applyDiff("update",t.diff,({diff:t,events:e})=>{this.update(t,e)});e(n)}):e(null)}))}undoRefs(t){ht.all(document,`[${R}="${this.id}"][${N}="${t}"]`,t=>{let e=t.getAttribute("data-phx-disabled");t.removeAttribute(N),t.removeAttribute(R),null!==t.getAttribute("data-phx-readonly")&&(t.readOnly=!1,t.removeAttribute("data-phx-readonly")),null!==e&&(t.disabled="true"===e,t.removeAttribute("data-phx-disabled")),D.forEach(e=>ht.removeClass(t,e));let n=t.getAttribute("data-phx-disable-with-restore");null!==n&&(t.innerText=n,t.removeAttribute("data-phx-disable-with-restore"));let i=ht.private(t,N);if(i){let e=this.triggerBeforeUpdateHook(t,i);Et.patchEl(t,i,this.liveSocket.getActiveElement()),e&&e.__updated(),ht.deletePrivate(t,N)}})}putRef(t,e,n={}){let i=this.ref++,r=this.binding("disable-with");return n.loading&&(t=t.concat(ht.all(document,n.loading))),t.forEach(t=>{t.classList.add(`phx-${e}-loading`),t.setAttribute(N,i),t.setAttribute(R,this.el.id);let n=t.getAttribute(r);null!==n&&(t.getAttribute("data-phx-disable-with-restore")||t.setAttribute("data-phx-disable-with-restore",t.innerText),""!==n&&(t.innerText=n),t.setAttribute("disabled",""))}),[i,t,n]}componentID(t){let e=t.getAttribute&&t.getAttribute(P);return e?parseInt(e):null}targetComponentID(t,e,n={}){if(K(e))return e;let i=t.getAttribute(this.binding("target"));return K(i)?parseInt(i):e&&(null!==i||n.target)?this.closestComponentID(e):null}closestComponentID(t){return K(t)?t:t?rt(t.closest(`[${P}]`),t=>this.ownsElement(t)&&this.componentID(t)):null}pushHookEvent(t,e,n,i){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",e,n]),!1;let[r,o,s]=this.putRef([],"hook");return this.pushWithReply(()=>[r,o,s],"event",{type:"hook",event:e,value:n,cid:this.closestComponentID(t)},(t,e)=>i(e,r)),r}extractMeta(t,e,n){let i=this.binding("value-");for(let n=0;n=0&&!t.checked&&delete e.value),n){e||(e={});for(let t in n)e[t]=n[t]}return e}pushEvent(t,e,n,i,r,o={}){this.pushWithReply(()=>this.putRef([e],t,o),"event",{type:t,event:i,value:this.extractMeta(e,r,o.value),cid:this.targetComponentID(e,n,o)})}pushFileProgress(t,e,n,i=function(){}){this.liveSocket.withinOwners(t.form,(r,o)=>{r.pushWithReply(null,"progress",{event:t.getAttribute(r.binding("progress")),ref:t.getAttribute(I),entry_ref:e,progress:n,cid:r.targetComponentID(t.form,o)},i)})}pushInput(t,e,n,i,r,o){let s,a,l=K(n)?n:this.targetComponentID(t.form,e),h=()=>this.putRef([t,t.form],"change",r);a=t.getAttribute(this.binding("change"))?Lt(t.form,{_target:r._target},[t.name]):Lt(t.form,{_target:r._target}),ht.isUploadInput(t)&&t.files&&t.files.length>0&&dt.trackFiles(t,Array.from(t.files)),s=dt.serializeUploads(t);let u={type:"form",event:i,value:a,uploads:s,cid:l};this.pushWithReply(h,"event",u,n=>{if(ht.showError(t,this.liveSocket.binding("feedback-for")),ht.isUploadInput(t)&&null!==t.getAttribute("data-phx-auto-upload")){if(dt.filesAwaitingPreflight(t).length>0){let[i,r]=h();this.uploadFiles(t.form,e,i,l,e=>{o&&o(n),this.triggerAwaitingSubmit(t.form)})}}else o&&o(n)})}triggerAwaitingSubmit(t){let e=this.getScheduledSubmit(t);if(e){let[n,i,r,o]=e;this.cancelSubmit(t),o()}}getScheduledSubmit(t){return this.formSubmits.find(([e,n,i,r])=>e.isSameNode(t))}scheduleSubmit(t,e,n,i){if(this.getScheduledSubmit(t))return!0;this.formSubmits.push([t,e,n,i])}cancelSubmit(t){this.formSubmits=this.formSubmits.filter(([e,n,i])=>!e.isSameNode(t)||(this.undoRefs(n),!1))}pushFormSubmit(t,e,n,i,r){let o=t=>!(et(t,this.binding("update")+"=ignore",t.form)||et(t,"data-phx-update=ignore",t.form)),s=t=>t.hasAttribute(this.binding("disable-with")),a=t=>"BUTTON"==t.tagName,l=t=>["INPUT","TEXTAREA","SELECT"].includes(t.tagName),h=()=>{let e=Array.from(t.elements),n=e.filter(s),r=e.filter(a).filter(o),h=e.filter(l).filter(o);return r.forEach(t=>{t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0}),h.forEach(t=>{t.setAttribute("data-phx-readonly",t.readOnly),t.readOnly=!0,t.files&&(t.setAttribute("data-phx-disabled",t.disabled),t.disabled=!0)}),t.setAttribute(this.binding("page-loading"),""),this.putRef([t].concat(n).concat(r).concat(h),"submit",i)},u=this.targetComponentID(t,e);if(dt.hasUploadsInProgress(t)){let[o,s]=h(),a=()=>this.pushFormSubmit(t,e,n,i,r);return this.scheduleSubmit(t,o,i,a)}if(dt.inputsAwaitingPreflight(t).length>0){let[o,s]=h(),a=()=>[o,s,i];this.uploadFiles(t,e,o,u,e=>{let i=Lt(t,{});this.pushWithReply(a,"event",{type:"form",event:n,value:i,cid:u},r)})}else{let e=Lt(t,{});this.pushWithReply(h,"event",{type:"form",event:n,value:e,cid:u},r)}}uploadFiles(t,e,n,i,r){let o=this.joinCount,s=dt.activeFileInputs(t),a=s.length;s.forEach(t=>{let i=new dt(t,this,()=>{a--,0===a&&r()});this.uploaders[t]=i;let s=i.entries().map(t=>t.toPreflightPayload()),l={ref:t.getAttribute(I),entries:s,cid:this.targetComponentID(t.form,e)};this.log("upload",()=>["sending preflight request",l]),this.pushWithReply(null,"allow_upload",l,t=>{if(this.log("upload",()=>["got preflight response",t]),t.error){this.undoRefs(n);let[e,i]=t.error;this.log("upload",()=>["error for entry "+e,i])}else{let e=t=>{this.channel.onError(()=>{this.joinCount===o&&t()})};i.initAdapterUpload(t,e,this.liveSocket)}})})}dispatchUploads(t,e){let n=ht.findUploadInputs(this.el).filter(e=>e.name===t);0===n.length?G(`no live file inputs found matching the name "${t}"`):n.length>1?G(`duplicate live file inputs found matching the name "${t}"`):ht.dispatchEvent(n[0],"track-uploads",{detail:{files:e}})}pushFormRecovery(t,e,n){this.liveSocket.withinOwners(t,(i,r)=>{let o=t.elements[0],s=t.getAttribute(this.binding("auto-recover"))||t.getAttribute(this.binding("change"));Mt.exec("change",s,i,o,["push",{_target:o.name,newCid:e,callback:n}])})}pushLinkPatch(t,e,n){let i=this.liveSocket.setPendingLink(t),r=e?()=>this.putRef([e],"click"):null,o=()=>this.liveSocket.redirect(window.location.href),s=this.pushWithReply(r,"live_patch",{url:t},e=>{this.liveSocket.requestDOMUpdate(()=>{e.link_redirect?this.liveSocket.replaceMain(t,null,n,i):(this.liveSocket.commitPendingLink(i)&&(this.href=t),this.applyPendingUpdates(),n&&n(i))})});s?s.receive("timeout",o):o()}formsForRecovery(t){if(0===this.joinCount)return[];let e=this.binding("change"),n=document.createElement("template");return n.innerHTML=t,ht.all(this.el,`form[${e}]`).filter(t=>t.id&&this.ownsElement(t)).filter(t=>t.elements.length>0).filter(t=>"ignore"!==t.getAttribute(this.binding("auto-recover"))).map(t=>{let i=n.content.querySelector(`form[id="${t.id}"][${e}="${t.getAttribute(e)}"]`);return i?[t,i,this.targetComponentID(i)]:[t,null,null]}).filter(([t,e,n])=>e)}maybePushComponentsDestroyed(t){let e=t.filter(t=>0===ht.findComponentNodeList(this.el,t).length);e.length>0&&(this.pruningCIDs.push(...e),this.pushWithReply(null,"cids_will_destroy",{cids:e},()=>{this.pruningCIDs=this.pruningCIDs.filter(t=>-1!==e.indexOf(t));let t=e.filter(t=>0===ht.findComponentNodeList(this.el,t).length);t.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:t},t=>{this.rendered.pruneCIDs(t.cids)})}))}ownsElement(t){return t.getAttribute(U)===this.id||rt(t.closest($),t=>t.id)===this.id}submitForm(t,e,n,i={}){ht.putPrivate(t,"phx-has-submitted",!0);let r=this.liveSocket.binding("feedback-for"),o=Array.from(t.elements);this.liveSocket.blurActiveElement(this),this.pushFormSubmit(t,e,n,i,()=>{o.forEach(t=>ht.showError(t,r)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(t){return this.liveSocket.binding(t)}},Pt=class{constructor(){this.transitions=new Set,this.pendingOps=[],this.reset()}reset(){this.transitions.forEach(t=>{cancelTimeout(t),this.transitions.delete(t)}),this.flushPendingOps()}after(t){0===this.size()?t():this.pushPendingOp(t)}addTransition(t,e,n){e();let i=setTimeout(()=>{this.transitions.delete(i),n(),0===this.size()&&this.flushPendingOps()},t);this.transitions.add(i)}pushPendingOp(t){this.pendingOps.push(t)}size(){return this.transitions.size}flushPendingOps(){this.pendingOps.forEach(t=>t()),this.pendingOps=[]}},Nt=function(t){return t};function Rt(t){return"translate("+t+",0)"}function It(t){return"translate(0,"+t+")"}function Ut(t){return e=>+t(e)}function Ot(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function jt(){return!this.__axis}function Ft(t,e){var n=[],i=null,r=null,o=6,s=6,a=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,h=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",c=1===t||3===t?Rt:It;function d(d){var f=null==i?e.ticks?e.ticks.apply(e,n):e.domain():i,p=null==r?e.tickFormat?e.tickFormat.apply(e,n):Nt:r,g=Math.max(o,0)+a,m=e.range(),v=+m[0]+l,y=+m[m.length-1]+l,b=(e.bandwidth?Ot:Ut)(e.copy(),l),w=d.selection?d.selection():d,k=w.selectAll(".domain").data([null]),_=w.selectAll(".tick").data(f,e).order(),x=_.exit(),C=_.enter().append("g").attr("class","tick"),E=_.select("line"),A=_.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(C),E=E.merge(C.append("line").attr("stroke","currentColor").attr(u+"2",h*o)),A=A.merge(C.append("text").attr("fill","currentColor").attr(u,h*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(k=k.transition(d),_=_.transition(d),E=E.transition(d),A=A.transition(d),x=x.transition(d).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=b(t))?c(t+l):this.getAttribute("transform")})),C.attr("opacity",1e-6).attr("transform",(function(t){var e=this.parentNode.__axis;return c((e&&isFinite(e=e(t))?e:b(t))+l)}))),x.remove(),k.attr("d",4===t||2===t?s?"M"+h*s+","+v+"H"+l+"V"+y+"H"+h*s:"M"+l+","+v+"V"+y:s?"M"+v+","+h*s+"V"+l+"H"+y+"V"+h*s:"M"+v+","+l+"H"+y),_.attr("opacity",1).attr("transform",(function(t){return c(b(t)+l)})),E.attr(u+"2",h*o),A.attr(u,h*g).text(p),w.filter(jt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=b}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(i=null==t?null:Array.from(t),d):i&&i.slice()},d.tickFormat=function(t){return arguments.length?(r=t,d):r},d.tickSize=function(t){return arguments.length?(o=s=+t,d):o},d.tickSizeInner=function(t){return arguments.length?(o=+t,d):o},d.tickSizeOuter=function(t){return arguments.length?(s=+t,d):s},d.tickPadding=function(t){return arguments.length?(a=+t,d):a},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Ht(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function $t(t){let e=t,n=t,i=t;function r(t,e,r=0,o=t.length){if(r>>1;i(t[n],e)<0?r=n+1:o=n}while(rt(e)-n,n=Ht,i=(e,n)=>Ht(t(e),n)),{left:r,center:function(t,n,i=0,o=t.length){const s=r(t,n,i,o-1);return s>i&&e(t[s-1],n)>-e(t[s],n)?s-1:s},right:function(t,e,r=0,o=t.length){if(r>>1;i(t[n],e)<=0?r=n+1:o=n}while(r=0?(o>=Bt?10:o>=qt?5:o>=Jt?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=Bt?10:o>=qt?5:o>=Jt?2:1)}function zt(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=Bt?r*=10:o>=qt?r*=5:o>=Jt&&(r*=2),e0))return a;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,i){if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););}))},n&&(r.count=function(e,i){return Wt.setTime(+e),Yt.setTime(+i),t(Wt),t(Yt),Math.floor(n(Wt,Yt))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?function(e){return i(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var Gt=Xt((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Gt.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Xt((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Gt:null};var Kt=Gt,Zt=(Gt.range,Xt((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()}))),Qt=Zt,te=(Zt.range,Xt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()}))),ee=te,ne=(te.range,Xt((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()}))),ie=ne,re=(ne.range,Xt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5,t=>t.getDate()-1)),oe=re;re.range;function se(t){return Xt((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var ae=se(0),le=se(1),he=se(2),ue=se(3),ce=se(4),de=se(5),fe=se(6),pe=(ae.range,le.range,he.range,ue.range,ce.range,de.range,fe.range,Xt((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),ge=pe,me=(pe.range,Xt((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()})));me.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Xt((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var ve=me,ye=(me.range,Xt((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()}))),be=ye,we=(ye.range,Xt((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()}))),ke=we,_e=(we.range,Xt((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}))),xe=_e;_e.range;function Ce(t){return Xt((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var Ee=Ce(0),Ae=Ce(1),Se=Ce(2),Te=Ce(3),Me=Ce(4),Le=Ce(5),De=Ce(6),Pe=(Ee.range,Ae.range,Se.range,Te.range,Me.range,Le.range,De.range,Xt((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),Ne=Pe,Re=(Pe.range,Xt((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));Re.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Xt((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Ie=Re;Re.range;function Ue(t,e,n,i,r,o){const s=[[Qt,1,1e3],[Qt,5,5e3],[Qt,15,15e3],[Qt,30,3e4],[o,1,6e4],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,36e5],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,864e5],[i,2,1728e5],[n,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function a(e,n,i){const r=Math.abs(n-e)/i,o=$t(([,,t])=>t).right(s,r);if(o===s.length)return t.every(zt(e/31536e6,n/31536e6,i));if(0===o)return Kt.every(Math.max(zt(e,n,i),1));const[a,l]=s[r/s[o-1][2][t.toLowerCase(),e]))}function tn(t,e,n){var i=We.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function en(t,e,n){var i=We.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function nn(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function rn(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function on(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function sn(t,e,n){var i=We.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function an(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function ln(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function hn(t,e,n){var i=We.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function un(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function cn(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function dn(t,e,n){var i=We.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function fn(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function pn(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function gn(t,e,n){var i=We.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function mn(t,e,n){var i=We.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function vn(t,e,n){var i=We.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function yn(t,e,n){var i=Ye.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function bn(t,e,n){var i=We.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function wn(t,e,n){var i=We.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function kn(t,e){return Ge(t.getDate(),e,2)}function _n(t,e){return Ge(t.getHours(),e,2)}function xn(t,e){return Ge(t.getHours()%12||12,e,2)}function Cn(t,e){return Ge(1+oe.count(ve(t),t),e,3)}function En(t,e){return Ge(t.getMilliseconds(),e,3)}function An(t,e){return En(t,e)+"000"}function Sn(t,e){return Ge(t.getMonth()+1,e,2)}function Tn(t,e){return Ge(t.getMinutes(),e,2)}function Mn(t,e){return Ge(t.getSeconds(),e,2)}function Ln(t){var e=t.getDay();return 0===e?7:e}function Dn(t,e){return Ge(ae.count(ve(t)-1,t),e,2)}function Pn(t){var e=t.getDay();return e>=4||0===e?ce(t):ce.ceil(t)}function Nn(t,e){return t=Pn(t),Ge(ce.count(ve(t),t)+(4===ve(t).getDay()),e,2)}function Rn(t){return t.getDay()}function In(t,e){return Ge(le.count(ve(t)-1,t),e,2)}function Un(t,e){return Ge(t.getFullYear()%100,e,2)}function On(t,e){return Ge((t=Pn(t)).getFullYear()%100,e,2)}function jn(t,e){return Ge(t.getFullYear()%1e4,e,4)}function Fn(t,e){var n=t.getDay();return Ge((t=n>=4||0===n?ce(t):ce.ceil(t)).getFullYear()%1e4,e,4)}function Hn(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ge(e/60|0,"0",2)+Ge(e%60,"0",2)}function $n(t,e){return Ge(t.getUTCDate(),e,2)}function Bn(t,e){return Ge(t.getUTCHours(),e,2)}function qn(t,e){return Ge(t.getUTCHours()%12||12,e,2)}function Jn(t,e){return Ge(1+xe.count(Ie(t),t),e,3)}function Vn(t,e){return Ge(t.getUTCMilliseconds(),e,3)}function zn(t,e){return Vn(t,e)+"000"}function Wn(t,e){return Ge(t.getUTCMonth()+1,e,2)}function Yn(t,e){return Ge(t.getUTCMinutes(),e,2)}function Xn(t,e){return Ge(t.getUTCSeconds(),e,2)}function Gn(t){var e=t.getUTCDay();return 0===e?7:e}function Kn(t,e){return Ge(Ee.count(Ie(t)-1,t),e,2)}function Zn(t){var e=t.getUTCDay();return e>=4||0===e?Me(t):Me.ceil(t)}function Qn(t,e){return t=Zn(t),Ge(Me.count(Ie(t),t)+(4===Ie(t).getUTCDay()),e,2)}function ti(t){return t.getUTCDay()}function ei(t,e){return Ge(Ae.count(Ie(t)-1,t),e,2)}function ni(t,e){return Ge(t.getUTCFullYear()%100,e,2)}function ii(t,e){return Ge((t=Zn(t)).getUTCFullYear()%100,e,2)}function ri(t,e){return Ge(t.getUTCFullYear()%1e4,e,4)}function oi(t,e){var n=t.getUTCDay();return Ge((t=n>=4||0===n?Me(t):Me.ceil(t)).getUTCFullYear()%1e4,e,4)}function si(){return"+0000"}function ai(){return"%"}function li(t){return+t}function hi(t){return Math.floor(+t/1e3)}Je=function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,s=t.shortDays,a=t.months,l=t.shortMonths,h=Ze(r),u=Qe(r),c=Ze(o),d=Qe(o),f=Ze(s),p=Qe(s),g=Ze(a),m=Qe(a),v=Ze(l),y=Qe(l),b={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:kn,e:kn,f:An,g:On,G:Fn,H:_n,I:xn,j:Cn,L:En,m:Sn,M:Tn,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:li,s:hi,S:Mn,u:Ln,U:Dn,V:Nn,w:Rn,W:In,x:null,X:null,y:Un,Y:jn,Z:Hn,"%":ai},w={a:function(t){return s[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:$n,e:$n,f:zn,g:ii,G:oi,H:Bn,I:qn,j:Jn,L:Vn,m:Wn,M:Yn,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:li,s:hi,S:Xn,u:Gn,U:Kn,V:Qn,w:ti,W:ei,x:null,X:null,y:ni,Y:ri,Z:si,"%":ai},k={a:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=v.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=g.exec(e.slice(n));return i?(t.m=m.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return C(t,e,n,i)},d:cn,e:cn,f:vn,g:an,G:sn,H:fn,I:fn,j:dn,L:mn,m:un,M:pn,p:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:hn,Q:bn,s:wn,S:gn,u:en,U:nn,V:rn,w:tn,W:on,x:function(t,e,i){return C(t,n,e,i)},X:function(t,e,n){return C(t,i,e,n)},y:an,Y:sn,Z:ln,"%":yn};function _(t,e){return function(n){var i,r,o,s=[],a=-1,l=0,h=t.length;for(n instanceof Date||(n=new Date(+n));++a53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=Be(qe(o.y,0,1))).getUTCDay(),i=r>4||0===r?Ae.ceil(i):Ae(i),i=xe.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=$e(qe(o.y,0,1))).getDay(),i=r>4||0===r?le.ceil(i):le(i),i=oe.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?Be(qe(o.y,0,1)).getUTCDay():$e(qe(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Be(o)):$e(o)}}function C(t,e,n,i){for(var r,o,s=0,a=e.length,l=n.length;s=l)return-1;if(37===(r=e.charCodeAt(s++))){if(r=e.charAt(s++),!(o=k[r in ze?e.charAt(s++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=_(n,b),b.X=_(i,b),b.c=_(e,b),w.x=_(n,w),w.X=_(i,w),w.c=_(e,w),{format:function(t){var e=_(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=_(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=x(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Ve=Je.format,Je.parse,Je.utcFormat,Je.utcParse;const ui=$t(Ht),ci=ui.right;ui.left,$t((function(t){return null===t?NaN:+t})).center;var di=ci,fi=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function pi(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function gi(){}var mi="\\s*([+-]?\\d+)\\s*",vi="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",yi="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bi=/^#([0-9a-f]{3,8})$/,wi=new RegExp("^rgb\\("+[mi,mi,mi]+"\\)$"),ki=new RegExp("^rgb\\("+[yi,yi,yi]+"\\)$"),_i=new RegExp("^rgba\\("+[mi,mi,mi,vi]+"\\)$"),xi=new RegExp("^rgba\\("+[yi,yi,yi,vi]+"\\)$"),Ci=new RegExp("^hsl\\("+[vi,yi,yi]+"\\)$"),Ei=new RegExp("^hsla\\("+[vi,yi,yi,vi]+"\\)$"),Ai={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Si(){return this.rgb().formatHex()}function Ti(){return this.rgb().formatRgb()}function Mi(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=bi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Li(e):3===n?new Ri(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Di(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Di(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=wi.exec(t))?new Ri(e[1],e[2],e[3],1):(e=ki.exec(t))?new Ri(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=_i.exec(t))?Di(e[1],e[2],e[3],e[4]):(e=xi.exec(t))?Di(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ci.exec(t))?ji(e[1],e[2]/100,e[3]/100,1):(e=Ei.exec(t))?ji(e[1],e[2]/100,e[3]/100,e[4]):Ai.hasOwnProperty(t)?Li(Ai[t]):"transparent"===t?new Ri(NaN,NaN,NaN,0):null}function Li(t){return new Ri(t>>16&255,t>>8&255,255&t,1)}function Di(t,e,n,i){return i<=0&&(t=e=n=NaN),new Ri(t,e,n,i)}function Pi(t){return t instanceof gi||(t=Mi(t)),t?new Ri((t=t.rgb()).r,t.g,t.b,t.opacity):new Ri}function Ni(t,e,n,i){return 1===arguments.length?Pi(t):new Ri(t,e,n,null==i?1:i)}function Ri(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function Ii(){return"#"+Oi(this.r)+Oi(this.g)+Oi(this.b)}function Ui(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Oi(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ji(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Hi(t,e,n,i)}function Fi(t){if(t instanceof Hi)return new Hi(t.h,t.s,t.l,t.opacity);if(t instanceof gi||(t=Mi(t)),!t)return new Hi;if(t instanceof Hi)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=NaN,a=o-r,l=(o+r)/2;return a?(s=e===o?(n-i)/a+6*(n0&&l<1?0:s,new Hi(s,a,l,t.opacity)}function Hi(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function $i(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Bi(t,e,n,i,r){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*n+(1+3*t+3*o-3*s)*i+s*r)/6}fi(gi,Mi,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Si,formatHex:Si,formatHsl:function(){return Fi(this).formatHsl()},formatRgb:Ti,toString:Ti}),fi(Ri,Ni,pi(gi,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ri(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ri(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ii,formatHex:Ii,formatRgb:Ui,toString:Ui})),fi(Hi,(function(t,e,n,i){return 1===arguments.length?Fi(t):new Hi(t,e,n,null==i?1:i)}),pi(gi,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Hi(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Hi(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Ri($i(t>=240?t-240:t+120,r,i),$i(t,r,i),$i(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var qi=t=>()=>t;function Ji(t,e){return function(n){return t+n*e}}function Vi(t){return 1==(t=+t)?zi:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):qi(isNaN(e)?n:e)}}function zi(t,e){var n=e-t;return n?Ji(t,n):qi(isNaN(t)?e:t)}var Wi=function t(e){var n=Vi(e);function i(t,e){var i=n((t=Ni(t)).r,(e=Ni(e)).r),r=n(t.g,e.g),o=n(t.b,e.b),s=zi(t.opacity,e.opacity);return function(e){return t.r=i(e),t.g=r(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function Yi(t){return function(e){var n,i,r=e.length,o=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),r=t[i],o=t[i+1],s=i>0?t[i-1]:2*r-o,a=io&&(r=e.slice(o,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Qi(n,i)})),o=nr.lastIndex;return oe&&(n=t,t=e,e=n),h=function(n){return Math.max(t,Math.min(e,n))}),i=l>2?cr:ur,r=o=null,c}function c(e){return null==e||isNaN(e=+e)?n:(r||(r=i(s.map(t),a,l)))(t(h(e)))}return c.invert=function(n){return h(e((o||(o=i(a,s.map(t),Qi)))(n)))},c.domain=function(t){return arguments.length?(s=Array.from(t,sr),u()):s.slice()},c.range=function(t){return arguments.length?(a=Array.from(t),u()):a.slice()},c.rangeRound=function(t){return a=Array.from(t),l=or,u()},c.clamp=function(t){return arguments.length?(h=!!t||lr,u()):h!==lr},c.interpolate=function(t){return arguments.length?(l=t,u()):l},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,i){return t=n,e=i,u()}}function pr(){return fr()(lr,lr)}function gr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function mr(t){return new Date(t)}function vr(t){return t instanceof Date?+t:+new Date(+t)}function yr(t,e,n,i,r,o,s,a,l,h){var u=pr(),c=u.invert,d=u.domain,f=h(".%L"),p=h(":%S"),g=h("%I:%M"),m=h("%I %p"),v=h("%a %d"),y=h("%b %d"),b=h("%B"),w=h("%Y");function k(t){return(l(t)=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wr(t){if(!(e=br.exec(t)))throw new Error("invalid format: "+t);var e;return new kr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function kr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}wr.prototype=kr.prototype,kr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};function _r(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}var xr,Cr,Er,Ar,Sr=function(t){return(t=_r(Math.abs(t)))?t[1]:NaN},Tr=function(t,e){var n=_r(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")},Mr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Tr(100*t,e),r:Tr,s:function(t,e){var n=_r(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(xr=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+_r(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)},Lr=function(t){return t},Dr=Array.prototype.map,Pr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Nr=function(t){var e,n,i=void 0===t.grouping||void 0===t.thousands?Lr:(e=Dr.call(t.grouping,Number),n=t.thousands+"",function(t,i){for(var r=t.length,o=[],s=0,a=e[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),o.push(t.substring(r-=a,r+a)),!((l+=a+1)>i));)a=e[s=(s+1)%e.length];return o.reverse().join(n)}),r=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Lr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Dr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=wr(t)).fill,n=t.align,c=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Mr[y]||(void 0===m&&(m=12),v=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?l:"",k=Mr[y],_=/[defgprs%]/.test(y);function x(t){var r,o,l,d=b,x=w;if("c"===y)x=k(t)+x,t="";else{var C=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:k(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,i=1,r=-1;i0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),C&&0==+t&&"+"!==c&&(C=!1),d=(C?"("===c?c:h:"-"===c||"("===c?"":c)+d,x=("s"===y?Pr[8+xr/3]:"")+x+(C&&"("===c?")":""),_)for(r=-1,o=t.length;++r(l=t.charCodeAt(r))||l>57){x=(46===l?s+t.slice(r+1):t.slice(r))+x,t=t.slice(0,r);break}}g&&!f&&(t=i(t,1/0));var E=d.length+t.length+x.length,A=E>1)+d+t+x+A.slice(E);break;default:t=A+d+t+x}return a(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),x.toString=function(){return t+""},x}return{format:c,formatPrefix:function(t,e){var n=c(((t=wr(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Sr(e)/3))),r=Math.pow(10,-i),o=Pr[8+i/3];return function(t){return n(r*t)+o}}}};!function(t){Cr=Nr(t),Er=Cr.format,Ar=Cr.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});function Rr(t,e,n,i){var r,o=zt(t,e,n);switch((i=wr(null==i?",f":i)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(e));return null!=i.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Sr(e)/3)))-Sr(Math.abs(t)))}(o,s))||(i.precision=r),Ar(i,s);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Sr(e)-Sr(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=function(t){return Math.max(0,-Sr(Math.abs(t)))}(o))||(i.precision=r-2*("%"===i.type))}return Er(i)}function Ir(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var i,r,o,s,a=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((i=e0){let n=Math.round(t/s),i=Math.round(e/s);for(n*se&&--i,o=new Array(r=i-n+1);++ae&&--i,o=new Array(r=i-n+1);++a0;){if((r=Vt(l,h,n))===i)return o[s]=l,o[a]=h,e(o);if(r>0)l=Math.floor(l/r)*r,h=Math.ceil(h/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,h=Math.floor(h*r)/r}i=r}return t},t}function Ur(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n=r)&&(n=r)}return n}const Or=Math.PI,jr=2*Or,Fr=jr-1e-6;function Hr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function $r(){return new Hr}Hr.prototype=$r.prototype={constructor:Hr,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+o)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var o=this._x1,s=this._y1,a=n-t,l=i-e,h=o-t,u=s-e,c=h*h+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(c>1e-6)if(Math.abs(u*a-l*h)>1e-6&&r){var d=n-o,f=i-s,p=a*a+l*l,g=d*d+f*f,m=Math.sqrt(p),v=Math.sqrt(c),y=r*Math.tan((Or-Math.acos((p+c-g)/(2*m*v)))/2),b=y/v,w=y/m;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*h)+","+(e+b*u)),this._+="A"+r+","+r+",0,0,"+ +(u*d>h*f)+","+(this._x1=t+w*a)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,o){t=+t,e=+e,o=!!o;var s=(n=+n)*Math.cos(i),a=n*Math.sin(i),l=t+s,h=e+a,u=1^o,c=o?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+h:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-h)>1e-6)&&(this._+="L"+l+","+h),n&&(c<0&&(c=c%jr+jr),c>Fr?this._+="A"+n+","+n+",0,1,"+u+","+(t-s)+","+(e-a)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=h):c>1e-6&&(this._+="A"+n+","+n+",0,"+ +(c>=Or)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var Br=$r,qr=(Array.prototype.slice,function(t){return function(){return t}});function Jr(t){this._context=t}Jr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Vr=function(t){return new Jr(t)};function zr(t){return t[0]}function Wr(t){return t[1]}var Yr=function(t,e){var n=qr(!0),i=null,r=Vr,o=null;function s(s){var a,l,h,u=(s=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(s)).length,c=!1;for(null==i&&(o=r(h=Br())),a=0;a<=u;++a)!(ae?1:t>=e?0:NaN}var go="http://www.w3.org/1999/xhtml",mo={svg:"http://www.w3.org/2000/svg",xhtml:go,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},vo=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),mo.hasOwnProperty(e)?{space:mo[e],local:t}:t};function yo(t){return function(){this.removeAttribute(t)}}function bo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function wo(t,e){return function(){this.setAttribute(t,e)}}function ko(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _o(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function xo(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var Co=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function Eo(t){return function(){this.style.removeProperty(t)}}function Ao(t,e,n){return function(){this.style.setProperty(t,e,n)}}function So(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function To(t,e){return t.style.getPropertyValue(e)||Co(t).getComputedStyle(t,null).getPropertyValue(e)}function Mo(t){return function(){delete this[t]}}function Lo(t,e){return function(){this[t]=e}}function Do(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Po(t){return t.trim().split(/^|\s+/)}function No(t){return t.classList||new Ro(t)}function Ro(t){this._node=t,this._names=Po(t.getAttribute("class")||"")}function Io(t,e){for(var n=No(t),i=-1,r=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Ho(){this.textContent=""}function $o(t){return function(){this.textContent=t}}function Bo(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function qo(){this.innerHTML=""}function Jo(t){return function(){this.innerHTML=t}}function Vo(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function zo(){this.nextSibling&&this.parentNode.appendChild(this)}function Wo(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yo(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===go&&e.documentElement.namespaceURI===go?e.createElement(t):e.createElementNS(n,t)}}function Xo(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var Go=function(t){var e=vo(t);return(e.local?Xo:Yo)(e)};function Ko(){return null}function Zo(){var t=this.parentNode;t&&t.removeChild(this)}function Qo(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ts(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function es(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function ns(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i=k&&(k=w+1);!(b=m[k])&&++k=0;)(i=r[o])&&(s&&4^i.compareDocumentPosition(s)&&s.parentNode.insertBefore(i,s),s=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=po);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o1?this.each((null==e?Eo:"function"==typeof e?So:Ao)(t,e,null==n?"":n)):To(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Mo:"function"==typeof e?Do:Lo)(t,e)):this.node()[t]},classed:function(t,e){var n=Po(t+"");if(arguments.length<2){for(var i=No(this.node()),r=-1,o=n.length;++r{}};function ds(){for(var t,e=0,n=arguments.length,i={};e=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function gs(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--ws}()}finally{ws=0,function(){var t,e,n=vs,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:vs=e);ys=t,Rs(i)}(),Cs=0}}function Ns(){var t=As.now(),e=t-xs;e>1e3&&(Es-=e,xs=t)}function Rs(t){ws||(ks&&(ks=clearTimeout(ks)),t-Cs>24?(t<1/0&&(ks=setTimeout(Ps,t-As.now()-Es)),_s&&(_s=clearInterval(_s))):(_s||(xs=As.now(),_s=setInterval(Ns,1e3)),ws=1,Ss(Ps)))}Ls.prototype=Ds.prototype={constructor:Ls,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Ts():+n)+(null==e?0:+e),this._next||ys===this||(ys?ys._next=this:vs=this,ys=this),this._call=t,this._time=n,Rs()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rs())}};var Is=function(t,e,n){var i=new Ls;return e=null==e?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,n),i},Us=bs("start","end","cancel","interrupt"),Os=[],js=function(t,e,n,i,r,o){var s=t.__transition;if(s){if(n in s)return}else t.__transition={};!function(t,e,n){var i,r=t.__transition;function o(l){var h,u,c,d;if(1!==n.state)return a();for(h in r)if((d=r[h]).name===n.name){if(3===d.state)return Is(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[h]):+h0)throw new Error("too late; already scheduled");return n}function Hs(t,e){var n=$s(t,e);if(n.state>3)throw new Error("too late; already running");return n}function $s(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var Bs,qs=180/Math.PI,Js={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Vs=function(t,e,n,i,r,o){var s,a,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(a=Math.sqrt(n*n+i*i))&&(n/=a,i/=a,l/=a),t*i180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:Qi(t,e)})):e&&n.push(r(n)+"rotate("+e+i)}(o.rotate,s.rotate,a,l),function(t,e,n,o){t!==e?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:Qi(t,e)}):e&&n.push(r(n)+"skewX("+e+i)}(o.skewX,s.skewX,a,l),function(t,e,n,i,o,s){if(t!==n||e!==i){var a=o.push(r(o)+"scale(",null,",",null,")");s.push({i:a-4,x:Qi(t,n)},{i:a-2,x:Qi(e,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,a,l),o=s=null,function(t){for(var e,n=-1,i=l.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Fs:Hs;return function(){var s=o(this,t),a=s.on;a!==i&&(r=(i=a).copy()).on(e,n),s.on=r}}var ga=us.prototype.constructor;function ma(t){return function(){this.style.removeProperty(t)}}function va(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function ya(t,e,n){var i,r;function o(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&va(t,o,n)),i}return o._value=e,o}function ba(t){return function(e){this.textContent=t.call(this,e)}}function wa(t){var e,n;function i(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ba(i)),e}return i._value=t,i}var ka=0;function _a(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function xa(){return++ka}var Ca=us.prototype;_a.prototype=function(t){return us().transition(t)}.prototype={constructor:_a,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Gr(t));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s=e&&(n=i=e):(n>e&&(n=e),i=o&&(n=i=o):(n>o&&(n=o),i2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[r]):s=!1;s&&delete t.__transition}}(this,t)}))},us.prototype.transition=function(t){var e,n;t instanceof _a?(e=t._id,t=t._name):(e=xa(),(n=Ea).time=Ts(),t=null==t?null:t+"");for(var i=this._groups,r=i.length,o=0;o{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()})}isProfileEnabled(){return"true"===this.sessionStorage.getItem("phx:live-socket:profiling")}isDebugEnabled(){return"true"===this.sessionStorage.getItem(q)}isDebugDisabled(){return"false"===this.sessionStorage.getItem(q)}enableDebug(){this.sessionStorage.setItem(q,"true")}enableProfiling(){this.sessionStorage.setItem("phx:live-socket:profiling","true")}disableDebug(){this.sessionStorage.setItem(q,"false")}disableProfiling(){this.sessionStorage.removeItem("phx:live-socket:profiling")}enableLatencySim(t){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem("phx:live-socket:latency-sim",t)}disableLatencySim(){this.sessionStorage.removeItem("phx:live-socket:latency-sim")}getLatencySim(){let t=this.sessionStorage.getItem("phx:live-socket:latency-sim");return t?parseInt(t):null}getSocket(){return this.socket}connect(){"localhost"!==window.location.hostname||this.isDebugDisabled()||this.enableDebug();let t=()=>{this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?t():document.addEventListener("DOMContentLoaded",()=>t())}disconnect(t){this.socket.disconnect(t)}execJS(t,e,n=null){this.owner(t,i=>Mt.exec(n,e,i,t))}triggerDOM(t,e){this.domCallbacks[t](...e)}time(t,e){if(!this.isProfileEnabled()||!console.time)return e();console.time(t);let n=e();return console.timeEnd(t),n}log(t,e,n){if(this.viewLogger){let[i,r]=n();this.viewLogger(t,e,i,r)}else if(this.isDebugEnabled()){let[i,r]=n();((t,e,n,i)=>{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${n} - `,i)})(t,e,i,r)}}requestDOMUpdate(t){this.transitions.after(t)}transition(t,e,n=function(){}){this.transitions.addTransition(t,e,n)}onChannel(t,e,n){t.on(e,t=>{let e=this.getLatencySim();e?(console.log(`simulating ${e}ms of latency from server to client`),setTimeout(()=>n(t),e)):n(t)})}wrapPush(t,e,n){let i=this.getLatencySim(),r=t.joinCount;if(!i)return this.isConnected()&&e.timeout?n().receive("timeout",()=>{t.joinCount!==r||t.isDestroyed()||this.reloadWithJitter(t,()=>{this.log(t,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):n();console.log(`simulating ${i}ms of latency from client to server`);let o={receives:[],receive(t,e){this.receives.push([t,e])}};return setTimeout(()=>{t.isDestroyed()||o.receives.reduce((t,[e,n])=>t.receive(e,n),n())},i),o}reloadWithJitter(t,e){t.destroy(),this.disconnect();let n=this.reloadJitterMin,i=this.reloadJitterMax,r=Math.floor(Math.random()*(i-n+1))+n,o=at.updateLocal(this.localStorage,window.location.pathname,"consecutive-reloads",0,t=>t+1);e?e():this.log(t,"join",()=>[`encountered ${o} consecutive reloads`]),o>this.maxReloads&&(this.log(t,"join",()=>[`exceeded ${this.maxReloads} consecutive reloads. Entering failsafe mode`]),r=this.failsafeJitter),setTimeout(()=>{this.hasPendingLink()?window.location=this.pendingLink:window.location.reload()},r)}getHookCallbacks(t){return t&&t.startsWith("Phoenix.")?ft[t.split(".")[1]]:this.hooks[t]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(t){return`${this.getBindingPrefix()}${t}`}channel(t,e){return this.socket.channel(t,e)}joinRootViews(){let t=!1;return ht.all(document,`${$}:not([${U}])`,e=>{if(!this.getRootById(e.id)){let t=this.newRootView(e);t.setHref(this.getHref()),t.join(),e.getAttribute("data-phx-main")&&(this.main=t)}t=!0}),t}redirect(t,e){this.disconnect(),at.redirect(t,e)}replaceMain(t,e,n=null,i=this.setPendingLink(t)){this.outgoingMainEl=this.outgoingMainEl||this.main.el;let r=ht.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(r,e),this.main.setRedirect(t),this.transitionRemoves(),this.main.join((t,e)=>{1===t&&this.commitPendingLink(i)&&this.requestDOMUpdate(()=>{ht.findPhxSticky(document).forEach(t=>r.appendChild(t)),this.outgoingMainEl.replaceWith(r),this.outgoingMainEl=null,n&&n(),e()})})}transitionRemoves(t){let e=this.binding("remove");(t=t||ht.all(document,`[${e}]`)).forEach(t=>{document.body.contains(t)&&this.execJS(t,t.getAttribute(e),"remove")})}isPhxView(t){return t.getAttribute&&null!==t.getAttribute(H)}newRootView(t,e){let n=new Dt(t,this,null,e);return this.roots[n.id]=n,n}owner(t,e){let n=rt(t.closest($),t=>this.getViewByEl(t))||this.main;n&&e(n)}withinOwners(t,e){this.owner(t,n=>e(n,t))}getViewByEl(t){let e=t.getAttribute(O);return rt(this.getRootById(e),e=>e.getDescendentByEl(t))}getRootById(t){return this.roots[t]}destroyAllViews(){for(let t in this.roots)this.roots[t].destroy(),delete this.roots[t]}destroyViewByEl(t){let e=this.getRootById(t.getAttribute(O));e&&e.id===t.id?(e.destroy(),delete this.roots[e.id]):e&&e.destroyDescendent(t.id)}setActiveElement(t){if(this.activeElement===t)return;this.activeElement=t;let e=()=>{t===this.activeElement&&(this.activeElement=null),t.removeEventListener("mouseup",this),t.removeEventListener("touchend",this)};t.addEventListener("mouseup",e),t.addEventListener("touchend",e)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(t){this.prevActive&&t.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(){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(t=>{t&&1e3===t.code&&this.main&&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),this.bindNav(),this.bindClicks(),this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(t,e,n,i,r,o)=>{let s=i.getAttribute(this.binding("key")),a=t.key&&t.key.toLowerCase();if(s&&s.toLowerCase()!==a)return;let l={key:t.key,...this.eventMeta(e,t,i)};Mt.exec(e,r,n,i,["push",{data:l}])}),this.bind({blur:"focusout",focus:"focusin"},(t,e,n,i,r,o)=>{if(!o){let o={key:t.key,...this.eventMeta(e,t,i)};Mt.exec(e,r,n,i,["push",{data:o}])}}),this.bind({blur:"blur",focus:"focus"},(t,e,n,i,r,o,s)=>{if("window"===s){let r=this.eventMeta(e,t,i);Mt.exec(e,o,n,i,["push",{data:r}])}}),window.addEventListener("dragover",t=>t.preventDefault()),window.addEventListener("drop",t=>{t.preventDefault();let e=rt(et(t.target,this.binding("drop-target")),t=>t.getAttribute(this.binding("drop-target"))),n=e&&document.getElementById(e),i=Array.from(t.dataTransfer.files||[]);n&&!n.disabled&&0!==i.length&&n.files instanceof FileList&&(dt.trackFiles(n,i),n.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on("track-uploads",t=>{let e=t.target;if(!ht.isUploadInput(e))return;let n=Array.from(t.detail.files||[]).filter(t=>t instanceof File||t instanceof Blob);dt.trackFiles(e,n),e.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(t,e,n){let i=this.metadataCallbacks[t];return i?i(e,n):{}}setPendingLink(t){return this.linkRef++,this.pendingLink=t,this.linkRef}commitPendingLink(t){return this.linkRef===t&&(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(t,e){for(let n in t){let i=t[n];this.on(i,t=>{let i=this.binding(n),r=this.binding("window-"+n),o=t.target.getAttribute&&t.target.getAttribute(i);o?this.debounce(t.target,t,()=>{this.withinOwners(t.target,i=>{e(t,n,i,t.target,o,null)})}):ht.all(document,`[${r}]`,i=>{let o=i.getAttribute(r);this.debounce(i,t,()=>{this.withinOwners(i,r=>{e(t,n,r,i,o,"window")})})})})}}bindClicks(){window.addEventListener("mousedown",t=>this.clickStartedAtTarget=t.target),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(t,e,n){let i=this.binding(e);window.addEventListener(t,t=>{let e=null;if(n)e=t.target.matches(`[${i}]`)?t.target:t.target.querySelector(`[${i}]`);else{let n=this.clickStartedAtTarget||t.target;e=et(n,i),this.dispatchClickAway(t,n),this.clickStartedAtTarget=null}let r=e&&e.getAttribute(i);r&&("#"===e.getAttribute("href")&&t.preventDefault(),this.debounce(e,t,()=>{this.withinOwners(e,n=>{Mt.exec("click",r,n,e,["push",{data:this.eventMeta("click",t,e)}])})}))},n)}dispatchClickAway(t,e){let n=this.binding("click-away");ht.all(document,`[${n}]`,i=>{i.isSameNode(e)||i.contains(e)||this.withinOwners(t.target,e=>{let r=i.getAttribute(n);Mt.isVisible(i)&&Mt.exec("click",r,e,i,["push",{data:this.eventMeta("click",t,t.target)}])})})}bindNav(){if(!at.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let t=null;window.addEventListener("scroll",e=>{clearTimeout(t),t=setTimeout(()=>{at.updateCurrentState(t=>Object.assign(t,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",t=>{if(!this.registerNewLocation(window.location))return;let{type:e,id:n,root:i,scroll:r}=t.state||{},o=window.location.href;this.requestDOMUpdate(()=>{this.main.isConnected()&&"patch"===e&&n===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{i&&this.replaceRootHistory(),"number"==typeof r&&setTimeout(()=>{window.scrollTo(0,r)},0)})})},!1),window.addEventListener("click",t=>{let e=et(t.target,"data-phx-link"),n=e&&e.getAttribute("data-phx-link"),i=t.metaKey||t.ctrlKey||1===t.button;if(!n||!this.isConnected()||!this.main||i)return;let r=e.href,o=e.getAttribute("data-phx-link-state");t.preventDefault(),t.stopImmediatePropagation(),this.pendingLink!==r&&this.requestDOMUpdate(()=>{if("patch"===n)this.pushHistoryPatch(r,o,e);else{if("redirect"!==n)throw new Error('expected data-phx-link to be "patch" or "redirect", got: '+n);this.historyRedirect(r,o)}})},!1)}dispatchEvent(t,e={}){ht.dispatchEvent(window,"phx:"+t,{detail:e})}dispatchEvents(t){t.forEach(([t,e])=>this.dispatchEvent(t,e))}withPageLoading(t,e){ht.dispatchEvent(window,"phx:page-loading-start",{detail:t});let n=()=>ht.dispatchEvent(window,"phx:page-loading-stop",{detail:t});return e?e(n):n}pushHistoryPatch(t,e,n){this.withPageLoading({to:t,kind:"patch"},i=>{this.main.pushLinkPatch(t,n,n=>{this.historyPatch(t,e,n),i()})})}historyPatch(t,e,n=this.setPendingLink(t)){this.commitPendingLink(n)&&(at.pushState(e,{type:"patch",id:this.main.id},t),this.registerNewLocation(window.location))}historyRedirect(t,e,n){let i=window.scrollY;this.withPageLoading({to:t,kind:"redirect"},r=>{this.replaceMain(t,n,()=>{at.pushState(e,{type:"redirect",id:this.main.id,scroll:i},t),this.registerNewLocation(window.location),r()})})}replaceRootHistory(){at.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(t){let{pathname:e,search:n}=this.currentLocation;return e+n!==t.pathname+t.search&&(this.currentLocation=tt(t),!0)}bindForms(){let t=0;this.on("submit",t=>{let e=t.target.getAttribute(this.binding("submit"));e&&(t.preventDefault(),t.target.disabled=!0,this.withinOwners(t.target,n=>{Mt.exec("submit",e,n,t.target,["push",{}])}))},!1);for(let e of["change","input"])this.on(e,n=>{let i=this.binding("change"),r=n.target,o=r.getAttribute(i),s=r.form&&r.form.getAttribute(i),a=o||s;if(!a)return;if("number"===r.type&&r.validity&&r.validity.badInput)return;let l=o?r:r.form,h=t;t++;let{at:u,type:c}=ht.private(r,"prev-iteration")||{};u===h-1&&e!==c||(ht.putPrivate(r,"prev-iteration",{at:h,type:e}),this.debounce(r,n,()=>{this.withinOwners(l,t=>{ht.putPrivate(r,"phx-has-focused",!0),ht.isTextualInput(r)||this.setActiveElement(r),Mt.exec("change",a,t,r,["push",{_target:n.target.name,dispatcher:l}])})}))},!1)}debounce(t,e,n){let i=this.binding("debounce"),r=this.binding("throttle"),o=this.defaults.debounce.toString(),s=this.defaults.throttle.toString();ht.debounce(t,e,i,o,r,s,n)}silenceEvents(t){this.silenced=!0,t(),this.silenced=!1}on(t,e){window.addEventListener(t,t=>{this.silenced||e(t)})}}(Ra,class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||1e4,this.transport=e.transport||s.WebSocket||S,this.establishedConnections=0,this.defaultEncoder=T.encode.bind(T),this.defaultDecoder=T.decode.bind(T),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==S?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;o&&o.addEventListener&&(o.addEventListener("pagehide",t=>{this.conn&&(this.disconnect(),n=this.connectClock)}),o.addEventListener("pageshow",t=>{n===this.connectClock&&(n=null,this.connect())})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.rejoinAfterMs=t=>e.rejoinAfterMs?e.rejoinAfterMs(t):[1e3,2e3,5e3][t-1]||1e4,this.reconnectAfterMs=t=>e.reconnectAfterMs?e.reconnectAfterMs(t):[10,50,100,150,200,250,500,1e3,2e3][t-1]||5e3,this.logger=e.logger||null,this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=i(e.params||{}),this.endPoint=`${t}/${_}`,this.vsn=e.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new E(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}replaceTransport(t){this.disconnect(),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=A.appendParams(A.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==t.charAt(0)?t:"/"===t.charAt(1)?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,n){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(t,e,n)}connect(t){this.connectClock++,t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=i(t)),this.conn||(this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t))}log(t,e,n){this.logger(t,e,n)}hasLogger(){return null!==this.logger}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onConnOpen(){this.hasLogger()&&this.log("transport","connected to "+this.endPointURL()),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,t])=>t())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,n){if(!this.conn)return t&&t();this.waitForBufferDone(()=>{this.conn&&(e?this.conn.close(e,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e=1){5!==e&&this.conn&&this.conn.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(t,e+1)},150*e):t()}waitForSocketClosed(t,e=1){5!==e&&this.conn&&this.conn.readyState!==u?setTimeout(()=>{this.waitForSocketClosed(t,e+1)},150*e):t()}onConnClose(t){let e=t&&t.code;this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||1e3===e||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,e])=>e(t))}onConnError(t){this.hasLogger()&&this.log("transport",t);let e=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(t,e,n)}),(e===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(v)})}connectionState(){switch(this.conn&&this.conn.readyState){case a:return"connecting";case l:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e.joinRef()!==t.joinRef())}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([e])=>-1===t.indexOf(e))}channel(t,e={}){let n=new class{constructor(t,e,n){this.state=c,this.topic=t,this.params=i(e||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new C(this,y,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new E(()=>{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,this.rejoinTimer.reset(),this.pushBuffer.forEach(t=>t.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=d,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=c,this.socket.remove(this)}),this.onError(t=>{this.socket.hasLogger()&&this.socket.log("channel","error "+this.topic,t),this.isJoining()&&this.joinPush.reset(),this.state=d,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 C(this,w,i({}),this.timeout).send(),this.state=d,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(b,(t,e)=>{this.trigger(this.replyEventName(e),t)})}join(t=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=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(t){this.on(m,t)}onError(t){return this.on(v,e=>t(e))}on(t,e){let n=this.bindingRef++;return this.bindings.push({event:t,ref:n,callback:e}),n}off(t,e){this.bindings=this.bindings.filter(n=>!(n.event===t&&(void 0===e||e===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,n=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new C(this,t,(function(){return e}),n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=g;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel","leave "+this.topic),this.trigger(m,"leave")},n=new C(this,w,i({}),t);return n.receive("ok",()=>e()).receive("timeout",()=>e()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(t,e,n){return e}isMember(t,e,n,i){return this.topic===t&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:n,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(t))}trigger(t,e,n,i){let r=this.onMessage(t,e,n,i);if(e&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(e=>e.event===t);for(let t=0;tthis.conn.send(t)):this.sendBuffer.push(()=>this.encode(t,t=>this.conn.send(t)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}abnormalClose(t){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,t)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,t=>{let{topic:e,event:n,payload:i,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(clearTimeout(this.heartbeatTimer),this.pendingHeartbeatRef=null,setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${i.status||""} ${e} ${n} ${r&&"("+r+")"||""}`,i);for(let t=0;te.topic===t&&(e.isJoined()||e.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}},{params:{_csrf_token:Na},hooks:{Table:{mounted:function(){var t=this.el,e=t.querySelector(".js-hidden-submit"),n=t.querySelector(".js-submit-button");t.querySelector(".js-select-all-rows").addEventListener("change",(function(){var e=this;t.querySelectorAll(".js-select-row").forEach((function(t){t.checked=e.checked}))})),t.querySelectorAll(".js-action").forEach((function(t){t.addEventListener("click",(function(){e.value=this.dataset.name,n.click()}))}))}},RealtimePlot:Ta,HistoricalPlot:Ma,Refresh:La,Timestamp:Pa}});L.a.config({barColors:{0:"#B5179E"},shadowColor:"rgba(0, 0, 0, .3)"}),window.addEventListener("phx:page-loading-start",(function(t){return L.a.show()})),window.addEventListener("phx:page-loading-stop",(function(t){return L.a.hide()})),Ia.connect(),window.liveSocket=Ia}]); \ No newline at end of file