import {
    a as Rs,
    e as Nr
} from "./chunk-IIZSMBNO.js";
import {
    h as _s
} from "./chunk-OYJWBUYU.js";
import {
    $ as no,
    B as Es,
    Ic as ks,
    Y as Ur,
    Z as xs,
    ba as pt,
    da as oo,
    g as Ss,
    mb as Os,
    pa as bs,
    s as As
} from "./chunk-SSI6PFOR.js";
import {
    e as ro,
    f as dt,
    g as y
} from "./chunk-FFRAY7OK.js";
var x = ro((Bf, Fs) => {
    "use strict";

    function js() {}
    js.prototype = {
        on: function(t, e, r) {
            var n = this.e || (this.e = {});
            return (n[t] || (n[t] = [])).push({
                fn: e,
                ctx: r
            }), this
        },
        once: function(t, e, r) {
            var n = this;

            function o() {
                n.off(t, o), e.apply(r, arguments)
            }
            return o._ = e, this.on(t, o, r)
        },
        emit: function(t) {
            var e = [].slice.call(arguments, 1),
                r = ((this.e || (this.e = {}))[t] || []).slice(),
                n = 0,
                o = r.length;
            for (n; n < o; n++) r[n].fn.apply(r[n].ctx, e);
            return this
        },
        off: function(t, e) {
            var r = this.e || (this.e = {}),
                n = r[t],
                o = [];
            if (n && e)
                for (var i = 0, s = n.length; i < s; i++) n[i].fn !== e && n[i].fn._ !== e && o.push(n[i]);
            return o.length ? r[t] = o : delete r[t], this
        }
    };
    Fs.exports = js
});
var _ = ro((Ce, Vs) => {
    "use strict";
    var Yr = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof global < "u" && global,
        Zr = function() {
            function t() {
                this.fetch = !1, this.DOMException = Yr.DOMException
            }
            return t.prototype = Yr, new t
        }();
    (function(t) {
        var e = function(r) {
            var n = typeof t < "u" && t || typeof self < "u" && self || typeof global < "u" && global || {},
                o = {
                    searchParams: "URLSearchParams" in n,
                    iterable: "Symbol" in n && "iterator" in Symbol,
                    blob: "FileReader" in n && "Blob" in n && function() {
                        try {
                            return new Blob, !0
                        } catch {
                            return !1
                        }
                    }(),
                    formData: "FormData" in n,
                    arrayBuffer: "ArrayBuffer" in n
                };

            function i(h) {
                return h && DataView.prototype.isPrototypeOf(h)
            }
            if (o.arrayBuffer) var s = ["[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]"],
                a = ArrayBuffer.isView || function(h) {
                    return h && s.indexOf(Object.prototype.toString.call(h)) > -1
                };

            function c(h) {
                if (typeof h != "string" && (h = String(h)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(h) || h === "") throw new TypeError('Invalid character in header field name: "' + h + '"');
                return h.toLowerCase()
            }

            function u(h) {
                return typeof h != "string" && (h = String(h)), h
            }

            function l(h) {
                var g = {
                    next: function() {
                        var A = h.shift();
                        return {
                            done: A === void 0,
                            value: A
                        }
                    }
                };
                return o.iterable && (g[Symbol.iterator] = function() {
                    return g
                }), g
            }

            function f(h) {
                this.map = {}, h instanceof f ? h.forEach(function(g, A) {
                    this.append(A, g)
                }, this) : Array.isArray(h) ? h.forEach(function(g) {
                    if (g.length != 2) throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + g.length);
                    this.append(g[0], g[1])
                }, this) : h && Object.getOwnPropertyNames(h).forEach(function(g) {
                    this.append(g, h[g])
                }, this)
            }
            f.prototype.append = function(h, g) {
                h = c(h), g = u(g);
                var A = this.map[h];
                this.map[h] = A ? A + ", " + g : g
            }, f.prototype.delete = function(h) {
                delete this.map[c(h)]
            }, f.prototype.get = function(h) {
                return h = c(h), this.has(h) ? this.map[h] : null
            }, f.prototype.has = function(h) {
                return this.map.hasOwnProperty(c(h))
            }, f.prototype.set = function(h, g) {
                this.map[c(h)] = u(g)
            }, f.prototype.forEach = function(h, g) {
                for (var A in this.map) this.map.hasOwnProperty(A) && h.call(g, this.map[A], A, this)
            }, f.prototype.keys = function() {
                var h = [];
                return this.forEach(function(g, A) {
                    h.push(A)
                }), l(h)
            }, f.prototype.values = function() {
                var h = [];
                return this.forEach(function(g) {
                    h.push(g)
                }), l(h)
            }, f.prototype.entries = function() {
                var h = [];
                return this.forEach(function(g, A) {
                    h.push([A, g])
                }), l(h)
            }, o.iterable && (f.prototype[Symbol.iterator] = f.prototype.entries);

            function p(h) {
                if (!h._noBody) {
                    if (h.bodyUsed) return Promise.reject(new TypeError("Already read"));
                    h.bodyUsed = !0
                }
            }

            function m(h) {
                return new Promise(function(g, A) {
                    h.onload = function() {
                        g(h.result)
                    }, h.onerror = function() {
                        A(h.error)
                    }
                })
            }

            function v(h) {
                var g = new FileReader,
                    A = m(g);
                return g.readAsArrayBuffer(h), A
            }

            function w(h) {
                var g = new FileReader,
                    A = m(g),
                    R = /charset=([A-Za-z0-9_-]+)/.exec(h.type),
                    M = R ? R[1] : "utf-8";
                return g.readAsText(h, M), A
            }

            function S(h) {
                for (var g = new Uint8Array(h), A = new Array(g.length), R = 0; R < g.length; R++) A[R] = String.fromCharCode(g[R]);
                return A.join("")
            }

            function T(h) {
                if (h.slice) return h.slice(0);
                var g = new Uint8Array(h.byteLength);
                return g.set(new Uint8Array(h)), g.buffer
            }

            function P() {
                return this.bodyUsed = !1, this._initBody = function(h) {
                    this.bodyUsed = this.bodyUsed, this._bodyInit = h, h ? typeof h == "string" ? this._bodyText = h : o.blob && Blob.prototype.isPrototypeOf(h) ? this._bodyBlob = h : o.formData && FormData.prototype.isPrototypeOf(h) ? this._bodyFormData = h : o.searchParams && URLSearchParams.prototype.isPrototypeOf(h) ? this._bodyText = h.toString() : o.arrayBuffer && o.blob && i(h) ? (this._bodyArrayBuffer = T(h.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : o.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(h) || a(h)) ? this._bodyArrayBuffer = T(h) : this._bodyText = h = Object.prototype.toString.call(h) : (this._noBody = !0, this._bodyText = ""), this.headers.get("content-type") || (typeof h == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : o.searchParams && URLSearchParams.prototype.isPrototypeOf(h) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"))
                }, o.blob && (this.blob = function() {
                    var h = p(this);
                    if (h) return h;
                    if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
                    if (this._bodyArrayBuffer) return Promise.resolve(new Blob([this._bodyArrayBuffer]));
                    if (this._bodyFormData) throw new Error("could not read FormData body as blob");
                    return Promise.resolve(new Blob([this._bodyText]))
                }), this.arrayBuffer = function() {
                    if (this._bodyArrayBuffer) {
                        var h = p(this);
                        return h || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset, this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength)) : Promise.resolve(this._bodyArrayBuffer))
                    } else {
                        if (o.blob) return this.blob().then(v);
                        throw new Error("could not read as ArrayBuffer")
                    }
                }, this.text = function() {
                    var h = p(this);
                    if (h) return h;
                    if (this._bodyBlob) return w(this._bodyBlob);
                    if (this._bodyArrayBuffer) return Promise.resolve(S(this._bodyArrayBuffer));
                    if (this._bodyFormData) throw new Error("could not read FormData body as text");
                    return Promise.resolve(this._bodyText)
                }, o.formData && (this.formData = function() {
                    return this.text().then(B)
                }), this.json = function() {
                    return this.text().then(JSON.parse)
                }, this
            }
            var U = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];

            function O(h) {
                var g = h.toUpperCase();
                return U.indexOf(g) > -1 ? g : h
            }

            function H(h, g) {
                if (!(this instanceof H)) throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
                g = g || {};
                var A = g.body;
                if (h instanceof H) {
                    if (h.bodyUsed) throw new TypeError("Already read");
                    this.url = h.url, this.credentials = h.credentials, g.headers || (this.headers = new f(h.headers)), this.method = h.method, this.mode = h.mode, this.signal = h.signal, !A && h._bodyInit != null && (A = h._bodyInit, h.bodyUsed = !0)
                } else this.url = String(h);
                if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new f(g.headers)), this.method = O(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal || function() {
                        if ("AbortController" in n) {
                            var E = new AbortController;
                            return E.signal
                        }
                    }(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && A) throw new TypeError("Body not allowed for GET or HEAD requests");
                if (this._initBody(A), (this.method === "GET" || this.method === "HEAD") && (g.cache === "no-store" || g.cache === "no-cache")) {
                    var R = /([?&])_=[^&]*/;
                    if (R.test(this.url)) this.url = this.url.replace(R, "$1_=" + new Date().getTime());
                    else {
                        var M = /\?/;
                        this.url += (M.test(this.url) ? "&" : "?") + "_=" + new Date().getTime()
                    }
                }
            }
            H.prototype.clone = function() {
                return new H(this, {
                    body: this._bodyInit
                })
            };

            function B(h) {
                var g = new FormData;
                return h.trim().split("&").forEach(function(A) {
                    if (A) {
                        var R = A.split("="),
                            M = R.shift().replace(/\+/g, " "),
                            E = R.join("=").replace(/\+/g, " ");
                        g.append(decodeURIComponent(M), decodeURIComponent(E))
                    }
                }), g
            }

            function me(h) {
                var g = new f,
                    A = h.replace(/\r?\n[\t ]+/g, " ");
                return A.split("\r").map(function(R) {
                    return R.indexOf(`
`) === 0 ? R.substr(1, R.length) : R
                }).forEach(function(R) {
                    var M = R.split(":"),
                        E = M.shift().trim();
                    if (E) {
                        var Dr = M.join(":").trim();
                        try {
                            g.append(E, Dr)
                        } catch (to) {
                            console.warn("Response " + to.message)
                        }
                    }
                }), g
            }
            P.call(H.prototype);

            function q(h, g) {
                if (!(this instanceof q)) throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
                if (g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.status < 200 || this.status > 599) throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
                this.ok = this.status >= 200 && this.status < 300, this.statusText = g.statusText === void 0 ? "" : "" + g.statusText, this.headers = new f(g.headers), this.url = g.url || "", this._initBody(h)
            }
            P.call(q.prototype), q.prototype.clone = function() {
                return new q(this._bodyInit, {
                    status: this.status,
                    statusText: this.statusText,
                    headers: new f(this.headers),
                    url: this.url
                })
            }, q.error = function() {
                var h = new q(null, {
                    status: 200,
                    statusText: ""
                });
                return h.ok = !1, h.status = 0, h.type = "error", h
            };
            var ft = [301, 302, 303, 307, 308];
            q.redirect = function(h, g) {
                if (ft.indexOf(g) === -1) throw new RangeError("Invalid status code");
                return new q(null, {
                    status: g,
                    headers: {
                        location: h
                    }
                })
            }, r.DOMException = n.DOMException;
            try {
                new r.DOMException
            } catch {
                r.DOMException = function(g, A) {
                    this.message = g, this.name = A;
                    var R = Error(g);
                    this.stack = R.stack
                }, r.DOMException.prototype = Object.create(Error.prototype), r.DOMException.prototype.constructor = r.DOMException
            }

            function Qt(h, g) {
                return new Promise(function(A, R) {
                    var M = new H(h, g);
                    if (M.signal && M.signal.aborted) return R(new r.DOMException("Aborted", "AbortError"));
                    var E = new XMLHttpRequest;

                    function Dr() {
                        E.abort()
                    }
                    E.onload = function() {
                        var K = {
                            statusText: E.statusText,
                            headers: me(E.getAllResponseHeaders() || "")
                        };
                        M.url.indexOf("file://") === 0 && (E.status < 200 || E.status > 599) ? K.status = 200 : K.status = E.status, K.url = "responseURL" in E ? E.responseURL : K.headers.get("X-Request-URL");
                        var Xe = "response" in E ? E.response : E.responseText;
                        setTimeout(function() {
                            A(new q(Xe, K))
                        }, 0)
                    }, E.onerror = function() {
                        setTimeout(function() {
                            R(new TypeError("Network request failed"))
                        }, 0)
                    }, E.ontimeout = function() {
                        setTimeout(function() {
                            R(new TypeError("Network request timed out"))
                        }, 0)
                    }, E.onabort = function() {
                        setTimeout(function() {
                            R(new r.DOMException("Aborted", "AbortError"))
                        }, 0)
                    };

                    function to(K) {
                        try {
                            return K === "" && n.location.href ? n.location.href : K
                        } catch {
                            return K
                        }
                    }
                    if (E.open(M.method, to(M.url), !0), M.credentials === "include" ? E.withCredentials = !0 : M.credentials === "omit" && (E.withCredentials = !1), "responseType" in E && (o.blob ? E.responseType = "blob" : o.arrayBuffer && (E.responseType = "arraybuffer")), g && typeof g.headers == "object" && !(g.headers instanceof f || n.Headers && g.headers instanceof n.Headers)) {
                        var Ts = [];
                        Object.getOwnPropertyNames(g.headers).forEach(function(K) {
                            Ts.push(c(K)), E.setRequestHeader(K, u(g.headers[K]))
                        }), M.headers.forEach(function(K, Xe) {
                            Ts.indexOf(Xe) === -1 && E.setRequestHeader(Xe, K)
                        })
                    } else M.headers.forEach(function(K, Xe) {
                        E.setRequestHeader(Xe, K)
                    });
                    M.signal && (M.signal.addEventListener("abort", Dr), E.onreadystatechange = function() {
                        E.readyState === 4 && M.signal.removeEventListener("abort", Dr)
                    }), E.send(typeof M._bodyInit > "u" ? null : M._bodyInit)
                })
            }
            return Qt.polyfill = !0, n.fetch || (n.fetch = Qt, n.Headers = f, n.Request = H, n.Response = q), r.Headers = f, r.Request = H, r.Response = q, r.fetch = Qt, Object.defineProperty(r, "__esModule", {
                value: !0
            }), r
        }({})
    })(Zr);
    Zr.fetch.ponyfill = !0;
    delete Zr.fetch.polyfill;
    var At = Yr.fetch ? Yr : Zr;
    Ce = At.fetch;
    Ce.default = At.fetch;
    Ce.fetch = At.fetch;
    Ce.Headers = At.Headers;
    Ce.Request = At.Request;
    Ce.Response = At.Response;
    Vs.exports = Ce
});
var Ia = ro((hb, gi) => {
    "use strict";
    var Ln = class extends Error {
            constructor(e) {
                super(e || "Promise was canceled"), this.name = "CancelError"
            }
            get isCanceled() {
                return !0
            }
        },
        jn = class t {
            static fn(e) {
                return (...r) => new t((n, o, i) => {
                    r.push(i), e(...r).then(n, o)
                })
            }
            constructor(e) {
                this._cancelHandlers = [], this._isPending = !0, this._isCanceled = !1, this._rejectOnCancel = !0, this._promise = new Promise((r, n) => {
                    this._reject = n;
                    let o = a => {
                            (!this._isCanceled || !s.shouldReject) && (this._isPending = !1, r(a))
                        },
                        i = a => {
                            this._isPending = !1, n(a)
                        },
                        s = a => {
                            if (!this._isPending) throw new Error("The `onCancel` handler was attached after the promise settled.");
                            this._cancelHandlers.push(a)
                        };
                    return Object.defineProperties(s, {
                        shouldReject: {
                            get: () => this._rejectOnCancel,
                            set: a => {
                                this._rejectOnCancel = a
                            }
                        }
                    }), e(o, i, s)
                })
            }
            then(e, r) {
                return this._promise.then(e, r)
            } catch (e) {
                return this._promise.catch(e)
            } finally(e) {
                return this._promise.finally(e)
            }
            cancel(e) {
                if (!(!this._isPending || this._isCanceled)) {
                    if (this._isCanceled = !0, this._cancelHandlers.length > 0) try {
                        for (let r of this._cancelHandlers) r()
                    } catch (r) {
                        this._reject(r);
                        return
                    }
                    this._rejectOnCancel && this._reject(new Ln(e))
                }
            }
            get isCanceled() {
                return this._isCanceled
            }
        };
    Object.setPrototypeOf(jn.prototype, Promise.prototype);
    gi.exports = jn;
    gi.exports.CancelError = Ln
});
var Re = function(t) {
        return t.SUCCESS = "SUCCESS", t.PENDING = "PENDING", t.FAILURE = "FAILURE", t.TERMINAL = "TERMINAL", t.CANCELED = "CANCELED", t
    }(Re || {}),
    ae = function(t) {
        return t.OKTA_PASSWORD = "okta_password", t.OKTA_EMAIL = "okta_email", t.PHONE_NUMBER = "phone_number", t.GOOGLE_AUTHENTICATOR = "google_otp", t.SECURITY_QUESTION = "security_question", t.OKTA_VERIFY = "okta_verify", t.WEBAUTHN = "webauthn", t
    }(ae || {}),
    ue = function(t) {
        return t.PASSWORD_RECOVERY = "recover-password", t.REGISTRATION = "enroll-profile", t.SOCIAL_IDP = "redirect-idp", t.ACCOUNT_UNLOCK = "unlock-account", t
    }(ue || {});

function Pe(t) {
    return t && (t.key || t.id)
}

function Ps() {
    return typeof window < "u" ? window.console : typeof console < "u" ? console : void 0
}

function Ye() {
    var t = Ps();
    return t && t.log ? t : {
        log: function() {},
        warn: function() {},
        group: function() {},
        groupEnd: function() {}
    }
}

function N(t) {
    Ye().warn("[okta-auth-sdk] WARN: " + t)
}

function D(t) {
    var e = {};
    for (var r in t)
        if (Object.prototype.hasOwnProperty.call(t, r)) {
            var n = t[r];
            n != null && (e[r] = n)
        }
    return e
}

function I(t) {
    if (t) {
        var e = JSON.stringify(t);
        if (e) return JSON.parse(e)
    }
    return t
}

function Te(t, ...e) {
    var r = {};
    for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) == -1 && (r[n] = t[n]);
    return I(r)
}

function ht(t, e) {
    for (var r = t.length; r--;) {
        var n = t[r],
            o = !0;
        for (var i in e)
            if (Object.prototype.hasOwnProperty.call(e, i) && n[i] !== e[i]) {
                o = !1;
                break
            }
        if (o) return n
    }
}

function mt(t, e, r) {
    if (!(!t || !t._links)) {
        var n = I(t._links[e]);
        if (n && n.name && r) {
            if (n.name === r) return n
        } else return n
    }
}
var X = class extends Error {
    constructor(e) {
        super(e), Object.setPrototypeOf(this, new.target.prototype)
    }
};

function ge(t) {
    return Object.prototype.toString.call(t) === "[object String]"
}

function Xt(t) {
    return Object.prototype.toString.call(t) === "[object Object]"
}

function io(t) {
    return Object.prototype.toString.call(t) === "[object Number]"
}

function Yt(t) {
    return !!t && {}.toString.call(t) === "[object Function]"
}

function so(t) {
    return t && t.finally && typeof t.finally == "function"
}
var Y = (() => {
    class t extends X {
        constructor(r, n, o) {
            var i;
            super((i = n.error) !== null && i !== void 0 ? i : t.UNKNOWN_ERROR), this.name = "WWWAuthError", this.resp = null, this.scheme = r, this.parameters = n, o && (this.resp = o)
        }
        get error() {
            return this.parameters.error
        }
        get errorCode() {
            return this.error
        }
        get error_description() {
            return this.parameters.error_description
        }
        get errorDescription() {
            return this.error_description
        }
        get errorSummary() {
            return this.errorDescription
        }
        get realm() {
            return this.parameters.realm
        }
        static parseHeader(r) {
            var n;
            if (!r) return null;
            let o = /(?:,|, )?([a-zA-Z0-9!#$%&'*+\-.^_`|~]+)=(?:"([a-zA-Z0-9!#$%&'*+\-.,^_`|~ /:]+)"|([a-zA-Z0-9!#$%&'*+\-.^_`|~/:]+))/g,
                i = r.indexOf(" "),
                s = r.slice(0, i),
                a = r.slice(i + 1),
                c = {},
                u;
            for (;
                (u = o.exec(a)) !== null;) c[u[1]] = (n = u[2]) !== null && n !== void 0 ? n : u[3];
            return new t(s, c)
        }
        static getWWWAuthenticateHeader(r = {}) {
            var n;
            return Yt(r ? .get) ? r.get("WWW-Authenticate") : (n = r["www-authenticate"]) !== null && n !== void 0 ? n : r["WWW-Authenticate"]
        }
    }
    return t.UNKNOWN_ERROR = "UNKNOWN_WWW_AUTH_ERROR", t
})();

function Lr(t) {
    for (var e = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", r = "", n = 0, o = e.length; n < t; ++n) r += e[Math.floor(Math.random() * o)];
    return r
}

function jr(t) {
    return new Promise(function(e) {
        setTimeout(e, t)
    })
}

function ao(t, e) {
    let r = t.split(e);
    return [r[0], r.splice(1, r.length).join(e)]
}

function gt(t) {
    return /^[a-z][a-z0-9+.-]*:/i.test(t)
}

function co(t = "", e) {
    return gt(t) ? t : (e = $(e), t[0] === "/" ? `${e}${t}` : `${e}/${t}`)
}

function uo(t = "", e) {
    return gt(t) && (t = t.substring(e.length)), t[0] === "/" ? t : `/${t}`
}

function W(t) {
    var e = [];
    if (t !== null)
        for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && t[r] !== void 0 && t[r] !== null && e.push(r + "=" + encodeURIComponent(t[r]));
    return e.length ? "?" + e.join("&") : ""
}

function $(t) {
    if (t) {
        var e = t.replace(/^\s+|\s+$/gm, "");
        return e = e.replace(/\/+$/, ""), e
    }
}
var d = class extends X {
    constructor(e, r) {
        super(e), this.name = "AuthSdkError", this.errorCode = "INTERNAL", this.errorSummary = e, this.errorLink = "INTERNAL", this.errorId = "INTERNAL", this.errorCauses = [], r && (this.xhr = r)
    }
};

function Ze() {
    return Lr(64)
}

function lo() {
    return Lr(64)
}

function fo(t, e = {}) {
    return $(e.issuer) || t.options.issuer
}

function Fr(t, e = {}) {
    let r = fo(t, e);
    return r.indexOf("/oauth2") > 0 ? r : r + "/oauth2"
}

function po(t, e = {}) {
    return fo(t, e).split("/oauth2")[0]
}

function G(t, e) {
    if (arguments.length > 2) throw new d('As of version 3.0, "getOAuthUrls" takes only a single set of options');
    e = e || {};
    var r = $(e.authorizeUrl) || t.options.authorizeUrl,
        n = fo(t, e),
        o = $(e.userinfoUrl) || t.options.userinfoUrl,
        i = $(e.tokenUrl) || t.options.tokenUrl,
        s = $(e.logoutUrl) || t.options.logoutUrl,
        a = $(e.revokeUrl) || t.options.revokeUrl,
        c = Fr(t, e);
    return r = r || c + "/v1/authorize", o = o || c + "/v1/userinfo", i = i || c + "/v1/token", a = a || c + "/v1/revoke", s = s || c + "/v1/logout", {
        issuer: n,
        authorizeUrl: r,
        userinfoUrl: o,
        tokenUrl: i,
        revokeUrl: a,
        logoutUrl: s
    }
}

function Zt(t, e) {
    let r = t.options.issuer,
        n = G(t, e),
        o = {
            issuer: r,
            urls: n,
            clientId: e.clientId,
            redirectUri: e.redirectUri,
            responseType: e.responseType,
            responseMode: e.responseMode,
            scopes: e.scopes,
            state: e.state,
            nonce: e.nonce,
            ignoreSignature: e.ignoreSignature,
            acrValues: e.acrValues,
            extraParams: e.extraParams
        };
    return e.pkce === !1 ? o : Object.assign(Object.assign({}, o), {
        codeVerifier: e.codeVerifier,
        codeChallengeMethod: e.codeChallengeMethod,
        codeChallenge: e.codeChallenge
    })
}
var Qr = {};
dt(Qr, {
    ACCESS_TOKEN_STORAGE_KEY: () => Cs,
    CACHE_STORAGE_NAME: () => qr,
    DEFAULT_CACHE_DURATION: () => Wr,
    DEFAULT_CODE_CHALLENGE_METHOD: () => yt,
    DEFAULT_MAX_CLOCK_SKEW: () => Br,
    DEFAULT_POLLING_DELAY: () => Vr,
    IDX_API_VERSION: () => Tt,
    IDX_RESPONSE_STORAGE_NAME: () => zr,
    ID_TOKEN_STORAGE_KEY: () => Ms,
    IOS_MAX_RETRY_COUNT: () => Hr,
    MAX_VERIFIER_LENGTH: () => Jr,
    MIN_VERIFIER_LENGTH: () => tr,
    ORIGINAL_URI_STORAGE_NAME: () => $r,
    PKCE_STORAGE_NAME: () => Is,
    REFERRER_PATH_STORAGE_KEY: () => wt,
    REFRESH_TOKEN_STORAGE_KEY: () => er,
    SHARED_TRANSACTION_STORAGE_NAME: () => Gr,
    STATE_TOKEN_KEY_NAME: () => Ie,
    TOKEN_STORAGE_NAME: () => vt,
    TRANSACTION_STORAGE_NAME: () => Kr
});
var Ie = "oktaStateToken",
    Vr = 500,
    Hr = 3,
    Br = 300,
    Wr = 86400,
    vt = "okta-token-storage",
    qr = "okta-cache-storage",
    Is = "okta-pkce-storage",
    Kr = "okta-transaction-storage",
    Gr = "okta-shared-transaction-storage",
    $r = "okta-original-uri-storage",
    zr = "okta-idx-response-storage",
    Cs = "accessToken",
    Ms = "idToken",
    er = "refreshToken",
    wt = "referrerPath",
    tr = 43,
    Jr = 128,
    yt = "S256",
    Tt = "1.0.0";
var z = class extends X {
    constructor(e, r, n) {
        let o = e.errorSummary;
        super(o), this.name = "AuthApiError", this.errorSummary = e.errorSummary, this.errorCode = e.errorCode, this.errorLink = e.errorLink, this.errorId = e.errorId, this.errorCauses = e.errorCauses, r && (this.xhr = r), n && (this.meta = n)
    }
};
var J = class extends X {
    constructor(e, r, n) {
        super(r), this.resp = null, this.name = "OAuthError", this.errorCode = e, this.errorSummary = r, this.error = e, this.error_description = r, n && (this.resp = n)
    }
};
var nr = {};
dt(nr, {
    getUserAgent: () => Ds,
    hasTextEncoder: () => mo,
    isBrowser: () => k,
    isDPoPSupported: () => Kc,
    isFingerprintSupported: () => ho,
    isHTTPS: () => go,
    isIE11OrLess: () => St,
    isIOS: () => Gc,
    isLocalhost: () => vo,
    isPKCESupported: () => qc,
    isPopupPostMessageSupported: () => Wc,
    isTokenVerifySupported: () => Ns
});
var rr = function(t) {
        return atob(t)
    },
    oe = function(t) {
        return btoa(t)
    },
    L = typeof crypto > "u" ? null : crypto;
var Bc = /windows phone|iemobile|wpdesktop/i;

function k() {
    return typeof document < "u" && typeof window < "u"
}

function St() {
    if (!k()) return !1;
    let t = document.documentMode;
    return !!t && t <= 11
}

function Ds() {
    return navigator.userAgent
}

function ho() {
    let t = Ds();
    return t && !Bc.test(t)
}

function Wc() {
    if (!k()) return !1;
    let t = document.documentMode;
    var e = t && t < 10;
    return typeof window.postMessage < "u" && !e
}

function Us() {
    return typeof L < "u" && L !== null && typeof L.subtle < "u" && typeof Uint8Array < "u"
}

function Ns() {
    return Us()
}

function mo() {
    return typeof TextEncoder < "u"
}

function qc() {
    return Ns() && mo()
}

function go() {
    return k() ? window.location.protocol === "https:" : !1
}

function vo() {
    return k() && window.location.hostname === "localhost"
}

function Kc() {
    return !St() && typeof window.indexedDB < "u" && mo() && Us()
}

function Gc() {
    return k() && typeof navigator < "u" && typeof navigator.userAgent < "u" && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream
}
var wo = 0,
    Ls;
k() && (wo = Date.now(), Ls = () => {
    document.hidden || (wo = Date.now())
}, document.addEventListener("visibilitychange", Ls));
var $c = (t, e) => {
    var r;
    if (e instanceof Error) return new z({
        errorSummary: e.message
    });
    let n = e,
        o, i = {};
    if (n.responseText && ge(n.responseText)) try {
        i = JSON.parse(n.responseText)
    } catch {
        i = {
            errorSummary: "Unknown error"
        }
    }
    n.status >= 500 && (i.errorSummary = "Unknown error"), t.options.transformErrorXHR && (n = t.options.transformErrorXHR(I(n)));
    let s = (r = Y.getWWWAuthenticateHeader(n ? .headers)) !== null && r !== void 0 ? r : "";
    if (i.error && i.error_description ? o = new J(i.error, i.error_description, n) : o = new z(i, n, {
            wwwAuthHeader: s
        }), s && n ? .status >= 400 && n ? .status < 500) {
        let a = Y.parseHeader(s);
        if (n.status === 403 && a ? .error === "insufficient_authentication_context") {
            let {
                max_age: c,
                acr_values: u
            } = a.parameters;
            o = new z({
                errorSummary: a.error,
                errorCauses: [{
                    errorSummary: a.errorDescription
                }]
            }, n, Object.assign({
                max_age: +c
            }, u && {
                acr_values: u
            }))
        } else a ? .scheme === "DPoP" && (o = a)
    }
    return o
};

function j(t, e) {
    var r;
    if (e = e || {}, t.options.httpRequestInterceptors)
        for (let B of t.options.httpRequestInterceptors) B(e);
    var n = e.url,
        o = e.method,
        i = e.args,
        s = e.saveAuthnState,
        a = e.accessToken,
        c = e.withCredentials === !0,
        u = t.options.storageUtil,
        l = u.storage,
        f = t.storageManager.getHttpCache(t.options.cookies),
        p = e.pollingIntent,
        m = (r = t.options.pollDelay) !== null && r !== void 0 ? r : 0;
    if (e.cacheResponse) {
        var v = f.getStorage(),
            w = v[n];
        if (w && Date.now() / 1e3 < w.expiresAt) return Promise.resolve(w.response)
    }
    var S = t._oktaUserAgent.getHttpHeader(),
        T = Object.assign({
            Accept: "application/json",
            "Content-Type": "application/json"
        }, S);
    Object.assign(T, t.options.headers, e.headers), T = D(T), a && ge(a) && (T.Authorization = "Bearer " + a);
    var P = {
            headers: T,
            data: i || void 0,
            withCredentials: c
        },
        U, O, H;
    if (p && k() && m > 0) {
        let B, me, q, ft = 0;
        me = () => {
            let h = Date.now() - wo;
            return h < m ? new Promise(g => setTimeout(() => {
                document.hidden ? g(B()) : g()
            }, m - h)) : Promise.resolve()
        }, B = () => {
            if (document.hidden) {
                let h;
                return new Promise(g => {
                    h = () => {
                        document.hidden || (document.removeEventListener("visibilitychange", h), g(me()))
                    }, document.addEventListener("visibilitychange", h)
                })
            } else return me()
        };
        let Qt = () => t.options.httpRequestClient(o, n, P).catch(h => {
            if (h ? .message === "Load failed" && ft < 3) return ft++, q();
            throw h
        });
        q = () => B().then(Qt), H = q()
    } else H = t.options.httpRequestClient(o, n, P);
    return H.then(function(B) {
        return O = B.responseText, O && ge(O) && (O = JSON.parse(O), O && typeof O == "object" && !O.headers && (Array.isArray(O) ? O.forEach(me => {
            me.headers = B.headers
        }) : O.headers = B.headers)), s && (O.stateToken || l.delete(Ie)), O && O.stateToken && O.expiresAt && l.set(Ie, O.stateToken, O.expiresAt, t.options.cookies), O && e.cacheResponse && f.updateStorage(n, {
            expiresAt: Math.floor(Date.now() / 1e3) + 86400,
            response: O
        }), O
    }).catch(function(B) {
        throw U = $c(t, B), U.errorCode === "E0000011" && l.delete(Ie), U
    })
}

function le(t, e, r) {
    e = gt(e) ? e : t.getIssuerOrigin() + e;
    var n = {
        url: e,
        method: "GET"
    };
    return Object.assign(n, r), j(t, n)
}

function Z(t, e, r, n) {
    e = gt(e) ? e : t.getIssuerOrigin() + e;
    var o = {
        url: e,
        method: "POST",
        args: r,
        saveAuthnState: !0
    };
    return Object.assign(o, n), j(t, o)
}
var Xf = y(x(), 1);

function Xr(t) {
    for (var e = 1; e < arguments.length; e++) {
        var r = arguments[e];
        for (var n in r) t[n] = r[n]
    }
    return t
}
var zc = {
    read: function(t) {
        return t[0] === '"' && (t = t.slice(1, -1)), t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
    },
    write: function(t) {
        return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent)
    }
};

function yo(t, e) {
    function r(o, i, s) {
        if (!(typeof document > "u")) {
            s = Xr({}, e, s), typeof s.expires == "number" && (s.expires = new Date(Date.now() + s.expires * 864e5)), s.expires && (s.expires = s.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
            var a = "";
            for (var c in s) s[c] && (a += "; " + c, s[c] !== !0 && (a += "=" + s[c].split(";")[0]));
            return document.cookie = o + "=" + t.write(i, o) + a
        }
    }

    function n(o) {
        if (!(typeof document > "u" || arguments.length && !o)) {
            for (var i = document.cookie ? document.cookie.split("; ") : [], s = {}, a = 0; a < i.length; a++) {
                var c = i[a].split("="),
                    u = c.slice(1).join("=");
                try {
                    var l = decodeURIComponent(c[0]);
                    if (s[l] = t.read(u, l), o === l) break
                } catch {}
            }
            return o ? s[o] : s
        }
    }
    return Object.create({
        set: r,
        get: n,
        remove: function(o, i) {
            r(o, "", Xr({}, i, {
                expires: -1
            }))
        },
        withAttributes: function(o) {
            return yo(this.converter, Xr({}, this.attributes, o))
        },
        withConverter: function(o) {
            return yo(Xr({}, this.converter, o), this.attributes)
        }
    }, {
        attributes: {
            value: Object.freeze(e)
        },
        converter: {
            value: Object.freeze(t)
        }
    })
}
var or = yo(zc, {
    path: "/"
});
var Zf = y(_(), 1);
var en = function(t) {
    return t.ACCESS = "accessToken", t.ID = "idToken", t.REFRESH = "refreshToken", t
}(en || {});

function ee(t) {
    return t && t.accessToken
}

function ie(t) {
    return t && t.idToken
}

function fe(t) {
    return t && t.refreshToken
}

function te(t, e) {
    var r = {};
    for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
    if (t != null && typeof Object.getOwnPropertySymbols == "function")
        for (var o = 0, n = Object.getOwnPropertySymbols(t); o < n.length; o++) e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[o]) && (r[n[o]] = t[n[o]]);
    return r
}
async function et(t, e = {}) {
    let r = await t.token.prepareTokenParams(e),
        n = Zt(t, r),
        {
            flow: o = "default",
            withCredentials: i = !0,
            activationToken: s = void 0,
            recoveryToken: a = void 0,
            maxAge: c = void 0,
            acrValues: u = void 0
        } = Object.assign(Object.assign({}, t.options), e);
    return Object.assign(Object.assign({}, n), {
        flow: o,
        withCredentials: i,
        activationToken: s,
        recoveryToken: a,
        maxAge: c,
        acrValues: u
    })
}

function ir(t, e) {
    let r = Q(t, e);
    return !!r ? .interactionHandle
}

function Q(t, e) {
    e = D(e), e = Object.assign(Object.assign({}, t.options), e);
    let r;
    try {
        r = t.transactionManager.load(e)
    } catch {}
    if (r) {
        if (sr(r, e)) return r;
        N("Saved transaction meta does not match the current configuration. This may indicate that two apps are sharing a storage key.")
    }
}
async function tn(t, e) {
    e = D(e), e = Object.assign(Object.assign({}, t.options), e);
    let r = Q(t, e);
    return r || et(t, e)
}

function Me(t, e) {
    t.transactionManager.save(e, {
        muteWarning: !0
    })
}

function rn(t) {
    t.transactionManager.clear()
}

function sr(t, e = {}) {
    if (Bs(t, e, ["issuer", "clientId", "redirectUri", "state", "codeChallenge", "codeChallengeMethod", "activationToken", "recoveryToken"]) === !1) return !1;
    let {
        flow: n
    } = e;
    return Hs(t, n) !== !1
}

function Hs(t, e) {
    return !(e && e !== "default" && e !== "proceed" && e !== t.flow)
}

function Bs(t, e, r) {
    return !r.some(o => {
        let i = e[o];
        if (i && i !== t[o]) return !0
    })
}
var cd = y(x(), 1);
var ld = y(_(), 1);

function Ws(t) {
    return {
        meta: t,
        interactionHandle: t.interactionHandle,
        state: t.state
    }
}
async function ar(t, e = {}) {
    e = D(e);
    let r = Q(t, e);
    if (r ? .interactionHandle) return Ws(r);
    r = await et(t, Object.assign(Object.assign({}, r), e));
    let n = Fr(t),
        {
            clientId: o,
            redirectUri: i,
            state: s,
            scopes: a,
            withCredentials: c,
            codeChallenge: u,
            codeChallengeMethod: l,
            activationToken: f,
            recoveryToken: p,
            maxAge: m,
            acrValues: v,
            nonce: w
        } = r,
        S = e.clientSecret || t.options.clientSecret;
    c = c ? ? !0;
    let T = `${n}/v1/interact`,
        P = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
            client_id: o,
            scope: a.join(" "),
            redirect_uri: i,
            code_challenge: u,
            code_challenge_method: l,
            state: s
        }, f && {
            activation_token: f
        }), p && {
            recovery_token: p
        }), S && {
            client_secret: S
        }), m && {
            max_age: m
        }), v && {
            acr_values: v
        }), w && {
            nonce: w
        }),
        H = (await j(t, {
            method: "POST",
            url: T,
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            withCredentials: c,
            args: P
        })).interaction_handle,
        B = Object.assign(Object.assign({}, r), {
            interactionHandle: H,
            withCredentials: c,
            state: s,
            scopes: a,
            recoveryToken: p,
            activationToken: f
        });
    return Me(t, B), Ws(B)
}
var wd = y(x(), 1);
var Td = y(_(), 1);
var Jc = function(e) {
        return e.mutable !== !1
    },
    Qc = function(e) {
        var r, n;
        let o = {},
            i = [],
            s = {};
        if (!e.value) return i.push(e), {
            defaultParamsForAction: o,
            neededParamsForAction: i,
            immutableParamsForAction: s
        };
        for (let a of e.value) Jc(a) ? (i.push(a), (r = a.value) !== null && r !== void 0 && r && (o[a.name] = a.value)) : s[a.name] = (n = a.value) !== null && n !== void 0 ? n : "";
        return {
            defaultParamsForAction: o,
            neededParamsForAction: i,
            immutableParamsForAction: s
        }
    },
    qs = function(e) {
        e = Array.isArray(e) ? e : [e];
        let r = [],
            n = {},
            o = {};
        for (let i of e) {
            let {
                defaultParamsForAction: s,
                neededParamsForAction: a,
                immutableParamsForAction: c
            } = Qc(i);
            r.push(a), n[i.name] = s, o[i.name] = c
        }
        return {
            defaultParams: n,
            neededParams: r,
            immutableParams: o
        }
    };
var Xc = function(e, {
        actionDefinition: r,
        defaultParamsForAction: n = {},
        immutableParamsForAction: o = {},
        toPersist: i = {}
    }) {
        let s = r.href;
        return async function(a = {}) {
            var c, u;
            let l = {
                    "Content-Type": "application/json",
                    Accept: r.accepts || "application/ion+json"
                },
                f = JSON.stringify(Object.assign(Object.assign(Object.assign({}, n), a), o));
            try {
                let p = {
                    url: s,
                    method: r.method,
                    headers: l,
                    args: f,
                    withCredentials: (c = i ? .withCredentials) !== null && c !== void 0 ? c : !0
                };
                (r.name === "poll" || ((u = r.name) === null || u === void 0 ? void 0 : u.endsWith("-poll"))) && (p.pollingIntent = !0);
                let v = await j(e, p);
                return e.idx.makeIdxResponse(Object.assign({}, v), i, !0)
            } catch (p) {
                if (!(p instanceof z) || !p ? .xhr) throw p;
                let m = p.xhr,
                    v = m.responseJSON || JSON.parse(m.responseText),
                    w = m.headers["WWW-Authenticate"] || m.headers["www-authenticate"],
                    S = e.idx.makeIdxResponse(Object.assign({}, v), i, !1);
                return m.status === 401 && w === 'Oktadevicejwt realm="Okta Device"' && (S.stepUp = !0), S
            }
        }
    },
    cr = function(e, r, n) {
        let o = Xc,
            {
                defaultParams: i,
                neededParams: s,
                immutableParams: a
            } = qs(r),
            c = o(e, {
                actionDefinition: r,
                defaultParamsForAction: i[r.name],
                immutableParamsForAction: a[r.name],
                toPersist: n
            });
        return c.neededParams = s, c
    };
var Ks = function(e, r, n = {}) {
    return r.reduce((o, i) => Object.assign(Object.assign({}, o), {
        [i.name]: cr(e, i, n)
    }), {})
};
var Yc = /\$?(?<step>\w+)|(?:\[(?<index>\d+)\])/g;

function Gs({
    path: t,
    json: e
}) {
    var r, n, o;
    let i = [],
        s;
    for (;
        (s = Yc.exec(t)) !== null;) {
        let u = (n = (r = s ? .groups) === null || r === void 0 ? void 0 : r.step) !== null && n !== void 0 ? n : (o = s ? .groups) === null || o === void 0 ? void 0 : o.index;
        u && i.push(u)
    }
    if (i.length < 1) return;
    let a = i.pop(),
        c = e;
    for (let u of i)
        if (Object.prototype.hasOwnProperty.call(c, u)) {
            if (typeof c[u] != "object") return;
            c = c[u]
        }
    return c[a]
}
var Zc = {
        remediation: !0,
        context: !0
    },
    eu = function(e, r, n = {}) {
        let o = {},
            i = {};
        return Object.keys(r).filter(s => !Zc[s]).forEach(s => {
            if (!(typeof r[s] == "object" && !!r[s])) {
                i[s] = r[s];
                return
            }
            if (r[s].rel) {
                o[r[s].name] = cr(e, r[s], n);
                return
            }
            let c = r[s],
                {
                    value: u,
                    type: l
                } = c,
                f = te(c, ["value", "type"]);
            if (i[s] = Object.assign({
                    type: l
                }, f), l !== "object") {
                i[s].value = u;
                return
            }
            i[s].value = {}, Object.entries(u).forEach(([p, m]) => {
                m.rel ? o[`${s}-${p.name||p}`] = cr(e, m, n) : i[s].value[p] = m
            })
        }), {
            context: i,
            actions: o
        }
    },
    $s = (t, e) => {
        Object.keys(e).forEach(r => {
            if (r === "relatesTo") {
                let n = Array.isArray(e[r]) ? e[r][0] : e[r];
                if (typeof n == "string") {
                    let o = Gs({
                        path: n,
                        json: t
                    });
                    if (o) {
                        e[r] = o;
                        return
                    } else throw new d(`Cannot resolve relatesTo: ${n}`)
                }
            }
            Array.isArray(e[r]) && e[r].forEach(n => $s(t, n))
        })
    },
    tu = (t, e, r) => {
        if (e.rel) {
            let o = Ks(t, [e], r)[e.name];
            return Object.assign(Object.assign({}, e), {
                action: o
            })
        }
        return e
    },
    zs = function(e, r, n = {}) {
        var o;
        let i = ((o = r.remediation) === null || o === void 0 ? void 0 : o.value) || [];
        i.forEach(u => {
            var l;
            if (u.name === "launch-authenticator" && ((l = u ? .relatesTo) === null || l === void 0 ? void 0 : l[0]) === "authenticatorChallenge" && !r ? .authenticatorChallenge) {
                delete u.relatesTo;
                return
            }
            return $s(r, u)
        });
        let s = i.map(u => tu(e, u, n)),
            {
                context: a,
                actions: c
            } = eu(e, r, n);
        return {
            remediations: s,
            context: a,
            actions: c
        }
    };

function Js(t, e, r, n) {
    var o, i, s;
    let a = e,
        {
            remediations: c,
            context: u,
            actions: l
        } = zs(t, e, r),
        f = [...c],
        p = async function(w, S = {}) {
            let T = c.find(U => U.name === w);
            return T ? typeof T.action != "function" ? Promise.reject(`Current remediation cannot make form submit action: [${w}]`) : T.action(S) : Promise.reject(`Unknown remediation choice: [${w}]`)
        },
        m = w => w.name === "interaction_code",
        v = (s = (i = (o = a.successWithInteractionCode) === null || o === void 0 ? void 0 : o.value) === null || i === void 0 ? void 0 : i.find(m)) === null || s === void 0 ? void 0 : s.value;
    return {
        proceed: p,
        neededToProceed: f,
        actions: l,
        context: u,
        rawIdxState: a,
        interactionCode: v,
        toPersist: r,
        requestDidSucceed: n
    }
}
var Qs = {
    makeIdxState: Js
};
var Xs = function(e) {
    switch (e) {
        case "1.0.0":
            return Qs;
        case void 0:
        case null:
            throw new Error("Api version is required");
        default:
            throw new Error(`Unknown api version: ${e}.  Use an exact semver version.`)
    }
};

function To(t) {
    if (!t) throw new Error("version is required");
    if ((t ? ? "").replace(/[^0-9a-zA-Z._-]/, "") !== t || !t) throw new Error("invalid version supplied - version is required and uses semver syntax");
    Xs(t)
}

function ur(t, e, r, n) {
    var o;
    let i = (o = e ? .version) !== null && o !== void 0 ? o : Tt;
    To(i);
    let {
        makeIdxState: s
    } = Xs(i);
    return s(t, e, r, n)
}

function nn(t) {
    return t && t.version
}

function on(t) {
    return t instanceof z
}

function lr(t) {
    return t instanceof J
}

function So(t) {
    return t instanceof Y
}
var ep = y(x(), 1);
var rp = y(_(), 1);
async function Et(t, e = {}) {
    var r;
    let n, o, i = t.transactionManager.loadIdxResponse(e);
    if (i && (n = i.rawIdxResponse, o = i.requestDidSucceed), !n) {
        let a = e.version || Tt,
            c = po(t),
            {
                interactionHandle: u,
                stateHandle: l
            } = e,
            f = (r = e.withCredentials) !== null && r !== void 0 ? r : !0;
        try {
            o = !0, To(a);
            let p = `${c}/idp/idx/introspect`,
                m = l ? {
                    stateToken: l
                } : {
                    interactionHandle: u
                },
                v = {
                    "Content-Type": `application/ion+json; okta-version=${a}`,
                    Accept: `application/ion+json; okta-version=${a}`
                };
            n = await j(t, {
                method: "POST",
                url: p,
                headers: v,
                withCredentials: f,
                args: m
            })
        } catch (p) {
            if (on(p) && p.xhr && nn(p.xhr.responseJSON)) n = p.xhr.responseJSON, o = !1;
            else throw p
        }
    }
    let {
        withCredentials: s
    } = e;
    return ur(t, n, {
        withCredentials: s
    }, o)
}

function Ys(t) {
    var e;
    return (e = t.value) === null || e === void 0 ? void 0 : e.map(r => r.name)
}

function Zs(t) {
    var e;
    return (e = t.value) === null || e === void 0 ? void 0 : e.reduce((r, n) => (n.required && r.push(n.name), r), [])
}

function fr(t) {
    return t.charAt(0).toUpperCase() + t.substring(1)
}

function De(t) {
    return t.value.find(({
        name: e
    }) => e === "authenticator")
}

function Ao(t) {
    let e;
    if (Pe(t)) e = t;
    else if (typeof t == "string") e = {
        key: t
    };
    else throw new Error("Invalid format for authenticator");
    return e
}

function Se(t, e) {
    return !t || !e ? !1 : t.id && e.id ? t.id === e.id : t.key && e.key ? t.key === e.key : !1
}

function ea(t, e) {
    let r;
    for (let n of t)
        if (r = e.find(({
                relatesTo: o
            }) => o.key && o.key === n.key), r) break;
    return r
}
var b = class {
    constructor(e, r = {}, n = {}) {
        this.values = Object.assign({}, r), this.options = Object.assign({}, n), this.formatAuthenticators(), this.remediation = e
    }
    formatAuthenticators() {
        if (this.values.authenticators = this.values.authenticators || [], this.values.authenticators = this.values.authenticators.map(e => Ao(e)), this.values.authenticator) {
            let e = Ao(this.values.authenticator);
            this.values.authenticators.some(n => Se(e, n)) || this.values.authenticators.push(e)
        }
        this.values.authenticatorsData = this.values.authenticators.reduce((e, r) => (typeof r == "object" && Object.keys(r).length > 1 && e.push(r), e), this.values.authenticatorsData || [])
    }
    getName() {
        return this.remediation.name
    }
    canRemediate(e) {
        return !Zs(this.remediation).find(o => !this.hasData(o))
    }
    getData(e) {
        if (!e) return Ys(this.remediation).reduce((o, i) => (o[i] = this.getData(i), o), {});
        if (typeof this[`map${fr(e)}`] == "function") {
            let r = this[`map${fr(e)}`](this.remediation.value.find(({
                name: n
            }) => n === e));
            if (r) return r
        }
        if (this.map && this.map[e]) {
            let r = this.map[e];
            for (let n = 0; n < r.length; n++) {
                let o = this.values[r[n]];
                if (o) return o
            }
        }
        return this.values[e]
    }
    hasData(e) {
        return !!this.getData(e)
    }
    getNextStep(e, r) {
        let n = this.getName(),
            o = this.getInputs(),
            i = this.getAuthenticator(),
            s = i ? .type;
        return Object.assign(Object.assign({
            name: n,
            inputs: o
        }, s && {
            type: s
        }), i && {
            authenticator: i
        })
    }
    getInputs() {
        let e = [];
        return (this.remediation.value || []).forEach(n => {
            let o, {
                name: i,
                type: s,
                visible: a,
                messages: c
            } = n;
            if (a !== !1) {
                if (typeof this[`getInput${fr(i)}`] == "function") o = this[`getInput${fr(i)}`](n);
                else if (s !== "object") {
                    let u, l = (this.map ? this.map[i] : null) || [];
                    l.length === 1 ? u = l[0] : u = l.find(f => Object.keys(this.values).includes(f)), u && (o = Object.assign(Object.assign({}, n), {
                        name: u
                    }))
                }
                o || (o = n), Array.isArray(o) ? o.forEach(u => e.push(u)) : (c && (o.messages = c), e.push(o))
            }
        }), e
    }
    static getMessages(e) {
        var r, n;
        if (e.value) return (n = (r = e.value[0]) === null || r === void 0 ? void 0 : r.form) === null || n === void 0 ? void 0 : n.value.reduce((o, i) => (i.messages && (o = [...o, ...i.messages.value]), o), [])
    }
    getValuesAfterProceed() {
        let e = this.remediation.value || [],
            r = this.getInputs(),
            n = [...e, ...r];
        for (let o of n) delete this.values[o.name];
        return this.values
    }
    getAuthenticator() {
        var e, r;
        let n = (e = this.remediation.relatesTo) === null || e === void 0 ? void 0 : e.value;
        if (!n) return;
        let o = De(this.remediation);
        if (!o) return n;
        let i = o.form.value.find(({
                name: a
            }) => a === "id").value,
            s = (r = o.form.value.find(({
                name: a
            }) => a === "enrollmentId")) === null || r === void 0 ? void 0 : r.value;
        return Object.assign(Object.assign({}, n), {
            id: i,
            enrollmentId: s
        })
    }
};

function dr(t) {
    if (Array.isArray(t)) return t.map(r => typeof r == "string" || typeof r == "number" || typeof r == "boolean" ? r : dr(r));
    let e = {};
    for (let [r, n] of Object.entries(t))
        if (!(n === null || typeof n > "u"))
            if (typeof n == "object") {
                let o = Object.keys(n);
                if (["value", "form"].includes(r) && o.length === 1 && ["value", "form"].includes(o[0])) {
                    let i = dr(n);
                    Object.entries(i).forEach(([s, a]) => {
                        e[s] = a
                    })
                } else e[r] = dr(n)
            } else e[r] = n;
    return e
}
var tt = class extends b {
    canRemediate() {
        return typeof this.remediation.action != "function" ? !1 : !!(this.remediation.name === "poll" || this.remediation.name.endsWith("-poll") || this.options.step)
    }
    getData() {
        return this.getInputs().reduce((r, {
            name: n
        }) => (r[n] = this.values[n], r), {})
    }
    getNextStep(e, r) {
        let n = this.getName(),
            o = this.getInputs(),
            i = this.remediation,
            {
                href: s,
                method: a,
                rel: c,
                accepts: u,
                produces: l,
                value: f,
                action: p
            } = i,
            m = te(i, ["href", "method", "rel", "accepts", "produces", "value", "action"]);
        return p ? Object.assign(Object.assign(Object.assign({}, m), !!o.length && {
            inputs: o
        }), {
            action: async v => e.idx.proceed(Object.assign({
                step: n
            }, v))
        }) : Object.assign({}, this.remediation)
    }
    getInputs() {
        return (this.remediation.value || []).filter(({
            name: e
        }) => e !== "stateHandle").map(dr).map(e => (e.type = e.type || "string", e))
    }
};
var bo = {
    remediators: {},
    getFlowSpecification: function(t, e = "default") {
        return {
            remediators: {}
        }
    }
};

function ta(t) {
    Object.assign(bo, t)
}

function ra(t, e = "default") {
    return bo.getFlowSpecification(t, e)
}

function xt(t) {
    let {
        neededToProceed: e,
        interactionCode: r
    } = t;
    return !e.length && !r
}

function ru(t) {
    return t.neededToProceed.some(({
        name: e
    }) => e === "skip")
}

function nu(t) {
    return Object.keys(t.actions).some(e => e.includes("resend"))
}

function Eo(t) {
    if (!(!t || !Array.isArray(t))) return t.reduce((e, r) => {
        if (r.messages && (e = [...e, ...r.messages.value]), r.form) {
            let n = Eo(r.form.value) || [];
            e = [...e, ...n]
        }
        if (r.options) {
            let n = [];
            r.options.forEach(i => {
                !i.value || typeof i.value == "string" || (n = [...n, i.value])
            });
            let o = Eo(n) || [];
            e = [...e, ...o]
        }
        return e
    }, [])
}

function Oo(t, e) {
    var r;
    let n = [],
        {
            rawIdxState: o,
            neededToProceed: i
        } = t,
        s = (r = o.messages) === null || r === void 0 ? void 0 : r.value.map(c => c);
    if (s && (n = [...n, ...s]), !e.useGenericRemediator)
        for (let c of i) {
            let u = Eo(c.value);
            u && (n = [...n, ...u])
        }
    let a = {};
    return n = n.reduce((c, u) => {
        var l;
        let f = (l = u.i18n) === null || l === void 0 ? void 0 : l.key;
        return f && a[f] && u.message === a[f].message || (a[f] = u, c = [...c, u]), c
    }, []), n
}

function na(t) {
    let e = [],
        {
            actions: r,
            neededToProceed: n
        } = t;
    return r["currentAuthenticator-recover"] && e.push(ue.PASSWORD_RECOVERY), n.some(({
        name: o
    }) => o === "select-enroll-profile") && e.push(ue.REGISTRATION), n.some(({
        name: o
    }) => o === "redirect-idp") && e.push(ue.SOCIAL_IDP), n.some(({
        name: o
    }) => o === "unlock-account") && e.push(ue.ACCOUNT_UNLOCK), e
}

function oa(t, e, r) {
    var n;
    let o = [],
        i = Object.values(bo.remediators).reduce((s, a) => (a.remediationName && (s[a.remediationName] = a), s), {});
    for (let s of e.neededToProceed) {
        let a = xo(s, {
            useGenericRemediator: r,
            remediators: i
        });
        if (a) {
            let c = new a(s);
            o.push(c.getNextStep(t, e.context))
        }
    }
    for (let [s] of Object.entries(e.actions || {})) {
        let a = {
            name: s,
            action: async c => t.idx.proceed({
                actions: [{
                    name: s,
                    params: c
                }]
            })
        };
        if (s.startsWith("currentAuthenticator")) {
            let [c, u] = ao(s, "-"), l = e.rawIdxState[c].value[u], f = te(l, ["href", "method", "rel", "accepts", "produces"]), p = (n = l.value) === null || n === void 0 ? void 0 : n.filter(m => m.name !== "stateHandle");
            a = Object.assign(Object.assign(Object.assign({}, f), p && {
                value: p
            }), a)
        }
        o.push(a)
    }
    return o
}

function ia(t, e, r) {
    let o = (t.neededToProceed || []).find(s => s.name === e);
    return o ? o.value.reduce((s, a) => {
        let {
            name: c,
            value: u
        } = a;
        return c === "stateHandle" ? s[c] = u : s[c] = r[c], s
    }, {}) : (N(`filterValuesForRemediation: "${e}" did not match any remediations`), r)
}

function xo(t, e) {
    let {
        useGenericRemediator: r,
        remediators: n
    } = e;
    if (t) return r ? tt : n[t.name]
}

function sn(t, e, r) {
    let n = r.remediators,
        o = r.useGenericRemediator,
        {
            neededToProceed: i,
            context: s
        } = t,
        a;
    if (r.step) {
        let u = i.find(({
            name: l
        }) => l === r.step);
        if (u) {
            let l = xo(u, r);
            return l ? new l(u, e, r) : void 0
        } else {
            N(`step "${r.step}" did not match any remediations`);
            return
        }
    }
    let c = [];
    if (o) c.push(new tt(i[0], e, r));
    else
        for (let u of i) {
            if (!Object.keys(n).includes(u.name)) continue;
            let f = xo(u, r);
            if (a = new f(u, e, r), a.canRemediate(s)) return a;
            c.push(a)
        }
    return c[0]
}

function an(t, e, r) {
    let n = e.getNextStep(t, r.context),
        o = ru(r),
        i = nu(r);
    return Object.assign(Object.assign(Object.assign({}, n), o && {
        canSkip: o
    }), i && {
        canResend: i
    })
}

function pr(t, e, r = {}) {
    let n = xt(e),
        o = Oo(e, r);
    if (n) return {
        idxResponse: e,
        terminal: n,
        messages: o
    }; {
        let i = sn(e, {}, r),
            s = i && an(t, i, e);
        return Object.assign({
            idxResponse: e,
            messages: o
        }, s && {
            nextStep: s
        })
    }
}

function ou(t, e) {
    return Object.keys(e.actions).find(r => !!t.resend && r.includes("-resend"))
}

function iu(t) {
    return Object.assign(Object.assign({}, t), {
        resend: void 0
    })
}

function su(t, e) {
    let r = t.actions || [];
    return r = r.filter(n => typeof n == "string" ? n !== e : n.name !== e), Object.assign(Object.assign({}, t), {
        actions: r
    })
}
async function hr(t, e, r, n) {
    let {
        neededToProceed: o,
        interactionCode: i
    } = e, {
        flow: s
    } = n;
    if (i) return {
        idxResponse: e
    };
    let a = sn(e, r, n),
        c = ou(r, e),
        l = [...n.actions || [], ...c && [c] || []];
    if (l)
        for (let v of l) {
            let w = {};
            typeof v != "string" && (w = v.params || {}, v = v.name);
            let S = iu(r),
                T = su(n, v);
            if (typeof e.actions[v] == "function") return e = await e.actions[v](w), e.requestDidSucceed === !1 ? pr(t, e, n) : v === "cancel" ? {
                idxResponse: e,
                canceled: !0
            } : hr(t, e, S, T);
            if (o.find(({
                    name: U
                }) => U === v)) return e = await e.proceed(v, w), e.requestDidSucceed === !1 ? pr(t, e, n) : hr(t, e, r, T)
        }
    let f = xt(e);
    if (f) return {
        idxResponse: e,
        terminal: f
    };
    if (!a) {
        if (n.step) return r = ia(e, n.step, r), e = await e.proceed(n.step, r), e.requestDidSucceed === !1 ? pr(t, e, n) : {
            idxResponse: e
        };
        if (s === "default") return {
            idxResponse: e
        };
        throw new d(`
      No remediation can match current flow, check policy settings in your org.
      Remediations: [${o.reduce((v,w)=>v?v+" ,"+w.name:w.name,"")}]
    `)
    }
    if (!a.canRemediate()) {
        let v = an(t, a, e);
        return {
            idxResponse: e,
            nextStep: v
        }
    }
    let p = a.getName(),
        m = a.getData();
    if (e = await e.proceed(p, m), e.requestDidSucceed === !1) return pr(t, e, n);
    if (r = a.getValuesAfterProceed(), n = Object.assign(Object.assign({}, n), {
            step: void 0
        }), n.useGenericRemediator && !e.interactionCode && !xt(e)) {
        let v = sn(e, r, n),
            w = an(t, v, e);
        return {
            idxResponse: e,
            nextStep: w
        }
    }
    return hr(t, e, r, n)
}

function au(t) {
    let e = ["flow", "remediators", "actions", "withCredentials", "step", "useGenericRemediator", "exchangeCodeForTokens"],
        r = Object.assign({}, t);
    return e.forEach(n => {
        delete r[n]
    }), r
}

function cu(t, e) {
    var r, n, o, i;
    let {
        options: s
    } = e;
    s = Object.assign(Object.assign({}, t.options.idx), s);
    let {
        flow: a,
        withCredentials: c,
        remediators: u,
        actions: l
    } = s, f = Re.PENDING;
    if (a = a || ((n = (r = t.idx).getFlow) === null || n === void 0 ? void 0 : n.call(r)) || "default", a) {
        (i = (o = t.idx).setFlow) === null || i === void 0 || i.call(o, a);
        let p = ra(t, a);
        c = typeof c < "u" ? c : p.withCredentials, u = u || p.remediators, l = l || p.actions
    }
    return Object.assign(Object.assign({}, e), {
        options: Object.assign(Object.assign({}, s), {
            flow: a,
            withCredentials: c,
            remediators: u,
            actions: l
        }),
        status: f
    })
}
async function uu(t, e) {
    let {
        options: r
    } = e, {
        stateHandle: n,
        withCredentials: o,
        version: i,
        state: s,
        scopes: a,
        recoveryToken: c,
        activationToken: u,
        maxAge: l,
        acrValues: f,
        nonce: p,
        useGenericRemediator: m
    } = r, v, w = Q(t, {
        state: s,
        recoveryToken: c,
        activationToken: u
    });
    if (n) v = await Et(t, {
        withCredentials: o,
        version: i,
        stateHandle: n,
        useGenericRemediator: m
    });
    else {
        let S = w ? .interactionHandle;
        if (!S) {
            t.transactionManager.clear();
            let T = await ar(t, {
                withCredentials: o,
                state: s,
                scopes: a,
                activationToken: u,
                recoveryToken: c,
                maxAge: l,
                acrValues: f,
                nonce: p
            });
            S = T.interactionHandle, w = T.meta
        }
        v = await Et(t, {
            withCredentials: o,
            version: i,
            interactionHandle: S,
            useGenericRemediator: m
        })
    }
    return Object.assign(Object.assign({}, e), {
        idxResponse: v,
        meta: w
    })
}
async function lu(t, e) {
    let {
        idxResponse: r,
        options: n,
        values: o
    } = e, {
        autoRemediate: i,
        remediators: s,
        actions: a,
        flow: c,
        step: u,
        useGenericRemediator: l
    } = n;
    if (!(i !== !1 && (s || a || u))) return e;
    o = Object.assign(Object.assign({}, o), {
        stateHandle: r.rawIdxState.stateHandle
    });
    let {
        idxResponse: p,
        nextStep: m,
        canceled: v
    } = await hr(t, r, o, {
        remediators: s,
        actions: a,
        flow: c,
        step: u,
        useGenericRemediator: l
    });
    return r = p, Object.assign(Object.assign({}, e), {
        idxResponse: r,
        nextStep: m,
        canceled: v
    })
}
async function fu(t, e) {
    let {
        meta: r,
        idxResponse: n
    } = e, {
        interactionCode: o
    } = n, {
        clientId: i,
        codeVerifier: s,
        ignoreSignature: a,
        redirectUri: c,
        urls: u,
        scopes: l
    } = r;
    return (await t.token.exchangeCodeForTokens({
        interactionCode: o,
        clientId: i,
        codeVerifier: s,
        ignoreSignature: a,
        redirectUri: c,
        scopes: l
    }, u)).tokens
}
async function du(t, e) {
    let {
        options: r,
        idxResponse: n,
        canceled: o,
        status: i
    } = e, {
        exchangeCodeForTokens: s
    } = r, a = !1, c = !1, u = !0, l, f, p, m, v, w;
    if (n && (a = !!(n.requestDidSucceed || n.stepUp), p = na(n), m = oa(t, n, r.useGenericRemediator), v = Oo(n, r), w = xt(n)), w) {
        i = Re.TERMINAL;
        let S = Object.keys(n.actions).length > 0,
            T = !!v.find(U => U.class === "ERROR");
        !S && !T && n.requestDidSucceed === !0 ? c = !0 : a = !!S, u = !1
    } else o ? (i = Re.CANCELED, c = !0) : n ? .interactionCode && (l = n.interactionCode, s === !1 ? (i = Re.SUCCESS, c = !1) : (f = await fu(t, e), i = Re.SUCCESS, c = !0));
    return Object.assign(Object.assign({}, e), {
        status: i,
        interactionCode: l,
        tokens: f,
        shouldSaveResponse: a,
        shouldClearTransaction: c,
        clearSharedStorage: u,
        enabledFeatures: p,
        availableSteps: m,
        messages: v,
        terminal: w
    })
}
async function re(t, e = {}) {
    var r;
    let n = {
        options: e,
        values: au(e)
    };
    n = cu(t, n), n = await uu(t, n), n = await lu(t, n), n = await du(t, n);
    let {
        idxResponse: o,
        meta: i,
        shouldSaveResponse: s,
        shouldClearTransaction: a,
        clearSharedStorage: c,
        status: u,
        enabledFeatures: l,
        availableSteps: f,
        tokens: p,
        nextStep: m,
        messages: v,
        error: w,
        interactionCode: S
    } = n;
    if (a) t.transactionManager.clear({
        clearSharedStorage: c
    });
    else if (Me(t, Object.assign({}, i)), s) {
        let {
            rawIdxState: q,
            requestDidSucceed: ft
        } = o;
        t.transactionManager.saveIdxResponse({
            rawIdxResponse: q,
            requestDidSucceed: ft,
            stateHandle: (r = o.context) === null || r === void 0 ? void 0 : r.stateHandle,
            interactionHandle: i ? .interactionHandle
        })
    }
    let {
        actions: T,
        context: P,
        neededToProceed: U,
        proceed: O,
        rawIdxState: H,
        requestDidSucceed: B,
        stepUp: me
    } = o || {};
    return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
        status: u
    }, i && {
        meta: i
    }), l && {
        enabledFeatures: l
    }), f && {
        availableSteps: f
    }), p && {
        tokens: p
    }), m && {
        nextStep: m
    }), v && v.length && {
        messages: v
    }), w && {
        error: w
    }), me && {
        stepUp: me
    }), {
        interactionCode: S,
        actions: T,
        context: P,
        neededToProceed: U,
        proceed: O,
        rawIdxState: H,
        requestDidSucceed: B
    })
}
async function ko(t, e = {}) {
    return e.password && !e.authenticator && (e.authenticator = ae.OKTA_PASSWORD), re(t, Object.assign(Object.assign({}, e), {
        flow: "authenticate"
    }))
}
var ne = class {
    constructor(e) {
        this.meta = e
    }
};
var bt = class extends ne {
    canVerify(e) {
        return !!(e.credentials || e.verificationCode || e.otp)
    }
    mapCredentials(e) {
        let {
            credentials: r,
            verificationCode: n,
            otp: o
        } = e;
        if (!(!r && !n && !o)) return r || {
            passcode: n || o
        }
    }
    getInputs(e) {
        var r;
        return Object.assign(Object.assign({}, (r = e.form) === null || r === void 0 ? void 0 : r.value[0]), {
            name: "verificationCode",
            type: "string",
            required: e.required
        })
    }
};
var cn = class extends bt {
    mapCredentials(e) {
        let {
            verificationCode: r
        } = e;
        if (r) return {
            totp: r
        }
    }
};
var Ot = class extends ne {
    canVerify(e) {
        return !!(e.credentials || e.password || e.passcode)
    }
    mapCredentials(e) {
        let {
            credentials: r,
            password: n,
            passcode: o,
            revokeSessions: i
        } = e;
        if (!(!r && !n && !o)) return r || {
            passcode: o || n,
            revokeSessions: i
        }
    }
    getInputs(e) {
        var r, n;
        let o = [Object.assign(Object.assign({}, (r = e.form) === null || r === void 0 ? void 0 : r.value[0]), {
            name: "password",
            type: "string",
            required: e.required
        })];
        return ((n = e.form) === null || n === void 0 ? void 0 : n.value.find(s => s.name === "revokeSessions")) && o.push({
            name: "revokeSessions",
            type: "boolean",
            label: "Sign me out of all other devices",
            required: !1
        }), o
    }
};
var un = class extends ne {
    canVerify(e) {
        let {
            credentials: r
        } = e;
        if (r && r.questionKey && r.answer) return !0;
        let {
            questionKey: n,
            question: o,
            answer: i
        } = e;
        return !!(n && i) || !!(o && i)
    }
    mapCredentials(e) {
        let {
            questionKey: r,
            question: n,
            answer: o
        } = e;
        if (!(!o || !r && !n)) return {
            questionKey: n ? "custom" : r,
            question: n,
            answer: o
        }
    }
    getInputs() {
        return [{
            name: "questionKey",
            type: "string",
            required: !0
        }, {
            name: "question",
            type: "string",
            label: "Create a security question"
        }, {
            name: "answer",
            type: "string",
            label: "Answer",
            required: !0
        }]
    }
};
var ln = class extends ne {
    canVerify(e) {
        let {
            credentials: r
        } = e;
        if (r && r.answer) return !0;
        let {
            answer: n
        } = e;
        return !!n
    }
    mapCredentials(e) {
        let {
            answer: r
        } = e;
        if (r) return {
            questionKey: this.meta.contextualData.enrolledQuestion.questionKey,
            answer: r
        }
    }
    getInputs() {
        return [{
            name: "answer",
            type: "string",
            label: "Answer",
            required: !0
        }]
    }
};
var fn = class extends ne {
    canVerify(e) {
        let {
            credentials: r
        } = e, n = r || e, {
            clientData: o,
            attestation: i
        } = n;
        return !!(o && i)
    }
    mapCredentials(e) {
        let {
            credentials: r,
            clientData: n,
            attestation: o
        } = e;
        if (!(!r && !n && !o)) return r || {
            clientData: n,
            attestation: o
        }
    }
    getInputs() {
        return [{
            name: "clientData",
            type: "string",
            required: !0,
            visible: !1,
            label: "Client Data"
        }, {
            name: "attestation",
            type: "string",
            required: !0,
            visible: !1,
            label: "Attestation"
        }]
    }
};
var dn = class extends ne {
    canVerify(e) {
        let {
            credentials: r
        } = e, n = r || e, {
            clientData: o,
            authenticatorData: i,
            signatureData: s
        } = n;
        return !!(o && i && s)
    }
    mapCredentials(e) {
        let {
            credentials: r,
            authenticatorData: n,
            clientData: o,
            signatureData: i
        } = e;
        if (!(!r && !n && !o && !i)) return r || {
            authenticatorData: n,
            clientData: o,
            signatureData: i
        }
    }
    getInputs() {
        return [{
            name: "authenticatorData",
            type: "string",
            label: "Authenticator Data",
            required: !0,
            visible: !1
        }, {
            name: "clientData",
            type: "string",
            label: "Client Data",
            required: !0,
            visible: !1
        }, {
            name: "signatureData",
            type: "string",
            label: "Signature Data",
            required: !0,
            visible: !1
        }]
    }
};

function sa(t) {
    var e, r;
    let n = t.relatesTo,
        o = n ? .value || {};
    switch (o.key) {
        case ae.OKTA_PASSWORD:
            return new Ot(o);
        case ae.SECURITY_QUESTION:
            return !((e = o.contextualData) === null || e === void 0) && e.enrolledQuestion ? new ln(o) : new un(o);
        case ae.OKTA_VERIFY:
            return new cn(o);
        case ae.WEBAUTHN:
            return !((r = o.contextualData) === null || r === void 0) && r.challengeData ? new dn(o) : new fn(o);
        default:
            return new bt(o)
    }
}
var Ue = class extends b {
    constructor(e, r = {}) {
        super(e, r), this.authenticator = sa(e)
    }
    getNextStep(e, r) {
        var n;
        let o = super.getNextStep(e, r),
            i = (n = r ? .authenticatorEnrollments) === null || n === void 0 ? void 0 : n.value;
        return Object.assign(Object.assign({}, o), {
            authenticatorEnrollments: i
        })
    }
    canRemediate() {
        return this.authenticator.canVerify(this.values)
    }
    mapCredentials() {
        return this.authenticator.mapCredentials(this.values)
    }
    getInputCredentials(e) {
        return this.authenticator.getInputs(e)
    }
    getValuesAfterProceed() {
        return this.values = super.getValuesAfterProceed(), Object.keys(this.values).filter(r => r !== "credentials").reduce((r, n) => Object.assign(Object.assign({}, r), {
            [n]: this.values[n]
        }), {})
    }
};
var kt = (() => {
    class t extends Ue {}
    return t.remediationName = "enroll-authenticator", t
})();
var ve = (() => {
    class t extends b {
        canRemediate() {
            return !!this.values.startPolling || this.options.step === "enroll-poll"
        }
        getNextStep(r, n) {
            let o = super.getNextStep(r, n),
                i = this.getAuthenticator();
            return !i && n ? .currentAuthenticator && (i = n.currentAuthenticator.value), Object.assign(Object.assign({}, o), {
                authenticator: i,
                poll: {
                    required: !0,
                    refresh: this.remediation.refresh
                }
            })
        }
        getValuesAfterProceed() {
            return Object.keys(this.values).filter(n => n !== "startPolling").reduce((n, o) => Object.assign(Object.assign({}, n), {
                [o]: this.values[o]
            }), {})
        }
    }
    return t.remediationName = "enroll-poll", t
})();
var _t = (() => {
    class t extends b {
        canRemediate() {
            if (this.values.channel) return !0;
            if (this.values.authenticator) {
                let {
                    id: r,
                    channel: n
                } = this.values.authenticator;
                if (r && n) return !0
            }
            return !1
        }
        getNextStep(r, n) {
            let o = super.getNextStep(r, n),
                i = n.currentAuthenticator.value;
            return Object.assign(Object.assign({}, o), {
                authenticator: i
            })
        }
        getData() {
            var r;
            return {
                authenticator: {
                    id: this.remediation.value[0].value.form.value[0].value,
                    channel: ((r = this.values.authenticator) === null || r === void 0 ? void 0 : r.channel) || this.values.channel
                },
                stateHandle: this.values.stateHandle
            }
        }
        getValuesAfterProceed() {
            this.values = super.getValuesAfterProceed(), delete this.values.authenticators;
            let r = this.values.channel ? "channel" : "authenticator";
            return Object.keys(this.values).filter(o => o !== r).reduce((o, i) => Object.assign(Object.assign({}, o), {
                [i]: this.values[i]
            }), {})
        }
    }
    return t.remediationName = "select-enrollment-channel", t
})();
var Rt = (() => {
    class t extends b {
        getInputEmail() {
            return [{
                name: "email",
                type: "string",
                required: !0,
                label: "Email"
            }]
        }
        getInputPhoneNumber() {
            return [{
                name: "phoneNumber",
                type: "string",
                required: !0,
                label: "Phone Number"
            }]
        }
        canRemediate() {
            return !!(this.values.email || this.values.phoneNumber)
        }
        getNextStep(r, n) {
            let o = super.getNextStep(r, n),
                i = n.currentAuthenticator.value;
            return Object.assign(Object.assign({}, o), {
                authenticator: i
            })
        }
        getData() {
            return {
                stateHandle: this.values.stateHandle,
                email: this.values.email,
                phoneNumber: this.values.phoneNumber
            }
        }
        getValuesAfterProceed() {
            return Object.keys(this.values).filter(n => !["email", "phoneNumber"].includes(n)).reduce((n, o) => Object.assign(Object.assign({}, n), {
                [o]: this.values[o]
            }), {})
        }
    }
    return t.remediationName = "enrollment-channel-data", t
})();
var Ne = (() => {
    class t extends Ue {}
    return t.remediationName = "challenge-authenticator", t
})();
var Pt = (() => {
    class t extends ve {
        canRemediate() {
            return !!this.values.startPolling || this.options.step === "challenge-poll"
        }
    }
    return t.remediationName = "challenge-poll", t
})();
var pn = (() => {
    class t extends Ue {}
    return t.remediationName = "reset-authenticator", t
})();
var hn = (() => {
    class t extends b {
        constructor(r, n = {}, o = {}) {
            super(r, n, o), this.authenticator = null, this.getCredentialsFromRemediation() && (this.authenticator = this.authenticator = new Ot({}))
        }
        canRemediate() {
            if (this.authenticator && !this.authenticator.canVerify(this.values)) return !1;
            let r = this.getData().userProfile;
            return r ? this.remediation.value.find(({
                name: o
            }) => o === "userProfile").form.value.reduce((o, i) => (i.required && (o = o && !!r[i.name]), o), !0) : !1
        }
        getCredentialsFromRemediation() {
            return this.remediation.value.find(({
                name: r
            }) => r === "credentials")
        }
        mapUserProfile({
            form: {
                value: r
            }
        }) {
            let o = r.map(({
                name: i
            }) => i).reduce((i, s) => this.values[s] ? Object.assign(Object.assign({}, i), {
                [s]: this.values[s]
            }) : i, {});
            if (Object.keys(o).length !== 0) return o
        }
        mapCredentials() {
            let r = this.authenticator && this.authenticator.mapCredentials(this.values);
            if (r) return r
        }
        getInputUserProfile(r) {
            return [...r.form.value]
        }
        getInputCredentials(r) {
            return [...r.form.value]
        }
        getErrorMessages(r) {
            return r.value[0].form.value.reduce((n, o) => (o.messages && n.push(o.messages.value[0].message), n), [])
        }
    }
    return t.remediationName = "enroll-profile", t
})();
var Ae = (() => {
    class t extends b {
        constructor() {
            super(...arguments), this.map = {
                identifier: ["username"]
            }
        }
        canRemediate() {
            let {
                identifier: r
            } = this.getData();
            return !!r
        }
        mapCredentials() {
            let {
                credentials: r,
                password: n
            } = this.values;
            if (!(!r && !n)) return r || {
                passcode: n
            }
        }
        getInputCredentials(r) {
            return Object.assign(Object.assign({}, r.form.value[0]), {
                name: "password",
                required: r.required
            })
        }
    }
    return t.remediationName = "identify", t
})();
var Le = (() => {
    class t extends b {
        mapCredentials() {
            let {
                newPassword: r
            } = this.values;
            if (r) return {
                passcode: r
            }
        }
        getInputCredentials(r) {
            let o = this.getAuthenticator().type === "password" ? "newPassword" : "verificationCode";
            return Object.assign(Object.assign({}, r.form.value[0]), {
                name: o
            })
        }
    }
    return t.remediationName = "reenroll-authenticator", t
})();
var je = (() => {
    class t extends Le {}
    return t.remediationName = "reenroll-authenticator-warning", t
})();
var mn = (() => {
    class t extends b {
        canRemediate() {
            return !1
        }
        getNextStep() {
            let {
                name: r,
                type: n,
                idp: o,
                href: i
            } = this.remediation;
            return {
                name: r,
                type: n,
                idp: o,
                href: i
            }
        }
    }
    return t.remediationName = "redirect-idp", t
})();
var Fe = class extends b {
    findMatchedOption(e, r) {
        let n;
        for (let o of e)
            if (n = r.find(({
                    relatesTo: i
                }) => i.key && i.key === o.key), n) break;
        return n
    }
    canRemediate(e) {
        var r, n;
        let {
            authenticators: o,
            authenticator: i
        } = this.values, s = De(this.remediation), {
            options: a
        } = s;
        if (!o || !o.length) return !1;
        if (Pe(i) && i.id) return !0;
        let c = this.findMatchedOption(o, a);
        if (c) {
            let u = e ? .currentAuthenticator && e ? .currentAuthenticator.value.id === ((r = c.relatesTo) === null || r === void 0 ? void 0 : r.id),
                l = e ? .currentAuthenticatorEnrollment && e ? .currentAuthenticatorEnrollment.value.id === ((n = c.relatesTo) === null || n === void 0 ? void 0 : n.id);
            return !u && !l
        }
        return !1
    }
    mapAuthenticator(e) {
        let {
            authenticators: r,
            authenticator: n
        } = this.values;
        if (Pe(n) && n.id) return this.selectedAuthenticator = n, n;
        let {
            options: o
        } = e, i = ea(r, o);
        return this.selectedAuthenticator = i.relatesTo, this.selectedOption = i, {
            id: i ? .value.form.value.find(({
                name: s
            }) => s === "id").value
        }
    }
    getInputAuthenticator(e) {
        return {
            name: "authenticator",
            type: "string",
            options: e.options.map(({
                label: n,
                relatesTo: o
            }) => ({
                label: n,
                value: o.key
            }))
        }
    }
    getValuesAfterProceed() {
        this.values = super.getValuesAfterProceed();
        let e = this.values.authenticators.filter(r => Se(r, this.selectedAuthenticator) !== !0);
        return Object.assign(Object.assign({}, this.values), {
            authenticators: e
        })
    }
};
var Ve = (() => {
    class t extends Fe {
        constructor(r, n = {}, o = {}) {
            var i;
            super(r, n, o);
            let s = this.options.flow === "recoverPassword";
            ((i = De(r).options) === null || i === void 0 ? void 0 : i.some(({
                relatesTo: c
            }) => c ? .key === ae.OKTA_PASSWORD)) && (s || this.values.password) && (this.values.authenticators = [...this.values.authenticators || [], {
                key: ae.OKTA_PASSWORD
            }])
        }
    }
    return t.remediationName = "select-authenticator-authenticate", t
})();
var He = (() => {
    class t extends Fe {}
    return t.remediationName = "select-authenticator-enroll", t
})();
var gn = (() => {
    class t extends Fe {
        constructor() {
            super(...arguments), this.map = {
                identifier: ["username"]
            }
        }
        canRemediate() {
            return !!this.getData("identifier") && super.canRemediate()
        }
        mapAuthenticator(r) {
            var n, o, i;
            let s = super.mapAuthenticator(r),
                a = (n = this.selectedOption) === null || n === void 0 ? void 0 : n.value.form.value.find(({
                    name: u
                }) => u === "methodType"),
                c = this.values.methodType || a ? .value || ((i = (o = a ? .options) === null || o === void 0 ? void 0 : o[0]) === null || i === void 0 ? void 0 : i.value);
            return c ? Object.assign(Object.assign({}, s), {
                methodType: c
            }) : s
        }
        getInputUsername() {
            return {
                name: "username",
                type: "string"
            }
        }
    }
    return t.remediationName = "select-authenticator-unlock-account", t
})();
var vn = (() => {
    class t extends b {
        canRemediate() {
            return !0
        }
    }
    return t.remediationName = "select-enroll-profile", t
})();
var It = class extends b {
    constructor(e, r = {}) {
        super(e, r), this.authenticator = this.getAuthenticator(), this.formatAuthenticatorData()
    }
    formatAuthenticatorData() {
        if (this.getAuthenticatorData()) this.values.authenticatorsData = this.values.authenticatorsData.map(r => Se(this.authenticator, r) ? this.mapAuthenticatorDataFromValues(r) : r);
        else {
            let r = this.mapAuthenticatorDataFromValues();
            r && this.values.authenticatorsData.push(r)
        }
    }
    getAuthenticatorData() {
        return this.values.authenticatorsData.find(e => Se(this.authenticator, e))
    }
    canRemediate() {
        return this.values.authenticatorsData.some(e => Se(this.authenticator, e))
    }
    mapAuthenticatorDataFromValues(e) {
        let {
            methodType: r,
            authenticator: n
        } = this.values;
        !r && Pe(n) && (r = n ? .methodType);
        let {
            id: o,
            enrollmentId: i
        } = this.authenticator, s = Object.assign(Object.assign({
            id: o,
            enrollmentId: i
        }, e && e), r && {
            methodType: r
        });
        return s.methodType ? s : null
    }
    getAuthenticatorFromRemediation() {
        return this.remediation.value.find(({
            name: r
        }) => r === "authenticator")
    }
    getValuesAfterProceed() {
        this.values = super.getValuesAfterProceed();
        let e = this.values.authenticatorsData.filter(r => Se(this.authenticator, r) !== !0);
        return Object.assign(Object.assign({}, this.values), {
            authenticatorsData: e
        })
    }
};
var Be = (() => {
    class t extends It {
        mapAuthenticator() {
            return this.getAuthenticatorData()
        }
        getInputAuthenticator() {
            let r = this.getAuthenticatorFromRemediation(),
                n = r.form.value.find(({
                    name: i
                }) => i === "methodType");
            return n && n.options ? {
                name: "methodType",
                type: "string",
                required: !0,
                options: n.options
            } : [...r.form.value]
        }
        getValuesAfterProceed() {
            return this.values = super.getValuesAfterProceed(), Object.keys(this.values).filter(n => n !== "authenticator").reduce((n, o) => Object.assign(Object.assign({}, n), {
                [o]: this.values[o]
            }), {})
        }
    }
    return t.remediationName = "authenticator-verification-data", t
})();
var We = (() => {
    class t extends It {
        mapAuthenticator() {
            let r = this.getAuthenticatorData();
            return {
                id: De(this.remediation).form.value.find(({
                    name: o
                }) => o === "id").value,
                methodType: r.methodType,
                phoneNumber: r.phoneNumber
            }
        }
        getInputAuthenticator(r) {
            return [{
                name: "methodType",
                type: "string"
            }, {
                name: "phoneNumber",
                label: "Phone Number",
                type: "string"
            }].map(n => {
                let o = r.form.value.find(i => i.name === n.name);
                return Object.assign(Object.assign({}, o), n)
            })
        }
        mapAuthenticatorDataFromValues(r) {
            r = super.mapAuthenticatorDataFromValues(r);
            let {
                phoneNumber: n
            } = this.values;
            if (!(!r && !n)) return Object.assign(Object.assign({}, r && r), n && {
                phoneNumber: n
            })
        }
    }
    return t.remediationName = "authenticator-enrollment-data", t
})();
var Ct = (() => {
    class t extends b {
        canRemediate() {
            return !!this.values.skip || this.options.step === "skip"
        }
    }
    return t.remediationName = "skip", t
})();
var _o = {
    identify: Ae,
    "select-authenticator-authenticate": Ve,
    "select-authenticator-enroll": He,
    "authenticator-enrollment-data": We,
    "authenticator-verification-data": Be,
    "enroll-authenticator": kt,
    "challenge-authenticator": Ne,
    "challenge-poll": Pt,
    "reenroll-authenticator": Le,
    "reenroll-authenticator-warning": je,
    "enroll-poll": ve,
    "select-enrollment-channel": _t,
    "enrollment-channel-data": Rt,
    "redirect-idp": mn,
    skip: Ct
};
var aa = {
    identify: Ae,
    "identify-recovery": Ae,
    "select-authenticator-authenticate": Ve,
    "select-authenticator-enroll": He,
    "challenge-authenticator": Ne,
    "authenticator-verification-data": Be,
    "authenticator-enrollment-data": We,
    "reset-authenticator": pn,
    "reenroll-authenticator": Le,
    "reenroll-authenticator-warning": je,
    "enroll-poll": ve
};
var ca = {
    "select-enroll-profile": vn,
    "enroll-profile": hn,
    "authenticator-enrollment-data": We,
    "select-authenticator-enroll": He,
    "enroll-poll": ve,
    "select-enrollment-channel": _t,
    "enrollment-channel-data": Rt,
    "enroll-authenticator": kt,
    skip: Ct
};
var ua = {
    identify: Ae,
    "select-authenticator-unlock-account": gn,
    "select-authenticator-authenticate": Ve,
    "challenge-authenticator": Ne,
    "challenge-poll": Pt,
    "authenticator-verification-data": Be,
    "reenroll-authenticator-warning": je
};

function Mt(t, e = "default") {
    let r, n, o = !0;
    switch (e) {
        case "register":
        case "signup":
        case "enrollProfile":
            r = ca, o = !1;
            break;
        case "recoverPassword":
        case "resetPassword":
            r = aa, n = ["currentAuthenticator-recover", "currentAuthenticatorEnrollment-recover"], o = !1;
            break;
        case "unlockAccount":
            r = ua, o = !1, n = ["unlock-account"];
            break;
        case "authenticate":
        case "login":
        case "signin":
            r = _o;
            break;
        default:
            r = _o;
            break
    }
    return {
        flow: e,
        remediators: r,
        actions: n,
        withCredentials: o
    }
}
async function Ro(t, e) {
    let r = t.transactionManager.load(),
        n = Mt(t, r.flow);
    return re(t, Object.assign(Object.assign(Object.assign({}, e), n), {
        actions: ["cancel"]
    }))
}

function mr(t) {
    var e = /\+/g,
        r = /([^&=]+)=?([^&]*)/g,
        n = t || "";
    n.charAt(0) === "#" && n.charAt(1) === "/" && (n = n.substring(2)), (n.charAt(0) === "#" || n.charAt(0) === "?") && (n = n.substring(1));
    for (var o = {}, i; i = r.exec(n), !!i;) {
        var s = i[1],
            a = i[2];
        s === "id_token" || s === "access_token" || s === "code" ? o[s] = a : o[s] = decodeURIComponent(a.replace(e, " "))
    }
    return o
}
var Po = class extends X {
    constructor(e, r) {
        super(`Enter the OTP code in the originating client: ${r}`), this.name = "EmailVerifyCallbackError", this.state = e, this.otp = r
    }
};

function Io(t) {
    return t.name === "EmailVerifyCallbackError"
}

function wn(t) {
    return /(otp=)/i.test(t) && /(state=)/i.test(t)
}

function yn(t) {
    return mr(t)
}
async function Co(t, e) {
    if (wn(e)) {
        let {
            state: r,
            otp: n
        } = yn(e);
        if (t.idx.canProceed({
                state: r
            })) return await t.idx.proceed({
            state: r,
            otp: n
        });
        throw new Po(r, n)
    }
}

function gr(t, e = {}) {
    return !!(Q(t, e) || e.stateHandle)
}
async function Dt(t, e = {}) {
    if (!gr(t, e)) throw new d("Unable to proceed: saved transaction could not be loaded");
    let {
        flow: r,
        state: n
    } = e;
    if (!r) {
        let o = Q(t, {
            state: n
        });
        r = o ? .flow
    }
    return re(t, Object.assign(Object.assign({}, e), {
        flow: r
    }))
}
async function Tn(t, e = {}) {
    var r;
    let {
        withCredentials: n,
        exchangeCodeForTokens: o
    } = e, i = await Dt(t, {
        startPolling: !0,
        withCredentials: n,
        exchangeCodeForTokens: o
    }), s = Q(t), a = (r = s ? .remediations) === null || r === void 0 ? void 0 : r.find(c => c.includes("poll"));
    return a ? .length || N("No polling remediations available at the current IDX flow stage"), Number.isInteger(e.refresh) ? new Promise(function(c, u) {
        setTimeout(async function() {
            var l, f;
            try {
                let p = (f = (l = i.nextStep) === null || l === void 0 ? void 0 : l.poll) === null || f === void 0 ? void 0 : f.refresh;
                c(p ? Tn(t, {
                    refresh: p
                }) : i)
            } catch (p) {
                u(p)
            }
        }, e.refresh)
    }) : i
}
async function qe(t, e = {}) {
    return t.transactionManager.clear(), re(t, Object.assign({
        exchangeCodeForTokens: !1
    }, e))
}
async function Mo(t, e = {}) {
    if (!ir(t)) {
        let {
            enabledFeatures: r
        } = await qe(t, Object.assign(Object.assign({}, e), {
            flow: "register",
            autoRemediate: !1
        }));
        if (!e.activationToken && r && !r.includes(ue.REGISTRATION)) throw new d("Registration is not supported based on your current org configuration.")
    }
    return re(t, Object.assign(Object.assign({}, e), {
        flow: "register"
    }))
}
async function Do(t, e = {}) {
    let r = Mt(t, "recoverPassword");
    return re(t, Object.assign(Object.assign({}, e), r))
}
async function Uo(t, e) {
    let r = t.transactionManager.load();
    if (!r) throw new d("No transaction data was found in storage");
    let {
        codeVerifier: n,
        state: o
    } = r, {
        searchParams: i
    } = new URL(e), s = i.get("state"), a = i.get("interaction_code"), c = i.get("error");
    if (c) throw new J(c, i.get("error_description"));
    if (s !== o) throw new d("State in redirect uri does not match with transaction state");
    if (!a) throw new d("Unable to parse interaction_code from the url");
    let {
        tokens: u
    } = await t.token.exchangeCodeForTokens({
        interactionCode: a,
        codeVerifier: n
    });
    t.tokenManager.setTokens(u)
}
async function No(t, e = {}) {
    if (e.flow = "unlockAccount", !ir(t)) {
        let {
            enabledFeatures: r
        } = await qe(t, Object.assign(Object.assign({}, e), {
            autoRemediate: !1
        }));
        if (r && !r.includes(ue.ACCOUNT_UNLOCK)) throw new d("Self Service Account Unlock is not supported based on your current org configuration.")
    }
    return re(t, Object.assign({}, e))
}

function vr(t) {
    return t.name !== "OAuthError" ? !1 : t.errorCode === "interaction_required"
}

function Lo(t) {
    return lr(t) && t.errorCode === "invalid_grant" && t.errorSummary === "The refresh token is invalid or expired."
}

function la(t) {
    return /[?&#](id|access)_token=/.test(t)
}

function fa(t) {
    return /[?&#]code=/.test(t)
}

function da(t) {
    return /[?&#]interaction_code=/.test(t)
}

function pa(t) {
    return /[?&#]error=/.test(t) || /[?&#]error_description/.test(t)
}

function ha(t, e) {
    var r = e.options;
    return !t || !r.redirectUri ? !1 : t.indexOf(r.redirectUri) === 0
}

function jo(t) {
    return t.pkce || t.responseType === "code" || t.responseMode === "query"
}

function Sn(t, e) {
    let r = !1;
    return Array.isArray(e.responseType) && e.responseType.length ? r = e.responseType.indexOf(t) >= 0 : r = e.responseType === t, r
}

function Fo(t) {
    var e = jo(t),
        r = e && t.responseMode !== "fragment";
    return r ? window.location.search : window.location.hash
}

function rt(t) {
    if (!ha(window.location.href, t)) return !1;
    var e = jo(t.options),
        r = Fo(t.options);
    if (pa(r)) return !0;
    if (e) {
        var n = fa(r) || da(r);
        return n
    }
    return la(window.location.hash)
}

function Vo(t, e) {
    if (!e) {
        if (!rt(t)) return !1;
        e = Fo(t.options)
    }
    return /(error=interaction_required)/i.test(e)
}
var ty = y(x(), 1);
var ny = y(_(), 1);
var Ho = {};
dt(Ho, {
    AuthenticatorEnrollmentData: () => We,
    AuthenticatorVerificationData: () => Be,
    ChallengeAuthenticator: () => Ne,
    ChallengePoll: () => Pt,
    EnrollAuthenticator: () => kt,
    EnrollPoll: () => ve,
    EnrollProfile: () => hn,
    EnrollmentChannelData: () => Rt,
    GenericRemediator: () => tt,
    Identify: () => Ae,
    ReEnrollAuthenticator: () => Le,
    ReEnrollAuthenticatorWarning: () => je,
    RedirectIdp: () => mn,
    Remediator: () => b,
    ResetAuthenticator: () => pn,
    SelectAuthenticatorAuthenticate: () => Ve,
    SelectAuthenticatorEnroll: () => He,
    SelectAuthenticatorUnlockAccount: () => gn,
    SelectEnrollProfile: () => vn,
    SelectEnrollmentChannel: () => _t,
    Skip: () => Ct
});

function Bo(t) {
    ta({
        remediators: Ho,
        getFlowSpecification: Mt
    });
    let e = qe.bind(null, t);
    return {
        interact: ar.bind(null, t),
        introspect: Et.bind(null, t),
        makeIdxResponse: ur.bind(null, t),
        authenticate: ko.bind(null, t),
        register: Mo.bind(null, t),
        start: e,
        startTransaction: e,
        poll: Tn.bind(null, t),
        proceed: Dt.bind(null, t),
        cancel: Ro.bind(null, t),
        recoverPassword: Do.bind(null, t),
        handleInteractionCodeRedirect: Uo.bind(null, t),
        isInteractionRequired: Vo.bind(null, t),
        isInteractionRequiredError: vr,
        handleEmailVerifyCallback: Co.bind(null, t),
        isEmailVerifyCallback: wn,
        parseEmailVerifyCallback: yn,
        isEmailVerifyCallbackError: Io,
        getSavedTransactionMeta: Q.bind(null, t),
        createTransactionMeta: et.bind(null, t),
        getTransactionMeta: tn.bind(null, t),
        saveTransactionMeta: Me.bind(null, t),
        clearTransactionMeta: rn.bind(null, t),
        isTransactionMetaValid: sr,
        setFlow: n => {
            t.options.flow = n
        },
        getFlow: () => t.options.flow,
        canProceed: gr.bind(null, t),
        unlockAccount: No.bind(null, t)
    }
}
var ma = y(x(), 1);

function wr(t) {
    class e {
        constructor(...n) {
            let o = new t(n.length ? n[0] || {} : {});
            this.options = D(o), this.emitter = new ma.default, this.features = nr
        }
    }
    return e.features = nr, e.constants = Qr, e.features = e.prototype.features = nr, Object.assign(e, {
        constants: Qr
    }), e
}

function yr(t, e) {
    return class extends t {
        constructor(...n) {
            super(...n);
            let {
                storageManager: o,
                cookies: i,
                storageUtil: s
            } = this.options;
            this.storageManager = new e(o, i, s)
        }
        clearStorage() {}
    }
}
var Tr = class {
    constructor() {
        this.environments = ["okta-auth-js/7.14.1"], this.maybeAddNodeEnvironment()
    }
    addEnvironment(e) {
        this.environments.push(e)
    }
    getHttpHeader() {
        return {
            "X-Okta-User-Agent-Extended": this.environments.join(" ")
        }
    }
    getVersion() {
        return "7.14.1"
    }
    maybeAddNodeEnvironment() {
        if (k() || !process || !process.versions) return;
        let {
            node: e
        } = process.versions;
        this.environments.push(`nodejs/${e}`)
    }
};

function Wo(t, e, r) {
    t.options.headers = t.options.headers || {}, t.options.headers[e] = r
}

function Sr(t) {
    return class extends t {
        constructor(...r) {
            super(...r), this._oktaUserAgent = new Tr, this.http = {
                setRequestHeader: Wo.bind(null, this)
            }
        }
        setHeaders(r) {
            this.options.headers = Object.assign({}, this.options.headers, r)
        }
        getIssuerOrigin() {
            return this.options.issuer.split("/oauth2/")[0]
        }
        webfinger(r) {
            var n = "/.well-known/webfinger" + W(r),
                o = {
                    headers: {
                        Accept: "application/jrd+json"
                    }
                };
            return le(this, n, o)
        }
    }
}
var bn = {};
dt(bn, {
    atob: () => rr,
    base64ToBase64Url: () => Ar,
    base64UrlDecode: () => xr,
    base64UrlToBase64: () => An,
    base64UrlToBuffer: () => ot,
    base64UrlToString: () => Er,
    btoa: () => oe,
    bufferToBase64Url: () => we,
    getOidcHash: () => En,
    stringToBase64Url: () => Ee,
    stringToBuffer: () => nt,
    verifyToken: () => xn,
    webcrypto: () => L
});

function Ee(t) {
    var e = oe(t);
    return Ar(e)
}

function Ar(t) {
    return t.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")
}

function An(t) {
    return t.replace(/-/g, "+").replace(/_/g, "/")
}

function Er(t) {
    var e = An(t);
    switch (e.length % 4) {
        case 0:
            break;
        case 2:
            e += "==";
            break;
        case 3:
            e += "=";
            break;
        default:
            throw new d("Not a valid Base64Url")
    }
    var r = rr(e);
    try {
        return decodeURIComponent(escape(r))
    } catch {
        return r
    }
}

function nt(t) {
    for (var e = new Uint8Array(t.length), r = 0; r < t.length; r++) e[r] = t.charCodeAt(r);
    return e
}

function xr(t) {
    return rr(An(t))
}

function ot(t) {
    return Uint8Array.from(xr(t), e => e.charCodeAt(0))
}

function we(t) {
    return oe(new Uint8Array(t).reduce((e, r) => e + String.fromCharCode(r), ""))
}

function En(t) {
    var e = new TextEncoder().encode(t);
    return L.subtle.digest("SHA-256", e).then(function(r) {
        var n = new Uint8Array(r),
            o = n.slice(0, 16),
            i = String.fromCharCode.apply(null, o),
            s = Ee(i);
        return s
    })
}

function xn(t, e) {
    e = I(e);
    var r = "jwk",
        n = {
            name: "RSASSA-PKCS1-v1_5",
            hash: {
                name: "SHA-256"
            }
        },
        o = !0,
        i = ["verify"];
    return delete e.use, L.subtle.importKey(r, e, n, o, i).then(function(s) {
        var a = t.split("."),
            c = nt(a[0] + "." + a[1]),
            u = xr(a[2]),
            l = nt(u);
        return L.subtle.verify(n, s, l, c)
    })
}
var xe = class {
    constructor(e = {
        quiet: !1
    }) {
        this.queue = [], this.running = !1, this.options = e
    }
    push(e, r, ...n) {
        return new Promise((o, i) => {
            this.queue.length > 0 && this.options.quiet !== !1 && N("Async method is being called but another async method is already running. The new method will be delayed until the previous method completes."), this.queue.push({
                method: e,
                thisObject: r,
                args: n,
                resolve: o,
                reject: i
            }), this.run()
        })
    }
    run() {
        if (!this.running && this.queue.length !== 0) {
            this.running = !0;
            var e = this.queue.shift(),
                r = e.method.apply(e.thisObject, e.args);
            so(r) ? r.then(e.resolve, e.reject).finally(() => {
                this.running = !1, this.run()
            }) : (e.resolve(r), this.running = !1, this.run())
        }
    }
};
var Zx = y(x(), 1);
var rb = y(_(), 1);

function pu(t) {
    return ("0" + t.toString(16)).substr(-2)
}

function hu(t) {
    var e = new Uint8Array(Math.ceil(t / 2));
    L.getRandomValues(e);
    var r = Array.from(e, pu).join("");
    return r.slice(0, t)
}

function mu(t) {
    var e = t || "";
    return e.length < 43 && (e = e + hu(43 - e.length)), encodeURIComponent(e).slice(0, 128)
}

function gu(t) {
    var e = new TextEncoder().encode(t);
    return L.subtle.digest("SHA-256", e).then(function(r) {
        var n = String.fromCharCode.apply(null, new Uint8Array(r)),
            o = Ee(n);
        return o
    })
}
var Ke = {
    DEFAULT_CODE_CHALLENGE_METHOD: yt,
    generateVerifier: mu,
    computeChallenge: gu
};

function Ut(t) {
    var e = t.split("."),
        r;
    try {
        r = {
            header: JSON.parse(Er(e[0])),
            payload: JSON.parse(Er(e[1])),
            signature: e[2]
        }
    } catch {
        throw new d("Malformed token")
    }
    return r
}

function be(t) {
    let {
        pkce: e,
        clientId: r,
        redirectUri: n,
        responseType: o,
        responseMode: i,
        scopes: s,
        acrValues: a,
        maxAge: c,
        state: u,
        ignoreSignature: l,
        dpop: f
    } = t.options, p = k() ? window.location.href : void 0;
    return D({
        pkce: e,
        clientId: r,
        redirectUri: n || p,
        responseType: o || ["token", "id_token"],
        responseMode: i,
        state: u || Ze(),
        nonce: lo(),
        scopes: s || ["openid", "email"],
        acrValues: a,
        maxAge: c,
        ignoreSignature: l,
        dpop: f
    })
}
var fS = y(x(), 1);
var pS = y(_(), 1);
var ET = y(x(), 1);
var bT = y(_(), 1);
var vu = "OktaAuthJs",
    qo = "DPoPKeys";

function On(t) {
    return (lr(t) || So(t)) && t.errorCode === "use_dpop_nonce"
}
async function wu(t, e, r) {
    let n = Ee(JSON.stringify(t)),
        o = Ee(JSON.stringify(e)),
        i = await L.subtle.sign({
            name: r.algorithm.name
        }, r, nt(`${n}.${o}`));
    return `${n}.${o}.${Ar(we(i))}`
}

function ga(t = 32) {
    return [...L.getRandomValues(new Uint8Array(t))].map(e => e.toString(16)).join("")
}
async function yu() {
    let t = {
        name: "RSASSA-PKCS1-v1_5",
        hash: "SHA-256",
        modulusLength: 2048,
        publicExponent: new Uint8Array([1, 0, 1])
    };
    return L.subtle.generateKey(t, !1, ["sign", "verify"])
}
async function Tu(t) {
    let e = new TextEncoder().encode(t),
        r = await L.subtle.digest("SHA-256", e);
    return oe(String.fromCharCode.apply(null, new Uint8Array(r))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")
}

function Su() {
    return new Promise((t, e) => {
        try {
            let n = window.indexedDB.open(vu, 1);
            n.onerror = function() {
                e(n.error)
            }, n.onupgradeneeded = function() {
                n.result.createObjectStore(qo)
            }, n.onsuccess = function() {
                let o = n.result,
                    i = o.transaction(qo, "readwrite");
                i.onerror = function() {
                    e(i.error)
                };
                let s = i.objectStore(qo);
                t(s), i.oncomplete = function() {
                    o.close()
                }
            }
        } catch (r) {
            e(r)
        }
    })
}
async function kn(t, ...e) {
    let r = await Su();
    return new Promise((n, o) => {
        let i = r[t](...e);
        i.onsuccess = function() {
            n(i)
        }, i.onerror = function() {
            o(i.error)
        }
    })
}
async function Au(t, e) {
    return await kn("add", e, t), e
}
async function Nt(t) {
    if (t) {
        let e = await kn("get", t);
        if (e.result) return e.result
    }
    throw new d(`Unable to locate dpop key pair required for refresh${t?` (${t})`:""}`)
}
async function _n(t) {
    await kn("delete", t)
}
async function va() {
    await kn("clear")
}
async function wa() {
    let t = ga(4),
        e = await yu();
    return await Au(t, e), {
        keyPair: e,
        keyPairId: t
    }
}
async function Ko(t, e) {
    var r;
    let n = !1,
        {
            accessToken: o,
            refreshToken: i
        } = e;
    t === "access" && o && o.tokenType === "DPoP" && !i && (n = !0), t === "refresh" && i && !o && (n = !0);
    let s = (r = o ? .dpopPairId) !== null && r !== void 0 ? r : i ? .dpopPairId;
    n && s && await _n(s)
}
async function Go({
    keyPair: t,
    url: e,
    method: r,
    nonce: n,
    accessToken: o
}) {
    let {
        kty: i,
        crv: s,
        e: a,
        n: c,
        x: u,
        y: l
    } = await L.subtle.exportKey("jwk", t.publicKey), f = {
        alg: "RS256",
        typ: "dpop+jwt",
        jwk: {
            kty: i,
            crv: s,
            e: a,
            n: c,
            x: u,
            y: l
        }
    }, p = {
        htm: r,
        htu: e,
        iat: Math.floor(Date.now() / 1e3),
        jti: ga()
    };
    return n && (p.nonce = n), o && (p.ath = await Tu(o)), wu(f, p, t.privateKey)
}
async function ya({
    keyPair: t,
    url: e,
    method: r,
    nonce: n
}) {
    let o = {
        keyPair: t,
        url: e,
        method: r
    };
    return n && (o.nonce = n), Go(o)
}

function Eu(t) {
    if (!t.clientId) throw new d("A clientId must be specified in the OktaAuth constructor to get a token");
    if (!t.redirectUri) throw new d("The redirectUri passed to /authorize must also be passed to /token");
    if (!t.authorizationCode && !t.interactionCode) throw new d("An authorization code (returned from /authorize) must be passed to /token");
    if (!t.codeVerifier) throw new d('The "codeVerifier" (generated and saved by your app) must be passed to /token')
}

function xu(t, e) {
    var r = D({
        client_id: e.clientId,
        redirect_uri: e.redirectUri,
        grant_type: e.interactionCode ? "interaction_code" : "authorization_code",
        code_verifier: e.codeVerifier
    });
    e.interactionCode ? r.interaction_code = e.interactionCode : e.authorizationCode && (r.code = e.authorizationCode);
    let {
        clientSecret: n
    } = t.options;
    return n && (r.client_secret = n), W(r).slice(1)
}
async function $o(t, {
    url: e,
    data: r,
    nonce: n,
    dpopKeyPair: o
}) {
    var i, s;
    let a = "POST",
        c = {
            "Content-Type": "application/x-www-form-urlencoded"
        };
    if (t.options.dpop) {
        if (!o) throw new d("DPoP is configured but no key pair was provided");
        let u = await ya({
            url: e,
            method: a,
            nonce: n,
            keyPair: o
        });
        c.DPoP = u
    }
    try {
        return await j(t, {
            url: e,
            method: a,
            args: r,
            headers: c
        })
    } catch (u) {
        if (On(u) && !n) {
            let l = (i = u.resp) === null || i === void 0 ? void 0 : i.headers["dpop-nonce"];
            if (!l) throw new z({
                errorSummary: "No `dpop-nonce` header found when required"
            }, (s = u.resp) !== null && s !== void 0 ? s : void 0);
            return $o(t, {
                url: e,
                data: r,
                dpopKeyPair: o,
                nonce: l
            })
        }
        throw u
    }
}
async function zo(t, e, r) {
    Eu(e);
    var n = xu(t, e);
    let o = {
        url: r.tokenUrl,
        data: n,
        dpopKeyPair: e ? .dpopKeyPair
    };
    return $o(t, o)
}
async function Jo(t, e, r) {
    let n = Object.entries({
            client_id: e.clientId,
            grant_type: "refresh_token",
            scope: r.scopes.join(" "),
            refresh_token: r.refreshToken
        }).map(function([s, a]) {
            return s + "=" + encodeURIComponent(a)
        }).join("&"),
        o = r.tokenUrl;
    e.extraParams && Object.keys(e.extraParams).length >= 1 && (o += W(e.extraParams));
    let i = {
        url: o,
        data: n,
        dpopKeyPair: e ? .dpopKeyPair
    };
    return $o(t, i)
}
var CT = y(x(), 1);
var DT = y(_(), 1);

function Ge(t, e) {
    var r = e || t.options.issuer;
    return le(t, r + "/.well-known/openid-configuration", {
        cacheResponse: !0
    })
}

function Qo(t, e, r) {
    var n = t.storageManager.getHttpCache(t.options.cookies);
    return Ge(t, e).then(function(o) {
        var i = o.jwks_uri,
            s = n.getStorage(),
            a = s[i];
        if (a && Date.now() / 1e3 < a.expiresAt) {
            var c = ht(a.response.keys, {
                kid: r
            });
            if (c) return c
        }
        return n.clearStorage(i), le(t, i, {
            cacheResponse: !0
        }).then(function(u) {
            var l = ht(u.keys, {
                kid: r
            });
            if (l) return l;
            throw new d("The key id, " + r + ", was not found in the server's keys")
        })
    })
}

function Xo(t, e, r) {
    let n = r.clientId,
        o = r.issuer,
        i = r.nonce,
        s = r.acrValues;
    if (!e || !o || !n) throw new d("The jwt, iss, and aud arguments are all required");
    if (i && e.nonce !== i) throw new d("OAuth flow response nonce doesn't match request nonce");
    let a = Math.floor(Date.now() / 1e3);
    if (e.iss !== o) throw new d("The issuer [" + e.iss + "] does not match [" + o + "]");
    if (Array.isArray(e.aud) && e.aud.indexOf(n) < 0 || !Array.isArray(e.aud) && e.aud !== n) throw new d("The audience [" + e.aud + "] does not match [" + n + "]");
    if (s && e.acr !== s) throw new d("The acr [" + e.acr + "] does not match acr_values [" + s + "]");
    if (e.iat > e.exp) throw new d("The JWT expired before it was issued");
    if (!t.options.ignoreLifetime) {
        if (a - t.options.maxClockSkew > e.exp) throw new d("The JWT expired and is no longer valid");
        if (e.iat > a + t.options.maxClockSkew) throw new d("The JWT was issued in the future")
    }
}
async function br(t, e, r) {
    if (!e || !e.idToken) throw new d("Only idTokens may be verified");
    let n = Ut(e.idToken),
        o = r ? .issuer || t.options.issuer,
        {
            issuer: i
        } = await Ge(t, o),
        s = Object.assign({
            clientId: t.options.clientId,
            ignoreSignature: t.options.ignoreSignature
        }, r, {
            issuer: i
        });
    if (Xo(t, n.payload, s), s.ignoreSignature == !0 || !t.features.isTokenVerifySupported()) return e;
    let a = await Qo(t, e.issuer, n.header.kid);
    if (!await xn(e.idToken, a)) throw new d("The token signature is not valid");
    if (r && r.accessToken && e.claims.at_hash && await En(r.accessToken) !== e.claims.at_hash) throw new d("Token hash verification failed");
    return e
}
var tS = y(x(), 1);
var nS = y(_(), 1);

function bu(t, e) {
    if (t.error && t.error_description) throw new J(t.error, t.error_description);
    if (t.state !== e.state) throw new d("OAuth flow response state doesn't match request state")
}
async function de(t, e, r, n) {
    var o, i;
    if (t.options.pkce !== !1 && (r.code || r.interaction_code)) return t.token.exchangeCodeForTokens(Object.assign({}, e, {
        authorizationCode: r.code,
        interactionCode: r.interaction_code
    }), n);
    e = e || be(t), n = n || G(t, e);
    let a = e.responseType || [];
    !Array.isArray(a) && a !== "none" && (a = [a]);
    let c;
    r.scope ? c = r.scope.split(" ") : c = I(e.scopes);
    let u = e.clientId || t.options.clientId;
    if (bu(r, e), e.dpop) {
        let {
            allowBearerTokens: T
        } = (i = (o = t.options) === null || o === void 0 ? void 0 : o.dpopOptions) !== null && i !== void 0 ? i : {
            allowBearerTokens: !1
        };
        if (!T && r.token_type !== "DPoP") throw new d('Unable to parse OAuth flow response: DPoP was configured but "token_type" was not DPoP')
    }
    let l = {},
        f = r.expires_in,
        p = r.token_type,
        m = r.access_token,
        v = r.id_token,
        w = r.refresh_token,
        S = Math.floor(Date.now() / 1e3);
    if (m) {
        let T = t.token.decode(m);
        l.accessToken = {
            accessToken: m,
            claims: T.payload,
            expiresAt: Number(f) + S,
            tokenType: p,
            scopes: c,
            authorizeUrl: n.authorizeUrl,
            userinfoUrl: n.userinfoUrl
        }, e.dpopPairId && (l.accessToken.dpopPairId = e.dpopPairId), e.extraParams && (l.accessToken.extraParams = e.extraParams)
    }
    if (w && (l.refreshToken = {
            refreshToken: w,
            expiresAt: Number(f) + S,
            scopes: c,
            tokenUrl: n.tokenUrl,
            authorizeUrl: n.authorizeUrl,
            issuer: n.issuer
        }, e.dpopPairId && (l.refreshToken.dpopPairId = e.dpopPairId), e.extraParams && (l.refreshToken.extraParams = e.extraParams)), v) {
        let T = t.token.decode(v),
            P = {
                idToken: v,
                claims: T.payload,
                expiresAt: T.payload.exp - T.payload.iat + S,
                scopes: c,
                authorizeUrl: n.authorizeUrl,
                issuer: n.issuer,
                clientId: u
            };
        e.extraParams && (P.extraParams = e.extraParams);
        let U = {
            clientId: u,
            issuer: n.issuer,
            nonce: e.nonce,
            accessToken: m,
            acrValues: e.acrValues
        };
        e.ignoreSignature !== void 0 && (U.ignoreSignature = e.ignoreSignature), await br(t, P, U), l.idToken = P
    }
    if (a.indexOf("token") !== -1 && !l.accessToken) throw new d('Unable to parse OAuth flow response: response type "token" was requested but "access_token" was not returned.');
    if (a.indexOf("id_token") !== -1 && !l.idToken) throw new d('Unable to parse OAuth flow response: response type "id_token" was requested but "id_token" was not returned.');
    return {
        tokens: l,
        state: r.state,
        code: r.code,
        responseType: a
    }
}
async function Rn(t, e, r) {
    r = r || G(t, e), e = Object.assign({}, be(t), I(e));
    let {
        authorizationCode: n,
        interactionCode: o,
        codeVerifier: i,
        clientId: s,
        redirectUri: a,
        scopes: c,
        ignoreSignature: u,
        state: l,
        acrValues: f,
        dpop: p,
        dpopPairId: m,
        extraParams: v
    } = e, w = {
        clientId: s,
        redirectUri: a,
        authorizationCode: n,
        interactionCode: o,
        codeVerifier: i,
        dpop: p
    }, S = ["token"];
    c.indexOf("openid") !== -1 && S.push("id_token");
    let T = {
        clientId: s,
        redirectUri: a,
        scopes: c,
        responseType: S,
        ignoreSignature: u,
        acrValues: f,
        extraParams: v
    };
    try {
        if (p)
            if (m) {
                let O = await Nt(m);
                w.dpopKeyPair = O, T.dpop = p, T.dpopPairId = m
            } else {
                let {
                    keyPair: O,
                    keyPairId: H
                } = await wa();
                w.dpopKeyPair = O, T.dpop = p, T.dpopPairId = H
            }
        let P = await zo(t, w, r),
            U = await de(t, T, P, r);
        return U.code = n, U.state = l, U
    } finally {
        t.transactionManager.clear()
    }
}
var xS = y(x(), 1);
var OS = y(_(), 1);
async function Yo(t, e, r) {
    if (e || (e = (await t.tokenManager.getTokens()).accessToken), r || (r = (await t.tokenManager.getTokens()).idToken), !e || !ee(e)) return Promise.reject(new d("getUserInfo requires an access token object"));
    if (!r || !ie(r)) return Promise.reject(new d("getUserInfo requires an ID token object"));
    let n = {
        url: e.userinfoUrl,
        method: "GET",
        accessToken: e.accessToken
    };
    if (t.options.dpop) {
        let o = await t.getDPoPAuthorizationHeaders(Object.assign(Object.assign({}, n), {
            accessToken: e
        }));
        n.headers = o, delete n.accessToken
    }
    return j(t, n).then(o => o.sub === r.claims.sub ? o : Promise.reject(new d("getUserInfo request was rejected due to token mismatch"))).catch(function(o) {
        var i;
        if (o instanceof Y && !t.options.dpop) {
            let {
                error: s,
                errorDescription: a
            } = o;
            throw new J(s, a)
        }
        if (!t.options.dpop) {
            let s = o;
            if (o instanceof z && (!((i = o ? .meta) === null || i === void 0) && i.wwwAuthHeader) && (s = Y.parseHeader(o.meta.wwwAuthHeader)), s instanceof Y) {
                let {
                    error: a,
                    errorDescription: c
                } = s;
                throw new J(a, c)
            }
        }
        throw o
    })
}
var Ta = 12e4;

function Pn(t, e, r) {
    t.addEventListener ? t.addEventListener(e, r) : t.attachEvent("on" + e, r)
}

function In(t, e, r) {
    t.removeEventListener ? t.removeEventListener(e, r) : t.detachEvent("on" + e, r)
}

function Zo(t) {
    var e = document.createElement("iframe");
    return e.style.display = "none", e.src = t, document.body.appendChild(e)
}

function Cn(t, e) {
    var r = e.popupTitle || "External Identity Provider User Authentication",
        n = "toolbar=no, scrollbars=yes, resizable=yes, top=100, left=500, width=600, height=600";
    return window.open(t, r, n)
}

function Mn(t, e, r) {
    var n, o, i = new Promise(function(s, a) {
        n = function(u) {
            if (!(!u.data || u.data.state !== r)) {
                if (u.origin !== t.getIssuerOrigin()) return a(new d("The request does not match client configuration"));
                s(u.data)
            }
        }, Pn(window, "message", n), o = setTimeout(function() {
            a(new d("OAuth flow timed out"))
        }, e || Ta)
    });
    return i.finally(function() {
        clearTimeout(o), In(window, "message", n)
    })
}

function ei(t, e, r, n) {
    let o;
    return new Promise((s, a) => {
        r.onmessage = c => {
            if (!(!c.isTrusted || !c.data)) {
                if (typeof c.data == "object" && n === c.data.state) return s(Object.assign({}, c.data));
                a(new d("Unable to complete auth code exchange"))
            }
        }, o = setTimeout(function() {
            a(new d("OAuth flow timed out"))
        }, e || Ta)
    }).finally(() => {
        clearTimeout(o), r.close()
    })
}

function Sa(t) {
    if (!t.features.isPKCESupported()) {
        var e = "PKCE requires a modern browser with encryption support running in a secure context.";
        throw t.features.isHTTPS() || (e += `
The current page is not being served with HTTPS protocol. PKCE requires secure HTTPS protocol.`), t.features.hasTextEncoder() || (e += `
"TextEncoder" is not defined. To use PKCE, you may need to include a polyfill/shim for this browser.`), new d(e)
    }
}
async function Aa(t, e) {
    e = e || t.options.codeChallengeMethod || yt;
    var n = (await Ge(t)).code_challenge_methods_supported || [];
    if (n.indexOf(e) === -1) throw new d("Invalid code_challenge_method");
    return e
}
async function Ea(t, e) {
    let {
        codeVerifier: r,
        codeChallenge: n,
        codeChallengeMethod: o
    } = e;
    return n = n || t.options.codeChallenge, n || (Sa(t), r = r || Ke.generateVerifier(), n = await Ke.computeChallenge(r)), o = await Aa(t, o), e = Object.assign(Object.assign({}, e), {
        responseType: "code",
        codeVerifier: r,
        codeChallenge: n,
        codeChallengeMethod: o
    }), e
}
async function $e(t, e = {}) {
    let r = be(t);
    if (e = Object.assign(Object.assign({}, r), e), e.dpop && !t.features.isDPoPSupported()) throw new d("DPoP has been configured, but is not supported by browser");
    return e.pkce === !1 ? e : Ea(t, e)
}

function xa(t) {
    if (!t.clientId) throw new d("A clientId must be specified in the OktaAuth constructor to get a token");
    if (ge(t.responseType) && t.responseType.indexOf(" ") !== -1) throw new d("Multiple OAuth responseTypes must be defined as an array");
    var e = {
        client_id: t.clientId,
        code_challenge: t.codeChallenge,
        code_challenge_method: t.codeChallengeMethod,
        display: t.display,
        idp: t.idp,
        idp_scope: t.idpScope,
        login_hint: t.loginHint,
        max_age: t.maxAge,
        nonce: t.nonce,
        prompt: t.prompt,
        redirect_uri: t.redirectUri,
        response_mode: t.responseMode,
        response_type: t.responseType,
        sessionToken: t.sessionToken,
        state: t.state,
        acr_values: t.acrValues,
        enroll_amr_values: t.enrollAmrValues
    };
    if (e = D(e), ["idp_scope", "response_type", "enroll_amr_values"].forEach(function(r) {
            Array.isArray(e[r]) && (e[r] = e[r].join(" "))
        }), t.responseType.indexOf("id_token") !== -1 && t.scopes.indexOf("openid") === -1) throw new d("openid scope must be specified in the scopes argument when requesting an id_token");
    return t.scopes && (e.scope = t.scopes.join(" ")), e
}

function it(t) {
    var e = xa(t);
    return W(Object.assign(Object.assign({}, e), t.extraParams && Object.assign({}, t.extraParams)))
}

function Lt(t, e) {
    if (arguments.length > 2) return Promise.reject(new d('As of version 3.0, "getToken" takes only a single set of options'));
    e = e || {};
    let r = e.popupWindow;
    return e.popupWindow = void 0, $e(t, e).then(function(n) {
        var o = {
                prompt: "none",
                responseMode: "okta_post_message",
                display: null
            },
            i = {
                display: "popup"
            };
        e.sessionToken ? Object.assign(n, o) : e.idp && Object.assign(n, i);
        var s, a, c;
        c = G(t, n), a = e.codeVerifier ? c.tokenUrl : c.authorizeUrl, s = a + it(n);
        var u = "IMPLICIT";
        switch (n.sessionToken || n.display === null ? u = "IFRAME" : n.display === "popup" ? u = e.idpPopup ? "IDP_POPUP" : "POPUP" : u = "IMPLICIT", u) {
            case "IFRAME":
                var l = Mn(t, e.timeout, n.state),
                    f = Zo(s);
                return l.then(function(w) {
                    return de(t, n, w, c)
                }).finally(function() {
                    var w;
                    document.body.contains(f) && ((w = f.parentElement) === null || w === void 0 || w.removeChild(f))
                });
            case "POPUP":
                var p;
                if (n.responseMode === "okta_post_message") {
                    if (!t.features.isPopupPostMessageSupported()) throw new d("This browser doesn't have full postMessage support");
                    p = Mn(t, e.timeout, n.state)
                }
                r && r.location.assign(s);
                var m = new Promise(function(w, S) {
                    var T = setInterval(function() {
                        (!r || r.closed) && (clearInterval(T), S(new d("Unable to parse OAuth flow response")))
                    }, 100);
                    p.then(function(P) {
                        clearInterval(T), w(P)
                    }).catch(function(P) {
                        clearInterval(T), S(P)
                    })
                });
                return m.then(function(w) {
                    return de(t, n, w, c)
                }).finally(function() {
                    r && !r.closed && r.close()
                });
            case "IDP_POPUP":
                var v = ei(t, e.timeout, e.channel, n.state);
                if (r) r.location.assign(s);
                else throw new d("Unable to open popup window");
                return v.then(function(w) {
                    return de(t, n, w, c)
                });
            default:
                throw new d("The full page redirect flow is not supported")
        }
    })
}

function st(t, e) {
    return arguments.length > 2 ? Promise.reject(new d('As of version 3.0, "getWithoutPrompt" takes only a single set of options')) : (e = I(e) || {}, Object.assign(e, {
        prompt: "none",
        responseMode: "okta_post_message",
        display: null
    }), Lt(t, e))
}
var pA = y(x(), 1);
var mA = y(_(), 1);

function ti(t, e) {
    if (arguments.length > 2) return Promise.reject(new d('As of version 3.0, "getWithPopup" takes only a single set of options'));
    let {
        initialPath: r
    } = e, n = te(e, ["initialPath"]), o = Cn(r ? ? "/", n);
    return e = I(n) || {}, Object.assign(n, {
        display: "popup",
        responseMode: "okta_post_message",
        popupWindow: o
    }), Lt(t, n)
}

function ri(t, e) {
    try {
        if (!BroadcastChannel) throw new d("Modern browser with `BroadcastChannel` support is required to use this method");
        if (!e.redirectUri) throw new d("`redirectUri` is a required param for `getWithIDPPopup`");
        e.state || (e.state = Ze());
        let r = Cn("/", e),
            n = new BroadcastChannel(`popup-callback:${e.state}`);
        e = I(e) || {}, Object.assign(e, {
            display: "popup",
            responseMode: "query",
            popupWindow: r,
            idpPopup: !0,
            channel: n
        });
        let o;
        return {
            promise: new Promise((a, c) => (o = c, Lt(t, e).then(u => a(u)).catch(u => c(u)))),
            cancel: () => {
                n.close(), o(new d("Popup flow canceled"))
            }
        }
    } catch (r) {
        return {
            promise: Promise.reject(r),
            cancel: () => {}
        }
    }
}
async function ni(t, e) {
    if (arguments.length > 2) return Promise.reject(new d('As of version 3.0, "getWithRedirect" takes only a single set of options'));
    e = I(e) || {};
    let r = await $e(t, e),
        n = Zt(t, r),
        o = n.urls.authorizeUrl + it(r);
    t.transactionManager.save(n), t.options.setLocation ? t.options.setLocation(o) : window.location.assign(o)
}
var IA = y(x(), 1);
var MA = y(_(), 1);

function Ou(t) {
    var e = t.token.parseFromUrl._getHistory(),
        r = t.token.parseFromUrl._getDocument(),
        n = t.token.parseFromUrl._getLocation();
    e && e.replaceState ? e.replaceState(null, r.title, n.pathname + n.search) : n.hash = ""
}

function ku(t) {
    var e = t.token.parseFromUrl._getHistory(),
        r = t.token.parseFromUrl._getDocument(),
        n = t.token.parseFromUrl._getLocation();
    e && e.replaceState ? e.replaceState(null, r.title, n.pathname + n.hash) : n.search = ""
}

function ba(t) {
    var e = t.options.pkce ? "query" : "fragment",
        r = t.options.responseMode || e;
    return r
}

function Dn(t, e) {
    e = e || {}, ge(e) ? e = {
        url: e
    } : e = e;
    var r = e.url,
        n = e.responseMode || ba(t),
        o = t.token.parseFromUrl._getLocation(),
        i;
    if (n === "query" ? i = r ? r.substring(r.indexOf("?")) : o.search : i = r ? r.substring(r.indexOf("#")) : o.hash, !i) throw new d("Unable to parse a token from the url");
    return mr(i)
}

function _u(t, e) {
    (e.responseMode || ba(t)) === "query" ? ku(t): Ou(t)
}
async function oi(t, e) {
    e = e || {}, ge(e) ? e = {
        url: e
    } : e = e;
    let r = Dn(t, e),
        n = r.state,
        o = t.transactionManager.load({
            state: n
        });
    if (!o) throw t.options.pkce ? new d("Could not load PKCE codeVerifier from storage. This may indicate the auth flow has already completed or multiple auth flows are executing concurrently.", void 0) : new d("Unable to retrieve OAuth redirect params from storage");
    let i = o.urls;
    return delete o.urls, e.url || _u(t, e), de(t, o, r, i).catch(s => {
        throw vr(s) || t.transactionManager.clear({
            state: n
        }), s
    }).then(s => (t.transactionManager.clear({
        state: n
    }), s))
}

function ii(t, e) {
    return t.refreshToken === e.refreshToken
}
async function at(t, e, r) {
    let {
        clientId: n,
        dpop: o
    } = t.options;
    if (!n) throw new d("A clientId must be specified in the OktaAuth constructor to renew tokens");
    try {
        let i = Object.assign({}, e, {
            clientId: n
        });
        r.extraParams && (i.extraParams = r.extraParams);
        let s = Object.assign({}, i);
        if (o) {
            let f = await Nt(r ? .dpopPairId);
            s.dpopKeyPair = f, i.dpop = o, i.dpopPairId = r.dpopPairId
        }
        let a = await Jo(t, s, r),
            c = G(t, e),
            {
                tokens: u
            } = await de(t, i, a, c),
            {
                refreshToken: l
            } = u;
        return l && !ii(l, r) && t.tokenManager.updateRefreshToken(l), u
    } catch (i) {
        throw Lo(i) && t.tokenManager.removeRefreshToken(), i
    }
}

function ka() {
    throw new d("Renew must be passed a token with an array of scopes and an accessToken or idToken")
}

function Oa(t, e) {
    if (ie(t)) return e.idToken;
    if (ee(t)) return e.accessToken;
    ka()
}
async function si(t, e) {
    !ie(e) && !ee(e) && ka();
    let r = t.tokenManager.getTokensSync();
    if (r.refreshToken) return r = await at(t, {
        scopes: e.scopes
    }, r.refreshToken), Oa(e, r);
    var n;
    t.options.pkce ? n = "code" : ee(e) ? n = "token" : n = "id_token";
    let {
        scopes: o,
        authorizeUrl: i,
        userinfoUrl: s,
        issuer: a,
        dpopPairId: c,
        extraParams: u
    } = e;
    return st(t, {
        responseType: n,
        scopes: o,
        authorizeUrl: i,
        userinfoUrl: s,
        issuer: a,
        dpopPairId: c,
        extraParams: u
    }).then(function(l) {
        return Oa(e, l.tokens)
    })
}
var aE = y(x(), 1);
var uE = y(_(), 1);
async function ai(t, e) {
    var r;
    let n = (r = e ? .tokens) !== null && r !== void 0 ? r : t.tokenManager.getTokensSync();
    if (n.refreshToken) return at(t, e || {}, n.refreshToken);
    if (!n.accessToken && !n.idToken) throw new d("renewTokens() was called but there is no existing token");
    let o = n.accessToken || {},
        i = n.idToken || {},
        s = o.scopes || i.scopes;
    if (!s) throw new d("renewTokens: invalid tokens: could not read scopes");
    let a = o.authorizeUrl || i.authorizeUrl;
    if (!a) throw new d("renewTokens: invalid tokens: could not read authorizeUrl");
    let c = o.userinfoUrl || t.options.userinfoUrl,
        u = i.issuer || t.options.issuer,
        l = o ? .dpopPairId,
        f = o ? .extraParams || i ? .extraParams;
    if (e = Object.assign({
            scopes: s,
            authorizeUrl: a,
            userinfoUrl: c,
            issuer: u,
            dpopPairId: l,
            extraParams: f
        }, e), t.options.pkce) e.responseType = "code";
    else {
        let {
            responseType: p
        } = be(t);
        e.responseType = p
    }
    return st(t, e).then(p => p.tokens)
}
var vE = y(x(), 1);
var yE = y(_(), 1);
async function ci(t, e) {
    let r = "",
        n = "";
    if (e && (r = e.accessToken, n = e.refreshToken), !r && !n) throw new d("A valid access or refresh token object is required");
    var o = t.options.clientId,
        i = t.options.clientSecret;
    if (!o) throw new d("A clientId must be specified in the OktaAuth constructor to revoke a token");
    var s = G(t).revokeUrl,
        a = W({
            token_type_hint: n ? "refresh_token" : "access_token",
            token: n || r
        }).slice(1),
        c = i ? oe(`${o}:${i}`) : oe(o);
    return Z(t, s, a, {
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
            Authorization: "Basic " + c
        }
    })
}
var _E = y(x(), 1);
var PE = y(_(), 1);
var Ru = {
    accessToken: "access_token",
    idToken: "id_token",
    refreshToken: "refresh_token"
};
async function ui(t, e, r) {
    var n;
    let o, i = t.options.clientId,
        s = t.options.clientSecret;
    if (r || (r = t.tokenManager.getTokens()[e]), !r) throw new d(`unable to find ${e} in storage or fn params`);
    if (e !== en.ACCESS ? o = r ? .issuer : o = (n = r ? .claims) === null || n === void 0 ? void 0 : n.iss, o = o || t.options.issuer, !i) throw new d("A clientId must be specified in the OktaAuth constructor to introspect a token");
    if (!o) throw new d("Unable to find issuer");
    let {
        introspection_endpoint: a
    } = await Ge(t, o), c = s ? oe(`${i}:${s}`) : oe(i), u = W({
        token_type_hint: Ru[e],
        token: r[e]
    }).slice(1);
    return Z(t, a, u, {
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
            Authorization: "Basic " + c
        }
    })
}

function li(t, e) {
    let r = t.options.issuer,
        n = G(t, e);
    return {
        issuer: r,
        urls: n,
        clientId: e.clientId,
        redirectUri: e.redirectUri,
        responseType: e.responseType,
        responseMode: e.responseMode,
        state: e.state,
        acrValues: e.acrValues,
        enrollAmrValues: e.enrollAmrValues
    }
}
var $E = y(x(), 1);
var JE = y(_(), 1);

function fi(t) {
    let {
        clientId: e,
        redirectUri: r,
        responseMode: n,
        state: o
    } = t.options, i = k() ? window.location.href : void 0;
    return D({
        clientId: e,
        redirectUri: r || i,
        responseMode: n,
        state: o || Ze(),
        responseType: "none",
        prompt: "enroll_authenticator"
    })
}

function Pu(t) {
    if (t = Object.assign(Object.assign({}, t), {
            responseType: "none",
            prompt: "enroll_authenticator",
            maxAge: 0
        }), !t.enrollAmrValues) throw new d("enroll_amr_values must be specified");
    if (!t.acrValues) throw new d("acr_values must be specified");
    return delete t.scopes, delete t.nonce, t
}

function di(t, e) {
    return Pu(Object.assign(Object.assign({}, fi(t)), e))
}

function _a(t, e) {
    e = I(e) || {};
    let r = di(t, e),
        n = li(t, r),
        o = n.urls.authorizeUrl + it(r);
    t.transactionManager.save(n), t.options.setLocation ? t.options.setLocation(o) : window.location.assign(o)
}

function pi(t, e) {
    let r = c => xe.prototype.push.bind(e, c, null),
        n = r(ni.bind(null, t)),
        o = r(oi.bind(null, t)),
        i = Object.assign(o, {
            _getHistory: function() {
                return window.history
            },
            _getLocation: function() {
                return window.location
            },
            _getDocument: function() {
                return window.document
            }
        }),
        s = {
            prepareTokenParams: $e.bind(null, t),
            exchangeCodeForTokens: Rn.bind(null, t),
            getWithoutPrompt: st.bind(null, t),
            getWithPopup: ti.bind(null, t),
            getWithIDPPopup: ri.bind(null, t),
            getWithRedirect: n,
            parseFromUrl: i,
            decode: Ut,
            revoke: ci.bind(null, t),
            renew: si.bind(null, t),
            renewTokensWithRefresh: at.bind(null, t),
            renewTokens: ai.bind(null, t),
            getUserInfo: (c, u) => Yo(t, c, u),
            verify: br.bind(null, t),
            isLoginRedirect: rt.bind(null, t),
            introspect: ui.bind(null, t)
        };
    return ["getWithoutPrompt", "getWithPopup", "revoke", "renew", "renewTokensWithRefresh", "renewTokens"].forEach(c => {
        s[c] = r(s[c])
    }), s
}

function hi(t) {
    return {
        authorize: {
            enrollAuthenticator: _a.bind(null, t)
        }
    }
}
var Cx = y(x(), 1);
var Dx = y(_(), 1);

function jt(t, e) {
    if (!ie(t) && !ee(t) && !fe(t)) throw new d("Token must be an Object with scopes, expiresAt, and one of: an idToken, accessToken, or refreshToken property");
    if (e === "accessToken" && !ee(t)) throw new d("invalid accessToken");
    if (e === "idToken" && !ie(t)) throw new d("invalid idToken");
    if (e === "refreshToken" && !fe(t)) throw new d("invalid refreshToken")
}
var Un = class t {
    constructor(e) {
        this.localOffset = parseInt(e || 0)
    }
    static create() {
        var e = 0;
        return new t(e)
    }
    now() {
        var e = (Date.now() + this.localOffset) / 1e3;
        return e
    }
};
var Ft = "expired",
    ze = "renewed",
    pe = "added",
    he = "removed",
    mi = "error",
    Je = "set_storage";
var Ra = {
    autoRenew: !0,
    autoRemove: !0,
    syncStorage: !0,
    clearPendingRemoveTokens: !0,
    storage: void 0,
    expireEarlySeconds: 30,
    storageKey: vt
};

function Iu() {
    return {
        expireTimeouts: {},
        renewPromise: null
    }
}
var Or = class {
    constructor(e, r = {}) {
        if (this.sdk = e, this.emitter = e.emitter, !this.emitter) throw new d("Emitter should be initialized before TokenManager");
        r = Object.assign({}, Ra, D(r)), vo() || (r.expireEarlySeconds = Ra.expireEarlySeconds), this.options = r;
        let n = D({
            storageKey: r.storageKey,
            secure: r.secure
        });
        typeof r.storage == "object" ? n.storageProvider = r.storage : r.storage && (n.storageType = r.storage), this.storage = e.storageManager.getTokenStorage(Object.assign(Object.assign({}, n), {
            useSeparateCookies: !0
        })), this.clock = Un.create(), this.state = Iu()
    }
    on(e, r, n) {
        n ? this.emitter.on(e, r, n) : this.emitter.on(e, r)
    }
    off(e, r) {
        r ? this.emitter.off(e, r) : this.emitter.off(e)
    }
    start() {
        this.options.clearPendingRemoveTokens && this.clearPendingRemoveTokens(), this.setExpireEventTimeoutAll(), this.state.started = !0
    }
    stop() {
        this.clearExpireEventTimeoutAll(), this.state.started = !1
    }
    isStarted() {
        return !!this.state.started
    }
    getOptions() {
        return I(this.options)
    }
    getExpireTime(e) {
        let r = this.options.expireEarlySeconds || 0;
        var n = e.expiresAt - r;
        return n
    }
    hasExpired(e) {
        var r = this.getExpireTime(e);
        return r <= this.clock.now()
    }
    emitExpired(e, r) {
        this.emitter.emit(Ft, e, r)
    }
    emitRenewed(e, r, n) {
        this.emitter.emit(ze, e, r, n)
    }
    emitAdded(e, r) {
        this.emitter.emit(pe, e, r)
    }
    emitRemoved(e, r) {
        this.emitter.emit(he, e, r)
    }
    emitError(e) {
        this.emitter.emit(mi, e)
    }
    clearExpireEventTimeout(e) {
        clearTimeout(this.state.expireTimeouts[e]), delete this.state.expireTimeouts[e], this.state.renewPromise = null
    }
    clearExpireEventTimeoutAll() {
        var e = this.state.expireTimeouts;
        for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && this.clearExpireEventTimeout(r)
    }
    setExpireEventTimeout(e, r) {
        if (!fe(r)) {
            var n = this.getExpireTime(r),
                o = Math.max(n - this.clock.now(), 0) * 1e3;
            this.clearExpireEventTimeout(e);
            var i = setTimeout(() => {
                this.emitExpired(e, r)
            }, o);
            this.state.expireTimeouts[e] = i
        }
    }
    setExpireEventTimeoutAll() {
        var e = this.storage.getStorage();
        for (var r in e)
            if (Object.prototype.hasOwnProperty.call(e, r)) {
                var n = e[r];
                this.setExpireEventTimeout(r, n)
            }
    }
    resetExpireEventTimeoutAll() {
        this.clearExpireEventTimeoutAll(), this.setExpireEventTimeoutAll()
    }
    add(e, r) {
        var n = this.storage.getStorage();
        jt(r), n[e] = r, this.storage.setStorage(n), this.emitSetStorageEvent(), this.emitAdded(e, r), this.setExpireEventTimeout(e, r)
    }
    getSync(e) {
        var r = this.storage.getStorage();
        return r[e]
    }
    async get(e) {
        return this.getSync(e)
    }
    getTokensSync() {
        let e = {},
            r = this.storage.getStorage();
        return Object.keys(r).forEach(n => {
            let o = r[n];
            ee(o) ? e.accessToken = o : ie(o) ? e.idToken = o : fe(o) && (e.refreshToken = o)
        }), e
    }
    async getTokens() {
        return this.getTokensSync()
    }
    getStorageKeyByType(e) {
        let r = this.storage.getStorage();
        return Object.keys(r).filter(o => {
            let i = r[o];
            return ee(i) && e === "accessToken" || ie(i) && e === "idToken" || fe(i) && e === "refreshToken"
        })[0]
    }
    getTokenType(e) {
        if (ee(e)) return "accessToken";
        if (ie(e)) return "idToken";
        if (fe(e)) return "refreshToken";
        throw new d("Unknown token type")
    }
    emitSetStorageEvent() {
        if (St()) {
            let e = this.storage.getStorage();
            this.emitter.emit(Je, e)
        }
    }
    getStorage() {
        return this.storage
    }
    setTokens(e, r, n, o) {
        let i = (p, m) => {
                let v = this.getTokenType(m);
                v === "accessToken" ? r && r(p, m) : v === "idToken" ? n && n(p, m) : v === "refreshToken" && o && o(p, m)
            },
            s = (p, m) => {
                this.emitAdded(p, m), this.setExpireEventTimeout(p, m), i(p, m)
            },
            a = (p, m, v) => {
                this.emitRenewed(p, m, v), this.clearExpireEventTimeout(p), this.setExpireEventTimeout(p, m), i(p, m)
            },
            c = (p, m) => {
                this.clearExpireEventTimeout(p), this.emitRemoved(p, m), i(p, m)
            },
            u = ["idToken", "accessToken", "refreshToken"],
            l = this.getTokensSync();
        u.forEach(p => {
            let m = e[p];
            m && jt(m, p)
        });
        let f = u.reduce((p, m) => {
            let v = e[m];
            if (v) {
                let w = this.getStorageKeyByType(m) || m;
                p[w] = v
            }
            return p
        }, {});
        this.storage.setStorage(f), this.emitSetStorageEvent(), u.forEach(p => {
            let m = e[p],
                v = l[p],
                w = this.getStorageKeyByType(p) || p;
            m && v ? (c(w, v), s(w, m), a(w, m, v)) : m ? s(w, m) : v && c(w, v)
        })
    }
    remove(e) {
        this.clearExpireEventTimeout(e);
        var r = this.storage.getStorage(),
            n = r[e];
        delete r[e], this.storage.setStorage(r), this.emitSetStorageEvent(), this.emitRemoved(e, n)
    }
    async renewToken(e) {
        var r;
        return (r = this.sdk.token) === null || r === void 0 ? void 0 : r.renew(e)
    }
    validateToken(e) {
        return jt(e)
    }
    renew(e) {
        if (this.state.renewPromise) return this.state.renewPromise;
        try {
            var r = this.getSync(e);
            let o = r !== void 0;
            if (!r && e === "accessToken") {
                let i = this.getStorageKeyByType("refreshToken");
                o = this.getSync(i) !== void 0
            }
            if (!o) throw new d("The tokenManager has no token for the key: " + e)
        } catch (o) {
            return this.emitError(o), Promise.reject(o)
        }
        return this.clearExpireEventTimeout(e), this.state.renewPromise = this.sdk.token.renewTokens().then(o => {
            if (this.setTokens(o), !r && e === "accessToken") {
                let s = o.accessToken;
                return this.emitRenewed(e, s, null), s
            }
            let i = this.getTokenType(r);
            return o[i]
        }).catch(o => {
            throw this.remove(e), o.tokenKey = e, this.emitError(o), o
        }).finally(() => {
            this.state.renewPromise = null
        })
    }
    clear() {
        let e = this.getTokensSync();
        this.clearExpireEventTimeoutAll(), this.storage.clearStorage(), this.emitSetStorageEvent(), Object.keys(e).forEach(r => {
            this.emitRemoved(r, e[r])
        })
    }
    clearPendingRemoveTokens() {
        let e = this.storage.getStorage(),
            r = {};
        Object.keys(e).forEach(n => {
            e[n].pendingRemove && (r[n] = e[n], delete e[n])
        }), this.storage.setStorage(e), this.emitSetStorageEvent(), Object.keys(r).forEach(n => {
            this.clearExpireEventTimeout(n), this.emitRemoved(n, r[n])
        })
    }
    updateRefreshToken(e) {
        let r = this.getStorageKeyByType("refreshToken") || er;
        var n = this.storage.getStorage();
        jt(e), n[r] = e, this.storage.setStorage(n), this.emitSetStorageEvent()
    }
    removeRefreshToken() {
        let e = this.getStorageKeyByType("refreshToken") || er;
        this.remove(e)
    }
    addPendingRemoveFlags() {
        let e = this.getTokensSync();
        Object.keys(e).forEach(r => {
            e[r].pendingRemove = !0
        }), this.setTokens(e)
    }
};
var Vt = {
    browserHasLocalStorage: function() {
        try {
            var t = this.getLocalStorage();
            return this.testStorage(t)
        } catch {
            return !1
        }
    },
    browserHasSessionStorage: function() {
        try {
            var t = this.getSessionStorage();
            return this.testStorage(t)
        } catch {
            return !1
        }
    },
    testStorageType: function(t) {
        var e = !1;
        switch (t) {
            case "sessionStorage":
                e = this.browserHasSessionStorage();
                break;
            case "localStorage":
                e = this.browserHasLocalStorage();
                break;
            case "cookie":
            case "memory":
                e = !0;
                break;
            default:
                e = !1;
                break
        }
        return e
    },
    getStorageByType: function(t, e) {
        let r;
        switch (t) {
            case "sessionStorage":
                r = this.getSessionStorage();
                break;
            case "localStorage":
                r = this.getLocalStorage();
                break;
            case "cookie":
                r = this.getCookieStorage(e);
                break;
            case "memory":
                r = this.getInMemoryStorage();
                break;
            default:
                throw new d(`Unrecognized storage option: ${t}`)
        }
        return r
    },
    findStorageType: function(t) {
        let e, r;
        return t = t.slice(), e = t.shift(), r = t.length ? t[0] : null, !r || this.testStorageType(e) ? e : (N(`This browser doesn't support ${e}. Switching to ${r}.`), this.findStorageType(t))
    },
    getLocalStorage: function() {
        return St() && !window.onstorage && (window.onstorage = function() {}), localStorage
    },
    getSessionStorage: function() {
        return sessionStorage
    },
    getCookieStorage: function(t) {
        let e = t.secure,
            r = t.sameSite,
            n = t.sessionCookie;
        if (typeof e > "u" || typeof r > "u") throw new d('getCookieStorage: "secure" and "sameSite" options must be provided');
        let o = {
            getItem: this.storage.get,
            setItem: (i, s, a = "2200-01-01T00:00:00.000Z") => {
                a = n ? null : a, this.storage.set(i, s, a, {
                    secure: e,
                    sameSite: r
                })
            },
            removeItem: i => {
                this.storage.delete(i)
            }
        };
        return t.useSeparateCookies ? {
            getItem: function(i) {
                var s = o.getItem(),
                    a = {};
                return Object.keys(s).forEach(c => {
                    c.indexOf(i) === 0 && (a[c.replace(`${i}_`, "")] = JSON.parse(s[c]))
                }), JSON.stringify(a)
            },
            setItem: function(i, s) {
                var a = JSON.parse(this.getItem(i));
                s = JSON.parse(s), Object.keys(s).forEach(c => {
                    var u = i + "_" + c,
                        l = JSON.stringify(s[c]);
                    o.setItem(u, l), delete a[c]
                }), Object.keys(a).forEach(c => {
                    o.removeItem(i + "_" + c)
                })
            },
            removeItem: function(i) {
                var s = JSON.parse(this.getItem(i));
                Object.keys(s).forEach(a => {
                    o.removeItem(i + "_" + a)
                })
            }
        } : o
    },
    inMemoryStore: {},
    getInMemoryStorage: function() {
        return {
            getItem: t => this.inMemoryStore[t],
            setItem: (t, e) => {
                this.inMemoryStore[t] = e
            }
        }
    },
    testStorage: function(t) {
        var e = "okta-test-storage";
        try {
            return t.setItem(e, e), t.removeItem(e), !0
        } catch {
            return !1
        }
    },
    storage: {
        set: function(t, e, r, n) {
            let {
                sameSite: o,
                secure: i
            } = n;
            if (typeof i > "u" || typeof o > "u") throw new d('storage.set: "secure" and "sameSite" options must be provided');
            var s = {
                path: n.path || "/",
                secure: i,
                sameSite: o
            };
            return Date.parse(r) && (s.expires = new Date(r)), or.set(t, e, s), this.get(t)
        },
        get: function(t) {
            return arguments.length ? or.get(t) : or.get()
        },
        delete: function(t) {
            return or.remove(t, {
                path: "/"
            })
        }
    }
};

function Pa(t) {
    return class extends t {
        setOriginalUri(r, n) {
            Vt.getSessionStorage().setItem(wt, r), n = n || this.options.state, n && this.storageManager.getOriginalUriStorage().setItem(n, r)
        }
        getOriginalUri(r) {
            if (r = r || this.options.state, r) {
                let i = this.storageManager.getOriginalUriStorage().getItem(r);
                if (i) return i
            }
            let n = Vt.getSessionStorage();
            return n && n.getItem(wt) || void 0
        }
        removeOriginalUri(r) {
            if (Vt.getSessionStorage().removeItem(wt), r = r || this.options.state, r) {
                let o = this.storageManager.getOriginalUriStorage();
                o.removeItem && o.removeItem(r)
            }
        }
    }
}

function Nn(t, e) {
    var r;
    let n = Pa(t);
    return r = class extends n {
        constructor(...i) {
            super(...i), this.transactionManager = new e(Object.assign({
                storageManager: this.storageManager
            }, this.options.transactionManager)), this.pkce = {
                DEFAULT_CODE_CHALLENGE_METHOD: Ke.DEFAULT_CODE_CHALLENGE_METHOD,
                generateVerifier: Ke.generateVerifier,
                computeChallenge: Ke.computeChallenge
            }, this._pending = {
                handleLogin: !1
            }, this._tokenQueue = new xe, this.token = pi(this, this._tokenQueue), this.tokenManager = new Or(this, this.options.tokenManager), this.endpoints = hi(this)
        }
        clearStorage() {
            super.clearStorage(), this.tokenManager.clear()
        }
        async isAuthenticated(i = {}) {
            let {
                autoRenew: s,
                autoRemove: a
            } = this.tokenManager.getOptions(), c = i.onExpiredToken ? i.onExpiredToken === "renew" : s, u = i.onExpiredToken ? i.onExpiredToken === "remove" : a, {
                accessToken: l
            } = this.tokenManager.getTokensSync();
            if (l && this.tokenManager.hasExpired(l))
                if (l = void 0, c) try {
                    l = await this.tokenManager.renew("accessToken")
                } catch {} else u && this.tokenManager.remove("accessToken");
            let {
                idToken: f
            } = this.tokenManager.getTokensSync();
            if (f && this.tokenManager.hasExpired(f))
                if (f = void 0, c) try {
                    f = await this.tokenManager.renew("idToken")
                } catch {} else u && this.tokenManager.remove("idToken");
            return !!(l && f)
        }
        async signInWithRedirect(i = {}) {
            let {
                originalUri: s
            } = i, a = te(i, ["originalUri"]);
            if (!this._pending.handleLogin) {
                this._pending.handleLogin = !0;
                try {
                    s && this.setOriginalUri(s);
                    let c = Object.assign({
                        scopes: this.options.scopes || ["openid", "email", "profile"]
                    }, a);
                    await this.token.getWithRedirect(c)
                } finally {
                    this._pending.handleLogin = !1
                }
            }
        }
        async getUser() {
            let {
                idToken: i,
                accessToken: s
            } = this.tokenManager.getTokensSync();
            return this.token.getUserInfo(s, i)
        }
        getIdToken() {
            let {
                idToken: i
            } = this.tokenManager.getTokensSync();
            return i ? i.idToken : void 0
        }
        getAccessToken() {
            let {
                accessToken: i
            } = this.tokenManager.getTokensSync();
            return i ? i.accessToken : void 0
        }
        getRefreshToken() {
            let {
                refreshToken: i
            } = this.tokenManager.getTokensSync();
            return i ? i.refreshToken : void 0
        }
        async getOrRenewAccessToken() {
            var i;
            let {
                accessToken: s
            } = this.tokenManager.getTokensSync();
            if (s && !this.tokenManager.hasExpired(s)) return s.accessToken;
            try {
                let a = this.tokenManager.getStorageKeyByType("accessToken"),
                    c = await this.tokenManager.renew(a ? ? "accessToken");
                return (i = c ? .accessToken) !== null && i !== void 0 ? i : null
            } catch (a) {
                return this.emitter.emit("error", a), null
            }
        }
        async storeTokensFromRedirect() {
            let {
                tokens: i,
                responseType: s
            } = await this.token.parseFromUrl();
            s !== "none" && this.tokenManager.setTokens(i)
        }
        isLoginRedirect() {
            return rt(this)
        }
        isPKCE() {
            return !!this.options.pkce
        }
        hasResponseType(i) {
            return Sn(i, this.options)
        }
        isAuthorizationCodeFlow() {
            return this.hasResponseType("code")
        }
        async invokeApiMethod(i) {
            if (!i.accessToken) {
                let s = (await this.tokenManager.getTokens()).accessToken;
                i.accessToken = s ? .accessToken
            }
            return j(this, i)
        }
        async revokeAccessToken(i) {
            if (!i) {
                let s = await this.tokenManager.getTokens();
                i = s.accessToken;
                let a = this.tokenManager.getStorageKeyByType("accessToken");
                this.tokenManager.remove(a), this.options.dpop && await Ko("access", s)
            }
            return i ? this.token.revoke(i) : Promise.resolve(null)
        }
        async revokeRefreshToken(i) {
            if (!i) {
                let s = await this.tokenManager.getTokens();
                i = s.refreshToken;
                let a = this.tokenManager.getStorageKeyByType("refreshToken");
                this.tokenManager.remove(a), this.options.dpop && await Ko("refresh", s)
            }
            return i ? this.token.revoke(i) : Promise.resolve(null)
        }
        getSignOutRedirectUrl(i = {}) {
            let {
                idToken: s,
                postLogoutRedirectUri: a,
                state: c
            } = i;
            if (s || (s = this.tokenManager.getTokensSync().idToken), !s) return "";
            a === void 0 && (a = this.options.postLogoutRedirectUri);
            let u = G(this).logoutUrl,
                l = s.idToken,
                f = u + "?id_token_hint=" + encodeURIComponent(l);
            return a && (f += "&post_logout_redirect_uri=" + encodeURIComponent(a)), c && (f += "&state=" + encodeURIComponent(c)), f
        }
        async signOut(i) {
            var s;
            i = Object.assign({}, i);
            let a = window.location.origin,
                c = window.location.href,
                u = i.postLogoutRedirectUri === null ? null : i.postLogoutRedirectUri || this.options.postLogoutRedirectUri || a,
                l = i ? .state,
                f = i.accessToken,
                p = i.refreshToken,
                m = i.revokeAccessToken !== !1,
                v = i.revokeRefreshToken !== !1;
            v && typeof p > "u" && (p = this.tokenManager.getTokensSync().refreshToken), m && typeof f > "u" && (f = this.tokenManager.getTokensSync().accessToken), i.idToken || (i.idToken = this.tokenManager.getTokensSync().idToken), v && p && await this.revokeRefreshToken(p), m && f && await this.revokeAccessToken(f);
            let w = (s = f ? .dpopPairId) !== null && s !== void 0 ? s : p ? .dpopPairId;
            this.options.dpop && w && await _n(w);
            let S = this.getSignOutRedirectUrl(Object.assign(Object.assign({}, i), {
                postLogoutRedirectUri: u
            }));
            if (S) return i.clearTokensBeforeRedirect ? this.tokenManager.clear() : this.tokenManager.addPendingRemoveFlags(), window.location.assign(S), !0; {
                let T = await this.closeSession(),
                    P = new URL(u || a);
                return l && P.searchParams.append("state", l), u === c ? window.location.href = P.href : window.location.assign(P.href), T
            }
        }
        async getDPoPAuthorizationHeaders(i) {
            if (!this.options.dpop) throw new d("DPoP is not configured for this client instance");
            let {
                accessToken: s
            } = i;
            if (s || (s = this.tokenManager.getTokensSync().accessToken), !s) throw new d("AccessToken is required to generate a DPoP Proof");
            let a = await Nt(s ? .dpopPairId),
                c = await Go(Object.assign(Object.assign({}, i), {
                    keyPair: a,
                    accessToken: s.accessToken
                }));
            return {
                Authorization: `DPoP ${s.accessToken}`,
                Dpop: c
            }
        }
        async clearDPoPStorage(i = !1) {
            var s, a;
            if (i) return va();
            let c = await this.tokenManager.getTokens(),
                u = ((s = c.accessToken) === null || s === void 0 ? void 0 : s.dpopPairId) || ((a = c.refreshToken) === null || a === void 0 ? void 0 : a.dpopPairId);
            u && await _n(u)
        }
        parseUseDPoPNonceError(i) {
            var s;
            let a = Y.getWWWAuthenticateHeader(i),
                c = Y.parseHeader(a ? ? "");
            if (On(c)) {
                let u = null;
                return Yt(i ? .get) && (u = i.get("DPoP-Nonce")), u = (s = u ? ? i["dpop-nonce"]) !== null && s !== void 0 ? s : i["DPoP-Nonce"], u
            }
            return null
        }
    }, r.crypto = bn, r
}
var Ma = y(Ia(), 1);
var Tb = y(x(), 1);
var Ab = y(_(), 1);
var Da = null,
    Ca = {
        updateAuthStatePromise: null,
        canceledTimes: 0
    },
    vi = "authStateChange",
    Cu = 10,
    Mu = (t, e) => t ? t.isAuthenticated === e.isAuthenticated && JSON.stringify(t.idToken) === JSON.stringify(e.idToken) && JSON.stringify(t.accessToken) === JSON.stringify(e.accessToken) && t.error === e.error : !1,
    kr = class {
        constructor(e) {
            if (!e.emitter) throw new d("Emitter should be initialized before AuthStateManager");
            this._sdk = e, this._pending = Object.assign({}, Ca), this._authState = Da, this._logOptions = {}, this._prevAuthState = null, this._transformQueue = new xe({
                quiet: !0
            }), e.tokenManager.on(pe, (r, n) => {
                this._setLogOptions({
                    event: pe,
                    key: r,
                    token: n
                }), this.updateAuthState()
            }), e.tokenManager.on(he, (r, n) => {
                this._setLogOptions({
                    event: he,
                    key: r,
                    token: n
                }), this.updateAuthState()
            })
        }
        _setLogOptions(e) {
            this._logOptions = e
        }
        getAuthState() {
            return this._authState
        }
        getPreviousAuthState() {
            return this._prevAuthState
        }
        async updateAuthState() {
            let {
                transformAuthState: e,
                devMode: r
            } = this._sdk.options, n = a => {
                let {
                    event: c,
                    key: u,
                    token: l
                } = this._logOptions;
                Ye().group(`OKTA-AUTH-JS:updateAuthState: Event:${c} Status:${a}`), Ye().log(u, l), Ye().log("Current authState", this._authState), Ye().groupEnd(), this._logOptions = {}
            }, o = a => {
                if (Mu(this._authState, a)) {
                    r && n("unchanged");
                    return
                }
                this._prevAuthState = this._authState, this._authState = a, this._sdk.emitter.emit(vi, Object.assign({}, a)), r && n("emitted")
            }, i = a => this._pending.updateAuthStatePromise.then(() => {
                let c = this._pending.updateAuthStatePromise;
                return c && c !== a ? i(c) : this.getAuthState()
            });
            if (this._pending.updateAuthStatePromise) {
                if (this._pending.canceledTimes >= Cu) return r && n("terminated"), i(this._pending.updateAuthStatePromise);
                this._pending.updateAuthStatePromise.cancel()
            }
            let s = new Ma.default((a, c, u) => {
                u.shouldReject = !1, u(() => {
                    this._pending.updateAuthStatePromise = null, this._pending.canceledTimes = this._pending.canceledTimes + 1, r && n("canceled")
                });
                let l = f => {
                    if (s.isCanceled) {
                        a();
                        return
                    }
                    o(f), a(), this._pending = Object.assign({}, Ca)
                };
                this._sdk.isAuthenticated().then(() => {
                    if (s.isCanceled) {
                        a();
                        return
                    }
                    let {
                        accessToken: f,
                        idToken: p,
                        refreshToken: m
                    } = this._sdk.tokenManager.getTokensSync(), v = {
                        accessToken: f,
                        idToken: p,
                        refreshToken: m,
                        isAuthenticated: !!(f && p)
                    };
                    (e ? this._transformQueue.push(e, null, this._sdk, v) : Promise.resolve(v)).then(S => l(S)).catch(S => l({
                        accessToken: f,
                        idToken: p,
                        refreshToken: m,
                        isAuthenticated: !1,
                        error: S
                    }))
                })
            });
            return this._pending.updateAuthStatePromise = s, i(s)
        }
        subscribe(e) {
            this._sdk.emitter.on(vi, e)
        }
        unsubscribe(e) {
            this._sdk.emitter.off(vi, e)
        }
    };
var Fn = class {
    constructor(e, r = {}) {
        this.started = !1, this.tokenManager = e, this.options = r, this.renewTimeQueue = [], this.onTokenExpiredHandler = this.onTokenExpiredHandler.bind(this)
    }
    shouldThrottleRenew() {
        let e = !1;
        if (this.renewTimeQueue.push(Date.now()), this.renewTimeQueue.length >= 10) {
            let r = this.renewTimeQueue.shift();
            e = this.renewTimeQueue[this.renewTimeQueue.length - 1] - r < 30 * 1e3
        }
        return e
    }
    requiresLeadership() {
        return !!this.options.syncStorage && k()
    }
    processExpiredTokens() {
        let r = this.tokenManager.getStorage().getStorage();
        Object.keys(r).forEach(n => {
            let o = r[n];
            !fe(o) && this.tokenManager.hasExpired(o) && this.onTokenExpiredHandler(n)
        })
    }
    onTokenExpiredHandler(e) {
        if (this.options.autoRenew)
            if (this.shouldThrottleRenew()) {
                let r = new d("Too many token renew requests");
                this.tokenManager.emitError(r)
            } else this.tokenManager.renew(e).catch(() => {});
        else this.options.autoRemove && this.tokenManager.remove(e)
    }
    canStart() {
        return (!!this.options.autoRenew || !!this.options.autoRemove) && !this.started
    }
    async start() {
        this.canStart() && (this.tokenManager.on(Ft, this.onTokenExpiredHandler), this.tokenManager.isStarted() && this.processExpiredTokens(), this.started = !0)
    }
    async stop() {
        this.started && (this.tokenManager.off(Ft, this.onTokenExpiredHandler), this.renewTimeQueue = [], this.started = !1)
    }
    isStarted() {
        return this.started
    }
};

function Na(t) {
    return t && typeof t.then == "function"
}
var Du = Promise.resolve(!1),
    La = Promise.resolve(!0),
    se = Promise.resolve();

function ye(t, e) {
    return t || (t = 0), new Promise(function(r) {
        return setTimeout(function() {
            return r(e)
        }, t)
    })
}

function ja(t, e) {
    return Math.floor(Math.random() * (e - t + 1) + t)
}

function Oe() {
    return Math.random().toString(36).substring(2)
}
var Ua = 0,
    wi = 0;

function Qe() {
    var t = new Date().getTime();
    return t === Ua ? (wi++, t * 1e3 + wi) : (Ua = t, wi = 0, t * 1e3)
}

function Fa() {
    return typeof navigator < "u" && typeof navigator.locks < "u" && typeof navigator.locks.request == "function"
}
var Uu = Qe,
    Nu = "native";

function Lu(t) {
    var e = {
        messagesCallback: null,
        bc: new BroadcastChannel(t),
        subFns: []
    };
    return e.bc.onmessage = function(r) {
        e.messagesCallback && e.messagesCallback(r.data)
    }, e
}

function ju(t) {
    t.bc.close(), t.subFns = []
}

function Fu(t, e) {
    try {
        return t.bc.postMessage(e, !1), se
    } catch (r) {
        return Promise.reject(r)
    }
}

function Vu(t, e) {
    t.messagesCallback = e
}

function Hu() {
    if ((typeof window < "u" || typeof self < "u") && typeof BroadcastChannel == "function") {
        if (BroadcastChannel._pubkey) throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");
        return !0
    } else return !1
}

function Bu() {
    return 150
}
var Va = {
    create: Lu,
    close: ju,
    onMessage: Vu,
    postMessage: Fu,
    canBeUsed: Hu,
    type: Nu,
    averageResponseTime: Bu,
    microSeconds: Uu
};
var Vn = function() {
    function t(e) {
        this.ttl = e, this.map = new Map, this._to = !1
    }
    return t.prototype.has = function(e) {
        return this.map.has(e)
    }, t.prototype.add = function(e) {
        var r = this;
        this.map.set(e, Ha()), this._to || (this._to = !0, setTimeout(function() {
            r._to = !1, Wu(r)
        }, 0))
    }, t.prototype.clear = function() {
        this.map.clear()
    }, t
}();

function Wu(t) {
    for (var e = Ha() - t.ttl, r = t.map[Symbol.iterator]();;) {
        var n = r.next().value;
        if (!n) return;
        var o = n[0],
            i = n[1];
        if (i < e) t.map.delete(o);
        else return
    }
}

function Ha() {
    return new Date().getTime()
}

function Ht() {
    var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
        e = JSON.parse(JSON.stringify(t));
    return typeof e.webWorkerSupport > "u" && (e.webWorkerSupport = !0), e.idb || (e.idb = {}), e.idb.ttl || (e.idb.ttl = 1e3 * 45), e.idb.fallbackInterval || (e.idb.fallbackInterval = 150), t.idb && typeof t.idb.onclose == "function" && (e.idb.onclose = t.idb.onclose), e.localstorage || (e.localstorage = {}), e.localstorage.removeTimeout || (e.localstorage.removeTimeout = 1e3 * 60), t.methods && (e.methods = t.methods), e.node || (e.node = {}), e.node.ttl || (e.node.ttl = 1e3 * 60 * 2), e.node.maxParallelWrites || (e.node.maxParallelWrites = 2048), typeof e.node.useFastPath > "u" && (e.node.useFastPath = !0), e
}
var qu = Qe,
    Ku = "pubkey.broadcast-channel-0-",
    ke = "messages",
    Hn = {
        durability: "relaxed"
    },
    Gu = "idb";

function Ba() {
    if (typeof indexedDB < "u") return indexedDB;
    if (typeof window < "u") {
        if (typeof window.mozIndexedDB < "u") return window.mozIndexedDB;
        if (typeof window.webkitIndexedDB < "u") return window.webkitIndexedDB;
        if (typeof window.msIndexedDB < "u") return window.msIndexedDB
    }
    return !1
}

function yi(t) {
    t.commit && t.commit()
}

function $u(t) {
    var e = Ba(),
        r = Ku + t,
        n = e.open(r);
    return n.onupgradeneeded = function(o) {
        var i = o.target.result;
        i.createObjectStore(ke, {
            keyPath: "id",
            autoIncrement: !0
        })
    }, new Promise(function(o, i) {
        n.onerror = function(s) {
            return i(s)
        }, n.onsuccess = function() {
            o(n.result)
        }
    })
}

function zu(t, e, r) {
    var n = new Date().getTime(),
        o = {
            uuid: e,
            time: n,
            data: r
        },
        i = t.transaction([ke], "readwrite", Hn);
    return new Promise(function(s, a) {
        i.oncomplete = function() {
            return s()
        }, i.onerror = function(u) {
            return a(u)
        };
        var c = i.objectStore(ke);
        c.add(o), yi(i)
    })
}

function Ju(t, e) {
    var r = t.transaction(ke, "readonly", Hn),
        n = r.objectStore(ke),
        o = [],
        i = IDBKeyRange.bound(e + 1, 1 / 0);
    if (n.getAll) {
        var s = n.getAll(i);
        return new Promise(function(c, u) {
            s.onerror = function(l) {
                return u(l)
            }, s.onsuccess = function(l) {
                c(l.target.result)
            }
        })
    }

    function a() {
        try {
            return i = IDBKeyRange.bound(e + 1, 1 / 0), n.openCursor(i)
        } catch {
            return n.openCursor()
        }
    }
    return new Promise(function(c, u) {
        var l = a();
        l.onerror = function(f) {
            return u(f)
        }, l.onsuccess = function(f) {
            var p = f.target.result;
            p ? p.value.id < e + 1 ? p.continue(e + 1) : (o.push(p.value), p.continue()) : (yi(r), c(o))
        }
    })
}

function Qu(t, e) {
    if (t.closed) return Promise.resolve([]);
    var r = t.db.transaction(ke, "readwrite", Hn),
        n = r.objectStore(ke);
    return Promise.all(e.map(function(o) {
        var i = n.delete(o);
        return new Promise(function(s) {
            i.onsuccess = function() {
                return s()
            }
        })
    }))
}

function Xu(t, e) {
    var r = new Date().getTime() - e,
        n = t.transaction(ke, "readonly", Hn),
        o = n.objectStore(ke),
        i = [];
    return new Promise(function(s) {
        o.openCursor().onsuccess = function(a) {
            var c = a.target.result;
            if (c) {
                var u = c.value;
                u.time < r ? (i.push(u), c.continue()) : (yi(n), s(i))
            } else s(i)
        }
    })
}

function Yu(t) {
    return Xu(t.db, t.options.idb.ttl).then(function(e) {
        return Qu(t, e.map(function(r) {
            return r.id
        }))
    })
}

function Zu(t, e) {
    return e = Ht(e), $u(t).then(function(r) {
        var n = {
            closed: !1,
            lastCursorId: 0,
            channelName: t,
            options: e,
            uuid: Oe(),
            eMIs: new Vn(e.idb.ttl * 2),
            writeBlockPromise: se,
            messagesCallback: null,
            readQueuePromises: [],
            db: r
        };
        return r.onclose = function() {
            n.closed = !0, e.idb.onclose && e.idb.onclose()
        }, Wa(n), n
    })
}

function Wa(t) {
    t.closed || qa(t).then(function() {
        return ye(t.options.idb.fallbackInterval)
    }).then(function() {
        return Wa(t)
    })
}

function el(t, e) {
    return !(t.uuid === e.uuid || e.eMIs.has(t.id) || t.data.time < e.messagesCallbackTime)
}

function qa(t) {
    return t.closed ? se : t.messagesCallback ? Ju(t.db, t.lastCursorId).then(function(e) {
        var r = e.filter(function(n) {
            return !!n
        }).map(function(n) {
            return n.id > t.lastCursorId && (t.lastCursorId = n.id), n
        }).filter(function(n) {
            return el(n, t)
        }).sort(function(n, o) {
            return n.time - o.time
        });
        return r.forEach(function(n) {
            t.messagesCallback && (t.eMIs.add(n.id), t.messagesCallback(n.data))
        }), se
    }) : se
}

function tl(t) {
    t.closed = !0, t.db.close()
}

function rl(t, e) {
    return t.writeBlockPromise = t.writeBlockPromise.then(function() {
        return zu(t.db, t.uuid, e)
    }).then(function() {
        ja(0, 10) === 0 && Yu(t)
    }), t.writeBlockPromise
}

function nl(t, e, r) {
    t.messagesCallbackTime = r, t.messagesCallback = e, qa(t)
}

function ol() {
    return !!Ba()
}

function il(t) {
    return t.idb.fallbackInterval * 2
}
var Ka = {
    create: Zu,
    close: tl,
    onMessage: nl,
    postMessage: rl,
    canBeUsed: ol,
    type: Gu,
    averageResponseTime: il,
    microSeconds: qu
};
var sl = Qe,
    al = "pubkey.broadcastChannel-",
    cl = "localstorage";

function Ga() {
    var t;
    if (typeof window > "u") return null;
    try {
        t = window.localStorage, t = window["ie8-eventlistener/storage"] || window.localStorage
    } catch {}
    return t
}

function $a(t) {
    return al + t
}

function ul(t, e) {
    return new Promise(function(r) {
        ye().then(function() {
            var n = $a(t.channelName),
                o = {
                    token: Oe(),
                    time: new Date().getTime(),
                    data: e,
                    uuid: t.uuid
                },
                i = JSON.stringify(o);
            Ga().setItem(n, i);
            var s = document.createEvent("Event");
            s.initEvent("storage", !0, !0), s.key = n, s.newValue = i, window.dispatchEvent(s), r()
        })
    })
}

function ll(t, e) {
    var r = $a(t),
        n = function(i) {
            i.key === r && e(JSON.parse(i.newValue))
        };
    return window.addEventListener("storage", n), n
}

function fl(t) {
    window.removeEventListener("storage", t)
}

function dl(t, e) {
    if (e = Ht(e), !za()) throw new Error("BroadcastChannel: localstorage cannot be used");
    var r = Oe(),
        n = new Vn(e.localstorage.removeTimeout),
        o = {
            channelName: t,
            uuid: r,
            eMIs: n
        };
    return o.listener = ll(t, function(i) {
        o.messagesCallback && i.uuid !== r && (!i.token || n.has(i.token) || i.data.time && i.data.time < o.messagesCallbackTime || (n.add(i.token), o.messagesCallback(i.data)))
    }), o
}

function pl(t) {
    fl(t.listener)
}

function hl(t, e, r) {
    t.messagesCallbackTime = r, t.messagesCallback = e
}

function za() {
    var t = Ga();
    if (!t) return !1;
    try {
        var e = "__broadcastchannel_check";
        t.setItem(e, "works"), t.removeItem(e)
    } catch {
        return !1
    }
    return !0
}

function ml() {
    var t = 120,
        e = navigator.userAgent.toLowerCase();
    return e.includes("safari") && !e.includes("chrome") ? t * 2 : t
}
var Ja = {
    create: dl,
    close: pl,
    onMessage: hl,
    postMessage: ul,
    canBeUsed: za,
    type: cl,
    averageResponseTime: ml,
    microSeconds: sl
};
var gl = Qe,
    vl = "simulate",
    Ti = new Set;

function wl(t) {
    var e = {
        name: t,
        messagesCallback: null
    };
    return Ti.add(e), e
}

function yl(t) {
    Ti.delete(t)
}

function Tl(t, e) {
    return new Promise(function(r) {
        return setTimeout(function() {
            var n = Array.from(Ti);
            n.filter(function(o) {
                return o.name === t.name
            }).filter(function(o) {
                return o !== t
            }).filter(function(o) {
                return !!o.messagesCallback
            }).forEach(function(o) {
                return o.messagesCallback(e)
            }), r()
        }, 5)
    })
}

function Sl(t, e) {
    t.messagesCallback = e
}

function Al() {
    return !0
}

function El() {
    return 5
}
var Qa = {
    create: wl,
    close: yl,
    onMessage: Sl,
    postMessage: Tl,
    canBeUsed: Al,
    type: vl,
    averageResponseTime: El,
    microSeconds: gl
};
var Xa = [Va, Ka, Ja];

function Ya(t) {
    var e = [].concat(t.methods, Xa).filter(Boolean);
    if (t.type) {
        if (t.type === "simulate") return Qa;
        var r = e.find(function(o) {
            return o.type === t.type
        });
        if (r) return r;
        throw new Error("method-type " + t.type + " not found")
    }
    t.webWorkerSupport || (e = e.filter(function(o) {
        return o.type !== "idb"
    }));
    var n = e.find(function(o) {
        return o.canBeUsed()
    });
    if (n) return n;
    throw new Error("No usable method found in " + JSON.stringify(Xa.map(function(o) {
        return o.type
    })))
}
var Si = new Set,
    xl = 0,
    ct = function(e, r) {
        this.id = xl++, Si.add(this), this.name = e, Za && (r = Za), this.options = Ht(r), this.method = Ya(this.options), this._iL = !1, this._onML = null, this._addEL = {
            message: [],
            internal: []
        }, this._uMP = new Set, this._befC = [], this._prepP = null, bl(this)
    };
ct._pubkey = !0;
var Za;
ct.prototype = {
    postMessage: function(e) {
        if (this.closed) throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed " + JSON.stringify(e));
        return ec(this, "message", e)
    },
    postInternal: function(e) {
        return ec(this, "internal", e)
    },
    set onmessage(t) {
        var e = this.method.microSeconds(),
            r = {
                time: e,
                fn: t
            };
        rc(this, "message", this._onML), t && typeof t == "function" ? (this._onML = r, tc(this, "message", r)) : this._onML = null
    },
    addEventListener: function(e, r) {
        var n = this.method.microSeconds(),
            o = {
                time: n,
                fn: r
            };
        tc(this, e, o)
    },
    removeEventListener: function(e, r) {
        var n = this._addEL[e].find(function(o) {
            return o.fn === r
        });
        rc(this, e, n)
    },
    close: function() {
        var e = this;
        if (!this.closed) {
            Si.delete(this), this.closed = !0;
            var r = this._prepP ? this._prepP : se;
            return this._onML = null, this._addEL.message = [], r.then(function() {
                return Promise.all(Array.from(e._uMP))
            }).then(function() {
                return Promise.all(e._befC.map(function(n) {
                    return n()
                }))
            }).then(function() {
                return e.method.close(e._state)
            })
        }
    },
    get type() {
        return this.method.type
    },
    get isClosed() {
        return this.closed
    }
};

function ec(t, e, r) {
    var n = t.method.microSeconds(),
        o = {
            time: n,
            type: e,
            data: r
        },
        i = t._prepP ? t._prepP : se;
    return i.then(function() {
        var s = t.method.postMessage(t._state, o);
        return t._uMP.add(s), s.catch().then(function() {
            return t._uMP.delete(s)
        }), s
    })
}

function bl(t) {
    var e = t.method.create(t.name, t.options);
    Na(e) ? (t._prepP = e, e.then(function(r) {
        t._state = r
    })) : t._state = e
}

function nc(t) {
    return t._addEL.message.length > 0 || t._addEL.internal.length > 0
}

function tc(t, e, r) {
    t._addEL[e].push(r), Ol(t)
}

function rc(t, e, r) {
    t._addEL[e] = t._addEL[e].filter(function(n) {
        return n !== r
    }), kl(t)
}

function Ol(t) {
    if (!t._iL && nc(t)) {
        var e = function(o) {
                t._addEL[o.type].forEach(function(i) {
                    var s = 1e5,
                        a = i.time - s;
                    o.time >= a && i.fn(o.data)
                })
            },
            r = t.method.microSeconds();
        t._prepP ? t._prepP.then(function() {
            t._iL = !0, t.method.onMessage(t._state, e, r)
        }) : (t._iL = !0, t.method.onMessage(t._state, e, r))
    }
}

function kl(t) {
    if (t._iL && !nc(t)) {
        t._iL = !1;
        var e = t.method.microSeconds();
        t.method.onMessage(t._state, null, e)
    }
}

function oc(t) {
    if (typeof WorkerGlobalScope == "function" && self instanceof WorkerGlobalScope) {
        var e = self.close.bind(self);
        self.close = function() {
            return t(), e()
        }
    } else {
        if (typeof window.addEventListener != "function") return;
        window.addEventListener("beforeunload", function() {
            t()
        }, !0), window.addEventListener("unload", function() {
            t()
        }, !0)
    }
}

function ic(t) {
    process.on("exit", function() {
        return t()
    }), process.on("beforeExit", function() {
        return t().then(function() {
            return process.exit()
        })
    }), process.on("SIGINT", function() {
        return t().then(function() {
            return process.exit()
        })
    }), process.on("uncaughtException", function(e) {
        return t().then(function() {
            console.trace(e), process.exit(101)
        })
    })
}
var _l = Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]",
    Rl = _l ? ic : oc,
    _r = new Set,
    sc = !1;

function Pl() {
    sc || (sc = !0, Rl(Il))
}

function ac(t) {
    if (Pl(), typeof t != "function") throw new Error("Listener is no function");
    _r.add(t);
    var e = {
        remove: function() {
            return _r.delete(t)
        },
        run: function() {
            return _r.delete(t), t()
        }
    };
    return e
}

function Il() {
    var t = [];
    return _r.forEach(function(e) {
        t.push(e()), _r.delete(e)
    }), Promise.all(t)
}

function _e(t, e) {
    var r = {
        context: "leader",
        action: e,
        token: t.token
    };
    return t.broadcastChannel.postInternal(r)
}

function Rr(t) {
    t.isLeader = !0, t._hasLeader = !0;
    var e = ac(function() {
        return t.die()
    });
    t._unl.push(e);
    var r = function(o) {
        o.context === "leader" && o.action === "apply" && _e(t, "tell"), o.context === "leader" && o.action === "tell" && !t._dpLC && (t._dpLC = !0, t._dpL(), _e(t, "tell"))
    };
    return t.broadcastChannel.addEventListener("internal", r), t._lstns.push(r), _e(t, "tell")
}
var Ai = function(e, r) {
    var n = this;
    this.broadcastChannel = e, e._befC.push(function() {
        return n.die()
    }), this._options = r, this.isLeader = !1, this.isDead = !1, this.token = Oe(), this._lstns = [], this._unl = [], this._dpL = function() {}, this._dpLC = !1, this._wKMC = {}, this.lN = "pubkey-bc||" + e.method.type + "||" + e.name
};
Ai.prototype = {
    hasLeader: function() {
        var e = this;
        return navigator.locks.query().then(function(r) {
            var n = r.held ? r.held.filter(function(o) {
                return o.name === e.lN
            }) : [];
            return !!(n && n.length > 0)
        })
    },
    awaitLeadership: function() {
        var e = this;
        if (!this._wLMP) {
            this._wKMC.c = new AbortController;
            var r = new Promise(function(n, o) {
                e._wKMC.res = n, e._wKMC.rej = o
            });
            this._wLMP = new Promise(function(n) {
                navigator.locks.request(e.lN, {
                    signal: e._wKMC.c.signal
                }, function() {
                    return e._wKMC.c = void 0, Rr(e), n(), r
                }).catch(function() {})
            })
        }
        return this._wLMP
    },
    set onduplicate(t) {},
    die: function() {
        var e = this;
        return this._lstns.forEach(function(r) {
            return e.broadcastChannel.removeEventListener("internal", r)
        }), this._lstns = [], this._unl.forEach(function(r) {
            return r.remove()
        }), this._unl = [], this.isLeader && (this.isLeader = !1), this.isDead = !0, this._wKMC.res && this._wKMC.res(), this._wKMC.c && this._wKMC.c.abort("LeaderElectionWebLock.die() called"), _e(this, "death")
    }
};
var cc = function(e, r) {
    var n = this;
    this.broadcastChannel = e, this._options = r, this.isLeader = !1, this._hasLeader = !1, this.isDead = !1, this.token = Oe(), this._aplQ = se, this._aplQC = 0, this._unl = [], this._lstns = [], this._dpL = function() {}, this._dpLC = !1;
    var o = function(s) {
        s.context === "leader" && (s.action === "death" && (n._hasLeader = !1), s.action === "tell" && (n._hasLeader = !0))
    };
    this.broadcastChannel.addEventListener("internal", o), this._lstns.push(o)
};
cc.prototype = {
    hasLeader: function() {
        return Promise.resolve(this._hasLeader)
    },
    applyOnce: function(e) {
        var r = this;
        if (this.isLeader) return ye(0, !0);
        if (this.isDead) return ye(0, !1);
        if (this._aplQC > 1) return this._aplQ;
        var n = function() {
            if (r.isLeader) return La;
            var i = !1,
                s, a = new Promise(function(l) {
                    s = function() {
                        i = !0, l()
                    }
                }),
                c = function(f) {
                    f.context === "leader" && f.token != r.token && (f.action === "apply" && f.token > r.token && s(), f.action === "tell" && (s(), r._hasLeader = !0))
                };
            r.broadcastChannel.addEventListener("internal", c);
            var u = e ? r._options.responseTime * 4 : r._options.responseTime;
            return _e(r, "apply").then(function() {
                return Promise.race([ye(u), a.then(function() {
                    return Promise.reject(new Error)
                })])
            }).then(function() {
                return _e(r, "apply")
            }).then(function() {
                return Promise.race([ye(u), a.then(function() {
                    return Promise.reject(new Error)
                })])
            }).catch(function() {}).then(function() {
                return r.broadcastChannel.removeEventListener("internal", c), i ? !1 : Rr(r).then(function() {
                    return !0
                })
            })
        };
        return this._aplQC = this._aplQC + 1, this._aplQ = this._aplQ.then(function() {
            return n()
        }).then(function() {
            r._aplQC = r._aplQC - 1
        }), this._aplQ.then(function() {
            return r.isLeader
        })
    },
    awaitLeadership: function() {
        return this._aLP || (this._aLP = Cl(this)), this._aLP
    },
    set onduplicate(t) {
        this._dpL = t
    },
    die: function() {
        var e = this;
        return this._lstns.forEach(function(r) {
            return e.broadcastChannel.removeEventListener("internal", r)
        }), this._lstns = [], this._unl.forEach(function(r) {
            return r.remove()
        }), this._unl = [], this.isLeader && (this._hasLeader = !1, this.isLeader = !1), this.isDead = !0, _e(this, "death")
    }
};

function Cl(t) {
    return t.isLeader ? se : new Promise(function(e) {
        var r = !1;

        function n() {
            r || (r = !0, t.broadcastChannel.removeEventListener("internal", i), e(!0))
        }
        t.applyOnce().then(function() {
            t.isLeader && n()
        });
        var o = function s() {
            return ye(t._options.fallbackInterval).then(function() {
                if (!(t.isDead || r))
                    if (t.isLeader) n();
                    else return t.applyOnce(!0).then(function() {
                        t.isLeader ? n() : s()
                    })
            })
        };
        o();
        var i = function(a) {
            a.context === "leader" && a.action === "death" && (t._hasLeader = !1, t.applyOnce().then(function() {
                t.isLeader && n()
            }))
        };
        t.broadcastChannel.addEventListener("internal", i), t._lstns.push(i)
    })
}

function Ml(t, e) {
    return t || (t = {}), t = JSON.parse(JSON.stringify(t)), t.fallbackInterval || (t.fallbackInterval = 3e3), t.responseTime || (t.responseTime = e.method.averageResponseTime(e.options)), t
}

function Ei(t, e) {
    if (t._leaderElector) throw new Error("BroadcastChannel already has a leader-elector");
    e = Ml(e, t);
    var r = Fa() ? new Ai(t, e) : new cc(t, e);
    return t._befC.push(function() {
        return r.die()
    }), t._leaderElector = r, r
}
var Bn = class {
    constructor(e, r = {}) {
        this.started = !1, this.enablePostMessage = !0, this.tokenManager = e, this.options = r, this.onTokenAddedHandler = this.onTokenAddedHandler.bind(this), this.onTokenRemovedHandler = this.onTokenRemovedHandler.bind(this), this.onTokenRenewedHandler = this.onTokenRenewedHandler.bind(this), this.onSetStorageHandler = this.onSetStorageHandler.bind(this), this.onSyncMessageHandler = this.onSyncMessageHandler.bind(this)
    }
    requiresLeadership() {
        return !1
    }
    isStarted() {
        return this.started
    }
    canStart() {
        return !!this.options.syncStorage && k() && !this.started
    }
    async start() {
        if (!this.canStart()) return;
        let {
            syncChannelName: e
        } = this.options;
        try {
            this.channel = new ct(e)
        } catch {
            throw new d("SyncStorageService is not supported in current browser.")
        }
        this.tokenManager.on(pe, this.onTokenAddedHandler), this.tokenManager.on(he, this.onTokenRemovedHandler), this.tokenManager.on(ze, this.onTokenRenewedHandler), this.tokenManager.on(Je, this.onSetStorageHandler), this.channel.addEventListener("message", this.onSyncMessageHandler), this.started = !0
    }
    async stop() {
        var e, r;
        this.started && (this.tokenManager.off(pe, this.onTokenAddedHandler), this.tokenManager.off(he, this.onTokenRemovedHandler), this.tokenManager.off(ze, this.onTokenRenewedHandler), this.tokenManager.off(Je, this.onSetStorageHandler), (e = this.channel) === null || e === void 0 || e.removeEventListener("message", this.onSyncMessageHandler), await ((r = this.channel) === null || r === void 0 ? void 0 : r.close()), this.channel = void 0, this.started = !1)
    }
    onTokenAddedHandler(e, r) {
        var n;
        this.enablePostMessage && ((n = this.channel) === null || n === void 0 || n.postMessage({
            type: pe,
            key: e,
            token: r
        }))
    }
    onTokenRemovedHandler(e, r) {
        var n;
        this.enablePostMessage && ((n = this.channel) === null || n === void 0 || n.postMessage({
            type: he,
            key: e,
            token: r
        }))
    }
    onTokenRenewedHandler(e, r, n) {
        var o;
        this.enablePostMessage && ((o = this.channel) === null || o === void 0 || o.postMessage({
            type: ze,
            key: e,
            token: r,
            oldToken: n
        }))
    }
    onSetStorageHandler(e) {
        var r;
        (r = this.channel) === null || r === void 0 || r.postMessage({
            type: Je,
            storage: e
        })
    }
    onSyncMessageHandler(e) {
        switch (this.enablePostMessage = !1, e.type) {
            case Je:
                this.tokenManager.getStorage().setStorage(e.storage);
                break;
            case pe:
                this.tokenManager.emitAdded(e.key, e.token), this.tokenManager.setExpireEventTimeout(e.key, e.token);
                break;
            case he:
                this.tokenManager.clearExpireEventTimeout(e.key), this.tokenManager.emitRemoved(e.key, e.token);
                break;
            case ze:
                this.tokenManager.emitRenewed(e.key, e.token, e.oldToken);
                break
        }
        this.enablePostMessage = !0
    }
};
var Wn = class {
    constructor(e = {}) {
        this.started = !1, this.options = e, this.onLeaderDuplicate = this.onLeaderDuplicate.bind(this), this.onLeader = this.onLeader.bind(this)
    }
    onLeaderDuplicate() {}
    async onLeader() {
        var e, r;
        await ((r = (e = this.options).onLeader) === null || r === void 0 ? void 0 : r.call(e))
    }
    isLeader() {
        var e;
        return !!(!((e = this.elector) === null || e === void 0) && e.isLeader)
    }
    hasLeader() {
        var e;
        return !!(!((e = this.elector) === null || e === void 0) && e.hasLeader)
    }
    async start() {
        if (this.canStart()) {
            let {
                electionChannelName: e
            } = this.options;
            this.channel = new ct(e), this.elector = Ei(this.channel), this.elector.onduplicate = this.onLeaderDuplicate, this.elector.awaitLeadership().then(this.onLeader), this.started = !0
        }
    }
    async stop() {
        this.started && (this.elector && (await this.elector.die(), this.elector = void 0), this.channel && (this.channel.postInternal = () => Promise.resolve(), await this.channel.close(), this.channel = void 0), this.started = !1)
    }
    requiresLeadership() {
        return !1
    }
    isStarted() {
        return this.started
    }
    canStart() {
        return k() && !this.started
    }
};
var uc = () => Math.floor(Date.now() / 1e3),
    qn = class {
        constructor(e, r = {}) {
            this.started = !1, this.lastHidden = -1, this.tokenManager = e, this.options = r, this.onPageVisbilityChange = this._onPageVisbilityChange.bind(this)
        }
        _onPageVisbilityChange() {
            if (document.hidden) this.lastHidden = uc();
            else if (this.lastHidden > 0 && uc() - this.lastHidden >= this.options.tabInactivityDuration) {
                let {
                    accessToken: e,
                    idToken: r
                } = this.tokenManager.getTokensSync();
                if (e && this.tokenManager.hasExpired(e)) {
                    let n = this.tokenManager.getStorageKeyByType("accessToken");
                    this.tokenManager.renew(n).catch(() => {})
                } else if (r && this.tokenManager.hasExpired(r)) {
                    let n = this.tokenManager.getStorageKeyByType("idToken");
                    this.tokenManager.renew(n).catch(() => {})
                }
            }
        }
        async start() {
            this.canStart() && document && (document.addEventListener("visibilitychange", this.onPageVisbilityChange), this.started = !0)
        }
        async stop() {
            document && (document.removeEventListener("visibilitychange", this.onPageVisbilityChange), this.started = !1)
        }
        canStart() {
            return k() && !!this.options.autoRenew && !!this.options.renewOnTabActivation && !this.started
        }
        requiresLeadership() {
            return !1
        }
        isStarted() {
            return this.started
        }
    };
var lc = "autoRenew",
    fc = "syncStorage",
    Kn = "leaderElection",
    dc = "renewOnTabActivation",
    xi = (() => {
        class t {
            constructor(r, n = {}) {
                this.sdk = r, this.onLeader = this.onLeader.bind(this);
                let {
                    autoRenew: o,
                    autoRemove: i,
                    syncStorage: s
                } = r.tokenManager.getOptions();
                n.electionChannelName = n.electionChannelName || n.broadcastChannelName, this.options = Object.assign({}, t.defaultOptions, {
                    autoRenew: o,
                    autoRemove: i,
                    syncStorage: s
                }, {
                    electionChannelName: `${r.options.clientId}-election`,
                    syncChannelName: `${r.options.clientId}-sync`
                }, D(n)), this.started = !1, this.services = new Map, t.knownServices.forEach(a => {
                    let c = this.createService(a);
                    c && this.services.set(a, c)
                })
            }
            async onLeader() {
                this.started && await this.startServices()
            }
            isLeader() {
                var r;
                return (r = this.getService(Kn)) === null || r === void 0 ? void 0 : r.isLeader()
            }
            isLeaderRequired() {
                return [...this.services.values()].some(r => r.canStart() && r.requiresLeadership())
            }
            async start() {
                this.started || (await this.startServices(), this.started = !0)
            }
            async stop() {
                await this.stopServices(), this.started = !1
            }
            getService(r) {
                return this.services.get(r)
            }
            async startServices() {
                for (let [r, n] of this.services.entries()) this.canStartService(r, n) && await n.start()
            }
            async stopServices() {
                for (let r of this.services.values()) await r.stop()
            }
            canStartService(r, n) {
                let o = n.canStart() && !n.isStarted();
                return r === Kn ? o && (o = this.isLeaderRequired()) : n.requiresLeadership() && o && (o = this.isLeader()), o
            }
            createService(r) {
                let n = this.sdk.tokenManager,
                    o;
                switch (r) {
                    case Kn:
                        o = new Wn(Object.assign(Object.assign({}, this.options), {
                            onLeader: this.onLeader
                        }));
                        break;
                    case lc:
                        o = new Fn(n, Object.assign({}, this.options));
                        break;
                    case fc:
                        o = new Bn(n, Object.assign({}, this.options));
                        break;
                    case dc:
                        o = new qn(n, Object.assign({}, this.options));
                        break;
                    default:
                        throw new Error(`Unknown service ${r}`)
                }
                return o
            }
        }
        return t.knownServices = [lc, fc, Kn, dc], t.defaultOptions = {
            autoRenew: !0,
            autoRemove: !0,
            syncStorage: !0,
            renewOnTabActivation: !0,
            tabInactivityDuration: 1800
        }, t
    })();

function bi(t) {
    return class extends t {
        constructor(...r) {
            super(...r), this.authStateManager = new kr(this), this.serviceManager = new xi(this, this.options.services)
        }
        async start() {
            await this.serviceManager.start(), this.tokenManager.start(), this.token.isLoginRedirect() || await this.authStateManager.updateAuthState()
        }
        async stop() {
            this.tokenManager.stop(), await this.serviceManager.stop()
        }
        async handleRedirect(r) {
            await this.handleLoginRedirect(void 0, r)
        }
        async handleLoginRedirect(r, n) {
            let o = this.options.state;
            if (r) this.tokenManager.setTokens(r), n = n || this.getOriginalUri(this.options.state);
            else if (this.isLoginRedirect()) try {
                o = (await Dn(this, {})).state, n = n || this.getOriginalUri(o), await this.storeTokensFromRedirect()
            } catch (s) {
                throw await this.authStateManager.updateAuthState(), s
            } else return;
            await this.authStateManager.updateAuthState(), this.removeOriginalUri(o);
            let {
                restoreOriginalUri: i
            } = this.options;
            i ? await i(this, n) : n && window.location.replace(n)
        }
        handleIDPPopupRedirect(r = window.location.href) {
            let n = Dn(this, {
                responseMode: "query",
                url: r
            });
            if (n.state) {
                let o = new BroadcastChannel(`popup-callback:${n.state}`);
                o.postMessage(n), o.close()
            } else throw new d("Unable to parse auth code params")
        }
    }
}
var YO = y(x(), 1);
var ek = y(_(), 1);

function Oi(t) {
    return t.session.get().then(function(e) {
        return e.status === "ACTIVE"
    }).catch(function() {
        return !1
    })
}

function ki(t) {
    return le(t, "/api/v1/sessions/me", {
        withCredentials: !0
    }).then(function(e) {
        var r = Te(e, "_links");
        return r.refresh = function() {
            return Z(t, mt(e, "refresh").href, {}, {
                withCredentials: !0
            })
        }, r.user = function() {
            return le(t, mt(e, "user").href, {
                withCredentials: !0
            })
        }, r
    }).catch(function() {
        return {
            status: "INACTIVE"
        }
    })
}

function _i(t) {
    return j(t, {
        url: t.getIssuerOrigin() + "/api/v1/sessions/me",
        method: "DELETE",
        withCredentials: !0
    })
}

function Ri(t) {
    return Z(t, "/api/v1/sessions/me/lifecycle/refresh", {}, {
        withCredentials: !0
    })
}

function Pi(t, e, r) {
    r = r || window.location.href, window.location.assign(t.getIssuerOrigin() + "/login/sessionCookieRedirect" + W({
        checkAccountSetupComplete: !0,
        token: e,
        redirectUrl: r
    }))
}

function Ii(t) {
    return {
        close: _i.bind(null, t),
        exists: Oi.bind(null, t),
        get: ki.bind(null, t),
        refresh: Ri.bind(null, t),
        setCookieAndRedirect: Pi.bind(null, t)
    }
}

function Pr(t) {
    return class extends t {
        constructor(...r) {
            super(...r), this.session = Ii(this)
        }
        closeSession() {
            return this.session.close().then(async () => (this.clearStorage(), !0)).catch(function(r) {
                if (r.name === "AuthApiError" && r.errorCode === "E0000007") return !1;
                throw r
            })
        }
    }
}

function Gn(t, e, r) {
    let n = wr(e),
        o = yr(n, t),
        i = Sr(o),
        s = Pr(i),
        a = Nn(s, r);
    return bi(a)
}
var yk = y(x(), 1);
var Sk = y(_(), 1);
var Dl = (t, e) => e.source === t.contentWindow;

function Ir(t, e) {
    var r;
    if (!ho()) return Promise.reject(new d("Fingerprinting is not supported on this device"));
    let n = (r = e ? .container) !== null && r !== void 0 ? r : document.body,
        o, i, s;
    return new Promise(function(c, u) {
        i = document.createElement("iframe"), i.style.display = "none", s = function(f) {
            var p;
            if (!Dl(i, f) || !f || !f.data || f.origin !== t.getIssuerOrigin()) return;
            let m;
            try {
                m = JSON.parse(f.data)
            } catch {
                return
            }
            if (m) {
                if (m.type === "FingerprintAvailable") return c(m.fingerprint);
                if (m.type === "FingerprintServiceReady")(p = i ? .contentWindow) === null || p === void 0 || p.postMessage(JSON.stringify({
                    type: "GetFingerprint"
                }), f.origin);
                else return u(new d("No data"))
            }
        }, Pn(window, "message", s), i.src = t.getIssuerOrigin() + "/auth/services/devicefingerprint", n.appendChild(i), o = setTimeout(function() {
            u(new d("Fingerprinting timed out"))
        }, e ? .timeout || 15e3)
    }).finally(function() {
        var c;
        clearTimeout(o), In(window, "message", s), n.contains(i) && ((c = i.parentElement) === null || c === void 0 || c.removeChild(i))
    })
}
var $n = {};
dt($n, {
    buildCredentialCreationOptions: () => Ul,
    buildCredentialRequestOptions: () => Nl,
    getAssertion: () => jl,
    getAttestation: () => Ll
});
var pc = (t = []) => {
        let e = [];
        return t.forEach(r => {
            r.key === "webauthn" && e.push({
                type: "public-key",
                id: ot(r.credentialId)
            })
        }), e
    },
    Ul = (t, e) => ({
        publicKey: {
            rp: t.rp,
            user: {
                id: ot(t.user.id),
                name: t.user.name,
                displayName: t.user.displayName
            },
            challenge: ot(t.challenge),
            pubKeyCredParams: t.pubKeyCredParams,
            attestation: t.attestation,
            authenticatorSelection: t.authenticatorSelection,
            excludeCredentials: pc(e)
        }
    }),
    Nl = (t, e) => ({
        publicKey: Object.assign({
            challenge: ot(t.challenge),
            userVerification: t.userVerification,
            allowCredentials: pc(e)
        }, t.rpId && {
            rpId: t.rpId
        })
    }),
    Ll = t => {
        let e = t.response,
            r = t.id,
            n = we(e.clientDataJSON),
            o = we(e.attestationObject);
        return {
            id: r,
            clientData: n,
            attestation: o
        }
    },
    jl = t => {
        let e = t.response,
            r = t.id,
            n = we(e.clientDataJSON),
            o = we(e.authenticatorData),
            i = we(e.signature);
        return {
            id: r,
            clientData: n,
            authenticatorData: o,
            signatureData: i
        }
    };

function Ci(t) {
    var e;
    return e = class extends t {
        constructor(...n) {
            super(...n), this.idx = Bo(this), this.fingerprint = Ir.bind(null, this)
        }
    }, e.webauthn = $n, e
}

function Mi(t, e, r) {
    let n = Gn(t, e, r);
    return Ci(n)
}
var Zk = y(x(), 1);
var t_ = y(_(), 1);
var H_ = y(x(), 1);
var W_ = y(_(), 1);
var y_ = y(x(), 1);

function Di() {
    return class {
        constructor(e) {
            this.devMode = !!e.devMode
        }
    }
}

function hc() {
    return Object.assign({}, Vt, {
        inMemoryStore: {}
    })
}
var mc = {
    token: {
        storageTypes: ["localStorage", "sessionStorage", "cookie"]
    },
    cache: {
        storageTypes: ["localStorage", "sessionStorage", "cookie"]
    },
    transaction: {
        storageTypes: ["sessionStorage", "localStorage", "cookie"]
    },
    "shared-transaction": {
        storageTypes: ["localStorage"]
    },
    "original-uri": {
        storageTypes: ["localStorage"]
    }
};

function gc(t = {}, e) {
    var r = t.cookies || {};
    return typeof r.secure > "u" && (r.secure = e), typeof r.sameSite > "u" && (r.sameSite = r.secure ? "none" : "lax"), r.secure && !e && (N(`The current page is not being served with the HTTPS protocol.
For security reasons, we strongly recommend using HTTPS.
If you cannot use HTTPS, set "cookies.secure" option to false.`), r.secure = !1), r.sameSite === "none" && !r.secure && (r.sameSite = "lax"), r
}

function Ui() {
    let t = Di();
    return class extends t {
        constructor(r) {
            super(r), this.cookies = gc(r, go()), this.storageUtil = r.storageUtil || hc(), this.storageManager = Object.assign(Object.assign({}, mc), r.storageManager)
        }
    }
}
var vc = y(_(), 1);
var Fl = /application\/\w*\+?json/;

function Vl(t) {
    return t.headers.get("Content-Type") && t.headers.get("Content-Type").toLowerCase().indexOf("application/json") >= 0 ? t.json().catch(e => ({
        error: e,
        errorSummary: "Could not parse server response"
    })) : t.text()
}

function Hl(t, e, r) {
    let n = typeof e == "object",
        o = {};
    for (let s of r.headers.entries()) o[s[0]] = s[1];
    let i = {
        responseText: n ? JSON.stringify(e) : e,
        status: t,
        headers: o
    };
    return n && (i.responseType = "json", i.responseJSON = e), i
}

function wc(t, e, r) {
    var n = r.data,
        o = r.headers || {},
        i = o["Content-Type"] || o["content-type"] || "";
    n && typeof n != "string" && (Fl.test(i) ? n = JSON.stringify(n) : i === "application/x-www-form-urlencoded" && (n = Object.entries(n).map(([c, u]) => `${c}=${encodeURIComponent(u)}`).join("&")));
    var s = window.fetch || vc.default,
        a = s(e, {
            method: t,
            headers: r.headers,
            body: n,
            credentials: r.withCredentials ? "include" : "omit"
        });
    return a.finally || (a = Promise.resolve(a)), a.then(function(c) {
        var u = !c.ok,
            l = c.status;
        return Vl(c).then(f => Hl(l, f, c)).then(f => {
            var p;
            if (u || !((p = f.responseJSON) === null || p === void 0) && p.error) throw f;
            return f
        })
    })
}

function Ni() {
    let t = Ui();
    return class extends t {
        constructor(r) {
            super(r), this.issuer = r.issuer, this.transformErrorXHR = r.transformErrorXHR, this.headers = r.headers, this.httpRequestClient = r.httpRequestClient || wc, this.httpRequestInterceptors = r.httpRequestInterceptors, this.pollDelay = r.pollDelay
        }
    }
}

function Wl(t) {
    t = t || {};
    var e = t.scopes;
    if (e && !Array.isArray(e)) throw new d('scopes must be a array of strings. Required usage: new OktaAuth({scopes: ["openid", "email"]})');
    var r = t.issuer;
    if (!r) throw new d('No issuer passed to constructor. Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
    var n = new RegExp("^http?s?://.+");
    if (!n.test(r)) throw new d('Issuer must be a valid URL. Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
    if (r.indexOf("-admin.okta") !== -1) throw new d('Issuer URL passed to constructor contains "-admin" in subdomain. Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com})')
}

function Li() {
    let t = Ni();
    return class extends t {
        constructor(r) {
            super(r), Wl(r), this.issuer = $(r.issuer), this.tokenUrl = $(r.tokenUrl), this.authorizeUrl = $(r.authorizeUrl), this.userinfoUrl = $(r.userinfoUrl), this.revokeUrl = $(r.revokeUrl), this.logoutUrl = $(r.logoutUrl), this.pkce = r.pkce !== !1, this.clientId = r.clientId, this.redirectUri = r.redirectUri, k() && (this.redirectUri = co(r.redirectUri, window.location.origin)), this.responseType = r.responseType, this.responseMode = r.responseMode, this.state = r.state, this.scopes = r.scopes, this.ignoreSignature = !!r.ignoreSignature, this.codeChallenge = r.codeChallenge, this.codeChallengeMethod = r.codeChallengeMethod, this.acrValues = r.acrValues, this.maxAge = r.maxAge, this.dpop = r.dpop === !0, this.dpopOptions = Object.assign({
                allowBearerTokens: !1
            }, r.dpopOptions), this.tokenManager = r.tokenManager, this.postLogoutRedirectUri = r.postLogoutRedirectUri, this.restoreOriginalUri = r.restoreOriginalUri, this.transactionManager = Object.assign({
                enableSharedStorage: !0
            }, r.transactionManager), this.clientSecret = r.clientSecret, this.setLocation = r.setLocation, this.ignoreLifetime = !!r.ignoreLifetime, !r.maxClockSkew && r.maxClockSkew !== 0 ? this.maxClockSkew = 300 : this.maxClockSkew = r.maxClockSkew
        }
    }
}

function ji() {
    let t = Li();
    return class extends t {
        constructor(r) {
            super(r), this.services = r.services, this.transformAuthState = r.transformAuthState
        }
    }
}

function Fi() {
    let t = ji();
    return class extends t {
        constructor(r) {
            super(r), this.flow = r.flow, this.activationToken = r.activationToken, this.recoveryToken = r.recoveryToken, this.idx = r.idx
        }
    }
}
var wR = y(x(), 1);
var ce = class {
    constructor(e, r) {
        if (!e) throw new d('"storage" is required');
        if (typeof r != "string" || !r.length) throw new d('"storageName" is required');
        this.storageName = r, this.storageProvider = e
    }
    getItem(e) {
        return this.getStorage()[e]
    }
    setItem(e, r) {
        return this.updateStorage(e, r)
    }
    removeItem(e) {
        return this.clearStorage(e)
    }
    getStorage() {
        var e = this.storageProvider.getItem(this.storageName);
        e = e || "{}";
        try {
            return JSON.parse(e)
        } catch {
            throw new d("Unable to parse storage string: " + this.storageName)
        }
    }
    setStorage(e) {
        try {
            var r = e ? JSON.stringify(e) : "{}";
            this.storageProvider.setItem(this.storageName, r)
        } catch {
            throw new d("Unable to set storage: " + this.storageName)
        }
    }
    clearStorage(e) {
        if (!e) {
            this.storageProvider.removeItem ? this.storageProvider.removeItem(this.storageName) : this.setStorage();
            return
        }
        var r = this.getStorage();
        delete r[e], this.setStorage(r)
    }
    updateStorage(e, r) {
        var n = this.getStorage();
        n[e] = r, this.setStorage(n)
    }
};

function Bt(t) {
    !k() && !t.storageProvider && !t.storageKey && N("Memory storage can only support simple single user use case on server side, please provide custom storageProvider or storageKey if advanced scenarios need to be supported.")
}
var Cr = class {
    constructor(e, r, n) {
        this.storageManagerOptions = e, this.cookieOptions = r, this.storageUtil = n
    }
    getOptionsForSection(e, r) {
        return Object.assign({}, this.storageManagerOptions[e], r)
    }
    getStorage(e) {
        if (e = Object.assign({}, this.cookieOptions, e), e.storageProvider) return e.storageProvider;
        let {
            storageType: r,
            storageTypes: n
        } = e;
        if (r === "sessionStorage" && (e.sessionCookie = !0), r && n) {
            let o = n.indexOf(r);
            o >= 0 && (n = n.slice(o), r = void 0)
        }
        return r || (r = this.storageUtil.findStorageType(n)), this.storageUtil.getStorageByType(r, e)
    }
    getTokenStorage(e) {
        e = this.getOptionsForSection("token", e), Bt(e);
        let r = this.getStorage(e),
            n = e.storageKey || vt;
        return new ce(r, n)
    }
    getHttpCache(e) {
        e = this.getOptionsForSection("cache", e);
        let r = this.getStorage(e),
            n = e.storageKey || qr;
        return new ce(r, n)
    }
};
var cR = y(x(), 1);

function Vi() {
    return class extends Cr {
        constructor(e, r, n) {
            super(e, r, n)
        }
        getTransactionStorage(e) {
            e = this.getOptionsForSection("transaction", e), Bt(e);
            let r = this.getStorage(e),
                n = e.storageKey || Kr;
            return new ce(r, n)
        }
        getSharedTansactionStorage(e) {
            e = this.getOptionsForSection("shared-transaction", e), Bt(e);
            let r = this.getStorage(e),
                n = e.storageKey || Gr;
            return new ce(r, n)
        }
        getOriginalUriStorage(e) {
            e = this.getOptionsForSection("original-uri", e), Bt(e);
            let r = this.getStorage(e),
                n = e.storageKey || $r;
            return new ce(r, n)
        }
    }
}

function Hi() {
    return Vi()
}

function Bi() {
    let t = Hi();
    return class extends t {
        constructor(r, n, o) {
            super(r, n, o)
        }
        getIdxResponseStorage(r) {
            let n;
            if (k()) try {
                n = this.storageUtil.getStorageByType("memory", r)
            } catch {
                N("No response storage found, you may want to provide custom implementation for intermediate idx responses to optimize the network traffic")
            } else {
                let o = this.getTransactionStorage(r);
                o && (n = {
                    getItem: i => {
                        let s = o.getStorage();
                        return s && s[i] ? s[i] : null
                    },
                    setItem: (i, s) => {
                        let a = o.getStorage();
                        if (!a) throw new d("Transaction has been cleared, failed to save idxState");
                        a[i] = s, o.setStorage(a)
                    },
                    removeItem: i => {
                        let s = o.getStorage();
                        s && (delete s[i], o.setStorage(s))
                    }
                })
            }
            return n ? new ce(n, zr) : null
        }
    }
}

function yc(t) {
    return !(!t || typeof t != "object" || Object.values(t).length === 0)
}

function Tc(t) {
    return yc(t) ? !!t.redirectUri || !!t.responseType : !1
}

function Sc(t) {
    return yc(t) ? Object.values(t).find(r => typeof r != "string") === void 0 : !1
}

function ut(t) {
    return !!(Tc(t) || Sc(t))
}
var ql = 30 * 60 * 1e3;

function Ac(t) {
    let e = t.getSharedTansactionStorage(),
        r = e.getStorage();
    Object.keys(r).forEach(n => {
        let o = r[n];
        Date.now() - o.dateCreated > ql && delete r[n]
    }), e.setStorage(r)
}

function Ec(t, e, r) {
    let n = t.getSharedTansactionStorage(),
        o = n.getStorage();
    o[e] = {
        dateCreated: Date.now(),
        transaction: r
    }, n.setStorage(o)
}

function xc(t, e) {
    let o = t.getSharedTansactionStorage().getStorage()[e];
    return o && o.transaction && ut(o.transaction) ? o.transaction : null
}

function bc(t, e) {
    let r = t.getSharedTansactionStorage(),
        n = r.getStorage();
    delete n[e], r.setStorage(n)
}

function Wi() {
    return class {
        constructor(e) {
            this.storageManager = e.storageManager, this.enableSharedStorage = e.enableSharedStorage !== !1, this.saveLastResponse = e.saveLastResponse !== !1, this.options = e
        }
        clear(e = {}) {
            let r = this.storageManager.getTransactionStorage(),
                n = r.getStorage();
            if (r.clearStorage(), this.enableSharedStorage && e.clearSharedStorage !== !1) {
                let o = e.state || n ? .state;
                o && bc(this.storageManager, o)
            }
        }
        save(e, r = {}) {
            let n = this.storageManager.getTransactionStorage(),
                o = n.getStorage();
            ut(o) && !r.muteWarning && N("a saved auth transaction exists in storage. This may indicate another auth flow is already in progress."), n.setStorage(e), this.enableSharedStorage && e.state && Ec(this.storageManager, e.state, e)
        }
        exists(e = {}) {
            try {
                return !!this.load(e)
            } catch {
                return !1
            }
        }
        load(e = {}) {
            let r;
            return this.enableSharedStorage && e.state && (Ac(this.storageManager), r = xc(this.storageManager, e.state), ut(r)) || (r = this.storageManager.getTransactionStorage().getStorage(), ut(r)) ? r : null
        }
    }
}

function qi() {
    let t = Wi();
    return class extends t {
        constructor(r) {
            super(r)
        }
        clear(r = {}) {
            super.clear(r), r.clearIdxResponse !== !1 && this.clearIdxResponse()
        }
        saveIdxResponse(r) {
            if (!this.saveLastResponse) return;
            let n = this.storageManager.getIdxResponseStorage();
            n && n.setStorage(r)
        }
        loadIdxResponse(r) {
            if (!this.saveLastResponse) return null;
            let n = this.storageManager.getIdxResponseStorage();
            if (!n) return null;
            let o = n.getStorage();
            if (!o || !nn(o.rawIdxResponse)) return null;
            if (r) {
                let {
                    stateHandle: i,
                    interactionHandle: s
                } = r;
                if (!r.useGenericRemediator && i && o.stateHandle !== i || s && o.interactionHandle !== s) return null
            }
            return o
        }
        clearIdxResponse() {
            if (!this.saveLastResponse) return;
            let r = this.storageManager.getIdxResponseStorage();
            r ? .clearStorage()
        }
    }
}
var F = class {
    constructor(e, r) {
        let {
            res: n
        } = r, {
            headers: o
        } = n, i = te(n, ["headers"]);
        o && (this.headers = o), Object.keys(i).forEach(s => {
            s !== "_links" && (this[s] = i[s])
        })
    }
};
var KR = y(x(), 1);
var $R = y(_(), 1);
async function C(t, e, r = F) {
    let {
        accessToken: n
    } = t.tokenManager.getTokensSync(), o = e.accessToken || n, i = t.getIssuerOrigin(), {
        url: s,
        method: a,
        payload: c
    } = e, u = s.startsWith(i) ? s : `${i}${s}`;
    if (!o) throw new d("AccessToken is required to request MyAccount API endpoints.");
    let l = o,
        f = Object.assign({
            headers: {
                Accept: "*/*;okta-version=1.0.0"
            },
            url: u,
            method: a
        }, c && {
            args: c
        });
    if (t.options.dpop) {
        if (typeof l == "string") throw new d("AccessToken object must be provided when using dpop");
        let {
            Authorization: v,
            Dpop: w
        } = await t.getDPoPAuthorizationHeaders({
            method: a,
            url: u,
            accessToken: l
        });
        f.headers.Authorization = v, f.headers.Dpop = w
    } else l = typeof l == "string" ? l : l.accessToken, f.accessToken = l;
    let p = await j(t, f),
        m;
    return Array.isArray(p) ? m = p.map(v => new r(t, {
        res: v,
        accessToken: l
    })) : m = new r(t, {
        res: p,
        accessToken: l
    }), m
}

function V({
    oktaAuth: t,
    accessToken: e,
    methodName: r,
    links: n
}, o = F) {
    for (let s of ["GET", "POST", "PUT", "DELETE"])
        if (s.toLowerCase() === r) {
            let a = n.self;
            return async c => C(t, {
                accessToken: e,
                url: a.href,
                method: s,
                payload: c
            }, o)
        }
    let i = n[r];
    if (!i) throw new d(`No link is found with methodName: ${r}`);
    return async s => C(t, {
        accessToken: e,
        url: i.href,
        method: i.hints.allow[0],
        payload: s
    }, o)
}
var Mr = class extends F {
    constructor(e, r) {
        super(e, r);
        let {
            createdAt: n,
            modifiedAt: o,
            profile: i
        } = r.res;
        this.createdAt = n, this.modifiedAt = o, this.profile = i
    }
};
var zn = class extends F {
    constructor(e, r) {
        super(e, r), this.properties = r.res.properties
    }
};
var Jn = function(t) {
    return t.NOT_ENROLLED = "NOT_ENROLLED", t.ACTIVE = "ACTIVE", t
}(Jn || {});
var Ki = async (t, e) => await C(t, {
        url: "/idp/myaccount/profile",
        method: "GET",
        accessToken: e ? .accessToken
    }, Mr),
    Gi = async (t, e) => {
        let {
            payload: r,
            accessToken: n
        } = e;
        return await C(t, {
            url: "/idp/myaccount/profile",
            method: "PUT",
            payload: r,
            accessToken: n
        }, Mr)
    },
    $i = async (t, e) => await C(t, {
        url: "/idp/myaccount/profile/schema",
        method: "GET",
        accessToken: e ? .accessToken
    }, zn);
var Wt = class extends F {
    constructor(e, r) {
        super(e, r);
        let {
            res: n
        } = r, {
            id: o,
            profile: i,
            expiresAt: s,
            status: a
        } = n;
        this.id = o, this.expiresAt = s, this.profile = i, this.status = a
    }
};
var lt = class t extends F {
    constructor(e, r) {
        super(e, r);
        let {
            accessToken: n,
            res: o
        } = r, {
            id: i,
            expiresAt: s,
            profile: a,
            status: c,
            _links: u
        } = o;
        this.id = i, this.expiresAt = s, this.profile = a, this.status = c, this.poll = async () => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "poll",
            links: u
        }, Wt)(), this.verify = async l => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "verify",
            links: u
        }, t)(l)
    }
};
var qt = class t extends F {
    constructor(e, r) {
        super(e, r);
        let {
            accessToken: n,
            res: o
        } = r, {
            id: i,
            profile: s,
            roles: a,
            status: c,
            _links: u
        } = o;
        this.id = i, this.profile = s, this.roles = a, this.status = c, this.get = async () => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "get",
            links: u
        }, t)(), this.delete = async () => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "delete",
            links: u
        })(), this.challenge = async () => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "challenge",
            links: u
        }, lt)(), u.poll && (this.poll = async () => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "poll",
            links: u
        }, Wt)()), u.verify && (this.verify = async l => await V({
            oktaAuth: e,
            accessToken: n,
            methodName: "verify",
            links: u
        })(l))
    }
};
var zi = async (t, e) => await C(t, {
        url: "/idp/myaccount/emails",
        method: "GET",
        accessToken: e ? .accessToken
    }, qt),
    Ji = async (t, e) => {
        let {
            id: r,
            accessToken: n
        } = e;
        return await C(t, {
            url: `/idp/myaccount/emails/${r}`,
            method: "GET",
            accessToken: n
        }, qt)
    },
    Qi = async (t, e) => {
        let {
            accessToken: r,
            payload: n
        } = e;
        return await C(t, {
            url: "/idp/myaccount/emails",
            method: "POST",
            payload: n,
            accessToken: r
        }, qt)
    },
    Xi = async (t, e) => {
        let {
            id: r,
            accessToken: n
        } = e;
        return await C(t, {
            url: `/idp/myaccount/emails/${r}`,
            method: "DELETE",
            accessToken: n
        })
    },
    Yi = async (t, e) => {
        let {
            id: r,
            accessToken: n
        } = e;
        return await C(t, {
            url: `/idp/myaccount/emails/${r}/challenge`,
            method: "POST",
            accessToken: n
        }, lt)
    },
    Zi = async (t, e) => {
        let {
            emailId: r,
            challengeId: n,
            accessToken: o
        } = e;
        return await C(t, {
            url: `/idp/myaccount/emails/${r}/challenge/${n}`,
            method: "POST",
            accessToken: o
        }, lt)
    },
    es = async (t, e) => {
        let {
            emailId: r,
            challengeId: n,
            payload: o,
            accessToken: i
        } = e;
        return await C(t, {
            url: `/idp/myaccount/emails/${r}/challenge/${n}/verify`,
            method: "POST",
            payload: o,
            accessToken: i
        })
    };
var Kt = class t extends F {
    constructor(e, r) {
        super(e, r);
        let {
            res: n,
            accessToken: o
        } = r, {
            id: i,
            profile: s,
            status: a,
            _links: c
        } = n;
        this.id = i, this.profile = s, this.status = a, this.get = async () => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "get",
            links: c
        }, t)(), this.delete = async () => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "delete",
            links: c
        })(), this.challenge = async u => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "challenge",
            links: c
        })(u), c.verify && (this.verify = async u => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "verify",
            links: c
        })(u))
    }
};
var ts = async (t, e) => await C(t, {
        url: "/idp/myaccount/phones",
        method: "GET",
        accessToken: e ? .accessToken
    }, Kt),
    rs = async (t, e) => {
        let {
            accessToken: r,
            id: n
        } = e;
        return await C(t, {
            url: `/idp/myaccount/phones/${n}`,
            method: "GET",
            accessToken: r
        }, Kt)
    },
    ns = async (t, e) => {
        let {
            accessToken: r,
            payload: n
        } = e;
        return await C(t, {
            url: "/idp/myaccount/phones",
            method: "POST",
            payload: n,
            accessToken: r
        }, Kt)
    },
    os = async (t, e) => {
        let {
            id: r,
            accessToken: n
        } = e;
        return await C(t, {
            url: `/idp/myaccount/phones/${r}`,
            method: "DELETE",
            accessToken: n
        })
    },
    is = async (t, e) => {
        let {
            accessToken: r,
            id: n,
            payload: o
        } = e;
        return await C(t, {
            url: `/idp/myaccount/phones/${n}/challenge`,
            method: "POST",
            payload: o,
            accessToken: r
        })
    },
    ss = async (t, e) => {
        let {
            id: r,
            payload: n,
            accessToken: o
        } = e;
        return await C(t, {
            url: `/idp/myaccount/phones/${r}/verify`,
            method: "POST",
            payload: n,
            accessToken: o
        })
    };
var Gt = class t extends F {
    constructor(e, r) {
        super(e, r);
        let {
            res: n,
            accessToken: o
        } = r, {
            id: i,
            status: s,
            created: a,
            lastUpdated: c,
            _links: u
        } = n;
        this.id = i, this.status = s, this.created = a, this.lastUpdated = c, this.status == Jn.NOT_ENROLLED ? this.enroll = async l => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "enroll",
            links: u
        }, t)(l) : (this.get = async () => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "get",
            links: u
        }, t)(), this.update = async l => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "put",
            links: u
        }, t)(l), this.delete = async () => await V({
            oktaAuth: e,
            accessToken: o,
            methodName: "delete",
            links: u
        })())
    }
};
var as = async (t, e) => await C(t, {
        url: "/idp/myaccount/password",
        method: "GET",
        accessToken: e ? .accessToken
    }, Gt),
    cs = async (t, e) => {
        let {
            accessToken: r,
            payload: n
        } = e;
        return await C(t, {
            url: "/idp/myaccount/password",
            method: "POST",
            payload: n,
            accessToken: r
        }, Gt)
    },
    us = async (t, e) => {
        let {
            accessToken: r,
            payload: n
        } = e;
        return await C(t, {
            url: "/idp/myaccount/password",
            method: "PUT",
            payload: n,
            accessToken: r
        }, Gt)
    },
    ls = async (t, e) => await C(t, {
        url: "/idp/myaccount/password",
        method: "DELETE",
        accessToken: e ? .accessToken
    });
var fs = {};
dt(fs, {
    addEmail: () => Qi,
    addPhone: () => ns,
    deleteEmail: () => Xi,
    deletePassword: () => ls,
    deletePhone: () => os,
    enrollPassword: () => cs,
    getEmail: () => Ji,
    getEmailChallenge: () => Zi,
    getEmails: () => zi,
    getPassword: () => as,
    getPhone: () => rs,
    getPhones: () => ts,
    getProfile: () => Ki,
    getProfileSchema: () => $i,
    sendEmailChallenge: () => Yi,
    sendPhoneChallenge: () => is,
    updatePassword: () => us,
    updateProfile: () => Gi,
    verifyEmailChallenge: () => es,
    verifyPhoneChallenge: () => ss
});

function Qn(t) {
    return class extends t {
        constructor(...r) {
            super(...r), this.myaccount = Object.entries(fs).filter(([n]) => n !== "default").reduce((n, [o, i]) => (n[o] = i.bind(null, this), n), {})
        }
    }
}
var Z0 = y(x(), 1);
var tP = y(_(), 1);

function $t(t, e) {
    var r = {};
    return Object.assign(r, e), !r.stateToken && t.stateToken && (r.stateToken = t.stateToken), r
}

function Oc(t) {
    return $t(t)
}

function ds(t, e) {
    return e = $t(t, e), Z(t, t.getIssuerOrigin() + "/api/v1/authn", e, {
        withCredentials: !0
    })
}

function kc(t, e, r) {
    if (!r || !r.stateToken) {
        var n = ps(t);
        if (n) r = {
            stateToken: n
        };
        else return Promise.reject(new d("No transaction to resume"))
    }
    return ds(t, r).then(function(o) {
        return e.createTransaction(o)
    })
}

function _c(t, e, r) {
    if (!r || !r.stateToken) {
        var n = ps(t);
        if (n) r = {
            stateToken: n
        };
        else return Promise.reject(new d("No transaction to evaluate"))
    }
    return Kl(t, r).then(function(o) {
        return e.createTransaction(o)
    })
}

function Kl(t, e) {
    return e = $t(t, e), Z(t, t.getIssuerOrigin() + "/api/v1/authn/introspect", e, {
        withCredentials: !0
    })
}

function Rc(t) {
    return !!ps(t)
}

function Xn(t, e, r, n, o) {
    return o = Object.assign({
        withCredentials: !0
    }, o), Z(t, r, n, o).then(function(i) {
        return e.createTransaction(i)
    })
}

function ps(t) {
    return t.options.storageUtil.storage.get(Ie)
}
var uP = y(x(), 1);
var fP = y(_(), 1);

function hs(t, e, r, n, o, i) {
    if (Array.isArray(o)) return function(a, c) {
        if (!a) throw new d("Must provide a link name");
        var u = ht(o, {
            name: a
        });
        if (!u) throw new d("No link found for that name");
        return hs(t, e, r, n, u, i)(c)
    };
    if (o.hints && o.hints.allow && o.hints.allow.length === 1) {
        var s = o.hints.allow[0];
        switch (s) {
            case "GET":
                return function() {
                    return le(t, o.href, {
                        withCredentials: !0
                    })
                };
            case "POST":
                return function(a) {
                    i && i.isPolling && (i.isPolling = !1);
                    var c = $t(r, a);
                    (r.status === "MFA_ENROLL" || r.status === "FACTOR_ENROLL") && Object.assign(c, {
                        factorType: n.factorType,
                        provider: n.provider
                    });
                    var u = {},
                        l = c.autoPush;
                    if (l !== void 0) {
                        if (typeof l == "function") try {
                            u.autoPush = !!l()
                        } catch {
                            return Promise.reject(new d("AutoPush resulted in an error."))
                        } else l !== null && (u.autoPush = !!l);
                        c = Te(c, "autoPush")
                    }
                    var f = c.rememberDevice;
                    if (f !== void 0) {
                        if (typeof f == "function") try {
                            u.rememberDevice = !!f()
                        } catch {
                            return Promise.reject(new d("RememberDevice resulted in an error."))
                        } else f !== null && (u.rememberDevice = !!f);
                        c = Te(c, "rememberDevice")
                    } else c.profile && c.profile.updatePhone !== void 0 && (c.profile.updatePhone && (u.updatePhone = !0), c.profile = Te(c.profile, "updatePhone"));
                    var p = o.href + W(u);
                    return Xn(t, e, p, c)
                }
        }
    }
}
var zt = class extends X {
    constructor() {
        super("The poll was stopped by the sdk")
    }
};
var OP = y(x(), 1);
var _P = y(_(), 1);

function Pc(t, e, r) {
    return function(n) {
        var o, i, s, a;
        io(n) ? o = n : Xt(n) && (n = n, o = n.delay, i = n.rememberDevice, s = n.autoPush, a = n.transactionCallBack), !o && o !== 0 && (o = 500);
        var c = mt(e, "next", "poll");

        function u() {
            var p = {};
            if (typeof s == "function") try {
                p.autoPush = !!s()
            } catch {
                return Promise.reject(new d("AutoPush resulted in an error."))
            } else s != null && (p.autoPush = !!s);
            if (typeof i == "function") try {
                p.rememberDevice = !!i()
            } catch {
                return Promise.reject(new d("RememberDevice resulted in an error."))
            } else i != null && (p.rememberDevice = !!i);
            var m = c.href + W(p);
            return Z(t, m, Oc(e), {
                saveAuthnState: !1,
                withCredentials: !0,
                pollingIntent: !0
            })
        }
        r.isPolling = !0;
        var l = 0,
            f = function() {
                return r.isPolling ? u().then(function(p) {
                    if (l = 0, p.factorResult && p.factorResult === "WAITING") {
                        if (!r.isPolling) throw new zt;
                        return typeof a == "function" && a(p), jr(o).then(f)
                    } else return r.isPolling = !1, t.tx.createTransaction(p)
                }).catch(function(p) {
                    if (p.xhr && (p.xhr.status === 0 || p.xhr.status === 429) && l <= 4) {
                        var m = Math.pow(2, l) * 1e3;
                        return l++, jr(m).then(f)
                    }
                    throw p
                }) : Promise.reject(new zt)
            };
        return f().catch(function(p) {
            throw r.isPolling = !1, p
        })
    }
}

function Ic(t, e, r, n, o) {
    var i = {};
    for (var s in n._links)
        if (Object.prototype.hasOwnProperty.call(n._links, s)) {
            var a = n._links[s];
            if (s === "next" && (s = a.name), a.type) {
                i[s] = a;
                continue
            }
            switch (s) {
                case "poll":
                    i.poll = Pc(t, r, o);
                    break;
                default:
                    var c = hs(t, e, r, n, a, o);
                    c && (i[s] = c)
            }
        }
    return i
}

function Yn(t, e, r, n, o) {
    if (n = n || r, n = I(n), Array.isArray(n)) {
        for (var i = [], s = 0, a = n.length; s < a; s++) i.push(Yn(t, e, r, n[s], o));
        return i
    }
    var c = n._embedded || {};
    for (var u in c) Object.prototype.hasOwnProperty.call(c, u) && (Xt(c[u]) || Array.isArray(c[u])) && (c[u] = Yn(t, e, r, c[u], o));
    var l = Ic(t, e, r, n, o);
    return Object.assign(c, l), n = Te(n, "_embedded", "_links"), Object.assign(n, c), n
}
var Zn = class {
    constructor(e, r, n = null) {
        this.data = void 0, this.status = void 0, n && (this.data = n, Object.assign(this, Yn(e, r, n, n, {})), delete this.stateToken, n.status === "RECOVERY_CHALLENGE" && !n._links && (this.cancel = function() {
            return Promise.resolve(r.createTransaction())
        }))
    }
};

function ms(t) {
    let e = {
        status: ds.bind(null, t),
        resume(r) {
            return kc(t, e, r)
        },
        exists: Rc.bind(null, t),
        introspect(r) {
            return _c(t, e, r)
        },
        createTransaction: r => new Zn(t, e, r),
        postToTransaction: (r, n, o) => Xn(t, e, r, n, o)
    };
    return e
}

function gs(t) {
    return class extends t {
        constructor(...r) {
            super(...r), this.authn = this.tx = ms(this), this.fingerprint = Ir.bind(null, this)
        }
        async signIn(r) {
            r = I(r || {});
            let n = o => (delete r.sendFingerprint, this.tx.postToTransaction("/api/v1/authn", r, o));
            return r.sendFingerprint ? this.fingerprint().then(function(o) {
                return n({
                    headers: {
                        "X-Device-Fingerprint": o
                    }
                })
            }) : n()
        }
        async signInWithCredentials(r) {
            return this.signIn(r)
        }
        forgotPassword(r) {
            return this.tx.postToTransaction("/api/v1/authn/recovery/password", r)
        }
        unlockAccount(r) {
            return this.tx.postToTransaction("/api/v1/authn/recovery/unlock", r)
        }
        verifyRecoveryToken(r) {
            let {
                multiOptionalFactorEnroll: n
            } = r, o = te(r, ["multiOptionalFactorEnroll"]);
            return n && (o.options = {
                multiOptionalFactorEnroll: n
            }), this.tx.postToTransaction("/api/v1/authn/recovery/token", o)
        }
    }
}
var Gl = Fi(),
    $l = Bi(),
    zl = qi(),
    Jl = Mi($l, Gl, zl),
    Ql = Qn(Jl),
    Xl = gs(Ql),
    Cc = class extends Xl {
        constructor(e) {
            super(e)
        }
    };
var Yl = (t, e) => {
    let r = Mc(t),
        n = Mc(e),
        o = r.pop(),
        i = n.pop(),
        s = Nc(r, n);
    return s !== 0 ? s : o && i ? Nc(o.split("."), i.split(".")) : o || i ? o ? -1 : 1 : 0
};
var jc = (t, e, r) => {
    rf(r);
    let n = Yl(t, e);
    return Fc[r].includes(n)
};
var Zl = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,
    Mc = t => {
        if (typeof t != "string") throw new TypeError("Invalid argument expected string");
        let e = t.match(Zl);
        if (!e) throw new Error(`Invalid argument not valid semver ('${t}' received)`);
        return e.shift(), e
    },
    Dc = t => t === "*" || t === "x" || t === "X",
    Uc = t => {
        let e = parseInt(t, 10);
        return isNaN(e) ? t : e
    },
    ef = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e],
    tf = (t, e) => {
        if (Dc(t) || Dc(e)) return 0;
        let [r, n] = ef(Uc(t), Uc(e));
        return r > n ? 1 : r < n ? -1 : 0
    },
    Nc = (t, e) => {
        for (let r = 0; r < Math.max(t.length, e.length); r++) {
            let n = tf(t[r] || "0", e[r] || "0");
            if (n !== 0) return n
        }
        return 0
    },
    Fc = {
        ">": [1],
        ">=": [0, 1],
        "=": [0],
        "<=": [-1, 0],
        "<": [-1]
    },
    Lc = Object.keys(Fc),
    rf = t => {
        if (typeof t != "string") throw new TypeError(`Invalid operator type, expected string but got ${typeof t}`);
        if (Lc.indexOf(t) === -1) throw new Error(`Invalid operator, expected one of ${Lc.join("|")}`)
    };
var Hc = new no("okta.config.angular"),
    ys = new no("okta.auth"),
    vs = (() => {
        class t {
            constructor(r) {
                r && (this.config = r)
            }
            getConfig() {
                return this.config
            }
            setConfig(r) {
                this.config = r
            }
        }
        return t.\u0275fac = function(r) {
            return new(r || t)(pt(Hc, 8))
        }, t.\u0275prov = Ur({
            token: t,
            factory: t.\u0275fac,
            providedIn: "root"
        }), t
    })();
var Jt = function(t, e, r, n) {
        function o(i) {
            return i instanceof r ? i : new r(function(s) {
                s(i)
            })
        }
        return new(r || (r = Promise))(function(i, s) {
            function a(l) {
                try {
                    u(n.next(l))
                } catch (f) {
                    s(f)
                }
            }

            function c(l) {
                try {
                    u(n.throw(l))
                } catch (f) {
                    s(f)
                }
            }

            function u(l) {
                l.done ? i(l.value) : o(l.value).then(a, c)
            }
            u((n = n.apply(t, e || [])).next())
        })
    },
    nf = (() => {
        class t {
            constructor(r, n, o) {
                this.oktaAuth = r, this.injector = n, this.configService = o, this.updateAuthStateListener = a => Jt(this, void 0, void 0, function*() {
                    (yield this.isAuthenticated(this.routeData, a)) || this.handleLogin(this.state.url, this.routeData)
                });
                let i = this.configService.getConfig();
                if (!i) throw new Error("Okta config is not provided");
                this.onAuthRequired = i.onAuthRequired, n.get(Nr).events.pipe(Es(a => a instanceof Rs && this.state && this.state.url !== a.url)).subscribe(() => {
                    this.oktaAuth.authStateManager.unsubscribe(this.updateAuthStateListener)
                })
            }
            canLoad(r) {
                var n;
                return Jt(this, void 0, void 0, function*() {
                    if (this.onAuthRequired = ((n = r.data) === null || n === void 0 ? void 0 : n.onAuthRequired) || this.onAuthRequired, yield this.isAuthenticated(r.data)) return !0;
                    let s = this.injector.get(Nr).getCurrentNavigation(),
                        a = s ? s.extractedUrl.toString() : void 0;
                    return yield this.handleLogin(a, r.data), !1
                })
            }
            canActivate(r, n) {
                return Jt(this, void 0, void 0, function*() {
                    return this.state = n, this.routeData = r.data, this.onAuthRequired = r.data && r.data.onAuthRequired || this.onAuthRequired, this.oktaAuth.authStateManager.subscribe(this.updateAuthStateListener), (yield this.isAuthenticated(r.data)) ? !0 : (yield this.handleLogin(n.url, r.data), !1)
                })
            }
            canActivateChild(r, n) {
                return Jt(this, void 0, void 0, function*() {
                    return this.canActivate(r, n)
                })
            }
            isAuthenticated(r, n) {
                var o, i, s;
                return Jt(this, void 0, void 0, function*() {
                    let c = n ? n ? .isAuthenticated : yield this.oktaAuth.isAuthenticated();
                    return !((o = r ? .okta) === null || o === void 0) && o.acrValues && (n || (n = this.oktaAuth.authStateManager.getAuthState()), c = ((i = n ? .idToken) === null || i === void 0 ? void 0 : i.claims.acr) === ((s = r ? .okta) === null || s === void 0 ? void 0 : s.acrValues)), c
                })
            }
            handleLogin(r, n) {
                var o;
                return Jt(this, void 0, void 0, function*() {
                    r && this.oktaAuth.setOriginalUri(r);
                    let i = {};
                    !((o = n ? .okta) === null || o === void 0) && o.acrValues && (i.acrValues = n.okta.acrValues), this.onAuthRequired ? this.onAuthRequired(this.oktaAuth, this.injector, i) : this.oktaAuth.signInWithRedirect(i)
                })
            }
        }
        return t.\u0275fac = function(r) {
            return new(r || t)(pt(ys), pt(bs), pt(vs))
        }, t.\u0275prov = Ur({
            token: t,
            factory: t.\u0275fac
        }), t
    })(),
    of = function(t, e, r, n) {
        function o(i) {
            return i instanceof r ? i : new r(function(s) {
                s(i)
            })
        }
        return new(r || (r = Promise))(function(i, s) {
            function a(l) {
                try {
                    u(n.next(l))
                } catch (f) {
                    s(f)
                }
            }

            function c(l) {
                try {
                    u(n.throw(l))
                } catch (f) {
                    s(f)
                }
            }

            function u(l) {
                l.done ? i(l.value) : o(l.value).then(a, c)
            }
            u((n = n.apply(t, e || [])).next())
        })
    },
    Vc = {
        isAuthenticated: !1
    },
    sf = (() => {
        class t {
            constructor(r) {
                this.oktaAuth = r, this._authState = new Ss(Vc), this.authState$ = this._authState.asObservable(), this.updateAuthState = this.updateAuthState.bind(this);
                let n = this.oktaAuth.authStateManager.getAuthState() || Vc;
                this._authState.next(n), this.oktaAuth.authStateManager.subscribe(this.updateAuthState)
            }
            ngOnDestroy() {
                this.oktaAuth.authStateManager.unsubscribe(this.updateAuthState)
            }
            hasAnyGroups(r) {
                return this.authState$.pipe(As(({
                    isAuthenticated: n,
                    idToken: o
                }) => of (this, void 0, void 0, function*() {
                    if (!n || !o) return !1;
                    typeof r == "string" && (r = {
                        groups: [r]
                    }), Array.isArray(r) && (r = {
                        groups: r
                    });
                    let i = Object.keys(r)[0],
                        s = r[i];
                    if (o.claims[i]) return s.some(c => o.claims[i].includes(c));
                    let a = yield this.oktaAuth.getUser();
                    return a[i] ? s.some(c => a[i].includes(c)) : !1
                })))
            }
            updateAuthState(r) {
                this._authState.next(r)
            }
        }
        return t.\u0275fac = function(r) {
            return new(r || t)(pt(ys))
        }, t.\u0275prov = Ur({
            token: t,
            factory: t.\u0275fac
        }), t
    })(),
    eo = {
        name: "@okta/okta-angular",
        version: "6.5.1",
        authJSMinSupportedVersion: "5.3.1"
    },
    af = function(t, e, r, n) {
        function o(i) {
            return i instanceof r ? i : new r(function(s) {
                s(i)
            })
        }
        return new(r || (r = Promise))(function(i, s) {
            function a(l) {
                try {
                    u(n.next(l))
                } catch (f) {
                    s(f)
                }
            }

            function c(l) {
                try {
                    u(n.throw(l))
                } catch (f) {
                    s(f)
                }
            }

            function u(l) {
                l.done ? i(l.value) : o(l.value).then(a, c)
            }
            u((n = n.apply(t, e || [])).next())
        })
    },
    ws = class t {
        static setupOktaAuth(e, r, n) {
            if (!(e._oktaUserAgent && jc(e._oktaUserAgent.getVersion(), eo.authJSMinSupportedVersion, ">="))) throw new d(`Passed in oktaAuth is not compatible with the SDK, minimum supported okta-auth-js version is ${eo.authJSMinSupportedVersion}.`);
            e._oktaUserAgent.addEnvironment(`${eo.name}/${eo.version}`), e._oktaUserAgent.addEnvironment(`Angular/${ks.full}`), !e.options.restoreOriginalUri && r && n && (e.options.restoreOriginalUri = (i, s) => af(this, void 0, void 0, function*() {
                let a = window.location.origin + n.prepareExternalUrl(""),
                    c = uo(s || "/", a);
                r.navigateByUrl(c)
            })), e.start()
        }
        static createOktaAuth(e, r, n) {
            let o = e.getConfig();
            if (!o) throw new Error("Okta config is not provided");
            let {
                oktaAuth: i
            } = o;
            if (!i) throw new Error("Okta config should contain oktaAuth");
            return t.setupOktaAuth(i, r, n), i
        }
    };
var YM = (() => {
    class t {
        static forRoot(r) {
            return {
                ngModule: t,
                providers: [{
                    provide: Hc,
                    useValue: r
                }]
            }
        }
    }
    return t.\u0275fac = function(r) {
        return new(r || t)
    }, t.\u0275mod = Os({
        type: t
    }), t.\u0275inj = xs({
        providers: [vs, sf, nf, {
            provide: ys,
            useFactory: ws.createOktaAuth,
            deps: [vs, [new oo, Nr],
                [new oo, _s]
            ]
        }]
    }), t
})();
export {
    Cc as a, ys as b, nf as c, YM as d
};
/**i18n:6e1dbccd4192d215e143e99fb4b6a095cee3c871f5aa7cd380ca91231f35e8e0*/