UNPKG

svix-react

Version:

React components for using Svix in your dashboard.

1,502 lines 58.8 kB
import * as ie from "react"; import dt, { useRef as pt, useEffect as Xe, useImperativeHandle as gt, useCallback as V, useMemo as Pe, useContext as mt, useState as de } from "react"; import { Svix as vt } from "svix"; function yt(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var Je = { exports: {} }, ke = { exports: {} }, q = {}; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Ze; function ht() { if (Ze) return q; Ze = 1; var e = typeof Symbol == "function" && Symbol.for, r = e ? Symbol.for("react.element") : 60103, o = e ? Symbol.for("react.portal") : 60106, i = e ? Symbol.for("react.fragment") : 60107, a = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, f = e ? Symbol.for("react.provider") : 60109, u = e ? Symbol.for("react.context") : 60110, v = e ? Symbol.for("react.async_mode") : 60111, m = e ? Symbol.for("react.concurrent_mode") : 60111, h = e ? Symbol.for("react.forward_ref") : 60112, T = e ? Symbol.for("react.suspense") : 60113, t = e ? Symbol.for("react.suspense_list") : 60120, C = e ? Symbol.for("react.memo") : 60115, L = e ? Symbol.for("react.lazy") : 60116, D = e ? Symbol.for("react.block") : 60121, x = e ? Symbol.for("react.fundamental") : 60117, K = e ? Symbol.for("react.responder") : 60118, ve = e ? Symbol.for("react.scope") : 60119; function X(d) { if (typeof d == "object" && d !== null) { var M = d.$$typeof; switch (M) { case r: switch (d = d.type, d) { case v: case m: case i: case s: case a: case T: return d; default: switch (d = d && d.$$typeof, d) { case u: case h: case L: case C: case f: return d; default: return M; } } case o: return M; } } } function J(d) { return X(d) === m; } return q.AsyncMode = v, q.ConcurrentMode = m, q.ContextConsumer = u, q.ContextProvider = f, q.Element = r, q.ForwardRef = h, q.Fragment = i, q.Lazy = L, q.Memo = C, q.Portal = o, q.Profiler = s, q.StrictMode = a, q.Suspense = T, q.isAsyncMode = function(d) { return J(d) || X(d) === v; }, q.isConcurrentMode = J, q.isContextConsumer = function(d) { return X(d) === u; }, q.isContextProvider = function(d) { return X(d) === f; }, q.isElement = function(d) { return typeof d == "object" && d !== null && d.$$typeof === r; }, q.isForwardRef = function(d) { return X(d) === h; }, q.isFragment = function(d) { return X(d) === i; }, q.isLazy = function(d) { return X(d) === L; }, q.isMemo = function(d) { return X(d) === C; }, q.isPortal = function(d) { return X(d) === o; }, q.isProfiler = function(d) { return X(d) === s; }, q.isStrictMode = function(d) { return X(d) === a; }, q.isSuspense = function(d) { return X(d) === T; }, q.isValidElementType = function(d) { return typeof d == "string" || typeof d == "function" || d === i || d === m || d === s || d === a || d === T || d === t || typeof d == "object" && d !== null && (d.$$typeof === L || d.$$typeof === C || d.$$typeof === f || d.$$typeof === u || d.$$typeof === h || d.$$typeof === x || d.$$typeof === K || d.$$typeof === ve || d.$$typeof === D); }, q.typeOf = X, q; } var $ = {}; /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var et; function bt() { return et || (et = 1, process.env.NODE_ENV !== "production" && function() { var e = typeof Symbol == "function" && Symbol.for, r = e ? Symbol.for("react.element") : 60103, o = e ? Symbol.for("react.portal") : 60106, i = e ? Symbol.for("react.fragment") : 60107, a = e ? Symbol.for("react.strict_mode") : 60108, s = e ? Symbol.for("react.profiler") : 60114, f = e ? Symbol.for("react.provider") : 60109, u = e ? Symbol.for("react.context") : 60110, v = e ? Symbol.for("react.async_mode") : 60111, m = e ? Symbol.for("react.concurrent_mode") : 60111, h = e ? Symbol.for("react.forward_ref") : 60112, T = e ? Symbol.for("react.suspense") : 60113, t = e ? Symbol.for("react.suspense_list") : 60120, C = e ? Symbol.for("react.memo") : 60115, L = e ? Symbol.for("react.lazy") : 60116, D = e ? Symbol.for("react.block") : 60121, x = e ? Symbol.for("react.fundamental") : 60117, K = e ? Symbol.for("react.responder") : 60118, ve = e ? Symbol.for("react.scope") : 60119; function X(y) { return typeof y == "string" || typeof y == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. y === i || y === m || y === s || y === a || y === T || y === t || typeof y == "object" && y !== null && (y.$$typeof === L || y.$$typeof === C || y.$$typeof === f || y.$$typeof === u || y.$$typeof === h || y.$$typeof === x || y.$$typeof === K || y.$$typeof === ve || y.$$typeof === D); } function J(y) { if (typeof y == "object" && y !== null) { var n = y.$$typeof; switch (n) { case r: var l = y.type; switch (l) { case v: case m: case i: case s: case a: case T: return l; default: var P = l && l.$$typeof; switch (P) { case u: case h: case L: case C: case f: return P; default: return n; } } case o: return n; } } } var d = v, M = m, Re = u, re = f, ye = r, Se = h, he = i, xe = L, ce = C, Me = o, oe = s, pe = a, Oe = T, be = !1; function c(y) { return be || (be = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), p(y) || J(y) === v; } function p(y) { return J(y) === m; } function I(y) { return J(y) === u; } function F(y) { return J(y) === f; } function O(y) { return typeof y == "object" && y !== null && y.$$typeof === r; } function z(y) { return J(y) === h; } function _(y) { return J(y) === i; } function S(y) { return J(y) === L; } function j(y) { return J(y) === C; } function H(y) { return J(y) === o; } function N(y) { return J(y) === s; } function ae(y) { return J(y) === a; } function ee(y) { return J(y) === T; } $.AsyncMode = d, $.ConcurrentMode = M, $.ContextConsumer = Re, $.ContextProvider = re, $.Element = ye, $.ForwardRef = Se, $.Fragment = he, $.Lazy = xe, $.Memo = ce, $.Portal = Me, $.Profiler = oe, $.StrictMode = pe, $.Suspense = Oe, $.isAsyncMode = c, $.isConcurrentMode = p, $.isContextConsumer = I, $.isContextProvider = F, $.isElement = O, $.isForwardRef = z, $.isFragment = _, $.isLazy = S, $.isMemo = j, $.isPortal = H, $.isProfiler = N, $.isStrictMode = ae, $.isSuspense = ee, $.isValidElementType = X, $.typeOf = J; }()), $; } var tt; function ct() { return tt || (tt = 1, process.env.NODE_ENV === "production" ? ke.exports = ht() : ke.exports = bt()), ke.exports; } /* object-assign (c) Sindre Sorhus @license MIT */ var $e, nt; function wt() { if (nt) return $e; nt = 1; var e = Object.getOwnPropertySymbols, r = Object.prototype.hasOwnProperty, o = Object.prototype.propertyIsEnumerable; function i(s) { if (s == null) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(s); } function a() { try { if (!Object.assign) return !1; var s = new String("abc"); if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5") return !1; for (var f = {}, u = 0; u < 10; u++) f["_" + String.fromCharCode(u)] = u; var v = Object.getOwnPropertyNames(f).map(function(h) { return f[h]; }); if (v.join("") !== "0123456789") return !1; var m = {}; return "abcdefghijklmnopqrst".split("").forEach(function(h) { m[h] = h; }), Object.keys(Object.assign({}, m)).join("") === "abcdefghijklmnopqrst"; } catch { return !1; } } return $e = a() ? Object.assign : function(s, f) { for (var u, v = i(s), m, h = 1; h < arguments.length; h++) { u = Object(arguments[h]); for (var T in u) r.call(u, T) && (v[T] = u[T]); if (e) { m = e(u); for (var t = 0; t < m.length; t++) o.call(u, m[t]) && (v[m[t]] = u[m[t]]); } } return v; }, $e; } var Ye, rt; function Ge() { if (rt) return Ye; rt = 1; var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; return Ye = e, Ye; } var Be, ot; function Et() { if (ot) return Be; ot = 1; var e = function() { }; if (process.env.NODE_ENV !== "production") { var r = Ge(), o = {}, i = Function.call.bind(Object.prototype.hasOwnProperty); e = function(s) { var f = "Warning: " + s; typeof console < "u" && console.error(f); try { throw new Error(f); } catch { } }; } function a(s, f, u, v, m) { if (process.env.NODE_ENV !== "production") { for (var h in s) if (i(s, h)) { var T; try { if (typeof s[h] != "function") { var t = Error( (v || "React class") + ": " + u + " type `" + h + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[h] + "`." ); throw t.name = "Invariant Violation", t; } T = s[h](f, h, v, u, null, r); } catch (L) { T = L; } if (T && !(T instanceof Error) && e( (v || "React class") + ": type specification of " + u + " `" + h + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof T + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)." ), T instanceof Error && !(T.message in o)) { o[T.message] = !0; var C = m ? m() : ""; e( "Failed " + u + " type: " + T.message + (C ?? "") ); } } } } return a.resetWarningCache = function() { process.env.NODE_ENV !== "production" && (o = {}); }, Be = a, Be; } var Ue, it; function Tt() { if (it) return Ue; it = 1; var e = ct(), r = wt(), o = Ge(), i = Et(), a = Function.call.bind(Object.prototype.hasOwnProperty), s = function() { }; process.env.NODE_ENV !== "production" && (s = function(u) { var v = "Warning: " + u; typeof console < "u" && console.error(v); try { throw new Error(v); } catch { } }); function f() { return null; } return Ue = function(u, v) { var m = typeof Symbol == "function" && Symbol.iterator, h = "@@iterator"; function T(c) { var p = c && (m && c[m] || c[h]); if (typeof p == "function") return p; } var t = "<<anonymous>>", C = { array: K("array"), bool: K("boolean"), func: K("function"), number: K("number"), object: K("object"), string: K("string"), symbol: K("symbol"), any: ve(), arrayOf: X, element: J(), elementType: d(), instanceOf: M, node: Se(), objectOf: re, oneOf: Re, oneOfType: ye, shape: he, exact: xe }; function L(c, p) { return c === p ? c !== 0 || 1 / c === 1 / p : c !== c && p !== p; } function D(c) { this.message = c, this.stack = ""; } D.prototype = Error.prototype; function x(c) { if (process.env.NODE_ENV !== "production") var p = {}, I = 0; function F(z, _, S, j, H, N, ae) { if (j = j || t, N = N || S, ae !== o) { if (v) { var ee = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types" ); throw ee.name = "Invariant Violation", ee; } else if (process.env.NODE_ENV !== "production" && typeof console < "u") { var y = j + ":" + S; !p[y] && // Avoid spamming the console because they are often not actionable except for lib authors I < 3 && (s( "You are manually calling a React.PropTypes validation function for the `" + N + "` prop on `" + j + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details." ), p[y] = !0, I++); } } return _[S] == null ? z ? _[S] === null ? new D("The " + H + " `" + N + "` is marked as required " + ("in `" + j + "`, but its value is `null`.")) : new D("The " + H + " `" + N + "` is marked as required in " + ("`" + j + "`, but its value is `undefined`.")) : null : c(_, S, j, H, N); } var O = F.bind(null, !1); return O.isRequired = F.bind(null, !0), O; } function K(c) { function p(I, F, O, z, _, S) { var j = I[F], H = oe(j); if (H !== c) { var N = pe(j); return new D("Invalid " + z + " `" + _ + "` of type " + ("`" + N + "` supplied to `" + O + "`, expected ") + ("`" + c + "`.")); } return null; } return x(p); } function ve() { return x(f); } function X(c) { function p(I, F, O, z, _) { if (typeof c != "function") return new D("Property `" + _ + "` of component `" + O + "` has invalid PropType notation inside arrayOf."); var S = I[F]; if (!Array.isArray(S)) { var j = oe(S); return new D("Invalid " + z + " `" + _ + "` of type " + ("`" + j + "` supplied to `" + O + "`, expected an array.")); } for (var H = 0; H < S.length; H++) { var N = c(S, H, O, z, _ + "[" + H + "]", o); if (N instanceof Error) return N; } return null; } return x(p); } function J() { function c(p, I, F, O, z) { var _ = p[I]; if (!u(_)) { var S = oe(_); return new D("Invalid " + O + " `" + z + "` of type " + ("`" + S + "` supplied to `" + F + "`, expected a single ReactElement.")); } return null; } return x(c); } function d() { function c(p, I, F, O, z) { var _ = p[I]; if (!e.isValidElementType(_)) { var S = oe(_); return new D("Invalid " + O + " `" + z + "` of type " + ("`" + S + "` supplied to `" + F + "`, expected a single ReactElement type.")); } return null; } return x(c); } function M(c) { function p(I, F, O, z, _) { if (!(I[F] instanceof c)) { var S = c.name || t, j = be(I[F]); return new D("Invalid " + z + " `" + _ + "` of type " + ("`" + j + "` supplied to `" + O + "`, expected ") + ("instance of `" + S + "`.")); } return null; } return x(p); } function Re(c) { if (!Array.isArray(c)) return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? s( "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])." ) : s("Invalid argument supplied to oneOf, expected an array.")), f; function p(I, F, O, z, _) { for (var S = I[F], j = 0; j < c.length; j++) if (L(S, c[j])) return null; var H = JSON.stringify(c, function(ae, ee) { var y = pe(ee); return y === "symbol" ? String(ee) : ee; }); return new D("Invalid " + z + " `" + _ + "` of value `" + String(S) + "` " + ("supplied to `" + O + "`, expected one of " + H + ".")); } return x(p); } function re(c) { function p(I, F, O, z, _) { if (typeof c != "function") return new D("Property `" + _ + "` of component `" + O + "` has invalid PropType notation inside objectOf."); var S = I[F], j = oe(S); if (j !== "object") return new D("Invalid " + z + " `" + _ + "` of type " + ("`" + j + "` supplied to `" + O + "`, expected an object.")); for (var H in S) if (a(S, H)) { var N = c(S, H, O, z, _ + "." + H, o); if (N instanceof Error) return N; } return null; } return x(p); } function ye(c) { if (!Array.isArray(c)) return process.env.NODE_ENV !== "production" && s("Invalid argument supplied to oneOfType, expected an instance of array."), f; for (var p = 0; p < c.length; p++) { var I = c[p]; if (typeof I != "function") return s( "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + Oe(I) + " at index " + p + "." ), f; } function F(O, z, _, S, j) { for (var H = 0; H < c.length; H++) { var N = c[H]; if (N(O, z, _, S, j, o) == null) return null; } return new D("Invalid " + S + " `" + j + "` supplied to " + ("`" + _ + "`.")); } return x(F); } function Se() { function c(p, I, F, O, z) { return ce(p[I]) ? null : new D("Invalid " + O + " `" + z + "` supplied to " + ("`" + F + "`, expected a ReactNode.")); } return x(c); } function he(c) { function p(I, F, O, z, _) { var S = I[F], j = oe(S); if (j !== "object") return new D("Invalid " + z + " `" + _ + "` of type `" + j + "` " + ("supplied to `" + O + "`, expected `object`.")); for (var H in c) { var N = c[H]; if (N) { var ae = N(S, H, O, z, _ + "." + H, o); if (ae) return ae; } } return null; } return x(p); } function xe(c) { function p(I, F, O, z, _) { var S = I[F], j = oe(S); if (j !== "object") return new D("Invalid " + z + " `" + _ + "` of type `" + j + "` " + ("supplied to `" + O + "`, expected `object`.")); var H = r({}, I[F], c); for (var N in H) { var ae = c[N]; if (!ae) return new D( "Invalid " + z + " `" + _ + "` key `" + N + "` supplied to `" + O + "`.\nBad object: " + JSON.stringify(I[F], null, " ") + ` Valid keys: ` + JSON.stringify(Object.keys(c), null, " ") ); var ee = ae(S, N, O, z, _ + "." + N, o); if (ee) return ee; } return null; } return x(p); } function ce(c) { switch (typeof c) { case "number": case "string": case "undefined": return !0; case "boolean": return !c; case "object": if (Array.isArray(c)) return c.every(ce); if (c === null || u(c)) return !0; var p = T(c); if (p) { var I = p.call(c), F; if (p !== c.entries) { for (; !(F = I.next()).done; ) if (!ce(F.value)) return !1; } else for (; !(F = I.next()).done; ) { var O = F.value; if (O && !ce(O[1])) return !1; } } else return !1; return !0; default: return !1; } } function Me(c, p) { return c === "symbol" ? !0 : p ? p["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && p instanceof Symbol : !1; } function oe(c) { var p = typeof c; return Array.isArray(c) ? "array" : c instanceof RegExp ? "object" : Me(p, c) ? "symbol" : p; } function pe(c) { if (typeof c > "u" || c === null) return "" + c; var p = oe(c); if (p === "object") { if (c instanceof Date) return "date"; if (c instanceof RegExp) return "regexp"; } return p; } function Oe(c) { var p = pe(c); switch (p) { case "array": case "object": return "an " + p; case "boolean": case "date": case "regexp": return "a " + p; default: return p; } } function be(c) { return !c.constructor || !c.constructor.name ? t : c.constructor.name; } return C.checkPropTypes = i, C.resetWarningCache = i.resetWarningCache, C.PropTypes = C, C; }, Ue; } var Ve, at; function Rt() { if (at) return Ve; at = 1; var e = Ge(); function r() { } function o() { } return o.resetWarningCache = r, Ve = function() { function i(f, u, v, m, h, T) { if (T !== e) { var t = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types" ); throw t.name = "Invariant Violation", t; } } i.isRequired = i; function a() { return i; } var s = { array: i, bool: i, func: i, number: i, object: i, string: i, symbol: i, any: i, arrayOf: a, element: i, elementType: i, instanceOf: a, node: i, objectOf: a, oneOf: a, oneOfType: a, shape: a, exact: a, checkPropTypes: o, resetWarningCache: r }; return s.PropTypes = s, s; }, Ve; } if (process.env.NODE_ENV !== "production") { var xt = ct(), Mt = !0; Je.exports = Tt()(xt.isElement, Mt); } else Je.exports = Rt()(); var Ot = Je.exports; const Pt = /* @__PURE__ */ yt(Ot); function Ae() { return Ae = Object.assign || function(e) { for (var r = 1; r < arguments.length; r++) { var o = arguments[r]; for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && (e[i] = o[i]); } return e; }, Ae.apply(this, arguments); } function ut(e, r) { if (e == null) return {}; var o = {}, i = Object.keys(e), a, s; for (s = 0; s < i.length; s++) a = i[s], !(r.indexOf(a) >= 0) && (o[a] = e[a]); return o; } function St(e, r) { return r = { exports: {} }, e(r, r.exports), r.exports; } var Ct = St(function(e) { (function(r) { if (typeof window > "u") return; var o = 0, i = !1, a = !1, s = "message", f = s.length, u = "[iFrameSizer]", v = u.length, m = null, h = window.requestAnimationFrame, T = { max: 1, scroll: 1, bodyScroll: 1, documentElementScroll: 1 }, t = {}, C = null, L = { autoResize: !0, bodyBackground: null, bodyMargin: null, bodyMarginV1: 8, bodyPadding: null, checkOrigin: !0, inPageLinks: !1, enablePublicMethods: !0, heightCalculationMethod: "bodyOffset", id: "iFrameResizer", interval: 32, log: !1, maxHeight: 1 / 0, maxWidth: 1 / 0, minHeight: 0, minWidth: 0, resizeFrom: "parent", scrolling: !1, sizeHeight: !0, sizeWidth: !1, warningTimeout: 5e3, tolerance: 0, widthCalculationMethod: "scroll", onClose: function() { return !0; }, onClosed: function() { }, onInit: function() { }, onMessage: function() { re("onMessage function not defined"); }, onMouseEnter: function() { }, onMouseLeave: function() { }, onResized: function() { }, onScroll: function() { return !0; } }; function D() { return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; } function x(n, l, P) { n.addEventListener(l, P, !1); } function K(n, l, P) { n.removeEventListener(l, P, !1); } function ve() { var n = ["moz", "webkit", "o", "ms"], l; for (l = 0; l < n.length && !h; l += 1) h = window[n[l] + "RequestAnimationFrame"]; h ? h = h.bind(window) : M("setup", "RequestAnimationFrame not supported"); } function X(n) { var l = "Host page: " + n; return window.top !== window.self && (window.parentIFrame && window.parentIFrame.getId ? l = window.parentIFrame.getId() + ": " + n : l = "Nested host page: " + n), l; } function J(n) { return u + "[" + X(n) + "]"; } function d(n) { return t[n] ? t[n].log : i; } function M(n, l) { ye("log", n, l, d(n)); } function Re(n, l) { ye("info", n, l, d(n)); } function re(n, l) { ye("warn", n, l, !0); } function ye(n, l, P, w) { w === !0 && typeof window.console == "object" && console[n](J(l), P); } function Se(n) { function l() { function g() { be(Y), oe(R), Ee("onResized", Y); } A("Height"), A("Width"), c(g, Y, "init"); } function P() { var g = se.substr(v).split(":"), k = g[1] ? parseInt(g[1], 10) : 0, U = t[g[0]] && t[g[0]].iframe, B = getComputedStyle(U); return { iframe: U, id: g[0], height: k + w(B) + W(B), width: g[2], type: g[3] }; } function w(g) { if (g.boxSizing !== "border-box") return 0; var k = g.paddingTop ? parseInt(g.paddingTop, 10) : 0, U = g.paddingBottom ? parseInt(g.paddingBottom, 10) : 0; return k + U; } function W(g) { if (g.boxSizing !== "border-box") return 0; var k = g.borderTopWidth ? parseInt(g.borderTopWidth, 10) : 0, U = g.borderBottomWidth ? parseInt(g.borderBottomWidth, 10) : 0; return k + U; } function A(g) { var k = Number(t[R]["max" + g]), U = Number(t[R]["min" + g]), B = g.toLowerCase(), Z = Number(Y[B]); M(R, "Checking " + B + " is in range " + U + "-" + k), Z < U && (Z = U, M(R, "Set " + B + " to min value")), Z > k && (Z = k, M(R, "Set " + B + " to max value")), Y[B] = "" + Z; } function ue() { function g() { function B() { var te = 0, le = !1; for (M( R, "Checking connection is from allowed list of origins: " + U ); te < U.length; te++) if (U[te] === k) { le = !0; break; } return le; } function Z() { var te = t[R] && t[R].remoteHost; return M(R, "Checking connection is from: " + te), k === te; } return U.constructor === Array ? B() : Z(); } var k = n.origin, U = t[R] && t[R].checkOrigin; if (U && "" + k != "null" && !g()) throw new Error( "Unexpected message received from: " + k + " for " + Y.iframe.id + ". Message was: " + n.data + ". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains." ); return !0; } function we() { return u === ("" + se).substr(0, v) && se.substr(v).split(":")[0] in t; } function fe() { var g = Y.type in { true: 1, false: 1, undefined: 1 }; return g && M(R, "Ignoring init message from meta parent page"), g; } function ge(g) { return se.substr(se.indexOf(":") + f + g); } function me(g) { M( R, "onMessage passed: {iframe: " + Y.iframe.id + ", message: " + g + "}" ), Ee("onMessage", { iframe: Y.iframe, message: JSON.parse(g) }), M(R, "--"); } function ze() { var g = document.body.getBoundingClientRect(), k = Y.iframe.getBoundingClientRect(); return JSON.stringify({ iframeHeight: k.height, iframeWidth: k.width, clientHeight: Math.max( document.documentElement.clientHeight, window.innerHeight || 0 ), clientWidth: Math.max( document.documentElement.clientWidth, window.innerWidth || 0 ), offsetTop: parseInt(k.top - g.top, 10), offsetLeft: parseInt(k.left - g.left, 10), scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, documentHeight: document.documentElement.clientHeight, documentWidth: document.documentElement.clientWidth, windowHeight: window.innerHeight, windowWidth: window.innerWidth }); } function _e(g, k) { function U() { p("Send Page Info", "pageInfo:" + ze(), g, k); } _(U, 32, k); } function je() { function g(Z, te) { function le() { t[B] ? _e(t[B].iframe, B) : k(); } ["scroll", "resize"].forEach(function(Ke) { M(B, Z + Ke + " listener for sendPageInfo"), te(window, Ke, le); }); } function k() { g("Remove ", K); } function U() { g("Add ", x); } var B = R; U(), t[B] && (t[B].stopPageInfo = k); } function Le() { t[R] && t[R].stopPageInfo && (t[R].stopPageInfo(), delete t[R].stopPageInfo); } function We() { var g = !0; return Y.iframe === null && (re(R, "IFrame (" + Y.id + ") not found"), g = !1), g; } function b(g) { var k = g.getBoundingClientRect(); return Me(R), { x: Math.floor(Number(k.left) + Number(m.x)), y: Math.floor(Number(k.top) + Number(m.y)) }; } function E(g) { function k() { m = te, G(), M(R, "--"); } function U() { return { x: Number(Y.width) + Z.x, y: Number(Y.height) + Z.y }; } function B() { window.parentIFrame ? window.parentIFrame["scrollTo" + (g ? "Offset" : "")]( te.x, te.y ) : re( R, "Unable to scroll to requested position, window.parentIFrame not found" ); } var Z = g ? b(Y.iframe) : { x: 0, y: 0 }, te = U(); M( R, "Reposition requested from iFrame (offset x:" + Z.x + " y:" + Z.y + ")" ), window.top !== window.self ? B() : k(); } function G() { Ee("onScroll", m) !== !1 ? oe(R) : pe(); } function Q(g) { function k() { var le = b(te); M( R, "Moving to in page link (#" + B + ") at x: " + le.x + " y: " + le.y ), m = { x: le.x, y: le.y }, G(), M(R, "--"); } function U() { window.parentIFrame ? window.parentIFrame.moveToAnchor(B) : M( R, "In page link #" + B + " not found and window.parentIFrame not found" ); } var B = g.split("#")[1] || "", Z = decodeURIComponent(B), te = document.getElementById(Z) || document.getElementsByName(Z)[0]; te ? k() : window.top !== window.self ? U() : M(R, "In page link #" + B + " not found"); } function Ce(g) { Ee(g, { iframe: Y.iframe, screenX: Y.width, screenY: Y.height, type: Y.type }); } function Ee(g, k) { return he(R, g, k); } function He() { switch (t[R] && t[R].firstRun && qe(), Y.type) { case "close": ce(Y.iframe); break; case "message": me(ge(6)); break; case "mouseenter": Ce("onMouseEnter"); break; case "mouseleave": Ce("onMouseLeave"); break; case "autoResize": t[R].autoResize = JSON.parse(ge(9)); break; case "scrollTo": E(!1); break; case "scrollToOffset": E(!0); break; case "pageInfo": _e( t[R] && t[R].iframe, R ), je(); break; case "pageInfoStop": Le(); break; case "inPageLink": Q(ge(9)); break; case "reset": Oe(Y); break; case "init": l(), Ee("onInit", Y.iframe); break; default: l(); } } function De(g) { var k = !0; return t[g] || (k = !1, re( Y.type + " No settings for " + g + ". Message was: " + se )), k; } function Ne() { for (var g in t) p( "iFrame requested init", I(g), t[g].iframe, g ); } function qe() { t[R] && (t[R].firstRun = !1); } var se = n.data, Y = {}, R = null; se === "[iFrameResizerChild]Ready" ? Ne() : we() ? (Y = P(), R = Y.id, t[R] && (t[R].loaded = !0), !fe() && De(R) && (M(R, "Received: " + se), We() && ue() && He())) : Re(R, "Ignored: " + se); } function he(n, l, P) { var w = null, W = null; if (t[n]) if (w = t[n][l], typeof w == "function") W = w(P); else throw new TypeError( l + " on iFrame[" + n + "] is not a function" ); return W; } function xe(n) { var l = n.id; delete t[l]; } function ce(n) { var l = n.id; if (he(l, "onClose", l) === !1) { M(l, "Close iframe cancelled by onClose event"); return; } M(l, "Removing iFrame: " + l); try { n.parentNode && n.parentNode.removeChild(n); } catch (P) { re(P); } he(l, "onClosed", l), M(l, "--"), xe(n); } function Me(n) { m === null && (m = { x: window.pageXOffset !== r ? window.pageXOffset : document.documentElement.scrollLeft, y: window.pageYOffset !== r ? window.pageYOffset : document.documentElement.scrollTop }, M( n, "Get page position: " + m.x + "," + m.y )); } function oe(n) { m !== null && (window.scrollTo(m.x, m.y), M( n, "Set page position: " + m.x + "," + m.y ), pe()); } function pe() { m = null; } function Oe(n) { function l() { be(n), p("reset", "reset", n.iframe, n.id); } M( n.id, "Size reset requested by " + (n.type === "init" ? "host page" : "iFrame") ), Me(n.id), c(l, n, "reset"); } function be(n) { function l(A) { if (!n.id) { M("undefined", "messageData id not set"); return; } n.iframe.style[A] = n[A] + "px", M( n.id, "IFrame (" + W + ") " + A + " set to " + n[A] + "px" ); } function P(A) { !a && n[A] === "0" && (a = !0, M(W, "Hidden iFrame detected, creating visibility listener"), S()); } function w(A) { l(A), P(A); } var W = n.iframe.id; t[W] && (t[W].sizeHeight && w("height"), t[W].sizeWidth && w("width")); } function c(n, l, P) { P !== l.type && h && // including check for jasmine because had trouble getting spy to work in unit test using requestAnimationFrame !window.jasmine ? (M(l.id, "Requesting animation frame"), h(n)) : n(); } function p(n, l, P, w, W) { function A() { var me = t[w] && t[w].targetOrigin; M( w, "[" + n + "] Sending msg to iframe[" + w + "] (" + l + ") targetOrigin: " + me ), P.contentWindow.postMessage(u + l, me); } function ue() { re(w, "[" + n + "] IFrame(" + w + ") not found"); } function we() { P && "contentWindow" in P && P.contentWindow !== null ? A() : ue(); } function fe() { function me() { t[w] && !t[w].loaded && !ge && (ge = !0, re( w, "IFrame has not responded within " + t[w].warningTimeout / 1e3 + " seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning." )); } W && t[w] && t[w].warningTimeout && (t[w].msgTimeout = setTimeout( me, t[w].warningTimeout )); } var ge = !1; w = w || P.id, t[w] && (we(), fe()); } function I(n) { return n + ":" + t[n].bodyMarginV1 + ":" + t[n].sizeWidth + ":" + t[n].log + ":" + t[n].interval + ":" + t[n].enablePublicMethods + ":" + t[n].autoResize + ":" + t[n].bodyMargin + ":" + t[n].heightCalculationMethod + ":" + t[n].bodyBackground + ":" + t[n].bodyPadding + ":" + t[n].tolerance + ":" + t[n].inPageLinks + ":" + t[n].resizeFrom + ":" + t[n].widthCalculationMethod; } function F(n, l) { function P() { function E(Q) { t[b][Q] !== 1 / 0 && t[b][Q] !== 0 && (n.style[Q] = t[b][Q] + "px", M( b, "Set " + Q + " = " + t[b][Q] + "px" )); } function G(Q) { if (t[b]["min" + Q] > t[b]["max" + Q]) throw new Error( "Value for min" + Q + " can not be greater than max" + Q ); } G("Height"), G("Width"), E("maxHeight"), E("minHeight"), E("maxWidth"), E("minWidth"); } function w() { var E = l && l.id || L.id + o++; return document.getElementById(E) !== null && (E += o++), E; } function W(E) { return E === "" && (n.id = E = w(), i = (l || {}).log, M( E, "Added missing iframe ID: " + E + " (" + n.src + ")" )), E; } function A() { switch (M( b, "IFrame scrolling " + (t[b] && t[b].scrolling ? "enabled" : "disabled") + " for " + b ), n.style.overflow = (t[b] && t[b].scrolling) === !1 ? "hidden" : "auto", t[b] && t[b].scrolling) { case "omit": break; case !0: n.scrolling = "yes"; break; case !1: n.scrolling = "no"; break; default: n.scrolling = t[b] ? t[b].scrolling : "no"; } } function ue() { (typeof (t[b] && t[b].bodyMargin) == "number" || (t[b] && t[b].bodyMargin) === "0") && (t[b].bodyMarginV1 = t[b].bodyMargin, t[b].bodyMargin = "" + t[b].bodyMargin + "px"); } function we() { var E = t[b] && t[b].firstRun, G = t[b] && t[b].heightCalculationMethod in T; !E && G && Oe({ iframe: n, height: 0, width: 0, type: "init" }); } function fe() { t[b] && (t[b].iframe.iFrameResizer = { close: ce.bind(null, t[b].iframe), removeListeners: xe.bind( null, t[b].iframe ), resize: p.bind( null, "Window resize", "resize", t[b].iframe ), moveToAnchor: function(E) { p( "Move to anchor", "moveToAnchor:" + E, t[b].iframe, b ); }, sendMessage: function(E) { E = JSON.stringify(E), p( "Send Message", "message:" + E, t[b].iframe, b ); } }); } function ge(E) { function G() { p("iFrame.onload", E, n, r, !0), we(); } function Q(Ee) { if (n.parentNode) { var He = new Ee(function(De) { De.forEach(function(Ne) { var qe = Array.prototype.slice.call(Ne.removedNodes); qe.forEach(function(se) { se === n && ce(n); }); }); }); He.observe(n.parentNode, { childList: !0 }); } } var Ce = D(); Ce && Q(Ce), x(n, "load", G), p("init", E, n, r, !0); } function me(E) { if (typeof E != "object") throw new TypeError("Options is not an object"); } function ze(E) { for (var G in L) Object.prototype.hasOwnProperty.call(L, G) && (t[b][G] = Object.prototype.hasOwnProperty.call( E, G ) ? E[G] : L[G]); } function _e(E) { return E === "" || E.match(/^(about:blank|javascript:|file:\/\/)/) !== null ? "*" : E; } function je(E) { var G = E.split("Callback"); if (G.length === 2) { var Q = "on" + G[0].charAt(0).toUpperCase() + G[0].slice(1); this[Q] = this[E], delete this[E], re( b, "Deprecated: '" + E + "' has been renamed '" + Q + "'. The old method will be removed in the next major version." ); } } function Le(E) { E = E || {}, t[b] = { firstRun: !0, iframe: n, remoteHost: n.src && n.src.split("/").slice(0, 3).join("/") }, me(E), Object.keys(E).forEach(je, E), ze(E), t[b] && (t[b].targetOrigin = t[b].checkOrigin === !0 ? _e(t[b].remoteHost) : "*"); } function We() { return b in t && "iFrameResizer" in n; } var b = W(n.id); We() ? re(b, "Ignored iFrame, already setup.") : (Le(l), A(), P(), ue(), ge(I(b)), fe()); } function O(n, l) { C === null && (C = setTimeout(function() { C = null, n(); }, l)); } var z = {}; function _(n, l, P) { z[P] || (z[P] = setTimeout(function() { z[P] = null, n(); }, l)); } function S() { function n() { function W(A) { function ue(fe) { return (t[A] && t[A].iframe.style[fe]) === "0px"; } function we(fe) { return fe.offsetParent !== null; } t[A] && we(t[A].iframe) && (ue("height") || ue("width")) && p( "Visibility change", "resize", t[A].iframe, A ); } Object.keys(t).forEach(function(A) { W(A); }); } function l(W) { M( "window", "Mutation observed: " + W[0].target + " " + W[0].type ), O(n, 16); } function P() { var W = document.querySelector("body"), A = { attributes: !0, attributeOldValue: !1, characterData: !0, characterDataOldValue: !1, childList: !0, subtree: !0 }, ue = new w(l); ue.observe(W, A); } var w = D(); w && P(); } function j(n) { function l() { N("Window " + n, "resize"); } M("window", "Trigger event: " + n), O(l, 16); } function H() { function n() { N("Tab Visable", "resize"); } document.visibilityState !== "hidden" && (M("document", "Trigger event: Visiblity change"), O(n, 16)); } function N(n, l) { function P(w) { return t[w] && t[w].resizeFrom === "parent" && t[w].autoResize && !t[w].firstRun; } Object.keys(t).forEach(function(w) { P(w) && p(n, l, t[w].iframe, w); }); } function ae() { x(window, "message", Se), x(window, "resize", function() { j("resize"); }), x(document, "visibilitychange", H), x(document, "-webkit-visibilitychange", H); } function ee() { function n(w, W) { function A() { if (W.tagName) { if (W.tagName.toUpperCase() !== "IFRAME") throw new TypeError( "Expected <IFRAME> tag, found <" + W.tagName + ">" ); } else throw new TypeError("Object is not a valid DOM element"); } W && (A(), F(W, w), P.push(W)); } function l(w) { w && w.enablePublicMethods && re( "enablePublicMethods option has been removed, public methods are now always available in the iFrame" ); } var P; return ve(), ae(), function(W, A) { switch (P = [], l(W), typeof A) { case "undefined": case "string": Array.prototype.forEach.call( document.querySelectorAll(A || "iframe"), n.bind(r, W) ); break; case "object": n(W, A); break; default: throw new TypeError("Unexpected data type (" + typeof A + ")"); } return P; }; } function y(n) { n.fn ? n.fn.iFrameResize || (n.fn.iFrameResize = function(P) { function w(W, A) { F(A, P); } return this.filter("iframe").each(w).end(); }) : Re("", "Unable to bind to jQuery, it is not fully loaded."); } window.jQuery && y(window.jQuery), typeof r == "function" && r.amd ? r([], ee) : e.exports = ee(), window.iFrameResize = window.iFrameResize || ee(); })(); }), Ft = process.env.NODE_ENV !== "production", ft = function() { }; if (Ft) { var _t = function(r, o) { var i = arguments.length; o = new Array(i > 1 ? i - 1 : 0); for (var a = 1; a < i; a++) o[a - 1] = arguments[a]; var s = 0, f = "Warning: " + r.replace(/%s/g, function() { return o[s++]; }); typeof console < "u" && console.error(f); try { throw new Error(f); } catch { } }; ft = function(e, r, o) { var i = arguments.length; o = new Array(i > 2 ? i - 2 : 0); for (var a = 2; a < i; a++) o[a - 2] = arguments[a]; if (r === void 0) throw new Error( "`warning(condition, format, ...args)` requires a warning message argument" ); e || _t.apply(null, [r].concat(o)); }; } var kt = ft, It = function(e) { e.autoResize, e.bodyBackground, e.bodyMargin, e.bodyPadding, e.checkOrigin, e.inPageLinks, e.heightCalculationMethod, e.interval, e.log, e.maxHeight, e.maxWidth, e.minHeight, e.minWidth, e.resizeFrom, e.scrolling, e.sizeHeight, e.sizeWidth, e.warningTimeout, e.tolerance, e.widthCalculationMethod, e.onClosed, e.onInit, e.onMessage, e.onMouseEnter, e.onMouseLeave, e.onResized; var r = ut(e, ["autoResize", "bodyBackground", "bodyMargin", "bodyPadding", "checkOrigin", "inPageLinks", "heightCalculationMethod", "interval", "log", "maxHeight", "maxWidth", "minHeight", "minWidth", "resizeFrom", "scrolling", "sizeHeight", "sizeWidth", "warningTimeout", "tolerance", "widthCalculationMethod", "onClosed", "onInit", "onMessage", "onMouseEnter", "onMouseLeave", "onResized"]); return r; }, Qe = function(r) { var o = r.title, i = r.forwardRef, a = ut(r, ["title", "forwardRef"]), s = It(a), f = pt(null), u = function() { return kt(!f.current, "[iframeSizerReact][" + (f && f.current && f.current.id) + "] Close event ignored, to remove the iframe update your React component"), !f.current; }; return Xe(function() { var v = f.current; return Ct(Ae({}, a, { onClose: u }), v), function() { return v.iFrameResizer && v.iFrameResizer.removeListeners(); }; }, []), gt(i, function() { return { resize: function() { return f.current.iFrameResizer.resize(); }, moveToAnchor: function(m) { return f.current.iFrameResizer.moveToAnchor(m); }, sendMessage: function(m, h) { f.current.iFrameResizer.sendMessage(m, h); } }; }), /* @__PURE__ */ dt.createElement("iframe", Ae({ title: o }, s, { ref: f })); }; Qe.defaultProps = { title: "iframe" }; Qe.propTypes = { title: Pt.string }; function st(e, r) { if (!e) return; const o = new URL(e); return r.darkMode !== void 0 && o.searchParams.append("darkMode", r.darkMode.toString()), r.fontFamily !== void 0 && o.searchParams.append("fontFamily", r.fontFamily), r.icon !== void 0 && o.searchParams.append("icon", r.icon), r.primaryColor !== void 0 && o.searchParams.append("primaryColor", r.primaryColor), o.href; } function At() { const e = ie.useRef(!1); return ie.useEffect(() => (e.current = !0, () => { e.current = !1; }), []), (r, o) => { window.setTimeout(() => { e.current && r(); }, o); }; } const zt = "650px"; function Wt(e) { const { url: r, ...o } = e, [i, a] = ie.useState(!1), s = At(); function f() { s(() => { a(!0); }, 1e4); } const u = i ? null : /* @__PURE__ */ ie.createElement("div", { className: `Svix__mask ${o.darkMode ? "Svix__dark" : "Svix__light"}` }); return /* @__PURE__ */ ie.createElement(ie.Fragment, null, /* @__PURE__ */ ie.createElement( "div", { style: { borderRadius: "8px", overflow