ash_admin/priv/static/js/app.js
Zach Daniel b214535f0c improvement: remove compile-time router, use params instead
improvement!: support latest surface/phoenix
2021-09-01 02:43:31 -04:00

2 lines
No EOL
117 KiB
JavaScript

/*! For license information please see app.js.LICENSE.txt */
!function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/js/",i(i.s=2)}([function(e,t,i){var n,r;void 0===(r="function"==typeof(n=function(){var e,t,i={version:"0.2.0"},n=i.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};function r(e,t,i){return e<t?t:e>i?i:e}function o(e){return 100*(-1+e)}i.configure=function(e){var t,i;for(t in e)void 0!==(i=e[t])&&e.hasOwnProperty(t)&&(n[t]=i);return this},i.status=null,i.set=function(e){var t=i.isStarted();e=r(e,n.minimum,1),i.status=1===e?null:e;var l=i.render(!t),c=l.querySelector(n.barSelector),u=n.speed,h=n.easing;return l.offsetWidth,s((function(t){""===n.positionUsing&&(n.positionUsing=i.getPositioningCSS()),a(c,function(e,t,i){var r;return(r="translate3d"===n.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===n.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+i,r}(e,u,h)),1===e?(a(l,{transition:"none",opacity:1}),l.offsetWidth,setTimeout((function(){a(l,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){i.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},i.isStarted=function(){return"number"==typeof i.status},i.start=function(){i.status||i.set(0);var e=function(){setTimeout((function(){i.status&&(i.trickle(),e())}),n.trickleSpeed)};return n.trickle&&e(),this},i.done=function(e){return e||i.status?i.inc(.3+.5*Math.random()).set(1):this},i.inc=function(e){var t=i.status;return t?("number"!=typeof e&&(e=(1-t)*r(Math.random()*t,.1,.95)),t=r(t+e,0,.994),i.set(t)):i.start()},i.trickle=function(){return i.inc(Math.random()*n.trickleRate)},e=0,t=0,i.promise=function(n){return n&&"resolved"!==n.state()?(0===t&&i.start(),e++,t++,n.always((function(){0==--t?(e=0,i.done()):i.set((e-t)/e)})),this):this},i.render=function(e){if(i.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=n.template;var r,s=t.querySelector(n.barSelector),l=e?"-100":o(i.status||0),u=document.querySelector(n.parent);return a(s,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),n.showSpinner||(r=t.querySelector(n.spinnerSelector))&&d(r),u!=document.body&&c(u,"nprogress-custom-parent"),u.appendChild(t),t},i.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(n.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&d(e)},i.isRendered=function(){return!!document.getElementById("nprogress")},i.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var s=function(){var e=[];function t(){var i=e.shift();i&&i(t)}return function(i){e.push(i),1==e.length&&t()}}(),a=function(){var e=["Webkit","O","Moz","ms"],t={};function i(i){return i=i.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()})),t[i]||(t[i]=function(t){var i=document.body.style;if(t in i)return t;for(var n,r=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((n=e[r]+o)in i)return n;return t}(i))}function n(e,t,n){t=i(t),e.style[t]=n}return function(e,t){var i,r,o=arguments;if(2==o.length)for(i in t)void 0!==(r=t[i])&&t.hasOwnProperty(i)&&n(e,i,r);else n(e,o[1],o[2])}}();function l(e,t){return("string"==typeof e?e:h(e)).indexOf(" "+t+" ")>=0}function c(e,t){var i=h(e),n=i+t;l(i,t)||(e.className=n.substring(1))}function u(e,t){var i,n=h(e);l(e,t)&&(i=n.replace(" "+t+" "," "),e.className=i.substring(1,i.length-1))}function h(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function d(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return i})?n.call(t,i,t,e):n)||(e.exports=r)},function(e,t,i){e.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){(function(t){e.exports=t.Phoenix=i(2)}).call(this,i(1))},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";function n(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var i=[],n=!0,r=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return a(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,i){return t&&c(e.prototype,t),i&&c(e,i),e}i.r(t),i.d(t,"Channel",(function(){return P})),i.d(t,"Serializer",(function(){return T})),i.d(t,"Socket",(function(){return L})),i.d(t,"LongPoll",(function(){return O})),i.d(t,"Ajax",(function(){return R})),i.d(t,"Presence",(function(){return D}));var h="undefined"!=typeof self?self:null,d="undefined"!=typeof window?window:null,f=h||d||void 0,p="closed",m="errored",g="joined",v="joining",b="leaving",y="phx_close",k="phx_error",w="phx_join",E="phx_reply",x="phx_leave",S=[y,k,w,E,x],_="websocket",C=function(e){return"function"==typeof e?e:function(){return e}},A=function(){function e(t,i,n,r){l(this,e),this.channel=t,this.event=i,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return u(e,[{key:"resend",value:function(e){this.timeout=e,this.reset(),this.send()}},{key:"send",value:function(){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()}))}},{key:"receive",value:function(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}},{key:"reset",value:function(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}},{key:"matchReceive",value:function(e){var t=e.status,i=e.response;e.ref,this.recHooks.filter((function(e){return e.status===t})).forEach((function(e){return e.callback(i)}))}},{key:"cancelRefEvent",value:function(){this.refEvent&&this.channel.off(this.refEvent)}},{key:"cancelTimeout",value:function(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}},{key:"startTimeout",value:function(){var e=this;this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(function(t){e.cancelRefEvent(),e.cancelTimeout(),e.receivedResp=t,e.matchReceive(t)})),this.timeoutTimer=setTimeout((function(){e.trigger("timeout",{})}),this.timeout)}},{key:"hasReceived",value:function(e){return this.receivedResp&&this.receivedResp.status===e}},{key:"trigger",value:function(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}}]),e}(),P=function(){function e(t,i,n){var r=this;l(this,e),this.state=p,this.topic=t,this.params=C(i||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new A(this,w,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new I((function(){r.socket.isConnected()&&r.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((function(){return r.rejoinTimer.reset()}))),this.stateChangeRefs.push(this.socket.onOpen((function(){r.rejoinTimer.reset(),r.isErrored()&&r.rejoin()}))),this.joinPush.receive("ok",(function(){r.state=g,r.rejoinTimer.reset(),r.pushBuffer.forEach((function(e){return e.send()})),r.pushBuffer=[]})),this.joinPush.receive("error",(function(){r.state=m,r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.onClose((function(){r.rejoinTimer.reset(),r.socket.hasLogger()&&r.socket.log("channel","close ".concat(r.topic," ").concat(r.joinRef())),r.state=p,r.socket.remove(r)})),this.onError((function(e){r.socket.hasLogger()&&r.socket.log("channel","error ".concat(r.topic),e),r.isJoining()&&r.joinPush.reset(),r.state=m,r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(function(){r.socket.hasLogger()&&r.socket.log("channel","timeout ".concat(r.topic," (").concat(r.joinRef(),")"),r.joinPush.timeout),new A(r,x,C({}),r.timeout).send(),r.state=m,r.joinPush.reset(),r.socket.isConnected()&&r.rejoinTimer.scheduleTimeout()})),this.on(E,(function(e,t){r.trigger(r.replyEventName(t),e)}))}return u(e,[{key:"join",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}},{key:"onClose",value:function(e){this.on(y,e)}},{key:"onError",value:function(e){return this.on(k,(function(t){return e(t)}))}},{key:"on",value:function(e,t){var i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}},{key:"off",value:function(e,t){this.bindings=this.bindings.filter((function(i){return!(i.event===e&&(void 0===t||t===i.ref))}))}},{key:"canPush",value:function(){return this.socket.isConnected()&&this.isJoined()}},{key:"push",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(t=t||{},!this.joinedOnce)throw new Error("tried to push '".concat(e,"' to '").concat(this.topic,"' before joining. Use channel.join() before pushing events"));var n=new A(this,e,(function(){return t}),i);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}},{key:"leave",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=b;var i=function(){e.socket.hasLogger()&&e.socket.log("channel","leave ".concat(e.topic)),e.trigger(y,"leave")},n=new A(this,x,C({}),t);return n.receive("ok",(function(){return i()})).receive("timeout",(function(){return i()})),n.send(),this.canPush()||n.trigger("ok",{}),n}},{key:"onMessage",value:function(e,t,i){return t}},{key:"isLifecycleEvent",value:function(e){return S.indexOf(e)>=0}},{key:"isMember",value:function(e,t,i,n){return!(this.topic!==e||n&&n!==this.joinRef()&&this.isLifecycleEvent(t)&&(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:n}),1))}},{key:"joinRef",value:function(){return this.joinPush.ref}},{key:"rejoin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=v,this.joinPush.resend(e))}},{key:"trigger",value:function(e,t,i,n){var r=this.onMessage(e,t,i,n);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");for(var o=this.bindings.filter((function(t){return t.event===e})),s=0;s<o.length;s++)o[s].callback(r,i,n||this.joinRef())}},{key:"replyEventName",value:function(e){return"chan_reply_".concat(e)}},{key:"isClosed",value:function(){return this.state===p}},{key:"isErrored",value:function(){return this.state===m}},{key:"isJoined",value:function(){return this.state===g}},{key:"isJoining",value:function(){return this.state===v}},{key:"isLeaving",value:function(){return this.state===b}}]),e}(),T={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode:function(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));var i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))},decode:function(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));var i=o(JSON.parse(e),5);return t({join_ref:i[0],ref:i[1],topic:i[2],event:i[3],payload:i[4]})},binaryEncode:function(e){var t=e.join_ref,i=e.ref,n=e.event,r=e.topic,o=e.payload,s=this.META_LENGTH+t.length+i.length+r.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+s),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,i.length),l.setUint8(c++,r.length),l.setUint8(c++,n.length),Array.from(t,(function(e){return l.setUint8(c++,e.charCodeAt(0))})),Array.from(i,(function(e){return l.setUint8(c++,e.charCodeAt(0))})),Array.from(r,(function(e){return l.setUint8(c++,e.charCodeAt(0))})),Array.from(n,(function(e){return l.setUint8(c++,e.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:function(e){var t=new DataView(e),i=t.getUint8(0),n=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush:function(e,t,i){var n=t.getUint8(1),r=t.getUint8(2),o=t.getUint8(3),s=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(e.slice(s,s+n));s+=n;var l=i.decode(e.slice(s,s+r));s+=r;var c=i.decode(e.slice(s,s+o));return s+=o,{join_ref:a,ref:null,topic:l,event:c,payload:e.slice(s,e.byteLength)}},decodeReply:function(e,t,i){var n=t.getUint8(1),r=t.getUint8(2),o=t.getUint8(3),s=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=i.decode(e.slice(a,a+n));a+=n;var c=i.decode(e.slice(a,a+r));a+=r;var u=i.decode(e.slice(a,a+o));a+=o;var h=i.decode(e.slice(a,a+s));a+=s;var d=e.slice(a,e.byteLength);return{join_ref:l,ref:c,topic:u,event:E,payload:{status:h,response:d}}},decodeBroadcast:function(e,t,i){var n=t.getUint8(1),r=t.getUint8(2),o=this.HEADER_LENGTH+2,s=i.decode(e.slice(o,o+n));o+=n;var a=i.decode(e.slice(o,o+r));return o+=r,{join_ref:null,ref:null,topic:s,event:a,payload:e.slice(o,e.byteLength)}}},L=function(){function e(t){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this,e),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=n.timeout||1e4,this.transport=n.transport||f.WebSocket||O,this.defaultEncoder=T.encode.bind(T),this.defaultDecoder=T.decode.bind(T),this.closeWasClean=!1,this.unloaded=!1,this.binaryType=n.binaryType||"arraybuffer",this.transport!==O?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),d&&d.addEventListener&&d.addEventListener("beforeunload",(function(e){i.conn&&(i.unloaded=!0,i.abnormalClose("unloaded"))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.rejoinAfterMs=function(e){return n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4},this.reconnectAfterMs=function(e){return i.unloaded?100:n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3},this.logger=n.logger||null,this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=C(n.params||{}),this.endPoint="".concat(t,"/").concat(_),this.vsn=n.vsn||"2.0.0",this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new I((function(){i.teardown((function(){return i.connect()}))}),this.reconnectAfterMs)}return u(e,[{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var e=R.appendParams(R.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?"".concat(this.protocol(),":").concat(e):"".concat(this.protocol(),"://").concat(location.host).concat(e)}},{key:"disconnect",value:function(e,t,i){this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,i)}},{key:"connect",value:function(e){var t=this;e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=C(e)),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=function(){return t.onConnOpen()},this.conn.onerror=function(e){return t.onConnError(e)},this.conn.onmessage=function(e){return t.onConnMessage(e)},this.conn.onclose=function(e){return t.onConnClose(e)})}},{key:"log",value:function(e,t,i){this.logger(e,t,i)}},{key:"hasLogger",value:function(){return null!==this.logger}},{key:"onOpen",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}},{key:"onClose",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}},{key:"onError",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}},{key:"onMessage",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}},{key:"onConnOpen",value:function(){this.hasLogger()&&this.log("transport","connected to ".concat(this.endPointURL())),this.unloaded=!1,this.closeWasClean=!1,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((function(e){return(0,o(e,2)[1])()}))}},{key:"heartbeatTimeout",value:function(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.abnormalClose("heartbeat timeout"))}},{key:"resetHeartbeat",value:function(){var e=this;this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearTimeout(this.heartbeatTimer),setTimeout((function(){return e.sendHeartbeat()}),this.heartbeatIntervalMs))}},{key:"teardown",value:function(e,t,i){var n=this;if(!this.conn)return e&&e();this.waitForBufferDone((function(){n.conn&&(t?n.conn.close(t,i||""):n.conn.close()),n.waitForSocketClosed((function(){n.conn&&(n.conn.onclose=function(){},n.conn=null),e&&e()}))}))}},{key:"waitForBufferDone",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;5!==i&&this.conn&&this.conn.bufferedAmount?setTimeout((function(){t.waitForBufferDone(e,i+1)}),150*i):e()}},{key:"waitForSocketClosed",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;5!==i&&this.conn&&3!==this.conn.readyState?setTimeout((function(){t.waitForSocketClosed(e,i+1)}),150*i):e()}},{key:"onConnClose",value:function(e){this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearTimeout(this.heartbeatTimer),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((function(t){return(0,o(t,2)[1])(e)}))}},{key:"onConnError",value:function(e){this.hasLogger()&&this.log("transport",e),this.triggerChanError(),this.stateChangeCallbacks.error.forEach((function(t){return(0,o(t,2)[1])(e)}))}},{key:"triggerChanError",value:function(){this.channels.forEach((function(e){e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(k)}))}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}},{key:"isConnected",value:function(){return"open"===this.connectionState()}},{key:"remove",value:function(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((function(t){return t.joinRef()!==e.joinRef()}))}},{key:"off",value:function(e){for(var t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((function(t){var i=o(t,1)[0];return-1===e.indexOf(i)}))}},{key:"channel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new P(e,t,this);return this.channels.push(i),i}},{key:"push",value:function(e){var t=this;if(this.hasLogger()){var i=e.topic,n=e.event,r=e.payload,o=e.ref,s=e.join_ref;this.log("push","".concat(i," ").concat(n," (").concat(s,", ").concat(o,")"),r)}this.isConnected()?this.encode(e,(function(e){return t.conn.send(e)})):this.sendBuffer.push((function(){return t.encode(e,(function(e){return t.conn.send(e)}))}))}},{key:"makeRef",value:function(){var e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}},{key:"sendHeartbeat",value:function(){var e=this;this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimer=setTimeout((function(){return e.heartbeatTimeout()}),this.heartbeatIntervalMs))}},{key:"abnormalClose",value:function(e){this.closeWasClean=!1,this.isConnected()&&this.conn.close(1e3,e)}},{key:"flushSendBuffer",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((function(e){return e()})),this.sendBuffer=[])}},{key:"onConnMessage",value:function(e){var t=this;this.decode(e.data,(function(e){var i=e.topic,n=e.event,r=e.payload,s=e.ref,a=e.join_ref;s&&s===t.pendingHeartbeatRef&&(clearTimeout(t.heartbeatTimer),t.pendingHeartbeatRef=null,setTimeout((function(){return t.sendHeartbeat()}),t.heartbeatIntervalMs)),t.hasLogger()&&t.log("receive","".concat(r.status||""," ").concat(i," ").concat(n," ").concat(s&&"("+s+")"||""),r);for(var l=0;l<t.channels.length;l++){var c=t.channels[l];c.isMember(i,n,r,a)&&c.trigger(n,r,s,a)}for(var u=0;u<t.stateChangeCallbacks.message.length;u++)(0,o(t.stateChangeCallbacks.message[u],2)[1])(e)}))}},{key:"leaveOpenTopic",value:function(e){var t=this.channels.find((function(t){return t.topic===e&&(t.isJoined()||t.isJoining())}));t&&(this.hasLogger()&&this.log("transport",'leaving duplicate topic "'.concat(e,'"')),t.leave())}}]),e}(),O=function(){function e(t){l(this,e),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=0,this.poll()}return u(e,[{key:"normalizeEndpoint",value:function(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+_),"$1/longpoll")}},{key:"endpointURL",value:function(){return R.appendParams(this.pollEndpoint,{token:this.token})}},{key:"closeAndRetry",value:function(){this.close(),this.readyState=0}},{key:"ontimeout",value:function(){this.onerror("timeout"),this.closeAndRetry()}},{key:"poll",value:function(){var e=this;1!==this.readyState&&0!==this.readyState||R.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),(function(t){if(t){var i=t.status,n=t.token,r=t.messages;e.token=n}else i=0;switch(i){case 200:r.forEach((function(t){setTimeout((function(){e.onmessage({data:t})}),0)})),e.poll();break;case 204:e.poll();break;case 410:e.readyState=1,e.onopen(),e.poll();break;case 403:e.onerror(),e.close();break;case 0:case 500:e.onerror(),e.closeAndRetry();break;default:throw new Error("unhandled poll status ".concat(i))}}))}},{key:"send",value:function(e){var t=this;R.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),(function(e){e&&200===e.status||(t.onerror(e&&e.status),t.closeAndRetry())}))}},{key:"close",value:function(e,t){this.readyState=3,this.onclose()}}]),e}(),R=function(){function e(){l(this,e)}return u(e,null,[{key:"request",value:function(e,t,i,n,r,o,s){if(f.XDomainRequest){var a=new XDomainRequest;this.xdomainRequest(a,e,t,n,r,o,s)}else{var l=new f.XMLHttpRequest;this.xhrRequest(l,e,t,i,n,r,o,s)}}},{key:"xdomainRequest",value:function(e,t,i,n,r,o,s){var a=this;e.timeout=r,e.open(t,i),e.onload=function(){var t=a.parseJSON(e.responseText);s&&s(t)},o&&(e.ontimeout=o),e.onprogress=function(){},e.send(n)}},{key:"xhrRequest",value:function(e,t,i,n,r,o,s,a){var l=this;e.open(t,i,!0),e.timeout=o,e.setRequestHeader("Content-Type",n),e.onerror=function(){a&&a(null)},e.onreadystatechange=function(){if(e.readyState===l.states.complete&&a){var t=l.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(r)}},{key:"parseJSON",value:function(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}},{key:"serialize",value:function(e,t){var i=[];for(var n in e)if(e.hasOwnProperty(n)){var o=t?"".concat(t,"[").concat(n,"]"):n,s=e[n];"object"===r(s)?i.push(this.serialize(s,o)):i.push(encodeURIComponent(o)+"="+encodeURIComponent(s))}return i.join("&")}},{key:"appendParams",value:function(e,t){if(0===Object.keys(t).length)return e;var i=e.match(/\?/)?"&":"?";return"".concat(e).concat(i).concat(this.serialize(t))}}]),e}();R.states={complete:4};var D=function(){function e(t){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this,e);var r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,(function(t){var n=i.caller,r=n.onJoin,o=n.onLeave,s=n.onSync;i.joinRef=i.channel.joinRef(),i.state=e.syncState(i.state,t,r,o),i.pendingDiffs.forEach((function(t){i.state=e.syncDiff(i.state,t,r,o)})),i.pendingDiffs=[],s()})),this.channel.on(r.diff,(function(t){var n=i.caller,r=n.onJoin,o=n.onLeave,s=n.onSync;i.inPendingSyncState()?i.pendingDiffs.push(t):(i.state=e.syncDiff(i.state,t,r,o),s())}))}return u(e,[{key:"onJoin",value:function(e){this.caller.onJoin=e}},{key:"onLeave",value:function(e){this.caller.onLeave=e}},{key:"onSync",value:function(e){this.caller.onSync=e}},{key:"list",value:function(t){return e.list(this.state,t)}},{key:"inPendingSyncState",value:function(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}}],[{key:"syncState",value:function(e,t,i,n){var r=this,o=this.clone(e),s={},a={};return this.map(o,(function(e,i){t[e]||(a[e]=i)})),this.map(t,(function(e,t){var i=o[e];if(i){var n=t.metas.map((function(e){return e.phx_ref})),l=i.metas.map((function(e){return e.phx_ref})),c=t.metas.filter((function(e){return l.indexOf(e.phx_ref)<0})),u=i.metas.filter((function(e){return n.indexOf(e.phx_ref)<0}));c.length>0&&(s[e]=t,s[e].metas=c),u.length>0&&(a[e]=r.clone(i),a[e].metas=u)}else s[e]=t})),this.syncDiff(o,{joins:s,leaves:a},i,n)}},{key:"syncDiff",value:function(e,t,i,r){var o=t.joins,s=t.leaves,a=this.clone(e);return i||(i=function(){}),r||(r=function(){}),this.map(o,(function(e,t){var r=a[e];if(a[e]=t,r){var o,s=a[e].metas.map((function(e){return e.phx_ref})),l=r.metas.filter((function(e){return s.indexOf(e.phx_ref)<0}));(o=a[e].metas).unshift.apply(o,n(l))}i(e,r,t)})),this.map(s,(function(e,t){var i=a[e];if(i){var n=t.metas.map((function(e){return e.phx_ref}));i.metas=i.metas.filter((function(e){return n.indexOf(e.phx_ref)<0})),r(e,i,t),0===i.metas.length&&delete a[e]}})),a}},{key:"list",value:function(e,t){return t||(t=function(e,t){return t}),this.map(e,(function(e,i){return t(e,i)}))}},{key:"map",value:function(e,t){return Object.getOwnPropertyNames(e).map((function(i){return t(i,e[i])}))}},{key:"clone",value:function(e){return JSON.parse(JSON.stringify(e))}}]),e}(),I=function(){function e(t,i){l(this,e),this.callback=t,this.timerCalc=i,this.timer=null,this.tries=0}return u(e,[{key:"reset",value:function(){this.tries=0,clearTimeout(this.timer)}},{key:"scheduleTimeout",value:function(){var e=this;clearTimeout(this.timer),this.timer=setTimeout((function(){e.tries=e.tries+1,e.callback()}),this.timerCalc(this.tries+1))}}]),e}()}])},function(e,t,i){e.exports=i(6)},function(e,t,i){},function(e,t,i){"use strict";!function(){var e=function(){if("function"==typeof window.CustomEvent)return window.CustomEvent;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}return e.prototype=window.Event.prototype,e}();function t(e,t){var i=document.createElement("input");return i.type="hidden",i.name=e,i.value=t,i}function i(e,i){var n=e.getAttribute("data-to"),r=t("_method",e.getAttribute("data-method")),o=t("_csrf_token",e.getAttribute("data-csrf")),s=document.createElement("form"),a=e.getAttribute("target");s.method="get"===e.getAttribute("data-method")?"get":"post",s.action=n,s.style.display="hidden",a?s.target=a:i&&(s.target="_blank"),s.appendChild(o),s.appendChild(r),document.body.appendChild(s),s.submit()}window.addEventListener("click",(function(t){for(var n=t.target;n&&n.getAttribute;){var r=new e("phoenix.link.click",{bubbles:!0,cancelable:!0});if(!n.dispatchEvent(r))return t.preventDefault(),t.stopImmediatePropagation(),!1;if(n.getAttribute("data-method"))return i(n,t.metaKey||t.shiftKey),t.preventDefault(),!1;n=n.parentNode}}),!1),window.addEventListener("phoenix.link.click",(function(e){var t=e.target.getAttribute("data-confirm");t&&!window.confirm(t)&&e.preventDefault()}),!1)}()},function(e,t,i){e.exports=function(){"use strict";function e(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function t(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function i(i){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){e(i,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(r,e))}))}return i}function n(e){return Array.from(new Set(e))}function r(){return navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")}function o(e,t){return e==t}function s(e,t){"template"!==e.tagName.toLowerCase()?console.warn(`Alpine: [${t}] directive should only be added to <template> tags. See https://github.com/alpinejs/alpine#${t}`):1!==e.content.childElementCount&&console.warn(`Alpine: <template> tag with [${t}] encountered with multiple element roots. Make sure <template> only has a single child element.`)}function a(e){return e.toLowerCase().replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function l(e,t){var i;return function(){var n=this,r=arguments,o=function(){i=null,e.apply(n,r)};clearTimeout(i),i=setTimeout(o,t)}}function c(e,t,i={}){return"function"==typeof e?e.call(t):new Function(["$data",...Object.keys(i)],`var __alpine_result; with($data) { __alpine_result = ${e} }; return __alpine_result`)(t,...Object.values(i))}const u=/^x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref|spread)\b/;function h(e){const t=p(e.name);return u.test(t)}function d(e,t,i){let n=Array.from(e.attributes).filter(h).map(f),r=n.filter(e=>"spread"===e.type)[0];if(r){let e=c(r.expression,t.$data);n=n.concat(Object.entries(e).map(([e,t])=>f({name:e,value:t})))}return i?n.filter(e=>e.type===i):function(e){let t=["bind","model","show","catch-all"];return e.sort((e,i)=>{let n=-1===t.indexOf(e.type)?"catch-all":e.type,r=-1===t.indexOf(i.type)?"catch-all":i.type;return t.indexOf(n)-t.indexOf(r)})}(n)}function f({name:e,value:t}){const i=p(e),n=i.match(u),r=i.match(/:([a-zA-Z0-9\-:]+)/),o=i.match(/\.[^.\]]+(?=[^\]]*$)/g)||[];return{type:n?n[1]:null,value:r?r[1]:null,modifiers:o.map(e=>e.replace(".","")),expression:t}}function p(e){return e.startsWith("@")?e.replace("@","x-on:"):e.startsWith(":")?e.replace(":","x-bind:"):e}function m(e,t=Boolean){return e.split(" ").filter(t)}function g(e,t,i,n,r=!1){if(r)return t();if(e.__x_transition&&"in"===e.__x_transition.type)return;const o=d(e,n,"transition"),s=d(e,n,"show")[0];if(s&&s.modifiers.includes("transition")){let n=s.modifiers;if(n.includes("out")&&!n.includes("in"))return t();const r=n.includes("in")&&n.includes("out");n=r?n.filter((e,t)=>t<n.indexOf("out")):n,function(e,t,i,n){const r={duration:b(t,"duration",150),origin:b(t,"origin","center"),first:{opacity:0,scale:b(t,"scale",95)},second:{opacity:1,scale:100}};y(e,t,i,()=>{},n,r,"in")}(e,n,t,i)}else o.some(e=>["enter","enter-start","enter-end"].includes(e.value))?function(e,t,i,n,r){const o=m(k((i.find(e=>"enter"===e.value)||{expression:""}).expression,e,t)),s=m(k((i.find(e=>"enter-start"===e.value)||{expression:""}).expression,e,t)),a=m(k((i.find(e=>"enter-end"===e.value)||{expression:""}).expression,e,t));w(e,o,s,a,n,()=>{},"in",r)}(e,n,o,t,i):t()}function v(e,t,i,n,r=!1){if(r)return t();if(e.__x_transition&&"out"===e.__x_transition.type)return;const o=d(e,n,"transition"),s=d(e,n,"show")[0];if(s&&s.modifiers.includes("transition")){let n=s.modifiers;if(n.includes("in")&&!n.includes("out"))return t();const r=n.includes("in")&&n.includes("out");n=r?n.filter((e,t)=>t>n.indexOf("out")):n,function(e,t,i,n,r){const o={duration:i?b(t,"duration",150):b(t,"duration",150)/2,origin:b(t,"origin","center"),first:{opacity:1,scale:100},second:{opacity:0,scale:b(t,"scale",95)}};y(e,t,()=>{},n,r,o,"out")}(e,n,r,t,i)}else o.some(e=>["leave","leave-start","leave-end"].includes(e.value))?function(e,t,i,n,r){const o=m(k((i.find(e=>"leave"===e.value)||{expression:""}).expression,e,t)),s=m(k((i.find(e=>"leave-start"===e.value)||{expression:""}).expression,e,t)),a=m(k((i.find(e=>"leave-end"===e.value)||{expression:""}).expression,e,t));w(e,o,s,a,()=>{},n,"out",r)}(e,n,o,t,i):t()}function b(e,t,i){if(-1===e.indexOf(t))return i;const n=e[e.indexOf(t)+1];if(!n)return i;if("scale"===t&&!x(n))return i;if("duration"===t){let e=n.match(/([0-9]+)ms/);if(e)return e[1]}return"origin"===t&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}function y(e,t,i,n,r,o,s){e.__x_transition&&e.__x_transition.cancel&&e.__x_transition.cancel();const a=e.style.opacity,l=e.style.transform,c=e.style.transformOrigin,u=!t.includes("opacity")&&!t.includes("scale"),h=u||t.includes("opacity"),d=u||t.includes("scale"),f={start(){h&&(e.style.opacity=o.first.opacity),d&&(e.style.transform=`scale(${o.first.scale/100})`)},during(){d&&(e.style.transformOrigin=o.origin),e.style.transitionProperty=[h?"opacity":"",d?"transform":""].join(" ").trim(),e.style.transitionDuration=o.duration/1e3+"s",e.style.transitionTimingFunction="cubic-bezier(0.4, 0.0, 0.2, 1)"},show(){i()},end(){h&&(e.style.opacity=o.second.opacity),d&&(e.style.transform=`scale(${o.second.scale/100})`)},hide(){n()},cleanup(){h&&(e.style.opacity=a),d&&(e.style.transform=l),d&&(e.style.transformOrigin=c),e.style.transitionProperty=null,e.style.transitionDuration=null,e.style.transitionTimingFunction=null}};E(e,f,s,r)}const k=(e,t,i)=>"function"==typeof e?i.evaluateReturnExpression(t,e):e;function w(e,t,i,n,r,o,s,a){e.__x_transition&&e.__x_transition.cancel&&e.__x_transition.cancel();const l=e.__x_original_classes||[],c={start(){e.classList.add(...i)},during(){e.classList.add(...t)},show(){r()},end(){e.classList.remove(...i.filter(e=>!l.includes(e))),e.classList.add(...n)},hide(){o()},cleanup(){e.classList.remove(...t.filter(e=>!l.includes(e))),e.classList.remove(...n.filter(e=>!l.includes(e)))}};E(e,c,s,a)}function E(e,t,i,n){const r=S(()=>{t.hide(),e.isConnected&&t.cleanup(),delete e.__x_transition});e.__x_transition={type:i,cancel:S(()=>{n("cancelled"),r()}),finish:r,nextFrame:null},t.start(),t.during(),e.__x_transition.nextFrame=requestAnimationFrame(()=>{let i=1e3*Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""));0===i&&(i=1e3*Number(getComputedStyle(e).animationDuration.replace("s",""))),t.show(),e.__x_transition.nextFrame=requestAnimationFrame(()=>{t.end(),setTimeout(e.__x_transition.finish,i)})})}function x(e){return!Array.isArray(e)&&!isNaN(e)}function S(e){let t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}function _(e,t,n,r,o){s(t,"x-for");let a=C("function"==typeof n?e.evaluateReturnExpression(t,n):n),l=function(e,t,i,n){let r=d(t,e,"if")[0];if(r&&!e.evaluateReturnExpression(t,r.expression))return[];let o=e.evaluateReturnExpression(t,i.items,n);return x(o)&&o>0&&(o=Array.from(Array(o).keys(),e=>e+1)),o}(e,t,a,o),c=t;l.forEach((n,s)=>{let u=function(e,t,n,r,o){let s=o?i({},o):{};return s[e.item]=t,e.index&&(s[e.index]=n),e.collection&&(s[e.collection]=r),s}(a,n,s,l,o()),h=function(e,t,i,n){let r=d(t,e,"bind").filter(e=>"key"===e.value)[0];return r?e.evaluateReturnExpression(t,r.expression,()=>n):i}(e,t,s,u),f=function(e,t){if(!e)return;if(e.__x_for_key===t)return e;let i=e;for(;i;){if(i.__x_for_key===t)return i.parentElement.insertBefore(i,e);i=!(!i.nextElementSibling||void 0===i.nextElementSibling.__x_for_key)&&i.nextElementSibling}}(c.nextElementSibling,h);f?(delete f.__x_for_key,f.__x_for=u,e.updateElements(f,()=>f.__x_for)):(f=function(e,t){let i=document.importNode(e.content,!0);return t.parentElement.insertBefore(i,t.nextElementSibling),t.nextElementSibling}(t,c),g(f,()=>{},()=>{},e,r),f.__x_for=u,e.initializeElements(f,()=>f.__x_for)),c=f,c.__x_for_key=h}),function(e,t){for(var i=!(!e.nextElementSibling||void 0===e.nextElementSibling.__x_for_key)&&e.nextElementSibling;i;){let e=i,n=i.nextElementSibling;v(i,()=>{e.remove()},()=>{},t),i=!(!n||void 0===n.__x_for_key)&&n}}(c,e)}function C(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,i=e.match(/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/);if(!i)return;let n={};n.items=i[2].trim();let r=i[1].trim().replace(/^\(|\)$/g,""),o=r.match(t);return o?(n.item=r.replace(t,"").trim(),n.index=o[1].trim(),o[2]&&(n.collection=o[2].trim())):n.item=r,n}function A(e,t,i,r,s,l,c){var u=e.evaluateReturnExpression(t,r,s);if("value"===i){if(fe.ignoreFocusedForValueBinding&&document.activeElement.isSameNode(t))return;if(void 0===u&&r.match(/\./)&&(u=""),"radio"===t.type)void 0===t.attributes.value&&"bind"===l?t.value=u:"bind"!==l&&(t.checked=o(t.value,u));else if("checkbox"===t.type)"boolean"==typeof u||[null,void 0].includes(u)||"bind"!==l?"bind"!==l&&(Array.isArray(u)?t.checked=u.some(e=>o(e,t.value)):t.checked=!!u):t.value=String(u);else if("SELECT"===t.tagName)!function(e,t){const i=[].concat(t).map(e=>e+"");Array.from(e.options).forEach(e=>{e.selected=i.includes(e.value||e.text)})}(t,u);else{if(t.value===u)return;t.value=u}}else if("class"===i)if(Array.isArray(u)){const e=t.__x_original_classes||[];t.setAttribute("class",n(e.concat(u)).join(" "))}else if("object"==typeof u)Object.keys(u).sort((e,t)=>u[e]-u[t]).forEach(e=>{u[e]?m(e).forEach(e=>t.classList.add(e)):m(e).forEach(e=>t.classList.remove(e))});else{const e=t.__x_original_classes||[],i=m(u);t.setAttribute("class",n(e.concat(i)).join(" "))}else i=c.includes("camel")?a(i):i,[null,void 0,!1].includes(u)?t.removeAttribute(i):function(e){return["disabled","checked","required","readonly","hidden","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(e)}(i)?P(t,i,i):P(t,i,u)}function P(e,t,i){e.getAttribute(t)!=i&&e.setAttribute(t,i)}function T(e,t,i,n,r,o={}){const s={passive:n.includes("passive")};if(n.includes("camel")&&(i=a(i)),n.includes("away")){let a=l=>{t.contains(l.target)||t.offsetWidth<1&&t.offsetHeight<1||(L(e,r,l,o),n.includes("once")&&document.removeEventListener(i,a,s))};document.addEventListener(i,a,s)}else{let a=n.includes("window")?window:n.includes("document")?document:t,c=l=>{a!==window&&a!==document||document.body.contains(t)?function(e){return["keydown","keyup"].includes(e)}(i)&&function(e,t){let i=t.filter(e=>!["window","document","prevent","stop"].includes(e));if(i.includes("debounce")){let e=i.indexOf("debounce");i.splice(e,x((i[e+1]||"invalid-wait").split("ms")[0])?2:1)}if(0===i.length)return!1;if(1===i.length&&i[0]===O(e.key))return!1;const n=["ctrl","shift","alt","meta","cmd","super"].filter(e=>i.includes(e));return i=i.filter(e=>!n.includes(e)),!(n.length>0&&n.filter(t=>("cmd"!==t&&"super"!==t||(t="meta"),e[t+"Key"])).length===n.length&&i[0]===O(e.key))}(l,n)||(n.includes("prevent")&&l.preventDefault(),n.includes("stop")&&l.stopPropagation(),n.includes("self")&&l.target!==t)||L(e,r,l,o).then(e=>{!1===e?l.preventDefault():n.includes("once")&&a.removeEventListener(i,c,s)}):a.removeEventListener(i,c,s)};if(n.includes("debounce")){let e=n[n.indexOf("debounce")+1]||"invalid-wait",t=x(e.split("ms")[0])?Number(e.split("ms")[0]):250;c=l(c,t)}a.addEventListener(i,c,s)}}function L(e,t,n,r){return e.evaluateCommandExpression(n.target,t,()=>i(i({},r()),{},{$event:n}))}function O(e){switch(e){case"/":return"slash";case" ":case"Spacebar":return"space";default:return e&&e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}}function R(e,t,i){return"radio"===e.type&&(e.hasAttribute("name")||e.setAttribute("name",i)),(i,n)=>{if(i instanceof CustomEvent&&i.detail)return i.detail;if("checkbox"===e.type){if(Array.isArray(n)){const e=t.includes("number")?D(i.target.value):i.target.value;return i.target.checked?n.concat([e]):n.filter(t=>!o(t,e))}return i.target.checked}if("select"===e.tagName.toLowerCase()&&e.multiple)return t.includes("number")?Array.from(i.target.selectedOptions).map(e=>D(e.value||e.text)):Array.from(i.target.selectedOptions).map(e=>e.value||e.text);{const e=i.target.value;return t.includes("number")?D(e):t.includes("trim")?e.trim():e}}}function D(e){const t=e?parseFloat(e):null;return x(t)?t:e}const{isArray:I}=Array,{getPrototypeOf:j,create:N,defineProperty:M,defineProperties:$,isExtensible:U,getOwnPropertyDescriptor:H,getOwnPropertyNames:F,getOwnPropertySymbols:B,preventExtensions:J,hasOwnProperty:z}=Object,{push:W,concat:q,map:V}=Array.prototype;function K(e){return void 0===e}function G(e){return"function"==typeof e}const X=new WeakMap;function Y(e,t){X.set(e,t)}const Z=e=>X.get(e)||e;function Q(e,t){return e.valueIsObservable(t)?e.getProxy(t):t}function ee(e,t,i){q.call(F(i),B(i)).forEach(n=>{let r=H(i,n);r.configurable||(r=ue(e,r,Q)),M(t,n,r)}),J(t)}class te{constructor(e,t){this.originalTarget=t,this.membrane=e}get(e,t){const{originalTarget:i,membrane:n}=this,r=i[t],{valueObserved:o}=n;return o(i,t),n.getProxy(r)}set(e,t,i){const{originalTarget:n,membrane:{valueMutated:r}}=this;return n[t]!==i?(n[t]=i,r(n,t)):"length"===t&&I(n)&&r(n,t),!0}deleteProperty(e,t){const{originalTarget:i,membrane:{valueMutated:n}}=this;return delete i[t],n(i,t),!0}apply(e,t,i){}construct(e,t,i){}has(e,t){const{originalTarget:i,membrane:{valueObserved:n}}=this;return n(i,t),t in i}ownKeys(e){const{originalTarget:t}=this;return q.call(F(t),B(t))}isExtensible(e){const t=U(e);if(!t)return t;const{originalTarget:i,membrane:n}=this,r=U(i);return r||ee(n,e,i),r}setPrototypeOf(e,t){}getPrototypeOf(e){const{originalTarget:t}=this;return j(t)}getOwnPropertyDescriptor(e,t){const{originalTarget:i,membrane:n}=this,{valueObserved:r}=this.membrane;r(i,t);let o=H(i,t);if(K(o))return o;const s=H(e,t);return K(s)?(o=ue(n,o,Q),o.configurable||M(e,t,o),o):s}preventExtensions(e){const{originalTarget:t,membrane:i}=this;return ee(i,e,t),J(t),!0}defineProperty(e,t,i){const{originalTarget:n,membrane:r}=this,{valueMutated:o}=r,{configurable:s}=i;if(z.call(i,"writable")&&!z.call(i,"value")){const e=H(n,t);i.value=e.value}return M(n,t,function(e){return z.call(e,"value")&&(e.value=Z(e.value)),e}(i)),!1===s&&M(e,t,ue(r,i,Q)),o(n,t),!0}}function ie(e,t){return e.valueIsObservable(t)?e.getReadOnlyProxy(t):t}class ne{constructor(e,t){this.originalTarget=t,this.membrane=e}get(e,t){const{membrane:i,originalTarget:n}=this,r=n[t],{valueObserved:o}=i;return o(n,t),i.getReadOnlyProxy(r)}set(e,t,i){return!1}deleteProperty(e,t){return!1}apply(e,t,i){}construct(e,t,i){}has(e,t){const{originalTarget:i,membrane:{valueObserved:n}}=this;return n(i,t),t in i}ownKeys(e){const{originalTarget:t}=this;return q.call(F(t),B(t))}setPrototypeOf(e,t){}getOwnPropertyDescriptor(e,t){const{originalTarget:i,membrane:n}=this,{valueObserved:r}=n;r(i,t);let o=H(i,t);if(K(o))return o;const s=H(e,t);return K(s)?(o=ue(n,o,ie),z.call(o,"set")&&(o.set=void 0),o.configurable||M(e,t,o),o):s}preventExtensions(e){return!1}defineProperty(e,t,i){return!1}}function re(e){let t=void 0;return I(e)?t=[]:"object"==typeof e&&(t={}),t}const oe=Object.prototype;function se(e){if(null===e)return!1;if("object"!=typeof e)return!1;if(I(e))return!0;const t=j(e);return t===oe||null===t||null===j(t)}const ae=(e,t)=>{},le=(e,t)=>{},ce=e=>e;function ue(e,t,i){const{set:n,get:r}=t;return z.call(t,"value")?t.value=i(e,t.value):(K(r)||(t.get=function(){return i(e,r.call(Z(this)))}),K(n)||(t.set=function(t){n.call(Z(this),e.unwrapProxy(t))})),t}class he{constructor(e){if(this.valueDistortion=ce,this.valueMutated=le,this.valueObserved=ae,this.valueIsObservable=se,this.objectGraph=new WeakMap,!K(e)){const{valueDistortion:t,valueMutated:i,valueObserved:n,valueIsObservable:r}=e;this.valueDistortion=G(t)?t:ce,this.valueMutated=G(i)?i:le,this.valueObserved=G(n)?n:ae,this.valueIsObservable=G(r)?r:se}}getProxy(e){const t=Z(e),i=this.valueDistortion(t);if(this.valueIsObservable(i)){const n=this.getReactiveState(t,i);return n.readOnly===e?e:n.reactive}return i}getReadOnlyProxy(e){e=Z(e);const t=this.valueDistortion(e);return this.valueIsObservable(t)?this.getReactiveState(e,t).readOnly:t}unwrapProxy(e){return Z(e)}getReactiveState(e,t){const{objectGraph:i}=this;let n=i.get(t);if(n)return n;const r=this;return n={get reactive(){const i=new te(r,t),n=new Proxy(re(t),i);return Y(n,e),M(this,"reactive",{value:n}),n},get readOnly(){const i=new ne(r,t),n=new Proxy(re(t),i);return Y(n,e),M(this,"readOnly",{value:n}),n}},i.set(t,n),n}}class de{constructor(e,t=null){this.$el=e;const i=this.$el.getAttribute("x-data"),n=""===i?"{}":i,r=this.$el.getAttribute("x-init");let o={$el:this.$el},s=t?t.$el:this.$el;Object.entries(fe.magicProperties).forEach(([e,t])=>{Object.defineProperty(o,"$"+e,{get:function(){return t(s)}})}),this.unobservedData=t?t.getUnobservedData():c(n,o);let{membrane:a,data:l}=this.wrapDataInObservable(this.unobservedData);var u;this.$data=l,this.membrane=a,this.unobservedData.$el=this.$el,this.unobservedData.$refs=this.getRefsProxy(),this.nextTickStack=[],this.unobservedData.$nextTick=e=>{this.nextTickStack.push(e)},this.watchers={},this.unobservedData.$watch=(e,t)=>{this.watchers[e]||(this.watchers[e]=[]),this.watchers[e].push(t)},Object.entries(fe.magicProperties).forEach(([e,t])=>{Object.defineProperty(this.unobservedData,"$"+e,{get:function(){return t(s)}})}),this.showDirectiveStack=[],this.showDirectiveLastElement,t||fe.onBeforeComponentInitializeds.forEach(e=>e(this)),r&&!t&&(this.pauseReactivity=!0,u=this.evaluateReturnExpression(this.$el,r),this.pauseReactivity=!1),this.initializeElements(this.$el),this.listenForNewElementsToInitialize(),"function"==typeof u&&u.call(this.$data),t||setTimeout(()=>{fe.onComponentInitializeds.forEach(e=>e(this))},0)}getUnobservedData(){return function(e,t){let i=e.unwrapProxy(t),n={};return Object.keys(i).forEach(e=>{["$el","$refs","$nextTick","$watch"].includes(e)||(n[e]=i[e])}),n}(this.membrane,this.$data)}wrapDataInObservable(e){var t=this;let i=l((function(){t.updateElements(t.$el)}),0);return function(e,t){let i=new he({valueMutated(e,i){t(e,i)}});return{data:i.getProxy(e),membrane:i}}(e,(e,n)=>{t.watchers[n]?t.watchers[n].forEach(t=>t(e[n])):Array.isArray(e)?Object.keys(t.watchers).forEach(i=>{let r=i.split(".");"length"!==n&&r.reduce((n,r)=>(Object.is(e,n[r])&&t.watchers[i].forEach(t=>t(e)),n[r]),t.unobservedData)}):Object.keys(t.watchers).filter(e=>e.includes(".")).forEach(i=>{let r=i.split(".");n===r[r.length-1]&&r.reduce((r,o)=>(Object.is(e,r)&&t.watchers[i].forEach(t=>t(e[n])),r[o]),t.unobservedData)}),t.pauseReactivity||i()})}walkAndSkipNestedComponents(e,t,i=(()=>{})){!function e(t,i){if(!1===i(t))return;let n=t.firstElementChild;for(;n;)e(n,i),n=n.nextElementSibling}(e,e=>e.hasAttribute("x-data")&&!e.isSameNode(this.$el)?(e.__x||i(e),!1):t(e))}initializeElements(e,t=(()=>{})){this.walkAndSkipNestedComponents(e,e=>void 0===e.__x_for_key&&void 0===e.__x_inserted_me&&void this.initializeElement(e,t),e=>{e.__x=new de(e)}),this.executeAndClearRemainingShowDirectiveStack(),this.executeAndClearNextTickStack(e)}initializeElement(e,t){e.hasAttribute("class")&&d(e,this).length>0&&(e.__x_original_classes=m(e.getAttribute("class"))),this.registerListeners(e,t),this.resolveBoundAttributes(e,!0,t)}updateElements(e,t=(()=>{})){this.walkAndSkipNestedComponents(e,e=>{if(void 0!==e.__x_for_key&&!e.isSameNode(this.$el))return!1;this.updateElement(e,t)},e=>{e.__x=new de(e)}),this.executeAndClearRemainingShowDirectiveStack(),this.executeAndClearNextTickStack(e)}executeAndClearNextTickStack(e){e===this.$el&&this.nextTickStack.length>0&&requestAnimationFrame(()=>{for(;this.nextTickStack.length>0;)this.nextTickStack.shift()()})}executeAndClearRemainingShowDirectiveStack(){this.showDirectiveStack.reverse().map(e=>new Promise((t,i)=>{e(t,i)})).reduce((e,t)=>e.then(()=>t.then(e=>{e()})),Promise.resolve(()=>{})).catch(e=>{if("cancelled"!==e)throw e}),this.showDirectiveStack=[],this.showDirectiveLastElement=void 0}updateElement(e,t){this.resolveBoundAttributes(e,!1,t)}registerListeners(e,t){d(e,this).forEach(({type:n,value:r,modifiers:o,expression:s})=>{switch(n){case"on":T(this,e,r,o,s,t);break;case"model":!function(e,t,n,r,o){var s="select"===t.tagName.toLowerCase()||["checkbox","radio"].includes(t.type)||n.includes("lazy")?"change":"input";T(e,t,s,n,`${r} = rightSideOfExpression($event, ${r})`,()=>i(i({},o()),{},{rightSideOfExpression:R(t,n,r)}))}(this,e,o,s,t)}})}resolveBoundAttributes(e,t=!1,i){let n=d(e,this);n.forEach(({type:r,value:o,modifiers:a,expression:l})=>{switch(r){case"model":A(this,e,"value",l,i,r,a);break;case"bind":if("template"===e.tagName.toLowerCase()&&"key"===o)return;A(this,e,o,l,i,r,a);break;case"text":var c=this.evaluateReturnExpression(e,l,i);!function(e,t,i){void 0===t&&i.match(/\./)&&(t=""),e.textContent=t}(e,c,l);break;case"html":!function(e,t,i,n){t.innerHTML=e.evaluateReturnExpression(t,i,n)}(this,e,l,i);break;case"show":c=this.evaluateReturnExpression(e,l,i),function(e,t,i,n,r=!1){const o=()=>{t.style.display="none",t.__x_is_shown=!1},s=()=>{1===t.style.length&&"none"===t.style.display?t.removeAttribute("style"):t.style.removeProperty("display"),t.__x_is_shown=!0};if(!0===r)return void(i?s():o());const a=(n,r)=>{i?(("none"===t.style.display||t.__x_transition)&&g(t,()=>{s()},r,e),n(()=>{})):"none"!==t.style.display?v(t,()=>{n(()=>{o()})},r,e):n(()=>{})};n.includes("immediate")?a(e=>e(),()=>{}):(e.showDirectiveLastElement&&!e.showDirectiveLastElement.contains(t)&&e.executeAndClearRemainingShowDirectiveStack(),e.showDirectiveStack.push(a),e.showDirectiveLastElement=t)}(this,e,c,a,t);break;case"if":if(n.some(e=>"for"===e.type))return;c=this.evaluateReturnExpression(e,l,i),function(e,t,i,n,r){s(t,"x-if");const o=t.nextElementSibling&&!0===t.nextElementSibling.__x_inserted_me;if(!i||o&&!t.__x_transition)!i&&o&&v(t.nextElementSibling,()=>{t.nextElementSibling.remove()},()=>{},e,n);else{const i=document.importNode(t.content,!0);t.parentElement.insertBefore(i,t.nextElementSibling),g(t.nextElementSibling,()=>{},()=>{},e,n),e.initializeElements(t.nextElementSibling,r),t.nextElementSibling.__x_inserted_me=!0}}(this,e,c,t,i);break;case"for":_(this,e,l,t,i);break;case"cloak":e.removeAttribute("x-cloak")}})}evaluateReturnExpression(e,t,n=(()=>{})){return c(t,this.$data,i(i({},n()),{},{$dispatch:this.getDispatchFunction(e)}))}evaluateCommandExpression(e,t,n=(()=>{})){return function(e,t,i={}){if("function"==typeof e)return Promise.resolve(e.call(t,i.$event));let n=Function;if(n=Object.getPrototypeOf((async function(){})).constructor,Object.keys(t).includes(e)){let n=new Function(["dataContext",...Object.keys(i)],`with(dataContext) { return ${e} }`)(t,...Object.values(i));return"function"==typeof n?Promise.resolve(n.call(t,i.$event)):Promise.resolve()}return Promise.resolve(new n(["dataContext",...Object.keys(i)],`with(dataContext) { ${e} }`)(t,...Object.values(i)))}(t,this.$data,i(i({},n()),{},{$dispatch:this.getDispatchFunction(e)}))}getDispatchFunction(e){return(t,i={})=>{e.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0}))}}listenForNewElementsToInitialize(){const e=this.$el;new MutationObserver(e=>{for(let t=0;t<e.length;t++){const i=e[t].target.closest("[x-data]");if(i&&i.isSameNode(this.$el)){if("attributes"===e[t].type&&"x-data"===e[t].attributeName){const i=c(e[t].target.getAttribute("x-data")||"{}",{$el:this.$el});Object.keys(i).forEach(e=>{this.$data[e]!==i[e]&&(this.$data[e]=i[e])})}e[t].addedNodes.length>0&&e[t].addedNodes.forEach(e=>{1!==e.nodeType||e.__x_inserted_me||(!e.matches("[x-data]")||e.__x?this.initializeElements(e):e.__x=new de(e))})}}}).observe(e,{childList:!0,attributes:!0,subtree:!0})}getRefsProxy(){var e=this;return new Proxy({},{get(t,i){return"$isAlpineProxy"===i||(e.walkAndSkipNestedComponents(e.$el,e=>{e.hasAttribute("x-ref")&&e.getAttribute("x-ref")===i&&(n=e)}),n);var n}})}}const fe={version:"2.7.3",pauseMutationObserver:!1,magicProperties:{},onComponentInitializeds:[],onBeforeComponentInitializeds:[],ignoreFocusedForValueBinding:!1,start:async function(){r()||await new Promise(e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",e):e()}),this.discoverComponents(e=>{this.initializeComponent(e)}),document.addEventListener("turbolinks:load",()=>{this.discoverUninitializedComponents(e=>{this.initializeComponent(e)})}),this.listenForNewUninitializedComponentsAtRunTime()},discoverComponents:function(e){document.querySelectorAll("[x-data]").forEach(t=>{e(t)})},discoverUninitializedComponents:function(e,t=null){const i=(t||document).querySelectorAll("[x-data]");Array.from(i).filter(e=>void 0===e.__x).forEach(t=>{e(t)})},listenForNewUninitializedComponentsAtRunTime:function(){const e=document.querySelector("body");new MutationObserver(e=>{if(!this.pauseMutationObserver)for(let t=0;t<e.length;t++)e[t].addedNodes.length>0&&e[t].addedNodes.forEach(e=>{1===e.nodeType&&(e.parentElement&&e.parentElement.closest("[x-data]")||this.discoverUninitializedComponents(e=>{this.initializeComponent(e)},e.parentElement))})}).observe(e,{childList:!0,attributes:!0,subtree:!0})},initializeComponent:function(e){if(!e.__x)try{e.__x=new de(e)}catch(e){setTimeout(()=>{throw e},0)}},clone:function(e,t){t.__x||(t.__x=new de(t,e))},addMagicProperty:function(e,t){this.magicProperties[e]=t},onComponentInitialized:function(e){this.onComponentInitializeds.push(e)},onBeforeComponentInitialized:function(e){this.onBeforeComponentInitializeds.push(e)}};return r()||(window.Alpine=fe,window.deferLoadingAlpine?window.deferLoadingAlpine((function(){window.Alpine.start()})):window.Alpine.start()),fe}()},function(e,t,i){"use strict";i.r(t);i(3),i(4);var n=i(1),r=i(0),o=i.n(r),s=[1e3,3e3],a=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading"],l="data-phx-component",c="data-phx-ref",u="data-phx-upload-ref",h=["text","textarea","number","email","password","search","tel","url","date","time"],d=["checkbox","radio"],f="data-phx-session",p=`[${f}]`,m="data-phx-static",g={debounce:300,throttle:300},v="d",b="s",y="e",k="r",w="t",E=(e,t)=>console.error&&console.error(e,t);var x,S=e=>"function"==typeof e?e:function(){return e},_=e=>JSON.parse(JSON.stringify(e)),C=(e,t,i)=>{do{if(e.matches(`[${t}]`))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType&&!(i&&i.isSameNode(e)||e.matches(p)));return null},A=e=>null!==e&&"object"==typeof e&&!(e instanceof Array),P=e=>{for(let t in e)return!1;return!0},T=(e,t)=>e&&t(e),L=function(e,t,i,n){e.forEach(e=>{new class{constructor(e,t,i){this.liveSocket=i,this.entry=e,this.offset=0,this.chunkSize=t,this.chunkTimer=null,this.uploadChannel=i.channel("lvu:"+e.ref,{token:e.metadata()})}error(e){clearTimeout(this.chunkTimer),this.uploadChannel.leave(),this.entry.error(e)}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,t=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=e=>{if(null!==e.target.error)return E("Read error: "+e.target.error);this.offset+=e.target.result.byteLength,this.pushChunk(e.target.result)},e.readAsArrayBuffer(t)}pushChunk(e){this.uploadChannel.isJoined()&&this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))})}}(e,i.config.chunk_size,n).upload()})},O={canPushState:()=>void 0!==history.pushState,dropLocal(e,t,i){return e.removeItem(this.localKey(t,i))},updateLocal(e,t,i,n,r){let o=this.getLocal(e,t,i),s=this.localKey(t,i),a=null===o?n:r(o);return e.setItem(s,JSON.stringify(a)),a},getLocal(e,t,i){return JSON.parse(e.getItem(this.localKey(t,i)))},updateCurrentState(e){this.canPushState()&&history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,i){if(this.canPushState()){if(i!==window.location.href){if("redirect"==t.type&&t.scroll){let e=history.state||{};e.scroll=t.scroll,history.replaceState(e,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",i||null);let n=this.getHashTargetEl(window.location.hash);n?n.scrollIntoView():"redirect"===t.type&&window.scroll(0,0)}}else this.redirect(i)},setCookie(e,t){document.cookie=`${e}=${t}`},getCookie:e=>document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1"),redirect(e,t){t&&O.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey:(e,t)=>`${e}-${t}`,getHashTargetEl(e){let t=e.toString().substring(1);if(""!==t)return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},R=O,D={byId:e=>document.getElementById(e)||E("no id found for "+e),removeClass(e,t){e.classList.remove(t),0===e.classList.length&&e.removeAttribute("class")},all(e,t,i){if(!e)return[];let n=Array.from(e.querySelectorAll(t));return i?n.forEach(i):n},childNodeLength(e){let t=document.createElement("template");return t.innerHTML=e,t.content.childElementCount},isUploadInput:e=>"file"===e.type&&null!==e.getAttribute(u),findUploadInputs(e){return this.all(e,`input[type="file"][${u}]`)},findComponentNodeList(e,t){return this.filterWithinSameLiveView(this.all(e,`[${l}="${t}"]`),e)},isPhxDestroyed:e=>!(!e.id||!D.private(e,"destroyed")),markPhxChildDestroyed(e){e.setAttribute(f,""),this.putPrivate(e,"destroyed",!0)},findPhxChildrenInFragment(e,t){let i=document.createElement("template");return i.innerHTML=e,this.findPhxChildren(i.content,t)},isIgnored:(e,t)=>"ignore"===(e.getAttribute(t)||e.getAttribute("data-phx-update")),isPhxUpdate:(e,t,i)=>e.getAttribute&&i.indexOf(e.getAttribute(t))>=0,findPhxChildren(e,t){return this.all(e,`${p}[data-phx-parent-id="${t}"]`)},findParentCIDs(e,t){let i=new Set(t);return t.reduce((t,i)=>{let n=`[${l}="${i}"] [${l}]`;return this.filterWithinSameLiveView(this.all(e,n),e).map(e=>parseInt(e.getAttribute(l))).forEach(e=>t.delete(e)),t},i)},filterWithinSameLiveView(e,t){return t.querySelector(p)?e.filter(e=>this.withinSameLiveView(e,t)):e},withinSameLiveView(e,t){for(;e=e.parentNode;){if(e.isSameNode(t))return!0;if(null!==e.getAttribute(f))return!1}},private:(e,t)=>e.phxPrivate&&e.phxPrivate[t],deletePrivate(e,t){e.phxPrivate&&delete e.phxPrivate[t]},putPrivate(e,t,i){e.phxPrivate||(e.phxPrivate={}),e.phxPrivate[t]=i},copyPrivates(e,t){t.phxPrivate&&(e.phxPrivate=_(t.phxPrivate))},putTitle(e){let t=document.querySelector("title"),{prefix:i,suffix:n}=t.dataset;document.title=`${i||""}${e}${n||""}`},debounce(e,t,i,n,r,o,s){let a=e.getAttribute(i),l=e.getAttribute(r);""===a&&(a=n),""===l&&(l=o);let c=a||l;switch(c){case null:return s();case"blur":return void(this.once(e,"debounce-blur")&&e.addEventListener("blur",()=>s()));default:let i=parseInt(c),n=()=>l?this.deletePrivate(e,"throttled"):s(),r=this.incCycle(e,"debounce-trigger",n);if(isNaN(i))return E("invalid throttle/debounce value: "+c);if(l){let n=!1;if("keydown"===t.type){let i=this.private(e,"debounce-prev-key");this.putPrivate(e,"debounce-prev-key",t.key),n=i!==t.key}if(!n&&this.private(e,"throttled"))return!1;s(),this.putPrivate(e,"throttled",!0),setTimeout(()=>this.triggerCycle(e,"debounce-trigger"),i)}else setTimeout(()=>this.triggerCycle(e,"debounce-trigger",r),i);let o=e.form;o&&this.once(o,"bind-debounce")&&o.addEventListener("submit",()=>{Array.from(new FormData(o).entries(),([e])=>{let t=o.querySelector(`[name="${e}"]`);this.incCycle(t,"debounce-trigger"),this.deletePrivate(t,"throttled")})}),this.once(e,"bind-debounce")&&e.addEventListener("blur",()=>this.triggerCycle(e,"debounce-trigger"))}},triggerCycle(e,t,i){let[n,r]=this.private(e,t);i||(i=n),i===n&&(this.incCycle(e,t),r())},once(e,t){return!0!==this.private(e,t)&&(this.putPrivate(e,t,!0),!0)},incCycle(e,t,i=function(){}){let[n]=this.private(e,t)||[0,i];return n++,this.putPrivate(e,t,[n,i]),n},discardError(e,t,i){let n=t.getAttribute&&t.getAttribute(i),r=n&&e.querySelector(`[id="${n}"], [name="${n}"]`);r&&(this.private(r,"phx-has-focused")||this.private(r.form,"phx-has-submitted")||t.classList.add("phx-no-feedback"))},showError(e,t){(e.id||e.name)&&this.all(e.form,`[${t}="${e.id}"], [${t}="${e.name}"]`,e=>{this.removeClass(e,"phx-no-feedback")})},isPhxChild:e=>e.getAttribute&&e.getAttribute("data-phx-parent-id"),dispatchEvent(e,t,i={}){let n=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:i});e.dispatchEvent(n)},cloneNode(e,t){if(void 0===t)return e.cloneNode(!0);{let i=e.cloneNode(!1);return i.innerHTML=t,i}},mergeAttrs(e,t,i={}){let n=i.exclude||[],r=i.isIgnored,o=t.attributes;for(let i=o.length-1;i>=0;i--){let r=o[i].name;n.indexOf(r)<0&&e.setAttribute(r,t.getAttribute(r))}let s=e.attributes;for(let i=s.length-1;i>=0;i--){let n=s[i].name;r?n.startsWith("data-")&&!t.hasAttribute(n)&&e.removeAttribute(n):t.hasAttribute(n)||e.removeAttribute(n)}},mergeFocusedInput(e,t){e instanceof HTMLSelectElement||D.mergeAttrs(e,t,{except:["value"]}),t.readOnly?e.setAttribute("readonly",!0):e.removeAttribute("readonly")},hasSelectionRange:e=>e.setSelectionRange&&("text"===e.type||"textarea"===e.type),restoreFocus(e,t,i){if(!D.isTextualInput(e))return;let n=e.matches(":focus");e.readOnly&&e.blur(),n||e.focus(),this.hasSelectionRange(e)&&e.setSelectionRange(t,i)},isFormInput:e=>/^(?:input|select|textarea)$/i.test(e.tagName)&&"button"!==e.type,syncAttrsToProps(e){e instanceof HTMLInputElement&&d.indexOf(e.type.toLocaleLowerCase())>=0&&(e.checked=null!==e.getAttribute("checked"))},syncPropsToAttrs(e){if(e instanceof HTMLSelectElement){let t=e.options.item(e.selectedIndex);t&&null===t.getAttribute("selected")&&t.setAttribute("selected","")}},isTextualInput:e=>h.indexOf(e.type)>=0,isNowTriggerFormExternal:(e,t)=>e.getAttribute&&null!==e.getAttribute(t),syncPendingRef(e,t,i){let n=e.getAttribute(c);return null===n||(D.isFormInput(e)||null!==e.getAttribute(i)?(D.isUploadInput(e)&&D.mergeAttrs(e,t,{isIgnored:!0}),D.putPrivate(e,c,t),!1):(a.forEach(i=>{e.classList.contains(i)&&t.classList.add(i)}),t.setAttribute(c,n),!0))},cleanChildNodes(e,t){if(D.isPhxUpdate(e,t,["append","prepend"])){let t=[];e.childNodes.forEach(e=>{if(!e.id){e.nodeType===Node.TEXT_NODE&&""===e.nodeValue.trim()||E(`only HTML element tags with an id are allowed inside containers with phx-update.\n\nremoving illegal node: "${(e.outerHTML||e.nodeValue).trim()}"\n\n`),t.push(e)}}),t.forEach(e=>e.remove())}},replaceRootContainer(e,t,i){let n=new Set(["id",f,m,"data-phx-main"]);if(e.tagName.toLowerCase()===t.toLowerCase())return Array.from(e.attributes).filter(e=>!n.has(e.name.toLowerCase())).forEach(t=>e.removeAttribute(t.name)),Object.keys(i).filter(e=>!n.has(e.toLowerCase())).forEach(t=>e.setAttribute(t,i[t])),e;{let r=document.createElement(t);return Object.keys(i).forEach(e=>r.setAttribute(e,i[e])),n.forEach(t=>r.setAttribute(t,e.getAttribute(t))),r.innerHTML=e.innerHTML,e.replaceWith(r),r}}},I=D,j=class{static isActive(e,t){let i=void 0===t._phxRef,n=e.getAttribute("data-phx-active-refs").split(",").indexOf(M.genFileRef(t))>=0;return t.size>0&&(i||n)}static isPreflighted(e,t){return e.getAttribute("data-phx-preflighted-refs").split(",").indexOf(M.genFileRef(t))>=0&&this.isActive(e,t)}constructor(e,t,i){this.ref=M.genFileRef(t),this.fileEl=e,this.file=t,this.view=i,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener("phx:live-file:updated",this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{M.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(e="failed"){this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),M.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener("phx:live-file:updated",this._onElUpdated),e()}}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(e){if(this.meta.uploader){let t=e[this.meta.uploader]||E("no uploader configured for "+this.meta.uploader);return{name:this.meta.uploader,callback:t}}return{name:"channel",callback:L}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||E("no preflight upload response returned with ref "+this.ref,{input:this.fileEl,response:e})}},N=0,M=class{static genFileRef(e){let t=e._phxRef;return void 0!==t?t:(e._phxRef=(N++).toString(),e._phxRef)}static getEntryDataURL(e,t,i){let n=this.activeFiles(e).find(e=>this.genFileRef(e)===t);i(URL.createObjectURL(n))}static hasUploadsInProgress(e){let t=0;return I.findUploadInputs(e).forEach(e=>{e.getAttribute("data-phx-preflighted-refs")!==e.getAttribute("data-phx-done-refs")&&t++}),t>0}static serializeUploads(e){let t=this.activeFiles(e),i={};return t.forEach(t=>{let n={path:e.name},r=e.getAttribute(u);i[r]=i[r]||[],n.ref=this.genFileRef(t),n.name=t.name||n.ref,n.type=t.type,n.size=t.size,i[r].push(n)}),i}static clearFiles(e){e.value=null,e.removeAttribute(u),I.putPrivate(e,"files",[])}static untrackFile(e,t){I.putPrivate(e,"files",I.private(e,"files").filter(e=>!Object.is(e,t)))}static trackFiles(e,t){if(null!==e.getAttribute("multiple")){let i=t.filter(t=>!this.activeFiles(e).find(e=>Object.is(e,t)));I.putPrivate(e,"files",this.activeFiles(e).concat(i)),e.value=null}else I.putPrivate(e,"files",t)}static activeFileInputs(e){let t=I.findUploadInputs(e);return Array.from(t).filter(e=>e.files&&this.activeFiles(e).length>0)}static activeFiles(e){return(I.private(e,"files")||[]).filter(t=>j.isActive(e,t))}static inputsAwaitingPreflight(e){let t=I.findUploadInputs(e);return Array.from(t).filter(e=>this.filesAwaitingPreflight(e).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(t=>!j.isPreflighted(e,t))}constructor(e,t,i){this.view=t,this.onComplete=i,this._entries=Array.from(M.filesAwaitingPreflight(e)||[]).map(i=>new j(e,i,t)),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,t,i){this._entries=this._entries.map(t=>(t.zipPostFlight(e),t.onDone(()=>{this.numEntriesInProgress--,0===this.numEntriesInProgress&&this.onComplete()}),t));let n=this._entries.reduce((e,t)=>{let{name:n,callback:r}=t.uploader(i.uploaders);return e[n]=e[n]||{callback:r,entries:[]},e[n].entries.push(t),e},{});for(let r in n){let{callback:o,entries:s}=n[r];o(s,t,e,i)}}},$={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 e=this.preflightedRefs();this.preflightedWas!==e&&(this.preflightedWas=e,""===e&&this.__view.cancelSubmit(this.el.form)),""===this.activeRefs()&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent("phx:live-file:updated"))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(u)),M.getEntryDataURL(this.inputEl,this.ref,e=>{this.url=e,this.el.src=e})},destroyed(){URL.revokeObjectURL(this.url)}}};var U="undefined"==typeof document?void 0:document,H=!!U&&"content"in U.createElement("template"),F=!!U&&U.createRange&&"createContextualFragment"in U.createRange();function B(e){return e=e.trim(),H?function(e){var t=U.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(e):F?function(e){return x||(x=U.createRange()).selectNode(U.body),x.createContextualFragment(e).childNodes[0]}(e):function(e){var t=U.createElement("body");return t.innerHTML=e,t.childNodes[0]}(e)}function J(e,t){var i,n,r=e.nodeName,o=t.nodeName;return r===o||(i=r.charCodeAt(0),n=o.charCodeAt(0),i<=90&&n>=97?r===o.toUpperCase():n<=90&&i>=97&&o===r.toUpperCase())}function z(e,t,i){e[i]!==t[i]&&(e[i]=t[i],e[i]?e.setAttribute(i,""):e.removeAttribute(i))}var W={OPTION:function(e,t){var i=e.parentNode;if(i){var n=i.nodeName.toUpperCase();"OPTGROUP"===n&&(n=(i=i.parentNode)&&i.nodeName.toUpperCase()),"SELECT"!==n||i.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),i.selectedIndex=-1)}z(e,t,"selected")},INPUT:function(e,t){z(e,t,"checked"),z(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var i=t.value;e.value!==i&&(e.value=i);var n=e.firstChild;if(n){var r=n.nodeValue;if(r==i||!i&&r==e.placeholder)return;n.nodeValue=i}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var i,n,r=-1,o=0,s=e.firstChild;s;)if("OPTGROUP"===(n=s.nodeName&&s.nodeName.toUpperCase()))s=(i=s).firstChild;else{if("OPTION"===n){if(s.hasAttribute("selected")){r=o;break}o++}!(s=s.nextSibling)&&i&&(s=i.nextSibling,i=null)}e.selectedIndex=r}}};function q(){}function V(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var K,G=(K=function(e,t){var i,n,r,o,s=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var a=s.length-1;a>=0;a--)n=(i=s[a]).name,r=i.namespaceURI,o=i.value,r?(n=i.localName||n,e.getAttributeNS(r,n)!==o&&("xmlns"===i.prefix&&(n=i.name),e.setAttributeNS(r,n,o))):e.getAttribute(n)!==o&&e.setAttribute(n,o);for(var l=e.attributes,c=l.length-1;c>=0;c--)n=(i=l[c]).name,(r=i.namespaceURI)?(n=i.localName||n,t.hasAttributeNS(r,n)||e.removeAttributeNS(r,n)):t.hasAttribute(n)||e.removeAttribute(n)}},function(e,t,i){if(i||(i={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName||"BODY"===e.nodeName){var n=t;(t=U.createElement("html")).innerHTML=n}else t=B(t);var r=i.getNodeKey||V,o=i.onBeforeNodeAdded||q,s=i.onNodeAdded||q,a=i.onBeforeElUpdated||q,l=i.onElUpdated||q,c=i.onBeforeNodeDiscarded||q,u=i.onNodeDiscarded||q,h=i.onBeforeElChildrenUpdated||q,d=!0===i.childrenOnly,f=Object.create(null),p=[];function m(e){p.push(e)}function g(e,t,i){!1!==c(e)&&(t&&t.removeChild(e),u(e),function e(t,i){if(1===t.nodeType)for(var n=t.firstChild;n;){var o=void 0;i&&(o=r(n))?m(o):(u(n),n.firstChild&&e(n,i)),n=n.nextSibling}}(e,i))}function v(e){s(e);for(var t=e.firstChild;t;){var i=t.nextSibling,n=r(t);if(n){var o=f[n];o&&J(t,o)?(t.parentNode.replaceChild(o,t),b(o,t)):v(t)}else v(t);t=i}}function b(e,t,i){var n=r(t);if(n&&delete f[n],!i){if(!1===a(e,t))return;if(K(e,t),l(e),!1===h(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var i,n,s,a,l,c=t.firstChild,u=e.firstChild;e:for(;c;){for(a=c.nextSibling,i=r(c);u;){if(s=u.nextSibling,c.isSameNode&&c.isSameNode(u)){c=a,u=s;continue e}n=r(u);var h=u.nodeType,d=void 0;if(h===c.nodeType&&(1===h?(i?i!==n&&((l=f[i])?s===l?d=!1:(e.insertBefore(l,u),n?m(n):g(u,e,!0),u=l):d=!1):n&&(d=!1),(d=!1!==d&&J(u,c))&&b(u,c)):3!==h&&8!=h||(d=!0,u.nodeValue!==c.nodeValue&&(u.nodeValue=c.nodeValue))),d){c=a,u=s;continue e}n?m(n):g(u,e,!0),u=s}if(i&&(l=f[i])&&J(l,c))e.appendChild(l),b(l,c);else{var p=o(c);!1!==p&&(p&&(c=p),c.actualize&&(c=c.actualize(e.ownerDocument||U)),e.appendChild(c),v(c))}c=a,u=s}!function(e,t,i){for(;t;){var n=t.nextSibling;(i=r(t))?m(i):g(t,e,!0),t=n}}(e,u,n);var y=W[e.nodeName];y&&y(e,t)}(e,t):W.TEXTAREA(e,t)}!function e(t){if(1===t.nodeType||11===t.nodeType)for(var i=t.firstChild;i;){var n=r(i);n&&(f[n]=i),e(i),i=i.nextSibling}}(e);var y,k,w=e,E=w.nodeType,x=t.nodeType;if(!d)if(1===E)1===x?J(e,t)||(u(e),w=function(e,t){for(var i=e.firstChild;i;){var n=i.nextSibling;t.appendChild(i),i=n}return t}(e,(y=t.nodeName,(k=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==k?U.createElementNS(k,y):U.createElement(y)))):w=t;else if(3===E||8===E){if(x===E)return w.nodeValue!==t.nodeValue&&(w.nodeValue=t.nodeValue),w;w=t}if(w===t)u(e);else{if(t.isSameNode&&t.isSameNode(w))return;if(b(w,t,d),p)for(var S=0,_=p.length;S<_;S++){var C=f[p[S]];C&&g(C,C.parentNode,!1)}}return!d&&w!==e&&e.parentNode&&(w.actualize&&(w=w.actualize(e.ownerDocument||U)),e.parentNode.replaceChild(w,e)),w}),X=class{static patchEl(e,t,i){G(e,t,{childrenOnly:!1,onBeforeElUpdated:(e,t)=>{if(i&&i.isSameNode(e)&&I.isFormInput(e))return I.mergeFocusedInput(e,t),!1}})}constructor(e,t,i,n,r){this.view=e,this.liveSocket=e.liveSocket,this.container=t,this.id=i,this.rootID=e.root.id,this.html=n,this.targetCID=r,this.cidPatch="number"==typeof this.targetCID,this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[]}}before(e,t){this.callbacks["before"+e].push(t)}after(e,t){this.callbacks["after"+e].push(t)}trackBefore(e,...t){this.callbacks["before"+e].forEach(e=>e(...t))}trackAfter(e,...t){this.callbacks["after"+e].forEach(e=>e(...t))}markPrunableContentForRemoval(){I.all(this.container,"[phx-update=append] > *, [phx-update=prepend] > *",e=>{e.setAttribute("data-phx-remove","")})}perform(){let{view:e,liveSocket:t,container:i,html:n}=this,r=this.isCIDPatch()?this.targetCIDContainer(n):i;if(this.isCIDPatch()&&!r)return;let o=t.getActiveElement(),{selectionStart:s,selectionEnd:a}=o&&I.hasSelectionRange(o)?o:{},c=t.binding("update"),u=t.binding("feedback-for"),h=t.binding("disable-with"),d=t.binding("trigger-action"),p=[],g=[],v=[],b=null,y=t.time("premorph container prep",()=>this.buildDiffHTML(i,n,c,r));return this.trackBefore("added",i),this.trackBefore("updated",i,i),t.time("morphdom",()=>{G(r,y,{childrenOnly:null===r.getAttribute(l),getNodeKey:e=>I.isPhxDestroyed(e)?null:e.id,onBeforeNodeAdded:e=>(this.trackBefore("added",e),e),onNodeAdded:t=>{I.isNowTriggerFormExternal(t,d)&&(b=t),I.discardError(r,t,u),I.isPhxChild(t)&&e.ownsElement(t)&&this.trackAfter("phxChildAdded",t),p.push(t)},onNodeDiscarded:e=>{I.isPhxChild(e)&&t.destroyViewByEl(e),this.trackAfter("discarded",e)},onBeforeNodeDiscarded:e=>!(!e.getAttribute||null===e.getAttribute("data-phx-remove"))||(null===e.parentNode||!I.isPhxUpdate(e.parentNode,c,["append","prepend"])||!e.id)&&!this.skipCIDSibling(e),onElUpdated:e=>{I.isNowTriggerFormExternal(e,d)&&(b=e),g.push(e)},onBeforeElUpdated:(e,t)=>{if(I.cleanChildNodes(t,c),this.skipCIDSibling(t))return!1;if(I.isIgnored(e,c))return this.trackBefore("updated",e,t),I.mergeAttrs(e,t,{isIgnored:!0}),g.push(e),!1;if("number"===e.type&&e.validity&&e.validity.badInput)return!1;if(!I.syncPendingRef(e,t,h))return I.isUploadInput(e)&&(this.trackBefore("updated",e,t),g.push(e)),!1;if(I.isPhxChild(t)){let i=e.getAttribute(f);return I.mergeAttrs(e,t,{exclude:[m]}),""!==i&&e.setAttribute(f,i),e.setAttribute("data-phx-root-id",this.rootID),!1}return I.copyPrivates(t,e),I.discardError(r,t,u),I.syncPropsToAttrs(t),o&&e.isSameNode(o)&&I.isFormInput(e)&&!this.forceFocusedSelectUpdate(e,t)?(this.trackBefore("updated",e,t),I.mergeFocusedInput(e,t),I.syncAttrsToProps(e),g.push(e),!1):(I.isPhxUpdate(t,c,["append","prepend"])&&v.push(new class{constructor(e,t,i){let n=new Set,r=new Set([...t.children].map(e=>e.id)),o=[];Array.from(e.children).forEach(e=>{if(e.id&&(n.add(e.id),r.has(e.id))){let t=e.previousElementSibling&&e.previousElementSibling.id;o.push({elementId:e.id,previousElementId:t})}}),this.containerId=t.id,this.updateType=i,this.elementsToModify=o,this.elementIdsToAdd=[...r].filter(e=>!n.has(e))}perform(){let e=I.byId(this.containerId);this.elementsToModify.forEach(t=>{t.previousElementId?T(document.getElementById(t.previousElementId),e=>{T(document.getElementById(t.elementId),t=>{t.previousElementSibling&&t.previousElementSibling.id==e.id||e.insertAdjacentElement("afterend",t)})}):T(document.getElementById(t.elementId),t=>{null==t.previousElementSibling||e.insertAdjacentElement("afterbegin",t)})}),"prepend"==this.updateType&&this.elementIdsToAdd.reverse().forEach(t=>{T(document.getElementById(t),t=>e.insertAdjacentElement("afterbegin",t))})}}(e,t,t.getAttribute(c))),I.syncAttrsToProps(t),this.trackBefore("updated",e,t),!0)}})}),t.isDebugEnabled()&&function(){let e=new Set,t=document.querySelectorAll("*[id]");for(let i=0,n=t.length;i<n;i++)e.has(t[i].id)?console.error(`Multiple IDs detected: ${t[i].id}. Ensure unique element ids.`):e.add(t[i].id)}(),v.length>0&&t.time("post-morph append/prepend restoration",()=>{v.forEach(e=>e.perform())}),t.silenceEvents(()=>I.restoreFocus(o,s,a)),I.dispatchEvent(document,"phx:update"),p.forEach(e=>this.trackAfter("added",e)),g.forEach(e=>this.trackAfter("updated",e)),b&&(t.disconnect(),b.submit()),!0}forceFocusedSelectUpdate(e,t){let i=["select","select-one","select-multiple"].find(t=>t===e.type);return!0===e.multiple||i&&e.innerHTML!=t.innerHTML}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&null!==e.getAttribute("data-phx-skip")}targetCIDContainer(e){if(!this.isCIDPatch())return;let[t,...i]=I.findComponentNodeList(this.container,this.targetCID);return 0===i.length&&1===I.childNodeLength(e)?t:t&&t.parentNode}buildDiffHTML(e,t,i,n){let r=this.isCIDPatch(),o=r&&n.getAttribute(l)===this.targetCID.toString();if(!r||o)return t;{let e=null,i=document.createElement("template");e=I.cloneNode(n);let[r,...o]=I.findComponentNodeList(e,this.targetCID);return i.innerHTML=t,o.forEach(e=>e.remove()),Array.from(e.childNodes).forEach(e=>{e.id&&e.nodeType===Node.ELEMENT_NODE&&e.getAttribute(l)!==this.targetCID.toString()&&(e.setAttribute("data-phx-skip",""),e.innerHTML="")}),Array.from(i.content.childNodes).forEach(t=>e.insertBefore(t,r)),r.remove(),e.outerHTML}}},Y=class{static extract(e){let{[k]:t,[y]:i,[w]:n}=e;return delete e[k],delete e[y],delete e[w],{diff:e,title:n,reply:t||null,events:i||[]}}constructor(e,t){this.viewId=e,this.rendered={},this.mergeDiff(t)}parentViewId(){return this.viewId}toString(e){return this.recursiveToString(this.rendered,this.rendered.c,e)}recursiveToString(e,t=e.c,i){let n={buffer:"",components:t,onlyCids:i=i?new Set(i):null};return this.toOutputBuffer(e,n),n.buffer}componentCIDs(e){return Object.keys(e.c||{}).map(e=>parseInt(e))}isComponentOnlyDiff(e){return!!e.c&&1===Object.keys(e).length}getComponent(e,t){return e.c[t]}mergeDiff(e){let t=e.c,i={};if(delete e.c,this.rendered=this.mutableMerge(this.rendered,e),this.rendered.c=this.rendered.c||{},t){let r=this.rendered.c;for(let e in t)t[e]=this.cachedFindComponent(e,t[e],r,t,i);for(var n in t)r[n]=t[n];e.c=t}}cachedFindComponent(e,t,i,n,r){if(r[e])return r[e];{let o,s,a=t[b];if("number"==typeof a){let e;e=a>0?this.cachedFindComponent(a,n[a],i,n,r):i[-a],s=e[b],o=this.cloneMerge(e,t),o[b]=s}else o=void 0!==t[b]?t:this.cloneMerge(i[e]||{},t);return r[e]=o,o}}mutableMerge(e,t){return void 0!==t[b]?t:(this.doMutableMerge(e,t),e)}doMutableMerge(e,t){for(let i in t){let n=t[i],r=e[i];A(n)&&void 0===n[b]&&A(r)?this.doMutableMerge(r,n):e[i]=n}}cloneMerge(e,t){let i={...e,...t};for(let n in i){let r=t[n],o=e[n];A(r)&&void 0===r[b]&&A(o)&&(i[n]=this.cloneMerge(o,r))}return i}componentToString(e){return this.recursiveCIDToString(this.rendered.c,e)}pruneCIDs(e){e.forEach(e=>delete this.rendered.c[e])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[b]}toOutputBuffer(e,t){if(e[v])return this.comprehensionToBuffer(e,t);let{[b]:i}=e;t.buffer+=i[0];for(let n=1;n<i.length;n++)this.dynamicToBuffer(e[n-1],t),t.buffer+=i[n]}comprehensionToBuffer(e,t){let{[v]:i,[b]:n}=e;for(let e=0;e<i.length;e++){let r=i[e];t.buffer+=n[0];for(let e=1;e<n.length;e++)this.dynamicToBuffer(r[e-1],t),t.buffer+=n[e]}}dynamicToBuffer(e,t){"number"==typeof e?t.buffer+=this.recursiveCIDToString(t.components,e,t.onlyCids):A(e)?this.toOutputBuffer(e,t):t.buffer+=e}recursiveCIDToString(e,t,i){let n=e[t]||E("no component for CID "+t,e),r=document.createElement("template");r.innerHTML=this.recursiveToString(n,e,i);let o=r.content,s=i&&!i.has(t),[a,c]=Array.from(o.childNodes).reduce(([e,i],n,o)=>n.nodeType===Node.ELEMENT_NODE?n.getAttribute(l)?[e,!0]:(n.setAttribute(l,t),n.id||(n.id=`${this.parentViewId()}-${t}-${o}`),s&&(n.setAttribute("data-phx-skip",""),n.innerHTML=""),[!0,i]):""!==n.nodeValue.trim()?(E(`only HTML element tags are allowed at the root of components.\n\ngot: "${n.nodeValue.trim()}"\n\nwithin:\n`,r.innerHTML.trim()),n.replaceWith(this.createSpan(n.nodeValue,t)),[!0,i]):(n.remove(),[e,i]),[!1,!1]);return a||c?!a&&c?(E("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:(E("expected at least one HTML element tag inside a component, but the component is empty:\n",r.innerHTML.trim()),this.createSpan("",t).outerHTML)}createSpan(e,t){let i=document.createElement("span");return i.innerText=e,i.setAttribute(l,t),i}},Z=1,Q=class{static makeID(){return Z++}static elementID(e){return e.phxHookId}constructor(e,t,i){this.__view=e,this.__liveSocket=e.liveSocket,this.__callbacks=i,this.__listeners=new Set,this.__isDisconnected=!1,this.el=t,this.el.phxHookId=this.constructor.makeID();for(let e in this.__callbacks)this[e]=this.__callbacks[e]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,t={},i=function(){}){return this.__view.pushHookEvent(null,e,t,i)}pushEventTo(e,t,i={},n=function(){}){return this.__view.withinTargets(e,(e,r)=>e.pushHookEvent(r,t,i,n))}handleEvent(e,t){let i=(i,n)=>n?e:t(i.detail);return window.addEventListener("phx:hook:"+e,i),this.__listeners.add(i),i}removeHandleEvent(e){let t=e(null,!0);window.removeEventListener("phx:hook:"+t,e),this.__listeners.delete(e)}upload(e,t){return this.__view.dispatchUploads(e,t)}uploadTo(e,t,i){return this.__view.withinTargets(e,e=>e.dispatchUploads(t,i))}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}},ee=(e,t={})=>{let i=new FormData(e),n=[];i.forEach((e,t,i)=>{e instanceof File&&n.push(t)}),n.forEach(e=>i.delete(e));let r=new URLSearchParams;for(let[e,t]of i.entries())r.append(e,t);for(let e in t)r.append(e,t[e]);return r.toString()},te=class{constructor(e,t,i,n){this.liveSocket=t,this.flash=n,this.parent=i,this.root=i?i.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.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(){},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(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.liveSocket.main===this}connectParams(){let e=this.liveSocket.params(this.el),t=I.all(document,`[${this.binding("track-static")}]`).map(e=>e.src||e.href).filter(e=>"string"==typeof e);return t.length>0&&(e._track_static=t),e._mounts=this.joinCount,e}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(f)}getStatic(){let e=this.el.getAttribute(m);return""===e?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let t=()=>{e();for(let e in this.viewHooks)this.destroyHook(this.viewHooks[e])};I.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",t).receive("error",t).receive("timeout",t)}setContainerClasses(...e){this.el.classList.remove("phx-connected","phx-disconnected","phx-error"),this.el.classList.add(...e)}isLoading(){return this.el.classList.contains("phx-disconnected")}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let e in this.viewHooks)this.viewHooks[e].__disconnected();this.setContainerClasses("phx-disconnected")}}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses("phx-connected")}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,t){this.liveSocket.log(this,e,t)}withinTargets(e,t){if(e instanceof HTMLElement)return this.liveSocket.owner(e,i=>t(i,e));if(/^(0|[1-9]\d*)$/.test(e)){let i=I.findComponentNodeList(this.el,e);0===i.length?E("no component found matching phx-target of "+e):t(this,i[0])}else{let i=Array.from(document.querySelectorAll(e));0===i.length&&E(`nothing found matching the phx-target selector "${e}"`),i.forEach(e=>this.liveSocket.owner(e,i=>t(i,e)))}}applyDiff(e,t,i){this.log(e,()=>["",_(t)]);let{diff:n,reply:r,events:o,title:s}=Y.extract(t);return s&&I.putTitle(s),i({diff:n,reply:r,events:o}),r}onJoin(e){let{rendered:t,container:i}=e;if(i){let[e,t]=i;this.el=I.replaceRootContainer(this.el,e,t)}this.childJoins=0,this.joinPending=!0,this.flash=null,R.dropLocal(this.liveSocket.localStorage,window.location.pathname,"consecutive-reloads"),this.applyDiff("mount",t,({diff:t,events:i})=>{this.rendered=new Y(this.id,t);let n=this.renderContainer(null,"join");this.dropPendingRefs();let r=this.formsForRecovery(n);this.joinCount++,r.length>0?r.forEach((e,t)=>{this.pushFormRecovery(e,e=>{t===r.length-1&&this.onJoinComplete(e,n,i)})}):this.onJoinComplete(e,n,i)})}dropPendingRefs(){I.all(this.el,`[${c}]`,e=>e.removeAttribute(c))}onJoinComplete({live_patch:e},t,i){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,t,i);0===I.findPhxChildrenInFragment(t,this.id).filter(e=>{let t=e.id&&this.el.querySelector(`[id="${e.id}"]`),i=t&&t.getAttribute(m);return i&&e.setAttribute(m,i),this.joinChild(e)}).length?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,t,i)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,t,i)])}attachTrueDocEl(){this.el=I.byId(this.id),this.el.setAttribute("data-phx-root-id",this.root.id)}dispatchEvents(e){e.forEach(([e,t])=>{window.dispatchEvent(new CustomEvent("phx:hook:"+e,{detail:t}))})}applyJoinPatch(e,t,i){this.attachTrueDocEl();let n=new X(this,this.el,this.id,t,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1),this.joinNewChildren(),I.all(this.el,`[${this.binding("hook")}], [data-phx-hook]`,e=>{let t=this.addHook(e);t&&t.__mounted()}),this.joinPending=!1,this.dispatchEvents(i),this.applyPendingUpdates(),e){let{kind:t,to:i}=e;this.liveSocket.historyPatch(i,t)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,t){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,t]);let i=this.getHook(e),n=i&&I.isIgnored(e,this.binding("update"));if(i&&!e.isEqualNode(t)&&(!n||(r=e.dataset,o=t.dataset,JSON.stringify(r)!==JSON.stringify(o))))return i.__beforeUpdate(),i;var r,o}performPatch(e,t){let i=[],n=!1,r=new Set;return e.after("added",e=>{this.liveSocket.triggerDOM("onNodeAdded",[e]);let t=this.addHook(e);t&&t.__mounted()}),e.after("phxChildAdded",e=>n=!0),e.before("updated",(e,t)=>{this.triggerBeforeUpdateHook(e,t)&&r.add(e.id)}),e.after("updated",e=>{r.has(e.id)&&this.getHook(e).__updated()}),e.after("discarded",e=>{let t=this.componentID(e);"number"==typeof t&&-1===i.indexOf(t)&&i.push(t);let n=this.getHook(e);n&&this.destroyHook(n)}),e.perform(),t&&this.maybePushComponentsDestroyed(i),n}joinNewChildren(){I.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute("data-phx-parent-id")][e.id]}destroyDescendent(e){for(let t in this.root.children)for(let i in this.root.children[t])if(i===e)return this.root.children[t][i].destroy()}joinChild(e){if(!this.getChildById(e.id)){let t=new te(e,this.liveSocket,this);return this.root.children[this.id][t.id]=t,t.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,0===this.childJoins&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(),this.pendingJoinOps.forEach(([e,t])=>{e.isDestroyed()||t()}),this.pendingJoinOps=[]}update(e,t){if(this.isJoinPending()||this.liveSocket.hasPendingLink())return this.pendingDiffs.push({diff:e,events:t});this.rendered.mergeDiff(e);let i=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{I.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(t=>{this.componentPatch(this.rendered.getComponent(e,t),t)&&(i=!0)})}):P(e)||this.liveSocket.time("full patch complete",()=>{let t=this.renderContainer(e,"update"),n=new X(this,this.el,this.id,t,null);i=this.performPatch(n,!0)}),this.dispatchEvents(t),i&&this.joinNewChildren()}renderContainer(e,t){return this.liveSocket.time(`toString diff (${t})`,()=>{let t=this.el.tagName,i=e?this.rendered.componentCIDs(e).concat(this.pruningCIDs):null;return`<${t}>${this.rendered.toString(i)}</${t}>`})}componentPatch(e,t){if(P(e))return!1;let i=this.rendered.componentToString(t),n=new X(this,this.el,this.id,i,t);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[Q.elementID(e)]}addHook(e){if(Q.elementID(e)||!e.getAttribute)return;let t=e.getAttribute("data-phx-hook")||e.getAttribute(this.binding("hook"));if(t&&!this.ownsElement(e))return;let i=this.liveSocket.getHookCallbacks(t);if(i){e.id||E(`no DOM ID for hook "${t}". Hooks require a unique ID on each element.`,e);let n=new Q(this,e,i);return this.viewHooks[Q.elementID(n.el)]=n,n}null!==t&&E(`unknown hook found for "${t}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[Q.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:t})=>this.update(e,t)),this.pendingDiffs=[]}onChannel(e,t){this.liveSocket.onChannel(this.channel,e,e=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>t(e)]):t(e)})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.applyDiff("update",e,({diff:e,events:t})=>this.update(e,t))}),this.onChannel("redirect",({to:e,flash:t})=>this.onRedirect({to:e,flash:t})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){for(let e in this.root.children[this.id])this.getChildById(e).destroy()}onLiveRedirect(e){let{to:t,kind:i,flash:n}=e,r=this.expandURL(t);this.liveSocket.historyRedirect(r,i,n)}onLivePatch(e){let{to:t,kind:i}=e;this.href=this.expandURL(t),this.liveSocket.historyPatch(t,i)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:t}){this.liveSocket.redirect(e,t)}isDestroyed(){return this.destroyed}join(e){this.parent||(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=()=>e&&e(this.joinCount),this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",e=>!this.isDestroyed()&&this.onJoin(e)).receive("error",e=>!this.isDestroyed()&&this.onJoinError(e)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){return"unauthorized"===e.reason||"stale"===e.reason?(this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.onRedirect({to:this.href})):((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect?this.onRedirect(e.redirect):e.live_redirect?this.onLiveRedirect(e.live_redirect):(this.log("error",()=>["unable to join",e]),this.liveSocket.reloadWithJitter(this)))}onClose(e){if(!this.isDestroyed()){if(this.isJoinPending()&&"hidden"!==document.visibilityState||this.liveSocket.hasPendingLink()&&"leave"!==e)return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(200)}}onError(e){this.onClose(e),this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||this.displayError()}displayError(){this.isMain()&&I.dispatchEvent(window,"phx:page-loading-start",{to:this.href,kind:"error"}),this.showLoader(),this.setContainerClasses("phx-disconnected","phx-error")}pushWithReply(e,t,i,n=function(){}){if(!this.isConnected())return;let[r,[o]]=e?e():[null,[]],s=function(){};return o&&null!==o.getAttribute(this.binding("page-loading"))&&(s=this.liveSocket.withPageLoading({kind:"element",target:o})),"number"!=typeof i.cid&&delete i.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(t,i,3e4).receive("ok",e=>{let t=null;null!==r&&this.undoRefs(r),e.diff&&(t=this.applyDiff("update",e.diff,({diff:e,events:t})=>{this.update(e,t)})),e.redirect&&this.onRedirect(e.redirect),e.live_patch&&this.onLivePatch(e.live_patch),e.live_redirect&&this.onLiveRedirect(e.live_redirect),s(),n(e,t)}))}undoRefs(e){I.all(this.el,`[${c}="${e}"]`,e=>{let t=e.getAttribute("data-phx-disabled");e.removeAttribute(c),null!==e.getAttribute("data-phx-readonly")&&(e.readOnly=!1,e.removeAttribute("data-phx-readonly")),null!==t&&(e.disabled="true"===t,e.removeAttribute("data-phx-disabled")),a.forEach(t=>I.removeClass(e,t));let i=e.getAttribute("data-phx-disable-with-restore");null!==i&&(e.innerText=i,e.removeAttribute("data-phx-disable-with-restore"));let n=I.private(e,c);if(n){let t=this.triggerBeforeUpdateHook(e,n);X.patchEl(e,n,this.liveSocket.getActiveElement()),t&&t.__updated(),I.deletePrivate(e,c)}})}putRef(e,t){let i=this.ref++,n=this.binding("disable-with");return e.forEach(e=>{e.classList.add(`phx-${t}-loading`),e.setAttribute(c,i);let r=e.getAttribute(n);null!==r&&(e.getAttribute("data-phx-disable-with-restore")||e.setAttribute("data-phx-disable-with-restore",e.innerText),e.innerText=r)}),[i,e]}componentID(e){let t=e.getAttribute&&e.getAttribute(l);return t?parseInt(t):null}targetComponentID(e,t){return e.getAttribute(this.binding("target"))?this.closestComponentID(t):null}closestComponentID(e){return e?T(e.closest(`[${l}]`),e=>this.ownsElement(e)&&this.componentID(e)):null}pushHookEvent(e,t,i,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",t,i]),!1;let[r,o]=this.putRef([],"hook");return this.pushWithReply(()=>[r,o],"event",{type:"hook",event:t,value:i,cid:this.closestComponentID(e)},(e,t)=>n(t,r)),r}extractMeta(e,t){let i=this.binding("value-");for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n].name;r.startsWith(i)&&(t[r.replace(i,"")]=e.getAttribute(r))}return void 0!==e.value&&(t.value=e.value,"INPUT"===e.tagName&&d.indexOf(e.type)>=0&&!e.checked&&delete t.value),t}pushEvent(e,t,i,n,r){this.pushWithReply(()=>this.putRef([t],e),"event",{type:e,event:n,value:this.extractMeta(t,r),cid:this.targetComponentID(t,i)})}pushKey(e,t,i,n,r){this.pushWithReply(()=>this.putRef([e],i),"event",{type:i,event:n,value:this.extractMeta(e,r),cid:this.targetComponentID(e,t)})}pushFileProgress(e,t,i,n=function(){}){this.liveSocket.withinOwners(e.form,(r,o)=>{r.pushWithReply(null,"progress",{event:e.getAttribute(r.binding("progress")),ref:e.getAttribute(u),entry_ref:t,progress:i,cid:r.targetComponentID(e.form,o)},n)})}pushInput(e,t,i,n,r){let o,s=this.targetComponentID(e.form,t),a=()=>this.putRef([e,e.form],"change"),l=ee(e.form,{_target:n.name});e.files&&e.files.length>0&&M.trackFiles(e,Array.from(e.files)),o=M.serializeUploads(e);let c={type:"form",event:i,value:l,uploads:o,cid:s};this.pushWithReply(a,"event",c,i=>{if(I.showError(e,this.liveSocket.binding("feedback-for")),I.isUploadInput(e)&&null!==e.getAttribute("data-phx-auto-upload")){if(M.filesAwaitingPreflight(e).length>0){let[n,o]=a();this.uploadFiles(e.form,t,n,s,t=>{r&&r(i),this.triggerAwaitingSubmit(e.form)})}}else r&&r(i)})}triggerAwaitingSubmit(e){let t=this.getScheduledSubmit(e);if(t){let[i,n,r]=t;this.cancelSubmit(e),r()}}getScheduledSubmit(e){return this.formSubmits.find(([t,i])=>t.isSameNode(e))}scheduleSubmit(e,t,i){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,t,i])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([t,i,n])=>!t.isSameNode(e)||(this.undoRefs(i),!1))}pushFormSubmit(e,t,i,n){let r=e=>!(C(e,this.binding("update")+"=ignore",e.form)||C(e,"data-phx-update=ignore",e.form)),o=e=>e.hasAttribute(this.binding("disable-with")),s=e=>"BUTTON"==e.tagName,a=e=>["INPUT","TEXTAREA","SELECT"].includes(e.tagName),l=()=>{let t=Array.from(e.elements),i=t.filter(o),n=t.filter(s).filter(r),l=t.filter(a).filter(r);return n.forEach(e=>{e.setAttribute("data-phx-disabled",e.disabled),e.disabled=!0}),l.forEach(e=>{e.setAttribute("data-phx-readonly",e.readOnly),e.readOnly=!0,e.files&&(e.setAttribute("data-phx-disabled",e.disabled),e.disabled=!0)}),e.setAttribute(this.binding("page-loading"),""),this.putRef([e].concat(i).concat(n).concat(l),"submit")},c=this.targetComponentID(e,t);if(M.hasUploadsInProgress(e)){let[r,o]=l();return this.scheduleSubmit(e,r,()=>this.pushFormSubmit(e,t,i,n))}if(M.inputsAwaitingPreflight(e).length>0){let[r,o]=l(),s=()=>[r,o];this.uploadFiles(e,t,r,c,t=>{let r=ee(e,{});this.pushWithReply(s,"event",{type:"form",event:i,value:r,cid:c},n)})}else{let t=ee(e);this.pushWithReply(l,"event",{type:"form",event:i,value:t,cid:c},n)}}uploadFiles(e,t,i,n,r){let o=this.joinCount,s=M.activeFileInputs(e),a=s.length;s.forEach(e=>{let n=new M(e,this,()=>{a--,0===a&&r()});this.uploaders[e]=n;let s=n.entries().map(e=>e.toPreflightPayload()),l={ref:e.getAttribute(u),entries:s,cid:this.targetComponentID(e.form,t)};this.log("upload",()=>["sending preflight request",l]),this.pushWithReply(null,"allow_upload",l,e=>{if(this.log("upload",()=>["got preflight response",e]),e.error){this.undoRefs(i);let[t,n]=e.error;this.log("upload",()=>["error for entry "+t,n])}else{let t=e=>{this.channel.onError(()=>{this.joinCount===o&&e()})};n.initAdapterUpload(e,t,this.liveSocket)}})})}dispatchUploads(e,t){let i=I.findUploadInputs(this.el).filter(t=>t.name===e);0===i.length?E(`no live file inputs found matching the name "${e}"`):i.length>1?E(`duplicate live file inputs found matching the name "${e}"`):I.dispatchEvent(i[0],"track-uploads",{files:t})}pushFormRecovery(e,t){this.liveSocket.withinOwners(e,(i,n)=>{let r=e.elements[0],o=e.getAttribute(this.binding("auto-recover"))||e.getAttribute(this.binding("change"));i.pushInput(r,n,o,r,t)})}pushLinkPatch(e,t,i){let n=this.liveSocket.setPendingLink(e),r=t?()=>this.putRef([t],"click"):null;this.pushWithReply(r,"live_patch",{url:e},t=>{t.link_redirect?this.liveSocket.replaceMain(e,null,i,n):(this.liveSocket.commitPendingLink(n)&&(this.href=e),this.applyPendingUpdates(),i&&i(n))}).receive("timeout",()=>this.liveSocket.redirect(window.location.href))}formsForRecovery(e){if(0===this.joinCount)return[];let t=this.binding("change"),i=document.createElement("template");return i.innerHTML=e,I.all(this.el,`form[${t}]`).filter(e=>this.ownsElement(e)).filter(e=>e.elements.length>0).filter(e=>"ignore"!==e.getAttribute(this.binding("auto-recover"))).filter(e=>i.content.querySelector(`form[${t}="${e.getAttribute(t)}"]`))}maybePushComponentsDestroyed(e){let t=e.filter(e=>0===I.findComponentNodeList(this.el,e).length);t.length>0&&(this.pruningCIDs.push(...t),this.pushWithReply(null,"cids_will_destroy",{cids:t},()=>{this.pruningCIDs=this.pruningCIDs.filter(e=>-1!==t.indexOf(e));let e=t.filter(e=>0===I.findComponentNodeList(this.el,e).length);e.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:e},e=>{this.rendered.pruneCIDs(e.cids)})}))}ownsElement(e){return e.getAttribute("data-phx-parent-id")===this.id||T(e.closest(p),e=>e.id)===this.id}submitForm(e,t,i){I.putPrivate(e,"phx-has-submitted",!0),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,t,i,()=>{this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}};i(5);let ie=document.querySelector("html").getAttribute("phx-socket")||"/live",ne=document.querySelector("meta[name='csrf-token']").getAttribute("content"),re={};const oe={};re.JsonEditor={mounted(){const e=this.el.getAttribute("data-input-id"),t=this;this.editor=new JSONEditor(this.el,{onChangeText:t=>{const i=document.getElementById(e);try{JSON.parse(t),i.value=t,i.dispatchEvent(new Event("change",{bubbles:!0}))}catch(e){}},onChange:()=>{try{const i=document.getElementById(e);json=t.editor.get(),i.value=JSON.stringify(json),i.dispatchEvent(new Event("change",{bubbles:!0}))}catch(e){}},onModeChange:e=>{t.mode=e},modes:["text","tree"]},JSON.parse(document.getElementById(e).value)),oe[this.el.id]=this.editor}},re.JsonEditorSource={updated(){try{let e=oe[this.el.getAttribute("data-editor-id")];"tree"===e.getMode()?e.update(JSON.parse(this.el.value)):console.log(e.get())!==console.log(JSON.parse(this.el.value))&&e.setText(this.el.value)}catch(e){}}},re.JsonView={updated(){const e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)},mounted(){const e=JSON.parse(this.el.getAttribute("data-json"));this.editor=new JSONEditor(this.el,{mode:"preview"},e)}},re.Actor={mounted(){this.handleEvent("set_actor",e=>{document.cookie="actor_resource="+e.resource+";path=/",document.cookie="actor_primary_key="+e.primary_key+";path=/",document.cookie="actor_action="+e.action+";path=/",document.cookie="actor_api="+e.api+";path=/"}),this.handleEvent("clear_actor",()=>{document.cookie="actor_resource=;path=/",document.cookie="actor_primary_key=;path=/",document.cookie="actor_action;path=/",document.cookie="actor_api=;path=/",document.cookie="actor_authorizing=false;path=/",document.cookie="actor_paused=true;path=/"}),this.handleEvent("toggle_authorizing",e=>{document.cookie="actor_authorizing="+e.authorizing+";path=/"}),this.handleEvent("toggle_actor_paused",e=>{document.cookie="actor_paused="+e.actor_paused+";path=/"})}},re.Tenant={mounted(){this.handleEvent("set_tenant",e=>{document.cookie="tenant="+e.tenant+";path=/"}),this.handleEvent("clear_tenant",()=>{document.cookie="tenant=;path=/"})}},re.FormChange={mounted(){this.handleEvent("form_change",()=>{this.el.dispatchEvent(new Event("change",{bubbles:!0}))})}},re.MaintainAttrs={attrs(){return this.el.getAttribute("data-attrs").split(", ")},beforeUpdate(){this.prevAttrs=this.attrs().map(e=>[e,this.el.getAttribute(e)])},updated(){this.prevAttrs.forEach(([e,t])=>this.el.setAttribute(e,t))}};let se=new class{constructor(e,t,i={}){if(this.unloaded=!1,!t||"Object"===t.constructor.name)throw new Error('\n a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example:\n\n import {Socket} from "phoenix"\n import LiveSocket from "phoenix_live_view"\n let liveSocket = new LiveSocket("/live", Socket, {...})\n ');this.socket=new t(e,i),this.bindingPrefix=i.bindingPrefix||"phx-",this.opts=i,this.params=S(i.params||{}),this.viewLogger=i.viewLogger,this.metadataCallbacks=i.metadata||{},this.defaults=Object.assign(_(g),i.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=_(window.location),this.hooks=i.hooks||{},this.uploaders=i.uploaders||{},this.loaderTimeout=i.loaderTimeout||1,this.localStorage=i.localStorage||window.localStorage,this.sessionStorage=i.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:S(),onBeforeElUpdated:S()},i.dom||{}),window.addEventListener("pagehide",e=>{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(e){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",e)}disableLatencySim(){this.sessionStorage.removeItem("phx:live-socket:latency-sim")}getLatencySim(){let e=this.sessionStorage.getItem("phx:live-socket:latency-sim");return e?parseInt(e):null}getSocket(){return this.socket}connect(){let e=()=>{this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())};["complete","loaded","interactive"].indexOf(document.readyState)>=0?e():document.addEventListener("DOMContentLoaded",()=>e())}disconnect(e){this.socket.disconnect(e)}triggerDOM(e,t){this.domCallbacks[e](...t)}time(e,t){if(!this.isProfileEnabled()||!console.time)return t();console.time(e);let i=t();return console.timeEnd(e),i}log(e,t,i){if(this.viewLogger){let[n,r]=i();this.viewLogger(e,t,n,r)}else if(this.isDebugEnabled()){let[n,r]=i();((e,t,i,n)=>{e.liveSocket.isDebugEnabled()&&console.log(`${e.id} ${t}: ${i} - `,n)})(e,t,n,r)}}onChannel(e,t,i){e.on(t,e=>{let t=this.getLatencySim();t?(console.log(`simulating ${t}ms of latency from server to client`),setTimeout(()=>i(e),t)):i(e)})}wrapPush(e,t,i){let n=this.getLatencySim(),r=e.joinCount;if(!n)return t.timeout?i().receive("timeout",()=>{e.joinCount!==r||e.isDestroyed()||this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):i();console.log(`simulating ${n}ms of latency from client to server`);let o={receives:[],receive(e,t){this.receives.push([e,t])}};return setTimeout(()=>{e.isDestroyed()||o.receives.reduce((e,[t,i])=>e.receive(t,i),i())},n),o}reloadWithJitter(e,t){e.destroy(),this.disconnect();let[i,n]=s,r=Math.floor(Math.random()*(n-i+1))+i,o=R.updateLocal(this.localStorage,window.location.pathname,"consecutive-reloads",0,e=>e+1);t?t():this.log(e,"join",()=>[`encountered ${o} consecutive reloads`]),o>10&&(this.log(e,"join",()=>["exceeded 10 consecutive reloads. Entering failsafe mode"]),r=3e4),setTimeout(()=>{this.hasPendingLink()?window.location=this.pendingLink:window.location.reload()},r)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?$[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,t){return this.socket.channel(e,t)}joinRootViews(){let e=!1;return I.all(document,p+":not([data-phx-parent-id])",t=>{if(!this.getRootById(t.id)){let e=this.newRootView(t);e.setHref(this.getHref()),e.join(),t.getAttribute("data-phx-main")&&(this.main=e)}e=!0}),e}redirect(e,t){this.disconnect(),R.redirect(e,t)}replaceMain(e,t,i=null,n=this.setPendingLink(e)){let r=this.main.el,o=I.cloneNode(r,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,t),this.main.setRedirect(e),this.main.join(e=>{1===e&&this.commitPendingLink(n)&&(r.replaceWith(o),i&&i())})}isPhxView(e){return e.getAttribute&&null!==e.getAttribute(f)}newRootView(e,t){let i=new te(e,this,null,t);return this.roots[i.id]=i,i}owner(e,t){let i=T(e.closest(p),e=>this.getViewByEl(e));i&&t(i)}withinOwners(e,t){this.owner(e,i=>{let n=e.getAttribute(this.binding("target"));null===n?t(i,e):i.withinTargets(n,t)})}getViewByEl(e){let t=e.getAttribute("data-phx-root-id");return T(this.getRootById(t),t=>t.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e]}destroyViewByEl(e){let t=this.getRootById(e.getAttribute("data-phx-root-id"));t&&t.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let t=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",t),e.addEventListener("touchend",t)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents(){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,document.body.addEventListener("click",(function(){})),window.addEventListener("pageshow",e=>{e.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"},(e,t,i,n,r,o,s)=>{let a=n.getAttribute(this.binding("key")),l=e.key&&e.key.toLowerCase();a&&a.toLowerCase()!==l||i.pushKey(n,r,t,o,{key:e.key,...this.eventMeta(t,e,n)})}),this.bind({blur:"focusout",focus:"focusin"},(e,t,i,n,r,o,s)=>{s||i.pushEvent(t,n,r,o,this.eventMeta(t,e,n))}),this.bind({blur:"blur",focus:"focus"},(e,t,i,n,r,o,s)=>{s&&"window"!==!s&&i.pushEvent(t,n,r,o,this.eventMeta(t,e,n))}),window.addEventListener("dragover",e=>e.preventDefault()),window.addEventListener("drop",e=>{e.preventDefault();let t=T(C(e.target,this.binding("drop-target")),e=>e.getAttribute(this.binding("drop-target"))),i=t&&document.getElementById(t),n=Array.from(e.dataTransfer.files||[]);i&&!i.disabled&&0!==n.length&&i.files instanceof FileList&&(M.trackFiles(i,n),i.dispatchEvent(new Event("input",{bubbles:!0})))}),this.on("track-uploads",e=>{let t=e.target;if(!I.isUploadInput(t))return;let i=Array.from(e.detail.files||[]).filter(e=>e instanceof File||e instanceof Blob);M.trackFiles(t,i),t.dispatchEvent(new Event("input",{bubbles:!0}))}))}eventMeta(e,t,i){let n=this.metadataCallbacks[e];return n?n(t,i):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef===e&&(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,t){for(let i in e){let n=e[i];this.on(n,e=>{let n=this.binding(i),r=this.binding("window-"+i),o=e.target.getAttribute&&e.target.getAttribute(n);o?this.debounce(e.target,e,()=>{this.withinOwners(e.target,(n,r)=>{t(e,i,n,e.target,r,o,null)})}):I.all(document,`[${r}]`,n=>{let o=n.getAttribute(r);this.debounce(n,e,()=>{this.withinOwners(n,(r,s)=>{t(e,i,r,n,s,o,"window")})})})})}}bindClicks(){this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(e,t,i){let n=this.binding(t);window.addEventListener(e,e=>{if(!this.isConnected())return;let t=null;t=i?e.target.matches(`[${n}]`)?e.target:e.target.querySelector(`[${n}]`):C(e.target,n);let r=t&&t.getAttribute(n);r&&("#"===t.getAttribute("href")&&e.preventDefault(),this.debounce(t,e,()=>{this.withinOwners(t,(i,n)=>{i.pushEvent("click",t,n,r,this.eventMeta("click",e,t))})}))},i)}bindNav(){if(!R.canPushState())return;history.scrollRestoration&&(history.scrollRestoration="manual");let e=null;window.addEventListener("scroll",t=>{clearTimeout(e),e=setTimeout(()=>{R.updateCurrentState(e=>Object.assign(e,{scroll:window.scrollY}))},100)}),window.addEventListener("popstate",e=>{if(!this.registerNewLocation(window.location))return;let{type:t,id:i,root:n,scroll:r}=e.state||{},o=window.location.href;this.main.isConnected()&&"patch"===t&&i===this.main.id?this.main.pushLinkPatch(o,null):this.replaceMain(o,null,()=>{n&&this.replaceRootHistory(),"number"==typeof r&&setTimeout(()=>{window.scrollTo(0,r)},0)})},!1),window.addEventListener("click",e=>{let t=C(e.target,"data-phx-link"),i=t&&t.getAttribute("data-phx-link"),n=e.metaKey||e.ctrlKey||1===e.button;if(!i||!this.isConnected()||!this.main||n)return;let r=t.href,o=t.getAttribute("data-phx-link-state");if(e.preventDefault(),this.pendingLink!==r)if("patch"===i)this.pushHistoryPatch(r,o,t);else{if("redirect"!==i)throw new Error('expected data-phx-link to be "patch" or "redirect", got: '+i);this.historyRedirect(r,o)}},!1)}withPageLoading(e,t){I.dispatchEvent(window,"phx:page-loading-start",e);let i=()=>I.dispatchEvent(window,"phx:page-loading-stop",e);return t?t(i):i}pushHistoryPatch(e,t,i){this.withPageLoading({to:e,kind:"patch"},n=>{this.main.pushLinkPatch(e,i,i=>{this.historyPatch(e,t,i),n()})})}historyPatch(e,t,i=this.setPendingLink(e)){this.commitPendingLink(i)&&(R.pushState(t,{type:"patch",id:this.main.id},e),this.registerNewLocation(window.location))}historyRedirect(e,t,i){let n=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},r=>{this.replaceMain(e,i,()=>{R.pushState(t,{type:"redirect",id:this.main.id,scroll:n},e),this.registerNewLocation(window.location),r()})})}replaceRootHistory(){R.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:t,search:i}=this.currentLocation;return t+i!==e.pathname+e.search&&(this.currentLocation=_(e),!0)}bindForms(){let e=0;this.on("submit",e=>{let t=e.target.getAttribute(this.binding("submit"));t&&(e.preventDefault(),e.target.disabled=!0,this.withinOwners(e.target,(i,n)=>i.submitForm(e.target,n,t)))},!1);for(let t of["change","input"])this.on(t,i=>{let n=i.target,r=n.form&&n.form.getAttribute(this.binding("change"));if(!r)return;if("number"===n.type&&n.validity&&n.validity.badInput)return;let o=e;e++;let{at:s,type:a}=I.private(n,"prev-iteration")||{};s===o-1&&t!==a||(I.putPrivate(n,"prev-iteration",{at:o,type:t}),this.debounce(n,i,()=>{this.withinOwners(n.form,(e,t)=>{I.putPrivate(n,"phx-has-focused",!0),I.isTextualInput(n)||this.setActiveElement(n),e.pushInput(n,t,r,i.target)})}))},!1)}debounce(e,t,i){let n=this.binding("debounce"),r=this.binding("throttle"),o=this.defaults.debounce.toString(),s=this.defaults.throttle.toString();I.debounce(e,t,n,o,r,s,i)}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,t){window.addEventListener(e,e=>{this.silenced||t(e)})}}(ie,n.Socket,{hooks:re,dom:{onBeforeElUpdated(e,t){e.__x&&window.Alpine.clone(e.__x,t)}},params:{_csrf_token:ne}});window.addEventListener("phx:page-loading-start",e=>o.a.start()),window.addEventListener("phx:page-loading-stop",e=>o.a.done()),se.connect(),window.liveSocket=se}]);