@forgebuild/sidon-booking-widget 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/elements.d.ts +1 -0
- package/dist/sidon-berth-map.js +2 -11
- package/dist/sidon-booking-widget.js +542 -534
- package/package.json +1 -1
|
@@ -28,8 +28,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
28
28
|
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region node_modules/svelte/src/constants.js
|
|
31
|
-
var d = {}, f = Symbol("uninitialized"), p = "http://www.w3.org/1999/xhtml", m = "http://www.w3.org/2000/svg", h = Array.isArray, g = Array.prototype.indexOf, _ = Array.prototype.includes, v = Array.from, y = Object.keys, b = Object.defineProperty, x = Object.getOwnPropertyDescriptor, S = Object.getOwnPropertyDescriptors,
|
|
32
|
-
function
|
|
31
|
+
var d = {}, f = Symbol("uninitialized"), p = "http://www.w3.org/1999/xhtml", m = "http://www.w3.org/2000/svg", h = Array.isArray, g = Array.prototype.indexOf, _ = Array.prototype.includes, v = Array.from, y = Object.keys, b = Object.defineProperty, x = Object.getOwnPropertyDescriptor, S = Object.getOwnPropertyDescriptors, ee = Object.prototype, C = Array.prototype, w = Object.getPrototypeOf, T = Object.isExtensible, E = () => {};
|
|
32
|
+
function D(e) {
|
|
33
33
|
for (var t = 0; t < e.length; t++) e[t]();
|
|
34
34
|
}
|
|
35
35
|
function O() {
|
|
@@ -184,7 +184,7 @@ function Ze() {
|
|
|
184
184
|
var Qe = [];
|
|
185
185
|
function $e() {
|
|
186
186
|
var e = Qe;
|
|
187
|
-
Qe = [],
|
|
187
|
+
Qe = [], D(e);
|
|
188
188
|
}
|
|
189
189
|
function et(e) {
|
|
190
190
|
if (Qe.length === 0 && !It) {
|
|
@@ -613,7 +613,7 @@ function kt(e) {
|
|
|
613
613
|
function At(e) {
|
|
614
614
|
if (e.effects !== null) for (let t of e.effects) (t.teardown || t.ac) && (t.teardown?.(), t.ac !== null && pt(() => {
|
|
615
615
|
t.ac.abort(be), t.ac = null;
|
|
616
|
-
}), t.fn !== null && (t.teardown =
|
|
616
|
+
}), t.fn !== null && (t.teardown = E), fr(t, 0), Pn(t));
|
|
617
617
|
}
|
|
618
618
|
function jt(e) {
|
|
619
619
|
if (e.effects !== null) for (let t of e.effects) t.teardown && t.fn !== null && pr(t);
|
|
@@ -989,8 +989,8 @@ function rn(e, t, n) {
|
|
|
989
989
|
}
|
|
990
990
|
function an(e) {
|
|
991
991
|
if (typeof e != "object" || !e || fe in e) return e;
|
|
992
|
-
let t =
|
|
993
|
-
if (t !==
|
|
992
|
+
let t = w(e);
|
|
993
|
+
if (t !== ee && t !== C) return e;
|
|
994
994
|
var n = /* @__PURE__ */ new Map(), r = h(e), i = /* @__PURE__ */ V(0), a = null, o = ar, s = (e) => {
|
|
995
995
|
if (ar === o) return e();
|
|
996
996
|
var t = K, n = ar;
|
|
@@ -1088,7 +1088,7 @@ function un() {
|
|
|
1088
1088
|
if (on === void 0) {
|
|
1089
1089
|
on = window, sn = /Firefox/.test(navigator.userAgent);
|
|
1090
1090
|
var e = Element.prototype, t = Node.prototype, n = Text.prototype;
|
|
1091
|
-
cn = x(t, "firstChild").get, ln = x(t, "nextSibling").get,
|
|
1091
|
+
cn = x(t, "firstChild").get, ln = x(t, "nextSibling").get, T(e) && (e[ge] = void 0, e[he] = null, e[_e] = void 0, e.__e = void 0), T(n) && (n[ve] = void 0);
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
function dn(e = "") {
|
|
@@ -1520,7 +1520,7 @@ function yr(e, t = /* @__PURE__ */ new Set()) {
|
|
|
1520
1520
|
for (let n in e) try {
|
|
1521
1521
|
yr(e[n], t);
|
|
1522
1522
|
} catch {}
|
|
1523
|
-
let n =
|
|
1523
|
+
let n = w(e);
|
|
1524
1524
|
if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
|
|
1525
1525
|
let t = S(n);
|
|
1526
1526
|
for (let n in t) {
|
|
@@ -1936,10 +1936,10 @@ function Qr(e, t, n, r, i) {
|
|
|
1936
1936
|
if (f.length < p.length) {
|
|
1937
1937
|
var b = p[0], x;
|
|
1938
1938
|
u = b.prev;
|
|
1939
|
-
var S = f[0],
|
|
1939
|
+
var S = f[0], ee = f[f.length - 1];
|
|
1940
1940
|
for (x = 0; x < f.length; x += 1) ei(f[x], b, n);
|
|
1941
1941
|
for (x = 0; x < p.length; x += 1) l.delete(p[x]);
|
|
1942
|
-
ti(e, S.prev,
|
|
1942
|
+
ti(e, S.prev, ee.next), ti(e, u, S), ti(e, ee, b), c = b, u = ee, --_, f = [], p = [];
|
|
1943
1943
|
} else l.delete(g), ei(g, c, n), ti(e, g.prev, g.next), ti(e, g, u === null ? e.effect.first : u.next), ti(e, u, g), u = g;
|
|
1944
1944
|
continue;
|
|
1945
1945
|
}
|
|
@@ -1953,17 +1953,17 @@ function Qr(e, t, n, r, i) {
|
|
|
1953
1953
|
e.outrogroups.size === 0 && (e.outrogroups = null);
|
|
1954
1954
|
}
|
|
1955
1955
|
if (c !== null || l !== void 0) {
|
|
1956
|
-
var
|
|
1957
|
-
if (l !== void 0) for (g of l) g.f & 8192 ||
|
|
1958
|
-
for (; c !== null;) !(c.f & 8192) && c !== e.fallback &&
|
|
1959
|
-
var
|
|
1960
|
-
if (
|
|
1961
|
-
var
|
|
1956
|
+
var C = [];
|
|
1957
|
+
if (l !== void 0) for (g of l) g.f & 8192 || C.push(g);
|
|
1958
|
+
for (; c !== null;) !(c.f & 8192) && c !== e.fallback && C.push(c), c = Zr(c.next);
|
|
1959
|
+
var w = C.length;
|
|
1960
|
+
if (w > 0) {
|
|
1961
|
+
var T = r & 4 && o === 0 ? n : null;
|
|
1962
1962
|
if (a) {
|
|
1963
|
-
for (_ = 0; _ <
|
|
1964
|
-
for (_ = 0; _ <
|
|
1963
|
+
for (_ = 0; _ < w; _ += 1) C[_].nodes?.a?.measure();
|
|
1964
|
+
for (_ = 0; _ < w; _ += 1) C[_].nodes?.a?.fix();
|
|
1965
1965
|
}
|
|
1966
|
-
qr(e,
|
|
1966
|
+
qr(e, C, T);
|
|
1967
1967
|
}
|
|
1968
1968
|
}
|
|
1969
1969
|
a && et(() => {
|
|
@@ -2171,7 +2171,7 @@ function Si(e) {
|
|
|
2171
2171
|
xi.set(t, n = []);
|
|
2172
2172
|
for (var r, i = e, a = Element.prototype; a !== i;) {
|
|
2173
2173
|
for (var o in r = S(i), r) r[o].set && o !== "innerHTML" && o !== "textContent" && o !== "innerText" && n.push(o);
|
|
2174
|
-
i =
|
|
2174
|
+
i = w(i);
|
|
2175
2175
|
}
|
|
2176
2176
|
return n;
|
|
2177
2177
|
}
|
|
@@ -3096,7 +3096,7 @@ function ha(e, t) {
|
|
|
3096
3096
|
var t = ie(), r = t.weekWrapper, i = t.weekNumbers;
|
|
3097
3097
|
n.innerContainer.appendChild(r), n.weekNumbers = i, n.weekWrapper = r;
|
|
3098
3098
|
}
|
|
3099
|
-
n.rContainer = Ki("div", "flatpickr-rContainer"), n.rContainer.appendChild(ne()), n.daysContainer || (n.daysContainer = Ki("div", "flatpickr-days"), n.daysContainer.tabIndex = -1),
|
|
3099
|
+
n.rContainer = Ki("div", "flatpickr-rContainer"), n.rContainer.appendChild(ne()), n.daysContainer || (n.daysContainer = Ki("div", "flatpickr-days"), n.daysContainer.tabIndex = -1), D(), n.rContainer.appendChild(n.daysContainer), n.innerContainer.appendChild(n.rContainer), e.appendChild(n.innerContainer);
|
|
3100
3100
|
}
|
|
3101
3101
|
n.config.enableTime && e.appendChild(te()), Gi(n.calendarContainer, "rangeMode", n.config.mode === "range"), Gi(n.calendarContainer, "animate", n.config.animate === !0), Gi(n.calendarContainer, "multiMonth", n.config.showMonths > 1), n.calendarContainer.appendChild(e);
|
|
3102
3102
|
var a = n.config.appendTo !== void 0 && n.config.appendTo.nodeType !== void 0;
|
|
@@ -3110,39 +3110,39 @@ function ha(e, t) {
|
|
|
3110
3110
|
var a = de(t, !0), o = Ki("span", e, t.getDate().toString());
|
|
3111
3111
|
return o.dateObj = t, o.$i = i, o.setAttribute("aria-label", n.formatDate(t, n.config.ariaDateFormat)), e.indexOf("hidden") === -1 && ia(t, n.now) === 0 && (n.todayDateElem = o, o.classList.add("today"), o.setAttribute("aria-current", "date")), a ? (o.tabIndex = -1, P(t) && (o.classList.add("selected"), n.selectedDateElem = o, n.config.mode === "range" && (Gi(o, "startRange", n.selectedDates[0] && ia(t, n.selectedDates[0], !0) === 0), Gi(o, "endRange", n.selectedDates[1] && ia(t, n.selectedDates[1], !0) === 0), e === "nextMonthDay" && o.classList.add("inRange")))) : o.classList.add("flatpickr-disabled"), n.config.mode === "range" && ze(t) && !P(t) && o.classList.add("inRange"), n.weekNumbers && n.config.showMonths === 1 && e !== "prevMonthDay" && i % 7 == 6 && n.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + n.config.getWeek(t) + "</span>"), N("onDayCreate", o), o;
|
|
3112
3112
|
}
|
|
3113
|
-
function
|
|
3113
|
+
function ee(e) {
|
|
3114
3114
|
e.focus(), n.config.mode === "range" && he(e);
|
|
3115
3115
|
}
|
|
3116
|
-
function
|
|
3116
|
+
function C(e) {
|
|
3117
3117
|
for (var t = e > 0 ? 0 : n.config.showMonths - 1, r = e > 0 ? n.config.showMonths : -1, i = t; i != r; i += e) for (var a = n.daysContainer.children[i], o = e > 0 ? 0 : a.children.length - 1, s = e > 0 ? a.children.length : -1, c = o; c != s; c += e) {
|
|
3118
3118
|
var l = a.children[c];
|
|
3119
3119
|
if (l.className.indexOf("hidden") === -1 && de(l.dateObj)) return l;
|
|
3120
3120
|
}
|
|
3121
3121
|
}
|
|
3122
|
-
function
|
|
3122
|
+
function w(e, t) {
|
|
3123
3123
|
for (var r = e.className.indexOf("Month") === -1 ? e.dateObj.getMonth() : n.currentMonth, i = t > 0 ? n.config.showMonths : -1, a = t > 0 ? 1 : -1, o = r - n.currentMonth; o != i; o += a) for (var s = n.daysContainer.children[o], c = r - n.currentMonth === o ? e.$i + t : t < 0 ? s.children.length - 1 : 0, l = s.children.length, u = c; u >= 0 && u < l && u != (t > 0 ? l : -1); u += a) {
|
|
3124
3124
|
var d = s.children[u];
|
|
3125
|
-
if (d.className.indexOf("hidden") === -1 && de(d.dateObj) && Math.abs(e.$i - u) >= Math.abs(t)) return
|
|
3125
|
+
if (d.className.indexOf("hidden") === -1 && de(d.dateObj) && Math.abs(e.$i - u) >= Math.abs(t)) return ee(d);
|
|
3126
3126
|
}
|
|
3127
|
-
n.changeMonth(a),
|
|
3127
|
+
n.changeMonth(a), T(C(a), 0);
|
|
3128
3128
|
}
|
|
3129
|
-
function
|
|
3130
|
-
var r = a(), i = fe(r || document.body), o = e === void 0 ? i ? r : n.selectedDateElem !== void 0 && fe(n.selectedDateElem) ? n.selectedDateElem : n.todayDateElem !== void 0 && fe(n.todayDateElem) ? n.todayDateElem :
|
|
3131
|
-
o === void 0 ? n._input.focus() : i ?
|
|
3129
|
+
function T(e, t) {
|
|
3130
|
+
var r = a(), i = fe(r || document.body), o = e === void 0 ? i ? r : n.selectedDateElem !== void 0 && fe(n.selectedDateElem) ? n.selectedDateElem : n.todayDateElem !== void 0 && fe(n.todayDateElem) ? n.todayDateElem : C(t > 0 ? 1 : -1) : e;
|
|
3131
|
+
o === void 0 ? n._input.focus() : i ? w(o, t) : ee(o);
|
|
3132
3132
|
}
|
|
3133
|
-
function
|
|
3133
|
+
function E(e, t) {
|
|
3134
3134
|
for (var r = (new Date(e, t, 1).getDay() - n.l10n.firstDayOfWeek + 7) % 7, i = n.utils.getDaysInMonth((t - 1 + 12) % 12, e), a = n.utils.getDaysInMonth(t, e), o = window.document.createDocumentFragment(), s = n.config.showMonths > 1, c = s ? "prevMonthDay hidden" : "prevMonthDay", l = s ? "nextMonthDay hidden" : "nextMonthDay", u = i + 1 - r, d = 0; u <= i; u++, d++) o.appendChild(S("flatpickr-day " + c, new Date(e, t - 1, u), u, d));
|
|
3135
3135
|
for (u = 1; u <= a; u++, d++) o.appendChild(S("flatpickr-day", new Date(e, t, u), u, d));
|
|
3136
3136
|
for (var f = a + 1; f <= 42 - r && (n.config.showMonths === 1 || d % 7 != 0); f++, d++) o.appendChild(S("flatpickr-day " + l, new Date(e, t + 1, f % a), f, d));
|
|
3137
3137
|
var p = Ki("div", "dayContainer");
|
|
3138
3138
|
return p.appendChild(o), p;
|
|
3139
3139
|
}
|
|
3140
|
-
function
|
|
3140
|
+
function D() {
|
|
3141
3141
|
if (n.daysContainer !== void 0) {
|
|
3142
3142
|
qi(n.daysContainer), n.weekNumbers && qi(n.weekNumbers);
|
|
3143
3143
|
for (var e = document.createDocumentFragment(), t = 0; t < n.config.showMonths; t++) {
|
|
3144
3144
|
var r = new Date(n.currentYear, n.currentMonth, 1);
|
|
3145
|
-
r.setMonth(n.currentMonth + t), e.appendChild(
|
|
3145
|
+
r.setMonth(n.currentMonth + t), e.appendChild(E(r.getFullYear(), r.getMonth()));
|
|
3146
3146
|
}
|
|
3147
3147
|
n.daysContainer.appendChild(e), n.days = n.daysContainer.firstChild, n.config.mode === "range" && n.selectedDates.length === 1 && he();
|
|
3148
3148
|
}
|
|
@@ -3241,7 +3241,7 @@ function ha(e, t) {
|
|
|
3241
3241
|
function M(e, t) {
|
|
3242
3242
|
t === void 0 && (t = !0);
|
|
3243
3243
|
var r = t ? e : e - n.currentMonth;
|
|
3244
|
-
r < 0 && n._hidePrevMonthArrow === !0 || r > 0 && n._hideNextMonthArrow === !0 || (n.currentMonth += r, (n.currentMonth < 0 || n.currentMonth > 11) && (n.currentYear += n.currentMonth > 11 ? 1 : -1, n.currentMonth = (n.currentMonth + 12) % 12, N("onYearChange"), O()),
|
|
3244
|
+
r < 0 && n._hidePrevMonthArrow === !0 || r > 0 && n._hideNextMonthArrow === !0 || (n.currentMonth += r, (n.currentMonth < 0 || n.currentMonth > 11) && (n.currentYear += n.currentMonth > 11 ? 1 : -1, n.currentMonth = (n.currentMonth + 12) % 12, N("onYearChange"), O()), D(), N("onMonthChange"), Be());
|
|
3245
3245
|
}
|
|
3246
3246
|
function ae(e, t) {
|
|
3247
3247
|
if (e === void 0 && (e = !0), t === void 0 && (t = !0), n.input.value = "", n.altInput !== void 0 && (n.altInput.value = ""), n.mobileInput !== void 0 && (n.mobileInput.value = ""), n.selectedDates = [], n.latestSelectedDateObj = void 0, t === !0 && (n.currentYear = n._initialDate.getFullYear(), n.currentMonth = n._initialDate.getMonth()), n.config.enableTime === !0) {
|
|
@@ -3335,7 +3335,7 @@ function ha(e, t) {
|
|
|
3335
3335
|
var f = a();
|
|
3336
3336
|
if (n.daysContainer !== void 0 && (o === !1 || f && fe(f))) {
|
|
3337
3337
|
var p = t.keyCode === 39 ? 1 : -1;
|
|
3338
|
-
t.ctrlKey ? (t.stopPropagation(), M(p),
|
|
3338
|
+
t.ctrlKey ? (t.stopPropagation(), M(p), T(C(1), 0)) : T(void 0, p);
|
|
3339
3339
|
}
|
|
3340
3340
|
} else n.hourElement && n.hourElement.focus();
|
|
3341
3341
|
break;
|
|
@@ -3343,7 +3343,7 @@ function ha(e, t) {
|
|
|
3343
3343
|
case 40:
|
|
3344
3344
|
t.preventDefault();
|
|
3345
3345
|
var m = t.keyCode === 40 ? 1 : -1;
|
|
3346
|
-
n.daysContainer && r.$i !== void 0 || r === n.input || r === n.altInput ? t.ctrlKey ? (t.stopPropagation(), ue(n.currentYear - m),
|
|
3346
|
+
n.daysContainer && r.$i !== void 0 || r === n.input || r === n.altInput ? t.ctrlKey ? (t.stopPropagation(), ue(n.currentYear - m), T(C(1), 0)) : u || T(void 0, m * 7) : r === n.currentYearElement ? ue(n.currentYear - m) : n.config.enableTime && (!u && n.hourElement && n.hourElement.focus(), c(t), n._debouncedChange());
|
|
3347
3347
|
break;
|
|
3348
3348
|
case 9: if (u) {
|
|
3349
3349
|
var h = [
|
|
@@ -3533,8 +3533,8 @@ function ha(e, t) {
|
|
|
3533
3533
|
else {
|
|
3534
3534
|
var v = Ce();
|
|
3535
3535
|
if (v === void 0) return;
|
|
3536
|
-
var y = window.document.body.offsetWidth, b = Math.max(0, y / 2 - i / 2), x = ".flatpickr-calendar.centerMost:before", S = ".flatpickr-calendar.centerMost:after",
|
|
3537
|
-
Gi(n.calendarContainer, "rightMost", !1), Gi(n.calendarContainer, "centerMost", !0), v.insertRule(x + "," + S +
|
|
3536
|
+
var y = window.document.body.offsetWidth, b = Math.max(0, y / 2 - i / 2), x = ".flatpickr-calendar.centerMost:before", S = ".flatpickr-calendar.centerMost:after", ee = v.cssRules.length, C = "{left:" + c.left + "px;right:auto;}";
|
|
3537
|
+
Gi(n.calendarContainer, "rightMost", !1), Gi(n.calendarContainer, "centerMost", !0), v.insertRule(x + "," + S + C, ee), n.calendarContainer.style.left = b + "px", n.calendarContainer.style.right = "auto";
|
|
3538
3538
|
}
|
|
3539
3539
|
}
|
|
3540
3540
|
}
|
|
@@ -3559,7 +3559,7 @@ function ha(e, t) {
|
|
|
3559
3559
|
return document.head.appendChild(e), e.sheet;
|
|
3560
3560
|
}
|
|
3561
3561
|
function Te() {
|
|
3562
|
-
n.config.noCalendar || n.isMobile || (O(), Be(),
|
|
3562
|
+
n.config.noCalendar || n.isMobile || (O(), Be(), D());
|
|
3563
3563
|
}
|
|
3564
3564
|
function Ee() {
|
|
3565
3565
|
n._input.focus(), window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== void 0 ? setTimeout(n.close, 0) : n.close();
|
|
@@ -3582,7 +3582,7 @@ function ha(e, t) {
|
|
|
3582
3582
|
var s = n.currentYear !== i.getFullYear();
|
|
3583
3583
|
n.currentYear = i.getFullYear(), n.currentMonth = i.getMonth(), s && (N("onYearChange"), O()), N("onMonthChange");
|
|
3584
3584
|
}
|
|
3585
|
-
if (Be(),
|
|
3585
|
+
if (Be(), D(), Ve(), !a && n.config.mode !== "range" && n.config.showMonths === 1 ? ee(r) : n.selectedDateElem !== void 0 && n.hourElement === void 0 && n.selectedDateElem && n.selectedDateElem.focus(), n.hourElement !== void 0 && n.hourElement !== void 0 && n.hourElement.focus(), n.config.closeOnSelect) {
|
|
3586
3586
|
var c = n.config.mode === "single" && !n.config.enableTime, l = n.config.mode === "range" && n.selectedDates.length === 2 && !n.config.enableTime;
|
|
3587
3587
|
(c || l) && Ee();
|
|
3588
3588
|
}
|
|
@@ -4126,21 +4126,21 @@ function Pa(e, t) {
|
|
|
4126
4126
|
}
|
|
4127
4127
|
}, v = Ma(), y = U(v), b = W(U(y), 2), x = U(b), S = W(x, 2);
|
|
4128
4128
|
_i(S), On(() => Ci(S, n)), ii(S, (e, t) => h?.(e, t), n);
|
|
4129
|
-
var
|
|
4129
|
+
var ee = W(S, 2);
|
|
4130
4130
|
Ve(2), F(b), F(y);
|
|
4131
|
-
var
|
|
4132
|
-
F(
|
|
4133
|
-
var
|
|
4134
|
-
_i(
|
|
4135
|
-
var O = W(
|
|
4131
|
+
var C = W(y, 2), w = W(U(C), 2), T = U(w, !0);
|
|
4132
|
+
F(w), ii(w, (e, t) => h?.(e, t), a), F(C);
|
|
4133
|
+
var E = W(C, 2), D = W(U(E), 2);
|
|
4134
|
+
_i(D), Oi(D, (e) => d = e, () => d), F(E);
|
|
4135
|
+
var O = W(E, 2), k = (e) => {
|
|
4136
4136
|
var t = ja(), n = U(t), r = U(n, !0);
|
|
4137
4137
|
F(n), ii(n, (e, t) => h?.(e, t), o), F(t), G(() => Z(r, o())), X(e, t);
|
|
4138
4138
|
};
|
|
4139
4139
|
return Q(O, (e) => {
|
|
4140
4140
|
o() && e(k);
|
|
4141
4141
|
}), F(v), G(() => {
|
|
4142
|
-
x.disabled = u(), yi(S, "min", s()), yi(S, "max", c()), S.disabled = u(),
|
|
4143
|
-
}), Cr("click", x, () => m(-1)), Cr("click",
|
|
4142
|
+
x.disabled = u(), yi(S, "min", s()), yi(S, "max", c()), S.disabled = u(), ee.disabled = u(), Z(T, a()), vi(D, J(g)), D.disabled = u();
|
|
4143
|
+
}), Cr("click", x, () => m(-1)), Cr("click", ee, () => m(1)), X(e, v), Xe(_);
|
|
4144
4144
|
}
|
|
4145
4145
|
wr(["click"]), Pi(Pa, {
|
|
4146
4146
|
loa: {},
|
|
@@ -4407,37 +4407,37 @@ var fo = /* @__PURE__ */ Y("<div class=\"sbm-map svelte-yb07tk\"></div>"), po =
|
|
|
4407
4407
|
};
|
|
4408
4408
|
function mo(e, t) {
|
|
4409
4409
|
Ye(t, !0), ri(e, po);
|
|
4410
|
-
let n = $(t, "mapsApiKey", 7), r = $(t, "mapStyle", 7), i = $(t, "center", 7), a = $(t, "navy", 7), o = $(t, "gold", 7), s = $(t, "logoMark", 7, null), c = $(t, "marinaName", 7, ""), l = $(t, "otherMarinas", 7), u = $(t, "berths", 7), d = $(t, "overlays", 7), f = $(t, "layout", 7), p = $(t, "loa", 7), m = $(t, "selectedBerth", 7), h = $(t, "onBerthClick", 7), g = $(t, "staff", 7, !1), _, v = /* @__PURE__ */ V(null), y = /* @__PURE__ */ new Map(), b = [], x = [], S = !1,
|
|
4410
|
+
let n = $(t, "mapsApiKey", 7), r = $(t, "mapStyle", 7), i = $(t, "center", 7), a = $(t, "navy", 7), o = $(t, "gold", 7), s = $(t, "logoMark", 7, null), c = $(t, "marinaName", 7, ""), l = $(t, "otherMarinas", 7), u = $(t, "berths", 7), d = $(t, "overlays", 7), f = $(t, "layout", 7), p = $(t, "loa", 7), m = $(t, "selectedBerth", 7), h = $(t, "onBerthClick", 7), g = $(t, "staff", 7, !1), _, v = /* @__PURE__ */ V(null), y = /* @__PURE__ */ new Map(), b = [], x = [], S = !1, ee = /* @__PURE__ */ L(() => ({
|
|
4411
4411
|
fillColor: o(),
|
|
4412
4412
|
fillOpacity: .38,
|
|
4413
4413
|
strokeColor: o(),
|
|
4414
4414
|
strokeOpacity: 1,
|
|
4415
4415
|
strokeWeight: 1.6
|
|
4416
|
-
})),
|
|
4416
|
+
})), C = /* @__PURE__ */ L(() => ({
|
|
4417
4417
|
fillColor: o(),
|
|
4418
4418
|
fillOpacity: .62,
|
|
4419
4419
|
strokeColor: o(),
|
|
4420
4420
|
strokeOpacity: 1,
|
|
4421
4421
|
strokeWeight: 1.6
|
|
4422
|
-
})),
|
|
4422
|
+
})), w = /* @__PURE__ */ L(() => ({
|
|
4423
4423
|
fillColor: o(),
|
|
4424
4424
|
fillOpacity: .72,
|
|
4425
4425
|
strokeColor: "#252525",
|
|
4426
4426
|
strokeOpacity: 1,
|
|
4427
4427
|
strokeWeight: 2
|
|
4428
|
-
})),
|
|
4428
|
+
})), T = {
|
|
4429
4429
|
fillColor: "#b8b8b8",
|
|
4430
4430
|
fillOpacity: .08,
|
|
4431
4431
|
strokeColor: "#b8b8b8",
|
|
4432
4432
|
strokeOpacity: .5,
|
|
4433
4433
|
strokeWeight: 1
|
|
4434
|
-
},
|
|
4434
|
+
}, E = {
|
|
4435
4435
|
fillColor: "#888888",
|
|
4436
4436
|
fillOpacity: .15,
|
|
4437
4437
|
strokeColor: "#888888",
|
|
4438
4438
|
strokeOpacity: .4,
|
|
4439
4439
|
strokeWeight: 1
|
|
4440
|
-
},
|
|
4440
|
+
}, D = /* @__PURE__ */ L(() => ({
|
|
4441
4441
|
fillColor: a(),
|
|
4442
4442
|
fillOpacity: .85,
|
|
4443
4443
|
strokeColor: a(),
|
|
@@ -4656,8 +4656,7 @@ function mo(e, t) {
|
|
|
4656
4656
|
let t = {};
|
|
4657
4657
|
for (let e of u()) e.berthId && (t[e.berthId] = {
|
|
4658
4658
|
price: e.pricePerNight,
|
|
4659
|
-
status: e.status
|
|
4660
|
-
rotation: e.rotation
|
|
4659
|
+
status: e.status
|
|
4661
4660
|
});
|
|
4662
4661
|
try {
|
|
4663
4662
|
let n = new DOMParser().parseFromString(e, "image/svg+xml");
|
|
@@ -4669,15 +4668,7 @@ function mo(e, t) {
|
|
|
4669
4668
|
let a = ie[i] ?? ie.occupied, o = e.querySelector("rect:not([data-role]), circle");
|
|
4670
4669
|
o && (o.setAttribute("fill", a.fill), o.setAttribute("stroke", a.stroke));
|
|
4671
4670
|
let s = e.querySelector("[data-role=\"entrance\"]");
|
|
4672
|
-
|
|
4673
|
-
let t = o, n = 0, i = 0;
|
|
4674
|
-
if (t.tagName.toLowerCase() === "rect") {
|
|
4675
|
-
let e = parseFloat(t.getAttribute("x") || "0"), r = parseFloat(t.getAttribute("y") || "0"), a = parseFloat(t.getAttribute("width") || "0"), o = parseFloat(t.getAttribute("height") || "0");
|
|
4676
|
-
n = e + a / 2, i = r + o / 2;
|
|
4677
|
-
} else t.tagName.toLowerCase() === "circle" && (n = parseFloat(t.getAttribute("cx") || "0"), i = parseFloat(t.getAttribute("cy") || "0"));
|
|
4678
|
-
let a = e.getAttribute("transform") || "";
|
|
4679
|
-
e.setAttribute("transform", `${a} rotate(${r.rotation} ${n} ${i})`.trim());
|
|
4680
|
-
}
|
|
4671
|
+
s && s.setAttribute("fill", a.stroke);
|
|
4681
4672
|
});
|
|
4682
4673
|
let r = n.createElementNS("http://www.w3.org/2000/svg", "style");
|
|
4683
4674
|
return r.textContent = `
|
|
@@ -4762,11 +4753,11 @@ function mo(e, t) {
|
|
|
4762
4753
|
function se(e, t) {
|
|
4763
4754
|
let n = e.berth.status !== "available";
|
|
4764
4755
|
e.pickable = eo(e.berth, p(), g());
|
|
4765
|
-
let r = t === m() ? J(
|
|
4756
|
+
let r = t === m() ? J(w) : n ? g() ? J(D) : E : e.pickable ? J(ee) : T;
|
|
4766
4757
|
e.circle.setOptions({
|
|
4767
4758
|
...r,
|
|
4768
4759
|
clickable: e.pickable
|
|
4769
|
-
}), e.hull?.setOptions({ fillOpacity: r ===
|
|
4760
|
+
}), e.hull?.setOptions({ fillOpacity: r === T || r === E ? .2 : .85 });
|
|
4770
4761
|
}
|
|
4771
4762
|
Gr(() => {
|
|
4772
4763
|
let e = !1;
|
|
@@ -4805,11 +4796,11 @@ function mo(e, t) {
|
|
|
4805
4796
|
lng: t.lng
|
|
4806
4797
|
},
|
|
4807
4798
|
radius: O(t),
|
|
4808
|
-
...J(
|
|
4799
|
+
...J(ee)
|
|
4809
4800
|
}) : new n.Polygon({
|
|
4810
4801
|
map: J(v),
|
|
4811
4802
|
paths: uo(t, r, so),
|
|
4812
|
-
...J(
|
|
4803
|
+
...J(ee)
|
|
4813
4804
|
}), o = {
|
|
4814
4805
|
circle: i,
|
|
4815
4806
|
hull: r == null ? null : new n.Polygon({
|
|
@@ -4826,7 +4817,7 @@ function mo(e, t) {
|
|
|
4826
4817
|
pickable: !1
|
|
4827
4818
|
};
|
|
4828
4819
|
y.set(t.berthId, o), _r(() => se(o, t.berthId)), i.addListener("click", () => h()(t.berthId === m() ? null : t.berthId)), i.addListener("mouseover", () => {
|
|
4829
|
-
o.pickable && t.berthId !== m() && i.setOptions(J(
|
|
4820
|
+
o.pickable && t.berthId !== m() && i.setOptions(J(C));
|
|
4830
4821
|
}), i.addListener("mouseout", () => {
|
|
4831
4822
|
t.berthId !== m() && se(o, t.berthId);
|
|
4832
4823
|
}), e.extend({
|
|
@@ -5112,14 +5103,14 @@ function xo(e, t) {
|
|
|
5112
5103
|
Ve(), F(y);
|
|
5113
5104
|
var x = W(y, 2);
|
|
5114
5105
|
_i(x), F(v), F(p);
|
|
5115
|
-
var S = W(p, 2),
|
|
5116
|
-
Ve(), F(
|
|
5117
|
-
var
|
|
5118
|
-
_i(
|
|
5119
|
-
var
|
|
5120
|
-
F(
|
|
5121
|
-
var k = W(
|
|
5122
|
-
_i(k), F(
|
|
5106
|
+
var S = W(p, 2), ee = U(S), C = U(ee), w = U(C);
|
|
5107
|
+
Ve(), F(C);
|
|
5108
|
+
var T = W(C, 2);
|
|
5109
|
+
_i(T), F(ee);
|
|
5110
|
+
var E = W(ee, 2), D = U(E), O = U(D, !0);
|
|
5111
|
+
F(D);
|
|
5112
|
+
var k = W(D, 2);
|
|
5113
|
+
_i(k), F(E), F(S);
|
|
5123
5114
|
var A = W(S, 2), j = U(A), te = U(j), ne = U(te, !0);
|
|
5124
5115
|
F(te);
|
|
5125
5116
|
var re = W(te, 2);
|
|
@@ -5128,8 +5119,8 @@ function xo(e, t) {
|
|
|
5128
5119
|
F(M);
|
|
5129
5120
|
var oe = W(M, 2);
|
|
5130
5121
|
return dt(oe), F(ie), F(u), G(() => {
|
|
5131
|
-
Z(f, c().yourDetails), Z(g, `${c().skipperName ?? ""} `), Z(b, `${c().boatName ?? ""} `), Z(
|
|
5132
|
-
}), Ci(_, n), Ci(x, a), Ci(
|
|
5122
|
+
Z(f, c().yourDetails), Z(g, `${c().skipperName ?? ""} `), Z(b, `${c().boatName ?? ""} `), Z(w, `${c().email ?? ""} `), Z(O, c().phone), Z(ne, c().wizard.boatBeam), Z(ae, c().notes);
|
|
5123
|
+
}), Ci(_, n), Ci(x, a), Ci(T, r), Ci(k, i), Ci(re, o), Ci(oe, s), X(e, u), Xe(l);
|
|
5133
5124
|
}
|
|
5134
5125
|
Pi(xo, {
|
|
5135
5126
|
contactName: {},
|
|
@@ -5837,12 +5828,12 @@ function es(e, t) {
|
|
|
5837
5828
|
F(b);
|
|
5838
5829
|
var S = W(b, 2);
|
|
5839
5830
|
Oi(S, (e) => l = e, () => l);
|
|
5840
|
-
var
|
|
5831
|
+
var ee = W(S, 2), C = (e) => {
|
|
5841
5832
|
var t = Zo(), n = U(t, !0);
|
|
5842
5833
|
F(t), G(() => Z(n, J(d))), X(e, t);
|
|
5843
5834
|
};
|
|
5844
|
-
return Q(
|
|
5845
|
-
J(d) && e(
|
|
5835
|
+
return Q(ee, (e) => {
|
|
5836
|
+
J(d) && e(C);
|
|
5846
5837
|
}), F(m), G(() => {
|
|
5847
5838
|
Z(_, J(s).paymentHold), Z(y, `${J(s).total ?? ""} ${o() ?? ""}`), Z(x, J(s).paymentNote);
|
|
5848
5839
|
}), X(e, m), Xe(p);
|
|
@@ -6166,17 +6157,17 @@ function Rs(e, t) {
|
|
|
6166
6157
|
set onchange(e) {
|
|
6167
6158
|
l(e), B();
|
|
6168
6159
|
}
|
|
6169
|
-
}, x = Is(), S = U(x),
|
|
6160
|
+
}, x = Is(), S = U(x), ee = U(S, !0);
|
|
6170
6161
|
F(S);
|
|
6171
|
-
var
|
|
6162
|
+
var C = W(S, 2), w = (e) => {
|
|
6172
6163
|
var t = Ts(), n = U(t, !0);
|
|
6173
6164
|
F(t), G(() => Z(n, J(u).docsAfterSend)), X(e, t);
|
|
6174
6165
|
};
|
|
6175
|
-
Q(
|
|
6176
|
-
J(d) || e(
|
|
6166
|
+
Q(C, (e) => {
|
|
6167
|
+
J(d) || e(w);
|
|
6177
6168
|
});
|
|
6178
|
-
var
|
|
6179
|
-
Xr(
|
|
6169
|
+
var T = W(C, 2);
|
|
6170
|
+
Xr(T, 17, s, (e) => e.id, (e, t) => {
|
|
6180
6171
|
let n = /* @__PURE__ */ L(() => g(J(t).id)), r = /* @__PURE__ */ L(() => J(p)[J(t).id]), i = /* @__PURE__ */ L(() => J(d) && !J(r) && (!J(n) || J(n).status === "rejected"));
|
|
6181
6172
|
var a = Nr();
|
|
6182
6173
|
ni(mn(a), () => J(i) ? "label" : "div", !1, (e, a) => {
|
|
@@ -6201,46 +6192,46 @@ function Rs(e, t) {
|
|
|
6201
6192
|
Q(f, (e) => {
|
|
6202
6193
|
J(r) ? e(p) : J(n)?.status === "verified" ? e(m, 1) : J(n)?.status === "pending" ? e(h, 2) : e(g, -1);
|
|
6203
6194
|
}), F(l);
|
|
6204
|
-
var v = W(l, 2), b = U(v), x = U(b, !0), S = W(x),
|
|
6195
|
+
var v = W(l, 2), b = U(v), x = U(b, !0), S = W(x), ee = (e) => {
|
|
6205
6196
|
X(e, As());
|
|
6206
6197
|
};
|
|
6207
6198
|
Q(S, (e) => {
|
|
6208
|
-
J(t).mandatory && e(
|
|
6199
|
+
J(t).mandatory && e(ee);
|
|
6209
6200
|
});
|
|
6210
|
-
var
|
|
6201
|
+
var C = W(S, 2), w = (e) => {
|
|
6211
6202
|
var t = js(), r = U(t, !0);
|
|
6212
6203
|
F(t), G((e) => Z(r, e), [() => _(J(n).submittedAt)]), X(e, t);
|
|
6213
6204
|
};
|
|
6214
|
-
Q(
|
|
6215
|
-
J(n) && !J(r) && e(
|
|
6205
|
+
Q(C, (e) => {
|
|
6206
|
+
J(n) && !J(r) && e(w);
|
|
6216
6207
|
}), F(b);
|
|
6217
|
-
var
|
|
6218
|
-
F(
|
|
6219
|
-
var
|
|
6208
|
+
var T = W(b, 2), E = U(T, !0);
|
|
6209
|
+
F(T), F(v), F(c);
|
|
6210
|
+
var D = W(c, 2), O = (e) => {
|
|
6220
6211
|
var t = Ms(), i = U(t, !0);
|
|
6221
6212
|
F(t), G(() => Z(i, J(r) ? J(u).uploading : J(n) ? J(u).replace : J(u).upload)), X(e, t);
|
|
6222
6213
|
};
|
|
6223
|
-
Q(
|
|
6214
|
+
Q(D, (e) => {
|
|
6224
6215
|
(J(i) || J(r)) && e(O);
|
|
6225
6216
|
});
|
|
6226
|
-
var k = W(
|
|
6217
|
+
var k = W(D, 2), A = (e) => {
|
|
6227
6218
|
var n = Ns();
|
|
6228
6219
|
Cr("change", n, (e) => y(J(t), e)), X(e, n);
|
|
6229
6220
|
};
|
|
6230
6221
|
Q(k, (e) => {
|
|
6231
6222
|
J(i) && e(A);
|
|
6232
6223
|
}), G(() => {
|
|
6233
|
-
Z(x, J(t).name), Z(
|
|
6224
|
+
Z(x, J(t).name), Z(E, J(r) ? `${J(u).uploading} ${J(r)}` : J(n) ? J(u).docState[J(n).status] : J(t).description || (J(d) ? J(u).tapToUpload : ""));
|
|
6234
6225
|
}), X(a, s);
|
|
6235
6226
|
}), X(e, a);
|
|
6236
6227
|
});
|
|
6237
|
-
var
|
|
6228
|
+
var E = W(T, 2), D = (e) => {
|
|
6238
6229
|
var t = Fs(), n = U(t, !0);
|
|
6239
6230
|
F(t), G(() => Z(n, J(m))), X(e, t);
|
|
6240
6231
|
};
|
|
6241
|
-
return Q(
|
|
6242
|
-
J(m) && e(
|
|
6243
|
-
}), F(x), G(() => Z(
|
|
6232
|
+
return Q(E, (e) => {
|
|
6233
|
+
J(m) && e(D);
|
|
6234
|
+
}), F(x), G(() => Z(ee, J(u).documentsHeading)), X(e, x), Xe(b);
|
|
6244
6235
|
}
|
|
6245
6236
|
wr(["change"]), Pi(Rs, {
|
|
6246
6237
|
apiOrigin: {},
|
|
@@ -6322,12 +6313,12 @@ function Ws(e, t) {
|
|
|
6322
6313
|
}
|
|
6323
6314
|
}, y = Hs(), b = U(y), x = U(b, !0);
|
|
6324
6315
|
F(b);
|
|
6325
|
-
var S = W(b, 2),
|
|
6316
|
+
var S = W(b, 2), ee = U(S, !0);
|
|
6326
6317
|
F(S);
|
|
6327
|
-
var
|
|
6318
|
+
var C = W(S, 2), w = (e) => {
|
|
6328
6319
|
var t = zs(), n = U(t, !0);
|
|
6329
6320
|
F(t), G((e) => Z(n, e), [() => J(l).contractAgreedOn(g(J(m)))]), X(e, t);
|
|
6330
|
-
},
|
|
6321
|
+
}, T = (e) => {
|
|
6331
6322
|
var t = Bs(), n = mn(t), r = U(n);
|
|
6332
6323
|
_i(r);
|
|
6333
6324
|
var i = W(r, 2), a = U(i), o = W(a), s = U(o, !0);
|
|
@@ -6337,17 +6328,17 @@ function Ws(e, t) {
|
|
|
6337
6328
|
Z(a, `${J(l).readAgree ?? ""} `), Z(s, J(l).agreement), c.disabled = !J(u) || J(d), Z(f, J(d) ? J(l).sending : J(l).agree);
|
|
6338
6329
|
}), wi(r, () => J(u), (e) => H(u, e)), Cr("click", c, _), X(e, t);
|
|
6339
6330
|
};
|
|
6340
|
-
Q(
|
|
6341
|
-
J(m) ? e(
|
|
6331
|
+
Q(C, (e) => {
|
|
6332
|
+
J(m) ? e(w) : J(h) && e(T, 1);
|
|
6342
6333
|
});
|
|
6343
|
-
var
|
|
6334
|
+
var E = W(C, 2), D = (e) => {
|
|
6344
6335
|
var t = Vs(), n = U(t, !0);
|
|
6345
6336
|
F(t), G(() => Z(n, J(f))), X(e, t);
|
|
6346
6337
|
};
|
|
6347
|
-
return Q(
|
|
6348
|
-
J(f) && e(
|
|
6338
|
+
return Q(E, (e) => {
|
|
6339
|
+
J(f) && e(D);
|
|
6349
6340
|
}), F(y), G(() => {
|
|
6350
|
-
Z(x, J(l).contractHeading), Z(
|
|
6341
|
+
Z(x, J(l).contractHeading), Z(ee, s().renderedBody);
|
|
6351
6342
|
}), X(e, y), Xe(v);
|
|
6352
6343
|
}
|
|
6353
6344
|
wr(["click"]), Pi(Ws, {
|
|
@@ -6421,7 +6412,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6421
6412
|
function S(e, t) {
|
|
6422
6413
|
return `${e}`.padStart(t ? 3 : 2, "0");
|
|
6423
6414
|
}
|
|
6424
|
-
function
|
|
6415
|
+
function ee(e) {
|
|
6425
6416
|
return b.Config.logTimestamps ? function(t) {
|
|
6426
6417
|
let n = new Date(b.Config.now());
|
|
6427
6418
|
e(S(n.getHours()) + ":" + S(n.getMinutes()) + ":" + S(n.getSeconds()) + "." + S(n.getMilliseconds(), 1) + " " + t);
|
|
@@ -6429,14 +6420,14 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6429
6420
|
e(t);
|
|
6430
6421
|
};
|
|
6431
6422
|
}
|
|
6432
|
-
var
|
|
6423
|
+
var C = () => {
|
|
6433
6424
|
let e, t;
|
|
6434
6425
|
return typeof x?.console?.log == "function" ? (e = function(...e) {
|
|
6435
6426
|
console.log.apply(console, e);
|
|
6436
6427
|
}, t = console.warn ? function(...e) {
|
|
6437
6428
|
console.warn.apply(console, e);
|
|
6438
|
-
} : e) : e = t = function() {}, [e, t].map(
|
|
6439
|
-
},
|
|
6429
|
+
} : e) : e = t = function() {}, [e, t].map(ee);
|
|
6430
|
+
}, w = class e {
|
|
6440
6431
|
constructor() {
|
|
6441
6432
|
this.deprecated = (e, t) => {
|
|
6442
6433
|
this.deprecationWarning(`${e} is deprecated and will be removed in a future version. ${t}`);
|
|
@@ -6445,7 +6436,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6445
6436
|
}, this.logLevel = e.defaultLogLevel, this.logHandler = e.defaultLogHandler, this.logErrorHandler = e.defaultLogErrorHandler;
|
|
6446
6437
|
}
|
|
6447
6438
|
static initLogHandlers() {
|
|
6448
|
-
let [t, n] =
|
|
6439
|
+
let [t, n] = C();
|
|
6449
6440
|
this.defaultLogHandler = t, this.defaultLogErrorHandler = n, this.defaultLogger = new e();
|
|
6450
6441
|
}
|
|
6451
6442
|
static logActionNoStrip(e, t, n, r) {
|
|
@@ -6467,11 +6458,11 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6467
6458
|
this.shouldLog(1) && this.logErrorHandler(`Ably: Deprecation warning - ${e}`, 1);
|
|
6468
6459
|
}
|
|
6469
6460
|
};
|
|
6470
|
-
|
|
6471
|
-
|
|
6461
|
+
w.defaultLogLevel = 1, w.LOG_NONE = 0, w.LOG_ERROR = 1, w.LOG_MAJOR = 2, w.LOG_MINOR = 3, w.LOG_MICRO = 4, w.logAction = (e, t, n, r) => {
|
|
6462
|
+
w.logActionNoStrip(e, t, n, r);
|
|
6472
6463
|
};
|
|
6473
|
-
var
|
|
6474
|
-
m(
|
|
6464
|
+
var T = w, E = {};
|
|
6465
|
+
m(E, {
|
|
6475
6466
|
Format: () => ve,
|
|
6476
6467
|
allSame: () => _e,
|
|
6477
6468
|
allToLowerCase: () => Pe,
|
|
@@ -6522,7 +6513,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6522
6513
|
whenPromiseSettles: () => je,
|
|
6523
6514
|
withTimeoutAsync: () => Ue
|
|
6524
6515
|
});
|
|
6525
|
-
function
|
|
6516
|
+
function D(e) {
|
|
6526
6517
|
let t = "[" + e.constructor.name;
|
|
6527
6518
|
return e.message && (t += ": " + e.message), e.statusCode && (t += "; statusCode=" + e.statusCode), e.code && (t += "; code=" + e.code), e.cause && (t += "; cause=" + Te(e.cause)), e.remediation && (t += "; remediation=" + e.remediation), e.detail && Object.keys(e.detail).length > 0 && (t += "; detail=" + JSON.stringify(e.detail)), e.href && !(e.message && e.message.indexOf("help.ably.io") > -1) && (t += "; see " + e.href + " "), t += "]", t;
|
|
6528
6519
|
}
|
|
@@ -6538,7 +6529,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6538
6529
|
} else o(t), Object.setPrototypeOf !== void 0 && Object.setPrototypeOf(this, e.prototype), this.code = n, this.statusCode = r, this.cause = i, this.detail = a;
|
|
6539
6530
|
}
|
|
6540
6531
|
toString() {
|
|
6541
|
-
return
|
|
6532
|
+
return D(this);
|
|
6542
6533
|
}
|
|
6543
6534
|
static fromValues(t) {
|
|
6544
6535
|
let n = new e(t);
|
|
@@ -6556,7 +6547,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6556
6547
|
} else o(t), Object.setPrototypeOf !== void 0 && Object.setPrototypeOf(this, e.prototype), this.code = n, this.statusCode = r, this.cause = i, this.detail = a;
|
|
6557
6548
|
}
|
|
6558
6549
|
toString() {
|
|
6559
|
-
return
|
|
6550
|
+
return D(this);
|
|
6560
6551
|
}
|
|
6561
6552
|
static fromValues(t) {
|
|
6562
6553
|
let n = new e(t);
|
|
@@ -6932,19 +6923,19 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6932
6923
|
function it(e, t, n, r, i) {
|
|
6933
6924
|
if (e === void 0) {
|
|
6934
6925
|
let e = t ? `${n} must be initialized with either a client options object, an Ably API key, or an Ably Token` : `${n} must be initialized with a client options object`;
|
|
6935
|
-
throw
|
|
6926
|
+
throw T.logAction(r, T.LOG_ERROR, `${n}()`, e), Error(e);
|
|
6936
6927
|
}
|
|
6937
6928
|
let a;
|
|
6938
6929
|
if (typeof e == "string") if (e.indexOf(":") == -1) {
|
|
6939
6930
|
if (!t) {
|
|
6940
6931
|
let e = `${n} cannot be initialized with just an Ably Token; you must provide a client options object with a \`plugins\` property. (Set this Ably Token as the object\u2019s \`token\` property.)`;
|
|
6941
|
-
throw
|
|
6932
|
+
throw T.logAction(r, T.LOG_ERROR, `${n}()`, e), Error(e);
|
|
6942
6933
|
}
|
|
6943
6934
|
a = { token: e };
|
|
6944
6935
|
} else {
|
|
6945
6936
|
if (!t) {
|
|
6946
6937
|
let e = `${n} cannot be initialized with just an Ably API key; you must provide a client options object with a \`plugins\` property. (Set this Ably API key as the object\u2019s \`key\` property.)`;
|
|
6947
|
-
throw
|
|
6938
|
+
throw T.logAction(r, T.LOG_ERROR, `${n}()`, e), Error(e);
|
|
6948
6939
|
}
|
|
6949
6940
|
a = { key: e };
|
|
6950
6941
|
}
|
|
@@ -6966,8 +6957,8 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
6966
6957
|
});
|
|
6967
6958
|
}
|
|
6968
6959
|
function ot(e, t, n) {
|
|
6969
|
-
let r = n ??
|
|
6970
|
-
e.environment && r.deprecated("The `environment` client option", "Use the `endpoint` client option instead."), e.restHost && r.deprecated("The `restHost` client option", "Use the `endpoint` client option instead."), e.realtimeHost && r.deprecated("The `realtimeHost` client option", "Use the `endpoint` client option instead."), at(e), typeof e.recover == "function" && e.closeOnUnload === !0 && (
|
|
6960
|
+
let r = n ?? T.defaultLogger;
|
|
6961
|
+
e.environment && r.deprecated("The `environment` client option", "Use the `endpoint` client option instead."), e.restHost && r.deprecated("The `restHost` client option", "Use the `endpoint` client option instead."), e.realtimeHost && r.deprecated("The `realtimeHost` client option", "Use the `endpoint` client option instead."), at(e), typeof e.recover == "function" && e.closeOnUnload === !0 && (T.logAction(r, T.LOG_ERROR, "Defaults.normaliseOptions", "closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter"), e.recover = void 0), "closeOnUnload" in e || (e.closeOnUnload = !e.recover), "queueMessages" in e || (e.queueMessages = !0);
|
|
6971
6962
|
let i = e.endpoint || Ke.ENDPOINT;
|
|
6972
6963
|
!e.fallbackHosts && !e.restHost && !e.realtimeHost && !e.port && !e.tlsPort && (e.fallbackHosts = Ze(e.environment || i));
|
|
6973
6964
|
let a = e.environment && `${e.environment}.realtime.ably.net`, o = e.restHost || e.realtimeHost || a || Xe(i);
|
|
@@ -7039,7 +7030,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7039
7030
|
for (let n of this.members) if (n) try {
|
|
7040
7031
|
n(e, t);
|
|
7041
7032
|
} catch (e) {
|
|
7042
|
-
|
|
7033
|
+
T.logAction(this.logger, T.LOG_ERROR, "Multicaster multiple callback handler", "Unexpected exception: " + e + "; stack = " + e.stack);
|
|
7043
7034
|
}
|
|
7044
7035
|
}
|
|
7045
7036
|
push(...e) {
|
|
@@ -7095,13 +7086,13 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7095
7086
|
return JSON.stringify(t);
|
|
7096
7087
|
}
|
|
7097
7088
|
function Tt(e, t) {
|
|
7098
|
-
if (e.authCallback)
|
|
7099
|
-
else if (e.authUrl)
|
|
7100
|
-
else if (e.key)
|
|
7101
|
-
else if (e.tokenDetails)
|
|
7089
|
+
if (e.authCallback) T.logAction(t, T.LOG_MINOR, "Auth()", "using token auth with authCallback");
|
|
7090
|
+
else if (e.authUrl) T.logAction(t, T.LOG_MINOR, "Auth()", "using token auth with authUrl");
|
|
7091
|
+
else if (e.key) T.logAction(t, T.LOG_MINOR, "Auth()", "using token auth with client-side signing");
|
|
7092
|
+
else if (e.tokenDetails) T.logAction(t, T.LOG_MINOR, "Auth()", "using token auth with supplied token only");
|
|
7102
7093
|
else {
|
|
7103
7094
|
let e = "authOptions must include valid authentication parameters";
|
|
7104
|
-
throw
|
|
7095
|
+
throw T.logAction(t, T.LOG_ERROR, "Auth()", e), new O(e, 40106, 401);
|
|
7105
7096
|
}
|
|
7106
7097
|
}
|
|
7107
7098
|
function L(e) {
|
|
@@ -7119,18 +7110,18 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7119
7110
|
}
|
|
7120
7111
|
var At = class {
|
|
7121
7112
|
constructor(e, t) {
|
|
7122
|
-
if (this.authOptions = {}, this.client = e, this.tokenParams = t.defaultTokenParams || {}, this.currentTokenRequestId = null, this.waitingForTokenRequest = null, Et(t)) Dt(t) &&
|
|
7113
|
+
if (this.authOptions = {}, this.client = e, this.tokenParams = t.defaultTokenParams || {}, this.currentTokenRequestId = null, this.waitingForTokenRequest = null, Et(t)) Dt(t) && T.logAction(this.logger, T.LOG_ERROR, "Auth()", "Warning: library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"), this._saveTokenOptions(t.defaultTokenParams, t), Tt(this.authOptions, this.logger);
|
|
7123
7114
|
else {
|
|
7124
7115
|
if (!t.key) {
|
|
7125
7116
|
let e = "No authentication options provided";
|
|
7126
|
-
throw
|
|
7117
|
+
throw T.logAction(this.logger, T.LOG_ERROR, "Auth()", e), new O({
|
|
7127
7118
|
message: e,
|
|
7128
7119
|
code: 40106,
|
|
7129
7120
|
statusCode: 401,
|
|
7130
7121
|
remediation: "Set one of the following in ClientOptions: key, authUrl, authCallback, token, or tokenDetails. For production use, prefer authUrl or authCallback for client-side (browser, mobile apps), or key for server-side."
|
|
7131
7122
|
});
|
|
7132
7123
|
}
|
|
7133
|
-
|
|
7124
|
+
T.logAction(this.logger, T.LOG_MINOR, "Auth()", "anonymous, using basic auth"), this._saveBasicOptions(t);
|
|
7134
7125
|
}
|
|
7135
7126
|
}
|
|
7136
7127
|
get logger() {
|
|
@@ -7168,16 +7159,16 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7168
7159
|
}
|
|
7169
7160
|
async _requestTokenImpl(e, t) {
|
|
7170
7161
|
let n = t || this.authOptions, r = e || te(this.tokenParams), i, a = this.client;
|
|
7171
|
-
if (n.authCallback)
|
|
7172
|
-
else if (n.authUrl)
|
|
7162
|
+
if (n.authCallback) T.logAction(this.logger, T.LOG_MINOR, "Auth.requestToken()", "using token auth with authCallback"), i = n.authCallback;
|
|
7163
|
+
else if (n.authUrl) T.logAction(this.logger, T.LOG_MINOR, "Auth.requestToken()", "using token auth with authUrl"), i = (e, t) => {
|
|
7173
7164
|
let r = j({ accept: "application/json, text/plain" }, n.authHeaders), i = n.authMethod && n.authMethod.toLowerCase() === "post", a, o = n.authUrl.indexOf("?");
|
|
7174
7165
|
o > -1 && (a = Se(n.authUrl.slice(o)), n.authUrl = n.authUrl.slice(0, o), i || (n.authParams = j(a, n.authParams)));
|
|
7175
7166
|
let s = j({}, n.authParams || {}, e), c = (e) => {
|
|
7176
7167
|
let n = e.body ?? null, r = null;
|
|
7177
|
-
if (e.error)
|
|
7168
|
+
if (e.error) T.logAction(this.logger, T.LOG_MICRO, "Auth.requestToken().tokenRequestCallback", "Received Error: " + Te(e.error));
|
|
7178
7169
|
else {
|
|
7179
7170
|
let t = e.headers["content-type"] ?? null;
|
|
7180
|
-
r = Array.isArray(t) ? t.join(", ") : t,
|
|
7171
|
+
r = Array.isArray(t) ? t.join(", ") : t, T.logAction(this.logger, T.LOG_MICRO, "Auth.requestToken().tokenRequestCallback", "Received; content-type: " + r + "; body: " + Ee(n));
|
|
7181
7172
|
}
|
|
7182
7173
|
if (e.error) {
|
|
7183
7174
|
t(e.error, null);
|
|
@@ -7225,17 +7216,17 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7225
7216
|
}
|
|
7226
7217
|
t(null, n, r);
|
|
7227
7218
|
};
|
|
7228
|
-
if (
|
|
7219
|
+
if (T.logAction(this.logger, T.LOG_MICRO, "Auth.requestToken().tokenRequestCallback", "Requesting token from " + n.authUrl + "; Params: " + JSON.stringify(s) + "; method: " + (i ? "POST" : "GET")), i) {
|
|
7229
7220
|
let e = r || {};
|
|
7230
7221
|
e["content-type"] = "application/x-www-form-urlencoded";
|
|
7231
7222
|
let t = be(s).slice(1);
|
|
7232
7223
|
je(this.client.http.doUri(ht.Post, n.authUrl, e, t, a), (e, t) => c(e || t));
|
|
7233
7224
|
} else je(this.client.http.doUri(ht.Get, n.authUrl, r || {}, null, s), (e, t) => c(e || t));
|
|
7234
7225
|
};
|
|
7235
|
-
else if (n.key)
|
|
7226
|
+
else if (n.key) T.logAction(this.logger, T.LOG_MINOR, "Auth.requestToken()", "using token auth with client-side signing"), i = (e, t) => {
|
|
7236
7227
|
je(this.createTokenRequest(e, n), (e, n) => t(e, n ?? null));
|
|
7237
7228
|
};
|
|
7238
|
-
else throw
|
|
7229
|
+
else throw T.logAction(this.logger, T.LOG_ERROR, "Auth()", "library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"), new O({
|
|
7239
7230
|
message: "Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)",
|
|
7240
7231
|
code: 40171,
|
|
7241
7232
|
statusCode: 403,
|
|
@@ -7246,13 +7237,13 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7246
7237
|
let r = "/keys/" + e.keyName + "/requestToken", i = function(e) {
|
|
7247
7238
|
return a.baseUri(e) + r;
|
|
7248
7239
|
}, o = I.defaultPostHeaders(this.client.options, { format: "json" });
|
|
7249
|
-
n.requestHeaders && j(o, n.requestHeaders),
|
|
7240
|
+
n.requestHeaders && j(o, n.requestHeaders), T.logAction(this.logger, T.LOG_MICRO, "Auth.requestToken().requestToken", "Sending POST to " + r + "; Token params: " + JSON.stringify(e)), je(this.client.http.do(ht.Post, i, o, JSON.stringify(e), null), (e, n) => e ? t(e) : t(n.error, n.body, n.unpacked));
|
|
7250
7241
|
};
|
|
7251
7242
|
return new Promise((e, t) => {
|
|
7252
7243
|
let a = !1, s = this.client.options.timeouts.realtimeRequestTimeout, c = b.Config.setTimeout(() => {
|
|
7253
7244
|
a = !0;
|
|
7254
7245
|
let e = "Token request via authCallback/authUrl did not complete within the configured timeout (" + s / 1e3 + " seconds)";
|
|
7255
|
-
|
|
7246
|
+
T.logAction(this.logger, T.LOG_ERROR, "Auth.requestToken()", e), t(new O({
|
|
7256
7247
|
message: e,
|
|
7257
7248
|
code: 40170,
|
|
7258
7249
|
statusCode: 401,
|
|
@@ -7262,7 +7253,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7262
7253
|
i(r, (r, i, s) => {
|
|
7263
7254
|
if (a) return;
|
|
7264
7255
|
if (b.Config.clearTimeout(c), r) {
|
|
7265
|
-
|
|
7256
|
+
T.logAction(this.logger, T.LOG_ERROR, "Auth.requestToken()", "token request signing call returned error; err = " + Te(r)), t(St(r));
|
|
7266
7257
|
return;
|
|
7267
7258
|
}
|
|
7268
7259
|
if (typeof i == "string") {
|
|
@@ -7291,7 +7282,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7291
7282
|
}
|
|
7292
7283
|
if (typeof i != "object" || !i) {
|
|
7293
7284
|
let e = "Expected token request callback to call back with a token string or token request/details object, but got a " + typeof i;
|
|
7294
|
-
|
|
7285
|
+
T.logAction(this.logger, T.LOG_ERROR, "Auth.requestToken()", e), t(new O({
|
|
7295
7286
|
message: e,
|
|
7296
7287
|
code: 40170,
|
|
7297
7288
|
statusCode: 401,
|
|
@@ -7315,7 +7306,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7315
7306
|
}
|
|
7316
7307
|
if (!("keyName" in i)) {
|
|
7317
7308
|
let e = "Expected token request callback to call back with a token string, token request object, or token details object. The returned object has neither a keyName nor an issued field.";
|
|
7318
|
-
|
|
7309
|
+
T.logAction(this.logger, T.LOG_ERROR, "Auth.requestToken()", e), t(new O({
|
|
7319
7310
|
message: e,
|
|
7320
7311
|
code: 40170,
|
|
7321
7312
|
statusCode: 401,
|
|
@@ -7325,10 +7316,10 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7325
7316
|
}
|
|
7326
7317
|
o(i, (n, r, i) => {
|
|
7327
7318
|
if (n) {
|
|
7328
|
-
|
|
7319
|
+
T.logAction(this.logger, T.LOG_ERROR, "Auth.requestToken()", "token request API call returned error; err = " + Te(n)), t(St(n));
|
|
7329
7320
|
return;
|
|
7330
7321
|
}
|
|
7331
|
-
i || (r = JSON.parse(r)),
|
|
7322
|
+
i || (r = JSON.parse(r)), T.logAction(this.logger, T.LOG_MINOR, "Auth.getToken()", "token received"), e(r);
|
|
7332
7323
|
});
|
|
7333
7324
|
});
|
|
7334
7325
|
});
|
|
@@ -7362,7 +7353,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7362
7353
|
let o = j({ keyName: i }, e), s = e.clientId || "", c = e.ttl || "", l = e.capability || "";
|
|
7363
7354
|
o.timestamp ||= await this._getTimestamp(t && t.queryTime);
|
|
7364
7355
|
let u = o.nonce ||= bt(), d = o.timestamp, f = o.keyName + "\n" + c + "\n" + l + "\n" + s + "\n" + d + "\n" + u + "\n";
|
|
7365
|
-
return o.mac = o.mac || Ct(f, a),
|
|
7356
|
+
return o.mac = o.mac || Ct(f, a), T.logAction(this.logger, T.LOG_MINOR, "Auth.getTokenRequest()", "generated signed request"), o;
|
|
7366
7357
|
}
|
|
7367
7358
|
async getAuthParams() {
|
|
7368
7359
|
if (this.method == "basic") return { key: this.key };
|
|
@@ -7395,8 +7386,8 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7395
7386
|
statusCode: 403,
|
|
7396
7387
|
remediation: "Issue the token with the same clientId as ClientOptions.clientId, or omit ClientOptions.clientId and let the token define it."
|
|
7397
7388
|
});
|
|
7398
|
-
if (!this.client.isTimeOffsetSet() || !t.expires || t.expires >= this.client.getTimestampUsingOffset()) return
|
|
7399
|
-
|
|
7389
|
+
if (!this.client.isTimeOffsetSet() || !t.expires || t.expires >= this.client.getTimestampUsingOffset()) return T.logAction(this.logger, T.LOG_MINOR, "Auth.getToken()", "using cached token; expires = " + t.expires), t;
|
|
7390
|
+
T.logAction(this.logger, T.LOG_MINOR, "Auth.getToken()", "deleting expired token"), this.tokenDetails = null;
|
|
7400
7391
|
}
|
|
7401
7392
|
let n = (this.waitingForTokenRequest ||= pt.create(this.logger)).createPromise();
|
|
7402
7393
|
if (this.currentTokenRequestId !== null && !e) return n;
|
|
@@ -7406,7 +7397,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7406
7397
|
} catch (e) {
|
|
7407
7398
|
a = e;
|
|
7408
7399
|
}
|
|
7409
|
-
if (this.currentTokenRequestId > r) return
|
|
7400
|
+
if (this.currentTokenRequestId > r) return T.logAction(this.logger, T.LOG_MINOR, "Auth._ensureValidAuthCredentials()", "Discarding token request response; overtaken by newer one"), n;
|
|
7410
7401
|
this.currentTokenRequestId = null;
|
|
7411
7402
|
let o = this.waitingForTokenRequest;
|
|
7412
7403
|
return this.waitingForTokenRequest = null, a ? (o?.rejectAll(a), n) : (o?.resolveAll(this.tokenDetails = i), n);
|
|
@@ -7437,7 +7428,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7437
7428
|
statusCode: 401,
|
|
7438
7429
|
remediation: "Issue the token with the matching clientId, or omit ClientOptions.clientId and let the token define it."
|
|
7439
7430
|
});
|
|
7440
|
-
return
|
|
7431
|
+
return T.logAction(this.logger, T.LOG_ERROR, "Auth._uncheckedSetClientId()", t), n;
|
|
7441
7432
|
}
|
|
7442
7433
|
return this.clientId = this.tokenParams.clientId = e, null;
|
|
7443
7434
|
}
|
|
@@ -7463,17 +7454,17 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7463
7454
|
return e + (t ? "?" : "") + jt(t);
|
|
7464
7455
|
}
|
|
7465
7456
|
function R(e, t, n, r, i) {
|
|
7466
|
-
e.error ?
|
|
7457
|
+
e.error ? T.logActionNoStrip(i, T.LOG_MICRO, "Http." + t + "()", "Received Error; " + Mt(n, r) + "; Error: " + Te(e.error)) : T.logActionNoStrip(i, T.LOG_MICRO, "Http." + t + "()", "Received; " + Mt(n, r) + "; Headers: " + jt(e.headers) + "; StatusCode: " + e.statusCode + "; Body" + (b.BufferUtils.isBuffer(e.body) ? " (Base64): " + b.BufferUtils.base64Encode(e.body) : ": " + e.body));
|
|
7467
7458
|
}
|
|
7468
7459
|
function Nt(e, t, n, r, i) {
|
|
7469
|
-
i.shouldLog(
|
|
7460
|
+
i.shouldLog(T.LOG_MICRO) && T.logActionNoStrip(i, T.LOG_MICRO, "Http." + e + "()", "Sending; " + Mt(t, r) + "; Body" + (b.BufferUtils.isBuffer(n) ? " (Base64): " + b.BufferUtils.base64Encode(n) : ": " + n));
|
|
7470
7461
|
}
|
|
7471
7462
|
var Pt = class {
|
|
7472
7463
|
constructor(e) {
|
|
7473
7464
|
this.client = e, this.platformHttp = new b.Http(e), this.checkConnectivity = this.platformHttp.checkConnectivity ? () => this.platformHttp.checkConnectivity() : void 0;
|
|
7474
7465
|
}
|
|
7475
7466
|
get logger() {
|
|
7476
|
-
return this.client?.logger ??
|
|
7467
|
+
return this.client?.logger ?? T.defaultLogger;
|
|
7477
7468
|
}
|
|
7478
7469
|
get supportsAuthHeaders() {
|
|
7479
7470
|
return this.platformHttp.supportsAuthHeaders;
|
|
@@ -7516,7 +7507,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7516
7507
|
try {
|
|
7517
7508
|
Nt(e, t, r, i, this.logger);
|
|
7518
7509
|
let a = await this.platformHttp.doUri(e, t, n, r, i);
|
|
7519
|
-
return this.logger.shouldLog(
|
|
7510
|
+
return this.logger.shouldLog(T.LOG_MICRO) && R(a, e, t, i, this.logger), a;
|
|
7520
7511
|
} catch (e) {
|
|
7521
7512
|
return { error: new O(`Unexpected error in Http.doUri: ${Te(e)}`, 500, 5e4) };
|
|
7522
7513
|
}
|
|
@@ -7526,7 +7517,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7526
7517
|
try {
|
|
7527
7518
|
n.apply(t, r);
|
|
7528
7519
|
} catch (t) {
|
|
7529
|
-
|
|
7520
|
+
T.logAction(e, T.LOG_ERROR, "EventEmitter.emit()", "Unexpected listener exception: " + t + "; stack = " + (t && t.stack));
|
|
7530
7521
|
}
|
|
7531
7522
|
}
|
|
7532
7523
|
function It(e, t, n) {
|
|
@@ -7884,13 +7875,13 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7884
7875
|
}
|
|
7885
7876
|
var H = class {}, $t = class {
|
|
7886
7877
|
constructor(e) {
|
|
7887
|
-
this.Platform = b, this.ErrorInfo = O, this.Logger =
|
|
7878
|
+
this.Platform = b, this.ErrorInfo = O, this.Logger = T, this.Defaults = I, this.Utils = E, this.EventEmitter = Lt, this.MessageEncoding = Zt, this._additionalHTTPRequestImplementations = e.plugins ?? null, this.logger = new T(), this.logger.setLog(e.logLevel, e.logHandler), T.logAction(this.logger, T.LOG_MICRO, "BaseClient()", "initialized with clientOptions " + b.Config.inspect(e)), this._MsgPack = e.plugins?.MsgPack ?? null;
|
|
7888
7879
|
let t = this.options = I.normaliseOptions(e, this._MsgPack, this.logger);
|
|
7889
7880
|
if (t.key) {
|
|
7890
7881
|
let e = t.key.match(/^([^:\s]+):([^:.\s]+)$/);
|
|
7891
7882
|
if (!e) {
|
|
7892
7883
|
let e = "invalid key parameter";
|
|
7893
|
-
throw
|
|
7884
|
+
throw T.logAction(this.logger, T.LOG_ERROR, "BaseClient()", e), new O({
|
|
7894
7885
|
message: e,
|
|
7895
7886
|
code: 40400,
|
|
7896
7887
|
statusCode: 404,
|
|
@@ -7913,7 +7904,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
7913
7904
|
remediation: "ClientOptions.clientId sets one fixed identity and cannot be \"*\". To let this client act as any clientId, request a wildcard token instead: set defaultTokenParams: { clientId: \"*\" } on the client. The \"*\" belongs in the token request, not in ClientOptions.clientId."
|
|
7914
7905
|
});
|
|
7915
7906
|
}
|
|
7916
|
-
|
|
7907
|
+
T.logAction(this.logger, T.LOG_MINOR, "BaseClient()", "started; version = " + I.version), this._currentFallback = null, this.serverTimeOffset = null, this.http = new Pt(this), this.auth = new At(this, t), this._rest = e.plugins?.Rest ? new e.plugins.Rest(this) : null, this._Crypto = e.plugins?.Crypto ?? null, this.__FilteredSubscriptions = e.plugins?.MessageInteractions ?? null, this._Annotations = e.plugins?.Annotations ?? null, this._liveObjectsPlugin = e.plugins?.LiveObjects ?? null;
|
|
7917
7908
|
}
|
|
7918
7909
|
get rest() {
|
|
7919
7910
|
return this._rest || He("Rest"), this._rest;
|
|
@@ -8064,7 +8055,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8064
8055
|
};
|
|
8065
8056
|
}
|
|
8066
8057
|
function an(e, t, n, r, i) {
|
|
8067
|
-
e.err ?
|
|
8058
|
+
e.err ? T.logAction(i, T.LOG_MICRO, "Resource." + t + "()", "Received Error; " + Mt(n, r) + "; Error: " + Te(e.err)) : T.logAction(i, T.LOG_MICRO, "Resource." + t + "()", "Received; " + Mt(n, r) + "; Headers: " + jt(e.headers) + "; StatusCode: " + e.statusCode + "; Body: " + (b.BufferUtils.isBuffer(e.body) ? " (Base64): " + b.BufferUtils.base64Encode(e.body) : ": " + b.Config.inspect(e.body)));
|
|
8068
8059
|
}
|
|
8069
8060
|
var on = class e {
|
|
8070
8061
|
static async get(t, n, r, i, a, o) {
|
|
@@ -8086,14 +8077,14 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8086
8077
|
o && ((a ||= {}).envelope = o);
|
|
8087
8078
|
let c = t.logger;
|
|
8088
8079
|
async function l(i, a) {
|
|
8089
|
-
if (c.shouldLog(
|
|
8080
|
+
if (c.shouldLog(T.LOG_MICRO)) {
|
|
8090
8081
|
let o = r;
|
|
8091
8082
|
if (i["content-type"]?.indexOf("msgpack") > 0) try {
|
|
8092
8083
|
t._MsgPack || He("MsgPack"), o = t._MsgPack.decode(r);
|
|
8093
8084
|
} catch (t) {
|
|
8094
|
-
|
|
8085
|
+
T.logAction(c, T.LOG_MICRO, "Resource." + e + "()", "Sending MsgPack Decoding Error: " + Te(t));
|
|
8095
8086
|
}
|
|
8096
|
-
|
|
8087
|
+
T.logAction(c, T.LOG_MICRO, "Resource." + e + "()", "Sending; " + Mt(n, a) + "; Body: " + o);
|
|
8097
8088
|
}
|
|
8098
8089
|
let o = await t.http.do(e, n, i, r, a);
|
|
8099
8090
|
return o.error && At.isTokenErr(o.error) ? (await t.auth.authorize(null, null), nn(t, i, a, l)) : {
|
|
@@ -8105,7 +8096,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8105
8096
|
};
|
|
8106
8097
|
}
|
|
8107
8098
|
let u = await nn(t, i, a, l);
|
|
8108
|
-
if (o && (u = rn(u, t._MsgPack, o)), c.shouldLog(
|
|
8099
|
+
if (o && (u = rn(u, t._MsgPack, o)), c.shouldLog(T.LOG_MICRO) && an(u, e, n, a, c), s) {
|
|
8109
8100
|
if (u.err) throw u.err;
|
|
8110
8101
|
{
|
|
8111
8102
|
let e = d({}, u);
|
|
@@ -8162,7 +8153,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8162
8153
|
return this.handlePage(n);
|
|
8163
8154
|
}
|
|
8164
8155
|
async handlePage(e) {
|
|
8165
|
-
if (e.err && ln(e.err, e.body, this.useHttpPaginatedResponse)) throw
|
|
8156
|
+
if (e.err && ln(e.err, e.body, this.useHttpPaginatedResponse)) throw T.logAction(this.logger, T.LOG_ERROR, "PaginatedResource.handlePage()", "Unexpected error getting resource: err = " + Te(e.err)), e.err;
|
|
8166
8157
|
let t, n, r;
|
|
8167
8158
|
try {
|
|
8168
8159
|
t = e.statusCode == vt.NoContent ? [] : await this.bodyHandler(e.body, e.headers || {}, e.unpacked);
|
|
@@ -8529,7 +8520,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8529
8520
|
try {
|
|
8530
8521
|
await qt(n, e);
|
|
8531
8522
|
} catch (e) {
|
|
8532
|
-
|
|
8523
|
+
T.logAction(t, T.LOG_ERROR, "WirePresenceMessage.decode()", Te(e));
|
|
8533
8524
|
}
|
|
8534
8525
|
return n;
|
|
8535
8526
|
}
|
|
@@ -8544,12 +8535,12 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8544
8535
|
return this.channel.logger;
|
|
8545
8536
|
}
|
|
8546
8537
|
async get(e) {
|
|
8547
|
-
|
|
8538
|
+
T.logAction(this.logger, T.LOG_MICRO, "RestPresence.get()", "channel = " + this.channel.name);
|
|
8548
8539
|
let t = this.channel.client, n = t.options.useBinaryProtocol ? "msgpack" : "json", r = this.channel.client.http.supportsLinkHeaders ? void 0 : n, i = I.defaultGetHeaders(t.options);
|
|
8549
8540
|
return j(i, t.options.headers), new pn(t, this.channel.client.rest.presenceMixin.basePath(this), i, r, async (e, r, i) => Dn(i ? e : Me(e, t._MsgPack, n), this.channel)).get(e);
|
|
8550
8541
|
}
|
|
8551
8542
|
async history(e) {
|
|
8552
|
-
return
|
|
8543
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestPresence.history()", "channel = " + this.channel.name), this.channel.client.rest.presenceMixin.history(this, e);
|
|
8553
8544
|
}
|
|
8554
8545
|
}, jn = [
|
|
8555
8546
|
"message.create",
|
|
@@ -8624,7 +8615,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8624
8615
|
try {
|
|
8625
8616
|
await qt(n, e);
|
|
8626
8617
|
} catch (e) {
|
|
8627
|
-
|
|
8618
|
+
T.logAction(t, T.LOG_ERROR, "WireMessage.decode()", Te(e)), r = e;
|
|
8628
8619
|
}
|
|
8629
8620
|
return n.expandFields(), {
|
|
8630
8621
|
decoded: n,
|
|
@@ -8646,7 +8637,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8646
8637
|
}
|
|
8647
8638
|
var Kn = class {
|
|
8648
8639
|
constructor(e, t, n) {
|
|
8649
|
-
this._annotations = null,
|
|
8640
|
+
this._annotations = null, T.logAction(e.logger, T.LOG_MINOR, "RestChannel()", "started; name = " + t), this.name = t, this.client = e, this.presence = new G(this), this.channelOptions = st(e._Crypto ?? null, this.logger, n), e.options.plugins?.Push && (this._push = new e.options.plugins.Push.PushChannel(this)), e._Annotations && (this._annotations = new e._Annotations.RestAnnotations(this)), e._liveObjectsPlugin && (this._object = new e._liveObjectsPlugin.RestObject(this));
|
|
8650
8641
|
}
|
|
8651
8642
|
get annotations() {
|
|
8652
8643
|
return this._annotations || He("Annotations"), this._annotations;
|
|
@@ -8664,7 +8655,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8664
8655
|
this.channelOptions = st(this.client._Crypto ?? null, this.logger, e);
|
|
8665
8656
|
}
|
|
8666
8657
|
async history(e) {
|
|
8667
|
-
return
|
|
8658
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestChannel.history()", "channel = " + this.name), this.client.rest.channelMixin.history(this, e ?? null);
|
|
8668
8659
|
}
|
|
8669
8660
|
async publish(...e) {
|
|
8670
8661
|
let t = e[0], n = e[1], r, i;
|
|
@@ -8705,19 +8696,19 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8705
8696
|
return this.client.rest.channelMixin.status(this);
|
|
8706
8697
|
}
|
|
8707
8698
|
async getMessage(e) {
|
|
8708
|
-
return
|
|
8699
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestChannel.getMessage()", "channel = " + this.name), this.client.rest.channelMixin.getMessage(this, e);
|
|
8709
8700
|
}
|
|
8710
8701
|
async updateMessage(e, t, n) {
|
|
8711
|
-
return
|
|
8702
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestChannel.updateMessage()", "channel = " + this.name), this.client.rest.channelMixin.updateDeleteMessage(this, "message.update", e, t, n);
|
|
8712
8703
|
}
|
|
8713
8704
|
async deleteMessage(e, t, n) {
|
|
8714
|
-
return
|
|
8705
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestChannel.deleteMessage()", "channel = " + this.name), this.client.rest.channelMixin.updateDeleteMessage(this, "message.delete", e, t, n);
|
|
8715
8706
|
}
|
|
8716
8707
|
async appendMessage(e, t, n) {
|
|
8717
|
-
return
|
|
8708
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestChannel.appendMessage()", "channel = " + this.name), this.client.rest.channelMixin.updateDeleteMessage(this, "message.append", e, t, n);
|
|
8718
8709
|
}
|
|
8719
8710
|
async getMessageVersions(e, t) {
|
|
8720
|
-
return
|
|
8711
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RestChannel.getMessageVersions()", "channel = " + this.name), this.client.rest.channelMixin.getMessageVersions(this, e, t);
|
|
8721
8712
|
}
|
|
8722
8713
|
}, qn = class e {
|
|
8723
8714
|
constructor(e) {
|
|
@@ -8878,24 +8869,24 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8878
8869
|
}
|
|
8879
8870
|
}, Xn = class extends en {
|
|
8880
8871
|
constructor(e) {
|
|
8881
|
-
super(I.objectifyOptions(e, !1, "BaseRest",
|
|
8872
|
+
super(I.objectifyOptions(e, !1, "BaseRest", T.defaultLogger, { Rest: Yn }));
|
|
8882
8873
|
}
|
|
8883
8874
|
}, Zn = { Rest: Yn }, Qn = class extends Un {
|
|
8884
8875
|
static async fromEncoded(e, t) {
|
|
8885
|
-
return Pn(
|
|
8876
|
+
return Pn(T.defaultLogger, b.Crypto, e, t);
|
|
8886
8877
|
}
|
|
8887
8878
|
static async fromEncodedArray(e, t) {
|
|
8888
|
-
return Fn(
|
|
8879
|
+
return Fn(T.defaultLogger, b.Crypto, e, t);
|
|
8889
8880
|
}
|
|
8890
8881
|
static fromValues(e) {
|
|
8891
8882
|
return Un.fromValues(e);
|
|
8892
8883
|
}
|
|
8893
8884
|
}, $n = class extends An {
|
|
8894
8885
|
static async fromEncoded(e, t) {
|
|
8895
|
-
return wn(
|
|
8886
|
+
return wn(T.defaultLogger, b.Crypto, e, t);
|
|
8896
8887
|
}
|
|
8897
8888
|
static async fromEncodedArray(e, t) {
|
|
8898
|
-
return Tn(
|
|
8889
|
+
return Tn(T.defaultLogger, b.Crypto, e, t);
|
|
8899
8890
|
}
|
|
8900
8891
|
static fromValues(e) {
|
|
8901
8892
|
return An.fromValues(e);
|
|
@@ -8945,7 +8936,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8945
8936
|
try {
|
|
8946
8937
|
await qt(n, e);
|
|
8947
8938
|
} catch (e) {
|
|
8948
|
-
|
|
8939
|
+
T.logAction(t, T.LOG_ERROR, "WireAnnotation.decode()", Te(e));
|
|
8949
8940
|
}
|
|
8950
8941
|
return n;
|
|
8951
8942
|
}
|
|
@@ -8954,10 +8945,10 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
8954
8945
|
}
|
|
8955
8946
|
}, sr = ar, cr = class extends sr {
|
|
8956
8947
|
static async fromEncoded(e, t) {
|
|
8957
|
-
return tr(
|
|
8948
|
+
return tr(T.defaultLogger, e, t);
|
|
8958
8949
|
}
|
|
8959
8950
|
static async fromEncodedArray(e, t) {
|
|
8960
|
-
return nr(
|
|
8951
|
+
return nr(T.defaultLogger, e, t);
|
|
8961
8952
|
}
|
|
8962
8953
|
static fromValues(e) {
|
|
8963
8954
|
return sr.fromValues(e);
|
|
@@ -9029,7 +9020,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9029
9020
|
let s;
|
|
9030
9021
|
n && e.annotations && (s = n.WireAnnotation.fromValuesArray(e.annotations));
|
|
9031
9022
|
let c;
|
|
9032
|
-
return r && e.state && (c = r.WireObjectMessage.fromValuesArray(e.state,
|
|
9023
|
+
return r && e.state && (c = r.WireObjectMessage.fromValuesArray(e.state, E, Zt)), Object.assign(new yr(), f(d({}, e), {
|
|
9033
9024
|
presence: o,
|
|
9034
9025
|
messages: a,
|
|
9035
9026
|
annotations: s,
|
|
@@ -9064,7 +9055,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9064
9055
|
"timestamp"
|
|
9065
9056
|
], o;
|
|
9066
9057
|
for (let t = 0; t < a.length; t++) o = a[t], e[o] !== void 0 && (i += "; " + o + "=" + e[o]);
|
|
9067
|
-
if (e.messages && (i += "; messages=" + mr(Hn.fromValuesArray(e.messages))), e.presence && t && (i += "; presence=" + mr(t.WirePresenceMessage.fromValuesArray(e.presence))), e.annotations && n && (i += "; annotations=" + mr(n.WireAnnotation.fromValuesArray(e.annotations))), e.state && r && (i += "; state=" + mr(r.WireObjectMessage.fromValuesArray(e.state,
|
|
9058
|
+
if (e.messages && (i += "; messages=" + mr(Hn.fromValuesArray(e.messages))), e.presence && t && (i += "; presence=" + mr(t.WirePresenceMessage.fromValuesArray(e.presence))), e.annotations && n && (i += "; annotations=" + mr(n.WireAnnotation.fromValuesArray(e.annotations))), e.state && r && (i += "; state=" + mr(r.WireObjectMessage.fromValuesArray(e.state, E, Zt))), e.error && (i += "; error=" + O.fromValues(e.error).toString()), e.auth && e.auth.accessToken && (i += "; token=" + e.auth.accessToken), e.flags && (i += "; flags=" + Bt.filter(e.hasFlag).join(",")), e.params) {
|
|
9068
9059
|
let t = "";
|
|
9069
9060
|
ge(e.params, function(n) {
|
|
9070
9061
|
t.length > 0 && (t += "; "), t += n + "=" + e.params[n];
|
|
@@ -9126,7 +9117,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9126
9117
|
super(e.logger), this._annotations = null, this._mode = 0, this._silentSubscribeWarned = !1, this.retryCount = 0, this.history = function(...e) {
|
|
9127
9118
|
return we(e, 0), this._historyImpl(e[0]);
|
|
9128
9119
|
}, this._historyImpl = async function(e) {
|
|
9129
|
-
|
|
9120
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.history()", "channel = " + this.name);
|
|
9130
9121
|
let t = this.client.rest.channelMixin;
|
|
9131
9122
|
if (e && e.untilAttach) {
|
|
9132
9123
|
if (this.state !== "attached") throw new O({
|
|
@@ -9144,7 +9135,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9144
9135
|
delete e.untilAttach, e.from_serial = this.properties.attachSerial;
|
|
9145
9136
|
}
|
|
9146
9137
|
return t.history(this, e);
|
|
9147
|
-
}, this.whenState = (e) => Lt.prototype.whenState.call(this, e, this.state),
|
|
9138
|
+
}, this.whenState = (e) => Lt.prototype.whenState.call(this, e, this.state), T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel()", "started; name = " + t), this.name = t, this.channelOptions = st(e._Crypto ?? null, this.logger, n), this.client = e, this._presence = e._RealtimePresence ? new e._RealtimePresence.RealtimePresence(this) : null, e._Annotations && (this._annotations = new e._Annotations.RealtimeAnnotations(this)), this.connectionManager = e.connection.connectionManager, this.state = "initialized", this.subscriptions = new Lt(this.logger), this.syncChannelSerial = void 0, this.properties = {
|
|
9148
9139
|
attachSerial: void 0,
|
|
9149
9140
|
channelSerial: void 0
|
|
9150
9141
|
}, this.setOptions(n), this.errorReason = null, this._attachResume = !1, this._decodingContext = {
|
|
@@ -9230,7 +9221,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9230
9221
|
statusCode: 400,
|
|
9231
9222
|
remediation: "Split the publish into multiple calls so each batch is under the limit. If a single message exceeds the limit, reduce its payload size. To lift the account limit, contact Ably support."
|
|
9232
9223
|
});
|
|
9233
|
-
this.throwIfUnpublishableState(),
|
|
9224
|
+
this.throwIfUnpublishableState(), T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.publish()", "sending message; channel state is " + this.state + ", message count = " + o.length);
|
|
9234
9225
|
let c = _r({
|
|
9235
9226
|
action: z.MESSAGE,
|
|
9236
9227
|
channel: this.name,
|
|
@@ -9244,7 +9235,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9244
9235
|
if (this.state === "failed" || this.state === "suspended") throw this.invalidStateError();
|
|
9245
9236
|
}
|
|
9246
9237
|
onEvent(e) {
|
|
9247
|
-
|
|
9238
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.onEvent()", "received message");
|
|
9248
9239
|
let t = this.subscriptions;
|
|
9249
9240
|
for (let n = 0; n < e.length; n++) {
|
|
9250
9241
|
let r = e[n];
|
|
@@ -9258,7 +9249,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9258
9249
|
}
|
|
9259
9250
|
_attach(e, t, n) {
|
|
9260
9251
|
n ||= (e) => {
|
|
9261
|
-
e &&
|
|
9252
|
+
e && T.logAction(this.logger, T.LOG_ERROR, "RealtimeChannel._attach()", "Channel attach failed: " + e.toString());
|
|
9262
9253
|
};
|
|
9263
9254
|
let r = this.connectionManager;
|
|
9264
9255
|
if (!r.activeState()) {
|
|
@@ -9280,7 +9271,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9280
9271
|
});
|
|
9281
9272
|
}
|
|
9282
9273
|
attachImpl() {
|
|
9283
|
-
|
|
9274
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.attachImpl()", "sending ATTACH message");
|
|
9284
9275
|
let e = _r({
|
|
9285
9276
|
action: z.ATTACH,
|
|
9286
9277
|
channel: this.name,
|
|
@@ -9326,7 +9317,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9326
9317
|
}
|
|
9327
9318
|
}
|
|
9328
9319
|
detachImpl() {
|
|
9329
|
-
|
|
9320
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.detach()", "sending DETACH message");
|
|
9330
9321
|
let e = _r({
|
|
9331
9322
|
action: z.DETACH,
|
|
9332
9323
|
channel: this.name
|
|
@@ -9349,7 +9340,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9349
9340
|
remediation: "Include \"subscribe\" in the channel modes: realtime.channels.get(name, { modes: [\"subscribe\", ...] }), or call channel.setOptions({ modes: [...] }) on an existing channel to trigger a reattach. Alternatively, omit modes entirely and ensure your token/API-key capability permits subscribe on this channel. If you have the Ably CLI installed, `ably auth keys list` shows your key's capabilities."
|
|
9350
9341
|
});
|
|
9351
9342
|
if (this.client.options.strictMode === !0) throw e;
|
|
9352
|
-
this._silentSubscribeWarned ||= (
|
|
9343
|
+
this._silentSubscribeWarned ||= (T.logActionNoStrip(this.logger, T.LOG_ERROR, "RealtimeChannel.subscribe()", e.message + "; remediation=" + e.remediation + T.silentFailureLogSuffix()), !0);
|
|
9353
9344
|
}
|
|
9354
9345
|
return i;
|
|
9355
9346
|
}
|
|
@@ -9453,14 +9444,14 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9453
9444
|
}
|
|
9454
9445
|
case z.MESSAGE: {
|
|
9455
9446
|
if (this.state !== "attached") {
|
|
9456
|
-
|
|
9447
|
+
T.logAction(this.logger, T.LOG_MAJOR, "RealtimeChannel.processMessage()", "Message \"" + e.id + "\" skipped as this channel \"" + this.name + "\" state is not \"attached\" (state is \"" + this.state + "\").");
|
|
9457
9448
|
return;
|
|
9458
9449
|
}
|
|
9459
9450
|
V(e);
|
|
9460
9451
|
let t = e.messages, n = t[0], r = t[t.length - 1];
|
|
9461
9452
|
if (n.extras && n.extras.delta && n.extras.delta.from !== this._lastPayload.messageId) {
|
|
9462
9453
|
let t = "Delta message decode failure - previous message not available for message \"" + e.id + "\" on this channel \"" + this.name + "\".";
|
|
9463
|
-
|
|
9454
|
+
T.logAction(this.logger, T.LOG_ERROR, "RealtimeChannel.processMessage()", t), this._startDecodeFailureRecovery(new O(t, 40018, 400));
|
|
9464
9455
|
break;
|
|
9465
9456
|
}
|
|
9466
9457
|
let i = [];
|
|
@@ -9493,36 +9484,36 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9493
9484
|
t && t.code == 80016 ? this.checkPendingState() : this.notifyState("failed", O.fromValues(t));
|
|
9494
9485
|
break;
|
|
9495
9486
|
}
|
|
9496
|
-
default:
|
|
9487
|
+
default: T.logAction(this.logger, T.LOG_MAJOR, "RealtimeChannel.processMessage()", "Protocol error: unrecognised message action (" + e.action + ")");
|
|
9497
9488
|
}
|
|
9498
9489
|
}
|
|
9499
9490
|
_startDecodeFailureRecovery(e) {
|
|
9500
|
-
this._lastPayload.decodeFailureRecoveryInProgress || (
|
|
9491
|
+
this._lastPayload.decodeFailureRecoveryInProgress || (T.logAction(this.logger, T.LOG_MAJOR, "RealtimeChannel.processMessage()", "Starting decode failure recovery process."), this._lastPayload.decodeFailureRecoveryInProgress = !0, this._attach(!0, e, () => {
|
|
9501
9492
|
this._lastPayload.decodeFailureRecoveryInProgress = !1;
|
|
9502
9493
|
}));
|
|
9503
9494
|
}
|
|
9504
9495
|
onAttached() {
|
|
9505
|
-
|
|
9496
|
+
T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel.onAttached", "activating channel; name = " + this.name);
|
|
9506
9497
|
}
|
|
9507
9498
|
notifyState(e, t, n, r, i, a) {
|
|
9508
|
-
if (
|
|
9499
|
+
if (T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.notifyState", "name = " + this.name + ", current state = " + this.state + ", notifying state " + e), this.clearStateTimer(), [
|
|
9509
9500
|
"detached",
|
|
9510
9501
|
"suspended",
|
|
9511
9502
|
"failed"
|
|
9512
9503
|
].includes(e) && (this.properties.channelSerial = null), e === this.state) return;
|
|
9513
9504
|
this._presence && this._presence.actOnChannelState(e, r, t), this._object && this._object.actOnChannelState(e, a), e === "suspended" && this.connectionManager.state.sendEvents ? this.startRetryTimer() : this.cancelRetryTimer(), t && (this.errorReason = t);
|
|
9514
9505
|
let o = new xr(this.state, e, n, i, t), s = "Channel state for channel \"" + this.name + "\"", c = e + (t ? "; reason: " + t : "");
|
|
9515
|
-
e === "failed" ?
|
|
9506
|
+
e === "failed" ? T.logAction(this.logger, T.LOG_ERROR, s, c) : T.logAction(this.logger, T.LOG_MAJOR, s, c), e !== "attaching" && e !== "suspended" && (this.retryCount = 0), e === "attached" && this.onAttached(), e === "attached" ? this._attachResume = !0 : (e === "detaching" || e === "failed") && (this._attachResume = !1), this.state = e, this.emit(e, o);
|
|
9516
9507
|
}
|
|
9517
9508
|
requestState(e, t) {
|
|
9518
|
-
|
|
9509
|
+
T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel.requestState", "name = " + this.name + ", state = " + e), this.notifyState(e, t), this.checkPendingState();
|
|
9519
9510
|
}
|
|
9520
9511
|
checkPendingState() {
|
|
9521
9512
|
if (!this.connectionManager.state.sendEvents) {
|
|
9522
|
-
|
|
9513
|
+
T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel.checkPendingState", "sendEvents is false; state is " + this.connectionManager.state.state);
|
|
9523
9514
|
return;
|
|
9524
9515
|
}
|
|
9525
|
-
switch (
|
|
9516
|
+
switch (T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel.checkPendingState", "name = " + this.name + ", state = " + this.state), this.state) {
|
|
9526
9517
|
case "attaching":
|
|
9527
9518
|
this.startStateTimerIfNotRunning(), this.attachImpl();
|
|
9528
9519
|
break;
|
|
@@ -9559,7 +9550,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9559
9550
|
}
|
|
9560
9551
|
startStateTimerIfNotRunning() {
|
|
9561
9552
|
this.stateTimer ||= b.Config.setTimeout(() => {
|
|
9562
|
-
|
|
9553
|
+
T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel.startStateTimerIfNotRunning", "timer expired"), this.stateTimer = null, this.timeoutPendingState();
|
|
9563
9554
|
}, this.client.options.timeouts.realtimeRequestTimeout);
|
|
9564
9555
|
}
|
|
9565
9556
|
clearStateTimer() {
|
|
@@ -9571,7 +9562,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9571
9562
|
this.retryCount++;
|
|
9572
9563
|
let e = N(this.client.options.timeouts.channelRetryTimeout, this.retryCount);
|
|
9573
9564
|
this.retryTimer = b.Config.setTimeout(() => {
|
|
9574
|
-
this.state === "suspended" && this.connectionManager.state.sendEvents && (this.retryTimer = null,
|
|
9565
|
+
this.state === "suspended" && this.connectionManager.state.sendEvents && (this.retryTimer = null, T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel retry timer expired", "attempting a new attach"), this.requestState("attaching"));
|
|
9575
9566
|
}, e);
|
|
9576
9567
|
}
|
|
9577
9568
|
cancelRetryTimer() {
|
|
@@ -9587,22 +9578,22 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9587
9578
|
});
|
|
9588
9579
|
}
|
|
9589
9580
|
setChannelSerial(e) {
|
|
9590
|
-
|
|
9581
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.setChannelSerial()", "Updating channel serial; serial = " + e + "; previous = " + this.properties.channelSerial), e && (this.properties.channelSerial = e);
|
|
9591
9582
|
}
|
|
9592
9583
|
async status() {
|
|
9593
9584
|
return this.client.rest.channelMixin.status(this);
|
|
9594
9585
|
}
|
|
9595
9586
|
async getMessage(e) {
|
|
9596
|
-
return
|
|
9587
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.getMessage()", "channel = " + this.name), this.client.rest.channelMixin.getMessage(this, e);
|
|
9597
9588
|
}
|
|
9598
9589
|
async updateMessage(e, t, n) {
|
|
9599
|
-
return
|
|
9590
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.updateMessage()", "channel = " + this.name), this.sendUpdate(e, "message.update", t, n);
|
|
9600
9591
|
}
|
|
9601
9592
|
async deleteMessage(e, t, n) {
|
|
9602
|
-
return
|
|
9593
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.deleteMessage()", "channel = " + this.name), this.sendUpdate(e, "message.delete", t, n);
|
|
9603
9594
|
}
|
|
9604
9595
|
async appendMessage(e, t, n) {
|
|
9605
|
-
return
|
|
9596
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.appendMessage()", "channel = " + this.name), this.sendUpdate(e, "message.append", t, n);
|
|
9606
9597
|
}
|
|
9607
9598
|
async sendUpdate(e, t, n, r) {
|
|
9608
9599
|
if (!e.serial) throw new O({
|
|
@@ -9624,7 +9615,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9624
9615
|
return { versionSerial: (await this.sendAndAwaitAck(a)).serials[0] ?? null };
|
|
9625
9616
|
}
|
|
9626
9617
|
async getMessageVersions(e, t) {
|
|
9627
|
-
return
|
|
9618
|
+
return T.logAction(this.logger, T.LOG_MICRO, "RealtimeChannel.getMessageVersions()", "channel = " + this.name), this.client.rest.channelMixin.getMessageVersions(this, e, t);
|
|
9628
9619
|
}
|
|
9629
9620
|
async ensureAttached() {
|
|
9630
9621
|
switch (this.state) {
|
|
@@ -9650,7 +9641,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9650
9641
|
}
|
|
9651
9642
|
async publish(e, t) {
|
|
9652
9643
|
let n = this.channel.name, r = ur(e, t), i = await r.encode();
|
|
9653
|
-
this.channel.throwIfUnpublishableState(),
|
|
9644
|
+
this.channel.throwIfUnpublishableState(), T.logAction(this.logger, T.LOG_MICRO, "RealtimeAnnotations.publish()", "channelName = " + n + ", sending annotation with messageSerial = " + r.messageSerial + ", type = " + r.type);
|
|
9654
9645
|
let a = _r({
|
|
9655
9646
|
action: z.ANNOTATION,
|
|
9656
9647
|
channel: n,
|
|
@@ -9671,7 +9662,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9671
9662
|
statusCode: 400,
|
|
9672
9663
|
remediation: "Include \"annotation_subscribe\" in the channel modes: realtime.channels.get(name, { modes: [\"annotation_subscribe\", ...] }), or call channel.setOptions({ modes: [...] }) on an existing channel to trigger a reattach. Calling channels.get(name, { modes }) on an existing channel throws. The server only grants the mode if your key or token has the annotation-subscribe capability. Without it the attach succeeds but the server silently drops the mode and annotations are never delivered. `ably auth keys list` shows your key's capabilities."
|
|
9673
9664
|
});
|
|
9674
|
-
throw
|
|
9665
|
+
throw T.logActionNoStrip(this.logger, T.LOG_MAJOR, "RealtimeAnnotations.subscribe()", e.message + "; remediation=" + e.remediation), e;
|
|
9675
9666
|
}
|
|
9676
9667
|
}
|
|
9677
9668
|
unsubscribe(...e) {
|
|
@@ -9687,7 +9678,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9687
9678
|
}, Dr = class e extends Xn {
|
|
9688
9679
|
constructor(t) {
|
|
9689
9680
|
if (!e._MsgPack) throw Error("Expected DefaultRest._MsgPack to have been set");
|
|
9690
|
-
super(I.objectifyOptions(t, !0, "Rest",
|
|
9681
|
+
super(I.objectifyOptions(t, !0, "Rest", T.defaultLogger, f(d({}, Zn), {
|
|
9691
9682
|
Crypto: e.Crypto ?? void 0,
|
|
9692
9683
|
MsgPack: e._MsgPack ?? void 0,
|
|
9693
9684
|
Annotations: {
|
|
@@ -9733,7 +9724,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9733
9724
|
this.messages.unshift.apply(this.messages, e);
|
|
9734
9725
|
}
|
|
9735
9726
|
completeMessages(e, t, n) {
|
|
9736
|
-
|
|
9727
|
+
T.logAction(this.logger, T.LOG_MICRO, "MessageQueue.completeMessages()", e == "all" ? "(all)" : "serial = " + e.serial + "; count = " + e.count), t ||= null;
|
|
9737
9728
|
let r = this.messages;
|
|
9738
9729
|
if (r.length === 0) throw Error("MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue");
|
|
9739
9730
|
let i = [];
|
|
@@ -9758,7 +9749,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9758
9749
|
for (let e of this.messages) e.sendAttempted = !1;
|
|
9759
9750
|
}
|
|
9760
9751
|
clear() {
|
|
9761
|
-
|
|
9752
|
+
T.logAction(this.logger, T.LOG_MICRO, "MessageQueue.clear()", "clearing " + this.messages.length + " messages"), this.messages = [], this.emit("idle");
|
|
9762
9753
|
}
|
|
9763
9754
|
}, Ar = class {
|
|
9764
9755
|
constructor(e, t) {
|
|
@@ -9780,13 +9771,13 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9780
9771
|
});
|
|
9781
9772
|
}
|
|
9782
9773
|
onAck(e, t, n) {
|
|
9783
|
-
|
|
9774
|
+
T.logAction(this.logger, T.LOG_MICRO, "Protocol.onAck()", "serial = " + e + "; count = " + t), this.messageQueue.completeMessages({
|
|
9784
9775
|
serial: e,
|
|
9785
9776
|
count: t
|
|
9786
9777
|
}, null, n);
|
|
9787
9778
|
}
|
|
9788
9779
|
onNack(e, t, n) {
|
|
9789
|
-
|
|
9780
|
+
T.logAction(this.logger, T.LOG_ERROR, "Protocol.onNack()", "serial = " + e + "; count = " + t + "; err = " + Te(n)), n ||= new O("Unable to send message; channel not responding", 50001, 500), this.messageQueue.completeMessages({
|
|
9790
9781
|
serial: e,
|
|
9791
9782
|
count: t
|
|
9792
9783
|
}, n);
|
|
@@ -9800,7 +9791,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9800
9791
|
t.once("idle", e);
|
|
9801
9792
|
}
|
|
9802
9793
|
send(e) {
|
|
9803
|
-
e.ackRequired && this.messageQueue.push(e), this.logger.shouldLog(
|
|
9794
|
+
e.ackRequired && this.messageQueue.push(e), this.logger.shouldLog(T.LOG_MICRO) && T.logActionNoStrip(this.logger, T.LOG_MICRO, "Protocol.send()", "sending msg; " + vr(e.message, this.transport.connectionManager.realtime._RealtimePresence, this.transport.connectionManager.realtime._Annotations, this.transport.connectionManager.realtime._liveObjectsPlugin)), e.sendAttempted = !0, this.transport.send(e.message);
|
|
9804
9795
|
}
|
|
9805
9796
|
getTransport() {
|
|
9806
9797
|
return this.transport;
|
|
@@ -9887,9 +9878,9 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9887
9878
|
this.isFinished || (this.isFinished = !0, this.isConnected = !1, this.maxIdleInterval = null, b.Config.clearTimeout(this.idleTimer ?? void 0), this.idleTimer = null, this.emit(e, t), this.dispose());
|
|
9888
9879
|
}
|
|
9889
9880
|
onProtocolMessage(e) {
|
|
9890
|
-
switch (this.logger.shouldLog(
|
|
9881
|
+
switch (this.logger.shouldLog(T.LOG_MICRO) && T.logActionNoStrip(this.logger, T.LOG_MICRO, "Transport.onProtocolMessage()", "received on " + this.shortName + ": " + vr(e, this.connectionManager.realtime._RealtimePresence, this.connectionManager.realtime._Annotations, this.connectionManager.realtime._liveObjectsPlugin) + "; connectionId = " + this.connectionManager.connectionId), this.onActivity(), e.action) {
|
|
9891
9882
|
case z.HEARTBEAT:
|
|
9892
|
-
|
|
9883
|
+
T.logActionNoStrip(this.logger, T.LOG_MICRO, "Transport.onProtocolMessage()", this.shortName + " heartbeat; connectionId = " + this.connectionManager.connectionId), this.emit("heartbeat", e.id);
|
|
9893
9884
|
break;
|
|
9894
9885
|
case z.CONNECTED:
|
|
9895
9886
|
this.onConnect(e), this.emit("connected", e.error, e.connectionId, e.connectionDetails, e);
|
|
@@ -9912,11 +9903,11 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9912
9903
|
case z.ACTIVATE: break;
|
|
9913
9904
|
case z.AUTH:
|
|
9914
9905
|
je(this.auth.authorize(), (e) => {
|
|
9915
|
-
e &&
|
|
9906
|
+
e && T.logAction(this.logger, T.LOG_ERROR, "Transport.onProtocolMessage()", "Ably requested re-authentication, but unable to obtain a new token: " + Te(e));
|
|
9916
9907
|
});
|
|
9917
9908
|
break;
|
|
9918
9909
|
case z.ERROR:
|
|
9919
|
-
if (
|
|
9910
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "Transport.onProtocolMessage()", "received error action; connectionId = " + this.connectionManager.connectionId + "; err = " + b.Config.inspect(e.error) + (e.channel ? ", channel: " + e.channel : "")), e.channel === void 0) {
|
|
9920
9911
|
this.onFatalError(e);
|
|
9921
9912
|
break;
|
|
9922
9913
|
}
|
|
@@ -9932,28 +9923,28 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9932
9923
|
}
|
|
9933
9924
|
onDisconnect(e) {
|
|
9934
9925
|
let t = e && e.error;
|
|
9935
|
-
|
|
9926
|
+
T.logAction(this.logger, T.LOG_MINOR, "Transport.onDisconnect()", "err = " + Te(t)), this.finish("disconnected", t);
|
|
9936
9927
|
}
|
|
9937
9928
|
onFatalError(e) {
|
|
9938
9929
|
let t = e && e.error;
|
|
9939
|
-
|
|
9930
|
+
T.logAction(this.logger, T.LOG_MINOR, "Transport.onFatalError()", "err = " + Te(t)), this.finish("failed", t);
|
|
9940
9931
|
}
|
|
9941
9932
|
onClose(e) {
|
|
9942
9933
|
let t = e && e.error;
|
|
9943
|
-
|
|
9934
|
+
T.logAction(this.logger, T.LOG_MINOR, "Transport.onClose()", "err = " + Te(t)), this.finish("closed", t);
|
|
9944
9935
|
}
|
|
9945
9936
|
requestClose() {
|
|
9946
|
-
|
|
9937
|
+
T.logAction(this.logger, T.LOG_MINOR, "Transport.requestClose()", ""), this.send(Fr);
|
|
9947
9938
|
}
|
|
9948
9939
|
requestDisconnect() {
|
|
9949
|
-
|
|
9940
|
+
T.logAction(this.logger, T.LOG_MINOR, "Transport.requestDisconnect()", ""), this.send(Ir);
|
|
9950
9941
|
}
|
|
9951
9942
|
ping(e) {
|
|
9952
9943
|
let t = { action: z.HEARTBEAT };
|
|
9953
9944
|
e && (t.id = e), this.send(_r(t));
|
|
9954
9945
|
}
|
|
9955
9946
|
dispose() {
|
|
9956
|
-
|
|
9947
|
+
T.logAction(this.logger, T.LOG_MINOR, "Transport.dispose()", ""), this.isDisposed = !0, this.off();
|
|
9957
9948
|
}
|
|
9958
9949
|
onActivity() {
|
|
9959
9950
|
this.maxIdleInterval && (this.lastActivity = this.connectionManager.lastActivity = b.Config.now(), this.setIdleTimer(this.maxIdleInterval + 100));
|
|
@@ -9969,7 +9960,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9969
9960
|
let e = b.Config.now() - this.lastActivity, t = this.maxIdleInterval - e;
|
|
9970
9961
|
if (t <= 0) {
|
|
9971
9962
|
let t = "No activity seen from realtime in " + e + "ms; assuming connection has dropped";
|
|
9972
|
-
|
|
9963
|
+
T.logAction(this.logger, T.LOG_ERROR, "Transport.onIdleTimerExpire()", t), this.disconnect(new O(t, 80003, 408));
|
|
9973
9964
|
} else this.setIdleTimer(t + 100);
|
|
9974
9965
|
}
|
|
9975
9966
|
static tryConnect(e, t, n, r, i) {
|
|
@@ -9986,7 +9977,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
9986
9977
|
"failed"
|
|
9987
9978
|
]), a.dispose(), s.call({ event: "disconnected" }, new O("Timeout waiting for transport to indicate itself viable", 5e4, 500));
|
|
9988
9979
|
}, c), a.on(["failed", "disconnected"], s), a.on("preconnect", function() {
|
|
9989
|
-
|
|
9980
|
+
T.logAction(t.logger, T.LOG_MINOR, "Transport.tryConnect()", "viable transport " + a), b.Config.clearTimeout(o), a.off(["failed", "disconnected"], s), i(null, a);
|
|
9990
9981
|
}), a.connect(), a;
|
|
9991
9982
|
}
|
|
9992
9983
|
static isAvailable() {
|
|
@@ -10094,18 +10085,18 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10094
10085
|
sendEvents: !1,
|
|
10095
10086
|
failState: "failed"
|
|
10096
10087
|
}
|
|
10097
|
-
}, this.state = this.states.initialized, this.errorReason = null, this.queuedMessages = new kr(this.logger), this.msgSerial = 0, this.connectionDetails = void 0, this.connectionId = void 0, this.connectionKey = void 0, this.connectionStateTtl = n.connectionStateTtl, this.maxIdleInterval = null, this.transports = le(t.transports || I.defaultTransports, this.supportedTransports), this.transportPreference = null, this.transports.includes(Z.WebSocket) && (this.webSocketTransportAvailable = !0), this.transports.includes(Z.XhrPolling) ? this.baseTransport = Z.XhrPolling : this.transports.includes(Z.Comet) && (this.baseTransport = Z.Comet), this.domains = I.getHosts(t), this.activeProtocol = null, this.host = null, this.lastAutoReconnectAttempt = null, this.lastActivity = null, this.forceFallbackHost = !1, this.connectCounter = 0, this.wsCheckResult = null, this.webSocketSlowTimer = null, this.webSocketGiveUpTimer = null, this.abandonedWebSocket = !1,
|
|
10088
|
+
}, this.state = this.states.initialized, this.errorReason = null, this.queuedMessages = new kr(this.logger), this.msgSerial = 0, this.connectionDetails = void 0, this.connectionId = void 0, this.connectionKey = void 0, this.connectionStateTtl = n.connectionStateTtl, this.maxIdleInterval = null, this.transports = le(t.transports || I.defaultTransports, this.supportedTransports), this.transportPreference = null, this.transports.includes(Z.WebSocket) && (this.webSocketTransportAvailable = !0), this.transports.includes(Z.XhrPolling) ? this.baseTransport = Z.XhrPolling : this.transports.includes(Z.Comet) && (this.baseTransport = Z.Comet), this.domains = I.getHosts(t), this.activeProtocol = null, this.host = null, this.lastAutoReconnectAttempt = null, this.lastActivity = null, this.forceFallbackHost = !1, this.connectCounter = 0, this.wsCheckResult = null, this.webSocketSlowTimer = null, this.webSocketGiveUpTimer = null, this.abandonedWebSocket = !1, T.logAction(this.logger, T.LOG_MINOR, "Realtime.ConnectionManager()", "started"), T.logAction(this.logger, T.LOG_MICRO, "Realtime.ConnectionManager()", "requested transports = [" + (t.transports || I.defaultTransports) + "]"), T.logAction(this.logger, T.LOG_MICRO, "Realtime.ConnectionManager()", "available transports = [" + this.transports + "]"), T.logAction(this.logger, T.LOG_MICRO, "Realtime.ConnectionManager()", "http domains = [" + this.domains + "]"), !this.transports.length) {
|
|
10098
10089
|
let e = "no requested transports available";
|
|
10099
|
-
throw
|
|
10090
|
+
throw T.logAction(this.logger, T.LOG_ERROR, "realtime.ConnectionManager()", e), Error(e);
|
|
10100
10091
|
}
|
|
10101
10092
|
let i = b.Config.addEventListener;
|
|
10102
10093
|
i && (Br() && typeof t.recover == "function" && i("beforeunload", this.persistConnection.bind(this)), t.closeOnUnload === !0 && i("beforeunload", () => {
|
|
10103
|
-
|
|
10094
|
+
T.logAction(this.logger, T.LOG_MAJOR, "Realtime.ConnectionManager()", "beforeunload event has triggered the connection to close as closeOnUnload is true"), this.requestState({ state: "closing" });
|
|
10104
10095
|
}), i("online", () => {
|
|
10105
10096
|
var e;
|
|
10106
|
-
this.state == this.states.disconnected || this.state == this.states.suspended ? (
|
|
10097
|
+
this.state == this.states.disconnected || this.state == this.states.suspended ? (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager caught browser ‘online’ event", "reattempting connection"), this.requestState({ state: "connecting" })) : this.state == this.states.connecting && ((e = this.pendingTransport) == null || e.off(), this.disconnectAllTransports(), this.startConnect());
|
|
10107
10098
|
}), i("offline", () => {
|
|
10108
|
-
this.state == this.states.connected && (
|
|
10099
|
+
this.state == this.states.connected && (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager caught browser ‘offline’ event", "disconnecting active transport"), this.disconnectAllTransports());
|
|
10109
10100
|
}));
|
|
10110
10101
|
}
|
|
10111
10102
|
static supportedTransports(e) {
|
|
@@ -10137,7 +10128,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10137
10128
|
}
|
|
10138
10129
|
let t = this.options.recover, n = this.getSessionRecoverData(), r = this.sessionRecoveryName();
|
|
10139
10130
|
if (n && typeof t == "function") {
|
|
10140
|
-
|
|
10131
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.getTransportParams()", "Calling clientOptions-provided recover function with last session data (recovery scope: " + r + ")"), t(n, (t) => {
|
|
10141
10132
|
t ? (this.options.recover = n.recoveryKey, e("recover")) : e("clean");
|
|
10142
10133
|
});
|
|
10143
10134
|
return;
|
|
@@ -10146,22 +10137,22 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10146
10137
|
})((t) => {
|
|
10147
10138
|
let n = this.createTransportParams(null, t);
|
|
10148
10139
|
if (t === "recover") {
|
|
10149
|
-
|
|
10140
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.getTransportParams()", "Transport recovery mode = recover; recoveryKey = " + this.options.recover);
|
|
10150
10141
|
let e = Ur(this.options.recover);
|
|
10151
10142
|
e && (this.msgSerial = e.msgSerial);
|
|
10152
|
-
} else
|
|
10143
|
+
} else T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.getTransportParams()", "Transport params = " + n.toString());
|
|
10153
10144
|
e(n);
|
|
10154
10145
|
});
|
|
10155
10146
|
}
|
|
10156
10147
|
tryATransport(e, t, n) {
|
|
10157
|
-
|
|
10148
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.tryATransport()", "trying " + t), this.proposedTransport = Lr.tryConnect(this.supportedTransports[t], this, this.realtime.auth, e, (r, i) => {
|
|
10158
10149
|
let a = this.state;
|
|
10159
10150
|
if (a == this.states.closing || a == this.states.closed || a == this.states.failed) {
|
|
10160
|
-
i && (
|
|
10151
|
+
i && (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.tryATransport()", "connection " + a.state + " while we were attempting the transport; closing " + i), i.close()), n(!0);
|
|
10161
10152
|
return;
|
|
10162
10153
|
}
|
|
10163
10154
|
if (r) {
|
|
10164
|
-
|
|
10155
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.tryATransport()", "transport " + t + " " + r.event + ", err: " + r.error.toString()), At.isTokenErr(r.error) && !(this.errorReason && At.isTokenErr(this.errorReason)) ? (this.errorReason = r.error, je(this.realtime.auth._forceNewToken(null, null), (r) => {
|
|
10165
10156
|
if (r) {
|
|
10166
10157
|
this.actOnErrorFromAuthorize(r);
|
|
10167
10158
|
return;
|
|
@@ -10176,12 +10167,12 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10176
10167
|
}), n(!0)));
|
|
10177
10168
|
return;
|
|
10178
10169
|
}
|
|
10179
|
-
|
|
10170
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.tryATransport()", "viable transport " + t + "; setting pending"), this.setTransportPending(i, e), n(null, i);
|
|
10180
10171
|
});
|
|
10181
10172
|
}
|
|
10182
10173
|
setTransportPending(e, t) {
|
|
10183
10174
|
let n = t.mode;
|
|
10184
|
-
|
|
10175
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.setTransportPending()", "transport = " + e + "; mode = " + n), this.pendingTransport = e, this.cancelWebSocketSlowTimer(), this.cancelWebSocketGiveUpTimer(), e.once("connected", (t, r, i) => {
|
|
10185
10176
|
this.activateTransport(t, e, r, i), n === "recover" && this.options.recover && (delete this.options.recover, this.unpersistConnection());
|
|
10186
10177
|
});
|
|
10187
10178
|
let r = this;
|
|
@@ -10194,10 +10185,10 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10194
10185
|
}), this.emit("transport.pending", e);
|
|
10195
10186
|
}
|
|
10196
10187
|
activateTransport(e, t, n, r) {
|
|
10197
|
-
|
|
10188
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.activateTransport()", "transport = " + t), e && T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.activateTransport()", "error = " + e), n && T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.activateTransport()", "connectionId = " + n), r && T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.activateTransport()", "connectionDetails = " + JSON.stringify(r)), this.persistTransportPreference(t);
|
|
10198
10189
|
let i = this.state, a = this.states.connected.state;
|
|
10199
|
-
if (
|
|
10200
|
-
if (delete this.pendingTransport, !t.isConnected) return
|
|
10190
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.activateTransport()", "current state = " + i.state), i.state == this.states.closing.state || i.state == this.states.closed.state || i.state == this.states.failed.state) return T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.activateTransport()", "Disconnecting transport and abandoning"), t.disconnect(), !1;
|
|
10191
|
+
if (delete this.pendingTransport, !t.isConnected) return T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.activateTransport()", "Declining to activate transport " + t + " since it appears to no longer be connected"), !1;
|
|
10201
10192
|
let o = this.activeProtocol;
|
|
10202
10193
|
this.activeProtocol = new Y(t), this.host = t.params.host;
|
|
10203
10194
|
let s = r.connectionKey;
|
|
@@ -10208,15 +10199,15 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10208
10199
|
}), i.state === this.states.connected.state ? e && (this.errorReason = this.realtime.connection.errorReason = e, this.emit("update", new jr(a, a, null, e))) : (this.notifyState({
|
|
10209
10200
|
state: "connected",
|
|
10210
10201
|
error: e
|
|
10211
|
-
}), this.errorReason = this.realtime.connection.errorReason = e || null), this.emit("transport.active", t), o) if (o.messageQueue.count() > 0 &&
|
|
10202
|
+
}), this.errorReason = this.realtime.connection.errorReason = e || null), this.emit("transport.active", t), o) if (o.messageQueue.count() > 0 && T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.activateTransport()", "Previous active protocol (for transport " + o.transport.shortName + ", new one is " + t.shortName + ") finishing with " + o.messageQueue.count() + " messages still pending"), o.transport === t) {
|
|
10212
10203
|
let e = "Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = " + t.shortName + "; stack = " + (/* @__PURE__ */ Error()).stack;
|
|
10213
|
-
|
|
10204
|
+
T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.activateTransport()", e);
|
|
10214
10205
|
} else o.finish();
|
|
10215
10206
|
return !0;
|
|
10216
10207
|
}
|
|
10217
10208
|
deactivateTransport(e, t, n) {
|
|
10218
10209
|
let r = this.activeProtocol, i = r && r.getTransport() === e, a = e === this.pendingTransport, o = this.noTransportsScheduledForActivation();
|
|
10219
|
-
if (
|
|
10210
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.deactivateTransport()", "transport = " + e), T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.deactivateTransport()", "state = " + t + (i ? "; was active" : a ? "; was pending" : "") + (o ? "" : "; another transport is scheduled for activation")), n && n.message && T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.deactivateTransport()", "reason = " + n.message), i && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.deactivateTransport()", "Getting, clearing, and requeuing " + this.activeProtocol.messageQueue.count() + " pending messages"), this.queuePendingMessages(r.getPendingMessages()), r.clearPendingMessages(), this.activeProtocol = this.host = null), this.emit("transport.inactive", e), i && o || i && t === "failed" || t === "closed" || r === null && a) {
|
|
10220
10211
|
if (t === "disconnected" && n && n.statusCode > 500 && this.domains.length > 1) {
|
|
10221
10212
|
this.unpersistTransportPreference(), this.forceFallbackHost = !0, this.notifyState({
|
|
10222
10213
|
state: t,
|
|
@@ -10238,7 +10229,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10238
10229
|
}
|
|
10239
10230
|
setConnection(e, t, n) {
|
|
10240
10231
|
let r = this.connectionId;
|
|
10241
|
-
(r && r !== e || !r && n) && (
|
|
10232
|
+
(r && r !== e || !r && n) && (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.setConnection()", "Resetting msgSerial"), this.msgSerial = 0, this.queuedMessages.resetSendAttempted()), this.connectionId !== e && T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.setConnection()", "New connectionId; reattaching any attached channels"), this.realtime.connection.id = this.connectionId = e, this.realtime.connection.key = this.connectionKey = t.connectionKey;
|
|
10242
10233
|
}
|
|
10243
10234
|
clearConnection() {
|
|
10244
10235
|
this.realtime.connection.id = this.connectionId = void 0, this.realtime.connection.key = this.connectionKey = void 0, this.msgSerial = 0, this.queuedMessages.resetSendAttempted(), this.unpersistConnection();
|
|
@@ -10253,7 +10244,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10253
10244
|
checkConnectionStateFreshness() {
|
|
10254
10245
|
if (!this.lastActivity || !this.connectionId) return;
|
|
10255
10246
|
let e = b.Config.now() - this.lastActivity;
|
|
10256
|
-
e > this.connectionStateTtl + this.maxIdleInterval && (
|
|
10247
|
+
e > this.connectionStateTtl + this.maxIdleInterval && (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.checkConnectionStateFreshness()", "Last known activity from realtime was " + e + "ms ago; discarding connection state"), this.clearConnection(), this.states.connecting.failState = "suspended");
|
|
10257
10248
|
}
|
|
10258
10249
|
persistConnection() {
|
|
10259
10250
|
if (Br()) {
|
|
@@ -10288,21 +10279,21 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10288
10279
|
}
|
|
10289
10280
|
enactStateChange(e) {
|
|
10290
10281
|
let t = "Connection state", n = e.current + (e.reason ? "; reason: " + e.reason : "");
|
|
10291
|
-
e.current === "failed" ?
|
|
10282
|
+
e.current === "failed" ? T.logAction(this.logger, T.LOG_ERROR, t, n) : T.logAction(this.logger, T.LOG_MAJOR, t, n), T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.enactStateChange", "setting new state: " + e.current + "; reason = " + (e.reason && e.reason.message));
|
|
10292
10283
|
let r = this.state = this.states[e.current];
|
|
10293
10284
|
e.reason && (this.errorReason = e.reason, this.realtime.connection.errorReason = e.reason), (r.terminal || r.state === "suspended") && this.clearConnection(), this.emit("connectionstate", e);
|
|
10294
10285
|
}
|
|
10295
10286
|
startTransitionTimer(e) {
|
|
10296
|
-
|
|
10297
|
-
this.transitionTimer && (this.transitionTimer = null,
|
|
10287
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.startTransitionTimer()", "transitionState: " + e.state), this.transitionTimer && (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.startTransitionTimer()", "clearing already-running timer"), b.Config.clearTimeout(this.transitionTimer)), this.transitionTimer = b.Config.setTimeout(() => {
|
|
10288
|
+
this.transitionTimer && (this.transitionTimer = null, T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager " + e.state + " timer expired", "requesting new state: " + e.failState), this.notifyState({ state: e.failState }));
|
|
10298
10289
|
}, e.retryDelay);
|
|
10299
10290
|
}
|
|
10300
10291
|
cancelTransitionTimer() {
|
|
10301
|
-
|
|
10292
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.cancelTransitionTimer()", ""), this.transitionTimer &&= (b.Config.clearTimeout(this.transitionTimer), null);
|
|
10302
10293
|
}
|
|
10303
10294
|
startSuspendTimer() {
|
|
10304
10295
|
this.suspendTimer ||= b.Config.setTimeout(() => {
|
|
10305
|
-
this.suspendTimer && (this.suspendTimer = null,
|
|
10296
|
+
this.suspendTimer && (this.suspendTimer = null, T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager suspend timer expired", "requesting new state: suspended"), this.states.connecting.failState = "suspended", this.notifyState({ state: "suspended" }));
|
|
10306
10297
|
}, this.connectionStateTtl);
|
|
10307
10298
|
}
|
|
10308
10299
|
checkSuspendTimer(e) {
|
|
@@ -10313,7 +10304,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10313
10304
|
}
|
|
10314
10305
|
startRetryTimer(e) {
|
|
10315
10306
|
this.retryTimer = b.Config.setTimeout(() => {
|
|
10316
|
-
|
|
10307
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager retry timer expired", "retrying"), this.retryTimer = null, this.requestState({ state: "connecting" });
|
|
10317
10308
|
}, e);
|
|
10318
10309
|
}
|
|
10319
10310
|
cancelRetryTimer() {
|
|
@@ -10321,15 +10312,15 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10321
10312
|
}
|
|
10322
10313
|
startWebSocketSlowTimer() {
|
|
10323
10314
|
this.webSocketSlowTimer = b.Config.setTimeout(() => {
|
|
10324
|
-
|
|
10325
|
-
|
|
10315
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager WebSocket slow timer", "checking connectivity"), this.checkWsConnectivity().then(() => {
|
|
10316
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager WebSocket slow timer", "ws connectivity check succeeded"), this.wsCheckResult = !0;
|
|
10326
10317
|
}).catch(() => {
|
|
10327
|
-
|
|
10318
|
+
T.logAction(this.logger, T.LOG_MAJOR, "ConnectionManager WebSocket slow timer", "ws connectivity check failed"), this.wsCheckResult = !1;
|
|
10328
10319
|
}), this.realtime.http.checkConnectivity && je(this.realtime.http.checkConnectivity(), (e, t) => {
|
|
10329
|
-
e || !t ? (
|
|
10320
|
+
e || !t ? (T.logAction(this.logger, T.LOG_MAJOR, "ConnectionManager WebSocket slow timer", "http connectivity check failed"), this.cancelWebSocketGiveUpTimer(), this.notifyState({
|
|
10330
10321
|
state: "disconnected",
|
|
10331
10322
|
error: new O("Unable to connect (network unreachable)", 80003, 404)
|
|
10332
|
-
})) :
|
|
10323
|
+
})) : T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager WebSocket slow timer", "http connectivity check succeeded");
|
|
10333
10324
|
});
|
|
10334
10325
|
}, this.options.timeouts.webSocketSlowTimeout);
|
|
10335
10326
|
}
|
|
@@ -10339,7 +10330,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10339
10330
|
startWebSocketGiveUpTimer(e) {
|
|
10340
10331
|
this.webSocketGiveUpTimer = b.Config.setTimeout(() => {
|
|
10341
10332
|
var t, n;
|
|
10342
|
-
this.wsCheckResult || (
|
|
10333
|
+
this.wsCheckResult || (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager WebSocket give up timer", "websocket connection took more than 10s; " + (this.baseTransport ? "trying base transport" : "")), this.baseTransport ? (this.abandonedWebSocket = !0, (t = this.proposedTransport) == null || t.dispose(), (n = this.pendingTransport) == null || n.dispose(), this.connectBase(e, ++this.connectCounter)) : T.logAction(this.logger, T.LOG_MAJOR, "ConnectionManager WebSocket give up timer", "websocket connectivity appears to be unavailable but no other transports to try"));
|
|
10343
10334
|
}, this.options.timeouts.webSocketConnectTimeout);
|
|
10344
10335
|
}
|
|
10345
10336
|
cancelWebSocketGiveUpTimer() {
|
|
@@ -10348,7 +10339,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10348
10339
|
notifyState(e) {
|
|
10349
10340
|
var t;
|
|
10350
10341
|
let n = e.state, r = n === "disconnected" && (this.state === this.states.connected || e.retryImmediately || this.state === this.states.connecting && e.error && At.isTokenErr(e.error) && !(this.errorReason && At.isTokenErr(this.errorReason)));
|
|
10351
|
-
if (
|
|
10342
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.notifyState()", "new state: " + n + (r ? "; will retry connection immediately" : "")), n == this.state.state || (this.cancelTransitionTimer(), this.cancelRetryTimer(), this.cancelWebSocketSlowTimer(), this.cancelWebSocketGiveUpTimer(), this.checkSuspendTimer(e.state), (n === "suspended" || n === "connected") && (this.disconnectedRetryCount = 0), this.state.terminal)) return;
|
|
10352
10343
|
let i = this.states[e.state], a = i.retryDelay;
|
|
10353
10344
|
i.state === "disconnected" && (this.disconnectedRetryCount++, a = N(i.retryDelay, this.disconnectedRetryCount));
|
|
10354
10345
|
let o = new jr(this.state.state, i.state, a, e.error || (t = Pr)[i.state]?.call(t));
|
|
@@ -10356,16 +10347,16 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10356
10347
|
let e = () => {
|
|
10357
10348
|
this.state === this.states.disconnected && (this.lastAutoReconnectAttempt = b.Config.now(), this.requestState({ state: "connecting" }));
|
|
10358
10349
|
}, t = this.lastAutoReconnectAttempt && b.Config.now() - this.lastAutoReconnectAttempt + 1;
|
|
10359
|
-
t && t < 1e3 ? (
|
|
10350
|
+
t && t < 1e3 ? (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.notifyState()", "Last reconnect attempt was only " + t + "ms ago, waiting another " + (1e3 - t) + "ms before trying again"), b.Config.setTimeout(e, 1e3 - t)) : b.Config.nextTick(e);
|
|
10360
10351
|
} else (n === "disconnected" || n === "suspended") && this.startRetryTimer(a);
|
|
10361
10352
|
(n === "disconnected" && !r || n === "suspended" || i.terminal) && b.Config.nextTick(() => {
|
|
10362
10353
|
this.disconnectAllTransports();
|
|
10363
|
-
}), n == "connected" && !this.activeProtocol &&
|
|
10354
|
+
}), n == "connected" && !this.activeProtocol && T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.notifyState()", "Broken invariant: attempted to go into connected state, but there is no active protocol"), this.enactStateChange(o), this.state.sendEvents ? (this.queuedPresenceToChannelQueues(), this.sendQueuedMessages()) : this.state.queueEvents || (this.realtime.channels.propogateConnectionInterruption(n, o.reason), this.failQueuedMessages(o.reason));
|
|
10364
10355
|
}
|
|
10365
10356
|
requestState(e) {
|
|
10366
10357
|
var t;
|
|
10367
10358
|
let n = e.state;
|
|
10368
|
-
if (
|
|
10359
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.requestState()", "requested state: " + n + "; current state: " + this.state.state), n == this.state.state || (this.cancelWebSocketSlowTimer(), this.cancelWebSocketGiveUpTimer(), this.cancelTransitionTimer(), this.cancelRetryTimer(), this.checkSuspendTimer(n), n == "connecting" && this.state.state == "connected") || n == "closing" && this.state.state == "closed") return;
|
|
10369
10360
|
let r = this.states[n], i = new jr(this.state.state, r.state, null, e.error || (t = Pr)[r.state]?.call(t));
|
|
10370
10361
|
this.enactStateChange(i), n == "connecting" && b.Config.nextTick(() => {
|
|
10371
10362
|
this.startConnect();
|
|
@@ -10373,7 +10364,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10373
10364
|
}
|
|
10374
10365
|
startConnect() {
|
|
10375
10366
|
if (this.state !== this.states.connecting) {
|
|
10376
|
-
|
|
10367
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.startConnect()", "Must be in connecting state to connect, but was " + this.state.state);
|
|
10377
10368
|
return;
|
|
10378
10369
|
}
|
|
10379
10370
|
let e = this.realtime.auth, t = ++this.connectCounter, n = () => {
|
|
@@ -10385,7 +10376,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10385
10376
|
t === this.connectCounter && this.connectImpl(e, t);
|
|
10386
10377
|
});
|
|
10387
10378
|
};
|
|
10388
|
-
if (
|
|
10379
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.startConnect()", "starting connection"), this.startSuspendTimer(), this.startTransitionTimer(this.states.connecting), e.method === "basic") n();
|
|
10389
10380
|
else {
|
|
10390
10381
|
let r = (e) => {
|
|
10391
10382
|
t === this.connectCounter && (e ? this.actOnErrorFromAuthorize(e) : n());
|
|
@@ -10396,25 +10387,25 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10396
10387
|
connectImpl(e, t) {
|
|
10397
10388
|
let n = this.state.state;
|
|
10398
10389
|
if (n !== this.states.connecting.state) {
|
|
10399
|
-
|
|
10390
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.connectImpl()", "Must be in connecting state to connect, but was " + n);
|
|
10400
10391
|
return;
|
|
10401
10392
|
}
|
|
10402
10393
|
let r = this.getTransportPreference();
|
|
10403
10394
|
r && r === this.baseTransport && this.webSocketTransportAvailable && this.checkWsConnectivity().then(() => {
|
|
10404
|
-
this.unpersistTransportPreference(), this.state === this.states.connecting && (
|
|
10395
|
+
this.unpersistTransportPreference(), this.state === this.states.connecting && (T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.connectImpl():", "web socket connectivity available, cancelling connection attempt with " + this.baseTransport), this.disconnectAllTransports(), this.connectWs(e, ++this.connectCounter));
|
|
10405
10396
|
}).catch(Vr), r && r === this.baseTransport || this.baseTransport && !this.webSocketTransportAvailable ? this.connectBase(e, t) : this.connectWs(e, t);
|
|
10406
10397
|
}
|
|
10407
10398
|
connectWs(e, t) {
|
|
10408
|
-
|
|
10399
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.connectWs()"), this.wsCheckResult = null, this.abandonedWebSocket = !1, this.startWebSocketSlowTimer(), this.startWebSocketGiveUpTimer(e), this.tryTransportWithFallbacks("web_socket", e, !0, t, () => this.wsCheckResult !== !1 && !this.abandonedWebSocket);
|
|
10409
10400
|
}
|
|
10410
10401
|
connectBase(e, t) {
|
|
10411
|
-
|
|
10402
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.connectBase()"), this.baseTransport ? this.tryTransportWithFallbacks(this.baseTransport, e, !1, t, () => !0) : this.notifyState({
|
|
10412
10403
|
state: "disconnected",
|
|
10413
10404
|
error: new O("No transports left to try", 8e4, 404)
|
|
10414
10405
|
});
|
|
10415
10406
|
}
|
|
10416
10407
|
tryTransportWithFallbacks(e, t, n, r, i) {
|
|
10417
|
-
|
|
10408
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.tryTransportWithFallbacks()", e);
|
|
10418
10409
|
let a = (e) => {
|
|
10419
10410
|
this.notifyState({
|
|
10420
10411
|
state: this.states.connecting.failState,
|
|
@@ -10464,12 +10455,12 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10464
10455
|
this.tryATransport(t, e, s);
|
|
10465
10456
|
}
|
|
10466
10457
|
closeImpl() {
|
|
10467
|
-
|
|
10458
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.closeImpl()", "closing connection"), this.cancelSuspendTimer(), this.startTransitionTimer(this.states.closing), this.pendingTransport && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.closeImpl()", "Closing pending transport: " + this.pendingTransport), this.pendingTransport.close()), this.activeProtocol && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.closeImpl()", "Closing active transport: " + this.activeProtocol.getTransport()), this.activeProtocol.getTransport().close()), this.notifyState({ state: "closed" });
|
|
10468
10459
|
}
|
|
10469
10460
|
onAuthUpdated(e, t) {
|
|
10470
10461
|
switch (this.state.state) {
|
|
10471
10462
|
case "connected": {
|
|
10472
|
-
|
|
10463
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.onAuthUpdated()", "Sending AUTH message on active transport");
|
|
10473
10464
|
let n = this.activeProtocol?.getTransport();
|
|
10474
10465
|
n && n.onAuthUpdated && n.onAuthUpdated(e);
|
|
10475
10466
|
let r = _r({
|
|
@@ -10485,9 +10476,9 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10485
10476
|
this.once("connectiondetails", i), this.on("connectionstate", a);
|
|
10486
10477
|
break;
|
|
10487
10478
|
}
|
|
10488
|
-
case "connecting":
|
|
10479
|
+
case "connecting": T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.onAuthUpdated()", "Aborting current connection attempts in order to start again with the new auth details"), this.disconnectAllTransports();
|
|
10489
10480
|
default: {
|
|
10490
|
-
|
|
10481
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.onAuthUpdated()", "Connection state is " + this.state.state + "; waiting until either connected or failed");
|
|
10491
10482
|
let n = (r) => {
|
|
10492
10483
|
switch (r.current) {
|
|
10493
10484
|
case "connected":
|
|
@@ -10503,21 +10494,21 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10503
10494
|
}
|
|
10504
10495
|
}
|
|
10505
10496
|
disconnectAllTransports() {
|
|
10506
|
-
|
|
10497
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.disconnectAllTransports()", "Disconnecting all transports"), this.connectCounter++, this.pendingTransport && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.disconnectAllTransports()", "Disconnecting pending transport: " + this.pendingTransport), this.pendingTransport.disconnect()), delete this.pendingTransport, this.proposedTransport && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.disconnectAllTransports()", "Disconnecting proposed transport: " + this.pendingTransport), this.proposedTransport.disconnect()), delete this.pendingTransport, this.activeProtocol && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.disconnectAllTransports()", "Disconnecting active transport: " + this.activeProtocol.getTransport()), this.activeProtocol.getTransport().disconnect());
|
|
10507
10498
|
}
|
|
10508
10499
|
send(e, t, n) {
|
|
10509
10500
|
n ||= Vr;
|
|
10510
10501
|
let r = this.state;
|
|
10511
10502
|
if (r.sendEvents) {
|
|
10512
|
-
|
|
10503
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.send()", "sending event"), this.sendImpl(new Ar(e, n));
|
|
10513
10504
|
return;
|
|
10514
10505
|
}
|
|
10515
10506
|
if (!(t && r.queueEvents)) {
|
|
10516
10507
|
let e = "rejecting event, queueEvent was " + t + ", state was " + r.state;
|
|
10517
|
-
|
|
10508
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.send()", e), n(this.errorReason || new O(e, 9e4, 400));
|
|
10518
10509
|
return;
|
|
10519
10510
|
}
|
|
10520
|
-
this.logger.shouldLog(
|
|
10511
|
+
this.logger.shouldLog(T.LOG_MICRO) && T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.send()", "queueing msg; " + vr(e, this.realtime._RealtimePresence, this.realtime._Annotations, this.realtime._liveObjectsPlugin)), this.queue(e, n);
|
|
10521
10512
|
}
|
|
10522
10513
|
sendImpl(e) {
|
|
10523
10514
|
let t = e.message;
|
|
@@ -10525,11 +10516,11 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10525
10516
|
try {
|
|
10526
10517
|
this.activeProtocol.send(e);
|
|
10527
10518
|
} catch (e) {
|
|
10528
|
-
|
|
10519
|
+
T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.sendImpl()", "Unexpected exception in transport.send(): " + e.stack);
|
|
10529
10520
|
}
|
|
10530
10521
|
}
|
|
10531
10522
|
queue(e, t) {
|
|
10532
|
-
|
|
10523
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.queue()", "queueing event"), this.queuedMessages.push(new Ar(e, t));
|
|
10533
10524
|
}
|
|
10534
10525
|
queuedPresenceToChannelQueues() {
|
|
10535
10526
|
this.queuedMessages.messages = this.queuedMessages.messages.filter((e) => {
|
|
@@ -10539,16 +10530,16 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10539
10530
|
});
|
|
10540
10531
|
}
|
|
10541
10532
|
sendQueuedMessages() {
|
|
10542
|
-
|
|
10533
|
+
T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.sendQueuedMessages()", "sending " + this.queuedMessages.count() + " queued messages");
|
|
10543
10534
|
let e;
|
|
10544
10535
|
for (; e = this.queuedMessages.shift();) this.sendImpl(e);
|
|
10545
10536
|
}
|
|
10546
10537
|
queuePendingMessages(e) {
|
|
10547
|
-
e && e.length && (
|
|
10538
|
+
e && e.length && (T.logAction(this.logger, T.LOG_MICRO, "ConnectionManager.queuePendingMessages()", "queueing " + e.length + " pending messages"), this.queuedMessages.prepend(e));
|
|
10548
10539
|
}
|
|
10549
10540
|
failQueuedMessages(e) {
|
|
10550
10541
|
let t = this.queuedMessages.count();
|
|
10551
|
-
t > 0 && (
|
|
10542
|
+
t > 0 && (T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.failQueuedMessages()", "failing " + t + " queued messages, err = " + Te(e)), this.queuedMessages.completeAllMessages(e));
|
|
10552
10543
|
}
|
|
10553
10544
|
onChannelMessage(e, t) {
|
|
10554
10545
|
this.pendingChannelMessagesState.queue.push({
|
|
@@ -10561,7 +10552,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10561
10552
|
this.pendingChannelMessagesState.isProcessing = !0;
|
|
10562
10553
|
let e = this.pendingChannelMessagesState.queue.shift();
|
|
10563
10554
|
this.processChannelMessage(e.message).catch((e) => {
|
|
10564
|
-
|
|
10555
|
+
T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.processNextPendingChannelMessage() received error ", e);
|
|
10565
10556
|
}).finally(() => {
|
|
10566
10557
|
this.pendingChannelMessagesState.isProcessing = !1, this.processNextPendingChannelMessage();
|
|
10567
10558
|
});
|
|
@@ -10579,7 +10570,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10579
10570
|
});
|
|
10580
10571
|
let e = this.activeProtocol?.getTransport();
|
|
10581
10572
|
if (!e) throw this.getStateError();
|
|
10582
|
-
|
|
10573
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.ping()", "transport = " + e);
|
|
10583
10574
|
let t = b.Config.now(), n = Oe();
|
|
10584
10575
|
return Ue(new Promise((r) => {
|
|
10585
10576
|
let i = (a) => {
|
|
@@ -10614,7 +10605,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10614
10605
|
});
|
|
10615
10606
|
else if (e.statusCode === vt.Forbidden) {
|
|
10616
10607
|
let t = "Client configured authentication provider returned 403, failing the connection";
|
|
10617
|
-
|
|
10608
|
+
T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.actOnErrorFromAuthorize()", t);
|
|
10618
10609
|
let n = new O({
|
|
10619
10610
|
message: t,
|
|
10620
10611
|
code: 80019,
|
|
@@ -10628,7 +10619,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10628
10619
|
});
|
|
10629
10620
|
} else {
|
|
10630
10621
|
let t = "Client configured authentication provider request failed";
|
|
10631
|
-
|
|
10622
|
+
T.logAction(this.logger, T.LOG_MINOR, "ConnectionManager.actOnErrorFromAuthorize", t);
|
|
10632
10623
|
let n = new O({
|
|
10633
10624
|
message: t,
|
|
10634
10625
|
code: 80019,
|
|
@@ -10649,7 +10640,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10649
10640
|
if (n) {
|
|
10650
10641
|
let e = this.realtime.auth._uncheckedSetClientId(n);
|
|
10651
10642
|
if (e) {
|
|
10652
|
-
|
|
10643
|
+
T.logAction(this.logger, T.LOG_ERROR, "ConnectionManager.onConnectionDetailsUpdate()", e.message), t.fail(e);
|
|
10653
10644
|
return;
|
|
10654
10645
|
}
|
|
10655
10646
|
}
|
|
@@ -10696,16 +10687,16 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10696
10687
|
});
|
|
10697
10688
|
}
|
|
10698
10689
|
connect() {
|
|
10699
|
-
|
|
10690
|
+
T.logAction(this.logger, T.LOG_MINOR, "Connection.connect()", ""), this.connectionManager.requestState({ state: "connecting" });
|
|
10700
10691
|
}
|
|
10701
10692
|
ping(...e) {
|
|
10702
10693
|
return we(e, 0), this._pingImpl();
|
|
10703
10694
|
}
|
|
10704
10695
|
async _pingImpl() {
|
|
10705
|
-
return
|
|
10696
|
+
return T.logAction(this.logger, T.LOG_MINOR, "Connection.ping()", ""), this.connectionManager.ping();
|
|
10706
10697
|
}
|
|
10707
10698
|
close() {
|
|
10708
|
-
|
|
10699
|
+
T.logAction(this.logger, T.LOG_MINOR, "Connection.close()", "connectionKey = " + this.key), this.connectionManager.requestState({ state: "closing" });
|
|
10709
10700
|
}
|
|
10710
10701
|
get recoveryKey() {
|
|
10711
10702
|
return this.logger.deprecationWarning("The `Connection.recoveryKey` attribute has been replaced by the `Connection.createRecoveryKey()` method. Replace your usage of `recoveryKey` with the return value of `createRecoveryKey()`. `recoveryKey` will be removed in a future version."), this.createRecoveryKey();
|
|
@@ -10715,7 +10706,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10715
10706
|
}
|
|
10716
10707
|
}, Kr = class e extends en {
|
|
10717
10708
|
constructor(t) {
|
|
10718
|
-
if (super(I.objectifyOptions(t, !1, "BaseRealtime",
|
|
10709
|
+
if (super(I.objectifyOptions(t, !1, "BaseRealtime", T.defaultLogger)), T.logAction(this.logger, T.LOG_MINOR, "Realtime()", ""), typeof EdgeRuntime == "string") throw new O("Ably.Realtime instance cannot be used in Vercel Edge runtime. If you are running Vercel Edge functions, please replace your \"new Ably.Realtime()\" with \"new Ably.Rest()\" and use Ably Rest API instead of the Realtime API. If you are server-rendering your application in the Vercel Edge runtime, please use the condition \"if (typeof EdgeRuntime === 'string')\" to prevent instantiating Ably.Realtime instance during SSR in the Vercel Edge runtime.", 4e4, 400);
|
|
10719
10710
|
this._additionalTransportImplementations = e.transportImplementationsFromPlugins(this.options.plugins), this._RealtimePresence = this.options.plugins?.RealtimePresence ?? null, this.connection = new Q(this, this.options), this._channels = new Jr(this), this.options.autoConnect !== !1 && this.connect();
|
|
10720
10711
|
}
|
|
10721
10712
|
static transportImplementationsFromPlugins(e) {
|
|
@@ -10729,10 +10720,10 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10729
10720
|
return this.auth.clientId;
|
|
10730
10721
|
}
|
|
10731
10722
|
connect() {
|
|
10732
|
-
|
|
10723
|
+
T.logAction(this.logger, T.LOG_MINOR, "Realtime.connect()", ""), this.connection.connect();
|
|
10733
10724
|
}
|
|
10734
10725
|
close() {
|
|
10735
|
-
|
|
10726
|
+
T.logAction(this.logger, T.LOG_MINOR, "Realtime.close()", ""), this.connection.close();
|
|
10736
10727
|
}
|
|
10737
10728
|
};
|
|
10738
10729
|
Kr.EventEmitter = Lt;
|
|
@@ -10759,12 +10750,12 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10759
10750
|
async processChannelMessage(e) {
|
|
10760
10751
|
let t = e.channel;
|
|
10761
10752
|
if (t === void 0) {
|
|
10762
|
-
|
|
10753
|
+
T.logAction(this.logger, T.LOG_ERROR, "Channels.processChannelMessage()", "received event unspecified channel, action = " + e.action);
|
|
10763
10754
|
return;
|
|
10764
10755
|
}
|
|
10765
10756
|
let n = this.all[t];
|
|
10766
10757
|
if (!n) {
|
|
10767
|
-
|
|
10758
|
+
T.logAction(this.logger, T.LOG_ERROR, "Channels.processChannelMessage()", "received event for non-existent channel: " + t);
|
|
10768
10759
|
return;
|
|
10769
10760
|
}
|
|
10770
10761
|
await n.processMessage(e);
|
|
@@ -10815,7 +10806,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10815
10806
|
return this.get(e, n);
|
|
10816
10807
|
}
|
|
10817
10808
|
release(e) {
|
|
10818
|
-
e = String(e),
|
|
10809
|
+
e = String(e), T.logAction(this.logger, T.LOG_MAJOR, "Channels.release()", "Releasing references to channel " + e);
|
|
10819
10810
|
let t = this.all[e];
|
|
10820
10811
|
if (!t) return;
|
|
10821
10812
|
let n = t.state;
|
|
@@ -10824,7 +10815,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10824
10815
|
return;
|
|
10825
10816
|
}
|
|
10826
10817
|
t.detach().catch((t) => {
|
|
10827
|
-
|
|
10818
|
+
T.logAction(this.logger, T.LOG_ERROR, "Channels.release()", "Error detaching channel " + e + " prior to release: " + Te(t));
|
|
10828
10819
|
}).then(() => {
|
|
10829
10820
|
delete this.all[e];
|
|
10830
10821
|
});
|
|
@@ -10879,11 +10870,11 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10879
10870
|
}
|
|
10880
10871
|
startSync() {
|
|
10881
10872
|
let e = this.map, t = this.syncInProgress;
|
|
10882
|
-
|
|
10873
|
+
T.logAction(this.logger, T.LOG_MINOR, "PresenceMap.startSync()", "channel = " + this.presence.channel.name + "; syncInProgress = " + t), this.syncInProgress || (this.residualMembers = te(e), this.setInProgress(!0));
|
|
10883
10874
|
}
|
|
10884
10875
|
endSync() {
|
|
10885
10876
|
let e = this.map, t = this.syncInProgress;
|
|
10886
|
-
if (
|
|
10877
|
+
if (T.logAction(this.logger, T.LOG_MINOR, "PresenceMap.endSync()", "channel = " + this.presence.channel.name + "; syncInProgress = " + t), t) {
|
|
10887
10878
|
for (let t in e) e[t].action === "absent" && delete e[t];
|
|
10888
10879
|
this.presence._synthesizeLeaves(he(this.residualMembers));
|
|
10889
10880
|
for (let t in this.residualMembers) delete e[t];
|
|
@@ -10893,13 +10884,13 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10893
10884
|
}
|
|
10894
10885
|
async waitSync() {
|
|
10895
10886
|
let e = this.syncInProgress;
|
|
10896
|
-
|
|
10887
|
+
T.logAction(this.logger, T.LOG_MINOR, "PresenceMap.waitSync()", "channel = " + this.presence.channel.name + "; syncInProgress = " + e), e && await this.once("sync");
|
|
10897
10888
|
}
|
|
10898
10889
|
clear() {
|
|
10899
10890
|
this.map = {}, this.setInProgress(!1), this.residualMembers = null;
|
|
10900
10891
|
}
|
|
10901
10892
|
setInProgress(e) {
|
|
10902
|
-
|
|
10893
|
+
T.logAction(this.logger, T.LOG_MICRO, "PresenceMap.setInProgress()", "inProgress = " + e), this.syncInProgress = e, this.presence.syncComplete = !e;
|
|
10903
10894
|
}
|
|
10904
10895
|
};
|
|
10905
10896
|
function Qr(e) {
|
|
@@ -10946,7 +10937,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10946
10937
|
async _enterOrUpdateClient(e, t, n, r) {
|
|
10947
10938
|
let i = this.channel;
|
|
10948
10939
|
if (!i.connectionManager.activeState()) throw i.connectionManager.getError();
|
|
10949
|
-
|
|
10940
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimePresence." + r + "Client()", "channel = " + i.name + ", id = " + e + ", client = " + (t || "(implicit) " + Qr(this)));
|
|
10950
10941
|
let a = An.fromData(n);
|
|
10951
10942
|
a.action = r, e && (a.id = e), t && (a.clientId = t);
|
|
10952
10943
|
let o = await a.encode(i.channelOptions);
|
|
@@ -10981,7 +10972,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
10981
10972
|
async leaveClient(e, t) {
|
|
10982
10973
|
let n = this.channel;
|
|
10983
10974
|
if (!n.connectionManager.activeState()) throw n.connectionManager.getError();
|
|
10984
|
-
|
|
10975
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimePresence.leaveClient()", "leaving; channel = " + this.channel.name + ", client = " + e);
|
|
10985
10976
|
let r = An.fromData(t);
|
|
10986
10977
|
r.action = "leave", e && (r.clientId = e);
|
|
10987
10978
|
let i = await r.encode(n.channelOptions);
|
|
@@ -11025,7 +11016,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11025
11016
|
remediation: "Include \"presence_subscribe\" in the channel modes: realtime.channels.get(name, { modes: [\"presence_subscribe\", ...] }), or call channel.setOptions({ modes: [...] }) on an existing channel to trigger a reattach. Alternatively, omit modes entirely and ensure your token/API-key capability permits subscribe on this channel. If you have the Ably CLI installed, `ably auth keys list` shows your key's capabilities."
|
|
11026
11017
|
});
|
|
11027
11018
|
if (this.channel.client.options.strictMode === !0) throw e;
|
|
11028
|
-
|
|
11019
|
+
T.logActionNoStrip(this.logger, T.LOG_ERROR, "RealtimePresence.get()", e.message + "; remediation=" + e.remediation + T.silentFailureLogSuffix());
|
|
11029
11020
|
}
|
|
11030
11021
|
let r = this.members;
|
|
11031
11022
|
return t && await r.waitSync(), n(this.members);
|
|
@@ -11034,7 +11025,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11034
11025
|
return we(e, 0), this._historyImpl(e[0]);
|
|
11035
11026
|
}
|
|
11036
11027
|
async _historyImpl(e) {
|
|
11037
|
-
|
|
11028
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimePresence.history()", "channel = " + this.name);
|
|
11038
11029
|
let t = this.channel.client.rest.presenceMixin;
|
|
11039
11030
|
if (e && e.untilAttach) if (this.channel.state === "attached") delete e.untilAttach, e.from_serial = this.channel.properties.attachSerial;
|
|
11040
11031
|
else throw new O({
|
|
@@ -11046,7 +11037,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11046
11037
|
return t.history(this, e);
|
|
11047
11038
|
}
|
|
11048
11039
|
setPresence(e, t, n) {
|
|
11049
|
-
|
|
11040
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimePresence.setPresence()", "received presence for " + e.length + " participants; syncChannelSerial = " + n);
|
|
11050
11041
|
let r, i, a = this.members, o = this._myMembers, s = [], c = this.channel.connectionManager.connectionId;
|
|
11051
11042
|
t && (this.members.startSync(), n && (i = n.match(/^[\w-]+:(.*)$/)) && (r = i[1]));
|
|
11052
11043
|
for (let t of e) switch (t.action) {
|
|
@@ -11064,12 +11055,12 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11064
11055
|
}
|
|
11065
11056
|
}
|
|
11066
11057
|
onAttached(e) {
|
|
11067
|
-
|
|
11058
|
+
T.logAction(this.logger, T.LOG_MINOR, "RealtimePresence.onAttached()", "channel = " + this.channel.name + ", hasPresence = " + e), e ? this.members.startSync() : (this._synthesizeLeaves(this.members.values()), this.members.clear()), this._ensureMyMembersPresent();
|
|
11068
11059
|
let t = this.pendingPresence, n = t.length;
|
|
11069
11060
|
if (n) {
|
|
11070
11061
|
this.pendingPresence = [];
|
|
11071
11062
|
let e = [], r = pt.create(this.logger);
|
|
11072
|
-
|
|
11063
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimePresence.onAttached", "sending " + n + " queued presence messages");
|
|
11073
11064
|
for (let i = 0; i < n; i++) {
|
|
11074
11065
|
let n = t[i];
|
|
11075
11066
|
e.push(n.presence), r.push(n.callback);
|
|
@@ -11089,7 +11080,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11089
11080
|
}
|
|
11090
11081
|
failPendingPresence(e) {
|
|
11091
11082
|
if (this.pendingPresence.length) {
|
|
11092
|
-
|
|
11083
|
+
T.logAction(this.logger, T.LOG_MINOR, "RealtimeChannel.failPendingPresence", "channel; name = " + this.channel.name + ", err = " + Te(e));
|
|
11093
11084
|
for (let t = 0; t < this.pendingPresence.length; t++) try {
|
|
11094
11085
|
this.pendingPresence[t].callback(e);
|
|
11095
11086
|
} catch {}
|
|
@@ -11109,7 +11100,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11109
11100
|
let e = this._myMembers, t = this.channel.connectionManager.connectionId;
|
|
11110
11101
|
for (let n in e.map) {
|
|
11111
11102
|
let r = e.map[n];
|
|
11112
|
-
|
|
11103
|
+
T.logAction(this.logger, T.LOG_MICRO, "RealtimePresence._ensureMyMembersPresent()", "Auto-reentering clientId \"" + r.clientId + "\" into the presence set");
|
|
11113
11104
|
let i = r.connectionId === t ? r.id : void 0;
|
|
11114
11105
|
this._enterOrUpdateClient(i, r.clientId, r.data, "enter").catch((e) => {
|
|
11115
11106
|
let t = new O({
|
|
@@ -11119,7 +11110,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11119
11110
|
cause: e,
|
|
11120
11111
|
remediation: "Listen for the channel \"update\" event and call presence.enter(...) again once the channel is attached. For a member entered on behalf of another clientId, call presence.enterClient(clientId, data) instead."
|
|
11121
11112
|
});
|
|
11122
|
-
|
|
11113
|
+
T.logAction(this.logger, T.LOG_ERROR, "RealtimePresence._ensureMyMembersPresent()", "Presence auto re-enter failed; reason = " + Te(e));
|
|
11123
11114
|
let n = new xr(this.channel.state, this.channel.state, !0, !1, t);
|
|
11124
11115
|
this.channel.emit("update", n);
|
|
11125
11116
|
});
|
|
@@ -11169,13 +11160,13 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11169
11160
|
return "WebSocketTransport; uri=" + this.uri;
|
|
11170
11161
|
}
|
|
11171
11162
|
connect() {
|
|
11172
|
-
|
|
11163
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.connect()", "starting"), Lr.prototype.connect.call(this);
|
|
11173
11164
|
let e = this, t = this.params, n = t.options, r = (n.tls ? "wss://" : "ws://") + this.wsHost + ":" + I.getPort(n) + "/";
|
|
11174
|
-
|
|
11165
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.connect()", "uri: " + r), je(this.auth.getAuthParams(), function(n, i) {
|
|
11175
11166
|
if (e.isDisposed) return;
|
|
11176
11167
|
let a = "";
|
|
11177
11168
|
for (let e in i) a += " " + e + ": " + i[e] + ";";
|
|
11178
|
-
if (
|
|
11169
|
+
if (T.logAction(e.logger, T.LOG_MINOR, "WebSocketTransport.connect()", "authParams:" + a + " err: " + n), n) {
|
|
11179
11170
|
e.disconnect(n);
|
|
11180
11171
|
return;
|
|
11181
11172
|
}
|
|
@@ -11194,56 +11185,56 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11194
11185
|
e.onActivity();
|
|
11195
11186
|
});
|
|
11196
11187
|
} catch (t) {
|
|
11197
|
-
|
|
11188
|
+
T.logAction(e.logger, T.LOG_ERROR, "WebSocketTransport.connect()", "Unexpected exception creating websocket: err = " + (t.stack || t.message)), e.disconnect(t);
|
|
11198
11189
|
}
|
|
11199
11190
|
});
|
|
11200
11191
|
}
|
|
11201
11192
|
send(e) {
|
|
11202
11193
|
let t = this.wsConnection;
|
|
11203
11194
|
if (!t) {
|
|
11204
|
-
|
|
11195
|
+
T.logAction(this.logger, T.LOG_ERROR, "WebSocketTransport.send()", "No socket connection");
|
|
11205
11196
|
return;
|
|
11206
11197
|
}
|
|
11207
11198
|
try {
|
|
11208
11199
|
t.send(pr(e, this.connectionManager.realtime._MsgPack, this.params.format));
|
|
11209
11200
|
} catch (e) {
|
|
11210
11201
|
let t = "Exception from ws connection when trying to send: " + Te(e);
|
|
11211
|
-
|
|
11202
|
+
T.logAction(this.logger, T.LOG_ERROR, "WebSocketTransport.send()", t), this.finish("disconnected", new O(t, 5e4, 500));
|
|
11212
11203
|
}
|
|
11213
11204
|
}
|
|
11214
11205
|
onWsData(e) {
|
|
11215
|
-
|
|
11206
|
+
T.logAction(this.logger, T.LOG_MICRO, "WebSocketTransport.onWsData()", "data received; length = " + e.length + "; type = " + typeof e);
|
|
11216
11207
|
try {
|
|
11217
11208
|
this.onProtocolMessage(J(e, this.connectionManager.realtime._MsgPack, this.connectionManager.realtime._RealtimePresence, this.connectionManager.realtime._Annotations, this.connectionManager.realtime._liveObjectsPlugin, this.format));
|
|
11218
11209
|
} catch (e) {
|
|
11219
|
-
|
|
11210
|
+
T.logAction(this.logger, T.LOG_ERROR, "WebSocketTransport.onWsData()", "Unexpected exception handing channel message: " + e.stack);
|
|
11220
11211
|
}
|
|
11221
11212
|
}
|
|
11222
11213
|
onWsOpen() {
|
|
11223
|
-
|
|
11214
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.onWsOpen()", "opened WebSocket"), this.emit("preconnect");
|
|
11224
11215
|
}
|
|
11225
11216
|
onWsClose(e) {
|
|
11226
11217
|
let t, n;
|
|
11227
11218
|
if (typeof e == "object" ? (n = e.code, t = e.wasClean || n === 1e3) : (n = e, t = n == 1e3), delete this.wsConnection, t) {
|
|
11228
|
-
|
|
11219
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.onWsClose()", "Cleanly closed WebSocket");
|
|
11229
11220
|
let e = new O("Websocket closed", 80003, 400);
|
|
11230
11221
|
this.finish("disconnected", e);
|
|
11231
11222
|
} else {
|
|
11232
11223
|
let e = "Unclean disconnection of WebSocket ; code = " + n, t = new O(e, 80003, 400);
|
|
11233
|
-
|
|
11224
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.onWsClose()", e), this.finish("disconnected", t);
|
|
11234
11225
|
}
|
|
11235
11226
|
this.emit("disposed");
|
|
11236
11227
|
}
|
|
11237
11228
|
onWsError(e) {
|
|
11238
|
-
|
|
11229
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.onError()", "Error from WebSocket: " + e.message), b.Config.nextTick(() => {
|
|
11239
11230
|
this.disconnect(Error(e.message));
|
|
11240
11231
|
});
|
|
11241
11232
|
}
|
|
11242
11233
|
dispose() {
|
|
11243
|
-
|
|
11234
|
+
T.logAction(this.logger, T.LOG_MINOR, "WebSocketTransport.dispose()", ""), this.isDisposed = !0;
|
|
11244
11235
|
let e = this.wsConnection;
|
|
11245
11236
|
e && (e.onmessage = function() {}, delete this.wsConnection, b.Config.nextTick(() => {
|
|
11246
|
-
if (
|
|
11237
|
+
if (T.logAction(this.logger, T.LOG_MICRO, "WebSocketTransport.dispose()", "closing websocket"), !e) throw Error("WebSocketTransport.dispose(): wsConnection is not defined");
|
|
11247
11238
|
e.close();
|
|
11248
11239
|
}));
|
|
11249
11240
|
}
|
|
@@ -11287,7 +11278,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11287
11278
|
constructor(t) {
|
|
11288
11279
|
let n = e._MsgPack;
|
|
11289
11280
|
if (!n) throw Error("Expected DefaultRealtime._MsgPack to have been set");
|
|
11290
|
-
super(I.objectifyOptions(t, !0, "Realtime",
|
|
11281
|
+
super(I.objectifyOptions(t, !0, "Realtime", T.defaultLogger, f(d({}, Zn), {
|
|
11291
11282
|
Crypto: e.Crypto ?? void 0,
|
|
11292
11283
|
MsgPack: n,
|
|
11293
11284
|
RealtimePresence: {
|
|
@@ -11313,7 +11304,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11313
11304
|
this._Crypto = e;
|
|
11314
11305
|
}
|
|
11315
11306
|
};
|
|
11316
|
-
ai.Utils =
|
|
11307
|
+
ai.Utils = E, ai.ConnectionManager = Gr, ai.ProtocolMessage = br, ai._Crypto = null, ai.Message = Qn, ai.PresenceMessage = $n, ai.Annotation = cr, ai._MsgPack = null, ai._Http = Pt, ai._PresenceMap = Zr, ai._MessageEncoding = Zt;
|
|
11317
11308
|
var oi = ai, si = Uint8Array, ci = Uint32Array, li = Math.pow, ui = new ci(8), di = [], fi = new ci(64);
|
|
11318
11309
|
function pi(e) {
|
|
11319
11310
|
return (e - (e | 0)) * li(2, 32) | 0;
|
|
@@ -11511,7 +11502,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11511
11502
|
return r;
|
|
11512
11503
|
}
|
|
11513
11504
|
async encrypt(e) {
|
|
11514
|
-
|
|
11505
|
+
T.logAction(this.logger, T.LOG_MICRO, "CBCCipher.encrypt()", "");
|
|
11515
11506
|
let t = await this.getIv(), n = await crypto.subtle.importKey("raw", this.key, this.webCryptoAlgorithm, !1, ["encrypt"]), r = await crypto.subtle.encrypt({
|
|
11516
11507
|
name: this.webCryptoAlgorithm,
|
|
11517
11508
|
iv: t
|
|
@@ -11519,7 +11510,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11519
11510
|
return this.concat(t, r);
|
|
11520
11511
|
}
|
|
11521
11512
|
async decrypt(e) {
|
|
11522
|
-
|
|
11513
|
+
T.logAction(this.logger, T.LOG_MICRO, "CBCCipher.decrypt()", "");
|
|
11523
11514
|
let n = t.toArrayBuffer(e), r = n.slice(0, 16), i = n.slice(16), a = await crypto.subtle.importKey("raw", this.key, this.webCryptoAlgorithm, !1, ["decrypt"]);
|
|
11524
11515
|
return crypto.subtle.decrypt({
|
|
11525
11516
|
name: this.webCryptoAlgorithm,
|
|
@@ -11559,19 +11550,19 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11559
11550
|
}, this.checkConnectivity = e?.options.disableConnectivityCheck ? async function() {
|
|
11560
11551
|
return !0;
|
|
11561
11552
|
} : async function() {
|
|
11562
|
-
|
|
11553
|
+
T.logAction(this.logger, T.LOG_MICRO, "(XHRRequest)Http.checkConnectivity()", "Sending; " + t);
|
|
11563
11554
|
let e = await this.doUri(ht.Get, t, null, null, n), i = !1;
|
|
11564
|
-
return i = r ? !e.error && e.body?.replace(/\n/, "") == "yes" : !e.error && _t(e.statusCode),
|
|
11555
|
+
return i = r ? !e.error && e.body?.replace(/\n/, "") == "yes" : !e.error && _t(e.statusCode), T.logAction(this.logger, T.LOG_MICRO, "(XHRRequest)Http.checkConnectivity()", "Result: " + i), i;
|
|
11565
11556
|
}) : b.Config.fetchSupported && o ? (this.supportsAuthHeaders = !0, this.Request = async (t, n, r, i, a) => o(t, e ?? null, n, r, i, a), this.checkConnectivity = e?.options.disableConnectivityCheck ? async function() {
|
|
11566
11557
|
return !0;
|
|
11567
11558
|
} : async function() {
|
|
11568
|
-
|
|
11559
|
+
T.logAction(this.logger, T.LOG_MICRO, "(Fetch)Http.checkConnectivity()", "Sending; " + t);
|
|
11569
11560
|
let e = await this.doUri(ht.Get, t, null, null, null), n = !e.error && e.body?.replace(/\n/, "") == "yes";
|
|
11570
|
-
return
|
|
11561
|
+
return T.logAction(this.logger, T.LOG_MICRO, "(Fetch)Http.checkConnectivity()", "Result: " + n), n;
|
|
11571
11562
|
}) : this.Request = async () => ({ error: s ? new k("no supported HTTP transports available", null, 400) : Di() });
|
|
11572
11563
|
}
|
|
11573
11564
|
get logger() {
|
|
11574
|
-
return this.client?.logger ??
|
|
11565
|
+
return this.client?.logger ?? T.defaultLogger;
|
|
11575
11566
|
}
|
|
11576
11567
|
async doUri(e, t, n, r, i) {
|
|
11577
11568
|
return this.Request ? this.Request(e, t, n, i, r) : { error: new k("Request invoked before assigned to", null, 500) };
|
|
@@ -11708,11 +11699,11 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11708
11699
|
}, this.stream = "stream" in n ? n.stream : !0, this.sendRequest = null, this.recvRequest = null, this.pendingCallback = null, this.pendingItems = null;
|
|
11709
11700
|
}
|
|
11710
11701
|
connect() {
|
|
11711
|
-
|
|
11702
|
+
T.logAction(this.logger, T.LOG_MINOR, "CometTransport.connect()", "starting"), Lr.prototype.connect.call(this);
|
|
11712
11703
|
let e = this.params, t = e.options, n = e.host || t.primaryDomain, r = I.getPort(t), i = t.tls ? "https://" : "http://";
|
|
11713
11704
|
this.baseUri = i + n + ":" + r + "/comet/";
|
|
11714
11705
|
let a = this.baseUri + "connect";
|
|
11715
|
-
|
|
11706
|
+
T.logAction(this.logger, T.LOG_MINOR, "CometTransport.connect()", "uri: " + a), je(this.auth.getAuthParams(), (e, t) => {
|
|
11716
11707
|
if (e) {
|
|
11717
11708
|
this.disconnect(e);
|
|
11718
11709
|
return;
|
|
@@ -11720,7 +11711,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11720
11711
|
if (this.isDisposed) return;
|
|
11721
11712
|
this.authParams = t;
|
|
11722
11713
|
let n = this.params.getConnectParams(t);
|
|
11723
|
-
"stream" in n && (this.stream = n.stream),
|
|
11714
|
+
"stream" in n && (this.stream = n.stream), T.logAction(this.logger, T.LOG_MINOR, "CometTransport.connect()", "connectParams:" + be(n));
|
|
11724
11715
|
let r = !1, i = this.recvRequest = this.createRequest(a, null, n, null, this.stream ? Ei.REQ_RECV_STREAM : Ei.REQ_RECV);
|
|
11725
11716
|
i.on("data", (e) => {
|
|
11726
11717
|
this.recvRequest && (r || (r = !0, this.emit("preconnect")), this.onData(e));
|
|
@@ -11736,22 +11727,22 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11736
11727
|
});
|
|
11737
11728
|
}
|
|
11738
11729
|
requestClose() {
|
|
11739
|
-
|
|
11730
|
+
T.logAction(this.logger, T.LOG_MINOR, "CometTransport.requestClose()"), this._requestCloseOrDisconnect(!0);
|
|
11740
11731
|
}
|
|
11741
11732
|
requestDisconnect() {
|
|
11742
|
-
|
|
11733
|
+
T.logAction(this.logger, T.LOG_MINOR, "CometTransport.requestDisconnect()"), this._requestCloseOrDisconnect(!1);
|
|
11743
11734
|
}
|
|
11744
11735
|
_requestCloseOrDisconnect(e) {
|
|
11745
11736
|
let t = e ? this.closeUri : this.disconnectUri;
|
|
11746
11737
|
if (t) {
|
|
11747
11738
|
let n = this.createRequest(t, null, this.authParams, null, Ei.REQ_SEND);
|
|
11748
11739
|
n.on("complete", (t) => {
|
|
11749
|
-
t && (
|
|
11740
|
+
t && (T.logAction(this.logger, T.LOG_ERROR, "CometTransport.request" + (e ? "Close()" : "Disconnect()"), "request returned err = " + Te(t)), this.finish("disconnected", t));
|
|
11750
11741
|
}), n.exec();
|
|
11751
11742
|
}
|
|
11752
11743
|
}
|
|
11753
11744
|
dispose() {
|
|
11754
|
-
|
|
11745
|
+
T.logAction(this.logger, T.LOG_MINOR, "CometTransport.dispose()", ""), this.isDisposed || (this.isDisposed = !0, this.recvRequest &&= (T.logAction(this.logger, T.LOG_MINOR, "CometTransport.dispose()", "aborting recv request"), this.recvRequest.abort(), null), this.finish("disconnected", Pr.disconnected()), b.Config.nextTick(() => {
|
|
11755
11746
|
this.emit("disposed");
|
|
11756
11747
|
}));
|
|
11757
11748
|
}
|
|
@@ -11760,7 +11751,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11760
11751
|
let t = e.connectionDetails?.connectionKey;
|
|
11761
11752
|
Lr.prototype.onConnect.call(this, e);
|
|
11762
11753
|
let n = this.baseUri + t;
|
|
11763
|
-
|
|
11754
|
+
T.logAction(this.logger, T.LOG_MICRO, "CometTransport.onConnect()", "baseUri = " + n), this.sendUri = n + "/send", this.recvUri = n + "/recv", this.closeUri = n + "/close", this.disconnectUri = n + "/disconnect";
|
|
11764
11755
|
}
|
|
11765
11756
|
send(e) {
|
|
11766
11757
|
if (this.sendRequest) {
|
|
@@ -11777,7 +11768,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11777
11768
|
sendItems(e) {
|
|
11778
11769
|
let t = this.sendRequest = this.createRequest(this.sendUri, null, this.authParams, this.encodeRequest(e), Ei.REQ_SEND);
|
|
11779
11770
|
t.on("complete", (e, t) => {
|
|
11780
|
-
if (e &&
|
|
11771
|
+
if (e && T.logAction(this.logger, T.LOG_ERROR, "CometTransport.sendItems()", "on complete: err = " + Te(e)), this.sendRequest = null, e) {
|
|
11781
11772
|
e.code ? this.onData(zi(e)) : this.disconnect(e);
|
|
11782
11773
|
return;
|
|
11783
11774
|
}
|
|
@@ -11806,7 +11797,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11806
11797
|
let t = this.decodeResponse(e);
|
|
11807
11798
|
if (t && t.length) for (let e = 0; e < t.length; e++) this.onProtocolMessage(hr(t[e], this.connectionManager.realtime._RealtimePresence, this.connectionManager.realtime._Annotations, this.connectionManager.realtime._liveObjectsPlugin));
|
|
11808
11799
|
} catch (e) {
|
|
11809
|
-
|
|
11800
|
+
T.logAction(this.logger, T.LOG_ERROR, "CometTransport.onData()", "Unexpected exception handing channel event: " + e.stack);
|
|
11810
11801
|
}
|
|
11811
11802
|
}
|
|
11812
11803
|
encodeRequest(e) {
|
|
@@ -11859,7 +11850,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
11859
11850
|
for (let t in e) i.setRequestHeader(t, e[t]);
|
|
11860
11851
|
let c = (e, t, n, r) => {
|
|
11861
11852
|
let i = t + " (event type: " + e.type + ")";
|
|
11862
|
-
(this == null ? void 0 : this.xhr)?.statusText && (i += ", current statusText is " + this.xhr.statusText),
|
|
11853
|
+
(this == null ? void 0 : this.xhr)?.statusText && (i += ", current statusText is " + this.xhr.statusText), T.logAction(this.logger, T.LOG_ERROR, "Request.on" + e.type + "()", i), this.complete(new k(i, n, r));
|
|
11863
11854
|
};
|
|
11864
11855
|
i.onerror = (e) => {
|
|
11865
11856
|
c(e, "XHR error occurred", null, 400);
|
|
@@ -12247,7 +12238,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
12247
12238
|
}, xa = wi(Li, Ci);
|
|
12248
12239
|
b.Crypto = xa, b.BufferUtils = Ci, b.Http = ki, b.Config = Li, b.Transports = Zi, b.WebStorage = Mi;
|
|
12249
12240
|
for (let e of [Or, oi]) e.Crypto = xa, e._MsgPack = ha;
|
|
12250
|
-
ki.bundledRequestImplementations = ba,
|
|
12241
|
+
ki.bundledRequestImplementations = ba, T.initLogHandlers(), b.Defaults = ft(Qi), b.Config.agent && (b.Defaults.agent += " " + b.Config.agent);
|
|
12251
12242
|
var Sa = {
|
|
12252
12243
|
ErrorInfo: O,
|
|
12253
12244
|
Rest: Or,
|
|
@@ -12269,7 +12260,7 @@ var Gs = /* @__PURE__ */ s(((e, t) => {
|
|
|
12269
12260
|
};
|
|
12270
12261
|
function cc(e, t) {
|
|
12271
12262
|
Ye(t, !0), ri(e, sc);
|
|
12272
|
-
let n = $(t, "apiOrigin", 7), r = $(t, "slug", 7), i = $(t, "session", 7), a = $(t, "lang", 7), o = $(t, "currencySymbol", 7), s = $(t, "variant", 7), c = $(t, "host", 7), l = $(t, "onstatus", 7), d = $(t, "onstartover", 7), f = "sidon-booking-payment", p = /* @__PURE__ */ V(null), m = /* @__PURE__ */ L(() => Va(a(), J(p)?.booking.locale)), h = /* @__PURE__ */ L(() => Co(J(m))), g = /* @__PURE__ */ V(an([])), _ = /* @__PURE__ */ V(null), v = /* @__PURE__ */ V(null), y = /* @__PURE__ */ V(!1), b = /* @__PURE__ */ V(!1), x = /* @__PURE__ */ V(!1), S = /* @__PURE__ */ V(!1),
|
|
12263
|
+
let n = $(t, "apiOrigin", 7), r = $(t, "slug", 7), i = $(t, "session", 7), a = $(t, "lang", 7), o = $(t, "currencySymbol", 7), s = $(t, "variant", 7), c = $(t, "host", 7), l = $(t, "onstatus", 7), d = $(t, "onstartover", 7), f = "sidon-booking-payment", p = /* @__PURE__ */ V(null), m = /* @__PURE__ */ L(() => Va(a(), J(p)?.booking.locale)), h = /* @__PURE__ */ L(() => Co(J(m))), g = /* @__PURE__ */ V(an([])), _ = /* @__PURE__ */ V(null), v = /* @__PURE__ */ V(null), y = /* @__PURE__ */ V(!1), b = /* @__PURE__ */ V(!1), x = /* @__PURE__ */ V(!1), S = /* @__PURE__ */ V(!1), ee = /* @__PURE__ */ V(null), C = null, w = null, T = null, E = !1, D = /* @__PURE__ */ V(!1), O = !1, k = 0, A = !1, j = null, te, ne = (e) => e instanceof ss && e.status < 400 ? J(h).networkError : e instanceof Error ? e.message : String(e), re = (e) => ka(e)?.toLocaleDateString(J(m), {
|
|
12273
12264
|
day: "numeric",
|
|
12274
12265
|
month: "short",
|
|
12275
12266
|
year: "numeric"
|
|
@@ -12285,31 +12276,31 @@ function cc(e, t) {
|
|
|
12285
12276
|
if (A || e !== k) return;
|
|
12286
12277
|
H(p, t, !0), H(_, null);
|
|
12287
12278
|
let a = t.booking.status;
|
|
12288
|
-
if (a !==
|
|
12289
|
-
let e =
|
|
12290
|
-
|
|
12279
|
+
if (a !== T) {
|
|
12280
|
+
let e = T;
|
|
12281
|
+
T = a, l()(a, e);
|
|
12291
12282
|
}
|
|
12292
|
-
a === "hold" ? t.payment && !
|
|
12283
|
+
a === "hold" ? t.payment && !E && (E = !0, ae(t.payment)) : se();
|
|
12293
12284
|
} catch (t) {
|
|
12294
12285
|
if (A || e !== k || J(p)) return;
|
|
12295
12286
|
H(_, t instanceof ss && t.status === 404 ? J(h).bookingNotFound : J(h).loadFailed, !0);
|
|
12296
12287
|
}
|
|
12297
12288
|
}
|
|
12298
12289
|
async function ae(e) {
|
|
12299
|
-
H(
|
|
12290
|
+
H(D, !1);
|
|
12300
12291
|
try {
|
|
12301
12292
|
await _s(n(), r(), i()), await M();
|
|
12302
12293
|
} catch (t) {
|
|
12303
12294
|
let n = no(t instanceof ss ? t.status : 0);
|
|
12304
|
-
n === "lapsed" ? H(b, !0) : n === "card" ? await oe(e) : (H(v, ne(t), !0), H(
|
|
12295
|
+
n === "lapsed" ? H(b, !0) : n === "card" ? await oe(e) : (H(v, ne(t), !0), H(D, !0), E = !1);
|
|
12305
12296
|
}
|
|
12306
12297
|
}
|
|
12307
12298
|
async function oe(e) {
|
|
12308
|
-
if (
|
|
12299
|
+
if (w || (H(x, !0), await mr(), A || !J(ee))) return;
|
|
12309
12300
|
let t = document.createElement("slot");
|
|
12310
|
-
t.name = f, J(
|
|
12301
|
+
t.name = f, J(ee).appendChild(t);
|
|
12311
12302
|
let n = document.createElement("div");
|
|
12312
|
-
n.slot = f, c().appendChild(n),
|
|
12303
|
+
n.slot = f, c().appendChild(n), w = n;
|
|
12313
12304
|
try {
|
|
12314
12305
|
let t = await Xo({
|
|
12315
12306
|
publishableKey: e.publishableKey,
|
|
@@ -12318,21 +12309,21 @@ function cc(e, t) {
|
|
|
12318
12309
|
mount: n,
|
|
12319
12310
|
colorPrimary: getComputedStyle(c()).getPropertyValue("--brand-navy").trim() || "#16365b"
|
|
12320
12311
|
});
|
|
12321
|
-
if (
|
|
12322
|
-
|
|
12312
|
+
if (w !== n) return t.destroy();
|
|
12313
|
+
C = t, H(S, !0);
|
|
12323
12314
|
} catch (e) {
|
|
12324
12315
|
H(v, ne(e), !0);
|
|
12325
12316
|
}
|
|
12326
12317
|
}
|
|
12327
12318
|
function se() {
|
|
12328
|
-
|
|
12319
|
+
C?.destroy(), C = null, w?.remove(), w = null, H(x, !1), H(S, !1);
|
|
12329
12320
|
}
|
|
12330
12321
|
async function ce() {
|
|
12331
|
-
if (!
|
|
12322
|
+
if (!C || J(y)) return;
|
|
12332
12323
|
H(y, !0), H(v, null);
|
|
12333
12324
|
let e = null;
|
|
12334
12325
|
try {
|
|
12335
|
-
await
|
|
12326
|
+
await C.confirm();
|
|
12336
12327
|
} catch (t) {
|
|
12337
12328
|
e = t;
|
|
12338
12329
|
}
|
|
@@ -12475,20 +12466,20 @@ function cc(e, t) {
|
|
|
12475
12466
|
let t = /* @__PURE__ */ L(() => J(p).booking), a = /* @__PURE__ */ L(() => J(t).expired || J(b) ? "expired" : J(t).status);
|
|
12476
12467
|
var s = ac(), c = mn(s);
|
|
12477
12468
|
let l;
|
|
12478
|
-
var u = U(c), f = U(u), _ = U(f),
|
|
12469
|
+
var u = U(c), f = U(u), _ = U(f), C = (e) => {
|
|
12479
12470
|
var t = Ys();
|
|
12480
12471
|
Ve(), X(e, t);
|
|
12481
|
-
},
|
|
12472
|
+
}, w = (e) => {
|
|
12482
12473
|
X(e, Xs());
|
|
12483
|
-
},
|
|
12474
|
+
}, T = (e) => {
|
|
12484
12475
|
X(e, Zs());
|
|
12485
12476
|
};
|
|
12486
12477
|
Q(_, (e) => {
|
|
12487
|
-
J(a) === "hold" ? e(
|
|
12478
|
+
J(a) === "hold" ? e(C) : J(a) === "pending" || J(a) === "confirmed" ? e(w, 1) : e(T, -1);
|
|
12488
12479
|
}), F(f), F(u);
|
|
12489
|
-
var
|
|
12490
|
-
F(
|
|
12491
|
-
var k = W(
|
|
12480
|
+
var E = W(u, 2), O = U(E, !0);
|
|
12481
|
+
F(E);
|
|
12482
|
+
var k = W(E, 2), A = U(k, !0);
|
|
12492
12483
|
F(k);
|
|
12493
12484
|
var j = W(k, 2), te = U(j, !0);
|
|
12494
12485
|
F(j);
|
|
@@ -12509,7 +12500,7 @@ function cc(e, t) {
|
|
|
12509
12500
|
var d = W(l, 2), f = U(d, !0);
|
|
12510
12501
|
F(d);
|
|
12511
12502
|
var p = W(d, 2);
|
|
12512
|
-
Oi(p, (e) => H(
|
|
12503
|
+
Oi(p, (e) => H(ee, e), () => J(ee));
|
|
12513
12504
|
var g = W(p, 2), _ = U(g, !0);
|
|
12514
12505
|
F(g), F(n), G((e, t) => {
|
|
12515
12506
|
Z(a, J(h).paymentHold), Z(c, `${J(h).total ?? ""} ${e ?? ""}`), Z(u, J(h).paymentNote), Z(f, t), g.disabled = J(y) || !J(S), Z(_, J(y) ? J(h).sending : J(h).payAndSend);
|
|
@@ -12638,7 +12629,7 @@ function cc(e, t) {
|
|
|
12638
12629
|
}), X(e, t);
|
|
12639
12630
|
};
|
|
12640
12631
|
Q(Je, (e) => {
|
|
12641
|
-
J(
|
|
12632
|
+
J(D) && e(Ye);
|
|
12642
12633
|
});
|
|
12643
12634
|
var Xe = W(Je, 2), Ze = (e) => {
|
|
12644
12635
|
var t = ic(), n = U(t), r = (e) => {
|
|
@@ -12725,152 +12716,152 @@ function pc() {
|
|
|
12725
12716
|
}
|
|
12726
12717
|
//#endregion
|
|
12727
12718
|
//#region src/BookingWidget.svelte
|
|
12728
|
-
var mc = /* @__PURE__ */ Y("<div><!></div>"), hc = /* @__PURE__ */ Y("<div class=\"sbw-load-error svelte-h0br6q\" role=\"alert\"> </div>"), gc = /* @__PURE__ */ Y("<!> <!> <!> <!> <!>", 1), _c = /* @__PURE__ */ Y("<!> <div
|
|
12719
|
+
var mc = /* @__PURE__ */ Y("<div><!></div>"), hc = /* @__PURE__ */ Y("<div class=\"sbw-load-error svelte-h0br6q\" role=\"alert\"> </div>"), gc = /* @__PURE__ */ Y("<!> <!> <!> <!> <!>", 1), _c = /* @__PURE__ */ Y("<!> <div><!></div>", 1), vc = {
|
|
12729
12720
|
hash: "svelte-h0br6q",
|
|
12730
|
-
code: ":host {--sbw-radius: 10px;display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;box-sizing:border-box;max-width:560px; /* fallback until the width prop's effect runs; see script */margin:0 auto;}:host .svelte-h0br6q {box-sizing:border-box;}.sbw-root.svelte-h0br6q {border-radius:var(--sbw-radius);overflow:hidden;box-shadow:0 8px 32px rgba(0, 0, 0, 0.16);}\n /* Inline, not a replacement for the card: the guest can still change\n dates or length, and the next successful load clears it. */.sbw-load-error.svelte-h0br6q {padding:16px 20px;font-size:14px;color:#cc4949;background:#fff;}\n /* Sits outside .sbw-root (not a child of it) specifically so map-width\n can be set to 100vw and actually break out full-bleed - .sbw-root's\n own overflow:hidden (for its rounded corners) would otherwise clip\n anything wider than the card right back down to the card's width,\n no matter what width/margin the child itself asks for. */.sbw-map-slot.svelte-h0br6q {border-radius:var(--sbw-radius) var(--sbw-radius) 0 0;overflow:hidden;}.sbw-map-slot--full-bleed.svelte-h0br6q {\n /* Standard full-bleed trick: escapes a centered ancestor of any width\n by sizing to the viewport and pulling back by the half-difference.\n Only correct when width is actually 100vw (see class:sbw-map-slot--\n full-bleed above) - applying this margin at any other width would\n misposition it instead of centering it. */margin-left:calc(50% - 50vw);margin-right:calc(50% - 50vw);border-radius:0;}"
|
|
12721
|
+
code: ":host {--sbw-radius: 10px;display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;box-sizing:border-box;max-width:560px; /* fallback until the width prop's effect runs; see script */margin:0 auto;}:host .svelte-h0br6q {box-sizing:border-box;}.sbw-root.svelte-h0br6q {border-radius:var(--sbw-radius);overflow:hidden;box-shadow:0 8px 32px rgba(0, 0, 0, 0.16);}\n /* Inline, not a replacement for the card: the guest can still change\n dates or length, and the next successful load clears it. */.sbw-load-error.svelte-h0br6q {padding:16px 20px;font-size:14px;color:#cc4949;background:#fff;}\n /* Sits outside .sbw-root (not a child of it) specifically so map-width\n can be set to 100vw and actually break out full-bleed - .sbw-root's\n own overflow:hidden (for its rounded corners) would otherwise clip\n anything wider than the card right back down to the card's width,\n no matter what width/margin the child itself asks for. */.sbw-map-slot.svelte-h0br6q {border-radius:var(--sbw-radius) var(--sbw-radius) 0 0;overflow:hidden;}.sbw-map-slot--full-bleed.svelte-h0br6q {\n /* Standard full-bleed trick: escapes a centered ancestor of any width\n by sizing to the viewport and pulling back by the half-difference.\n Only correct when width is actually 100vw (see class:sbw-map-slot--\n full-bleed above) - applying this margin at any other width would\n misposition it instead of centering it. */margin-left:calc(50% - 50vw);margin-right:calc(50% - 50vw);border-radius:0;}\n /* Overlay: the card's negative-margin pull-up does the overlap, and its\n position/z-index paints it over the map's own positioned layers. */\n /* Below 768px overlay stacks; map-height/map-gap are sized for the\n overlay, so fall back to a half-screen map and a small gap. */\n @media (max-width: 767px) {.sbw-map-slot--overlay.svelte-h0br6q {height:50vh !important;margin-bottom:24px !important;}\n }\n @media (min-width: 768px) {.sbw-map-slot--overlay.svelte-h0br6q {margin-bottom:0 !important; /* beats the stacked inline margin */border-radius:0;}.sbw-root--overlay.svelte-h0br6q {position:relative;z-index:1;max-width:var(--sbw-card-width, 560px);margin-top:calc(var(--sbw-map-gap, 24px) - var(--sbw-map-h, 280px));margin-left:var(--sbw-card-inset, 24px);}\n }"
|
|
12731
12722
|
};
|
|
12732
12723
|
function yc(e, t) {
|
|
12733
12724
|
Ye(t, !0), ri(e, vc);
|
|
12734
|
-
let n = $(t, "marina", 7), r = $(t, "apiOrigin", 7, ""), i = $(t, "from", 7, ""), a = $(t, "to", 7, ""), o = $(t, "length", 7, 15), s = $(t, "berth", 7, ""), c = $(t, "locale", 7, ""), l = $(t, "currencySymbol", 7, ""), u = $(t, "variant", 7, "navy"), d = $(t, "mapsApiKey", 7, ""), f = $(t, "mapStyle", 7, "chart"), p = $(t, "mapHeight", 7, "280px"), m = $(t, "mapWidth", 7, "100%"), h = $(t, "mapGap", 7, "0px"), g = $(t, "width", 7, "560px"), _ = $(t, "logoMark", 7, null),
|
|
12735
|
-
function
|
|
12736
|
-
|
|
12725
|
+
let n = $(t, "marina", 7), r = $(t, "apiOrigin", 7, ""), i = $(t, "from", 7, ""), a = $(t, "to", 7, ""), o = $(t, "length", 7, 15), s = $(t, "berth", 7, ""), c = $(t, "locale", 7, ""), l = $(t, "currencySymbol", 7, ""), u = $(t, "variant", 7, "navy"), d = $(t, "mapsApiKey", 7, ""), f = $(t, "mapStyle", 7, "chart"), p = $(t, "mapHeight", 7, "280px"), m = $(t, "mapWidth", 7, "100%"), h = $(t, "mapGap", 7, "0px"), g = $(t, "width", 7, "560px"), _ = $(t, "layout", 7, "stacked"), v = $(t, "logoMark", 7, null), y = $(t, "marinaName", 7, ""), b = $(t, "otherMarinas", 23, () => []), x = $(t, "bookingId", 7), S = t.$$host;
|
|
12726
|
+
function ee(e, t) {
|
|
12727
|
+
S.dispatchEvent(new CustomEvent(e, {
|
|
12737
12728
|
detail: t,
|
|
12738
12729
|
bubbles: !0,
|
|
12739
12730
|
composed: !0
|
|
12740
12731
|
}));
|
|
12741
12732
|
}
|
|
12742
|
-
let C = /* @__PURE__ */ L(() => Ba(c())), w = /* @__PURE__ */ L(() => Co(J(C))), T = _r(() =>
|
|
12743
|
-
function
|
|
12733
|
+
let C = /* @__PURE__ */ L(() => Ba(c())), w = /* @__PURE__ */ L(() => Co(J(C))), T = _r(() => x() != null), E = /* @__PURE__ */ V(an(_r(() => T ? O() : uc(n())))), D = /* @__PURE__ */ V(an(_r(() => T || J(E) ? 3 : 1)));
|
|
12734
|
+
function O() {
|
|
12744
12735
|
let e = pc();
|
|
12745
12736
|
if (e) {
|
|
12746
12737
|
let t = {
|
|
12747
|
-
id:
|
|
12738
|
+
id: x() || e.id,
|
|
12748
12739
|
token: e.token
|
|
12749
12740
|
};
|
|
12750
12741
|
return dc(n(), t), t;
|
|
12751
12742
|
}
|
|
12752
12743
|
let t = uc(n());
|
|
12753
|
-
return t && (!
|
|
12744
|
+
return t && (!x() || t.id === x()) ? t : null;
|
|
12754
12745
|
}
|
|
12755
|
-
let
|
|
12746
|
+
let k = /* @__PURE__ */ V(an(_r(() => o() && o() > 0 ? o() : 15))), A = /* @__PURE__ */ V(an(_r(() => {
|
|
12756
12747
|
let e = ka(i());
|
|
12757
12748
|
if (e) return e;
|
|
12758
12749
|
let t = /* @__PURE__ */ new Date();
|
|
12759
12750
|
return t.setHours(0, 0, 0, 0), t;
|
|
12760
|
-
}))),
|
|
12751
|
+
}))), j = /* @__PURE__ */ V(an(_r(() => {
|
|
12761
12752
|
let e = ka(a());
|
|
12762
12753
|
if (e) return e;
|
|
12763
12754
|
let t = ka(i()) ?? new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
12764
12755
|
return new Date(t.getTime() + 2592e5);
|
|
12765
|
-
}))),
|
|
12756
|
+
}))), te = /* @__PURE__ */ V(null), ne = /* @__PURE__ */ V(""), re = /* @__PURE__ */ V(""), ie = /* @__PURE__ */ V(""), M = /* @__PURE__ */ V(""), ae = /* @__PURE__ */ V(null), oe = /* @__PURE__ */ V(""), se = /* @__PURE__ */ V(null), ce = /* @__PURE__ */ V(an([])), le = /* @__PURE__ */ V(null), ue = /* @__PURE__ */ V(0), de = /* @__PURE__ */ V(null), fe = /* @__PURE__ */ V(void 0), pe = /* @__PURE__ */ V(!1), me = /* @__PURE__ */ V(null), he = /* @__PURE__ */ V("#16365b"), ge = /* @__PURE__ */ V("#c9a86b");
|
|
12766
12757
|
Gr(() => {
|
|
12767
|
-
let e = getComputedStyle(
|
|
12768
|
-
H(
|
|
12758
|
+
let e = getComputedStyle(S);
|
|
12759
|
+
H(he, e.getPropertyValue("--brand-navy").trim() || J(he), !0), H(ge, e.getPropertyValue("--brand-gold").trim() || J(ge), !0);
|
|
12769
12760
|
}), Gr(() => {
|
|
12770
12761
|
let e = new ResizeObserver(() => {
|
|
12771
12762
|
window.dispatchEvent(new Event("resize"));
|
|
12772
12763
|
});
|
|
12773
|
-
return e.observe(
|
|
12764
|
+
return e.observe(S), () => e.disconnect();
|
|
12774
12765
|
}), Gr(() => {
|
|
12775
|
-
|
|
12766
|
+
_() === "overlay" ? (S.style.maxWidth = "none", S.style.setProperty("--sbw-card-width", g())) : S.style.maxWidth = g();
|
|
12776
12767
|
});
|
|
12777
|
-
let
|
|
12768
|
+
let _e = /* @__PURE__ */ L(() => !!d() && J(D) !== 3 && !J(le)), ve = /* @__PURE__ */ L(() => J(ae) != null && J(ae) > 0 ? J(ae) : null), ye = /* @__PURE__ */ L(() => (J(se)?.berths ?? []).filter((e) => e.status === "available")), be = /* @__PURE__ */ L(() => !J(ye).length || J(ye).some((e) => e.lengthM == null) ? 200 : Math.max(...J(ye).map((e) => e.lengthM ?? 0))), xe = /* @__PURE__ */ L(() => J(te) && J(ce).some((e) => e.label === J(te)) ? J(te) : to(J(ce))), Se = /* @__PURE__ */ L(() => J(ce).find((e) => e.label === J(xe)) ?? null), Ce = /* @__PURE__ */ L(() => J(Se)?.totalPrice == null ? null : io(J(Se).totalPrice, J(se)?.currency ?? null, l(), J(C))), we = !1;
|
|
12778
12769
|
wn(() => {
|
|
12779
|
-
|
|
12770
|
+
we || !J(ye).length || (we = !0, J(k) > J(be) && H(k, J(be), !0));
|
|
12780
12771
|
}), wn(() => {
|
|
12781
12772
|
let e = s();
|
|
12782
12773
|
_r(() => {
|
|
12783
|
-
J(D) === 1 && H(
|
|
12774
|
+
J(D) === 1 && H(te, e || null, !0);
|
|
12784
12775
|
});
|
|
12785
12776
|
});
|
|
12786
|
-
let
|
|
12777
|
+
let Te = /* @__PURE__ */ L(() => J(D) !== 3);
|
|
12787
12778
|
wn(() => {
|
|
12788
|
-
if (!J(
|
|
12789
|
-
let e = J(
|
|
12790
|
-
from: Oa(J(
|
|
12791
|
-
to: Oa(J(
|
|
12779
|
+
if (!J(Te)) return;
|
|
12780
|
+
let e = J(A) && J(j) ? {
|
|
12781
|
+
from: Oa(J(A)),
|
|
12782
|
+
to: Oa(J(j))
|
|
12792
12783
|
} : void 0;
|
|
12793
|
-
J(
|
|
12784
|
+
J(ue);
|
|
12794
12785
|
let t = !1, i = setTimeout(() => {
|
|
12795
12786
|
fs(r(), n(), e).then((e) => {
|
|
12796
|
-
t || (H(
|
|
12787
|
+
t || (H(se, e, !0), H(le, null));
|
|
12797
12788
|
}).catch(() => {
|
|
12798
|
-
t || H(
|
|
12789
|
+
t || H(le, J(w).wizard.errLoad, !0);
|
|
12799
12790
|
});
|
|
12800
12791
|
}, 200);
|
|
12801
12792
|
return () => {
|
|
12802
12793
|
t = !0, clearTimeout(i);
|
|
12803
12794
|
};
|
|
12804
12795
|
}), wn(() => {
|
|
12805
|
-
if (J(D) !== 1 || !J(
|
|
12796
|
+
if (J(D) !== 1 || !J(A) || !J(j) || +J(j) <= +J(A) || !(J(k) > 0)) return;
|
|
12806
12797
|
let e = {
|
|
12807
|
-
arrival: Oa(J(
|
|
12808
|
-
departure: Oa(J(
|
|
12809
|
-
boatLengthM: J(
|
|
12810
|
-
boatBeamM: J(
|
|
12798
|
+
arrival: Oa(J(A)),
|
|
12799
|
+
departure: Oa(J(j)),
|
|
12800
|
+
boatLengthM: J(k),
|
|
12801
|
+
boatBeamM: J(ve)
|
|
12811
12802
|
};
|
|
12812
|
-
J(
|
|
12803
|
+
J(ue);
|
|
12813
12804
|
let t = !1, i = setTimeout(() => {
|
|
12814
12805
|
ms(r(), n(), e).then((e) => {
|
|
12815
|
-
t || (H(
|
|
12806
|
+
t || (H(ce, e, !0), H(le, null));
|
|
12816
12807
|
}).catch(() => {
|
|
12817
|
-
t || H(
|
|
12808
|
+
t || H(le, J(w).wizard.errLoad, !0);
|
|
12818
12809
|
});
|
|
12819
12810
|
}, 200);
|
|
12820
12811
|
return () => {
|
|
12821
12812
|
t = !0, clearTimeout(i);
|
|
12822
12813
|
};
|
|
12823
12814
|
}), wn(() => {
|
|
12824
|
-
|
|
12815
|
+
ee("sidon-step-change", { step: J(D) });
|
|
12825
12816
|
}), wn(() => {
|
|
12826
|
-
T ||
|
|
12817
|
+
T || ee("sidon-loa-change", { loa: J(k) });
|
|
12827
12818
|
});
|
|
12828
|
-
function
|
|
12829
|
-
J(D) === 1 && H(
|
|
12819
|
+
function Ee(e) {
|
|
12820
|
+
J(D) === 1 && H(te, e, !0);
|
|
12830
12821
|
}
|
|
12831
|
-
function
|
|
12832
|
-
e < J(D) &&
|
|
12833
|
-
}
|
|
12834
|
-
function Ee() {
|
|
12835
|
-
J(fe) || (H(pe, null), J(D) === 1 ? ke() : J(D) === 2 && je());
|
|
12822
|
+
function De(e) {
|
|
12823
|
+
e < J(D) && Fe();
|
|
12836
12824
|
}
|
|
12837
|
-
let De = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
12838
12825
|
function Oe() {
|
|
12826
|
+
J(pe) || (H(me, null), J(D) === 1 ? je() : J(D) === 2 && Ne());
|
|
12827
|
+
}
|
|
12828
|
+
let ke = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
12829
|
+
function Ae() {
|
|
12839
12830
|
let e = J(w).wizard;
|
|
12840
|
-
return !J(
|
|
12831
|
+
return !J(A) || !J(j) || +J(j) <= +J(A) ? e.errDates : J(k) > 0 ? J(xe) ? J(ne).trim() ? J(M).trim() ? ke.test(J(re).trim()) ? null : e.errEmail : e.errBoatName : e.errName : e.errNoBerth : e.errLength;
|
|
12841
12832
|
}
|
|
12842
|
-
async function
|
|
12843
|
-
let e =
|
|
12844
|
-
if (e) return void H(
|
|
12845
|
-
H(
|
|
12833
|
+
async function je() {
|
|
12834
|
+
let e = Ae();
|
|
12835
|
+
if (e) return void H(me, e, !0);
|
|
12836
|
+
H(pe, !0);
|
|
12846
12837
|
try {
|
|
12847
12838
|
let e = await hs(r(), n(), {
|
|
12848
|
-
berthLabel: J(
|
|
12849
|
-
arrival: Oa(J(
|
|
12850
|
-
departure: Oa(J(
|
|
12851
|
-
contactName: J(
|
|
12852
|
-
contactEmail: J(
|
|
12853
|
-
contactPhone: J(
|
|
12854
|
-
boatName: J(
|
|
12855
|
-
boatLengthM: J(
|
|
12856
|
-
boatBeamM: J(
|
|
12857
|
-
notes: J(
|
|
12839
|
+
berthLabel: J(xe),
|
|
12840
|
+
arrival: Oa(J(A)),
|
|
12841
|
+
departure: Oa(J(j)),
|
|
12842
|
+
contactName: J(ne).trim(),
|
|
12843
|
+
contactEmail: J(re).trim(),
|
|
12844
|
+
contactPhone: J(ie).trim() || void 0,
|
|
12845
|
+
boatName: J(M).trim(),
|
|
12846
|
+
boatLengthM: J(k),
|
|
12847
|
+
boatBeamM: J(ve),
|
|
12848
|
+
notes: J(oe).trim() || void 0,
|
|
12858
12849
|
locale: J(C)
|
|
12859
12850
|
}), t = {
|
|
12860
12851
|
id: e.booking.id,
|
|
12861
12852
|
token: e.token
|
|
12862
12853
|
};
|
|
12863
|
-
H(E, t, !0), dc(n(), t), e.payment ? (H(
|
|
12854
|
+
H(E, t, !0), dc(n(), t), e.payment ? (H(de, e, !0), H(D, 2)) : Pe(t.id);
|
|
12864
12855
|
} catch (e) {
|
|
12865
|
-
|
|
12856
|
+
Me(e);
|
|
12866
12857
|
} finally {
|
|
12867
|
-
H(
|
|
12858
|
+
H(pe, !1);
|
|
12868
12859
|
}
|
|
12869
12860
|
}
|
|
12870
|
-
function
|
|
12861
|
+
function Me(e) {
|
|
12871
12862
|
let t = J(w).wizard;
|
|
12872
|
-
if (!(e instanceof ss) || e.status === 0) return void H(
|
|
12873
|
-
(e.status === 409 || e.status === 404) && tn(
|
|
12863
|
+
if (!(e instanceof ss) || e.status === 0) return void H(me, t.errNetwork, !0);
|
|
12864
|
+
(e.status === 409 || e.status === 404) && tn(ue);
|
|
12874
12865
|
let n = {
|
|
12875
12866
|
404: t.errTaken,
|
|
12876
12867
|
409: t.errTaken,
|
|
@@ -12878,45 +12869,45 @@ function yc(e, t) {
|
|
|
12878
12869
|
502: t.errPayment,
|
|
12879
12870
|
503: t.errUnavailable
|
|
12880
12871
|
};
|
|
12881
|
-
H(
|
|
12872
|
+
H(me, n[e.status] ?? (e.status >= 500 ? t.errUnavailable : e.message), !0);
|
|
12882
12873
|
}
|
|
12883
|
-
async function
|
|
12874
|
+
async function Ne() {
|
|
12884
12875
|
let e = J(E);
|
|
12885
|
-
if (!(!e || !J(
|
|
12886
|
-
H(
|
|
12876
|
+
if (!(!e || !J(fe))) {
|
|
12877
|
+
H(pe, !0);
|
|
12887
12878
|
try {
|
|
12888
|
-
await J(
|
|
12879
|
+
await J(fe).confirm();
|
|
12889
12880
|
} catch (e) {
|
|
12890
|
-
H(
|
|
12881
|
+
H(me, e instanceof Error ? e.message : J(w).wizard.errNetwork, !0), H(pe, !1);
|
|
12891
12882
|
return;
|
|
12892
12883
|
}
|
|
12893
|
-
await _s(r(), n(), e).catch(() => {}), H(
|
|
12884
|
+
await _s(r(), n(), e).catch(() => {}), H(pe, !1), Pe(e.id);
|
|
12894
12885
|
}
|
|
12895
12886
|
}
|
|
12896
|
-
function
|
|
12897
|
-
H(
|
|
12887
|
+
function Pe(e) {
|
|
12888
|
+
H(de, null), H(D, 3), ee("sidon-booked", {
|
|
12898
12889
|
bookingId: e,
|
|
12899
12890
|
marina: n()
|
|
12900
12891
|
});
|
|
12901
12892
|
}
|
|
12902
|
-
async function
|
|
12893
|
+
async function Fe() {
|
|
12903
12894
|
let e = J(E);
|
|
12904
|
-
if (J(
|
|
12905
|
-
H(
|
|
12895
|
+
if (J(pe) || J(D) !== 2 || !e) return;
|
|
12896
|
+
H(me, null), H(pe, !0);
|
|
12906
12897
|
let t = await vs(r(), n(), e).then(() => !0, (e) => e instanceof ss && e.status >= 400 && e.status < 500 && e.status !== 429);
|
|
12907
|
-
if (H(
|
|
12908
|
-
fc(n()), H(E, null), H(
|
|
12898
|
+
if (H(pe, !1), !t) return void H(me, J(w).wizard.errNetwork, !0);
|
|
12899
|
+
fc(n()), H(E, null), H(de, null), H(D, 1);
|
|
12909
12900
|
}
|
|
12910
|
-
function
|
|
12911
|
-
fc(n()), H(E, null), H(
|
|
12901
|
+
function Ie() {
|
|
12902
|
+
fc(n()), H(E, null), H(me, null), H(D, 1);
|
|
12912
12903
|
}
|
|
12913
|
-
function
|
|
12914
|
-
t !== null && J(E) &&
|
|
12904
|
+
function Le(e, t) {
|
|
12905
|
+
t !== null && J(E) && ee("sidon-booking-status", {
|
|
12915
12906
|
bookingId: J(E).id,
|
|
12916
12907
|
status: e
|
|
12917
12908
|
});
|
|
12918
12909
|
}
|
|
12919
|
-
var
|
|
12910
|
+
var N = {
|
|
12920
12911
|
get marina() {
|
|
12921
12912
|
return n();
|
|
12922
12913
|
},
|
|
@@ -13007,39 +12998,45 @@ function yc(e, t) {
|
|
|
13007
12998
|
set width(e = "560px") {
|
|
13008
12999
|
g(e), B();
|
|
13009
13000
|
},
|
|
13010
|
-
get
|
|
13001
|
+
get layout() {
|
|
13011
13002
|
return _();
|
|
13012
13003
|
},
|
|
13013
|
-
set
|
|
13004
|
+
set layout(e = "stacked") {
|
|
13014
13005
|
_(e), B();
|
|
13015
13006
|
},
|
|
13016
|
-
get
|
|
13007
|
+
get logoMark() {
|
|
13017
13008
|
return v();
|
|
13018
13009
|
},
|
|
13019
|
-
set
|
|
13010
|
+
set logoMark(e = null) {
|
|
13020
13011
|
v(e), B();
|
|
13021
13012
|
},
|
|
13022
|
-
get
|
|
13013
|
+
get marinaName() {
|
|
13023
13014
|
return y();
|
|
13024
13015
|
},
|
|
13025
|
-
set
|
|
13016
|
+
set marinaName(e = "") {
|
|
13026
13017
|
y(e), B();
|
|
13027
13018
|
},
|
|
13028
|
-
get
|
|
13019
|
+
get otherMarinas() {
|
|
13029
13020
|
return b();
|
|
13030
13021
|
},
|
|
13031
|
-
set
|
|
13022
|
+
set otherMarinas(e = []) {
|
|
13032
13023
|
b(e), B();
|
|
13024
|
+
},
|
|
13025
|
+
get bookingId() {
|
|
13026
|
+
return x();
|
|
13027
|
+
},
|
|
13028
|
+
set bookingId(e) {
|
|
13029
|
+
x(e), B();
|
|
13033
13030
|
}
|
|
13034
|
-
},
|
|
13031
|
+
}, Re = _c(), P = mn(Re), ze = (e) => {
|
|
13035
13032
|
var t = mc();
|
|
13036
13033
|
let n;
|
|
13037
13034
|
var r = U(t);
|
|
13038
13035
|
{
|
|
13039
13036
|
let e = /* @__PURE__ */ L(() => ({
|
|
13040
|
-
lat: J(
|
|
13041
|
-
lng: J(
|
|
13042
|
-
})), t = /* @__PURE__ */ L(() => J(
|
|
13037
|
+
lat: J(se)?.profile.lat ?? 0,
|
|
13038
|
+
lng: J(se)?.profile.lng ?? 0
|
|
13039
|
+
})), t = /* @__PURE__ */ L(() => J(se)?.berths ?? []), n = /* @__PURE__ */ L(() => J(se)?.overlays ?? []), i = /* @__PURE__ */ L(() => J(se)?.layout ?? null);
|
|
13043
13040
|
mo(r, {
|
|
13044
13041
|
get mapsApiKey() {
|
|
13045
13042
|
return d();
|
|
@@ -13051,19 +13048,19 @@ function yc(e, t) {
|
|
|
13051
13048
|
return J(e);
|
|
13052
13049
|
},
|
|
13053
13050
|
get navy() {
|
|
13054
|
-
return J(
|
|
13051
|
+
return J(he);
|
|
13055
13052
|
},
|
|
13056
13053
|
get gold() {
|
|
13057
|
-
return J(
|
|
13054
|
+
return J(ge);
|
|
13058
13055
|
},
|
|
13059
13056
|
get logoMark() {
|
|
13060
|
-
return
|
|
13057
|
+
return v();
|
|
13061
13058
|
},
|
|
13062
13059
|
get marinaName() {
|
|
13063
|
-
return
|
|
13060
|
+
return y();
|
|
13064
13061
|
},
|
|
13065
13062
|
get otherMarinas() {
|
|
13066
|
-
return
|
|
13063
|
+
return b();
|
|
13067
13064
|
},
|
|
13068
13065
|
get berths() {
|
|
13069
13066
|
return J(t);
|
|
@@ -13075,22 +13072,27 @@ function yc(e, t) {
|
|
|
13075
13072
|
return J(i);
|
|
13076
13073
|
},
|
|
13077
13074
|
get loa() {
|
|
13078
|
-
return J(
|
|
13075
|
+
return J(k);
|
|
13079
13076
|
},
|
|
13080
13077
|
get selectedBerth() {
|
|
13081
|
-
return J(
|
|
13078
|
+
return J(xe);
|
|
13082
13079
|
},
|
|
13083
|
-
onBerthClick:
|
|
13080
|
+
onBerthClick: Ee
|
|
13084
13081
|
});
|
|
13085
13082
|
}
|
|
13086
13083
|
F(t), G(() => {
|
|
13087
|
-
n = ui(t, 1, "sbw-map-slot svelte-h0br6q", null, n, {
|
|
13084
|
+
n = ui(t, 1, "sbw-map-slot svelte-h0br6q", null, n, {
|
|
13085
|
+
"sbw-map-slot--full-bleed": m() === "100vw",
|
|
13086
|
+
"sbw-map-slot--overlay": _() === "overlay"
|
|
13087
|
+
}), fi(t, `height: ${p() ?? ""}; width: ${m() ?? ""}; margin-bottom: ${h() ?? ""};`);
|
|
13088
13088
|
}), X(e, t);
|
|
13089
13089
|
};
|
|
13090
|
-
Q(
|
|
13091
|
-
|
|
13090
|
+
Q(P, (e) => {
|
|
13091
|
+
J(_e) && e(ze);
|
|
13092
13092
|
});
|
|
13093
|
-
var
|
|
13093
|
+
var Be = W(P, 2);
|
|
13094
|
+
let Ve;
|
|
13095
|
+
var He = U(Be), Ue = (e) => {
|
|
13094
13096
|
var t = Nr(), i = mn(t), a = (e) => {
|
|
13095
13097
|
{
|
|
13096
13098
|
let t = /* @__PURE__ */ L(() => c() ? J(C) : null);
|
|
@@ -13114,9 +13116,9 @@ function yc(e, t) {
|
|
|
13114
13116
|
return u();
|
|
13115
13117
|
},
|
|
13116
13118
|
get host() {
|
|
13117
|
-
return
|
|
13119
|
+
return S;
|
|
13118
13120
|
},
|
|
13119
|
-
onstatus:
|
|
13121
|
+
onstatus: Le
|
|
13120
13122
|
});
|
|
13121
13123
|
}
|
|
13122
13124
|
}, o = (e) => {
|
|
@@ -13126,19 +13128,19 @@ function yc(e, t) {
|
|
|
13126
13128
|
Q(i, (e) => {
|
|
13127
13129
|
J(E) ? e(a) : e(o, -1);
|
|
13128
13130
|
}), X(e, t);
|
|
13129
|
-
},
|
|
13131
|
+
}, We = (e) => {
|
|
13130
13132
|
var t = gc(), i = mn(t), a = (e) => {
|
|
13131
13133
|
{
|
|
13132
|
-
let t = /* @__PURE__ */ L(() => J(
|
|
13134
|
+
let t = /* @__PURE__ */ L(() => J(xe) ?? "—"), n = /* @__PURE__ */ L(() => c() || "en"), r = /* @__PURE__ */ L(() => J(D) !== 1);
|
|
13133
13135
|
Pa(e, {
|
|
13134
13136
|
get berthLabel() {
|
|
13135
13137
|
return J(t);
|
|
13136
13138
|
},
|
|
13137
13139
|
get priceLabel() {
|
|
13138
|
-
return J(
|
|
13140
|
+
return J(Ce);
|
|
13139
13141
|
},
|
|
13140
13142
|
get maxLoa() {
|
|
13141
|
-
return J(
|
|
13143
|
+
return J(be);
|
|
13142
13144
|
},
|
|
13143
13145
|
get locale() {
|
|
13144
13146
|
return J(n);
|
|
@@ -13147,22 +13149,22 @@ function yc(e, t) {
|
|
|
13147
13149
|
return J(r);
|
|
13148
13150
|
},
|
|
13149
13151
|
get loa() {
|
|
13150
|
-
return J(
|
|
13152
|
+
return J(k);
|
|
13151
13153
|
},
|
|
13152
13154
|
set loa(e) {
|
|
13153
|
-
H(
|
|
13155
|
+
H(k, e, !0);
|
|
13154
13156
|
},
|
|
13155
13157
|
get from() {
|
|
13156
|
-
return J(
|
|
13158
|
+
return J(A);
|
|
13157
13159
|
},
|
|
13158
13160
|
set from(e) {
|
|
13159
|
-
H(
|
|
13161
|
+
H(A, e, !0);
|
|
13160
13162
|
},
|
|
13161
13163
|
get to() {
|
|
13162
|
-
return J(
|
|
13164
|
+
return J(j);
|
|
13163
13165
|
},
|
|
13164
13166
|
set to(e) {
|
|
13165
|
-
H(
|
|
13167
|
+
H(j, e, !0);
|
|
13166
13168
|
}
|
|
13167
13169
|
});
|
|
13168
13170
|
}
|
|
@@ -13178,14 +13180,14 @@ function yc(e, t) {
|
|
|
13178
13180
|
get labels() {
|
|
13179
13181
|
return J(w).steps;
|
|
13180
13182
|
},
|
|
13181
|
-
onStepClick:
|
|
13183
|
+
onStepClick: De
|
|
13182
13184
|
});
|
|
13183
13185
|
var s = W(o, 2), d = (e) => {
|
|
13184
13186
|
var t = hc(), n = U(t, !0);
|
|
13185
|
-
F(t), G(() => Z(n, J(
|
|
13187
|
+
F(t), G(() => Z(n, J(le))), X(e, t);
|
|
13186
13188
|
};
|
|
13187
13189
|
Q(s, (e) => {
|
|
13188
|
-
J(
|
|
13190
|
+
J(le) && J(D) !== 3 && e(d);
|
|
13189
13191
|
});
|
|
13190
13192
|
var f = W(s, 2), p = (e) => {
|
|
13191
13193
|
xo(e, {
|
|
@@ -13193,51 +13195,51 @@ function yc(e, t) {
|
|
|
13193
13195
|
return J(w);
|
|
13194
13196
|
},
|
|
13195
13197
|
get contactName() {
|
|
13196
|
-
return J(
|
|
13198
|
+
return J(ne);
|
|
13197
13199
|
},
|
|
13198
13200
|
set contactName(e) {
|
|
13199
|
-
H(
|
|
13201
|
+
H(ne, e, !0);
|
|
13200
13202
|
},
|
|
13201
13203
|
get contactEmail() {
|
|
13202
|
-
return J(
|
|
13204
|
+
return J(re);
|
|
13203
13205
|
},
|
|
13204
13206
|
set contactEmail(e) {
|
|
13205
|
-
H(
|
|
13207
|
+
H(re, e, !0);
|
|
13206
13208
|
},
|
|
13207
13209
|
get contactPhone() {
|
|
13208
|
-
return J(
|
|
13210
|
+
return J(ie);
|
|
13209
13211
|
},
|
|
13210
13212
|
set contactPhone(e) {
|
|
13211
|
-
H(
|
|
13213
|
+
H(ie, e, !0);
|
|
13212
13214
|
},
|
|
13213
13215
|
get boatName() {
|
|
13214
|
-
return J(
|
|
13216
|
+
return J(M);
|
|
13215
13217
|
},
|
|
13216
13218
|
set boatName(e) {
|
|
13217
|
-
H(
|
|
13219
|
+
H(M, e, !0);
|
|
13218
13220
|
},
|
|
13219
13221
|
get boatBeamM() {
|
|
13220
|
-
return J(
|
|
13222
|
+
return J(ae);
|
|
13221
13223
|
},
|
|
13222
13224
|
set boatBeamM(e) {
|
|
13223
|
-
H(
|
|
13225
|
+
H(ae, e, !0);
|
|
13224
13226
|
},
|
|
13225
13227
|
get notes() {
|
|
13226
|
-
return J(
|
|
13228
|
+
return J(oe);
|
|
13227
13229
|
},
|
|
13228
13230
|
set notes(e) {
|
|
13229
|
-
H(
|
|
13231
|
+
H(oe, e, !0);
|
|
13230
13232
|
}
|
|
13231
13233
|
});
|
|
13232
13234
|
}, m = (e) => {
|
|
13233
13235
|
{
|
|
13234
|
-
let t = /* @__PURE__ */ L(() => io(J(
|
|
13236
|
+
let t = /* @__PURE__ */ L(() => io(J(de).booking.totalPrice, J(de).booking.currency, l(), J(C)));
|
|
13235
13237
|
Oi(es(e, {
|
|
13236
13238
|
get payment() {
|
|
13237
|
-
return J(
|
|
13239
|
+
return J(de).payment;
|
|
13238
13240
|
},
|
|
13239
13241
|
get host() {
|
|
13240
|
-
return
|
|
13242
|
+
return S;
|
|
13241
13243
|
},
|
|
13242
13244
|
get lang() {
|
|
13243
13245
|
return J(C);
|
|
@@ -13248,7 +13250,7 @@ function yc(e, t) {
|
|
|
13248
13250
|
get totalLabel() {
|
|
13249
13251
|
return J(t);
|
|
13250
13252
|
}
|
|
13251
|
-
}), (e) => H(
|
|
13253
|
+
}), (e) => H(fe, e), () => J(fe));
|
|
13252
13254
|
}
|
|
13253
13255
|
}, h = (e) => {
|
|
13254
13256
|
{
|
|
@@ -13273,24 +13275,24 @@ function yc(e, t) {
|
|
|
13273
13275
|
return u();
|
|
13274
13276
|
},
|
|
13275
13277
|
get host() {
|
|
13276
|
-
return
|
|
13278
|
+
return S;
|
|
13277
13279
|
},
|
|
13278
|
-
onstatus:
|
|
13279
|
-
onstartover:
|
|
13280
|
+
onstatus: Le,
|
|
13281
|
+
onstartover: Ie
|
|
13280
13282
|
});
|
|
13281
13283
|
}
|
|
13282
13284
|
};
|
|
13283
13285
|
Q(f, (e) => {
|
|
13284
|
-
J(D) === 1 ? e(p) : J(D) === 2 && J(
|
|
13286
|
+
J(D) === 1 ? e(p) : J(D) === 2 && J(de)?.payment ? e(m, 1) : J(D) === 3 && J(E) && e(h, 2);
|
|
13285
13287
|
}), os(W(f, 2), {
|
|
13286
13288
|
get step() {
|
|
13287
13289
|
return J(D);
|
|
13288
13290
|
},
|
|
13289
13291
|
get sending() {
|
|
13290
|
-
return J(
|
|
13292
|
+
return J(pe);
|
|
13291
13293
|
},
|
|
13292
13294
|
get error() {
|
|
13293
|
-
return J(
|
|
13295
|
+
return J(me);
|
|
13294
13296
|
},
|
|
13295
13297
|
get labels() {
|
|
13296
13298
|
return J(w);
|
|
@@ -13298,13 +13300,15 @@ function yc(e, t) {
|
|
|
13298
13300
|
get variant() {
|
|
13299
13301
|
return u();
|
|
13300
13302
|
},
|
|
13301
|
-
onBack:
|
|
13302
|
-
onNext:
|
|
13303
|
+
onBack: Fe,
|
|
13304
|
+
onNext: Oe
|
|
13303
13305
|
}), X(e, t);
|
|
13304
13306
|
};
|
|
13305
|
-
return Q(
|
|
13306
|
-
T ? e(
|
|
13307
|
-
}), F(
|
|
13307
|
+
return Q(He, (e) => {
|
|
13308
|
+
T ? e(Ue) : e(We, -1);
|
|
13309
|
+
}), F(Be), G(() => {
|
|
13310
|
+
Ve = ui(Be, 1, "sbw-root svelte-h0br6q", null, Ve, { "sbw-root--overlay": _() === "overlay" }), fi(Be, `--sbw-map-h: ${(J(_e) ? p() : "0px") ?? ""}; --sbw-map-gap: ${(J(_e) ? h() : "0px") ?? ""};`);
|
|
13311
|
+
}), X(e, Re), Xe(N);
|
|
13308
13312
|
}
|
|
13309
13313
|
customElements.define("sidon-booking-widget", Pi(yc, {
|
|
13310
13314
|
marina: {
|
|
@@ -13367,6 +13371,10 @@ customElements.define("sidon-booking-widget", Pi(yc, {
|
|
|
13367
13371
|
attribute: "width",
|
|
13368
13372
|
type: "String"
|
|
13369
13373
|
},
|
|
13374
|
+
layout: {
|
|
13375
|
+
attribute: "layout",
|
|
13376
|
+
type: "String"
|
|
13377
|
+
},
|
|
13370
13378
|
logoMark: {
|
|
13371
13379
|
attribute: "logo-mark",
|
|
13372
13380
|
type: "String"
|