Current section

Files

Jump to
snowhite priv static js app.js
Raw

priv/static/js/app.js

(() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// ../deps/phoenix/priv/static/phoenix.js
var require_phoenix = __commonJS({
"../deps/phoenix/priv/static/phoenix.js"(exports, module) {
!function(e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.Phoenix = t() : e.Phoenix = t();
}(exports, function() {
return function(e) {
var t = {};
function n(i) {
if (t[i]) return t[i].exports;
var o = t[i] = { i, l: false, exports: {} };
return e[i].call(o.exports, o, o.exports, n), o.l = true, o.exports;
}
return n.m = e, n.c = t, n.d = function(e2, t2, i) {
n.o(e2, t2) || Object.defineProperty(e2, t2, { enumerable: true, get: i });
}, n.r = function(e2) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
}, n.t = function(e2, t2) {
if (1 & t2 && (e2 = n(e2)), 8 & t2) return e2;
if (4 & t2 && "object" == typeof e2 && e2 && e2.__esModule) return e2;
var i = /* @__PURE__ */ Object.create(null);
if (n.r(i), Object.defineProperty(i, "default", { enumerable: true, value: e2 }), 2 & t2 && "string" != typeof e2) for (var o in e2) n.d(i, o, function(t3) {
return e2[t3];
}.bind(null, o));
return i;
}, n.n = function(e2) {
var t2 = e2 && e2.__esModule ? function() {
return e2.default;
} : function() {
return e2;
};
return n.d(t2, "a", t2), t2;
}, n.o = function(e2, t2) {
return Object.prototype.hasOwnProperty.call(e2, t2);
}, n.p = "", n(n.s = 0);
}([function(e, t, n) {
(function(t2) {
e.exports = t2.Phoenix = n(2);
}).call(this, n(1));
}, function(e, t) {
var n;
n = /* @__PURE__ */ function() {
return this;
}();
try {
n = n || new Function("return this")();
} catch (e2) {
"object" == typeof window && (n = window);
}
e.exports = n;
}, function(e, t, n) {
"use strict";
function i(e2) {
return function(e3) {
if (Array.isArray(e3)) return a(e3);
}(e2) || function(e3) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(e3)) return Array.from(e3);
}(e2) || s(e2) || 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 o(e2) {
return (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e3) {
return typeof e3;
} : function(e3) {
return e3 && "function" == typeof Symbol && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
})(e2);
}
function r(e2, t2) {
return function(e3) {
if (Array.isArray(e3)) return e3;
}(e2) || function(e3, t3) {
if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(e3))) return;
var n2 = [], i2 = true, o2 = false, r2 = void 0;
try {
for (var s2, a2 = e3[Symbol.iterator](); !(i2 = (s2 = a2.next()).done) && (n2.push(s2.value), !t3 || n2.length !== t3); i2 = true) ;
} catch (e4) {
o2 = true, r2 = e4;
} finally {
try {
i2 || null == a2.return || a2.return();
} finally {
if (o2) throw r2;
}
}
return n2;
}(e2, t2) || s(e2, t2) || 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(e2, t2) {
if (e2) {
if ("string" == typeof e2) return a(e2, t2);
var n2 = Object.prototype.toString.call(e2).slice(8, -1);
return "Object" === n2 && e2.constructor && (n2 = e2.constructor.name), "Map" === n2 || "Set" === n2 ? Array.from(n2) : "Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? a(e2, t2) : void 0;
}
}
function a(e2, t2) {
(null == t2 || t2 > e2.length) && (t2 = e2.length);
for (var n2 = 0, i2 = new Array(t2); n2 < t2; n2++) i2[n2] = e2[n2];
return i2;
}
function c(e2, t2) {
if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
}
function u(e2, t2) {
for (var n2 = 0; n2 < t2.length; n2++) {
var i2 = t2[n2];
i2.enumerable = i2.enumerable || false, i2.configurable = true, "value" in i2 && (i2.writable = true), Object.defineProperty(e2, i2.key, i2);
}
}
function h(e2, t2, n2) {
return t2 && u(e2.prototype, t2), n2 && u(e2, n2), e2;
}
n.r(t), n.d(t, "Channel", function() {
return O;
}), n.d(t, "Serializer", function() {
return _;
}), n.d(t, "Socket", function() {
return H;
}), n.d(t, "LongPoll", function() {
return U;
}), n.d(t, "Ajax", function() {
return D;
}), n.d(t, "Presence", function() {
return M;
});
var l = "undefined" != typeof self ? self : null, f = "undefined" != typeof window ? window : null, d = l || f || void 0, p = 0, v = 1, y = 2, m = 3, g = "closed", k = "errored", b = "joined", j = "joining", T = "leaving", C = "phx_close", R = "phx_error", E = "phx_join", w = "phx_reply", S = "phx_leave", A = "longpoll", L = "websocket", x = function(e2) {
if ("function" == typeof e2) return e2;
return function() {
return e2;
};
}, P = function() {
function e2(t2, n2, i2, o2) {
c(this, e2), this.channel = t2, this.event = n2, this.payload = i2 || function() {
return {};
}, this.receivedResp = null, this.timeout = o2, this.timeoutTimer = null, this.recHooks = [], this.sent = false;
}
return h(e2, [{ key: "resend", value: function(e3) {
this.timeout = e3, this.reset(), this.send();
} }, { key: "send", value: function() {
this.hasReceived("timeout") || (this.startTimeout(), this.sent = true, 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(e3, t2) {
return this.hasReceived(e3) && t2(this.receivedResp.response), this.recHooks.push({ status: e3, callback: t2 }), this;
} }, { key: "reset", value: function() {
this.cancelRefEvent(), this.ref = null, this.refEvent = null, this.receivedResp = null, this.sent = false;
} }, { key: "matchReceive", value: function(e3) {
var t2 = e3.status, n2 = e3.response;
e3.ref;
this.recHooks.filter(function(e4) {
return e4.status === t2;
}).forEach(function(e4) {
return e4.callback(n2);
});
} }, { 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 e3 = this;
this.timeoutTimer && this.cancelTimeout(), this.ref = this.channel.socket.makeRef(), this.refEvent = this.channel.replyEventName(this.ref), this.channel.on(this.refEvent, function(t2) {
e3.cancelRefEvent(), e3.cancelTimeout(), e3.receivedResp = t2, e3.matchReceive(t2);
}), this.timeoutTimer = setTimeout(function() {
e3.trigger("timeout", {});
}, this.timeout);
} }, { key: "hasReceived", value: function(e3) {
return this.receivedResp && this.receivedResp.status === e3;
} }, { key: "trigger", value: function(e3, t2) {
this.channel.trigger(this.refEvent, { status: e3, response: t2 });
} }]), e2;
}(), O = function() {
function e2(t2, n2, i2) {
var o2 = this;
c(this, e2), this.state = g, this.topic = t2, this.params = x(n2 || {}), this.socket = i2, this.bindings = [], this.bindingRef = 0, this.timeout = this.socket.timeout, this.joinedOnce = false, this.joinPush = new P(this, E, this.params, this.timeout), this.pushBuffer = [], this.stateChangeRefs = [], this.rejoinTimer = new N(function() {
o2.socket.isConnected() && o2.rejoin();
}, this.socket.rejoinAfterMs), this.stateChangeRefs.push(this.socket.onError(function() {
return o2.rejoinTimer.reset();
})), this.stateChangeRefs.push(this.socket.onOpen(function() {
o2.rejoinTimer.reset(), o2.isErrored() && o2.rejoin();
})), this.joinPush.receive("ok", function() {
o2.state = b, o2.rejoinTimer.reset(), o2.pushBuffer.forEach(function(e3) {
return e3.send();
}), o2.pushBuffer = [];
}), this.joinPush.receive("error", function() {
o2.state = k, o2.socket.isConnected() && o2.rejoinTimer.scheduleTimeout();
}), this.onClose(function() {
o2.rejoinTimer.reset(), o2.socket.hasLogger() && o2.socket.log("channel", "close ".concat(o2.topic, " ").concat(o2.joinRef())), o2.state = g, o2.socket.remove(o2);
}), this.onError(function(e3) {
o2.socket.hasLogger() && o2.socket.log("channel", "error ".concat(o2.topic), e3), o2.isJoining() && o2.joinPush.reset(), o2.state = k, o2.socket.isConnected() && o2.rejoinTimer.scheduleTimeout();
}), this.joinPush.receive("timeout", function() {
o2.socket.hasLogger() && o2.socket.log("channel", "timeout ".concat(o2.topic, " (").concat(o2.joinRef(), ")"), o2.joinPush.timeout), new P(o2, S, x({}), o2.timeout).send(), o2.state = k, o2.joinPush.reset(), o2.socket.isConnected() && o2.rejoinTimer.scheduleTimeout();
}), this.on(w, function(e3, t3) {
o2.trigger(o2.replyEventName(t3), e3);
});
}
return h(e2, [{ key: "join", value: function() {
var e3 = 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 = e3, this.joinedOnce = true, this.rejoin(), this.joinPush;
} }, { key: "onClose", value: function(e3) {
this.on(C, e3);
} }, { key: "onError", value: function(e3) {
return this.on(R, function(t2) {
return e3(t2);
});
} }, { key: "on", value: function(e3, t2) {
var n2 = this.bindingRef++;
return this.bindings.push({ event: e3, ref: n2, callback: t2 }), n2;
} }, { key: "off", value: function(e3, t2) {
this.bindings = this.bindings.filter(function(n2) {
return !(n2.event === e3 && (void 0 === t2 || t2 === n2.ref));
});
} }, { key: "canPush", value: function() {
return this.socket.isConnected() && this.isJoined();
} }, { key: "push", value: function(e3, t2) {
var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.timeout;
if (t2 = t2 || {}, !this.joinedOnce) throw new Error("tried to push '".concat(e3, "' to '").concat(this.topic, "' before joining. Use channel.join() before pushing events"));
var i2 = new P(this, e3, function() {
return t2;
}, n2);
return this.canPush() ? i2.send() : (i2.startTimeout(), this.pushBuffer.push(i2)), i2;
} }, { key: "leave", value: function() {
var e3 = this, t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.timeout;
this.rejoinTimer.reset(), this.joinPush.cancelTimeout(), this.state = T;
var n2 = function() {
e3.socket.hasLogger() && e3.socket.log("channel", "leave ".concat(e3.topic)), e3.trigger(C, "leave");
}, i2 = new P(this, S, x({}), t2);
return i2.receive("ok", function() {
return n2();
}).receive("timeout", function() {
return n2();
}), i2.send(), this.canPush() || i2.trigger("ok", {}), i2;
} }, { key: "onMessage", value: function(e3, t2, n2) {
return t2;
} }, { key: "isMember", value: function(e3, t2, n2, i2) {
return this.topic === e3 && (!i2 || i2 === this.joinRef() || (this.socket.hasLogger() && this.socket.log("channel", "dropping outdated message", { topic: e3, event: t2, payload: n2, joinRef: i2 }), false));
} }, { key: "joinRef", value: function() {
return this.joinPush.ref;
} }, { key: "rejoin", value: function() {
var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.timeout;
this.isLeaving() || (this.socket.leaveOpenTopic(this.topic), this.state = j, this.joinPush.resend(e3));
} }, { key: "trigger", value: function(e3, t2, n2, i2) {
var o2 = this.onMessage(e3, t2, n2, i2);
if (t2 && !o2) throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");
for (var r2 = this.bindings.filter(function(t3) {
return t3.event === e3;
}), s2 = 0; s2 < r2.length; s2++) {
r2[s2].callback(o2, n2, i2 || this.joinRef());
}
} }, { key: "replyEventName", value: function(e3) {
return "chan_reply_".concat(e3);
} }, { key: "isClosed", value: function() {
return this.state === g;
} }, { key: "isErrored", value: function() {
return this.state === k;
} }, { key: "isJoined", value: function() {
return this.state === b;
} }, { key: "isJoining", value: function() {
return this.state === j;
} }, { key: "isLeaving", value: function() {
return this.state === T;
} }]), e2;
}(), _ = { HEADER_LENGTH: 1, META_LENGTH: 4, KINDS: { push: 0, reply: 1, broadcast: 2 }, encode: function(e2, t2) {
if (e2.payload.constructor === ArrayBuffer) return t2(this.binaryEncode(e2));
var n2 = [e2.join_ref, e2.ref, e2.topic, e2.event, e2.payload];
return t2(JSON.stringify(n2));
}, decode: function(e2, t2) {
if (e2.constructor === ArrayBuffer) return t2(this.binaryDecode(e2));
var n2 = r(JSON.parse(e2), 5);
return t2({ join_ref: n2[0], ref: n2[1], topic: n2[2], event: n2[3], payload: n2[4] });
}, binaryEncode: function(e2) {
var t2 = e2.join_ref, n2 = e2.ref, i2 = e2.event, o2 = e2.topic, r2 = e2.payload, s2 = this.META_LENGTH + t2.length + n2.length + o2.length + i2.length, a2 = new ArrayBuffer(this.HEADER_LENGTH + s2), c2 = new DataView(a2), u2 = 0;
c2.setUint8(u2++, this.KINDS.push), c2.setUint8(u2++, t2.length), c2.setUint8(u2++, n2.length), c2.setUint8(u2++, o2.length), c2.setUint8(u2++, i2.length), Array.from(t2, function(e3) {
return c2.setUint8(u2++, e3.charCodeAt(0));
}), Array.from(n2, function(e3) {
return c2.setUint8(u2++, e3.charCodeAt(0));
}), Array.from(o2, function(e3) {
return c2.setUint8(u2++, e3.charCodeAt(0));
}), Array.from(i2, function(e3) {
return c2.setUint8(u2++, e3.charCodeAt(0));
});
var h2 = new Uint8Array(a2.byteLength + r2.byteLength);
return h2.set(new Uint8Array(a2), 0), h2.set(new Uint8Array(r2), a2.byteLength), h2.buffer;
}, binaryDecode: function(e2) {
var t2 = new DataView(e2), n2 = t2.getUint8(0), i2 = new TextDecoder();
switch (n2) {
case this.KINDS.push:
return this.decodePush(e2, t2, i2);
case this.KINDS.reply:
return this.decodeReply(e2, t2, i2);
case this.KINDS.broadcast:
return this.decodeBroadcast(e2, t2, i2);
}
}, decodePush: function(e2, t2, n2) {
var i2 = t2.getUint8(1), o2 = t2.getUint8(2), r2 = t2.getUint8(3), s2 = this.HEADER_LENGTH + this.META_LENGTH - 1, a2 = n2.decode(e2.slice(s2, s2 + i2));
s2 += i2;
var c2 = n2.decode(e2.slice(s2, s2 + o2));
s2 += o2;
var u2 = n2.decode(e2.slice(s2, s2 + r2));
return s2 += r2, { join_ref: a2, ref: null, topic: c2, event: u2, payload: e2.slice(s2, e2.byteLength) };
}, decodeReply: function(e2, t2, n2) {
var i2 = t2.getUint8(1), o2 = t2.getUint8(2), r2 = t2.getUint8(3), s2 = t2.getUint8(4), a2 = this.HEADER_LENGTH + this.META_LENGTH, c2 = n2.decode(e2.slice(a2, a2 + i2));
a2 += i2;
var u2 = n2.decode(e2.slice(a2, a2 + o2));
a2 += o2;
var h2 = n2.decode(e2.slice(a2, a2 + r2));
a2 += r2;
var l2 = n2.decode(e2.slice(a2, a2 + s2));
a2 += s2;
var f2 = e2.slice(a2, e2.byteLength);
return { join_ref: c2, ref: u2, topic: h2, event: w, payload: { status: l2, response: f2 } };
}, decodeBroadcast: function(e2, t2, n2) {
var i2 = t2.getUint8(1), o2 = t2.getUint8(2), r2 = this.HEADER_LENGTH + 2, s2 = n2.decode(e2.slice(r2, r2 + i2));
r2 += i2;
var a2 = n2.decode(e2.slice(r2, r2 + o2));
return r2 += o2, { join_ref: null, ref: null, topic: s2, event: a2, payload: e2.slice(r2, e2.byteLength) };
} }, H = function() {
function e2(t2) {
var n2 = this, i2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
c(this, e2), this.stateChangeCallbacks = { open: [], close: [], error: [], message: [] }, this.channels = [], this.sendBuffer = [], this.ref = 0, this.timeout = i2.timeout || 1e4, this.transport = i2.transport || d.WebSocket || U, this.defaultEncoder = _.encode.bind(_), this.defaultDecoder = _.decode.bind(_), this.closeWasClean = false, this.unloaded = false, this.binaryType = i2.binaryType || "arraybuffer", this.transport !== U ? (this.encode = i2.encode || this.defaultEncoder, this.decode = i2.decode || this.defaultDecoder) : (this.encode = this.defaultEncoder, this.decode = this.defaultDecoder), f && f.addEventListener && f.addEventListener("beforeunload", function(e3) {
n2.conn && (n2.unloaded = true, n2.abnormalClose("unloaded"));
}), this.heartbeatIntervalMs = i2.heartbeatIntervalMs || 3e4, this.rejoinAfterMs = function(e3) {
return i2.rejoinAfterMs ? i2.rejoinAfterMs(e3) : [1e3, 2e3, 5e3][e3 - 1] || 1e4;
}, this.reconnectAfterMs = function(e3) {
return n2.unloaded ? 100 : i2.reconnectAfterMs ? i2.reconnectAfterMs(e3) : [10, 50, 100, 150, 200, 250, 500, 1e3, 2e3][e3 - 1] || 5e3;
}, this.logger = i2.logger || null, this.longpollerTimeout = i2.longpollerTimeout || 2e4, this.params = x(i2.params || {}), this.endPoint = "".concat(t2, "/").concat(L), this.vsn = i2.vsn || "2.0.0", this.heartbeatTimer = null, this.pendingHeartbeatRef = null, this.reconnectTimer = new N(function() {
n2.teardown(function() {
return n2.connect();
});
}, this.reconnectAfterMs);
}
return h(e2, [{ key: "protocol", value: function() {
return location.protocol.match(/^https/) ? "wss" : "ws";
} }, { key: "endPointURL", value: function() {
var e3 = D.appendParams(D.appendParams(this.endPoint, this.params()), { vsn: this.vsn });
return "/" !== e3.charAt(0) ? e3 : "/" === e3.charAt(1) ? "".concat(this.protocol(), ":").concat(e3) : "".concat(this.protocol(), "://").concat(location.host).concat(e3);
} }, { key: "disconnect", value: function(e3, t2, n2) {
this.closeWasClean = true, this.reconnectTimer.reset(), this.teardown(e3, t2, n2);
} }, { key: "connect", value: function(e3) {
var t2 = this;
e3 && (console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"), this.params = x(e3)), this.conn || (this.closeWasClean = false, this.conn = new this.transport(this.endPointURL()), this.conn.binaryType = this.binaryType, this.conn.timeout = this.longpollerTimeout, this.conn.onopen = function() {
return t2.onConnOpen();
}, this.conn.onerror = function(e4) {
return t2.onConnError(e4);
}, this.conn.onmessage = function(e4) {
return t2.onConnMessage(e4);
}, this.conn.onclose = function(e4) {
return t2.onConnClose(e4);
});
} }, { key: "log", value: function(e3, t2, n2) {
this.logger(e3, t2, n2);
} }, { key: "hasLogger", value: function() {
return null !== this.logger;
} }, { key: "onOpen", value: function(e3) {
var t2 = this.makeRef();
return this.stateChangeCallbacks.open.push([t2, e3]), t2;
} }, { key: "onClose", value: function(e3) {
var t2 = this.makeRef();
return this.stateChangeCallbacks.close.push([t2, e3]), t2;
} }, { key: "onError", value: function(e3) {
var t2 = this.makeRef();
return this.stateChangeCallbacks.error.push([t2, e3]), t2;
} }, { key: "onMessage", value: function(e3) {
var t2 = this.makeRef();
return this.stateChangeCallbacks.message.push([t2, e3]), t2;
} }, { key: "onConnOpen", value: function() {
this.hasLogger() && this.log("transport", "connected to ".concat(this.endPointURL())), this.unloaded = false, this.closeWasClean = false, this.flushSendBuffer(), this.reconnectTimer.reset(), this.resetHeartbeat(), this.stateChangeCallbacks.open.forEach(function(e3) {
return (0, r(e3, 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 e3 = this;
this.conn && this.conn.skipHeartbeat || (this.pendingHeartbeatRef = null, clearTimeout(this.heartbeatTimer), setTimeout(function() {
return e3.sendHeartbeat();
}, this.heartbeatIntervalMs));
} }, { key: "teardown", value: function(e3, t2, n2) {
var i2 = this;
if (!this.conn) return e3 && e3();
this.waitForBufferDone(function() {
i2.conn && (t2 ? i2.conn.close(t2, n2 || "") : i2.conn.close()), i2.waitForSocketClosed(function() {
i2.conn && (i2.conn.onclose = function() {
}, i2.conn = null), e3 && e3();
});
});
} }, { key: "waitForBufferDone", value: function(e3) {
var t2 = this, n2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1;
5 !== n2 && this.conn && this.conn.bufferedAmount ? setTimeout(function() {
t2.waitForBufferDone(e3, n2 + 1);
}, 150 * n2) : e3();
} }, { key: "waitForSocketClosed", value: function(e3) {
var t2 = this, n2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1;
5 !== n2 && this.conn && this.conn.readyState !== m ? setTimeout(function() {
t2.waitForSocketClosed(e3, n2 + 1);
}, 150 * n2) : e3();
} }, { key: "onConnClose", value: function(e3) {
this.hasLogger() && this.log("transport", "close", e3), this.triggerChanError(), clearTimeout(this.heartbeatTimer), this.closeWasClean || this.reconnectTimer.scheduleTimeout(), this.stateChangeCallbacks.close.forEach(function(t2) {
return (0, r(t2, 2)[1])(e3);
});
} }, { key: "onConnError", value: function(e3) {
this.hasLogger() && this.log("transport", e3), this.triggerChanError(), this.stateChangeCallbacks.error.forEach(function(t2) {
return (0, r(t2, 2)[1])(e3);
});
} }, { key: "triggerChanError", value: function() {
this.channels.forEach(function(e3) {
e3.isErrored() || e3.isLeaving() || e3.isClosed() || e3.trigger(R);
});
} }, { key: "connectionState", value: function() {
switch (this.conn && this.conn.readyState) {
case p:
return "connecting";
case v:
return "open";
case y:
return "closing";
default:
return "closed";
}
} }, { key: "isConnected", value: function() {
return "open" === this.connectionState();
} }, { key: "remove", value: function(e3) {
this.off(e3.stateChangeRefs), this.channels = this.channels.filter(function(t2) {
return t2.joinRef() !== e3.joinRef();
});
} }, { key: "off", value: function(e3) {
for (var t2 in this.stateChangeCallbacks) this.stateChangeCallbacks[t2] = this.stateChangeCallbacks[t2].filter(function(t3) {
var n2 = r(t3, 1)[0];
return -1 === e3.indexOf(n2);
});
} }, { key: "channel", value: function(e3) {
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n2 = new O(e3, t2, this);
return this.channels.push(n2), n2;
} }, { key: "push", value: function(e3) {
var t2 = this;
if (this.hasLogger()) {
var n2 = e3.topic, i2 = e3.event, o2 = e3.payload, r2 = e3.ref, s2 = e3.join_ref;
this.log("push", "".concat(n2, " ").concat(i2, " (").concat(s2, ", ").concat(r2, ")"), o2);
}
this.isConnected() ? this.encode(e3, function(e4) {
return t2.conn.send(e4);
}) : this.sendBuffer.push(function() {
return t2.encode(e3, function(e4) {
return t2.conn.send(e4);
});
});
} }, { key: "makeRef", value: function() {
var e3 = this.ref + 1;
return e3 === this.ref ? this.ref = 0 : this.ref = e3, this.ref.toString();
} }, { key: "sendHeartbeat", value: function() {
var e3 = this;
this.pendingHeartbeatRef && !this.isConnected() || (this.pendingHeartbeatRef = this.makeRef(), this.push({ topic: "phoenix", event: "heartbeat", payload: {}, ref: this.pendingHeartbeatRef }), this.heartbeatTimer = setTimeout(function() {
return e3.heartbeatTimeout();
}, this.heartbeatIntervalMs));
} }, { key: "abnormalClose", value: function(e3) {
this.closeWasClean = false, this.isConnected() && this.conn.close(1e3, e3);
} }, { key: "flushSendBuffer", value: function() {
this.isConnected() && this.sendBuffer.length > 0 && (this.sendBuffer.forEach(function(e3) {
return e3();
}), this.sendBuffer = []);
} }, { key: "onConnMessage", value: function(e3) {
var t2 = this;
this.decode(e3.data, function(e4) {
var n2 = e4.topic, i2 = e4.event, o2 = e4.payload, s2 = e4.ref, a2 = e4.join_ref;
s2 && s2 === t2.pendingHeartbeatRef && (clearTimeout(t2.heartbeatTimer), t2.pendingHeartbeatRef = null, setTimeout(function() {
return t2.sendHeartbeat();
}, t2.heartbeatIntervalMs)), t2.hasLogger() && t2.log("receive", "".concat(o2.status || "", " ").concat(n2, " ").concat(i2, " ").concat(s2 && "(" + s2 + ")" || ""), o2);
for (var c2 = 0; c2 < t2.channels.length; c2++) {
var u2 = t2.channels[c2];
u2.isMember(n2, i2, o2, a2) && u2.trigger(i2, o2, s2, a2);
}
for (var h2 = 0; h2 < t2.stateChangeCallbacks.message.length; h2++) {
(0, r(t2.stateChangeCallbacks.message[h2], 2)[1])(e4);
}
});
} }, { key: "leaveOpenTopic", value: function(e3) {
var t2 = this.channels.find(function(t3) {
return t3.topic === e3 && (t3.isJoined() || t3.isJoining());
});
t2 && (this.hasLogger() && this.log("transport", 'leaving duplicate topic "'.concat(e3, '"')), t2.leave());
} }]), e2;
}(), U = function() {
function e2(t2) {
c(this, e2), this.endPoint = null, this.token = null, this.skipHeartbeat = true, this.onopen = function() {
}, this.onerror = function() {
}, this.onmessage = function() {
}, this.onclose = function() {
}, this.pollEndpoint = this.normalizeEndpoint(t2), this.readyState = p, this.poll();
}
return h(e2, [{ key: "normalizeEndpoint", value: function(e3) {
return e3.replace("ws://", "http://").replace("wss://", "https://").replace(new RegExp("(.*)/" + L), "$1/" + A);
} }, { key: "endpointURL", value: function() {
return D.appendParams(this.pollEndpoint, { token: this.token });
} }, { key: "closeAndRetry", value: function() {
this.close(), this.readyState = p;
} }, { key: "ontimeout", value: function() {
this.onerror("timeout"), this.closeAndRetry();
} }, { key: "poll", value: function() {
var e3 = this;
this.readyState !== v && this.readyState !== p || D.request("GET", this.endpointURL(), "application/json", null, this.timeout, this.ontimeout.bind(this), function(t2) {
if (t2) {
var n2 = t2.status, i2 = t2.token, o2 = t2.messages;
e3.token = i2;
} else n2 = 0;
switch (n2) {
case 200:
o2.forEach(function(t3) {
setTimeout(function() {
e3.onmessage({ data: t3 });
}, 0);
}), e3.poll();
break;
case 204:
e3.poll();
break;
case 410:
e3.readyState = v, e3.onopen(), e3.poll();
break;
case 403:
e3.onerror(), e3.close();
break;
case 0:
case 500:
e3.onerror(), e3.closeAndRetry();
break;
default:
throw new Error("unhandled poll status ".concat(n2));
}
});
} }, { key: "send", value: function(e3) {
var t2 = this;
D.request("POST", this.endpointURL(), "application/json", e3, this.timeout, this.onerror.bind(this, "timeout"), function(e4) {
e4 && 200 === e4.status || (t2.onerror(e4 && e4.status), t2.closeAndRetry());
});
} }, { key: "close", value: function(e3, t2) {
this.readyState = m, this.onclose();
} }]), e2;
}(), D = function() {
function e2() {
c(this, e2);
}
return h(e2, null, [{ key: "request", value: function(e3, t2, n2, i2, o2, r2, s2) {
if (d.XDomainRequest) {
var a2 = new XDomainRequest();
this.xdomainRequest(a2, e3, t2, i2, o2, r2, s2);
} else {
var c2 = new d.XMLHttpRequest();
this.xhrRequest(c2, e3, t2, n2, i2, o2, r2, s2);
}
} }, { key: "xdomainRequest", value: function(e3, t2, n2, i2, o2, r2, s2) {
var a2 = this;
e3.timeout = o2, e3.open(t2, n2), e3.onload = function() {
var t3 = a2.parseJSON(e3.responseText);
s2 && s2(t3);
}, r2 && (e3.ontimeout = r2), e3.onprogress = function() {
}, e3.send(i2);
} }, { key: "xhrRequest", value: function(e3, t2, n2, i2, o2, r2, s2, a2) {
var c2 = this;
e3.open(t2, n2, true), e3.timeout = r2, e3.setRequestHeader("Content-Type", i2), e3.onerror = function() {
a2 && a2(null);
}, e3.onreadystatechange = function() {
if (e3.readyState === c2.states.complete && a2) {
var t3 = c2.parseJSON(e3.responseText);
a2(t3);
}
}, s2 && (e3.ontimeout = s2), e3.send(o2);
} }, { key: "parseJSON", value: function(e3) {
if (!e3 || "" === e3) return null;
try {
return JSON.parse(e3);
} catch (t2) {
return console && console.log("failed to parse JSON response", e3), null;
}
} }, { key: "serialize", value: function(e3, t2) {
var n2 = [];
for (var i2 in e3) if (e3.hasOwnProperty(i2)) {
var r2 = t2 ? "".concat(t2, "[").concat(i2, "]") : i2, s2 = e3[i2];
"object" === o(s2) ? n2.push(this.serialize(s2, r2)) : n2.push(encodeURIComponent(r2) + "=" + encodeURIComponent(s2));
}
return n2.join("&");
} }, { key: "appendParams", value: function(e3, t2) {
if (0 === Object.keys(t2).length) return e3;
var n2 = e3.match(/\?/) ? "&" : "?";
return "".concat(e3).concat(n2).concat(this.serialize(t2));
} }]), e2;
}();
D.states = { complete: 4 };
var M = function() {
function e2(t2) {
var n2 = this, i2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
c(this, e2);
var o2 = i2.events || { state: "presence_state", diff: "presence_diff" };
this.state = {}, this.pendingDiffs = [], this.channel = t2, this.joinRef = null, this.caller = { onJoin: function() {
}, onLeave: function() {
}, onSync: function() {
} }, this.channel.on(o2.state, function(t3) {
var i3 = n2.caller, o3 = i3.onJoin, r2 = i3.onLeave, s2 = i3.onSync;
n2.joinRef = n2.channel.joinRef(), n2.state = e2.syncState(n2.state, t3, o3, r2), n2.pendingDiffs.forEach(function(t4) {
n2.state = e2.syncDiff(n2.state, t4, o3, r2);
}), n2.pendingDiffs = [], s2();
}), this.channel.on(o2.diff, function(t3) {
var i3 = n2.caller, o3 = i3.onJoin, r2 = i3.onLeave, s2 = i3.onSync;
n2.inPendingSyncState() ? n2.pendingDiffs.push(t3) : (n2.state = e2.syncDiff(n2.state, t3, o3, r2), s2());
});
}
return h(e2, [{ key: "onJoin", value: function(e3) {
this.caller.onJoin = e3;
} }, { key: "onLeave", value: function(e3) {
this.caller.onLeave = e3;
} }, { key: "onSync", value: function(e3) {
this.caller.onSync = e3;
} }, { key: "list", value: function(t2) {
return e2.list(this.state, t2);
} }, { key: "inPendingSyncState", value: function() {
return !this.joinRef || this.joinRef !== this.channel.joinRef();
} }], [{ key: "syncState", value: function(e3, t2, n2, i2) {
var o2 = this, r2 = this.clone(e3), s2 = {}, a2 = {};
return this.map(r2, function(e4, n3) {
t2[e4] || (a2[e4] = n3);
}), this.map(t2, function(e4, t3) {
var n3 = r2[e4];
if (n3) {
var i3 = t3.metas.map(function(e5) {
return e5.phx_ref;
}), c2 = n3.metas.map(function(e5) {
return e5.phx_ref;
}), u2 = t3.metas.filter(function(e5) {
return c2.indexOf(e5.phx_ref) < 0;
}), h2 = n3.metas.filter(function(e5) {
return i3.indexOf(e5.phx_ref) < 0;
});
u2.length > 0 && (s2[e4] = t3, s2[e4].metas = u2), h2.length > 0 && (a2[e4] = o2.clone(n3), a2[e4].metas = h2);
} else s2[e4] = t3;
}), this.syncDiff(r2, { joins: s2, leaves: a2 }, n2, i2);
} }, { key: "syncDiff", value: function(e3, t2, n2, o2) {
var r2 = t2.joins, s2 = t2.leaves, a2 = this.clone(e3);
return n2 || (n2 = function() {
}), o2 || (o2 = function() {
}), this.map(r2, function(e4, t3) {
var o3 = a2[e4];
if (a2[e4] = t3, o3) {
var r3, s3 = a2[e4].metas.map(function(e5) {
return e5.phx_ref;
}), c2 = o3.metas.filter(function(e5) {
return s3.indexOf(e5.phx_ref) < 0;
});
(r3 = a2[e4].metas).unshift.apply(r3, i(c2));
}
n2(e4, o3, t3);
}), this.map(s2, function(e4, t3) {
var n3 = a2[e4];
if (n3) {
var i2 = t3.metas.map(function(e5) {
return e5.phx_ref;
});
n3.metas = n3.metas.filter(function(e5) {
return i2.indexOf(e5.phx_ref) < 0;
}), o2(e4, n3, t3), 0 === n3.metas.length && delete a2[e4];
}
}), a2;
} }, { key: "list", value: function(e3, t2) {
return t2 || (t2 = function(e4, t3) {
return t3;
}), this.map(e3, function(e4, n2) {
return t2(e4, n2);
});
} }, { key: "map", value: function(e3, t2) {
return Object.getOwnPropertyNames(e3).map(function(n2) {
return t2(n2, e3[n2]);
});
} }, { key: "clone", value: function(e3) {
return JSON.parse(JSON.stringify(e3));
} }]), e2;
}(), N = function() {
function e2(t2, n2) {
c(this, e2), this.callback = t2, this.timerCalc = n2, this.timer = null, this.tries = 0;
}
return h(e2, [{ key: "reset", value: function() {
this.tries = 0, clearTimeout(this.timer);
} }, { key: "scheduleTimeout", value: function() {
var e3 = this;
clearTimeout(this.timer), this.timer = setTimeout(function() {
e3.tries = e3.tries + 1, e3.callback();
}, this.timerCalc(this.tries + 1));
} }]), e2;
}();
}]);
});
}
});
// ../deps/phoenix_live_view/priv/static/phoenix_live_view.js
var require_phoenix_live_view = __commonJS({
"../deps/phoenix_live_view/priv/static/phoenix_live_view.js"(exports, module) {
!function(e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.phoenix_live_view = t() : e.phoenix_live_view = t();
}(exports, function() {
return function(e) {
var t = {};
function n(i) {
if (t[i]) return t[i].exports;
var r = t[i] = { i, l: false, exports: {} };
return e[i].call(r.exports, r, r.exports, n), r.l = true, r.exports;
}
return n.m = e, n.c = t, n.d = function(e2, t2, i) {
n.o(e2, t2) || Object.defineProperty(e2, t2, { configurable: false, enumerable: true, get: i });
}, n.r = function(e2) {
Object.defineProperty(e2, "__esModule", { value: true });
}, n.n = function(e2) {
var t2 = e2 && e2.__esModule ? function() {
return e2.default;
} : function() {
return e2;
};
return n.d(t2, "a", t2), t2;
}, n.o = function(e2, t2) {
return Object.prototype.hasOwnProperty.call(e2, t2);
}, n.p = "", n(n.s = 2);
}([function(e, t, n) {
"use strict";
n.r(t);
var i, r = 11;
var o = "http://www.w3.org/1999/xhtml", a = "undefined" == typeof document ? void 0 : document, u = !!a && "content" in a.createElement("template"), s = !!a && a.createRange && "createContextualFragment" in a.createRange();
function c(e2) {
return e2 = e2.trim(), u ? function(e3) {
var t2 = a.createElement("template");
return t2.innerHTML = e3, t2.content.childNodes[0];
}(e2) : s ? function(e3) {
return i || (i = a.createRange()).selectNode(a.body), i.createContextualFragment(e3).childNodes[0];
}(e2) : function(e3) {
var t2 = a.createElement("body");
return t2.innerHTML = e3, t2.childNodes[0];
}(e2);
}
function l(e2, t2) {
var n2, i2, r2 = e2.nodeName, o2 = t2.nodeName;
return r2 === o2 || (n2 = r2.charCodeAt(0), i2 = o2.charCodeAt(0), n2 <= 90 && i2 >= 97 ? r2 === o2.toUpperCase() : i2 <= 90 && n2 >= 97 && o2 === r2.toUpperCase());
}
function d(e2, t2, n2) {
e2[n2] !== t2[n2] && (e2[n2] = t2[n2], e2[n2] ? e2.setAttribute(n2, "") : e2.removeAttribute(n2));
}
var h = { OPTION: function(e2, t2) {
var n2 = e2.parentNode;
if (n2) {
var i2 = n2.nodeName.toUpperCase();
"OPTGROUP" === i2 && (i2 = (n2 = n2.parentNode) && n2.nodeName.toUpperCase()), "SELECT" !== i2 || n2.hasAttribute("multiple") || (e2.hasAttribute("selected") && !t2.selected && (e2.setAttribute("selected", "selected"), e2.removeAttribute("selected")), n2.selectedIndex = -1);
}
d(e2, t2, "selected");
}, INPUT: function(e2, t2) {
d(e2, t2, "checked"), d(e2, t2, "disabled"), e2.value !== t2.value && (e2.value = t2.value), t2.hasAttribute("value") || e2.removeAttribute("value");
}, TEXTAREA: function(e2, t2) {
var n2 = t2.value;
e2.value !== n2 && (e2.value = n2);
var i2 = e2.firstChild;
if (i2) {
var r2 = i2.nodeValue;
if (r2 == n2 || !n2 && r2 == e2.placeholder) return;
i2.nodeValue = n2;
}
}, SELECT: function(e2, t2) {
if (!t2.hasAttribute("multiple")) {
for (var n2, i2, r2 = -1, o2 = 0, a2 = e2.firstChild; a2; ) if ("OPTGROUP" === (i2 = a2.nodeName && a2.nodeName.toUpperCase())) a2 = (n2 = a2).firstChild;
else {
if ("OPTION" === i2) {
if (a2.hasAttribute("selected")) {
r2 = o2;
break;
}
o2++;
}
!(a2 = a2.nextSibling) && n2 && (a2 = n2.nextSibling, n2 = null);
}
e2.selectedIndex = r2;
}
} }, f = 1, v = 11, p = 3, g = 8;
function m() {
}
function y(e2) {
if (e2) return e2.getAttribute && e2.getAttribute("id") || e2.id;
}
var k = /* @__PURE__ */ function(e2) {
return function(t2, n2, i2) {
if (i2 || (i2 = {}), "string" == typeof n2) if ("#document" === t2.nodeName || "HTML" === t2.nodeName || "BODY" === t2.nodeName) {
var r2 = n2;
(n2 = a.createElement("html")).innerHTML = r2;
} else n2 = c(n2);
var u2 = i2.getNodeKey || y, s2 = i2.onBeforeNodeAdded || m, d2 = i2.onNodeAdded || m, k2 = i2.onBeforeElUpdated || m, b2 = i2.onElUpdated || m, w2 = i2.onBeforeNodeDiscarded || m, E2 = i2.onNodeDiscarded || m, S2 = i2.onBeforeElChildrenUpdated || m, A2 = true === i2.childrenOnly, x2 = /* @__PURE__ */ Object.create(null), C2 = [];
function P2(e3) {
C2.push(e3);
}
function L2(e3, t3, n3) {
false !== w2(e3) && (t3 && t3.removeChild(e3), E2(e3), function e4(t4, n4) {
if (t4.nodeType === f) for (var i3 = t4.firstChild; i3; ) {
var r3 = void 0;
n4 && (r3 = u2(i3)) ? P2(r3) : (E2(i3), i3.firstChild && e4(i3, n4)), i3 = i3.nextSibling;
}
}(e3, n3));
}
function I2(e3) {
d2(e3);
for (var t3 = e3.firstChild; t3; ) {
var n3 = t3.nextSibling, i3 = u2(t3);
if (i3) {
var r3 = x2[i3];
r3 && l(t3, r3) ? (t3.parentNode.replaceChild(r3, t3), T2(r3, t3)) : I2(t3);
} else I2(t3);
t3 = n3;
}
}
function T2(t3, n3, i3) {
var r3 = u2(n3);
if (r3 && delete x2[r3], !i3) {
if (false === k2(t3, n3)) return;
if (e2(t3, n3), b2(t3), false === S2(t3, n3)) return;
}
"TEXTAREA" !== t3.nodeName ? function(e3, t4) {
var n4, i4, r4, o2, c2, d3 = t4.firstChild, v2 = e3.firstChild;
e: for (; d3; ) {
for (o2 = d3.nextSibling, n4 = u2(d3); v2; ) {
if (r4 = v2.nextSibling, d3.isSameNode && d3.isSameNode(v2)) {
d3 = o2, v2 = r4;
continue e;
}
i4 = u2(v2);
var m2 = v2.nodeType, y2 = void 0;
if (m2 === d3.nodeType && (m2 === f ? (n4 ? n4 !== i4 && ((c2 = x2[n4]) ? r4 === c2 ? y2 = false : (e3.insertBefore(c2, v2), i4 ? P2(i4) : L2(v2, e3, true), v2 = c2) : y2 = false) : i4 && (y2 = false), (y2 = false !== y2 && l(v2, d3)) && T2(v2, d3)) : m2 !== p && m2 != g || (y2 = true, v2.nodeValue !== d3.nodeValue && (v2.nodeValue = d3.nodeValue))), y2) {
d3 = o2, v2 = r4;
continue e;
}
i4 ? P2(i4) : L2(v2, e3, true), v2 = r4;
}
if (n4 && (c2 = x2[n4]) && l(c2, d3)) e3.appendChild(c2), T2(c2, d3);
else {
var k3 = s2(d3);
false !== k3 && (k3 && (d3 = k3), d3.actualize && (d3 = d3.actualize(e3.ownerDocument || a)), e3.appendChild(d3), I2(d3));
}
d3 = o2, v2 = r4;
}
!function(e4, t5, n5) {
for (; t5; ) {
var i5 = t5.nextSibling;
(n5 = u2(t5)) ? P2(n5) : L2(t5, e4, true), t5 = i5;
}
}(e3, v2, i4);
var b3 = h[e3.nodeName];
b3 && b3(e3, t4);
}(t3, n3) : h.TEXTAREA(t3, n3);
}
!function e3(t3) {
if (t3.nodeType === f || t3.nodeType === v) for (var n3 = t3.firstChild; n3; ) {
var i3 = u2(n3);
i3 && (x2[i3] = n3), e3(n3), n3 = n3.nextSibling;
}
}(t2);
var D2 = t2, _2 = D2.nodeType, N2 = n2.nodeType;
if (!A2) {
if (_2 === f) N2 === f ? l(t2, n2) || (E2(t2), D2 = function(e3, t3) {
for (var n3 = e3.firstChild; n3; ) {
var i3 = n3.nextSibling;
t3.appendChild(n3), n3 = i3;
}
return t3;
}(t2, function(e3, t3) {
return t3 && t3 !== o ? a.createElementNS(t3, e3) : a.createElement(e3);
}(n2.nodeName, n2.namespaceURI))) : D2 = n2;
else if (_2 === p || _2 === g) {
if (N2 === _2) return D2.nodeValue !== n2.nodeValue && (D2.nodeValue = n2.nodeValue), D2;
D2 = n2;
}
}
if (D2 === n2) E2(t2);
else {
if (n2.isSameNode && n2.isSameNode(D2)) return;
if (T2(D2, n2, A2), C2) for (var R2 = 0, O2 = C2.length; R2 < O2; R2++) {
var j2 = x2[C2[R2]];
j2 && L2(j2, j2.parentNode, false);
}
}
return !A2 && D2 !== t2 && t2.parentNode && (D2.actualize && (D2 = D2.actualize(t2.ownerDocument || a)), t2.parentNode.replaceChild(D2, t2)), D2;
};
}(function(e2, t2) {
var n2, i2, o2, a2, u2 = t2.attributes;
if (t2.nodeType !== r && e2.nodeType !== r) {
for (var s2 = u2.length - 1; s2 >= 0; s2--) i2 = (n2 = u2[s2]).name, o2 = n2.namespaceURI, a2 = n2.value, o2 ? (i2 = n2.localName || i2, e2.getAttributeNS(o2, i2) !== a2 && ("xmlns" === n2.prefix && (i2 = n2.name), e2.setAttributeNS(o2, i2, a2))) : e2.getAttribute(i2) !== a2 && e2.setAttribute(i2, a2);
for (var c2 = e2.attributes, l2 = c2.length - 1; l2 >= 0; l2--) i2 = (n2 = c2[l2]).name, (o2 = n2.namespaceURI) ? (i2 = n2.localName || i2, t2.hasAttributeNS(o2, i2) || e2.removeAttributeNS(o2, i2)) : t2.hasAttribute(i2) || e2.removeAttribute(i2);
}
});
function b(e2) {
return L(e2) || E(e2) || I(e2) || P();
}
function w(e2) {
return function(e3) {
if (Array.isArray(e3)) return T(e3);
}(e2) || E(e2) || I(e2) || 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 E(e2) {
if ("undefined" != typeof Symbol && Symbol.iterator in Object(e2)) return Array.from(e2);
}
function S(e2, t2) {
var n2 = Object.keys(e2);
if (Object.getOwnPropertySymbols) {
var i2 = Object.getOwnPropertySymbols(e2);
t2 && (i2 = i2.filter(function(t3) {
return Object.getOwnPropertyDescriptor(e2, t3).enumerable;
})), n2.push.apply(n2, i2);
}
return n2;
}
function A(e2) {
for (var t2 = 1; t2 < arguments.length; t2++) {
var n2 = null != arguments[t2] ? arguments[t2] : {};
t2 % 2 ? S(Object(n2), true).forEach(function(t3) {
x(e2, t3, n2[t3]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(n2)) : S(Object(n2)).forEach(function(t3) {
Object.defineProperty(e2, t3, Object.getOwnPropertyDescriptor(n2, t3));
});
}
return e2;
}
function x(e2, t2, n2) {
return t2 in e2 ? Object.defineProperty(e2, t2, { value: n2, enumerable: true, configurable: true, writable: true }) : e2[t2] = n2, e2;
}
function C(e2, t2) {
return L(e2) || function(e3, t3) {
if ("undefined" == typeof Symbol || !(Symbol.iterator in Object(e3))) return;
var n2 = [], i2 = true, r2 = false, o2 = void 0;
try {
for (var a2, u2 = e3[Symbol.iterator](); !(i2 = (a2 = u2.next()).done) && (n2.push(a2.value), !t3 || n2.length !== t3); i2 = true) ;
} catch (e4) {
r2 = true, o2 = e4;
} finally {
try {
i2 || null == u2.return || u2.return();
} finally {
if (r2) throw o2;
}
}
return n2;
}(e2, t2) || I(e2, t2) || P();
}
function P() {
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 L(e2) {
if (Array.isArray(e2)) return e2;
}
function I(e2, t2) {
if (e2) {
if ("string" == typeof e2) return T(e2, t2);
var n2 = Object.prototype.toString.call(e2).slice(8, -1);
return "Object" === n2 && e2.constructor && (n2 = e2.constructor.name), "Map" === n2 || "Set" === n2 ? Array.from(e2) : "Arguments" === n2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2) ? T(e2, t2) : void 0;
}
}
function T(e2, t2) {
(null == t2 || t2 > e2.length) && (t2 = e2.length);
for (var n2 = 0, i2 = new Array(t2); n2 < t2; n2++) i2[n2] = e2[n2];
return i2;
}
function D(e2, t2) {
if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
}
function _(e2, t2) {
for (var n2 = 0; n2 < t2.length; n2++) {
var i2 = t2[n2];
i2.enumerable = i2.enumerable || false, i2.configurable = true, "value" in i2 && (i2.writable = true), Object.defineProperty(e2, i2.key, i2);
}
}
function N(e2, t2, n2) {
return t2 && _(e2.prototype, t2), n2 && _(e2, n2), e2;
}
function R(e2) {
"@babel/helpers - typeof";
return (R = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e3) {
return typeof e3;
} : function(e3) {
return e3 && "function" == typeof Symbol && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
})(e2);
}
n.d(t, "debug", function() {
return X;
}), n.d(t, "Rendered", function() {
return se;
}), n.d(t, "LiveSocket", function() {
return ce;
}), n.d(t, "Browser", function() {
return le;
}), n.d(t, "DOM", function() {
return de;
}), n.d(t, "View", function() {
return ve;
});
var O = [1e3, 3e3], j = "data-phx-view", H = ["phx-click-loading", "phx-change-loading", "phx-submit-loading", "phx-keydown-loading", "phx-keyup-loading", "phx-blur-loading", "phx-focus-loading"], M = "data-phx-component", F = "data-phx-ref", U = "data-phx-upload-ref", B = "[".concat(j, "]"), J = ["text", "textarea", "number", "email", "password", "search", "tel", "url", "date", "time"], V = ["checkbox", "radio"], W = 1, q = "phx-", z = { debounce: 300, throttle: 300 }, K = function(e2, t2) {
return console.error && console.error(e2, t2);
};
var X = function(e2, t2, n2, i2) {
e2.liveSocket.isDebugEnabled() && console.log("".concat(e2.id, " ").concat(t2, ": ").concat(n2, " - "), i2);
}, $ = function(e2) {
return "function" == typeof e2 ? e2 : function() {
return e2;
};
}, G = function(e2) {
return JSON.parse(JSON.stringify(e2));
}, Y = function(e2, t2, n2) {
do {
if (e2.matches("[".concat(t2, "]"))) return e2;
e2 = e2.parentElement || e2.parentNode;
} while (null !== e2 && 1 === e2.nodeType && !(n2 && n2.isSameNode(e2) || e2.matches(B)));
return null;
}, Q = function(e2) {
return null !== e2 && "object" === R(e2) && !(e2 instanceof Array);
}, Z = function(e2) {
for (var t2 in e2) return false;
return true;
}, ee = function(e2, t2) {
return e2 && t2(e2);
}, te = function() {
function e2(t2, n2, i2) {
D(this, e2), this.ref = re.genFileRef(n2), this.fileEl = t2, this.file = n2, this.view = i2, this.meta = null, this._isCancelled = false, this._isDone = false, this._progress = 0, this._lastProgressSent = -1, this._onDone = function() {
};
}
return N(e2, null, [{ key: "isActive", value: function(e3, t2) {
var n2 = void 0 === t2._phxRef, i2 = e3.getAttribute("data-phx-active-refs").split(",").indexOf(re.genFileRef(t2)) >= 0;
return t2.size > 0 && (n2 || i2);
} }, { key: "isPreflighted", value: function(e3, t2) {
var n2 = e3.getAttribute("data-phx-preflighted-refs").split(",").indexOf(re.genFileRef(t2)) >= 0;
return n2 && this.isActive(e3, t2);
} }]), N(e2, [{ key: "metadata", value: function() {
return this.meta;
} }, { key: "progress", value: function(e3) {
var t2 = this;
this._progress = Math.floor(e3), this._progress > this._lastProgressSent && (this._progress >= 100 ? (this._progress = 100, this._lastProgressSent = 100, this._isDone = true, this.view.pushFileProgress(this.fileEl, this.ref, 100, function() {
re.untrackFile(t2.fileEl, t2.file), t2._onDone();
})) : (this._lastProgressSent = this._progress, this.view.pushFileProgress(this.fileEl, this.ref, this._progress)));
} }, { key: "cancel", value: function() {
this._isCancelled = true, this._isDone = true, this._onDone();
} }, { key: "isDone", value: function() {
return this._isDone;
} }, { key: "error", value: function() {
var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "failed";
re.clearFiles(this.fileEl), this.view.pushFileProgress(this.fileEl, this.ref, { error: e3 });
} }, { key: "onDone", value: function(e3) {
this._onDone = e3;
} }, { key: "toPreflightPayload", value: function() {
return { last_modified: this.file.lastModified, name: this.file.name, size: this.file.size, type: this.file.type, ref: this.ref };
} }, { key: "uploader", value: function(e3) {
if (this.meta.uploader) {
var t2 = e3[this.meta.uploader] || K("no uploader configured for ".concat(this.meta.uploader));
return { name: this.meta.uploader, callback: t2 };
}
return { name: "channel", callback: oe };
} }, { key: "zipPostFlight", value: function(e3) {
this.meta = e3.entries[this.ref], this.meta || K("no preflight upload response returned with ref ".concat(this.ref), { input: this.fileEl, response: e3 });
} }]), e2;
}(), ne = { LiveFileUpload: { preflightedRefs: function() {
return this.el.getAttribute("data-phx-preflighted-refs");
}, mounted: function() {
this.preflightedWas = this.preflightedRefs();
}, updated: function() {
var e2 = this.preflightedRefs();
this.preflightedWas !== e2 && (this.preflightedWas = e2, "" === e2 && this.__view.cancelSubmit(this.el.form));
} } };
ne.LiveImgPreview = { mounted: function() {
var e2 = this;
this.ref = this.el.getAttribute("data-phx-entry-ref"), this.inputEl = document.getElementById(this.el.getAttribute(U)), re.getEntryDataURL(this.inputEl, this.ref, function(t2) {
return e2.el.src = t2;
});
} };
var ie = 0, re = function() {
function e2(t2, n2, i2) {
D(this, e2), this.view = n2, this.onComplete = i2, this._entries = Array.from(e2.filesAwaitingPreflight(t2) || []).map(function(e3) {
return new te(t2, e3, n2);
}), this.numEntriesInProgress = this._entries.length;
}
return N(e2, null, [{ key: "genFileRef", value: function(e3) {
var t2 = e3._phxRef;
return void 0 !== t2 ? t2 : (e3._phxRef = (ie++).toString(), e3._phxRef);
} }, { key: "getEntryDataURL", value: function(e3, t2, n2) {
var i2 = this, r2 = this.activeFiles(e3).find(function(e4) {
return i2.genFileRef(e4) === t2;
}), o2 = new FileReader();
o2.onload = function(e4) {
return n2(e4.target.result);
}, o2.readAsDataURL(r2);
} }, { key: "hasUploadsInProgress", value: function(e3) {
var t2 = 0;
return de.findUploadInputs(e3).forEach(function(e4) {
e4.getAttribute("data-phx-preflighted-refs") !== e4.getAttribute("data-phx-done-refs") && t2++;
}), t2 > 0;
} }, { key: "serializeUploads", value: function(e3) {
var t2 = this, n2 = {};
return this.activeFiles(e3, "serialize").forEach(function(i2) {
var r2 = { path: e3.name }, o2 = e3.getAttribute(U);
n2[o2] = n2[o2] || [], r2.ref = t2.genFileRef(i2), r2.name = i2.name, r2.type = i2.type, r2.size = i2.size, n2[o2].push(r2);
}), n2;
} }, { key: "clearFiles", value: function(e3) {
e3.value = null, e3.removeAttribute(U), de.putPrivate(e3, "files", []);
} }, { key: "untrackFile", value: function(e3, t2) {
de.putPrivate(e3, "files", de.private(e3, "files").filter(function(e4) {
return !Object.is(e4, t2);
}));
} }, { key: "trackFiles", value: function(e3, t2) {
var n2 = this;
if (null !== e3.getAttribute("multiple")) {
var i2 = t2.filter(function(t3) {
return !n2.activeFiles(e3).find(function(e4) {
return Object.is(e4, t3);
});
});
de.putPrivate(e3, "files", this.activeFiles(e3).concat(i2)), e3.value = null;
} else de.putPrivate(e3, "files", t2);
} }, { key: "activeFileInputs", value: function(e3) {
var t2 = this, n2 = de.findUploadInputs(e3);
return Array.from(n2).filter(function(e4) {
return e4.files && t2.activeFiles(e4).length > 0;
});
} }, { key: "activeFiles", value: function(e3) {
return (de.private(e3, "files") || []).filter(function(t2) {
return te.isActive(e3, t2);
});
} }, { key: "inputsAwaitingPreflight", value: function(e3) {
var t2 = this, n2 = de.findUploadInputs(e3);
return Array.from(n2).filter(function(e4) {
return t2.filesAwaitingPreflight(e4).length > 0;
});
} }, { key: "filesAwaitingPreflight", value: function(e3) {
return this.activeFiles(e3).filter(function(t2) {
return !te.isPreflighted(e3, t2);
});
} }]), N(e2, [{ key: "entries", value: function() {
return this._entries;
} }, { key: "initAdapterUpload", value: function(e3, t2, n2) {
var i2 = this;
this._entries = this._entries.map(function(t3) {
return t3.zipPostFlight(e3), t3.onDone(function() {
i2.numEntriesInProgress--, 0 === i2.numEntriesInProgress && i2.onComplete();
}), t3;
});
var r2 = this._entries.reduce(function(e4, t3) {
var i3 = t3.uploader(n2.uploaders), r3 = i3.name, o3 = i3.callback;
return e4[r3] = e4[r3] || { callback: o3, entries: [] }, e4[r3].entries.push(t3), e4;
}, {});
for (var o2 in r2) {
var a2 = r2[o2];
(0, a2.callback)(a2.entries, t2, e3, n2);
}
} }]), e2;
}(), oe = function(e2, t2, n2, i2) {
e2.forEach(function(e3) {
new ae(e3, n2.config.chunk_size, i2).upload();
});
}, ae = function() {
function e2(t2, n2, i2) {
D(this, e2), this.liveSocket = i2, this.entry = t2, this.offset = 0, this.chunkSize = n2, this.chunkTimer = null, this.uploadChannel = i2.channel("lvu:".concat(t2.ref), { token: t2.metadata() });
}
return N(e2, [{ key: "error", value: function(e3) {
clearTimeout(this.chunkTimer), this.uploadChannel.leave(), this.entry.error(e3);
} }, { key: "upload", value: function() {
var e3 = this;
this.uploadChannel.onError(function(t2) {
return e3.error(t2);
}), this.uploadChannel.join().receive("ok", function(t2) {
return e3.readNextChunk();
}).receive("error", function(t2) {
return e3.error(t2);
});
} }, { key: "isDone", value: function() {
return this.offset >= this.entry.file.size;
} }, { key: "readNextChunk", value: function() {
var e3 = this, t2 = new window.FileReader(), n2 = this.entry.file.slice(this.offset, this.chunkSize + this.offset);
t2.onload = function(t3) {
if (null !== t3.target.error) return K("Read error: " + t3.target.error);
e3.offset += t3.target.result.byteLength, e3.pushChunk(t3.target.result);
}, t2.readAsArrayBuffer(n2);
} }, { key: "pushChunk", value: function(e3) {
var t2 = this;
this.uploadChannel.isJoined() && this.uploadChannel.push("chunk", e3).receive("ok", function() {
t2.entry.progress(t2.offset / t2.entry.file.size * 100), t2.isDone() || (t2.chunkTimer = setTimeout(function() {
return t2.readNextChunk();
}, t2.liveSocket.getLatencySim() || 0));
});
} }]), e2;
}(), ue = function(e2) {
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n2 = new FormData(e2), i2 = [];
n2.forEach(function(e3, t3, n3) {
e3 instanceof File && i2.push(t3);
}), i2.forEach(function(e3) {
return n2.delete(e3);
});
var r2, o2 = new URLSearchParams(), a2 = function(e3) {
if ("undefined" == typeof Symbol || null == e3[Symbol.iterator]) {
if (Array.isArray(e3) || (e3 = I(e3))) {
var t3 = 0, n3 = function() {
};
return { s: n3, n: function() {
return t3 >= e3.length ? { done: true } : { done: false, value: e3[t3++] };
}, e: function(e4) {
throw e4;
}, f: n3 };
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var i3, r3, o3 = true, a3 = false;
return { s: function() {
i3 = e3[Symbol.iterator]();
}, n: function() {
var e4 = i3.next();
return o3 = e4.done, e4;
}, e: function(e4) {
a3 = true, r3 = e4;
}, f: function() {
try {
o3 || null == i3.return || i3.return();
} finally {
if (a3) throw r3;
}
} };
}(n2.entries());
try {
for (a2.s(); !(r2 = a2.n()).done; ) {
var u2 = C(r2.value, 2), s2 = u2[0], c2 = u2[1];
o2.append(s2, c2);
}
} catch (e3) {
a2.e(e3);
} finally {
a2.f();
}
for (var l2 in t2) o2.append(l2, t2[l2]);
return o2.toString();
}, se = function() {
function e2(t2, n2) {
D(this, e2), this.viewId = t2, this.rendered = {}, this.mergeDiff(n2);
}
return N(e2, null, [{ key: "extract", value: function(e3) {
var t2 = e3.r, n2 = e3.e, i2 = e3.t;
return delete e3.r, delete e3.e, delete e3.t, { diff: e3, title: i2, reply: t2 || null, events: n2 || [] };
} }]), N(e2, [{ key: "parentViewId", value: function() {
return this.viewId;
} }, { key: "toString", value: function(e3) {
return this.recursiveToString(this.rendered, this.rendered.c, e3);
} }, { key: "recursiveToString", value: function(e3) {
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e3.c, n2 = arguments.length > 2 ? arguments[2] : void 0, i2 = { buffer: "", components: t2, onlyCids: n2 = n2 ? new Set(n2) : null };
return this.toOutputBuffer(e3, i2), i2.buffer;
} }, { key: "componentCIDs", value: function(e3) {
return Object.keys(e3.c || {}).map(function(e4) {
return parseInt(e4);
});
} }, { key: "isComponentOnlyDiff", value: function(e3) {
return !!e3.c && 1 === Object.keys(e3).length;
} }, { key: "getComponent", value: function(e3, t2) {
return e3.c[t2];
} }, { key: "mergeDiff", value: function(e3) {
var t2 = e3.c, n2 = {};
if (delete e3.c, this.rendered = this.mutableMerge(this.rendered, e3), this.rendered.c = this.rendered.c || {}, t2) {
var i2 = this.rendered.c;
for (var r2 in t2) t2[r2] = this.cachedFindComponent(r2, t2[r2], i2, t2, n2);
for (var o2 in t2) i2[o2] = t2[o2];
e3.c = t2;
}
} }, { key: "cachedFindComponent", value: function(e3, t2, n2, i2, r2) {
if (r2[e3]) return r2[e3];
var o2, a2, u2, s2 = t2.s;
return "number" == typeof s2 ? (a2 = (u2 = s2 > 0 ? this.cachedFindComponent(s2, i2[s2], n2, i2, r2) : n2[-s2]).s, (o2 = this.cloneMerge(u2, t2)).s = a2) : o2 = void 0 !== t2.s ? t2 : this.cloneMerge(n2[e3] || {}, t2), r2[e3] = o2, o2;
} }, { key: "mutableMerge", value: function(e3, t2) {
return void 0 !== t2.s ? t2 : (this.doMutableMerge(e3, t2), e3);
} }, { key: "doMutableMerge", value: function(e3, t2) {
for (var n2 in t2) {
var i2 = t2[n2], r2 = e3[n2];
Q(i2) && void 0 === i2.s && Q(r2) ? this.doMutableMerge(r2, i2) : e3[n2] = i2;
}
} }, { key: "cloneMerge", value: function(e3, t2) {
var n2 = A(A({}, e3), t2);
for (var i2 in n2) {
var r2 = t2[i2], o2 = e3[i2];
Q(r2) && void 0 === r2.s && Q(o2) && (n2[i2] = this.cloneMerge(o2, r2));
}
return n2;
} }, { key: "componentToString", value: function(e3) {
return this.recursiveCIDToString(this.rendered.c, e3);
} }, { key: "pruneCIDs", value: function(e3) {
var t2 = this;
e3.forEach(function(e4) {
return delete t2.rendered.c[e4];
});
} }, { key: "get", value: function() {
return this.rendered;
} }, { key: "isNewFingerprint", value: function() {
return !!(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).s;
} }, { key: "toOutputBuffer", value: function(e3, t2) {
if (e3.d) return this.comprehensionToBuffer(e3, t2);
var n2 = e3.s;
t2.buffer += n2[0];
for (var i2 = 1; i2 < n2.length; i2++) this.dynamicToBuffer(e3[i2 - 1], t2), t2.buffer += n2[i2];
} }, { key: "comprehensionToBuffer", value: function(e3, t2) {
for (var n2 = e3.d, i2 = e3.s, r2 = 0; r2 < n2.length; r2++) {
var o2 = n2[r2];
t2.buffer += i2[0];
for (var a2 = 1; a2 < i2.length; a2++) this.dynamicToBuffer(o2[a2 - 1], t2), t2.buffer += i2[a2];
}
} }, { key: "dynamicToBuffer", value: function(e3, t2) {
"number" == typeof e3 ? t2.buffer += this.recursiveCIDToString(t2.components, e3, t2.onlyCids) : Q(e3) ? this.toOutputBuffer(e3, t2) : t2.buffer += e3;
} }, { key: "recursiveCIDToString", value: function(e3, t2, n2) {
var i2 = this, r2 = e3[t2] || K("no component for CID ".concat(t2), e3), o2 = document.createElement("template");
o2.innerHTML = this.recursiveToString(r2, e3, n2);
var a2 = o2.content, u2 = n2 && !n2.has(t2), s2 = C(Array.from(a2.childNodes).reduce(function(e4, n3, r3) {
var a3 = C(e4, 2), s3 = a3[0], c3 = a3[1];
return n3.nodeType === Node.ELEMENT_NODE ? n3.getAttribute(M) ? [s3, true] : (n3.setAttribute(M, t2), n3.id || (n3.id = "".concat(i2.parentViewId(), "-").concat(t2, "-").concat(r3)), u2 && (n3.setAttribute("data-phx-skip", ""), n3.innerHTML = ""), [true, c3]) : "" !== n3.nodeValue.trim() ? (K("only HTML element tags are allowed at the root of components.\n\n" + 'got: "'.concat(n3.nodeValue.trim(), '"\n\n') + "within:\n", o2.innerHTML.trim()), n3.replaceWith(i2.createSpan(n3.nodeValue, t2)), [true, c3]) : (n3.remove(), [s3, c3]);
}, [false, false]), 2), c2 = s2[0], l2 = s2[1];
return c2 || l2 ? !c2 && l2 ? (K("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.", o2.innerHTML.trim()), o2.innerHTML) : o2.innerHTML : (K("expected at least one HTML element tag inside a component, but the component is empty:\n", o2.innerHTML.trim()), this.createSpan("", t2).outerHTML);
} }, { key: "createSpan", value: function(e3, t2) {
var n2 = document.createElement("span");
return n2.innerText = e3, n2.setAttribute(M, t2), n2;
} }]), e2;
}(), ce = function() {
function e2(t2, n2) {
var i2 = this, r2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
if (D(this, e2), this.unloaded = false, !n2 || "Object" === n2.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 n2(t2, r2), this.bindingPrefix = r2.bindingPrefix || q, this.opts = r2, this.params = $(r2.params || {}), this.viewLogger = r2.viewLogger, this.metadataCallbacks = r2.metadata || {}, this.defaults = Object.assign(G(z), r2.defaults || {}), this.activeElement = null, this.prevActive = null, this.silenced = false, this.main = null, this.linkRef = 1, this.roots = {}, this.href = window.location.href, this.pendingLink = null, this.currentLocation = G(window.location), this.hooks = r2.hooks || {}, this.uploaders = r2.uploaders || {}, this.loaderTimeout = r2.loaderTimeout || W, this.localStorage = r2.localStorage || window.localStorage, this.sessionStorage = r2.sessionStorage || window.sessionStorage, this.boundTopLevelEvents = false, this.domCallbacks = Object.assign({ onNodeAdded: $(), onBeforeElUpdated: $() }, r2.dom || {}), window.addEventListener("pagehide", function(e3) {
i2.unloaded = true;
}), this.socket.onOpen(function() {
i2.isUnloaded() && window.location.reload();
});
}
return N(e2, [{ key: "isProfileEnabled", value: function() {
return "true" === this.sessionStorage.getItem("phx:live-socket:profiling");
} }, { key: "isDebugEnabled", value: function() {
return "true" === this.sessionStorage.getItem("phx:live-socket:debug");
} }, { key: "enableDebug", value: function() {
this.sessionStorage.setItem("phx:live-socket:debug", "true");
} }, { key: "enableProfiling", value: function() {
this.sessionStorage.setItem("phx:live-socket:profiling", "true");
} }, { key: "disableDebug", value: function() {
this.sessionStorage.removeItem("phx:live-socket:debug");
} }, { key: "disableProfiling", value: function() {
this.sessionStorage.removeItem("phx:live-socket:profiling");
} }, { key: "enableLatencySim", value: function(e3) {
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", e3);
} }, { key: "disableLatencySim", value: function() {
this.sessionStorage.removeItem("phx:live-socket:latency-sim");
} }, { key: "getLatencySim", value: function() {
var e3 = this.sessionStorage.getItem("phx:live-socket:latency-sim");
return e3 ? parseInt(e3) : null;
} }, { key: "getSocket", value: function() {
return this.socket;
} }, { key: "connect", value: function() {
var e3 = this, t2 = function() {
e3.joinRootViews() && (e3.bindTopLevelEvents(), e3.socket.connect());
};
["complete", "loaded", "interactive"].indexOf(document.readyState) >= 0 ? t2() : document.addEventListener("DOMContentLoaded", function() {
return t2();
});
} }, { key: "disconnect", value: function(e3) {
this.socket.disconnect(e3);
} }, { key: "triggerDOM", value: function(e3, t2) {
var n2;
(n2 = this.domCallbacks)[e3].apply(n2, w(t2));
} }, { key: "time", value: function(e3, t2) {
if (!this.isProfileEnabled() || !console.time) return t2();
console.time(e3);
var n2 = t2();
return console.timeEnd(e3), n2;
} }, { key: "log", value: function(e3, t2, n2) {
if (this.viewLogger) {
var i2 = C(n2(), 2), r2 = i2[0], o2 = i2[1];
this.viewLogger(e3, t2, r2, o2);
} else if (this.isDebugEnabled()) {
var a2 = C(n2(), 2), u2 = a2[0], s2 = a2[1];
X(e3, t2, u2, s2);
}
} }, { key: "onChannel", value: function(e3, t2, n2) {
var i2 = this;
e3.on(t2, function(e4) {
var t3 = i2.getLatencySim();
t3 ? (console.log("simulating ".concat(t3, "ms of latency from server to client")), setTimeout(function() {
return n2(e4);
}, t3)) : n2(e4);
});
} }, { key: "wrapPush", value: function(e3, t2, n2) {
var i2 = this, r2 = this.getLatencySim(), o2 = e3.joinCount;
if (!r2) return t2.timeout ? n2().receive("timeout", function() {
e3.joinCount === o2 && i2.reloadWithJitter(e3, function() {
i2.log(e3, "timeout", function() {
return ["received timeout while communicating with server. Falling back to hard refresh for recovery"];
});
});
}) : n2();
console.log("simulating ".concat(r2, "ms of latency from client to server"));
var a2 = { receives: [], receive: function(e4, t3) {
this.receives.push([e4, t3]);
} };
return setTimeout(function() {
a2.receives.reduce(function(e4, t3) {
var n3 = C(t3, 2), i3 = n3[0], r3 = n3[1];
return e4.receive(i3, r3);
}, n2());
}, r2), a2;
} }, { key: "reloadWithJitter", value: function(e3, t2) {
var n2 = this;
e3.destroy(), this.disconnect();
var i2 = O[0], r2 = O[1], o2 = Math.floor(Math.random() * (r2 - i2 + 1)) + i2, a2 = le.updateLocal(this.localStorage, e3.name(), "consecutive-reloads", 0, function(e4) {
return e4 + 1;
});
t2 ? t2() : this.log(e3, "join", function() {
return ["encountered ".concat(a2, " consecutive reloads")];
}), a2 > 10 && (this.log(e3, "join", function() {
return ["exceeded ".concat(10, " consecutive reloads. Entering failsafe mode")];
}), o2 = 3e4), setTimeout(function() {
n2.hasPendingLink() ? window.location = n2.pendingLink : window.location.reload();
}, o2);
} }, { key: "getHookCallbacks", value: function(e3) {
return e3 && e3.startsWith("Phoenix.") ? ne[e3.split(".")[1]] : this.hooks[e3];
} }, { key: "isUnloaded", value: function() {
return this.unloaded;
} }, { key: "isConnected", value: function() {
return this.socket.isConnected();
} }, { key: "getBindingPrefix", value: function() {
return this.bindingPrefix;
} }, { key: "binding", value: function(e3) {
return "".concat(this.getBindingPrefix()).concat(e3);
} }, { key: "channel", value: function(e3, t2) {
return this.socket.channel(e3, t2);
} }, { key: "joinRootViews", value: function() {
var e3 = this, t2 = false;
return de.all(document, "".concat(B, ":not([").concat("data-phx-parent-id", "])"), function(n2) {
if (!e3.getRootById(n2.id)) {
var i2 = e3.joinRootView(n2, e3.getHref());
e3.root = e3.root || i2, n2.getAttribute("data-phx-main") && (e3.main = i2);
}
t2 = true;
}), t2;
} }, { key: "redirect", value: function(e3, t2) {
this.disconnect(), le.redirect(e3, t2);
} }, { key: "replaceMain", value: function(e3, t2) {
var n2 = this, i2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, r2 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : this.setPendingLink(e3), o2 = this.main.el;
this.main.showLoader(this.loaderTimeout), this.main.destroy(), le.fetchPage(e3, function(a2, u2) {
if (200 !== a2) return n2.redirect(e3);
var s2 = document.createElement("template");
s2.innerHTML = u2;
var c2 = s2.content.childNodes[0];
if (!c2 || !n2.isPhxView(c2)) return n2.redirect(e3);
n2.joinRootView(c2, e3, t2, function(e4, t3) {
1 === t3 && (n2.commitPendingLink(r2) ? (o2.replaceWith(e4.el), n2.main = e4, i2 && i2()) : e4.destroy());
});
});
} }, { key: "isPhxView", value: function(e3) {
return e3.getAttribute && null !== e3.getAttribute(j);
} }, { key: "joinRootView", value: function(e3, t2, n2, i2) {
var r2 = new ve(e3, this, null, t2, n2);
return this.roots[r2.id] = r2, r2.join(i2), r2;
} }, { key: "owner", value: function(e3, t2) {
var n2 = this, i2 = ee(e3.closest(B), function(e4) {
return n2.getViewByEl(e4);
});
i2 && t2(i2);
} }, { key: "withinOwners", value: function(e3, t2) {
var n2 = this;
this.owner(e3, function(i2) {
var r2 = e3.getAttribute(n2.binding("target"));
null === r2 ? t2(i2, e3) : i2.withinTargets(r2, t2);
});
} }, { key: "getViewByEl", value: function(e3) {
var t2 = e3.getAttribute("data-phx-root-id");
return ee(this.getRootById(t2), function(t3) {
return t3.getDescendentByEl(e3);
});
} }, { key: "getRootById", value: function(e3) {
return this.roots[e3];
} }, { key: "destroyAllViews", value: function() {
for (var e3 in this.roots) this.roots[e3].destroy(), delete this.roots[e3];
} }, { key: "destroyViewByEl", value: function(e3) {
var t2 = this.getRootById(e3.getAttribute("data-phx-root-id"));
t2 && t2.destroyDescendent(e3.id);
} }, { key: "setActiveElement", value: function(e3) {
var t2 = this;
if (this.activeElement !== e3) {
this.activeElement = e3;
var n2 = function() {
e3 === t2.activeElement && (t2.activeElement = null), e3.removeEventListener("mouseup", t2), e3.removeEventListener("touchend", t2);
};
e3.addEventListener("mouseup", n2), e3.addEventListener("touchend", n2);
}
} }, { key: "getActiveElement", value: function() {
return document.activeElement === document.body ? this.activeElement || document.activeElement : document.activeElement || document.body;
} }, { key: "dropActiveElement", value: function(e3) {
this.prevActive && e3.ownsElement(this.prevActive) && (this.prevActive = null);
} }, { key: "restorePreviouslyActiveFocus", value: function() {
this.prevActive && this.prevActive !== document.body && this.prevActive.focus();
} }, { key: "blurActiveElement", value: function() {
this.prevActive = this.getActiveElement(), this.prevActive !== document.body && this.prevActive.blur();
} }, { key: "bindTopLevelEvents", value: function() {
var e3 = this;
this.boundTopLevelEvents || (this.boundTopLevelEvents = true, document.body.addEventListener("click", function() {
}), window.addEventListener("pageshow", function(t2) {
t2.persisted && (e3.getSocket().disconnect(), e3.withPageLoading({ to: window.location.href, kind: "redirect" }), window.location.reload());
}, true), this.bindClicks(), this.bindNav(), this.bindForms(), this.bind({ keyup: "keyup", keydown: "keydown" }, function(t2, n2, i2, r2, o2, a2, u2) {
var s2 = r2.getAttribute(e3.binding("key")), c2 = t2.key && t2.key.toLowerCase();
s2 && s2.toLowerCase() !== c2 || i2.pushKey(r2, o2, n2, a2, A({ key: t2.key }, e3.eventMeta(n2, t2, r2)));
}), this.bind({ blur: "focusout", focus: "focusin" }, function(t2, n2, i2, r2, o2, a2, u2) {
u2 || i2.pushEvent(n2, r2, o2, a2, e3.eventMeta(n2, t2, r2));
}), this.bind({ blur: "blur", focus: "focus" }, function(t2, n2, i2, r2, o2, a2, u2) {
u2 && "window" !== !u2 && i2.pushEvent(n2, r2, o2, a2, e3.eventMeta(n2, t2, r2));
}), window.addEventListener("dragover", function(e4) {
return e4.preventDefault();
}), window.addEventListener("drop", function(t2) {
t2.preventDefault();
var n2 = ee(Y(t2.target, e3.binding("drop-target")), function(t3) {
return t3.getAttribute(e3.binding("drop-target"));
}), i2 = n2 && document.getElementById(n2), r2 = Array.from(t2.dataTransfer.files || []);
i2 && !i2.disabled && 0 !== r2.length && i2.files instanceof FileList && (re.trackFiles(i2, r2), i2.dispatchEvent(new Event("input", { bubbles: true })));
}));
} }, { key: "eventMeta", value: function(e3, t2, n2) {
var i2 = this.metadataCallbacks[e3];
return i2 ? i2(t2, n2) : {};
} }, { key: "setPendingLink", value: function(e3) {
return this.linkRef++, this.pendingLink = e3, this.linkRef;
} }, { key: "commitPendingLink", value: function(e3) {
return this.linkRef === e3 && (this.href = this.pendingLink, this.pendingLink = null, true);
} }, { key: "getHref", value: function() {
return this.href;
} }, { key: "hasPendingLink", value: function() {
return !!this.pendingLink;
} }, { key: "bind", value: function(e3, t2) {
var n2 = this, i2 = function(i3) {
var r3 = e3[i3];
n2.on(r3, function(e4) {
var r4 = n2.binding(i3), o2 = n2.binding("window-".concat(i3)), a2 = e4.target.getAttribute && e4.target.getAttribute(r4);
a2 ? n2.debounce(e4.target, e4, function() {
n2.withinOwners(e4.target, function(n3, r5) {
t2(e4, i3, n3, e4.target, r5, a2, null);
});
}) : de.all(document, "[".concat(o2, "]"), function(r5) {
var a3 = r5.getAttribute(o2);
n2.debounce(r5, e4, function() {
n2.withinOwners(r5, function(n3, o3) {
t2(e4, i3, n3, r5, o3, a3, "window");
});
});
});
});
};
for (var r2 in e3) i2(r2);
} }, { key: "bindClicks", value: function() {
this.bindClick("click", "click", false), this.bindClick("mousedown", "capture-click", true);
} }, { key: "bindClick", value: function(e3, t2, n2) {
var i2 = this, r2 = this.binding(t2);
window.addEventListener(e3, function(e4) {
if (i2.isConnected()) {
var t3 = null, o2 = (t3 = n2 ? e4.target.matches("[".concat(r2, "]")) ? e4.target : e4.target.querySelector("[".concat(r2, "]")) : Y(e4.target, r2)) && t3.getAttribute(r2);
o2 && ("#" === t3.getAttribute("href") && e4.preventDefault(), i2.debounce(t3, e4, function() {
i2.withinOwners(t3, function(n3, r3) {
n3.pushEvent("click", t3, r3, o2, i2.eventMeta("click", e4, t3));
});
}));
}
}, n2);
} }, { key: "bindNav", value: function() {
var e3 = this;
if (le.canPushState()) {
history.scrollRestoration && (history.scrollRestoration = "manual");
var t2 = null;
window.addEventListener("scroll", function(e4) {
clearTimeout(t2), t2 = setTimeout(function() {
le.updateCurrentState(function(e5) {
return Object.assign(e5, { scroll: window.scrollY });
});
}, 100);
}), window.addEventListener("popstate", function(t3) {
if (e3.registerNewLocation(window.location)) {
var n2 = t3.state || {}, i2 = n2.type, r2 = n2.id, o2 = n2.root, a2 = n2.scroll, u2 = window.location.href;
e3.main.isConnected() && "patch" === i2 && r2 === e3.main.id ? e3.main.pushLinkPatch(u2, null) : e3.replaceMain(u2, null, function() {
o2 && e3.replaceRootHistory(), "number" == typeof a2 && setTimeout(function() {
window.scrollTo(0, a2);
}, 0);
});
}
}, false), window.addEventListener("click", function(t3) {
var n2 = Y(t3.target, "data-phx-link"), i2 = n2 && n2.getAttribute("data-phx-link"), r2 = t3.metaKey || t3.ctrlKey || 1 === t3.button;
if (i2 && e3.isConnected() && e3.main && !r2) {
var o2 = n2.href, a2 = n2.getAttribute("data-phx-link-state");
if (t3.preventDefault(), e3.pendingLink !== o2) if ("patch" === i2) e3.pushHistoryPatch(o2, a2, n2);
else {
if ("redirect" !== i2) throw new Error("expected ".concat("data-phx-link", ' to be "patch" or "redirect", got: ').concat(i2));
e3.historyRedirect(o2, a2);
}
}
}, false);
}
} }, { key: "withPageLoading", value: function(e3, t2) {
de.dispatchEvent(window, "phx:page-loading-start", e3);
var n2 = function() {
return de.dispatchEvent(window, "phx:page-loading-stop", e3);
};
return t2 ? t2(n2) : n2;
} }, { key: "pushHistoryPatch", value: function(e3, t2, n2) {
var i2 = this;
this.withPageLoading({ to: e3, kind: "patch" }, function(r2) {
i2.main.pushLinkPatch(e3, n2, function(n3) {
i2.historyPatch(e3, t2, n3), r2();
});
});
} }, { key: "historyPatch", value: function(e3, t2) {
var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.setPendingLink(e3);
this.commitPendingLink(n2) && (le.pushState(t2, { type: "patch", id: this.main.id }, e3), this.registerNewLocation(window.location));
} }, { key: "historyRedirect", value: function(e3, t2, n2) {
var i2 = this, r2 = window.scrollY;
this.withPageLoading({ to: e3, kind: "redirect" }, function(o2) {
i2.replaceMain(e3, n2, function() {
le.pushState(t2, { type: "redirect", id: i2.main.id, scroll: r2 }, e3), i2.registerNewLocation(window.location), o2();
});
});
} }, { key: "replaceRootHistory", value: function() {
le.pushState("replace", { root: true, type: "patch", id: this.main.id });
} }, { key: "registerNewLocation", value: function(e3) {
var t2 = this.currentLocation;
return t2.pathname + t2.search !== e3.pathname + e3.search && (this.currentLocation = G(e3), true);
} }, { key: "bindForms", value: function() {
var e3 = this, t2 = 0;
this.on("submit", function(t3) {
var n3 = t3.target.getAttribute(e3.binding("submit"));
n3 && (t3.preventDefault(), t3.target.disabled = true, e3.withinOwners(t3.target, function(e4, i3) {
return e4.submitForm(t3.target, i3, n3);
}));
}, false);
for (var n2 = function() {
var n3 = r2[i2];
e3.on(n3, function(i3) {
var r3 = i3.target, o2 = r3.form && r3.form.getAttribute(e3.binding("change"));
if (o2 && ("number" !== r3.type || !r3.validity || !r3.validity.badInput)) {
var a2 = t2;
t2++;
var u2 = de.private(r3, "prev-iteration") || {}, s2 = u2.at, c2 = u2.type;
s2 === a2 - 1 && n3 !== c2 || (de.putPrivate(r3, "prev-iteration", { at: a2, type: n3 }), e3.debounce(r3, i3, function() {
e3.withinOwners(r3.form, function(t3, n4) {
de.putPrivate(r3, "phx-has-focused", true), de.isTextualInput(r3) || e3.setActiveElement(r3), t3.pushInput(r3, n4, o2, i3.target);
});
}));
}
}, false);
}, i2 = 0, r2 = ["change", "input"]; i2 < r2.length; i2++) n2();
} }, { key: "debounce", value: function(e3, t2, n2) {
var i2 = this.binding("debounce"), r2 = this.binding("throttle"), o2 = this.defaults.debounce.toString(), a2 = this.defaults.throttle.toString();
de.debounce(e3, t2, i2, o2, r2, a2, n2);
} }, { key: "silenceEvents", value: function(e3) {
this.silenced = true, e3(), this.silenced = false;
} }, { key: "on", value: function(e3, t2) {
var n2 = this;
window.addEventListener(e3, function(e4) {
n2.silenced || t2(e4);
});
} }]), e2;
}(), le = { canPushState: function() {
return void 0 !== history.pushState;
}, dropLocal: function(e2, t2, n2) {
return e2.removeItem(this.localKey(t2, n2));
}, updateLocal: function(e2, t2, n2, i2, r2) {
var o2 = this.getLocal(e2, t2, n2), a2 = this.localKey(t2, n2), u2 = null === o2 ? i2 : r2(o2);
return e2.setItem(a2, JSON.stringify(u2)), u2;
}, getLocal: function(e2, t2, n2) {
return JSON.parse(e2.getItem(this.localKey(t2, n2)));
}, fetchPage: function(e2, t2) {
var n2 = new XMLHttpRequest();
n2.open("GET", e2, true), n2.timeout = 3e4, n2.setRequestHeader("content-type", "text/html"), n2.setRequestHeader("cache-control", "max-age=0, no-cache, no-store, must-revalidate, post-check=0, pre-check=0"), n2.setRequestHeader("x-requested-with", "live-link"), n2.onerror = function() {
return t2(400);
}, n2.ontimeout = function() {
return t2(504);
}, n2.onreadystatechange = function() {
if (4 === n2.readyState) {
var i2 = new URL(e2), r2 = i2.pathname + i2.search, o2 = ee(n2.getResponseHeader("x-response-url") || n2.responseURL, function(e3) {
return new URL(e3);
}), a2 = o2 ? o2.pathname + o2.search : null;
return "live-link" !== n2.getResponseHeader("x-requested-with") ? t2(400) : null === o2 || a2 != r2 ? t2(302) : 200 !== n2.status ? t2(n2.status) : void t2(200, n2.responseText);
}
}, n2.send();
}, updateCurrentState: function(e2) {
this.canPushState() && history.replaceState(e2(history.state || {}), "", window.location.href);
}, pushState: function(e2, t2, n2) {
if (this.canPushState()) {
if (n2 !== window.location.href) {
if ("redirect" == t2.type && t2.scroll) {
var i2 = history.state || {};
i2.scroll = t2.scroll, history.replaceState(i2, "", window.location.href);
}
delete t2.scroll, history[e2 + "State"](t2, "", n2 || null);
var r2 = this.getHashTargetEl(window.location.hash);
r2 ? r2.scrollIntoView() : "redirect" === t2.type && window.scroll(0, 0);
}
} else this.redirect(n2);
}, setCookie: function(e2, t2) {
document.cookie = "".concat(e2, "=").concat(t2);
}, getCookie: function(e2) {
return document.cookie.replace(new RegExp("(?:(?:^|.*;s*)".concat(e2, "s*=s*([^;]*).*$)|^.*$")), "$1");
}, redirect: function(e2, t2) {
t2 && le.setCookie("__phoenix_flash__", t2 + "; max-age=60000; path=/"), window.location = e2;
}, localKey: function(e2, t2) {
return "".concat(e2, "-").concat(t2);
}, getHashTargetEl: function(e2) {
var t2 = e2.toString().substring(1);
if ("" !== t2) return document.getElementById(t2) || document.querySelector('a[name="'.concat(t2, '"]'));
} }, de = { byId: function(e2) {
return document.getElementById(e2) || K("no id found for ".concat(e2));
}, removeClass: function(e2, t2) {
e2.classList.remove(t2), 0 === e2.classList.length && e2.removeAttribute("class");
}, all: function(e2, t2, n2) {
var i2 = Array.from(e2.querySelectorAll(t2));
return n2 ? i2.forEach(n2) : i2;
}, childNodeLength: function(e2) {
var t2 = document.createElement("template");
return t2.innerHTML = e2, t2.content.childElementCount;
}, isUploadInput: function(e2) {
return "file" === e2.type && null !== e2.getAttribute(U);
}, findUploadInputs: function(e2) {
return this.all(e2, 'input[type="file"]['.concat(U, "]"));
}, findComponentNodeList: function(e2, t2) {
return this.filterWithinSameLiveView(this.all(e2, "[".concat(M, '="').concat(t2, '"]')), e2);
}, isPhxDestroyed: function(e2) {
return !(!e2.id || !de.private(e2, "destroyed"));
}, markPhxChildDestroyed: function(e2) {
e2.setAttribute("data-phx-session", ""), this.putPrivate(e2, "destroyed", true);
}, findPhxChildrenInFragment: function(e2, t2) {
var n2 = document.createElement("template");
return n2.innerHTML = e2, this.findPhxChildren(n2.content, t2);
}, isIgnored: function(e2, t2) {
return "ignore" === (e2.getAttribute(t2) || e2.getAttribute("data-phx-update"));
}, isPhxUpdate: function(e2, t2, n2) {
return e2.getAttribute && n2.indexOf(e2.getAttribute(t2)) >= 0;
}, findPhxChildren: function(e2, t2) {
return this.all(e2, "".concat(B, "[").concat("data-phx-parent-id", '="').concat(t2, '"]'));
}, findParentCIDs: function(e2, t2) {
var n2 = this, i2 = new Set(t2);
return t2.reduce(function(t3, i3) {
var r2 = "[".concat(M, '="').concat(i3, '"] [').concat(M, "]");
return n2.filterWithinSameLiveView(n2.all(e2, r2), e2).map(function(e3) {
return parseInt(e3.getAttribute(M));
}).forEach(function(e3) {
return t3.delete(e3);
}), t3;
}, i2);
}, filterWithinSameLiveView: function(e2, t2) {
var n2 = this;
return t2.querySelector(B) ? e2.filter(function(e3) {
return n2.withinSameLiveView(e3, t2);
}) : e2;
}, withinSameLiveView: function(e2, t2) {
for (; e2 = e2.parentNode; ) {
if (e2.isSameNode(t2)) return true;
if (e2.getAttribute(j)) return false;
}
}, private: function(e2, t2) {
return e2.phxPrivate && e2.phxPrivate[t2];
}, deletePrivate: function(e2, t2) {
e2.phxPrivate && delete e2.phxPrivate[t2];
}, putPrivate: function(e2, t2, n2) {
e2.phxPrivate || (e2.phxPrivate = {}), e2.phxPrivate[t2] = n2;
}, copyPrivates: function(e2, t2) {
t2.phxPrivate && (e2.phxPrivate = G(t2.phxPrivate));
}, putTitle: function(e2) {
var t2 = document.querySelector("title").dataset, n2 = t2.prefix, i2 = t2.suffix;
document.title = "".concat(n2 || "").concat(e2).concat(i2 || "");
}, debounce: function(e2, t2, n2, i2, r2, o2, a2) {
var u2 = this, s2 = e2.getAttribute(n2), c2 = e2.getAttribute(r2);
"" === s2 && (s2 = i2), "" === c2 && (c2 = o2);
var l2 = s2 || c2;
switch (l2) {
case null:
return a2();
case "blur":
return void (this.once(e2, "debounce-blur") && e2.addEventListener("blur", function() {
return a2();
}));
default:
var d2 = parseInt(l2), h2 = this.incCycle(e2, "debounce-trigger", function() {
return c2 ? u2.deletePrivate(e2, "throttled") : a2();
});
if (isNaN(d2)) return K("invalid throttle/debounce value: ".concat(l2));
if (c2) {
var f2 = false;
if ("keydown" === t2.type) {
var v2 = this.private(e2, "debounce-prev-key");
this.putPrivate(e2, "debounce-prev-key", t2.key), f2 = v2 !== t2.key;
}
if (!f2 && this.private(e2, "throttled")) return false;
a2(), this.putPrivate(e2, "throttled", true), setTimeout(function() {
return u2.triggerCycle(e2, "debounce-trigger");
}, d2);
} else setTimeout(function() {
return u2.triggerCycle(e2, "debounce-trigger", h2);
}, d2);
var p2 = e2.form;
p2 && this.once(p2, "bind-debounce") && p2.addEventListener("submit", function(e3) {
Array.from(new FormData(p2).entries(), function(e4) {
var t3 = C(e4, 2), n3 = t3[0], i3 = (t3[1], p2.querySelector('[name="'.concat(n3, '"]')));
u2.incCycle(i3, "debounce-trigger"), u2.deletePrivate(i3, "throttled");
});
}), this.once(e2, "bind-debounce") && e2.addEventListener("blur", function(t3) {
return u2.triggerCycle(e2, "debounce-trigger");
});
}
}, triggerCycle: function(e2, t2, n2) {
var i2 = C(this.private(e2, t2), 2), r2 = i2[0], o2 = i2[1];
n2 || (n2 = r2), n2 === r2 && (this.incCycle(e2, t2), o2());
}, once: function(e2, t2) {
return true !== this.private(e2, t2) && (this.putPrivate(e2, t2, true), true);
}, incCycle: function(e2, t2) {
var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function() {
}, i2 = C(this.private(e2, t2) || [0, n2], 2), r2 = i2[0];
i2[1];
return r2++, this.putPrivate(e2, t2, [r2, n2]), r2;
}, discardError: function(e2, t2, n2) {
var i2 = t2.getAttribute && t2.getAttribute(n2), r2 = i2 && e2.querySelector('[id="'.concat(i2, '"], [name="').concat(i2, '"]'));
r2 && (this.private(r2, "phx-has-focused") || this.private(r2.form, "phx-has-submitted") || t2.classList.add("phx-no-feedback"));
}, showError: function(e2, t2) {
var n2 = this;
(e2.id || e2.name) && this.all(e2.form, "[".concat(t2, '="').concat(e2.id, '"], [').concat(t2, '="').concat(e2.name, '"]'), function(e3) {
n2.removeClass(e3, "phx-no-feedback");
});
}, isPhxChild: function(e2) {
return e2.getAttribute && e2.getAttribute("data-phx-parent-id");
}, dispatchEvent: function(e2, t2) {
var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, i2 = new CustomEvent(t2, { bubbles: true, cancelable: true, detail: n2 });
e2.dispatchEvent(i2);
}, cloneNode: function(e2, t2) {
if (void 0 === t2) return e2.cloneNode(true);
var n2 = e2.cloneNode(false);
return n2.innerHTML = t2, n2;
}, mergeAttrs: function(e2, t2) {
for (var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, i2 = n2.exclude || [], r2 = n2.isIgnored, o2 = t2.attributes, a2 = o2.length - 1; a2 >= 0; a2--) {
var u2 = o2[a2].name;
i2.indexOf(u2) < 0 && e2.setAttribute(u2, t2.getAttribute(u2));
}
for (var s2 = e2.attributes, c2 = s2.length - 1; c2 >= 0; c2--) {
var l2 = s2[c2].name;
r2 ? l2.startsWith("data-") && !t2.hasAttribute(l2) && e2.removeAttribute(l2) : t2.hasAttribute(l2) || e2.removeAttribute(l2);
}
}, mergeFocusedInput: function(e2, t2) {
e2 instanceof HTMLSelectElement || de.mergeAttrs(e2, t2, { except: ["value"] }), t2.readOnly ? e2.setAttribute("readonly", true) : e2.removeAttribute("readonly");
}, hasSelectionRange: function(e2) {
return e2.setSelectionRange && ("text" === e2.type || "textarea" === e2.type);
}, restoreFocus: function(e2, t2, n2) {
if (de.isTextualInput(e2)) {
var i2 = e2.matches(":focus");
e2.readOnly && e2.blur(), i2 || e2.focus(), this.hasSelectionRange(e2) && e2.setSelectionRange(t2, n2);
}
}, isFormInput: function(e2) {
return /^(?:input|select|textarea)$/i.test(e2.tagName) && "button" !== e2.type;
}, syncAttrsToProps: function(e2) {
e2 instanceof HTMLInputElement && V.indexOf(e2.type.toLocaleLowerCase()) >= 0 && (e2.checked = null !== e2.getAttribute("checked"));
}, isTextualInput: function(e2) {
return J.indexOf(e2.type) >= 0;
}, isNowTriggerFormExternal: function(e2, t2) {
return e2.getAttribute && null !== e2.getAttribute(t2);
}, syncPendingRef: function(e2, t2, n2) {
var i2 = e2.getAttribute(F);
return null === i2 || (de.isFormInput(e2) || null !== e2.getAttribute(n2) ? (de.isUploadInput(e2) && de.mergeAttrs(e2, t2, { isIgnored: true }), de.putPrivate(e2, F, t2), false) : (H.forEach(function(n3) {
e2.classList.contains(n3) && t2.classList.add(n3);
}), t2.setAttribute(F, i2), true));
}, cleanChildNodes: function(e2, t2) {
if (de.isPhxUpdate(e2, t2, ["append", "prepend"])) {
var n2 = [];
e2.childNodes.forEach(function(e3) {
e3.id || (e3.nodeType === Node.TEXT_NODE && "" === e3.nodeValue.trim() || K("only HTML element tags with an id are allowed inside containers with phx-update.\n\n" + 'removing illegal node: "'.concat((e3.outerHTML || e3.nodeValue).trim(), '"\n\n')), n2.push(e3));
}), n2.forEach(function(e3) {
return e3.remove();
});
}
} }, he = function() {
function e2(t2, n2, i2) {
D(this, e2);
var r2 = /* @__PURE__ */ new Set(), o2 = new Set(w(n2.children).map(function(e3) {
return e3.id;
})), a2 = [];
Array.from(t2.children).forEach(function(e3) {
if (e3.id && (r2.add(e3.id), o2.has(e3.id))) {
var t3 = e3.previousElementSibling && e3.previousElementSibling.id;
a2.push({ elementId: e3.id, previousElementId: t3 });
}
}), this.containerId = n2.id, this.updateType = i2, this.elementsToModify = a2, this.elementIdsToAdd = w(o2).filter(function(e3) {
return !r2.has(e3);
});
}
return N(e2, [{ key: "perform", value: function() {
var e3 = de.byId(this.containerId);
this.elementsToModify.forEach(function(t2) {
t2.previousElementId ? ee(document.getElementById(t2.previousElementId), function(e4) {
ee(document.getElementById(t2.elementId), function(t3) {
t3.previousElementSibling && t3.previousElementSibling.id == e4.id || e4.insertAdjacentElement("afterend", t3);
});
}) : ee(document.getElementById(t2.elementId), function(t3) {
null == t3.previousElementSibling || e3.insertAdjacentElement("afterbegin", t3);
});
}), "prepend" == this.updateType && this.elementIdsToAdd.reverse().forEach(function(t2) {
ee(document.getElementById(t2), function(t3) {
return e3.insertAdjacentElement("afterbegin", t3);
});
});
} }]), e2;
}(), fe = function() {
function e2(t2, n2, i2, r2, o2) {
D(this, e2), this.view = t2, this.liveSocket = t2.liveSocket, this.container = n2, this.id = i2, this.rootID = t2.root.id, this.html = r2, this.targetCID = o2, this.cidPatch = "number" == typeof this.targetCID, this.callbacks = { beforeadded: [], beforeupdated: [], beforephxChildAdded: [], afteradded: [], afterupdated: [], afterdiscarded: [], afterphxChildAdded: [] };
}
return N(e2, null, [{ key: "patchEl", value: function(e3, t2, n2) {
k(e3, t2, { childrenOnly: false, onBeforeElUpdated: function(e4, t3) {
if (n2 && n2.isSameNode(e4) && de.isFormInput(e4)) return de.mergeFocusedInput(e4, t3), false;
} });
} }]), N(e2, [{ key: "before", value: function(e3, t2) {
this.callbacks["before".concat(e3)].push(t2);
} }, { key: "after", value: function(e3, t2) {
this.callbacks["after".concat(e3)].push(t2);
} }, { key: "trackBefore", value: function(e3) {
for (var t2 = arguments.length, n2 = new Array(t2 > 1 ? t2 - 1 : 0), i2 = 1; i2 < t2; i2++) n2[i2 - 1] = arguments[i2];
this.callbacks["before".concat(e3)].forEach(function(e4) {
return e4.apply(void 0, n2);
});
} }, { key: "trackAfter", value: function(e3) {
for (var t2 = arguments.length, n2 = new Array(t2 > 1 ? t2 - 1 : 0), i2 = 1; i2 < t2; i2++) n2[i2 - 1] = arguments[i2];
this.callbacks["after".concat(e3)].forEach(function(e4) {
return e4.apply(void 0, n2);
});
} }, { key: "markPrunableContentForRemoval", value: function() {
de.all(this.container, "[phx-update=append] > *, [phx-update=prepend] > *", function(e3) {
e3.setAttribute("data-phx-remove", "");
});
} }, { key: "perform", value: function() {
var e3 = this, t2 = this.view, n2 = this.liveSocket, i2 = this.container, r2 = this.html, o2 = this.isCIDPatch() ? this.targetCIDContainer(r2) : i2;
if (!this.isCIDPatch() || o2) {
var a2 = n2.getActiveElement(), u2 = a2 && de.hasSelectionRange(a2) ? a2 : {}, s2 = u2.selectionStart, c2 = u2.selectionEnd, l2 = n2.binding("update"), d2 = n2.binding("feedback-for"), h2 = n2.binding("disable-with"), f2 = n2.binding("trigger-action"), v2 = [], p2 = [], g2 = [], m2 = null, y2 = n2.time("premorph container prep", function() {
return e3.buildDiffHTML(i2, r2, l2, o2);
});
return this.trackBefore("added", i2), this.trackBefore("updated", i2, i2), n2.time("morphdom", function() {
k(o2, y2, { childrenOnly: null === o2.getAttribute(M), getNodeKey: function(e4) {
return de.isPhxDestroyed(e4) ? null : e4.id;
}, onBeforeNodeAdded: function(t3) {
return de.discardError(o2, t3, d2), e3.trackBefore("added", t3), t3;
}, onNodeAdded: function(n3) {
de.isNowTriggerFormExternal(n3, f2) && (m2 = n3), de.isPhxChild(n3) && t2.ownsElement(n3) && e3.trackAfter("phxChildAdded", n3), v2.push(n3);
}, onNodeDiscarded: function(t3) {
de.isPhxChild(t3) && n2.destroyViewByEl(t3), e3.trackAfter("discarded", t3);
}, onBeforeNodeDiscarded: function(t3) {
return !(!t3.getAttribute || null === t3.getAttribute("data-phx-remove")) || (null === t3.parentNode || !de.isPhxUpdate(t3.parentNode, l2, ["append", "prepend"]) || !t3.id) && !e3.skipCIDSibling(t3);
}, onElUpdated: function(e4) {
de.isNowTriggerFormExternal(e4, f2) && (m2 = e4), p2.push(e4);
}, onBeforeElUpdated: function(t3, n3) {
if (de.cleanChildNodes(n3, l2), e3.skipCIDSibling(n3)) return false;
if (de.isIgnored(t3, l2)) return e3.trackBefore("updated", t3, n3), de.mergeAttrs(t3, n3, { isIgnored: true }), p2.push(t3), false;
if ("number" === t3.type && t3.validity && t3.validity.badInput) return false;
if (!de.syncPendingRef(t3, n3, h2)) return de.isUploadInput(t3) && (e3.trackBefore("updated", t3, n3), p2.push(t3)), false;
if (de.isPhxChild(n3)) {
var i3 = t3.getAttribute("data-phx-session");
return de.mergeAttrs(t3, n3, { exclude: ["data-phx-static"] }), "" !== i3 && t3.setAttribute("data-phx-session", i3), t3.setAttribute("data-phx-root-id", e3.rootID), false;
}
return de.copyPrivates(n3, t3), de.discardError(o2, n3, d2), a2 && t3.isSameNode(a2) && de.isFormInput(t3) && !e3.forceFocusedSelectUpdate(t3, n3) ? (e3.trackBefore("updated", t3, n3), de.mergeFocusedInput(t3, n3), de.syncAttrsToProps(t3), p2.push(t3), false) : (de.isPhxUpdate(n3, l2, ["append", "prepend"]) && g2.push(new he(t3, n3, n3.getAttribute(l2))), de.syncAttrsToProps(n3), e3.trackBefore("updated", t3, n3), true);
} });
}), n2.isDebugEnabled() && function() {
for (var e4 = /* @__PURE__ */ new Set(), t3 = document.querySelectorAll("*[id]"), n3 = 0, i3 = t3.length; n3 < i3; n3++) e4.has(t3[n3].id) ? console.error("Multiple IDs detected: ".concat(t3[n3].id, ". Ensure unique element ids.")) : e4.add(t3[n3].id);
}(), g2.length > 0 && n2.time("post-morph append/prepend restoration", function() {
g2.forEach(function(e4) {
return e4.perform();
});
}), n2.silenceEvents(function() {
return de.restoreFocus(a2, s2, c2);
}), de.dispatchEvent(document, "phx:update"), v2.forEach(function(t3) {
return e3.trackAfter("added", t3);
}), p2.forEach(function(t3) {
return e3.trackAfter("updated", t3);
}), m2 && (n2.disconnect(), m2.submit()), true;
}
} }, { key: "forceFocusedSelectUpdate", value: function(e3, t2) {
var n2 = ["select", "select-one", "select-multiple"].find(function(t3) {
return t3 === e3.type;
});
return true === e3.multiple || n2 && e3.innerHTML != t2.innerHTML;
} }, { key: "isCIDPatch", value: function() {
return this.cidPatch;
} }, { key: "skipCIDSibling", value: function(e3) {
return e3.nodeType === Node.ELEMENT_NODE && null !== e3.getAttribute("data-phx-skip");
} }, { key: "targetCIDContainer", value: function(e3) {
if (this.isCIDPatch()) {
var t2 = b(de.findComponentNodeList(this.container, this.targetCID)), n2 = t2[0];
return 0 === t2.slice(1).length && 1 === de.childNodeLength(e3) ? n2 : n2 && n2.parentNode;
}
} }, { key: "buildDiffHTML", value: function(e3, t2, n2, i2) {
var r2 = this, o2 = this.isCIDPatch(), a2 = o2 && i2.getAttribute(M) === this.targetCID.toString();
if (!o2 || a2) return t2;
var u2 = null, s2 = document.createElement("template");
u2 = de.cloneNode(i2);
var c2 = b(de.findComponentNodeList(u2, this.targetCID)), l2 = c2[0], d2 = c2.slice(1);
return s2.innerHTML = t2, d2.forEach(function(e4) {
return e4.remove();
}), Array.from(u2.childNodes).forEach(function(e4) {
e4.id && e4.nodeType === Node.ELEMENT_NODE && e4.getAttribute(M) !== r2.targetCID.toString() && (e4.setAttribute("data-phx-skip", ""), e4.innerHTML = "");
}), Array.from(s2.content.childNodes).forEach(function(e4) {
return u2.insertBefore(e4, l2);
}), l2.remove(), u2.outerHTML;
} }]), e2;
}(), ve = function() {
function e2(t2, n2, i2, r2, o2) {
var a2 = this;
D(this, e2), this.liveSocket = n2, this.flash = o2, this.parent = i2, this.root = i2 ? i2.root : this, this.el = t2, this.id = this.el.id, this.view = this.el.getAttribute(j), this.ref = 0, this.childJoins = 0, this.loaderTimer = null, this.pendingDiffs = [], this.pruningCIDs = [], this.href = r2, this.joinCount = this.parent ? this.parent.joinCount - 1 : 0, this.joinPending = true, this.destroyed = false, 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:".concat(this.id), function() {
return { url: a2.href, params: a2.connectParams(), session: a2.getSession(), static: a2.getStatic(), flash: a2.flash };
}), this.showLoader(this.liveSocket.loaderTimeout), this.bindChannel();
}
return N(e2, [{ key: "isMain", value: function() {
return this.liveSocket.main === this;
} }, { key: "connectParams", value: function() {
var e3 = this.liveSocket.params(this.view), t2 = de.all(document, "[".concat(this.binding("track-static"), "]")).map(function(e4) {
return e4.src || e4.href;
}).filter(function(e4) {
return "string" == typeof e4;
});
return t2.length > 0 && (e3._track_static = t2), e3._mounts = this.joinCount, e3;
} }, { key: "name", value: function() {
return this.view;
} }, { key: "isConnected", value: function() {
return this.channel.canPush();
} }, { key: "getSession", value: function() {
return this.el.getAttribute("data-phx-session");
} }, { key: "getStatic", value: function() {
var e3 = this.el.getAttribute("data-phx-static");
return "" === e3 ? null : e3;
} }, { key: "destroy", value: function() {
var e3 = this, t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : function() {
};
this.destroyAllChildren(), this.destroyed = true, delete this.root.children[this.id], this.parent && delete this.root.children[this.parent.id][this.id], clearTimeout(this.loaderTimer);
var n2 = function() {
for (var n3 in t2(), e3.viewHooks) e3.destroyHook(e3.viewHooks[n3]);
};
de.markPhxChildDestroyed(this.el), this.log("destroyed", function() {
return ["the child has been removed from the parent"];
}), this.channel.leave().receive("ok", n2).receive("error", n2).receive("timeout", n2);
} }, { key: "setContainerClasses", value: function() {
var e3;
this.el.classList.remove("phx-connected", "phx-disconnected", "phx-error"), (e3 = this.el.classList).add.apply(e3, arguments);
} }, { key: "isLoading", value: function() {
return this.el.classList.contains("phx-disconnected");
} }, { key: "showLoader", value: function(e3) {
var t2 = this;
if (clearTimeout(this.loaderTimer), e3) this.loaderTimer = setTimeout(function() {
return t2.showLoader();
}, e3);
else {
for (var n2 in this.viewHooks) this.viewHooks[n2].__disconnected();
this.setContainerClasses("phx-disconnected");
}
} }, { key: "hideLoader", value: function() {
clearTimeout(this.loaderTimer), this.setContainerClasses("phx-connected");
} }, { key: "triggerReconnected", value: function() {
for (var e3 in this.viewHooks) this.viewHooks[e3].__reconnected();
} }, { key: "log", value: function(e3, t2) {
this.liveSocket.log(this, e3, t2);
} }, { key: "withinTargets", value: function(e3, t2) {
var n2 = this;
if (e3 instanceof HTMLElement) return this.liveSocket.owner(e3, function(n3) {
return t2(n3, e3);
});
if (/^(0|[1-9]\d*)$/.test(e3)) {
var i2 = de.findComponentNodeList(this.el, e3);
0 === i2.length ? K("no component found matching phx-target of ".concat(e3)) : t2(this, i2[0]);
} else {
var r2 = Array.from(document.querySelectorAll(e3));
0 === r2.length && K('nothing found matching the phx-target selector "'.concat(e3, '"')), r2.forEach(function(e4) {
return n2.liveSocket.owner(e4, function(n3) {
return t2(n3, e4);
});
});
}
} }, { key: "applyDiff", value: function(e3, t2, n2) {
this.log(e3, function() {
return ["", G(t2)];
});
var i2 = se.extract(t2), r2 = i2.diff, o2 = i2.reply, a2 = i2.events, u2 = i2.title;
return u2 && de.putTitle(u2), n2({ diff: r2, reply: o2, events: a2 }), o2;
} }, { key: "onJoin", value: function(e3) {
var t2 = this, n2 = e3.rendered;
this.childJoins = 0, this.joinPending = true, this.flash = null, le.dropLocal(this.liveSocket.localStorage, this.name(), "consecutive-reloads"), this.applyDiff("mount", n2, function(n3) {
var i2 = n3.diff, r2 = n3.events;
t2.rendered = new se(t2.id, i2);
var o2 = t2.renderContainer(null, "join");
t2.dropPendingRefs();
var a2 = t2.formsForRecovery(o2);
t2.joinCount++, a2.length > 0 ? a2.forEach(function(e4, n4) {
t2.pushFormRecovery(e4, function(e5) {
n4 === a2.length - 1 && t2.onJoinComplete(e5, o2, r2);
});
}) : t2.onJoinComplete(e3, o2, r2);
});
} }, { key: "dropPendingRefs", value: function() {
de.all(this.el, "[".concat(F, "]"), function(e3) {
return e3.removeAttribute(F);
});
} }, { key: "onJoinComplete", value: function(e3, t2, n2) {
var i2 = this, r2 = e3.live_patch;
if (this.joinCount > 1 || this.parent && !this.parent.isJoinPending()) return this.applyJoinPatch(r2, t2, n2);
0 === de.findPhxChildrenInFragment(t2, this.id).filter(function(e4) {
var t3 = e4.id && i2.el.querySelector("#".concat(e4.id)), n3 = t3 && t3.getAttribute("data-phx-static");
return n3 && e4.setAttribute("data-phx-static", n3), i2.joinChild(e4);
}).length ? this.parent ? (this.root.pendingJoinOps.push([this, function() {
return i2.applyJoinPatch(r2, t2, n2);
}]), this.parent.ackJoin(this)) : (this.onAllChildJoinsComplete(), this.applyJoinPatch(r2, t2, n2)) : this.root.pendingJoinOps.push([this, function() {
return i2.applyJoinPatch(r2, t2, n2);
}]);
} }, { key: "attachTrueDocEl", value: function() {
this.el = de.byId(this.id), this.el.setAttribute("data-phx-root-id", this.root.id);
} }, { key: "dispatchEvents", value: function(e3) {
e3.forEach(function(e4) {
var t2 = C(e4, 2), n2 = t2[0], i2 = t2[1];
window.dispatchEvent(new CustomEvent("phx:hook:".concat(n2), { detail: i2 }));
});
} }, { key: "applyJoinPatch", value: function(e3, t2, n2) {
var i2 = this;
this.attachTrueDocEl();
var r2 = new fe(this, this.el, this.id, t2, null);
if (r2.markPrunableContentForRemoval(), this.performPatch(r2, false), this.joinNewChildren(), de.all(this.el, "[".concat(this.binding("hook"), "], [data-phx-").concat("hook", "]"), function(e4) {
var t3 = i2.addHook(e4);
t3 && t3.__mounted();
}), this.joinPending = false, this.dispatchEvents(n2), this.applyPendingUpdates(), e3) {
var o2 = e3.kind, a2 = e3.to;
this.liveSocket.historyPatch(a2, o2);
}
this.hideLoader(), this.joinCount > 1 && this.triggerReconnected(), this.stopCallback();
} }, { key: "triggerBeforeUpdateHook", value: function(e3, t2) {
this.liveSocket.triggerDOM("onBeforeElUpdated", [e3, t2]);
var n2 = this.getHook(e3), i2 = n2 && de.isIgnored(e3, this.binding("update"));
if (n2 && !e3.isEqualNode(t2) && (!i2 || !function(e4, t3) {
return JSON.stringify(e4) === JSON.stringify(t3);
}(e3.dataset, t2.dataset))) return n2.__beforeUpdate(), n2;
} }, { key: "performPatch", value: function(e3, t2) {
var n2 = this, i2 = [], r2 = false, o2 = /* @__PURE__ */ new Set();
return e3.after("added", function(e4) {
n2.liveSocket.triggerDOM("onNodeAdded", [e4]);
var t3 = n2.addHook(e4);
t3 && t3.__mounted();
}), e3.after("phxChildAdded", function(e4) {
return r2 = true;
}), e3.before("updated", function(e4, t3) {
n2.triggerBeforeUpdateHook(e4, t3) && o2.add(e4.id);
}), e3.after("updated", function(e4) {
o2.has(e4.id) && n2.getHook(e4).__updated();
}), e3.after("discarded", function(e4) {
var t3 = n2.componentID(e4);
"number" == typeof t3 && -1 === i2.indexOf(t3) && i2.push(t3);
var r3 = n2.getHook(e4);
r3 && n2.destroyHook(r3);
}), e3.perform(), t2 && this.maybePushComponentsDestroyed(i2), r2;
} }, { key: "joinNewChildren", value: function() {
var e3 = this;
de.findPhxChildren(this.el, this.id).forEach(function(t2) {
return e3.joinChild(t2);
});
} }, { key: "getChildById", value: function(e3) {
return this.root.children[this.id][e3];
} }, { key: "getDescendentByEl", value: function(e3) {
return e3.id === this.id ? this : this.children[e3.getAttribute("data-phx-parent-id")][e3.id];
} }, { key: "destroyDescendent", value: function(e3) {
for (var t2 in this.root.children) for (var n2 in this.root.children[t2]) if (n2 === e3) return this.root.children[t2][n2].destroy();
} }, { key: "joinChild", value: function(t2) {
if (!this.getChildById(t2.id)) {
var n2 = new e2(t2, this.liveSocket, this);
return this.root.children[this.id][n2.id] = n2, n2.join(), this.childJoins++, true;
}
} }, { key: "isJoinPending", value: function() {
return this.joinPending;
} }, { key: "ackJoin", value: function(e3) {
this.childJoins--, 0 === this.childJoins && (this.parent ? this.parent.ackJoin(this) : this.onAllChildJoinsComplete());
} }, { key: "onAllChildJoinsComplete", value: function() {
this.joinCallback(), this.pendingJoinOps.forEach(function(e3) {
var t2 = C(e3, 2), n2 = t2[0], i2 = t2[1];
n2.isDestroyed() || i2();
}), this.pendingJoinOps = [];
} }, { key: "update", value: function(e3, t2) {
var n2 = this;
if (this.isJoinPending() || this.liveSocket.hasPendingLink()) return this.pendingDiffs.push({ diff: e3, events: t2 });
this.rendered.mergeDiff(e3);
var i2 = false;
this.rendered.isComponentOnlyDiff(e3) ? this.liveSocket.time("component patch complete", function() {
de.findParentCIDs(n2.el, n2.rendered.componentCIDs(e3)).forEach(function(t3) {
n2.componentPatch(n2.rendered.getComponent(e3, t3), t3) && (i2 = true);
});
}) : Z(e3) || this.liveSocket.time("full patch complete", function() {
var t3 = n2.renderContainer(e3, "update"), r2 = new fe(n2, n2.el, n2.id, t3, null);
i2 = n2.performPatch(r2, true);
}), this.dispatchEvents(t2), i2 && this.joinNewChildren();
} }, { key: "renderContainer", value: function(e3, t2) {
var n2 = this;
return this.liveSocket.time("toString diff (".concat(t2, ")"), function() {
var t3 = n2.el.tagName, i2 = e3 ? n2.rendered.componentCIDs(e3).concat(n2.pruningCIDs) : null, r2 = n2.rendered.toString(i2);
return "<".concat(t3, ">").concat(r2, "</").concat(t3, ">");
});
} }, { key: "componentPatch", value: function(e3, t2) {
if (Z(e3)) return false;
var n2 = this.rendered.componentToString(t2), i2 = new fe(this, this.el, this.id, n2, t2);
return this.performPatch(i2, true);
} }, { key: "getHook", value: function(e3) {
return this.viewHooks[ge.elementID(e3)];
} }, { key: "addHook", value: function(e3) {
if (!ge.elementID(e3) && e3.getAttribute) {
var t2 = e3.getAttribute("data-phx-".concat("hook")) || e3.getAttribute(this.binding("hook"));
if (!t2 || this.ownsElement(e3)) {
var n2 = this.liveSocket.getHookCallbacks(t2);
if (n2) {
e3.id || K('no DOM ID for hook "'.concat(t2, '". Hooks require a unique ID on each element.'), e3);
var i2 = new ge(this, e3, n2);
return this.viewHooks[ge.elementID(i2.el)] = i2, i2;
}
null !== t2 && K('unknown hook found for "'.concat(t2, '"'), e3);
}
}
} }, { key: "destroyHook", value: function(e3) {
e3.__destroyed(), e3.__cleanup__(), delete this.viewHooks[ge.elementID(e3.el)];
} }, { key: "applyPendingUpdates", value: function() {
var e3 = this;
this.pendingDiffs.forEach(function(t2) {
var n2 = t2.diff, i2 = t2.events;
return e3.update(n2, i2);
}), this.pendingDiffs = [];
} }, { key: "onChannel", value: function(e3, t2) {
var n2 = this;
this.liveSocket.onChannel(this.channel, e3, function(e4) {
n2.isJoinPending() ? n2.root.pendingJoinOps.push([n2, function() {
return t2(e4);
}]) : t2(e4);
});
} }, { key: "bindChannel", value: function() {
var e3 = this;
this.liveSocket.onChannel(this.channel, "diff", function(t2) {
e3.applyDiff("update", t2, function(t3) {
var n2 = t3.diff, i2 = t3.events;
return e3.update(n2, i2);
});
}), this.onChannel("redirect", function(t2) {
var n2 = t2.to, i2 = t2.flash;
return e3.onRedirect({ to: n2, flash: i2 });
}), this.onChannel("live_patch", function(t2) {
return e3.onLivePatch(t2);
}), this.onChannel("live_redirect", function(t2) {
return e3.onLiveRedirect(t2);
}), this.channel.onError(function(t2) {
return e3.onError(t2);
}), this.channel.onClose(function(t2) {
return e3.onClose(t2);
});
} }, { key: "destroyAllChildren", value: function() {
for (var e3 in this.root.children[this.id]) this.getChildById(e3).destroy();
} }, { key: "onLiveRedirect", value: function(e3) {
var t2 = e3.to, n2 = e3.kind, i2 = e3.flash, r2 = this.expandURL(t2);
this.liveSocket.historyRedirect(r2, n2, i2);
} }, { key: "onLivePatch", value: function(e3) {
var t2 = e3.to, n2 = e3.kind;
this.href = this.expandURL(t2), this.liveSocket.historyPatch(t2, n2);
} }, { key: "expandURL", value: function(e3) {
return e3.startsWith("/") ? "".concat(window.location.protocol, "//").concat(window.location.host).concat(e3) : e3;
} }, { key: "onRedirect", value: function(e3) {
var t2 = e3.to, n2 = e3.flash;
this.liveSocket.redirect(t2, n2);
} }, { key: "isDestroyed", value: function() {
return this.destroyed;
} }, { key: "join", value: function(e3) {
var t2 = this;
this.parent || (this.stopCallback = this.liveSocket.withPageLoading({ to: this.href, kind: "initial" })), this.joinCallback = function() {
return e3 && e3(t2, t2.joinCount);
}, this.liveSocket.wrapPush(this, { timeout: false }, function() {
return t2.channel.join().receive("ok", function(e4) {
return t2.onJoin(e4);
}).receive("error", function(e4) {
return t2.onJoinError(e4);
}).receive("timeout", function() {
return t2.onJoinError({ reason: "timeout" });
});
});
} }, { key: "onJoinError", value: function(e3) {
return (e3.redirect || e3.live_redirect) && (this.joinPending = false, this.channel.leave()), e3.redirect ? this.onRedirect(e3.redirect) : e3.live_redirect ? this.onLiveRedirect(e3.live_redirect) : (this.log("error", function() {
return ["unable to join", e3];
}), this.liveSocket.reloadWithJitter(this));
} }, { key: "onClose", value: function(e3) {
if (!this.isDestroyed()) {
if (this.isJoinPending() && "hidden" !== document.visibilityState || this.liveSocket.hasPendingLink() && "leave" !== e3) return this.liveSocket.reloadWithJitter(this);
this.destroyAllChildren(), this.liveSocket.dropActiveElement(this), document.activeElement && document.activeElement.blur(), this.liveSocket.isUnloaded() && this.showLoader(200);
}
} }, { key: "onError", value: function(e3) {
this.onClose(e3), this.log("error", function() {
return ["view crashed", e3];
}), this.liveSocket.isUnloaded() || this.displayError();
} }, { key: "displayError", value: function() {
this.isMain() && de.dispatchEvent(window, "phx:page-loading-start", { to: this.href, kind: "error" }), this.showLoader(), this.setContainerClasses("phx-disconnected", "phx-error");
} }, { key: "pushWithReply", value: function(e3, t2, n2) {
var i2 = this, r2 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function() {
};
if (this.isConnected()) {
var o2 = C(e3 ? e3() : [null, []], 2), a2 = o2[0], u2 = C(o2[1], 1)[0], s2 = function() {
};
return u2 && null !== u2.getAttribute(this.binding("page-loading")) && (s2 = this.liveSocket.withPageLoading({ kind: "element", target: u2 })), "number" != typeof n2.cid && delete n2.cid, this.liveSocket.wrapPush(this, { timeout: true }, function() {
return i2.channel.push(t2, n2, 3e4).receive("ok", function(e4) {
var t3 = null;
null !== a2 && i2.undoRefs(a2), e4.diff && (t3 = i2.applyDiff("update", e4.diff, function(e5) {
var t4 = e5.diff, n3 = e5.events;
i2.update(t4, n3);
})), e4.redirect && i2.onRedirect(e4.redirect), e4.live_patch && i2.onLivePatch(e4.live_patch), e4.live_redirect && i2.onLiveRedirect(e4.live_redirect), s2(), r2(e4, t3);
});
});
}
} }, { key: "undoRefs", value: function(e3) {
var t2 = this;
de.all(this.el, "[".concat(F, '="').concat(e3, '"]'), function(e4) {
e4.removeAttribute(F), null !== e4.getAttribute("data-phx-readonly") && (e4.readOnly = false, e4.removeAttribute("data-phx-readonly")), null !== e4.getAttribute("data-phx-disabled") && (e4.disabled = false, e4.removeAttribute("data-phx-disabled")), H.forEach(function(t3) {
return de.removeClass(e4, t3);
});
var n2 = e4.getAttribute("data-phx-disable-with-restore");
null !== n2 && (e4.innerText = n2, e4.removeAttribute("data-phx-disable-with-restore"));
var i2 = de.private(e4, F);
if (i2) {
var r2 = t2.triggerBeforeUpdateHook(e4, i2);
fe.patchEl(e4, i2, t2.liveSocket.getActiveElement()), r2 && r2.__updated(), de.deletePrivate(e4, F);
}
});
} }, { key: "putRef", value: function(e3, t2) {
var n2 = this.ref++, i2 = this.binding("disable-with");
return e3.forEach(function(e4) {
e4.classList.add("phx-".concat(t2, "-loading")), e4.setAttribute(F, n2);
var r2 = e4.getAttribute(i2);
null !== r2 && (e4.getAttribute("data-phx-disable-with-restore") || e4.setAttribute("data-phx-disable-with-restore", e4.innerText), e4.innerText = r2);
}), [n2, e3];
} }, { key: "componentID", value: function(e3) {
var t2 = e3.getAttribute && e3.getAttribute(M);
return t2 ? parseInt(t2) : null;
} }, { key: "targetComponentID", value: function(e3, t2) {
return e3.getAttribute(this.binding("target")) ? this.closestComponentID(t2) : null;
} }, { key: "closestComponentID", value: function(e3) {
var t2 = this;
return e3 ? ee(e3.closest("[".concat(M, "]")), function(e4) {
return t2.ownsElement(e4) && t2.componentID(e4);
}) : null;
} }, { key: "pushHookEvent", value: function(e3, t2, n2, i2) {
if (!this.isConnected()) return this.log("hook", function() {
return ["unable to push hook event. LiveView not connected", t2, n2];
}), false;
var r2 = C(this.putRef([], "hook"), 2), o2 = r2[0], a2 = r2[1];
return this.pushWithReply(function() {
return [o2, a2];
}, "event", { type: "hook", event: t2, value: n2, cid: this.closestComponentID(e3) }, function(e4, t3) {
return i2(t3, o2);
}), o2;
} }, { key: "extractMeta", value: function(e3, t2) {
for (var n2 = this.binding("value-"), i2 = 0; i2 < e3.attributes.length; i2++) {
var r2 = e3.attributes[i2].name;
r2.startsWith(n2) && (t2[r2.replace(n2, "")] = e3.getAttribute(r2));
}
return void 0 !== e3.value && (t2.value = e3.value, "INPUT" === e3.tagName && V.indexOf(e3.type) >= 0 && !e3.checked && delete t2.value), t2;
} }, { key: "pushEvent", value: function(e3, t2, n2, i2, r2) {
var o2 = this;
this.pushWithReply(function() {
return o2.putRef([t2], e3);
}, "event", { type: e3, event: i2, value: this.extractMeta(t2, r2), cid: this.targetComponentID(t2, n2) });
} }, { key: "pushKey", value: function(e3, t2, n2, i2, r2) {
var o2 = this;
this.pushWithReply(function() {
return o2.putRef([e3], n2);
}, "event", { type: n2, event: i2, value: this.extractMeta(e3, r2), cid: this.targetComponentID(e3, t2) });
} }, { key: "pushFileProgress", value: function(e3, t2, n2) {
var i2 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function() {
};
this.liveSocket.withinOwners(e3.form, function(r2, o2) {
r2.pushWithReply(null, "progress", { event: e3.getAttribute(r2.binding("progress")), ref: e3.getAttribute(U), entry_ref: t2, progress: n2, cid: r2.targetComponentID(e3.form, o2) }, i2);
});
} }, { key: "pushInput", value: function(e3, t2, n2, i2, r2) {
var o2 = this, a2 = this.targetComponentID(e3.form, t2), u2 = function() {
return o2.putRef([e3, e3.form], "change");
}, s2 = ue(e3.form, { _target: i2.name });
e3.files && e3.files.length > 0 && re.trackFiles(e3, Array.from(e3.files));
var c2 = { type: "form", event: n2, value: s2, uploads: re.serializeUploads(e3), cid: a2 };
this.pushWithReply(u2, "event", c2, function(n3) {
if (de.showError(e3, o2.liveSocket.binding("feedback-for")), de.isUploadInput(e3) && null !== e3.getAttribute("data-phx-auto-upload")) {
if (re.filesAwaitingPreflight(e3).length > 0) {
var i3 = C(u2(), 2), s3 = i3[0];
i3[1];
o2.uploadFiles(e3.form, t2, s3, a2, function(t3) {
r2 && r2(n3), o2.triggerAwaitingSubmit(e3.form);
});
}
} else r2 && r2(n3);
});
} }, { key: "triggerAwaitingSubmit", value: function(e3) {
var t2 = this.getScheduledSubmit(e3);
if (t2) {
var n2 = C(t2, 3), i2 = (n2[0], n2[1], n2[2]);
this.cancelSubmit(e3), i2();
}
} }, { key: "getScheduledSubmit", value: function(e3) {
return this.formSubmits.find(function(t2) {
var n2 = C(t2, 2), i2 = n2[0];
n2[1];
return i2.isSameNode(e3);
});
} }, { key: "scheduleSubmit", value: function(e3, t2, n2) {
if (this.getScheduledSubmit(e3)) return true;
this.formSubmits.push([e3, t2, n2]);
} }, { key: "cancelSubmit", value: function(e3) {
var t2 = this;
this.formSubmits = this.formSubmits.filter(function(n2) {
var i2 = C(n2, 3), r2 = i2[0], o2 = i2[1];
i2[2];
return !r2.isSameNode(e3) || (t2.undoRefs(o2), false);
});
} }, { key: "pushFormSubmit", value: function(e3, t2, n2, i2) {
var r2 = this, o2 = function(e4) {
return !(Y(e4, "".concat(r2.binding("update"), "=ignore"), e4.form) || Y(e4, "data-phx-update=ignore", e4.form));
}, a2 = function(e4) {
return e4.hasAttribute(r2.binding("disable-with"));
}, u2 = function(e4) {
return "BUTTON" == e4.tagName;
}, s2 = function(e4) {
return ["INPUT", "TEXTAREA", "SELECT"].includes(e4.tagName);
}, c2 = function() {
var t3 = Array.from(e3.elements), n3 = t3.filter(a2), i3 = t3.filter(u2).filter(o2), c3 = t3.filter(s2).filter(o2);
return i3.forEach(function(e4) {
e4.setAttribute("data-phx-disabled", e4.disabled), e4.disabled = true;
}), c3.forEach(function(e4) {
e4.setAttribute("data-phx-readonly", e4.readOnly), e4.readOnly = true, e4.files && (e4.setAttribute("data-phx-disabled", e4.disabled), e4.disabled = true);
}), e3.setAttribute(r2.binding("page-loading"), ""), r2.putRef([e3].concat(n3).concat(i3).concat(c3), "submit");
}, l2 = this.targetComponentID(e3, t2);
if (re.hasUploadsInProgress(e3)) {
var d2 = C(c2(), 2), h2 = d2[0];
d2[1];
return this.scheduleSubmit(e3, h2, function() {
return r2.pushFormSubmit(e3, t2, n2, i2);
});
}
if (re.inputsAwaitingPreflight(e3).length > 0) {
var f2 = C(c2(), 2), v2 = f2[0], p2 = f2[1], g2 = function() {
return [v2, p2];
};
this.uploadFiles(e3, t2, v2, l2, function(t3) {
var o3 = ue(e3, {});
r2.pushWithReply(g2, "event", { type: "form", event: n2, value: o3, cid: l2 }, i2);
});
} else {
var m2 = ue(e3);
this.pushWithReply(c2, "event", { type: "form", event: n2, value: m2, cid: l2 }, i2);
}
} }, { key: "uploadFiles", value: function(e3, t2, n2, i2, r2) {
var o2 = this, a2 = this.joinCount;
re.activeFileInputs(e3).forEach(function(e4) {
var i3 = new re(e4, o2, r2);
o2.uploaders[e4] = i3;
var u2 = i3.entries().map(function(e5) {
return e5.toPreflightPayload();
}), s2 = { ref: e4.getAttribute(U), entries: u2, cid: o2.targetComponentID(e4.form, t2) };
o2.log("upload", function() {
return ["sending preflight request", s2];
}), o2.pushWithReply(null, "allow_upload", s2, function(e5) {
if (o2.log("upload", function() {
return ["got preflight response", e5];
}), e5.error) {
o2.undoRefs(n2);
var t3 = C(e5.error, 2), r3 = t3[0], u3 = t3[1];
o2.log("upload", function() {
return ["error for entry ".concat(r3), u3];
});
} else {
i3.initAdapterUpload(e5, function(e6) {
o2.channel.onError(function() {
o2.joinCount === a2 && e6();
});
}, o2.liveSocket);
}
});
});
} }, { key: "pushFormRecovery", value: function(e3, t2) {
var n2 = this;
this.liveSocket.withinOwners(e3, function(i2, r2) {
var o2 = e3.elements[0], a2 = e3.getAttribute(n2.binding("auto-recover")) || e3.getAttribute(n2.binding("change"));
i2.pushInput(o2, r2, a2, o2, t2);
});
} }, { key: "pushLinkPatch", value: function(e3, t2, n2) {
var i2 = this, r2 = this.liveSocket.setPendingLink(e3), o2 = t2 ? function() {
return i2.putRef([t2], "click");
} : null;
this.pushWithReply(o2, "link", { url: e3 }, function(t3) {
t3.link_redirect ? i2.liveSocket.replaceMain(e3, null, n2, r2) : (i2.liveSocket.commitPendingLink(r2) && (i2.href = e3), i2.applyPendingUpdates(), n2 && n2(r2));
}).receive("timeout", function() {
return i2.liveSocket.redirect(window.location.href);
});
} }, { key: "formsForRecovery", value: function(e3) {
var t2 = this;
if (0 === this.joinCount) return [];
var n2 = this.binding("change"), i2 = document.createElement("template");
return i2.innerHTML = e3, de.all(this.el, "form[".concat(n2, "]")).filter(function(e4) {
return t2.ownsElement(e4);
}).filter(function(e4) {
return e4.elements.length > 0;
}).filter(function(e4) {
return "ignore" !== e4.getAttribute(t2.binding("auto-recover"));
}).filter(function(e4) {
return i2.content.querySelector("form[".concat(n2, '="').concat(e4.getAttribute(n2), '"]'));
});
} }, { key: "maybePushComponentsDestroyed", value: function(e3) {
var t2, n2 = this, i2 = e3.filter(function(e4) {
return 0 === de.findComponentNodeList(n2.el, e4).length;
});
i2.length > 0 && ((t2 = this.pruningCIDs).push.apply(t2, w(i2)), this.pushWithReply(null, "cids_will_destroy", { cids: i2 }, function() {
n2.pruningCIDs = n2.pruningCIDs.filter(function(e5) {
return -1 !== i2.indexOf(e5);
});
var e4 = i2.filter(function(e5) {
return 0 === de.findComponentNodeList(n2.el, e5).length;
});
e4.length > 0 && n2.pushWithReply(null, "cids_destroyed", { cids: e4 }, function(e5) {
n2.rendered.pruneCIDs(e5.cids);
});
}));
} }, { key: "ownsElement", value: function(e3) {
return e3.getAttribute("data-phx-parent-id") === this.id || ee(e3.closest(B), function(e4) {
return e4.id;
}) === this.id;
} }, { key: "submitForm", value: function(e3, t2, n2) {
var i2 = this;
de.putPrivate(e3, "phx-has-submitted", true), this.liveSocket.blurActiveElement(this), this.pushFormSubmit(e3, t2, n2, function() {
i2.liveSocket.restorePreviouslyActiveFocus();
});
} }, { key: "binding", value: function(e3) {
return this.liveSocket.binding(e3);
} }]), e2;
}(), pe = 1, ge = function() {
function e2(t2, n2, i2) {
for (var r2 in D(this, e2), this.__view = t2, this.__liveSocket = t2.liveSocket, this.__callbacks = i2, this.__listeners = /* @__PURE__ */ new Set(), this.__isDisconnected = false, this.el = n2, this.viewName = t2.name(), this.el.phxHookId = this.constructor.makeID(), this.__callbacks) this[r2] = this.__callbacks[r2];
}
return N(e2, null, [{ key: "makeID", value: function() {
return pe++;
} }, { key: "elementID", value: function(e3) {
return e3.phxHookId;
} }]), N(e2, [{ key: "__mounted", value: function() {
this.mounted && this.mounted();
} }, { key: "__updated", value: function() {
this.updated && this.updated();
} }, { key: "__beforeUpdate", value: function() {
this.beforeUpdate && this.beforeUpdate();
} }, { key: "__destroyed", value: function() {
this.destroyed && this.destroyed();
} }, { key: "__reconnected", value: function() {
this.__isDisconnected && (this.__isDisconnected = false, this.reconnected && this.reconnected());
} }, { key: "__disconnected", value: function() {
this.__isDisconnected = true, this.disconnected && this.disconnected();
} }, { key: "pushEvent", value: function(e3) {
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function() {
};
return this.__view.pushHookEvent(null, e3, t2, n2);
} }, { key: "pushEventTo", value: function(e3, t2) {
var n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, i2 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : function() {
};
return this.__view.withinTargets(e3, function(e4, r2) {
return e4.pushHookEvent(r2, t2, n2, i2);
});
} }, { key: "handleEvent", value: function(e3, t2) {
var n2 = function(n3, i2) {
return i2 ? e3 : t2(n3.detail);
};
return window.addEventListener("phx:hook:".concat(e3), n2), this.__listeners.add(n2), n2;
} }, { key: "removeHandleEvent", value: function(e3) {
var t2 = e3(null, true);
window.removeEventListener("phx:hook:".concat(t2), e3), this.__listeners.delete(e3);
} }, { key: "__cleanup__", value: function() {
var e3 = this;
this.__listeners.forEach(function(t2) {
return e3.removeHandleEvent(t2);
});
} }]), e2;
}();
t.default = ce;
}, function(e, t) {
var n;
n = /* @__PURE__ */ function() {
return this;
}();
try {
n = n || Function("return this")() || (0, eval)("this");
} catch (e2) {
"object" == typeof window && (n = window);
}
e.exports = n;
}, function(e, t, n) {
(function(t2) {
t2.Phoenix || (t2.Phoenix = {}), e.exports = t2.Phoenix.LiveView = n(0);
}).call(this, n(1));
}]);
});
}
});
// js/live.js
var import_phoenix = __toESM(require_phoenix());
var import_phoenix_live_view = __toESM(require_phoenix_live_view());
var csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content");
var liveSocket = new import_phoenix_live_view.LiveSocket("/live", import_phoenix.Socket, { params: { _csrf_token: csrfToken } });
liveSocket.connect();
window.liveSocket = liveSocket;
})();