@ipscape/chat-client-js
Version:
ipSCAPE chat client SDK
1,297 lines • 475 kB
JavaScript
var Vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function It(e) {
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
var t = e.default;
if (typeof t == "function") {
var n = function r() {
var i = !1;
try {
i = this instanceof r;
} catch {
}
return i ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
n.prototype = t.prototype;
} else n = {};
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
var i = Object.getOwnPropertyDescriptor(e, r);
Object.defineProperty(n, r, i.get ? i : {
enumerable: !0,
get: function() {
return e[r];
}
});
}), n;
}
var gt = { exports: {} }, Wn;
function qo() {
if (Wn) return gt.exports;
Wn = 1;
var e = typeof Reflect == "object" ? Reflect : null, t = e && typeof e.apply == "function" ? e.apply : function(V, Q, ie) {
return Function.prototype.apply.call(V, Q, ie);
}, n;
e && typeof e.ownKeys == "function" ? n = e.ownKeys : Object.getOwnPropertySymbols ? n = function(V) {
return Object.getOwnPropertyNames(V).concat(Object.getOwnPropertySymbols(V));
} : n = function(V) {
return Object.getOwnPropertyNames(V);
};
function r(F) {
console && console.warn && console.warn(F);
}
var i = Number.isNaN || function(V) {
return V !== V;
};
function o() {
o.init.call(this);
}
gt.exports = o, gt.exports.once = fe, o.EventEmitter = o, o.prototype._events = void 0, o.prototype._eventsCount = 0, o.prototype._maxListeners = void 0;
var s = 10;
function l(F) {
if (typeof F != "function")
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof F);
}
Object.defineProperty(o, "defaultMaxListeners", {
enumerable: !0,
get: function() {
return s;
},
set: function(F) {
if (typeof F != "number" || F < 0 || i(F))
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + F + ".");
s = F;
}
}), o.init = function() {
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
}, o.prototype.setMaxListeners = function(V) {
if (typeof V != "number" || V < 0 || i(V))
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + V + ".");
return this._maxListeners = V, this;
};
function f(F) {
return F._maxListeners === void 0 ? o.defaultMaxListeners : F._maxListeners;
}
o.prototype.getMaxListeners = function() {
return f(this);
}, o.prototype.emit = function(V) {
for (var Q = [], ie = 1; ie < arguments.length; ie++) Q.push(arguments[ie]);
var ce = V === "error", he = this._events;
if (he !== void 0)
ce = ce && he.error === void 0;
else if (!ce)
return !1;
if (ce) {
var le;
if (Q.length > 0 && (le = Q[0]), le instanceof Error)
throw le;
var De = new Error("Unhandled error." + (le ? " (" + le.message + ")" : ""));
throw De.context = le, De;
}
var Ge = he[V];
if (Ge === void 0)
return !1;
if (typeof Ge == "function")
t(Ge, this, Q);
else
for (var Te = Ge.length, re = W(Ge, Te), ie = 0; ie < Te; ++ie)
t(re[ie], this, Q);
return !0;
};
function y(F, V, Q, ie) {
var ce, he, le;
if (l(Q), he = F._events, he === void 0 ? (he = F._events = /* @__PURE__ */ Object.create(null), F._eventsCount = 0) : (he.newListener !== void 0 && (F.emit(
"newListener",
V,
Q.listener ? Q.listener : Q
), he = F._events), le = he[V]), le === void 0)
le = he[V] = Q, ++F._eventsCount;
else if (typeof le == "function" ? le = he[V] = ie ? [Q, le] : [le, Q] : ie ? le.unshift(Q) : le.push(Q), ce = f(F), ce > 0 && le.length > ce && !le.warned) {
le.warned = !0;
var De = new Error("Possible EventEmitter memory leak detected. " + le.length + " " + String(V) + " listeners added. Use emitter.setMaxListeners() to increase limit");
De.name = "MaxListenersExceededWarning", De.emitter = F, De.type = V, De.count = le.length, r(De);
}
return F;
}
o.prototype.addListener = function(V, Q) {
return y(this, V, Q, !1);
}, o.prototype.on = o.prototype.addListener, o.prototype.prependListener = function(V, Q) {
return y(this, V, Q, !0);
};
function b() {
if (!this.fired)
return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function $(F, V, Q) {
var ie = { fired: !1, wrapFn: void 0, target: F, type: V, listener: Q }, ce = b.bind(ie);
return ce.listener = Q, ie.wrapFn = ce, ce;
}
o.prototype.once = function(V, Q) {
return l(Q), this.on(V, $(this, V, Q)), this;
}, o.prototype.prependOnceListener = function(V, Q) {
return l(Q), this.prependListener(V, $(this, V, Q)), this;
}, o.prototype.removeListener = function(V, Q) {
var ie, ce, he, le, De;
if (l(Q), ce = this._events, ce === void 0)
return this;
if (ie = ce[V], ie === void 0)
return this;
if (ie === Q || ie.listener === Q)
--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete ce[V], ce.removeListener && this.emit("removeListener", V, ie.listener || Q));
else if (typeof ie != "function") {
for (he = -1, le = ie.length - 1; le >= 0; le--)
if (ie[le] === Q || ie[le].listener === Q) {
De = ie[le].listener, he = le;
break;
}
if (he < 0)
return this;
he === 0 ? ie.shift() : Z(ie, he), ie.length === 1 && (ce[V] = ie[0]), ce.removeListener !== void 0 && this.emit("removeListener", V, De || Q);
}
return this;
}, o.prototype.off = o.prototype.removeListener, o.prototype.removeAllListeners = function(V) {
var Q, ie, ce;
if (ie = this._events, ie === void 0)
return this;
if (ie.removeListener === void 0)
return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : ie[V] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete ie[V]), this;
if (arguments.length === 0) {
var he = Object.keys(ie), le;
for (ce = 0; ce < he.length; ++ce)
le = he[ce], le !== "removeListener" && this.removeAllListeners(le);
return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
}
if (Q = ie[V], typeof Q == "function")
this.removeListener(V, Q);
else if (Q !== void 0)
for (ce = Q.length - 1; ce >= 0; ce--)
this.removeListener(V, Q[ce]);
return this;
};
function L(F, V, Q) {
var ie = F._events;
if (ie === void 0)
return [];
var ce = ie[V];
return ce === void 0 ? [] : typeof ce == "function" ? Q ? [ce.listener || ce] : [ce] : Q ? oe(ce) : W(ce, ce.length);
}
o.prototype.listeners = function(V) {
return L(this, V, !0);
}, o.prototype.rawListeners = function(V) {
return L(this, V, !1);
}, o.listenerCount = function(F, V) {
return typeof F.listenerCount == "function" ? F.listenerCount(V) : H.call(F, V);
}, o.prototype.listenerCount = H;
function H(F) {
var V = this._events;
if (V !== void 0) {
var Q = V[F];
if (typeof Q == "function")
return 1;
if (Q !== void 0)
return Q.length;
}
return 0;
}
o.prototype.eventNames = function() {
return this._eventsCount > 0 ? n(this._events) : [];
};
function W(F, V) {
for (var Q = new Array(V), ie = 0; ie < V; ++ie)
Q[ie] = F[ie];
return Q;
}
function Z(F, V) {
for (; V + 1 < F.length; V++)
F[V] = F[V + 1];
F.pop();
}
function oe(F) {
for (var V = new Array(F.length), Q = 0; Q < V.length; ++Q)
V[Q] = F[Q].listener || F[Q];
return V;
}
function fe(F, V) {
return new Promise(function(Q, ie) {
function ce(le) {
F.removeListener(V, he), ie(le);
}
function he() {
typeof F.removeListener == "function" && F.removeListener("error", ce), Q([].slice.call(arguments));
}
ye(F, V, he, { once: !0 }), V !== "error" && ae(F, ce, { once: !0 });
});
}
function ae(F, V, Q) {
typeof F.on == "function" && ye(F, "error", V, Q);
}
function ye(F, V, Q, ie) {
if (typeof F.on == "function")
ie.once ? F.once(V, Q) : F.on(V, Q);
else if (typeof F.addEventListener == "function")
F.addEventListener(V, function ce(he) {
ie.once && F.removeEventListener(V, ce), Q(he);
});
else
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof F);
}
return gt.exports;
}
var Cr = qo();
function qe(e, t) {
var n = {};
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
if (e != null && typeof Object.getOwnPropertySymbols == "function")
for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++)
t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
return n;
}
function Jn(e) {
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
if (n) return n.call(e);
if (e && typeof e.length == "number") return {
next: function() {
return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
}
};
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function me(e) {
return this instanceof me ? (this.v = e, this) : new me(e);
}
function ze(e, t, n) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var r = n.apply(e, t || []), i, o = [];
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), l("next"), l("throw"), l("return", s), i[Symbol.asyncIterator] = function() {
return this;
}, i;
function s(H) {
return function(W) {
return Promise.resolve(W).then(H, $);
};
}
function l(H, W) {
r[H] && (i[H] = function(Z) {
return new Promise(function(oe, fe) {
o.push([H, Z, oe, fe]) > 1 || f(H, Z);
});
}, W && (i[H] = W(i[H])));
}
function f(H, W) {
try {
y(r[H](W));
} catch (Z) {
L(o[0][3], Z);
}
}
function y(H) {
H.value instanceof me ? Promise.resolve(H.value.v).then(b, $) : L(o[0][2], H);
}
function b(H) {
f("next", H);
}
function $(H) {
f("throw", H);
}
function L(H, W) {
H(W), o.shift(), o.length && f(o[0][0], o[0][1]);
}
}
function Ct(e) {
var t, n;
return t = {}, r("next"), r("throw", function(i) {
throw i;
}), r("return"), t[Symbol.iterator] = function() {
return this;
}, t;
function r(i, o) {
t[i] = e[i] ? function(s) {
return (n = !n) ? { value: me(e[i](s)), done: !1 } : o ? o(s) : s;
} : o;
}
}
function Fe(e) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var t = e[Symbol.asyncIterator], n;
return t ? t.call(e) : (e = typeof Jn == "function" ? Jn(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
return this;
}, n);
function r(o) {
n[o] = e[o] && function(s) {
return new Promise(function(l, f) {
s = e[o](s), i(l, f, s.done, s.value);
});
};
}
function i(o, s, l, f) {
Promise.resolve(f).then(function(y) {
o({ value: y, done: l });
}, s);
}
}
var Ht = { exports: {} }, mt, Bo = new Uint8Array(16);
function Rr() {
if (!mt && (mt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !mt))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return mt(Bo);
}
const Ho = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
function Ot(e) {
return typeof e == "string" && Ho.test(e);
}
var ke = [];
for (var zt = 0; zt < 256; ++zt)
ke.push((zt + 256).toString(16).substr(1));
function Mt(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = (ke[e[t + 0]] + ke[e[t + 1]] + ke[e[t + 2]] + ke[e[t + 3]] + "-" + ke[e[t + 4]] + ke[e[t + 5]] + "-" + ke[e[t + 6]] + ke[e[t + 7]] + "-" + ke[e[t + 8]] + ke[e[t + 9]] + "-" + ke[e[t + 10]] + ke[e[t + 11]] + ke[e[t + 12]] + ke[e[t + 13]] + ke[e[t + 14]] + ke[e[t + 15]]).toLowerCase();
if (!Ot(n))
throw TypeError("Stringified UUID is invalid");
return n;
}
var Gn, Ft, Vt = 0, Wt = 0;
function zo(e, t, n) {
var r = t && n || 0, i = t || new Array(16);
e = e || {};
var o = e.node || Gn, s = e.clockseq !== void 0 ? e.clockseq : Ft;
if (o == null || s == null) {
var l = e.random || (e.rng || Rr)();
o == null && (o = Gn = [l[0] | 1, l[1], l[2], l[3], l[4], l[5]]), s == null && (s = Ft = (l[6] << 8 | l[7]) & 16383);
}
var f = e.msecs !== void 0 ? e.msecs : Date.now(), y = e.nsecs !== void 0 ? e.nsecs : Wt + 1, b = f - Vt + (y - Wt) / 1e4;
if (b < 0 && e.clockseq === void 0 && (s = s + 1 & 16383), (b < 0 || f > Vt) && e.nsecs === void 0 && (y = 0), y >= 1e4)
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
Vt = f, Wt = y, Ft = s, f += 122192928e5;
var $ = ((f & 268435455) * 1e4 + y) % 4294967296;
i[r++] = $ >>> 24 & 255, i[r++] = $ >>> 16 & 255, i[r++] = $ >>> 8 & 255, i[r++] = $ & 255;
var L = f / 4294967296 * 1e4 & 268435455;
i[r++] = L >>> 8 & 255, i[r++] = L & 255, i[r++] = L >>> 24 & 15 | 16, i[r++] = L >>> 16 & 255, i[r++] = s >>> 8 | 128, i[r++] = s & 255;
for (var H = 0; H < 6; ++H)
i[r + H] = o[H];
return t || Mt(i);
}
function kr(e) {
if (!Ot(e))
throw TypeError("Invalid UUID");
var t, n = new Uint8Array(16);
return n[0] = (t = parseInt(e.slice(0, 8), 16)) >>> 24, n[1] = t >>> 16 & 255, n[2] = t >>> 8 & 255, n[3] = t & 255, n[4] = (t = parseInt(e.slice(9, 13), 16)) >>> 8, n[5] = t & 255, n[6] = (t = parseInt(e.slice(14, 18), 16)) >>> 8, n[7] = t & 255, n[8] = (t = parseInt(e.slice(19, 23), 16)) >>> 8, n[9] = t & 255, n[10] = (t = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = t / 4294967296 & 255, n[12] = t >>> 24 & 255, n[13] = t >>> 16 & 255, n[14] = t >>> 8 & 255, n[15] = t & 255, n;
}
function Fo(e) {
e = unescape(encodeURIComponent(e));
for (var t = [], n = 0; n < e.length; ++n)
t.push(e.charCodeAt(n));
return t;
}
var Vo = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", Wo = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
function Er(e, t, n) {
function r(i, o, s, l) {
if (typeof i == "string" && (i = Fo(i)), typeof o == "string" && (o = kr(o)), o.length !== 16)
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
var f = new Uint8Array(16 + i.length);
if (f.set(o), f.set(i, o.length), f = n(f), f[6] = f[6] & 15 | t, f[8] = f[8] & 63 | 128, s) {
l = l || 0;
for (var y = 0; y < 16; ++y)
s[l + y] = f[y];
return s;
}
return Mt(f);
}
try {
r.name = e;
} catch {
}
return r.DNS = Vo, r.URL = Wo, r;
}
function Jo(e) {
if (typeof e == "string") {
var t = unescape(encodeURIComponent(e));
e = new Uint8Array(t.length);
for (var n = 0; n < t.length; ++n)
e[n] = t.charCodeAt(n);
}
return Go(Ko(Xo(e), e.length * 8));
}
function Go(e) {
for (var t = [], n = e.length * 32, r = "0123456789abcdef", i = 0; i < n; i += 8) {
var o = e[i >> 5] >>> i % 32 & 255, s = parseInt(r.charAt(o >>> 4 & 15) + r.charAt(o & 15), 16);
t.push(s);
}
return t;
}
function Pr(e) {
return (e + 64 >>> 9 << 4) + 14 + 1;
}
function Ko(e, t) {
e[t >> 5] |= 128 << t % 32, e[Pr(t) - 1] = t;
for (var n = 1732584193, r = -271733879, i = -1732584194, o = 271733878, s = 0; s < e.length; s += 16) {
var l = n, f = r, y = i, b = o;
n = Ae(n, r, i, o, e[s], 7, -680876936), o = Ae(o, n, r, i, e[s + 1], 12, -389564586), i = Ae(i, o, n, r, e[s + 2], 17, 606105819), r = Ae(r, i, o, n, e[s + 3], 22, -1044525330), n = Ae(n, r, i, o, e[s + 4], 7, -176418897), o = Ae(o, n, r, i, e[s + 5], 12, 1200080426), i = Ae(i, o, n, r, e[s + 6], 17, -1473231341), r = Ae(r, i, o, n, e[s + 7], 22, -45705983), n = Ae(n, r, i, o, e[s + 8], 7, 1770035416), o = Ae(o, n, r, i, e[s + 9], 12, -1958414417), i = Ae(i, o, n, r, e[s + 10], 17, -42063), r = Ae(r, i, o, n, e[s + 11], 22, -1990404162), n = Ae(n, r, i, o, e[s + 12], 7, 1804603682), o = Ae(o, n, r, i, e[s + 13], 12, -40341101), i = Ae(i, o, n, r, e[s + 14], 17, -1502002290), r = Ae(r, i, o, n, e[s + 15], 22, 1236535329), n = Ie(n, r, i, o, e[s + 1], 5, -165796510), o = Ie(o, n, r, i, e[s + 6], 9, -1069501632), i = Ie(i, o, n, r, e[s + 11], 14, 643717713), r = Ie(r, i, o, n, e[s], 20, -373897302), n = Ie(n, r, i, o, e[s + 5], 5, -701558691), o = Ie(o, n, r, i, e[s + 10], 9, 38016083), i = Ie(i, o, n, r, e[s + 15], 14, -660478335), r = Ie(r, i, o, n, e[s + 4], 20, -405537848), n = Ie(n, r, i, o, e[s + 9], 5, 568446438), o = Ie(o, n, r, i, e[s + 14], 9, -1019803690), i = Ie(i, o, n, r, e[s + 3], 14, -187363961), r = Ie(r, i, o, n, e[s + 8], 20, 1163531501), n = Ie(n, r, i, o, e[s + 13], 5, -1444681467), o = Ie(o, n, r, i, e[s + 2], 9, -51403784), i = Ie(i, o, n, r, e[s + 7], 14, 1735328473), r = Ie(r, i, o, n, e[s + 12], 20, -1926607734), n = Oe(n, r, i, o, e[s + 5], 4, -378558), o = Oe(o, n, r, i, e[s + 8], 11, -2022574463), i = Oe(i, o, n, r, e[s + 11], 16, 1839030562), r = Oe(r, i, o, n, e[s + 14], 23, -35309556), n = Oe(n, r, i, o, e[s + 1], 4, -1530992060), o = Oe(o, n, r, i, e[s + 4], 11, 1272893353), i = Oe(i, o, n, r, e[s + 7], 16, -155497632), r = Oe(r, i, o, n, e[s + 10], 23, -1094730640), n = Oe(n, r, i, o, e[s + 13], 4, 681279174), o = Oe(o, n, r, i, e[s], 11, -358537222), i = Oe(i, o, n, r, e[s + 3], 16, -722521979), r = Oe(r, i, o, n, e[s + 6], 23, 76029189), n = Oe(n, r, i, o, e[s + 9], 4, -640364487), o = Oe(o, n, r, i, e[s + 12], 11, -421815835), i = Oe(i, o, n, r, e[s + 15], 16, 530742520), r = Oe(r, i, o, n, e[s + 2], 23, -995338651), n = Me(n, r, i, o, e[s], 6, -198630844), o = Me(o, n, r, i, e[s + 7], 10, 1126891415), i = Me(i, o, n, r, e[s + 14], 15, -1416354905), r = Me(r, i, o, n, e[s + 5], 21, -57434055), n = Me(n, r, i, o, e[s + 12], 6, 1700485571), o = Me(o, n, r, i, e[s + 3], 10, -1894986606), i = Me(i, o, n, r, e[s + 10], 15, -1051523), r = Me(r, i, o, n, e[s + 1], 21, -2054922799), n = Me(n, r, i, o, e[s + 8], 6, 1873313359), o = Me(o, n, r, i, e[s + 15], 10, -30611744), i = Me(i, o, n, r, e[s + 6], 15, -1560198380), r = Me(r, i, o, n, e[s + 13], 21, 1309151649), n = Me(n, r, i, o, e[s + 4], 6, -145523070), o = Me(o, n, r, i, e[s + 11], 10, -1120210379), i = Me(i, o, n, r, e[s + 2], 15, 718787259), r = Me(r, i, o, n, e[s + 9], 21, -343485551), n = Ve(n, l), r = Ve(r, f), i = Ve(i, y), o = Ve(o, b);
}
return [n, r, i, o];
}
function Xo(e) {
if (e.length === 0)
return [];
for (var t = e.length * 8, n = new Uint32Array(Pr(t)), r = 0; r < t; r += 8)
n[r >> 5] |= (e[r / 8] & 255) << r % 32;
return n;
}
function Ve(e, t) {
var n = (e & 65535) + (t & 65535), r = (e >> 16) + (t >> 16) + (n >> 16);
return r << 16 | n & 65535;
}
function Qo(e, t) {
return e << t | e >>> 32 - t;
}
function Nt(e, t, n, r, i, o) {
return Ve(Qo(Ve(Ve(t, e), Ve(r, o)), i), n);
}
function Ae(e, t, n, r, i, o, s) {
return Nt(t & n | ~t & r, e, t, i, o, s);
}
function Ie(e, t, n, r, i, o, s) {
return Nt(t & r | n & ~r, e, t, i, o, s);
}
function Oe(e, t, n, r, i, o, s) {
return Nt(t ^ n ^ r, e, t, i, o, s);
}
function Me(e, t, n, r, i, o, s) {
return Nt(n ^ (t | ~r), e, t, i, o, s);
}
var Yo = Er("v3", 48, Jo);
function Zo(e, t, n) {
e = e || {};
var r = e.random || (e.rng || Rr)();
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
n = n || 0;
for (var i = 0; i < 16; ++i)
t[n + i] = r[i];
return t;
}
return Mt(r);
}
function es(e, t, n, r) {
switch (e) {
case 0:
return t & n ^ ~t & r;
case 1:
return t ^ n ^ r;
case 2:
return t & n ^ t & r ^ n & r;
case 3:
return t ^ n ^ r;
}
}
function Jt(e, t) {
return e << t | e >>> 32 - t;
}
function ts(e) {
var t = [1518500249, 1859775393, 2400959708, 3395469782], n = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
if (typeof e == "string") {
var r = unescape(encodeURIComponent(e));
e = [];
for (var i = 0; i < r.length; ++i)
e.push(r.charCodeAt(i));
} else Array.isArray(e) || (e = Array.prototype.slice.call(e));
e.push(128);
for (var o = e.length / 4 + 2, s = Math.ceil(o / 16), l = new Array(s), f = 0; f < s; ++f) {
for (var y = new Uint32Array(16), b = 0; b < 16; ++b)
y[b] = e[f * 64 + b * 4] << 24 | e[f * 64 + b * 4 + 1] << 16 | e[f * 64 + b * 4 + 2] << 8 | e[f * 64 + b * 4 + 3];
l[f] = y;
}
l[s - 1][14] = (e.length - 1) * 8 / Math.pow(2, 32), l[s - 1][14] = Math.floor(l[s - 1][14]), l[s - 1][15] = (e.length - 1) * 8 & 4294967295;
for (var $ = 0; $ < s; ++$) {
for (var L = new Uint32Array(80), H = 0; H < 16; ++H)
L[H] = l[$][H];
for (var W = 16; W < 80; ++W)
L[W] = Jt(L[W - 3] ^ L[W - 8] ^ L[W - 14] ^ L[W - 16], 1);
for (var Z = n[0], oe = n[1], fe = n[2], ae = n[3], ye = n[4], F = 0; F < 80; ++F) {
var V = Math.floor(F / 20), Q = Jt(Z, 5) + es(V, oe, fe, ae) + ye + t[V] + L[F] >>> 0;
ye = ae, ae = fe, fe = Jt(oe, 30) >>> 0, oe = Z, Z = Q;
}
n[0] = n[0] + Z >>> 0, n[1] = n[1] + oe >>> 0, n[2] = n[2] + fe >>> 0, n[3] = n[3] + ae >>> 0, n[4] = n[4] + ye >>> 0;
}
return [n[0] >> 24 & 255, n[0] >> 16 & 255, n[0] >> 8 & 255, n[0] & 255, n[1] >> 24 & 255, n[1] >> 16 & 255, n[1] >> 8 & 255, n[1] & 255, n[2] >> 24 & 255, n[2] >> 16 & 255, n[2] >> 8 & 255, n[2] & 255, n[3] >> 24 & 255, n[3] >> 16 & 255, n[3] >> 8 & 255, n[3] & 255, n[4] >> 24 & 255, n[4] >> 16 & 255, n[4] >> 8 & 255, n[4] & 255];
}
var ns = Er("v5", 80, ts);
const rs = "00000000-0000-0000-0000-000000000000";
function is(e) {
if (!Ot(e))
throw TypeError("Invalid UUID");
return parseInt(e.substr(14, 1), 16);
}
const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
NIL: rs,
parse: kr,
stringify: Mt,
v1: zo,
v3: Yo,
v4: Zo,
v5: ns,
validate: Ot,
version: is
}, Symbol.toStringTag, { value: "Module" })), ss = /* @__PURE__ */ It(os);
function Ar(e, t) {
return e = Math.ceil(e), t = Math.floor(t), Math.floor(Math.random() * (t - e + 1)) + e;
}
function Ir(e, t) {
const n = t.retryDelayInMs * Math.pow(2, e), r = Math.min(t.maxRetryDelayInMs, n);
return { retryAfterInMs: r / 2 + Ar(0, r / 2) };
}
function bn(e) {
return typeof e == "object" && e !== null && !Array.isArray(e) && !(e instanceof RegExp) && !(e instanceof Date);
}
function wn(e) {
if (bn(e)) {
const t = typeof e.name == "string", n = typeof e.message == "string";
return t && n;
}
return !1;
}
function _t(e, t) {
switch (t) {
case "utf-8":
return cs(e);
case "base64":
return Or(e);
case "base64url":
return as(e);
case "hex":
return us(e);
}
}
function Le(e, t) {
switch (t) {
case "utf-8":
return ls(e);
case "base64":
return Mr(e);
case "base64url":
return ds(e);
case "hex":
return hs(e);
}
}
function Or(e) {
return btoa([...e].map((t) => String.fromCharCode(t)).join(""));
}
function as(e) {
return Or(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
}
function cs(e) {
return new TextDecoder().decode(e);
}
function us(e) {
return [...e].map((t) => t.toString(16).padStart(2, "0")).join("");
}
function ls(e) {
return new TextEncoder().encode(e);
}
function Mr(e) {
return new Uint8Array([...atob(e)].map((t) => t.charCodeAt(0)));
}
function ds(e) {
const t = e.replace(/-/g, "+").replace(/_/g, "/");
return Mr(t);
}
const Kn = new Set("0123456789abcdefABCDEF");
function hs(e) {
const t = new Uint8Array(e.length / 2);
for (let n = 0; n < e.length / 2; ++n) {
const r = e[2 * n], i = e[2 * n + 1];
if (!Kn.has(r) || !Kn.has(i))
return t.slice(0, n);
t[n] = parseInt(`${r}${i}`, 16);
}
return t;
}
let yt;
function Nr() {
if (yt)
return yt;
if (!self.crypto || !self.crypto.subtle)
throw new Error("Your browser environment does not support cryptography functions.");
return yt = self.crypto.subtle, yt;
}
async function ps(e, t, n) {
const r = Nr(), i = Le(e, "base64"), o = Le(t, "utf-8"), s = await r.importKey("raw", i, {
name: "HMAC",
hash: { name: "SHA-256" }
}, !1, ["sign"]), l = await r.sign({
name: "HMAC",
hash: { name: "SHA-256" }
}, s, o);
return _t(new Uint8Array(l), n);
}
async function fs(e, t) {
const n = Le(e, "utf-8"), r = await Nr().digest({ name: "SHA-256" }, n);
return _t(new Uint8Array(r), t);
}
function gs() {
let e = "";
for (let t = 0; t < 32; t++) {
const n = Math.floor(Math.random() * 16);
t === 12 ? e += "4" : t === 16 ? e += n & 3 | 8 : e += n.toString(16), (t === 7 || t === 11 || t === 15 || t === 19) && (e += "-");
}
return e;
}
var Gt;
const ms = typeof ((Gt = globalThis?.crypto) === null || Gt === void 0 ? void 0 : Gt.randomUUID) == "function" ? globalThis.crypto.randomUUID.bind(globalThis.crypto) : gs;
function Sn() {
return ms();
}
var Kt, Xt, Qt, Yt;
const ys = typeof window < "u" && typeof window.document < "u", vs = typeof self == "object" && typeof self?.importScripts == "function" && (((Kt = self.constructor) === null || Kt === void 0 ? void 0 : Kt.name) === "DedicatedWorkerGlobalScope" || ((Xt = self.constructor) === null || Xt === void 0 ? void 0 : Xt.name) === "ServiceWorkerGlobalScope" || ((Qt = self.constructor) === null || Qt === void 0 ? void 0 : Qt.name) === "SharedWorkerGlobalScope"), _r = typeof Deno < "u" && typeof Deno.version < "u" && typeof Deno.version.deno < "u", Ur = typeof Bun < "u" && typeof Bun.version < "u", Je = typeof globalThis.process < "u" && !!globalThis.process.version && !!(!((Yt = globalThis.process.versions) === null || Yt === void 0) && Yt.node), Ts = Je && !Ur && !_r, bs = typeof navigator < "u" && navigator?.product === "ReactNative", Zt = "REDACTED", ws = [
"x-ms-client-request-id",
"x-ms-return-client-request-id",
"x-ms-useragent",
"x-ms-correlation-request-id",
"x-ms-request-id",
"client-request-id",
"ms-cv",
"return-client-request-id",
"traceparent",
"Access-Control-Allow-Credentials",
"Access-Control-Allow-Headers",
"Access-Control-Allow-Methods",
"Access-Control-Allow-Origin",
"Access-Control-Expose-Headers",
"Access-Control-Max-Age",
"Access-Control-Request-Headers",
"Access-Control-Request-Method",
"Origin",
"Accept",
"Accept-Encoding",
"Cache-Control",
"Connection",
"Content-Length",
"Content-Type",
"Date",
"ETag",
"Expires",
"If-Match",
"If-Modified-Since",
"If-None-Match",
"If-Unmodified-Since",
"Last-Modified",
"Pragma",
"Request-Id",
"Retry-After",
"Server",
"Transfer-Encoding",
"User-Agent",
"WWW-Authenticate"
], Ss = ["api-version"];
class Cn {
constructor({ additionalAllowedHeaderNames: t = [], additionalAllowedQueryParameters: n = [] } = {}) {
t = ws.concat(t), n = Ss.concat(n), this.allowedHeaderNames = new Set(t.map((r) => r.toLowerCase())), this.allowedQueryParameters = new Set(n.map((r) => r.toLowerCase()));
}
/**
* Sanitizes an object for logging.
* @param obj - The object to sanitize
* @returns - The sanitized object as a string
*/
sanitize(t) {
const n = /* @__PURE__ */ new Set();
return JSON.stringify(t, (r, i) => {
if (i instanceof Error)
return Object.assign(Object.assign({}, i), { name: i.name, message: i.message });
if (r === "headers")
return this.sanitizeHeaders(i);
if (r === "url")
return this.sanitizeUrl(i);
if (r === "query")
return this.sanitizeQuery(i);
if (r === "body")
return;
if (r === "response")
return;
if (r === "operationSpec")
return;
if (Array.isArray(i) || bn(i)) {
if (n.has(i))
return "[Circular]";
n.add(i);
}
return i;
}, 2);
}
/**
* Sanitizes a URL for logging.
* @param value - The URL to sanitize
* @returns - The sanitized URL as a string
*/
sanitizeUrl(t) {
if (typeof t != "string" || t === null || t === "")
return t;
const n = new URL(t);
if (!n.search)
return t;
for (const [r] of n.searchParams)
this.allowedQueryParameters.has(r.toLowerCase()) || n.searchParams.set(r, Zt);
return n.toString();
}
sanitizeHeaders(t) {
const n = {};
for (const r of Object.keys(t))
this.allowedHeaderNames.has(r.toLowerCase()) ? n[r] = t[r] : n[r] = Zt;
return n;
}
sanitizeQuery(t) {
if (typeof t != "object" || t === null)
return t;
const n = {};
for (const r of Object.keys(t))
this.allowedQueryParameters.has(r.toLowerCase()) ? n[r] = t[r] : n[r] = Zt;
return n;
}
}
async function Cs(e, t) {
var n, r;
const i = new AbortController();
function o() {
i.abort();
}
(n = t?.abortSignal) === null || n === void 0 || n.addEventListener("abort", o);
try {
return await Promise.race(e.map((s) => s({ abortSignal: i.signal })));
} finally {
i.abort(), (r = t?.abortSignal) === null || r === void 0 || r.removeEventListener("abort", o);
}
}
let Rs = class extends Error {
constructor(t) {
super(t), this.name = "AbortError";
}
};
function xr(e, t) {
const { cleanupBeforeAbort: n, abortSignal: r, abortErrorMsg: i } = t ?? {};
return new Promise((o, s) => {
function l() {
s(new Rs(i ?? "The operation was aborted."));
}
function f() {
r?.removeEventListener("abort", y);
}
function y() {
n?.(), f(), l();
}
if (r?.aborted)
return l();
try {
e((b) => {
f(), o(b);
}, (b) => {
f(), s(b);
});
} catch (b) {
s(b);
}
r?.addEventListener("abort", y);
});
}
const ks = "The delay was aborted.";
function Dr(e, t) {
let n;
const { abortSignal: r, abortErrorMsg: i } = t ?? {};
return xr((o) => {
n = setTimeout(o, e);
}, {
cleanupBeforeAbort: () => clearTimeout(n),
abortSignal: r,
abortErrorMsg: i ?? ks
});
}
function ht(e) {
if (wn(e))
return e.message;
{
let t;
try {
typeof e == "object" && e ? t = JSON.stringify(e) : t = String(e);
} catch {
t = "[unable to stringify input]";
}
return `Unknown error ${t}`;
}
}
function Rn(e) {
return typeof e < "u" && e !== null;
}
function Es(e, t) {
if (!Rn(e) || typeof e != "object")
return !1;
for (const n of t)
if (!Lr(e, n))
return !1;
return !0;
}
function Lr(e, t) {
return Rn(e) && typeof e == "object" && t in e;
}
function Ps(e, t) {
return Ir(e, t);
}
function As(e, t) {
return fs(e, t);
}
function Is(e, t, n) {
return ps(e, t, n);
}
function Os(e, t) {
return Ar(e, t);
}
function $r(e) {
return wn(e);
}
function Ms(e) {
return bn(e);
}
function jr() {
return Sn();
}
const Ns = ys, _s = Ur, Us = _r, xs = Je, Rt = Je, Ds = Ts, Ls = bs, $s = vs;
function js(e, t) {
return _t(e, t);
}
function qs(e, t) {
return Le(e, t);
}
const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
calculateRetryDelay: Ps,
cancelablePromiseRace: Cs,
computeSha256Hash: As,
computeSha256Hmac: Is,
createAbortablePromise: xr,
delay: Dr,
getErrorMessage: ht,
getRandomIntegerInclusive: Os,
isBrowser: Ns,
isBun: _s,
isDefined: Rn,
isDeno: Us,
isError: $r,
isNode: xs,
isNodeLike: Rt,
isNodeRuntime: Ds,
isObject: Ms,
isObjectWithProperties: Es,
isReactNative: Ls,
isWebWorker: $s,
objectHasProperty: Lr,
randomUUID: jr,
stringToUint8Array: qs,
uint8ArrayToString: js
}, Symbol.toStringTag, { value: "Module" })), Hs = /* @__PURE__ */ It(Bs);
function qr(e) {
let t = "";
for (let n = 0; n < e.length; n++)
t += String.fromCharCode(e[n]);
return btoa(t);
}
function Br(e) {
const t = atob(e), n = new Uint8Array(t.length);
for (let r = 0; r < t.length; r++)
n[r] = t.charCodeAt(r);
return n;
}
function zs(e) {
return atob(e);
}
const Re = "$", Ze = "_";
function Fs(e, t) {
return t !== "Composite" && t !== "Dictionary" && (typeof e == "string" || typeof e == "number" || typeof e == "boolean" || t?.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i) !== null || e === void 0 || e === null);
}
const Vs = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function Ws(e) {
return Vs.test(e);
}
const Js = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
function Gs(e) {
return Js.test(e);
}
function Ks(e) {
const t = Object.assign(Object.assign({}, e.headers), e.body);
return e.hasNullableType && Object.getOwnPropertyNames(t).length === 0 ? e.shouldWrapBody ? { body: null } : null : e.shouldWrapBody ? Object.assign(Object.assign({}, e.headers), { body: e.body }) : t;
}
function Xn(e, t) {
var n, r;
const i = e.parsedHeaders;
if (e.request.method === "HEAD")
return Object.assign(Object.assign({}, i), { body: e.parsedBody });
const o = t && t.bodyMapper, s = !!o?.nullable, l = o?.type.name;
if (l === "Stream")
return Object.assign(Object.assign({}, i), { blobBody: e.blobBody, readableStreamBody: e.readableStreamBody });
const f = l === "Composite" && o.type.modelProperties || {}, y = Object.keys(f).some((b) => f[b].serializedName === "");
if (l === "Sequence" || y) {
const b = (n = e.parsedBody) !== null && n !== void 0 ? n : [];
for (const $ of Object.keys(f))
f[$].serializedName && (b[$] = (r = e.parsedBody) === null || r === void 0 ? void 0 : r[$]);
if (i)
for (const $ of Object.keys(i))
b[$] = i[$];
return s && !e.parsedBody && !i && Object.getOwnPropertyNames(f).length === 0 ? null : b;
}
return Ks({
body: e.parsedBody,
headers: i,
hasNullableType: s,
shouldWrapBody: Fs(e.parsedBody, l)
});
}
class Xs {
constructor(t = {}, n = !1) {
this.modelMappers = t, this.isXML = n;
}
/**
* @deprecated Removing the constraints validation on client side.
*/
validateConstraints(t, n, r) {
const i = (o, s) => {
throw new Error(`"${r}" with value "${n}" should satisfy the constraint "${o}": ${s}.`);
};
if (t.constraints && n !== void 0 && n !== null) {
const { ExclusiveMaximum: o, ExclusiveMinimum: s, InclusiveMaximum: l, InclusiveMinimum: f, MaxItems: y, MaxLength: b, MinItems: $, MinLength: L, MultipleOf: H, Pattern: W, UniqueItems: Z } = t.constraints;
if (o !== void 0 && n >= o && i("ExclusiveMaximum", o), s !== void 0 && n <= s && i("ExclusiveMinimum", s), l !== void 0 && n > l && i("InclusiveMaximum", l), f !== void 0 && n < f && i("InclusiveMinimum", f), y !== void 0 && n.length > y && i("MaxItems", y), b !== void 0 && n.length > b && i("MaxLength", b), $ !== void 0 && n.length < $ && i("MinItems", $), L !== void 0 && n.length < L && i("MinLength", L), H !== void 0 && n % H !== 0 && i("MultipleOf", H), W) {
const oe = typeof W == "string" ? new RegExp(W) : W;
(typeof n != "string" || n.match(oe) === null) && i("Pattern", W);
}
Z && n.some((oe, fe, ae) => ae.indexOf(oe) !== fe) && i("UniqueItems", Z);
}
}
/**
* Serialize the given object based on its metadata defined in the mapper
*
* @param mapper - The mapper which defines the metadata of the serializable object
*
* @param object - A valid Javascript object to be serialized
*
* @param objectName - Name of the serialized object
*
* @param options - additional options to serialization
*
* @returns A valid serialized Javascript object
*/
serialize(t, n, r, i = { xml: {} }) {
var o, s, l;
const f = {
xml: {
rootName: (o = i.xml.rootName) !== null && o !== void 0 ? o : "",
includeRoot: (s = i.xml.includeRoot) !== null && s !== void 0 ? s : !1,
xmlCharKey: (l = i.xml.xmlCharKey) !== null && l !== void 0 ? l : Ze
}
};
let y = {};
const b = t.type.name;
r || (r = t.serializedName), b.match(/^Sequence$/i) !== null && (y = []), t.isConstant && (n = t.defaultValue);
const { required: $, nullable: L } = t;
if ($ && L && n === void 0)
throw new Error(`${r} cannot be undefined.`);
if ($ && !L && n == null)
throw new Error(`${r} cannot be null or undefined.`);
if (!$ && L === !1 && n === null)
throw new Error(`${r} cannot be null.`);
return n == null || b.match(/^any$/i) !== null ? y = n : b.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i) !== null ? y = na(b, r, n) : b.match(/^Enum$/i) !== null ? y = ra(r, t.type.allowedValues, n) : b.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/i) !== null ? y = sa(b, n, r) : b.match(/^ByteArray$/i) !== null ? y = ia(r, n) : b.match(/^Base64Url$/i) !== null ? y = oa(r, n) : b.match(/^Sequence$/i) !== null ? y = aa(this, t, n, r, !!this.isXML, f) : b.match(/^Dictionary$/i) !== null ? y = ca(this, t, n, r, !!this.isXML, f) : b.match(/^Composite$/i) !== null && (y = la(this, t, n, r, !!this.isXML, f)), y;
}
/**
* Deserialize the given object based on its metadata defined in the mapper
*
* @param mapper - The mapper which defines the metadata of the serializable object
*
* @param responseBody - A valid Javascript entity to be deserialized
*
* @param objectName - Name of the deserialized object
*
* @param options - Controls behavior of XML parser and builder.
*
* @returns A valid deserialized Javascript object
*/
deserialize(t, n, r, i = { xml: {} }) {
var o, s, l, f;
const y = {
xml: {
rootName: (o = i.xml.rootName) !== null && o !== void 0 ? o : "",
includeRoot: (s = i.xml.includeRoot) !== null && s !== void 0 ? s : !1,
xmlCharKey: (l = i.xml.xmlCharKey) !== null && l !== void 0 ? l : Ze
},
ignoreUnknownProperties: (f = i.ignoreUnknownProperties) !== null && f !== void 0 ? f : !1
};
if (n == null)
return this.isXML && t.type.name === "Sequence" && !t.xmlIsWrapped && (n = []), t.defaultValue !== void 0 && (n = t.defaultValue), n;
let b;
const $ = t.type.name;
if (r || (r = t.serializedName), $.match(/^Composite$/i) !== null)
b = ha(this, t, n, r, y);
else {
if (this.isXML) {
const L = y.xml.xmlCharKey;
n[Re] !== void 0 && n[L] !== void 0 && (n = n[L]);
}
$.match(/^Number$/i) !== null ? (b = parseFloat(n), isNaN(b) && (b = n)) : $.match(/^Boolean$/i) !== null ? n === "true" ? b = !0 : n === "false" ? b = !1 : b = n : $.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i) !== null ? b = n : $.match(/^(Date|DateTime|DateTimeRfc1123)$/i) !== null ? b = new Date(n) : $.match(/^UnixTime$/i) !== null ? b = ta(n) : $.match(/^ByteArray$/i) !== null ? b = Br(n) : $.match(/^Base64Url$/i) !== null ? b = Zs(n) : $.match(/^Sequence$/i) !== null ? b = fa(this, t, n, r, y) : $.match(/^Dictionary$/i) !== null && (b = pa(this, t, n, r, y));
}
return t.isConstant && (b = t.defaultValue), b;
}
}
function kn(e = {}, t = !1) {
return new Xs(e, t);
}
function Qs(e, t) {
let n = e.length;
for (; n - 1 >= 0 && e[n - 1] === t; )
--n;
return e.substr(0, n);
}
function Ys(e) {
if (!e)
return;
if (!(e instanceof Uint8Array))
throw new Error("Please provide an input of type Uint8Array for converting to Base64Url.");
const t = qr(e);
return Qs(t, "=").replace(/\+/g, "-").replace(/\//g, "_");
}
function Zs(e) {
if (e) {
if (e && typeof e.valueOf() != "string")
throw new Error("Please provide an input of type string for converting to Uint8Array");
return e = e.replace(/-/g, "+").replace(/_/g, "/"), Br(e);
}
}
function an(e) {
const t = [];
let n = "";
if (e) {
const r = e.split(".");
for (const i of r)
i.charAt(i.length - 1) === "\\" ? n += i.substr(0, i.length - 1) + "." : (n += i, t.push(n), n = "");
}
return t;
}
function ea(e) {
if (e)
return typeof e.valueOf() == "string" && (e = new Date(e)), Math.floor(e.getTime() / 1e3);
}
function ta(e) {
if (e)
return new Date(e * 1e3);
}
function na(e, t, n) {
if (n != null) {
if (e.match(/^Number$/i) !== null) {
if (typeof n != "number")
throw new Error(`${t} with value ${n} must be of type number.`);
} else if (e.match(/^String$/i) !== null) {
if (typeof n.valueOf() != "string")
throw new Error(`${t} with value "${n}" must be of type string.`);
} else if (e.match(/^Uuid$/i) !== null) {
if (!(typeof n.valueOf() == "string" && Gs(n)))
throw new Error(`${t} with value "${n}" must be of type string and a valid uuid.`);
} else if (e.match(/^Boolean$/i) !== null) {
if (typeof n != "boolean")
throw new Error(`${t} with value ${n} must be of type boolean.`);
} else if (e.match(/^Stream$/i) !== null) {
const r = typeof n;
if (r !== "string" && typeof n.pipe != "function" && // NodeJS.ReadableStream
typeof n.tee != "function" && // browser ReadableStream
!(n instanceof ArrayBuffer) && !ArrayBuffer.isView(n) && // File objects count as a type of Blob, so we want to use instanceof explicitly
!((typeof Blob == "function" || typeof Blob == "object") && n instanceof Blob) && r !== "function")
throw new Error(`${t} must be a string, Blob, ArrayBuffer, ArrayBufferView, ReadableStream, or () => ReadableStream.`);
}
}
return n;
}
function ra(e, t, n) {
if (!t)
throw new Error(`Please provide a set of allowedValues to validate ${e} as an Enum Type.`);
if (!t.some((i) => typeof i.valueOf() == "string" ? i.toLowerCase() === n.toLowerCase() : i === n))
throw new Error(`${n} is not a valid value for ${e}. The valid values are: ${JSON.stringify(t)}.`);
return n;
}
function ia(e, t) {
if (t != null) {
if (!(t instanceof Uint8Array))
throw new Error(`${e} must be of type Uint8Array.`);
t = qr(t);
}
return t;
}
function oa(e, t) {
if (t != null) {
if (!(t instanceof Uint8Array))
throw new Error(`${e} must be of type Uint8Array.`);
t = Ys(t);
}
return t;
}
function sa(e, t, n) {
if (t != null) {
if (e.match(/^Date$/i) !== null) {
if (!(t instanceof Date || typeof t.valueOf() == "string" && !isNaN(Date.parse(t))))
throw new Error(`${n} must be an instanceof Date or a string in ISO8601 format.`);
t = t instanceof Date ? t.toISOString().substring(0, 10) : new Date(t).toISOString().substring(0, 10);
} else if (e.match(/^DateTime$/i) !== null) {
if (!(t instanceof Date || typeof t.valueOf() == "string" && !isNaN(Date.parse(t))))
throw new Error(`${n} must be an instanceof Date or a string in ISO8601 format.`);
t = t instanceof Date ? t.toISOString() : new Date(t).toISOString();
} else if (e.match(/^DateTimeRfc1123$/i) !== null) {
if (!(t instanceof Date || typeof t.valueOf() == "string" && !isNaN(Date.parse(t))))
throw new Error(`${n} must be an instanceof Date or a string in RFC-1123 format.`);
t = t instanceof Date ? t.toUTCString() : new Date(t).toUTCString();
} else if (e.match(/^UnixTime$/i) !== null) {
if (!(t instanceof Date || typeof t.valueOf() == "string" && !isNaN(Date.parse(t))))
throw new Error(`${n} must be an instanceof Date or a string in RFC-1123/ISO8601 format for it to be serialized in UnixTime/Epoch format.`);
t = ea(t);
} else if (e.match(/^TimeSpan$/i) !== null && !Ws(t))
throw new Error(`${n} must be a string in ISO 8601 format. Instead was "${t}".`);
}
return t;
}
function aa(e, t, n, r, i, o) {
var s;
if (!Array.isArray(n))
throw new Error(`${r} must be of type Array.`);
let l = t.type.element;
if (!l || typeof l != "object")
throw new Error(`element" metadata for an Array must be defined in the mapper and it must of type "object" in ${r}.`);
l.type.name === "Composite" && l.type.className && (l = (s = e.modelMappers[l.type.className]) !== null && s !== void 0 ? s : l);
const f = [];
for (let y = 0; y < n.length; y++) {
const b = e.serialize(l, n[y], r, o);
if (i && l.xmlNamespace) {
const $ = l.xmlNamespacePrefix ? `xmlns:${l.xmlNamespacePrefix}` : "xmlns";
l.type.name === "Composite" ? (f[y] = Object.assign({}, b), f[y][Re] = { [$]: l.xmlNamespace }) : (f[y] = {}, f[y][o.xml.xmlCharKey] = b, f[y][Re] = { [$]: l.xmlNamespace });
} else
f[y] = b;
}
return f;
}
function ca(e, t, n, r, i, o) {
if (typeof n != "object")
throw new Error(`${r} must be of type object.`);
const s = t.type.value;
if (!s || typeof s != "object")
throw new Error(`"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in ${r}.`);
const l = {};
for (const f of Object.keys(n)) {
const y = e.serialize(s, n[f], r, o);
l[f] = Fr(s, y, i, o);
}
if (i && t.xmlNamespace) {
const f = t.xmlNamespacePrefix ? `xmlns:${t.xmlNamespacePrefix}` : "xmlns", y = l;
return y[Re] = { [f]: t.xmlNamespace }, y;
}
return l;
}
function ua(e, t, n) {
const r = t.type.additionalProperties;
if (!r && t.type.className) {
const i = Hr(e, t, n);
return i?.type.additionalProperties;
}
return r;
}
function Hr(e, t, n) {
const r = t.type.className;
if (!r)
throw new Error(`Class name for model "${n}" is not provided in the mapper "${JSON.stringify(t, void 0, 2)}".`);
return e.modelMappers[r];
}
function zr(e, t, n) {
let r = t.type.modelProperties;
if (!r) {
const i = Hr(e, t, n);
if (!i)
throw new Error(`mapper() cannot be null or undefined for model "${t.type.className}".`);
if (r = i?.type.modelProperties, !r)
throw new Error(`modelProperties cannot be null or undefined in the mapper "${JSON.stringify(i)}" of type "${t.type.className}" for object "${n}".`);
}
return r;
}
function la(e, t, n, r, i, o) {
if (kt(e, t) && (t = Vr(e, t, n, "clientName")), n != null) {
const s = {}, l = zr(e, t, r);
for (const y of Object.keys(l)) {
const b = l[y];
if (b.readOnly)
continue;
let $, L = s;
if (e.isXML)
b.xmlIsWrapped ? $ = b.xmlName : $ = b.xmlElementName || b.xmlName;
else {
const H = an(b.serializedName);
$ = H.pop();
for (const W of H) {
const Z = L[W];
Z == null && (n[y] !== void 0 && n[y] !== null || b.defaultValue !== void 0) && (L[W] = {}), L = L[W];
}
}
if (L != null) {
if (i && t.xmlNamespace) {
const fe = t.xmlNamespacePrefix ? `xmlns:${t.xmlNamespacePrefix}` : "xmlns";
L[Re] = Object.assign(Object.assign({}, L[Re]), { [fe]: t.xmlNamespace });
}
const H = b.serializedName !== "" ? r + "." + b.serializedName : r;
let W = n[y];
const Z = kt(e, t);
Z && Z.clientName === y && W == null && (W = t.serializedName);
const oe = e.serialize(b, W, H, o);
if (oe !== void 0 && $ !== void 0 && $ !== null) {
const fe = Fr(b, oe, i, o);
i && b.xmlIsAttribute ? (L[Re] = L[Re] || {}, L[Re][$] = oe) : i && b.xmlIsWrapped ? L[$] = { [b.xmlElementName]: fe } : L[$] = fe;
}
}
}
const f = ua(e, t, r);
if (f) {
const y = Object.keys(l);
for (const b in n)
y.every((L) => L !== b) && (s[b] = e.serialize(f, n[b], r + '["' + b + '"]', o));
}
return s;
}
return n;
}
function Fr(e, t, n, r) {
if (!n || !e.xmlNamespace)
return t;
const o = { [e.xmlNamespacePrefix ? `xmlns:${e.xmlNamespacePrefix}` : "xmlns"]: e.xmlNamespace };
if (["Composite"].includes(e.type.name)) {
if (t[Re])
return t;
{
const l = Object.assign({}, t);
return l[Re] = o, l;
}
}
const s = {};
return s[r.xml.xmlCharKey] = t, s[Re] = o, s;
}
function da(e, t) {
return [Re, t.xml.xmlCharKey].includes(e);
}
function ha(e, t, n, r, i) {
var o, s;
const l = (o = i.xml.xmlCharKey) !== null && o !== void 0 ? o : Ze;
kt(e, t) && (t = Vr(e, t, n, "serializedName"));
const f = zr(e, t, r);
let y = {};
const b = [];
for (const L of Object.keys(f)) {
const H = f[L], W = an(f[L].serializedName);
b.push(W[0]);
const { serializedName: Z, xmlName: oe, xmlElementName: fe } = H;
let ae = r;
Z !== "" && Z !== void 0 && (ae = r + "." + Z);
const ye = H.headerCollectionPrefix;
if (ye) {
const F = {};
for (const V of Object.keys(n))
V.startsWith(ye) && (F[V.substring(ye.length)] = e.deserialize(H.type.value, n[V], ae, i)), b.push(V);
y[L] = F;
} else if (e.isXML)
if (H.xmlIsAttribute && n[Re])
y[L] = e.deserialize(H, n[Re][oe], ae, i);
else if (H.xmlIsMsText)
n[l] !== void 0 ? y[L] = n[l] : typeof n == "string" && (y[L] = n);
else {
const F = fe || oe || Z;
if (H.xmlIsWrapped) {
const V = n[oe],