@iframe-resizer/child 6.0.0-beta.0 → 6.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import Ln, { NORMAL as K, HIGHLIGHT as c, FOREGROUND as w, BOLD as ft, ITALIC as jn } from "auto-console-group";
2
- const D = "6.0.0-beta.0", Ve = "iframeResizer", Ee = ":", xn = "[iFrameResizerChild]Ready", _n = "autoResize", Dn = "beforeUnload", Bn = "close", Hn = "inPageLink", Se = "init", je = "message", Fn = "mouseenter", Wn = "mouseleave", Bt = "pageHide", Ht = "pageInfo", Ft = "parentInfo", Un = "pageInfoStop", Gn = "parentInfoStop", Vn = "scrollBy", qn = "scrollTo", Wt = "scrollToOffset", Zn = "title", W = 10, X = 1, Oe = "data-iframe-size", Ut = "data-iframe-overflowed", te = "data-iframe-ignore", ne = "height", Gt = "width", Ie = "offset", Ae = "offsetSize", Yn = "scroll", qe = `
3
- `, oe = "string", L = "number", Qn = "boolean", Jn = "object", re = "function", Kn = "undefined", Xn = "false", eo = "null", Me = "auto", Vt = "readystatechange", xe = "bottom", _e = "right", De = "autoResizeEnabled", mt = /* @__PURE__ */ Symbol("sizeChanged"), Ze = "manualResize", Ye = "parentResize", ht = {
4
- [Ze]: 1,
5
- [Ye]: 1
6
- }, qt = "setOffsetSize", Zt = "resizeObserver", Qe = "overflowObserver", Yt = "mutationObserver", Qt = "visibilityObserver", to = "font-weight: bold;", Je = "none", gt = "No change in content size detected", he = "[iFrameSizer]", Jt = he.length, Ke = Me, Kt = Yn, Xt = 128, en = /* @__PURE__ */ new Set([
1
+ import Cn, { NORMAL as Y, HIGHLIGHT as c, FOREGROUND as z, BOLD as dt, ITALIC as Pn } from "auto-console-group";
2
+ const _ = "6.0.0-beta.1", Ve = "iframeResizer", ve = ":", Ln = "[iFrameResizerChild]Ready", jn = "autoResize", _n = "beforeUnload", xn = "close", Dn = "inPageLink", be = "init", je = "message", Bn = "mouseenter", Fn = "mouseleave", jt = "pageHide", _t = "pageInfo", xt = "parentInfo", Hn = "pageInfoStop", Wn = "parentInfoStop", Vn = "scrollBy", Un = "scrollTo", Dt = "scrollToOffset", Gn = "title", se = 10, J = 1, ze = "data-iframe-size", Bt = "data-iframe-overflowed", X = "data-iframe-ignore", we = "height", Ft = "width", Ie = "offset", Te = "offsetSize", Ue = `
3
+ `, ee = "string", C = "number", qn = "boolean", Zn = "object", Se = "function", Qn = "undefined", Yn = "false", Jn = "null", k = "auto", Ht = "readystatechange", Wt = "bottom", Vt = "right", _e = "autoResizeEnabled", ut = /* @__PURE__ */ Symbol("sizeChanged"), Ge = "manualResize", qe = "parentResize", Ae = {
4
+ [Ge]: 1,
5
+ [qe]: 1
6
+ }, Ut = "setOffsetSize", Gt = "resizeObserver", Ze = "overflowObserver", qt = "mutationObserver", Zt = "visibilityObserver", Kn = "font-weight: bold;", Qe = "none", ft = "No change in content size detected", ue = "[iFrameSizer]", Qt = ue.length, Xn = k, Yt = 128, Jt = /* @__PURE__ */ new Set([
7
7
  "head",
8
8
  "body",
9
9
  "meta",
@@ -20,38 +20,38 @@ const D = "6.0.0-beta.0", Ve = "iframeResizer", Ee = ":", xn = "[iFrameResizerCh
20
20
  "track",
21
21
  "wbr",
22
22
  "nobr"
23
- ]), no = (e) => (t, n = "renamed to") => (o, r, u = "", l = "") => e(
23
+ ]), eo = (e) => (t, n = "renamed to") => (o, s, u = "", l = "") => e(
24
24
  l,
25
25
  `<rb>Deprecated ${t}(${o.replace("()", "")})</>
26
26
 
27
- The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${u}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`
28
- ), oo = (e) => typeof e === oe, Re = (e, ...t) => setTimeout(() => e(...t), 0), tn = (e) => {
27
+ The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${u}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`
28
+ ), to = (e) => typeof e === ee, Ee = (e, ...t) => setTimeout(() => e(...t), 0), Kt = (e) => {
29
29
  let t = !1;
30
30
  return function(...n) {
31
31
  return t ? void 0 : (t = !0, e.apply(this, n));
32
32
  };
33
- }, ge = (e) => e, pt = 1e3, _ = (e) => Math.round(e * pt) / pt, nn = (e) => e.charAt(0).toUpperCase() + e.slice(1), U = (e) => `${e}` != "" && e !== void 0, ro = (e) => e(), so = (e) => e.toLowerCase();
34
- function io(e) {
33
+ }, fe = (e) => e, mt = 1e3, j = (e) => Math.round(e * mt) / mt, Xt = (e) => e.charAt(0).toUpperCase() + e.slice(1), H = (e) => `${e}` != "" && e !== void 0, no = (e) => e(), oo = (e) => e.toLowerCase();
34
+ function so(e) {
35
35
  switch (!0) {
36
- case !U(e):
36
+ case !H(e):
37
37
  return "";
38
- case U(e.id):
38
+ case H(e.id):
39
39
  return `${e.nodeName}#${e.id}`;
40
- case U(e.name):
40
+ case H(e.name):
41
41
  return `${e.nodeName} (${e.name}`;
42
- case U(e.className):
42
+ case H(e.className):
43
43
  return `${e.nodeName}.${e.className}`;
44
44
  default:
45
45
  return e.nodeName;
46
46
  }
47
47
  }
48
- const co = (e) => (
48
+ const ro = (e) => (
49
49
  // eslint-disable-next-line no-underscore-dangle
50
50
  e?.__esModule ? e.default : e
51
51
  ), $ = (e, t, n) => {
52
52
  if (typeof e !== t)
53
- throw new TypeError(`${n} is not a ${nn(t)}`);
54
- }, on = {
53
+ throw new TypeError(`${n} is not a ${Xt(t)}`);
54
+ }, en = {
55
55
  br: `
56
56
  `,
57
57
  rb: "\x1B[31;1m",
@@ -66,42 +66,42 @@ const co = (e) => (
66
66
  // underline
67
67
  "/": "\x1B[m"
68
68
  // reset
69
- }, ao = Object.keys(on), lo = new RegExp(`<(${ao.join("|")})>`, "gi"), uo = (e, t) => on[t] ?? "", fo = (e) => e.replace(lo, uo), mo = (e) => e.replaceAll("<br>", qe).replaceAll(/<\/?[^>]+>/gi, ""), ho = (e) => (t) => e(
70
- oo(t) ? window.chrome ? fo(t) : mo(t) : t
69
+ }, io = Object.keys(en), co = new RegExp(`<(${io.join("|")})>`, "gi"), ao = (e, t) => en[t] ?? "", lo = (e) => e.replace(co, ao), uo = (e) => e.replaceAll("<br>", Ue).replaceAll(/<\/?[^>]+>/gi, ""), fo = (e) => (t) => e(
70
+ to(t) ? window.chrome ? lo(t) : uo(t) : t
71
71
  );
72
- let Xe = !0, Be = Ve;
73
- const go = co(Ln), ee = go({
72
+ let Ye = !0, xe = Ve;
73
+ const mo = ro(Cn), K = mo({
74
74
  label: `${Ve}(child)`,
75
75
  expand: !1
76
76
  });
77
- function po(e) {
78
- Be = e.id || Ve, ee.label(`${Be}`), ee.expand(e.expand), Xe = e.enabled;
77
+ function ho(e) {
78
+ xe = e.id || Ve, K.label(`${xe}`), K.expand(e.expand), Ye = e.enabled;
79
79
  }
80
- const rn = (e) => (...t) => Xe ? ee[e](...t) : !0, a = rn("log"), d = a, pe = rn("debug");
81
- function yo(e, t) {
80
+ const tn = (e) => (...t) => Ye ? K[e](...t) : !0, a = tn("log"), d = a, me = tn("debug");
81
+ function go(e, t) {
82
82
  console.info(
83
- `${Be} %ciframe-resizer ${e}`,
84
- Xe || t < 1 ? to : K
83
+ `${xe} %ciframe-resizer ${e}`,
84
+ Ye || t < 1 ? Kn : Y
85
85
  );
86
86
  }
87
87
  const {
88
- assert: Ai,
89
- endAutoGroup: B,
90
- error: sn,
91
- errorBoundary: et,
92
- event: m,
93
- label: Ci,
94
- purge: ki,
95
- warn: T
96
- } = ee, bo = ho(ge), g = (...e) => ee.warn(...e.map(bo)), tt = no((e, t) => g(t)), cn = tt("Method"), vo = tt("Method", "replaced with"), wo = tt("Option"), nt = [];
97
- function an(e, t) {
88
+ assert: Ri,
89
+ endAutoGroup: D,
90
+ error: nn,
91
+ errorBoundary: Je,
92
+ event: h,
93
+ label: Ii,
94
+ purge: Ti,
95
+ warn: x
96
+ } = K, po = fo(fe), p = (...e) => K.warn(...e.map(po)), Ke = eo((e, t) => p(t)), on = Ke("Method"), yo = Ke("Method", "replaced with"), vo = Ke("Option"), Xe = [];
97
+ function sn(e, t) {
98
98
  a(`${e} event listener: %c${t}`, c);
99
99
  }
100
- const ln = (e, t, n, o) => {
101
- e.removeEventListener(t, n, o), an("Removed", t);
102
- }, j = (e, t, n, o = !1) => {
103
- e.addEventListener(t, n, o), nt.push(() => ln(e, t, n, o)), an("Added", t);
104
- }, i = {
100
+ const rn = (e, t, n, o) => {
101
+ e.removeEventListener(t, n, o), sn("Removed", t);
102
+ }, P = (e, t, n, o = !1) => {
103
+ e.addEventListener(t, n, o), Xe.push(() => rn(e, t, n, o)), sn("Added", t);
104
+ }, r = {
105
105
  applySelectors: null,
106
106
  firstRun: !0,
107
107
  hasTags: !1,
@@ -124,63 +124,67 @@ const ln = (e, t, n, o) => {
124
124
  onPageInfo: null,
125
125
  onParentInfo: null
126
126
  };
127
- let yt = !1;
128
- const bt = (e) => e.postMessage(
129
- xn,
127
+ let ht = !1;
128
+ const gt = (e) => e.postMessage(
129
+ Ln,
130
130
  window?.iframeResizer?.targetOrigin || "*"
131
131
  );
132
- function vt() {
133
- if (document.readyState === "loading" || !i.firstRun || yt) return;
132
+ function pt() {
133
+ if (document.readyState === "loading" || !r.firstRun || ht) return;
134
134
  const { parent: e, top: t } = window;
135
- m("ready"), a(
135
+ h("ready"), a(
136
136
  "Sending%c ready%c to parent from",
137
137
  c,
138
- w,
138
+ z,
139
139
  window.location.href
140
- ), bt(e), e !== t && bt(t), yt = !0;
140
+ ), gt(e), e !== t && gt(t), ht = !0;
141
141
  }
142
- const wt = "iframeResize", zo = (e) => he === `${e.data}`.slice(0, Jt), Eo = () => wt in window || window.jQuery !== void 0 && wt in window.jQuery.prototype, So = (e) => e.data.split(Ee)[2] in { true: 1, false: 1 }, Oo = () => [document.documentElement, document.body], Mo = ["min-height", "min-width", "max-height", "max-width"], zt = /* @__PURE__ */ new Set(), Ro = (e) => !!e && e !== "0px" && e !== Me && e !== Je, dn = (e) => e.tagName ? e.tagName.toLowerCase() : "unknown", un = (e, t) => window.getComputedStyle(e).getPropertyValue(t), $o = (e, t) => Ro(un(e, t));
143
- function To(e, t) {
142
+ const yt = "iframeResize", bo = (e) => ue === `${e.data}`.slice(0, Qt), zo = () => yt in window || // @ts-ignore
143
+ window.jQuery !== void 0 && yt in window.jQuery.prototype, wo = (e) => e.data.split(ve)[2] in { true: 1, false: 1 }, So = () => [document.documentElement, document.body], Eo = ["min-height", "min-width", "max-height", "max-width"], vt = /* @__PURE__ */ new Set(), Oo = (e) => !!e && e !== "0px" && e !== k && e !== Qe, cn = (e) => e.tagName ? e.tagName.toLowerCase() : "unknown", an = (e, t) => window.getComputedStyle(e).getPropertyValue(t), $o = (e, t) => Oo(an(e, t));
144
+ function Mo(e, t) {
144
145
  const n = e.style[t];
145
146
  return n ? { source: "an inline style attribute", value: n } : null;
146
147
  }
147
- function Io({ href: e }) {
148
- zt.has(e) || (a("Unable to access stylesheet:", e), zt.add(e));
148
+ function Ro({ href: e }) {
149
+ vt.has(e) || (a("Unable to access stylesheet:", e), vt.add(e));
149
150
  }
150
- function Ao(e, t) {
151
+ function Io(e, t) {
151
152
  for (const n of document.styleSheets)
152
153
  try {
153
154
  for (const o of n.cssRules || [])
154
155
  if (o.selectorText && e.matches(o.selectorText)) {
155
- const r = o.style[t];
156
- if (r)
156
+ const s = o.style[t];
157
+ if (s)
157
158
  return {
158
159
  source: n.ownerNode.tagName === "STYLE" ? "an inline <style> block" : `stylesheet (${n.href})`,
159
- value: r
160
+ value: s
160
161
  };
161
162
  }
162
163
  } catch {
163
- Io(n);
164
+ Ro(n);
164
165
  }
165
166
  return {
166
167
  source: "cross-origin stylesheet",
167
- value: un(e, t)
168
+ value: an(e, t)
168
169
  };
169
170
  }
170
- const Co = (e, t) => To(e, t) || Ao(e, t), ko = (e, t) => {
171
- const { source: n, value: o } = Co(e, t), r = dn(e);
172
- g(
173
- `The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${r}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.
171
+ const To = (e, t) => Mo(e, t) || Io(e, t), Ao = (e, t) => {
172
+ const { source: n, value: o } = To(e, t), s = cn(e);
173
+ p(
174
+ `The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${s}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.
174
175
 
175
176
  If you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`
176
177
  );
177
178
  };
178
- function No() {
179
- for (const e of Oo())
180
- for (const t of Mo)
181
- a(`Checking <${dn(e)}> for blocking CSS: ${t}`), $o(e, t) && ko(e, t);
182
- }
183
- const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
179
+ function ko() {
180
+ for (const e of So())
181
+ for (const t of Eo)
182
+ a(`Checking <${cn(e)}> for blocking CSS: ${t}`), $o(e, t) && Ao(e, t);
183
+ }
184
+ const No = ({
185
+ calculateWidth: e,
186
+ calculateHeight: t
187
+ }) => e === t, i = {
184
188
  autoResize: !0,
185
189
  bodyBackground: "",
186
190
  bodyMargin: 0,
@@ -189,7 +193,7 @@ const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
189
193
  bodyPadding: "",
190
194
  calculateHeight: !0,
191
195
  calculateWidth: !1,
192
- heightCalcMode: Ke,
196
+ heightCalcMode: k,
193
197
  ignoreSelector: "",
194
198
  inPageLinks: !1,
195
199
  logging: !1,
@@ -198,318 +202,277 @@ const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
198
202
  mouseEvents: !1,
199
203
  offsetHeight: 0,
200
204
  offsetWidth: 0,
205
+ parentId: void 0,
201
206
  sizeSelector: "",
202
207
  targetOrigin: "*",
203
208
  tolerance: 0,
204
- widthCalcMode: Kt,
209
+ widthCalcMode: k,
205
210
  onBeforeResize: void 0,
206
211
  onMessage: () => {
207
- T("onMessage function not defined");
212
+ x("onMessage function not defined");
208
213
  },
209
214
  onReady: () => {
210
215
  }
211
- }, Lo = (e) => `:not(${e})`, jo = `* ${Array.from(en).map(Lo).join("")}`, ot = (e) => e.querySelectorAll(jo), ye = (e) => [
212
- e.bodyOffset(),
213
- e.bodyScroll(),
214
- e.documentElementOffset(),
215
- e.documentElementScroll(),
216
- e.boundingClientRect()
217
- ], k = [c, w, c], fe = {
216
+ }, A = [c, z, c], le = {
218
217
  height: 0,
219
218
  width: 0
220
219
  }, F = {
221
220
  height: 0,
222
221
  width: 0
223
222
  };
224
- function H(e, t, n) {
225
- return F[e] = t, fe[e] = n, t;
223
+ function B(e, t, n) {
224
+ return F[e] = t, le[e] = n, t;
226
225
  }
227
- function xo(e) {
226
+ function Co(e) {
228
227
  const t = e.getOffset();
229
228
  return t !== 0 && d(`Page offsetSize: %c${t}px`, c), t;
230
229
  }
231
- const _o = (e) => e.documentElementScroll() + Math.max(0, e.getOffset());
232
- function fn(e) {
233
- const { hasOverflow: t, hasTags: n, triggerLocked: o } = i, r = e.label, u = r === ne, l = e.boundingClientRect(), p = Math.ceil(l), v = Math.floor(l), f = _o(e), z = `HTML: %c${l}px %cPage: %c${f}px`;
234
- let h;
230
+ const Po = (e) => e.documentElementScroll() + Math.max(0, e.getOffset());
231
+ function ln(e) {
232
+ const { hasOverflow: t, hasTags: n, triggerLocked: o } = r, s = e.label, u = s === we, l = e.boundingClientRect(), m = Math.ceil(l), b = Math.floor(l), f = Po(e), w = `HTML: %c${l}px %cPage: %c${f}px`;
233
+ let g;
235
234
  switch (!0) {
236
235
  case !e.enabled():
237
- return Math.max(f, X);
236
+ return Math.max(f, J);
238
237
  case n:
239
- d("Found element with data-iframe-size attribute"), h = e.taggedElement();
238
+ d("Found element with data-iframe-size attribute"), g = e.taggedElement();
240
239
  break;
241
- case (!t && i.firstRun && F[r] === 0 && fe[r] === 0):
242
- d(`Initial page size values: ${z}`, ...k), h = H(
243
- r,
240
+ case (!t && r.firstRun && F[s] === 0 && le[s] === 0):
241
+ d(`Initial page size values: ${w}`, ...A), g = B(
242
+ s,
244
243
  l,
245
244
  f
246
245
  );
247
246
  break;
248
- case (o && l === F[r] && f === fe[r]):
249
- d(`Size unchanged: ${z}`, ...k), h = Math.max(l, f);
247
+ case (o && l === F[s] && f === le[s]):
248
+ d(`Size unchanged: ${w}`, ...A), g = Math.max(l, f);
250
249
  break;
251
250
  case (l === 0 && f !== 0):
252
- d(`Page is hidden: ${z}`, ...k), h = f;
251
+ d(`Page is hidden: ${w}`, ...A), g = f;
253
252
  break;
254
- case (!t && l !== F[r] && f <= fe[r]):
255
- d(`New <html> size: ${z} `, ...k), d(
256
- `Previous <html> size: %c${F[r]}px`,
253
+ case (!t && l !== F[s] && f <= le[s]):
254
+ d(`New <html> size: ${w} `, ...A), d(
255
+ `Previous <html> size: %c${F[s]}px`,
257
256
  c
258
- ), h = H(
259
- r,
257
+ ), g = B(
258
+ s,
260
259
  l,
261
260
  f
262
261
  );
263
262
  break;
264
263
  case !u:
265
- h = e.taggedElement();
264
+ g = e.taggedElement();
266
265
  break;
267
- case (!t && l < F[r]):
268
- d(`<html> size decreased: ${z}`, ...k), h = H(
269
- r,
266
+ case (!t && l < F[s]):
267
+ d(`<html> size decreased: ${w}`, ...A), g = B(
268
+ s,
270
269
  l,
271
270
  f
272
271
  );
273
272
  break;
274
- case (f === v || f === p):
275
- d(`<html> size equals page size: ${z}`, ...k), h = H(
276
- r,
273
+ case (f === b || f === m):
274
+ d(`<html> size equals page size: ${w}`, ...A), g = B(
275
+ s,
277
276
  l,
278
277
  f
279
278
  );
280
279
  break;
281
280
  case l > f:
282
- d(`Page size < <html> size: ${z}`, ...k), h = H(
283
- r,
281
+ d(`Page size < <html> size: ${w}`, ...A), g = B(
282
+ s,
284
283
  l,
285
284
  f
286
285
  );
287
286
  break;
288
287
  case t:
289
- d("Found elements possibly overflowing <html> "), h = e.taggedElement();
288
+ d("Found elements possibly overflowing <html> "), g = e.taggedElement();
290
289
  break;
291
290
  default:
292
- d(`Using <html> size: ${z}`, ...k), h = H(
293
- r,
291
+ d(`Using <html> size: ${w}`, ...A), g = B(
292
+ s,
294
293
  l,
295
294
  f
296
295
  );
297
296
  }
298
- return d(`Content ${r}: %c${h}px`, c), h += xo(e), Math.max(h, X);
299
- }
300
- const Do = () => {
301
- const { body: e } = document, t = getComputedStyle(e);
302
- return e.offsetHeight + parseInt(t.marginTop, W) + parseInt(t.marginBottom, W);
303
- }, Bo = 1e3, Ho = 5 * Bo, Fo = 4, Wo = 10, Uo = 100, rt = "--ifr-start", be = "--ifr-end", mn = "--ifr-measure", b = [];
304
- let me = {}, Et = 0, He;
305
- function hn() {
297
+ return d(`Content ${s}: %c${g}px`, c), g += Co(e), Math.max(g, J);
298
+ }
299
+ const Lo = 1e3, jo = 5 * Lo, _o = 4, xo = 10, Do = 100, et = "--ifr-start", he = "--ifr-end", dn = "--ifr-measure", v = [];
300
+ let de = {}, bt = 0, De;
301
+ function un() {
306
302
  try {
307
- performance.clearMarks(rt), performance.clearMarks(be), performance.clearMeasures(mn);
303
+ performance.clearMarks(et), performance.clearMarks(he), performance.clearMeasures(dn);
308
304
  } catch {
309
305
  }
310
306
  }
311
- function Go() {
312
- He = setInterval(() => {
313
- if (b.length < Wo || me.hasTags && me.len < 25) return;
314
- b.sort();
307
+ function Bo() {
308
+ De = setInterval(() => {
309
+ if (v.length < xo || de.hasTags && de.len < 25) return;
310
+ v.sort();
315
311
  const e = Math.min(
316
- b.reduce((n, o) => n + o, 0) / b.length,
317
- b[Math.floor(b.length / 2)]
318
- ), t = _(e);
319
- t > Et && (Et = t, m("performanceObserver"), a("Mean time:", _(b[Math.floor(b.length / 2)])), a(
312
+ v.reduce((n, o) => n + o, 0) / v.length,
313
+ v[Math.floor(v.length / 2)]
314
+ ), t = j(e);
315
+ t > bt && (bt = t, h("performanceObserver"), a("Mean time:", j(v[Math.floor(v.length / 2)])), a(
320
316
  "Median time:",
321
- _(b.reduce((n, o) => n + o, 0) / b.length)
322
- ), a("Average time:", t), a("Max time:", _(Math.max(...b)))), hn(), !(e <= Fo) && (clearInterval(He), g(
317
+ j(v.reduce((n, o) => n + o, 0) / v.length)
318
+ ), a("Average time:", t), a("Max time:", j(Math.max(...v)))), un(), !(e <= _o) && (clearInterval(De), p(
323
319
  `<rb>Performance Warning</>
324
320
 
325
- Calculating the page size is taking an excessive amount of time (${_(e)}ms).
321
+ Calculating the page size is taking an excessive amount of time (${j(e)}ms).
326
322
 
327
- To improve performance add the <b>data-iframe-size</> attribute to the ${me.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`
323
+ To improve performance add the <b>data-iframe-size</> attribute to the ${de.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`
328
324
  ));
329
- }, Ho);
325
+ }, jo);
330
326
  }
331
- function Vo(e) {
327
+ function Fo(e) {
332
328
  e.getEntries().forEach((t) => {
333
- if (t.name === be)
329
+ if (t.name === he)
334
330
  try {
335
331
  const { duration: n } = performance.measure(
336
- mn,
337
- rt,
338
- be
332
+ dn,
333
+ et,
334
+ he
339
335
  );
340
- me = t.detail, b.push(n), b.length > Uo && b.shift();
336
+ de = t.detail, v.push(n), v.length > Do && v.shift();
341
337
  } catch {
342
338
  }
343
339
  });
344
340
  }
345
- function qo() {
346
- d("Attached%c PerformanceObserver%c to page", c, w);
347
- const e = new PerformanceObserver(Vo);
348
- return e.observe({ entryTypes: ["mark"] }), Go(), {
341
+ function Ho() {
342
+ d("Attached%c PerformanceObserver%c to page", c, z);
343
+ const e = new PerformanceObserver(Fo);
344
+ return e.observe({ entryTypes: ["mark"] }), Bo(), {
349
345
  disconnect: () => {
350
- hn(), clearInterval(He), e.disconnect(), d("Detached%c PerformanceObserver", c);
346
+ un(), clearInterval(De), e.disconnect(), d("Detached%c PerformanceObserver", c);
351
347
  }
352
348
  };
353
349
  }
354
- function Zo() {
355
- const { hasOverflow: e, hasTags: t, overflowedNodeSet: n, taggedElements: o } = i;
356
- return t ? o : e ? Array.from(n) : ot(document.documentElement);
350
+ const Wo = (e) => `:not(${e})`, Vo = `* ${Array.from(Jt).map(Wo).join("")}`, tt = (e) => e.querySelectorAll(Vo);
351
+ function Uo() {
352
+ const { hasOverflow: e, hasTags: t, overflowedNodeSet: n, taggedElements: o } = r;
353
+ return t ? o : e ? Array.from(n) : tt(document.documentElement);
357
354
  }
358
- function Yo(e, t) {
355
+ function Go(e, t) {
359
356
  const n = `margin-${t}`;
360
- let o, r = document.documentElement, u = i.hasTags ? X : document.documentElement.getBoundingClientRect().bottom;
357
+ let o, s = document.documentElement, u = r.hasTags ? J : document.documentElement.getBoundingClientRect().bottom;
361
358
  for (const l of e)
362
- o = l.getBoundingClientRect()[t] + parseFloat(getComputedStyle(l).getPropertyValue(n)), o > u && (u = o, r = l);
363
- return { maxEl: r, maxVal: u };
359
+ o = l.getBoundingClientRect()[t] + parseFloat(getComputedStyle(l).getPropertyValue(n)), o > u && (u = o, s = l);
360
+ return { maxEl: s, maxVal: u };
364
361
  }
365
- function ve(e) {
366
- performance.mark(rt);
367
- const t = nn(e), { logging: n } = s, { hasTags: o } = i, r = Zo(), { maxEl: u, maxVal: l } = Yo(r, e);
368
- return d(`${t} position calculated from:`, u), d(`Checked %c${r.length}%c elements`, c, w), performance.mark(be, {
362
+ function fn(e) {
363
+ performance.mark(et);
364
+ const t = Xt(e), { logging: n } = i, { hasTags: o } = r, s = Uo(), { maxEl: u, maxVal: l } = Go(s, e);
365
+ return d(`${t} position calculated from:`, u), d(`Checked %c${s.length}%c elements`, c, z), performance.mark(he, {
369
366
  detail: {
370
367
  hasTags: o,
371
- len: r.length,
368
+ len: s.length,
372
369
  logging: n,
373
370
  Side: t
374
371
  }
375
372
  }), l;
376
373
  }
377
- const S = {
378
- label: ne,
379
- enabled: () => s.calculateHeight,
380
- getOffset: () => s.offsetHeight,
381
- auto: () => fn(S),
382
- bodyOffset: Do,
383
- bodyScroll: () => document.body.scrollHeight,
384
- offset: () => S.bodyOffset(),
385
- // Backwards compatibility
386
- documentElementOffset: () => document.documentElement.offsetHeight,
387
- documentElementScroll: () => document.documentElement.scrollHeight,
374
+ const Oe = {
375
+ label: we,
376
+ enabled: () => i.calculateHeight,
377
+ getOffset: () => i.offsetHeight,
378
+ auto: () => ln(Oe),
388
379
  boundingClientRect: () => Math.max(
389
380
  document.documentElement.getBoundingClientRect().bottom,
390
381
  document.body.getBoundingClientRect().bottom
391
382
  ),
392
- max: () => Math.max(...ye(S)),
393
- min: () => Math.min(...ye(S)),
394
- grow: () => S.max(),
395
- lowestElement: () => ve(xe),
396
- taggedElement: () => ve(xe),
397
- custom: () => (T("Custom height calculation function not defined"), S.auto())
398
- }, O = {
399
- label: Gt,
400
- enabled: () => s.calculateWidth,
401
- getOffset: () => s.offsetWidth,
402
- auto: () => fn(O),
403
- bodyScroll: () => document.body.scrollWidth,
404
- bodyOffset: () => document.body.offsetWidth,
405
- documentElementScroll: () => document.documentElement.scrollWidth,
406
- documentElementOffset: () => document.documentElement.offsetWidth,
383
+ documentElementScroll: () => document.documentElement.scrollHeight,
384
+ taggedElement: () => fn(Wt)
385
+ }, $e = {
386
+ label: Ft,
387
+ enabled: () => i.calculateWidth,
388
+ getOffset: () => i.offsetWidth,
389
+ auto: () => ln($e),
407
390
  boundingClientRect: () => Math.max(
408
391
  document.documentElement.getBoundingClientRect().right,
409
392
  document.body.getBoundingClientRect().right
410
393
  ),
411
- max: () => Math.max(...ye(O)),
412
- min: () => Math.min(...ye(O)),
413
- rightMostElement: () => ve(_e),
414
- scroll: () => Math.max(O.bodyScroll(), O.documentElementScroll()),
415
- taggedElement: () => ve(_e),
416
- custom: () => (T("Custom width calculation function not defined"), O.auto())
417
- }, Qo = {
418
- bodyOffset: 1,
419
- bodyScroll: 1,
420
- offset: 1,
421
- documentElementOffset: 1,
422
- documentElementScroll: 1,
423
- boundingClientRect: 1,
424
- max: 1,
425
- min: 1,
426
- grow: 1,
427
- lowestElement: 1
428
- }, Jo = (e) => `set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page. This can be done on the child page by adding the following code:
394
+ documentElementScroll: () => document.documentElement.scrollWidth,
395
+ taggedElement: () => fn(Vt)
396
+ };
397
+ function mn(e, t) {
398
+ const { label: n } = t;
399
+ return e && e !== k && p(
400
+ `<rb>Ignored ${n}CalculationMethod (${e})</>
429
401
 
430
- window.iframeResizer = {
431
- license: 'xxxx',
432
- ${e}CalculationMethod: '${Me}',
433
- }
434
- `;
435
- function Ko(e, t) {
436
- const n = s.version ? "remove this option." : Jo(e);
437
- g(
438
- `<rb>Deprecated ${e}CalculationMethod (${t})</>
402
+ This version of <i>iframe-resizer</> auto detects the most suitable ${n} calculation method. The <b>${n}CalculationMethod</> option is no longer supported and has been ignored.
439
403
 
440
- This version of <i>iframe-resizer</> can auto detect the most suitable ${e} calculation method. It is recommended that you ${n}
404
+ To remove this warning, delete the <b>${n}CalculationMethod</> option from your parent page config and/or the <i>window.iframeResizer</> config on the child page.
441
405
  `
442
- );
443
- }
444
- function gn(e, t, n) {
445
- const { label: o } = n;
446
- return t !== e && (e in n || (T(`${e} is not a valid option for ${o}CalculationMethod.`), e = t), e in Qo && Ko(o, e)), a(`Set ${o} calculation method: %c${e}`, c), e;
406
+ ), a(`Set ${n} calculation method: %c${k}`, c), k;
447
407
  }
448
- function pn() {
449
- s.heightCalcMode = gn(
450
- s.heightCalcMode,
451
- Ke,
452
- S
453
- );
408
+ function qo() {
409
+ i.heightCalcMode = mn(i.heightCalcMode, Oe);
454
410
  }
455
- function yn() {
456
- s.widthCalcMode = gn(
457
- s.widthCalcMode,
458
- Kt,
459
- O
460
- );
411
+ function Zo() {
412
+ i.widthCalcMode = mn(i.widthCalcMode, $e);
461
413
  }
462
- function Xo() {
414
+ function Qo() {
463
415
  try {
464
- i.sameOrigin = s.mode === 1 || "iframeParentListener" in window.parent;
416
+ r.sameOrigin = i.mode === 1 || "iframeParentListener" in window.parent;
465
417
  } catch {
466
418
  a("Cross domain iframe detected");
467
419
  }
468
420
  }
469
- const er = `<rb>Deprecated Attributes</>
421
+ const Yo = `<rb>Deprecated Attributes</>
470
422
 
471
423
  The <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.`;
472
- function tr() {
424
+ function Jo() {
473
425
  let e = !1;
474
426
  const t = (n) => document.querySelectorAll(`[${n}]`).forEach((o) => {
475
- o.toggleAttribute(Oe, !0), o.removeAttribute(n), e = !0;
427
+ o.toggleAttribute(ze, !0), o.removeAttribute(n), e = !0;
476
428
  });
477
- t("data-iframe-height"), t("data-iframe-width"), e && g(er);
429
+ t("data-iframe-height"), t("data-iframe-width"), e && p(Yo);
478
430
  }
479
- let St = 0;
480
- function nr(e) {
431
+ let zt = 0;
432
+ function Ko(e) {
481
433
  const t = e.length === 1 ? "" : "s";
482
- T(
483
- `%c[${te}]%c found on %c${e.length}%c element${t}`,
484
- ft,
485
- K,
486
- ft,
487
- K
434
+ x(
435
+ `%c[${X}]%c found on %c${e.length}%c element${t}`,
436
+ dt,
437
+ Y,
438
+ dt,
439
+ Y
488
440
  );
489
441
  }
490
- function or() {
491
- const e = document.querySelectorAll(`*[${te}]`), t = e.length > 0;
492
- return t && e.length !== St && (nr(e), St = e.length), t;
442
+ function Xo() {
443
+ const e = document.querySelectorAll(`*[${X}]`), t = e.length > 0;
444
+ return t && e.length !== zt && (Ko(e), zt = e.length), t;
493
445
  }
494
- const Ot = (e) => {
446
+ const ge = (e) => {
495
447
  if (!e) return "";
496
448
  let t = -559038744, n = 1103547984;
497
- for (let o, r = 0; r < e.length; r++)
498
- o = e.codePointAt(r), t = Math.imul(t ^ o, 2246822519), n = Math.imul(n ^ o, 3266489917);
449
+ for (let o, s = 0; s < e.length; s++)
450
+ o = e.codePointAt(s), t = Math.imul(t ^ o, 2246822519), n = Math.imul(n ^ o, 3266489917);
499
451
  return t ^= Math.imul(t ^ n >>> 15, 1935289751), n ^= Math.imul(n ^ t >>> 15, 3405138345), t ^= n >>> 16, n ^= t >>> 16, (2097152 * (n >>> 0) + (t >>> 11)).toString(36);
500
- }, N = (e) => e.replace(
452
+ }, T = (e) => e.replace(
501
453
  /[A-Za-z]/g,
502
454
  (t) => String.fromCodePoint(
503
455
  (t <= "Z" ? 90 : 122) >= (t = t.codePointAt(0) + 19) ? t : t - 26
504
456
  )
505
- ), Q = ["spjluzl", "rlf", "clyzpvu", "rlf2"], rr = [
457
+ ), es = /* @__PURE__ */ new Date(), hn = (e) => new Set(Array.from({ length: 9 }, e)), ts = (e) => [
458
+ e[0],
459
+ ...e.slice(1).map((t) => `${t} - lewpylk`),
460
+ `${e[4]} - lewpylk`,
461
+ ...e.slice(1)
462
+ ], W = ["spjluzl", "rlf", "clyzpvu", "rlf2", "nlaMbssFlhy"], ns = [
506
463
  "<yi>Puchspk Spjluzl Rlf</><iy><iy>",
507
464
  "<yi>Tpzzpun Spjluzl Rlf</><iy><iy>",
508
465
  "Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>",
509
466
  "<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.",
510
467
  "<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.",
511
- "Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."
512
- ], sr = ["NWSc3", "zvsv", "wyv", "ibzpulzz", "vlt"], Mt = Object.fromEntries(
468
+ "Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz.",
469
+ "<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> fvb jhu bzl aol mpyza 11 johyhjalyz vm fvb spjlujl rlf av nla h 60% kpzjvbua ha <ii>oaaw://pmyhtl-ylzpgly.jvt</>.",
470
+ // Upgrade
471
+ "<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Av bwnyhkl av clyzpvu 6 vm<p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt sltvu-zxbllgf.jvt.",
472
+ // Upgrade OEM
473
+ "<yi>VLT rlf lewpylk</><iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt sltvu-zxbllgf.jvt."
474
+ // key expired
475
+ ], os = ts(["NWSc3", "zvsv", "wyv", "ibzpulzz", "VLT"]), wt = Object.fromEntries(
513
476
  [
514
477
  "2cgs7fdf4xb",
515
478
  "1c9ctcccr4z",
@@ -517,551 +480,564 @@ const Ot = (e) => {
517
480
  "ueokt0969w",
518
481
  "w2zxchhgqz",
519
482
  "1umuxblj2e5",
483
+ "1foobarqaz",
520
484
  "2b5sdlfhbev",
521
485
  "zo4ui3arjo",
522
- "oclbb4thgl"
486
+ "oclbb4thgl",
487
+ "igb1wzrjqr"
523
488
  ].map((e, t) => [e, Math.max(0, t - 1)])
524
- ), G = (e) => N(rr[e]), ir = (e) => N(sr[e]), cr = (e) => N(Q[e]), Rt = (e) => {
525
- const t = e[N(Q[0])] || e[N(Q[1])] || e[N(Q[2])] || e[N(Q[3])];
489
+ ), ss = /* @__PURE__ */ new Set([1, 6]), gn = es[T(W[4])](), rs = hn((e, t) => ge(`${gn + t}`)), is = hn((e, t) => ge(`${gn - ++t}`)), cs = (e) => rs.has(e) ? 9 : is.has(e) ? 5 : -2, nt = (e) => ss.has(e), V = (e) => T(ns[e]), as = (e) => T(os[e]), St = (e) => T(W[e]), Et = (e) => {
490
+ const t = e[T(W[0])] || e[T(W[1])] || e[T(W[2])] || e[T(W[3])];
526
491
  if (!t) return -1;
527
492
  const n = t.split("-");
528
- let o = (function(r = "") {
529
- let u = -2;
530
- const l = Ot(N(r));
531
- return l in Mt && (u = Mt[l]), u > 4 ? u - 4 : u;
532
- })(n[0]);
533
- return o === 0 || ((r) => r[2] === Ot(r[0] + r[1]))(n) || (o = -2), o;
493
+ let o = (function(s = "", u = "") {
494
+ let l = -2;
495
+ const m = ge(T(s));
496
+ return m in wt && (l = wt[m]), l === 9 ? cs(u) : l;
497
+ })(...n);
498
+ return o === 0 || ((s) => s[2] === ge(s[0] + s[1]))(n) || (o = -2), o;
534
499
  };
535
- function ar({ key: e, key2: t, mode: n, version: o }) {
536
- const r = n, u = Rt({ key: e }), l = Rt({ key2: t });
537
- if (s.mode = n = Math.max(u, l), n < 0) {
538
- if (n = Math.min(u, l), g(`${G(n + 2)}${G(2)}`), U(o))
539
- throw i.firstRun = !1, G(n + 2).replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
540
- } else (!U(o) || r > -1 && n > r) && (sessionStorage.getItem("ifr") !== D && yo(`v${D} (${ir(n)})`, n), n < 2 && g(G(3)), sessionStorage.setItem("ifr", D));
541
- }
542
- const lr = "BackCompat", dr = `<rb>Quirks Mode Detected</>
500
+ function ls({
501
+ key: e,
502
+ key2: t,
503
+ mode: n,
504
+ version: o
505
+ }) {
506
+ const s = n, u = Et({ key: e }), l = Et({ key2: t });
507
+ if (i.mode = n = Math.max(u, l), n < 0) {
508
+ if (n = Math.min(u, l), p(`${V(n + 2)}${V(2)}`), H(o))
509
+ throw r.firstRun = !1, V(n + 2).replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
510
+ } else (!H(o) || s > -1 && n > s) && (sessionStorage.getItem("ifr") !== _ && go(`v${_} (${as(n)})`, n), n < 2 && p(V(3)), sessionStorage.setItem("ifr", _));
511
+ }
512
+ const ds = "BackCompat", us = `<rb>Quirks Mode Detected</>
543
513
 
544
514
  This iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.
545
515
 
546
516
  For more information see <u>https://iframe-resizer.com/quirks-mode</>.
547
517
  `;
548
- function ur() {
549
- document.compatMode === lr && g(dr);
518
+ function fs() {
519
+ document.compatMode === ds && p(us);
550
520
  }
551
- const fr = "complete";
552
- let $t = !1;
553
- function bn(e) {
554
- document.readyState === fr ? Re(e) : $t || j(
521
+ const ms = "complete";
522
+ let Ot = !1;
523
+ function pn(e) {
524
+ document.readyState === ms ? Ee(e) : Ot || P(
555
525
  document,
556
- Vt,
557
- () => bn(e)
558
- ), $t = !0;
526
+ Ht,
527
+ () => pn(e)
528
+ ), Ot = !0;
559
529
  }
560
- const mr = () => {
561
- d(`Set targetOrigin for parent: %c${s.targetOrigin}`, c), s.autoResize !== !0 && a("Auto Resize disabled");
530
+ const hs = () => {
531
+ d(`Set targetOrigin for parent: %c${i.targetOrigin}`, c), i.autoResize !== !0 && a("Auto Resize disabled");
562
532
  };
563
- function vn() {
564
- i.taggedElements = document.querySelectorAll(`[${Oe}]`), i.hasTags = i.taggedElements.length > 0, a(`Tagged elements found: %c${i.hasTags}`, c);
533
+ function yn() {
534
+ r.taggedElements = document.querySelectorAll(`[${ze}]`), r.hasTags = r.taggedElements.length > 0, a(`Tagged elements found: %c${r.hasTags}`, c);
565
535
  }
566
- const hr = `<rb>Legacy version detected on parent page</>
536
+ const gs = `<rb>Legacy version detected on parent page</>
567
537
 
568
538
  Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
569
539
 
570
540
  See <u>https://iframe-resizer.com/setup/</> for more details.
571
- `, gr = (e) => `<b>Version mismatch</>
541
+ `, ps = (e) => `<b>Version mismatch</>
572
542
 
573
543
  The parent and child pages are running different versions of <i>iframe resizer</>.
574
544
 
575
- Parent page: ${e} - Child page: ${D}.
545
+ Parent page: ${e} - Child page: ${_}.
576
546
  `;
577
- function pr({ version: e }) {
578
- !e || e === "" || e === Xn ? g(hr) : e !== D && g(gr(e));
547
+ function ys({ version: e }) {
548
+ !e || e === "" || e === Yn ? p(gs) : e !== _ && p(ps(e));
579
549
  }
580
- const yr = tn(() => g(G(4)));
581
- function br(e) {
582
- if (!i.timerActive) return;
583
- const t = _(performance.now() - i.totalTime), n = e === Se ? `Initialised iframe in %c${t}ms` : `Size calculated in %c${t}ms`;
550
+ const vs = Kt(() => p(V(4)));
551
+ function bs(e) {
552
+ if (!r.timerActive) return;
553
+ const t = j(performance.now() - r.totalTime), n = e === be ? `Initialised iframe in %c${t}ms` : `Size calculated in %c${t}ms`;
584
554
  a(n, c);
585
555
  }
586
- function vr(e) {
587
- return e === void 0 ? e = s.targetOrigin : a(`Message targetOrigin: %c${e}`, c), e;
556
+ function zs(e) {
557
+ return e === void 0 ? e = i.targetOrigin : a(`Message targetOrigin: %c${e}`, c), e;
588
558
  }
589
- function wr(e, t) {
590
- const { mode: n } = s, { sameOrigin: o, target: r } = i;
559
+ function ws(e, t) {
560
+ const { mode: n } = i, { sameOrigin: o, target: s } = r;
591
561
  if (o)
592
562
  try {
593
- window.parent.iframeParentListener(he + e);
563
+ window.parent.iframeParentListener(ue + e);
594
564
  } catch (u) {
595
- if (n === 1) yr();
565
+ if (nt(n)) vs();
596
566
  else throw u;
597
567
  return !1;
598
568
  }
599
- else r.postMessage(he + e, vr(t));
569
+ else s.postMessage(ue + e, zs(t));
600
570
  return !0;
601
571
  }
602
- function wn(e, t, n, o, r) {
603
- const { parentId: u } = s, { sameOrigin: l } = i, p = `${e}:${t}`, v = `${u}:${p}:${n}${o === void 0 ? "" : `:${o}`}`;
604
- s.mode < -1 || !wr(v, r) || (br(n), d(
605
- `Sending message to parent page via ${l ? "sameOrigin" : "postMessage"}: %c%c${v}`,
606
- jn,
572
+ function vn(e, t, n, o, s) {
573
+ const { parentId: u } = i, { sameOrigin: l } = r, m = `${e}:${t}`, b = `${u}:${m}:${n}${o === void 0 ? "" : `:${o}`}`;
574
+ i.mode < -1 || !ws(b, s) || (bs(n), d(
575
+ `Sending message to parent page via ${l ? "sameOrigin" : "postMessage"}: %c%c${b}`,
576
+ Pn,
607
577
  c
608
578
  ));
609
579
  }
610
- const y = et(
611
- (e, t, n, o, r) => {
612
- m(n), wn(e, t, n, o, r), B();
580
+ const y = Je(
581
+ (e, t, n, o, s) => {
582
+ h(n), vn(e, t, n, o, s), D();
613
583
  }
614
- ), zr = (e) => y(0, 0, e.type, `${e.screenY}:${e.screenX}`);
615
- function Tt(e, t) {
616
- a(`Add event listener: %c${t}`, c), j(window.document, e, zr);
584
+ ), Ss = (e) => y(0, 0, e.type, `${e.screenY}:${e.screenX}`);
585
+ function $t(e, t) {
586
+ a(`Add event listener: %c${t}`, c), P(window.document, e, Ss);
617
587
  }
618
- function Er({ mouseEvents: e }) {
619
- e === !0 && (Tt(Fn, "Mouse Enter"), Tt(Wn, "Mouse Leave"));
588
+ function Es({
589
+ mouseEvents: e
590
+ }) {
591
+ e === !0 && ($t(Bn, "Mouse Enter"), $t(Fn, "Mouse Leave"));
620
592
  }
621
- const Sr = () => y(0, 0, Dn);
622
- function Or({ persisted: e }) {
623
- e || Sr(), m(Bt), d("Page persisted:", e), !e && nt.forEach(ro);
593
+ const Os = () => y(0, 0, _n);
594
+ function $s({ persisted: e }) {
595
+ e || Os(), h(jt), d("Page persisted:", e), !e && Xe.forEach(no);
624
596
  }
625
- const Mr = () => j(window, so(Bt), Or), It = (e, t) => !(Math.abs(e - t) <= s.tolerance);
626
- function Rr(e, t) {
627
- const { calculateHeight: n, calculateWidth: o } = s, { height: r, width: u } = i;
628
- return n && It(r, e) || o && It(u, t);
597
+ const Ms = () => P(window, oo(jt), $s), Mt = (e, t) => !(Math.abs(e - t) <= i.tolerance);
598
+ function Rs(e, t) {
599
+ const { calculateHeight: n, calculateWidth: o } = i, { height: s, width: u } = r;
600
+ return n && Mt(s, e) || o && Mt(u, t);
629
601
  }
630
- function $r(e) {
631
- const t = s.onBeforeResize(e);
632
- if (t === void 0)
602
+ function Is(e, t, n) {
603
+ const o = i.onBeforeResize(e, t, n);
604
+ if (o === void 0)
633
605
  throw new TypeError(
634
606
  "No value returned from onBeforeResize(), expected a numeric value"
635
607
  );
636
- if (Number.isNaN(t))
608
+ if (Number.isNaN(o))
637
609
  throw new TypeError(
638
- `Invalid value returned from onBeforeResize(): ${t}, expected Number`
610
+ `Invalid value returned from onBeforeResize(): ${o}, expected Number`
639
611
  );
640
- if (t < X)
612
+ if (o < J)
641
613
  throw new RangeError(
642
- `Out of range value returned from onBeforeResize(): ${t}, must be at least ${X}`
614
+ `Out of range value returned from onBeforeResize(): ${o}, must be at least ${J}`
643
615
  );
644
- return t;
645
- }
646
- const zn = (e) => (t) => {
647
- const n = e[t]();
648
- return e.enabled() && s.onBeforeResize !== void 0 ? $r(n) : n;
649
- }, Tr = zn(S), Ir = zn(O);
650
- function Ar(e, t, n, o) {
651
- const { heightCalcMode: r, widthCalcMode: u } = s, l = n ?? Tr(r), p = o ?? Ir(u), v = Rr(l, p) ? mt : e;
652
- switch (a(`Resize event: %c${t}`, c), v) {
653
- case Se:
654
- case De:
655
- case mt:
656
- case Ze:
657
- case Ye:
658
- i.height = l, i.width = p;
616
+ return o;
617
+ }
618
+ const bn = (e, t) => (n, o) => {
619
+ const s = e[n]();
620
+ return e.enabled() && i.onBeforeResize !== void 0 ? Is(s, o, t) : s;
621
+ }, Ts = bn(Oe, we), As = bn($e, Ft);
622
+ function ks(e, t, n, o) {
623
+ const { heightCalcMode: s, widthCalcMode: u } = i, l = n ?? Ts(s, e), m = o ?? As(u, e), b = Rs(l, m) ? ut : e;
624
+ switch (a(`Resize event: %c${t}`, c), b) {
625
+ case be:
626
+ case _e:
627
+ case ut:
628
+ case Ge:
629
+ case qe:
630
+ r.height = l, r.width = m;
659
631
  // eslint-disable-next-line no-fallthrough
660
- case qt:
661
- return i;
632
+ case Ut:
633
+ return r;
662
634
  // the following case needs {} to prevent a compile error on Next.js
663
- case Qe:
664
- case Yt:
665
- case Zt:
666
- case Qt: {
667
- a(gt);
635
+ case Ze:
636
+ case qt:
637
+ case Gt:
638
+ case Zt: {
639
+ a(ft);
668
640
  break;
669
641
  }
670
642
  default:
671
- d(gt);
643
+ d(ft);
672
644
  }
673
645
  return null;
674
646
  }
675
- let ae = !1, Ce = !1, Z = null;
676
- function Cr(e, t, n, o, r) {
677
- const { autoResize: u } = s, { isHidden: l } = i;
678
- switch (m(e), !0) {
679
- case l === !0: {
680
- if (Ce === !0) break;
681
- a("Iframe hidden - Ignored resize request"), Ce = !0, ae = !1, cancelAnimationFrame(Z), Z = null;
647
+ let re = !1, ke = !1, q = null;
648
+ function Ns(e, t, n, o, s) {
649
+ const { autoResize: u } = i, { isHidden: l } = r;
650
+ switch (h(e), !0) {
651
+ // Allow manual and parent resize requests to bypass the hidden check
652
+ case (l === !0 && !(e in Ae)): {
653
+ if (ke === !0) break;
654
+ a("Iframe hidden - Ignored resize request"), ke = !0, re = !1, cancelAnimationFrame(q), q = null;
682
655
  break;
683
656
  }
684
657
  // Ignore overflowObserver here, as more efficient than using
685
658
  // mutationObserver to detect OVERFLOW_ATTR changes
686
659
  // Also allow manual and parent resize requests to bypass the pending check
687
- case (ae === !0 && e !== Qe && !(e in ht)): {
660
+ case (re === !0 && e !== Ze && !(e in Ae)): {
688
661
  a("Resize already pending - Ignored resize request");
689
662
  break;
690
663
  }
691
- case (!u && !(e in ht)): {
664
+ case (!u && !(e in Ae)): {
692
665
  d("Resizing disabled");
693
666
  break;
694
667
  }
695
668
  default: {
696
- Ce = !1, ae = !0, i.totalTime = performance.now(), i.timerActive = !0;
697
- const p = Ar(
669
+ ke = !1, re = !0, r.totalTime = performance.now(), r.timerActive = !0;
670
+ const m = ks(
698
671
  e,
699
672
  t,
700
673
  n,
701
674
  o
702
675
  );
703
- p && wn(p.height, p.width, e, r), Z || (Z = requestAnimationFrame(() => {
704
- ae = !1, Z = null, m("requestAnimationFrame"), pe(`Reset sendPending: %c${e}`, c);
705
- })), i.timerActive = !1;
676
+ m && vn(m.height, m.width, e, s), q || (q = requestAnimationFrame(() => {
677
+ re = !1, q = null, h("requestAnimationFrame"), me(`Reset sendPending: %c${e}`, c);
678
+ })), r.timerActive = !1;
706
679
  }
707
680
  }
708
- B();
681
+ D();
709
682
  }
710
- const I = et(Cr);
711
- function At({ eventType: e, eventName: t }) {
712
- j(window, t, () => I(t, e), { passive: !0 });
683
+ const M = Je(Ns);
684
+ function Rt({
685
+ eventType: e,
686
+ eventName: t
687
+ }) {
688
+ P(window, t, () => M(t, e), { passive: !0 });
713
689
  }
714
- function kr() {
715
- At({
690
+ function Cs() {
691
+ Rt({
716
692
  eventType: "After Print",
717
693
  eventName: "afterprint"
718
- }), At({
694
+ }), Rt({
719
695
  eventType: "Before Print",
720
696
  eventName: "beforeprint"
721
697
  });
722
698
  }
723
- function Nr() {
724
- if (i.triggerLocked) {
699
+ function Ps() {
700
+ if (r.triggerLocked) {
725
701
  a("TriggerLock blocked calculation");
726
702
  return;
727
703
  }
728
- i.triggerLocked = !0, pe("Trigger event lock on"), requestAnimationFrame(() => {
729
- i.triggerLocked = !1, pe("Trigger event lock off");
704
+ r.triggerLocked = !0, me("Trigger event lock on"), requestAnimationFrame(() => {
705
+ r.triggerLocked = !1, me("Trigger event lock off");
730
706
  });
731
707
  }
732
- function En(e) {
733
- const { heightCalcMode: t, widthCalcMode: n } = s, o = S[t](), r = O[n]();
734
- a(`Reset trigger event: %c${e}`, c), y(o, r, e);
708
+ function zn(e) {
709
+ const { heightCalcMode: t, widthCalcMode: n } = i, o = Oe[t](), s = $e[n]();
710
+ a(`Reset trigger event: %c${e}`, c), y(o, s, e);
735
711
  }
736
- function Pr(e) {
737
- const t = s.heightCalcMode;
738
- a(`Reset trigger event: %c${e}`, c), s.heightCalcMode = Ke, Nr(), En("reset"), s.heightCalcMode = t;
712
+ function Ls(e) {
713
+ const t = i.heightCalcMode;
714
+ a(`Reset trigger event: %c${e}`, c), i.heightCalcMode = Xn, Ps(), zn("reset"), i.heightCalcMode = t;
739
715
  }
740
- const Lr = `Auto Resize can not be changed when <b>direction</> is set to '${Je}'.`;
741
- function jr(e) {
742
- $(e, Qn, "parentIframe.autoResize(enable) enable");
743
- const { autoResize: t, calculateHeight: n, calculateWidth: o } = s;
744
- return o === !1 && n === !1 ? (m(De), g(Lr), !1) : (e === !0 && t === !1 ? (s.autoResize = !0, queueMicrotask(() => I(De, "Auto Resize enabled"))) : e === !1 && t === !0 && (s.autoResize = !1), y(0, 0, _n, JSON.stringify(s.autoResize)), s.autoResize);
745
- }
746
- function xr(e) {
747
- s.heightCalcMode = e, pn();
748
- }
749
- function _r(e) {
750
- s.widthCalcMode = e, yn();
716
+ const js = `Auto Resize can not be changed when <b>direction</> is set to '${Qe}'.`;
717
+ function _s(e) {
718
+ $(e, qn, "parentIframe.autoResize(enable) enable");
719
+ const {
720
+ autoResize: t,
721
+ calculateHeight: n,
722
+ calculateWidth: o
723
+ } = i;
724
+ return o === !1 && n === !1 ? (h(_e), p(js), !1) : (e === !0 && t === !1 ? (i.autoResize = !0, queueMicrotask(() => M(_e, "Auto Resize enabled"))) : e === !1 && t === !0 && (i.autoResize = !1), y(0, 0, jn, JSON.stringify(i.autoResize)), i.autoResize);
751
725
  }
752
- function Dr(e) {
753
- $(e, oe, "parentIframe.moveToAnchor(anchor) anchor"), i.inPageLinks.findTarget(e);
726
+ function xs(e) {
727
+ $(e, ee, "parentIframe.moveToAnchor(anchor) anchor"), r.inPageLinks.findTarget(e);
754
728
  }
755
- function Br(e) {
756
- $(e, L, "parentIframe.setOffsetSize(offset) offset"), s.offsetHeight = e, s.offsetWidth = e, I(qt, `parentIframe.setOffsetSize(${e})`);
729
+ function Ds(e) {
730
+ $(e, C, "parentIframe.setOffsetSize(offset) offset"), i.offsetHeight = e, i.offsetWidth = e, M(Ut, `parentIframe.setOffsetSize(${e})`);
757
731
  }
758
- function Hr() {
759
- return m("getOrigin"), cn("getOrigin()", "getParentOrigin()"), i.origin;
732
+ function Bs() {
733
+ return h("getOrigin"), on("getOrigin()", "getParentOrigin()"), r.origin;
760
734
  }
761
- const Fr = () => i.origin;
762
- function Wr(e) {
735
+ const Fs = () => r.origin;
736
+ function Hs(e) {
763
737
  $(
764
738
  e,
765
- oe,
739
+ ee,
766
740
  "parentIframe.setTargetOrigin(targetOrigin) targetOrigin"
767
- ), a(`Set targetOrigin: %c${e}`, c), s.targetOrigin = e;
741
+ ), a(`Set targetOrigin: %c${e}`, c), i.targetOrigin = e;
768
742
  }
769
- function Ur(e) {
770
- if (typeof e === re) {
771
- i.onPageInfo = e, y(0, 0, Ht), vo(
743
+ function Ws(e) {
744
+ if (typeof e === Se) {
745
+ r.onPageInfo = e, y(0, 0, _t), yo(
772
746
  "getPageInfo()",
773
747
  "getParentProps()",
774
748
  "See <u>https://iframe-resizer.com/upgrade</> for details. "
775
749
  );
776
750
  return;
777
751
  }
778
- i.onPageInfo = null, y(0, 0, Un);
752
+ r.onPageInfo = null, y(0, 0, Hn);
779
753
  }
780
- function Sn(e) {
754
+ function wn(e) {
781
755
  return $(
782
756
  e,
783
- re,
757
+ Se,
784
758
  "parentIframe.getParentProps(callback) callback"
785
- ), i.onParentInfo = e, y(0, 0, Ft), () => {
786
- i.onParentInfo = null, y(0, 0, Gn);
759
+ ), r.onParentInfo = e, y(0, 0, xt), () => {
760
+ r.onParentInfo = null, y(0, 0, Wn);
787
761
  };
788
762
  }
789
- function Gr(e) {
790
- cn("getParentProperties()", "getParentProps()"), Sn(e);
763
+ function Vs(e) {
764
+ on("getParentProperties()", "getParentProps()"), wn(e);
791
765
  }
792
- const Vr = (e) => `<rb>Deprecated API object name</>
766
+ const Us = (e) => `<rb>Deprecated API object name</>
793
767
  The <b>window.parentIFrame</> object has been renamed to <b>window.parentIframe</>. Please update your code as the old object will be removed in a future version.
794
768
 
795
769
  Called property: '${String(e)}'
796
770
  `;
797
- function qr(e) {
771
+ function Gs(e) {
798
772
  const t = /* @__PURE__ */ new Set();
799
773
  return new Proxy(e, {
774
+ // eslint-disable-next-line @typescript-eslint/no-shadow
800
775
  get(n, o) {
801
- t.has(o) || (g(Vr(o)), t.add(o));
802
- const r = n[o], u = Object.getOwnPropertyDescriptor(n, o);
803
- return u && !u.configurable && !u.writable ? r : typeof r == "function" ? r.bind(n) : r;
776
+ t.has(o) || (p(Us(o)), t.add(o));
777
+ const s = n[o], u = Object.getOwnPropertyDescriptor(n, o);
778
+ return u && !u.configurable && !u.writable ? s : typeof s == "function" ? s.bind(n) : s;
804
779
  }
805
780
  });
806
781
  }
807
- function Zr(e, t) {
782
+ function qs(e, t) {
808
783
  e !== void 0 && $(
809
784
  e,
810
- L,
785
+ C,
811
786
  "parentIframe.resize(customHeight, customWidth) customHeight"
812
787
  ), t !== void 0 && $(
813
788
  t,
814
- L,
789
+ C,
815
790
  "parentIframe.resize(customHeight, customWidth) customWidth"
816
791
  );
817
792
  const n = `${e || ""}${t ? `,${t}` : ""}`;
818
- I(
819
- Ze,
793
+ M(
794
+ Ge,
820
795
  `parentIframe.resize(${n})`,
821
796
  e,
822
797
  t
823
798
  );
824
799
  }
825
- const st = (e) => (t, n) => {
826
- $(t, L, `parentIframe.${e}(x, y) x`), $(n, L, `parentIframe.${e}(x, y) y`), y(n, t, e);
827
- }, Yr = st(Vn), Qr = st(qn), Jr = st(Wt);
828
- function Kr(e, t) {
800
+ const ot = (e) => (t, n) => {
801
+ $(t, C, `parentIframe.${e}(x, y) x`), $(n, C, `parentIframe.${e}(x, y) y`), y(n, t, e);
802
+ }, Zs = ot(Vn), Qs = ot(Un), Ys = ot(Dt);
803
+ function Js(e, t) {
829
804
  t && $(
830
805
  t,
831
- oe,
806
+ ee,
832
807
  "parentIframe.sendMessage(msg, targetOrigin) targetOrigin"
833
808
  ), y(0, 0, je, JSON.stringify(e), t);
834
809
  }
835
- const Xr = () => y(0, 0, Bn), es = () => s.parentId, ts = () => Pr("parentIframe.reset"), ns = () => T("parentIframe.size() has been renamed parentIframe.resize()");
836
- function os() {
837
- const { win: e } = i;
838
- s.mode !== 1 && (e.parentIframe = Object.freeze({
839
- autoResize: jr,
840
- close: Xr,
841
- getId: es,
842
- getOrigin: Hr,
810
+ const Ks = () => y(0, 0, xn), Xs = () => i.parentId, er = () => Ls("parentIframe.reset"), tr = () => x("parentIframe.size() has been renamed parentIframe.resize()");
811
+ function nr() {
812
+ const { win: e } = r;
813
+ i.mode !== 1 && (e.parentIframe = Object.freeze({
814
+ autoResize: _s,
815
+ close: Ks,
816
+ getId: Xs,
817
+ getOrigin: Bs,
843
818
  // TODO Remove in V6
844
- getParentOrigin: Fr,
845
- getPageInfo: Ur,
819
+ getParentOrigin: Fs,
820
+ getPageInfo: Ws,
846
821
  // TODO Remove in V6
847
- getParentProps: Sn,
848
- getParentProperties: Gr,
822
+ getParentProps: wn,
823
+ getParentProperties: Vs,
849
824
  // TODO Remove in V6
850
- moveToAnchor: Dr,
851
- reset: ts,
852
- setOffsetSize: Br,
853
- scrollBy: Yr,
854
- scrollTo: Qr,
855
- scrollToOffset: Jr,
856
- sendMessage: Kr,
857
- setHeightCalculationMethod: xr,
858
- setWidthCalculationMethod: _r,
859
- setTargetOrigin: Wr,
860
- resize: Zr,
861
- size: ns
825
+ moveToAnchor: xs,
826
+ reset: er,
827
+ setOffsetSize: Ds,
828
+ scrollBy: Zs,
829
+ scrollTo: Qs,
830
+ scrollToOffset: Ys,
831
+ sendMessage: Js,
832
+ setTargetOrigin: Hs,
833
+ resize: qs,
834
+ size: tr
862
835
  // TODO Remove in V6
863
- }), e.parentIFrame = qr(e.parentIframe));
836
+ }), e.parentIFrame = Gs(e.parentIframe));
864
837
  }
865
- const se = (e = "") => (t) => (n) => {
866
- n.size > 0 && pe(
838
+ const te = (e = "") => (t) => (n) => {
839
+ n.size > 0 && me(
867
840
  `${t}Observer ${e}:`,
868
- ...Array.from(n).flatMap((o) => [qe, o])
841
+ ...Array.from(n).flatMap((o) => [Ue, o])
869
842
  );
870
- }, rs = (e = "") => (t) => (n) => {
871
- n.size > 0 && sn(
843
+ }, or = (e = "") => (t) => (n) => {
844
+ n.size > 0 && nn(
872
845
  `${t}Observer ${e}:`,
873
- ...Array.from(n).flatMap((o) => [qe, o])
846
+ ...Array.from(n).flatMap((o) => [Ue, o])
874
847
  );
875
- }, On = se("attached to"), Mn = rs("already attached"), ss = se("detached from"), $e = (e, t = !0) => (n) => {
848
+ }, Sn = te("attached to"), En = or("already attached"), sr = te("detached from"), Me = (e, t = !0) => (n) => {
876
849
  n > 0 && d(
877
850
  `${t ? "At" : "De"}tached %c${e}Observer%c ${t ? "to" : "from"} %c${n}%c element${n === 1 ? "" : "s"}`,
878
851
  c,
879
- K,
852
+ Y,
880
853
  c,
881
- K
854
+ Y
882
855
  );
883
- }, Rn = (e, t, n, o) => {
884
- const r = ss(e);
856
+ }, On = (e, t, n, o) => {
857
+ const s = sr(e);
885
858
  return (u) => {
886
859
  const l = /* @__PURE__ */ new Set();
887
- let p = 0;
888
- for (const v of u)
889
- n.has(v) && (t.unobserve(v), n.delete(v), l.add(v), p += 1);
890
- r(l), o(p), l.clear();
860
+ let m = 0;
861
+ for (const b of u)
862
+ n.has(b) && (t.unobserve(b), n.delete(b), l.add(b), m += 1);
863
+ s(l), o(m), l.clear();
891
864
  };
892
- }, Ct = 16, kt = 2, is = 200, it = "Mutation", M = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set(), Fe = /* @__PURE__ */ new Set(), we = [], cs = {
865
+ }, It = 16, Tt = 2, rr = 200, st = "Mutation", E = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set(), Be = /* @__PURE__ */ new Set(), pe = [], ir = {
893
866
  attributes: !0,
894
- attributeFilter: [te, Oe],
867
+ attributeFilter: [X, ze],
895
868
  attributeOldValue: !1,
896
869
  characterData: !1,
897
870
  characterDataOldValue: !1,
898
871
  childList: !0,
899
872
  subtree: !0
900
873
  };
901
- let ke = 1, ct, We = !1, Ue = 0;
902
- const as = se("added")(it), ls = se("removed (page)")(it), ds = se("removed (added)")(it), $n = (e) => e.nodeType !== Node.ELEMENT_NODE || en.has(e.tagName.toLowerCase());
903
- function us(e) {
874
+ let Ne = 1, rt, Fe = !1, He = 0;
875
+ const cr = te("added")(st), ar = te("removed (page)")(st), lr = te("removed (added)")(st), $n = (e) => e.nodeType !== Node.ELEMENT_NODE || Jt.has(e.tagName.toLowerCase());
876
+ function dr(e) {
904
877
  const t = e.addedNodes;
905
878
  for (const n of t)
906
- $n(n) || M.add(n);
879
+ $n(n) || E.add(n);
907
880
  }
908
- function fs(e) {
881
+ function ur(e) {
909
882
  const t = e.removedNodes;
910
883
  for (const n of t)
911
- $n(n) || (M.has(n) ? (M.delete(n), Fe.add(n)) : P.add(n));
884
+ $n(n) || (E.has(n) ? (E.delete(n), Be.add(n)) : N.add(n));
912
885
  }
913
- const ms = (e) => {
886
+ const fr = (e) => {
914
887
  d("Mutations:", e);
915
888
  for (const t of e)
916
- us(t), fs(t);
917
- as(M), ls(P), ds(Fe), Fe.clear();
889
+ dr(t), ur(t);
890
+ cr(E), ar(N), lr(Be), Be.clear();
918
891
  };
919
- function hs() {
920
- P.size > 0 && a(
921
- `Detected %c${P.size} %cremoved element${P.size > 1 ? "s" : ""}`,
892
+ function mr() {
893
+ N.size > 0 && a(
894
+ `Detected %c${N.size} %cremoved element${N.size > 1 ? "s" : ""}`,
922
895
  c,
923
- w
924
- ), M.size > 0 && a(
925
- `Found %c${M.size} %cnew element${M.size > 1 ? "s" : ""}`,
896
+ z
897
+ ), E.size > 0 && a(
898
+ `Found %c${E.size} %cnew element${E.size > 1 ? "s" : ""}`,
926
899
  c,
927
- w
900
+ z
928
901
  );
929
902
  }
930
- const gs = (e) => () => {
931
- const t = performance.now(), n = t - Ue, o = Ct * ke++ + kt;
932
- if (n > o && n < is) {
933
- m("mutationThrottled"), d("Update delayed due to heavy workload on the callStack"), d(
934
- `EventLoop busy time: %c${_(n)}ms %c> Max wait: %c${o - kt}ms`,
903
+ const hr = (e) => () => {
904
+ const t = performance.now(), n = t - He, o = It * Ne++ + Tt;
905
+ if (n > o && n < rr) {
906
+ h("mutationThrottled"), d("Update delayed due to heavy workload on the callStack"), d(
907
+ `EventLoop busy time: %c${j(n)}ms %c> Max wait: %c${o - Tt}ms`,
935
908
  c,
936
- w,
909
+ z,
937
910
  c
938
- ), setTimeout(ct, Ct * ke), Ue = t;
911
+ ), setTimeout(rt, It * Ne), He = t;
939
912
  return;
940
913
  }
941
- ke = 1, we.forEach(ms), we.length = 0, We = !1, hs(), e({ addedNodes: M, removedNodes: P }), M.clear(), P.clear();
914
+ Ne = 1, pe.forEach(fr), pe.length = 0, Fe = !1, mr(), e({ addedNodes: E, removedNodes: N }), E.clear(), N.clear();
942
915
  };
943
- function ps(e) {
944
- we.push(e), !We && (Ue = performance.now(), We = !0, requestAnimationFrame(ct));
916
+ function gr(e) {
917
+ pe.push(e), !Fe && (He = performance.now(), Fe = !0, requestAnimationFrame(rt));
945
918
  }
946
- function ys(e) {
947
- const t = new window.MutationObserver(ps), n = document.body || document.documentElement;
948
- return ct = gs(e), t.observe(n, cs), d("Attached%c MutationObserver%c to body", c, w), {
919
+ function pr(e) {
920
+ const t = new window.MutationObserver(gr), n = document.body || document.documentElement;
921
+ return rt = hr(e), t.observe(n, ir), d("Attached%c MutationObserver%c to body", c, z), {
949
922
  ...t,
950
923
  disconnect: () => {
951
- M.clear(), P.clear(), we.length = 0, t.disconnect(), d("Detached%c MutationObserver", c);
924
+ E.clear(), N.clear(), pe.length = 0, t.disconnect(), d("Detached%c MutationObserver", c);
952
925
  }
953
926
  };
954
927
  }
955
- const bs = {
928
+ const yr = {
956
929
  characterData: !0,
957
930
  childList: !0,
958
931
  subtree: !0
959
932
  };
960
- function vs(e) {
933
+ function vr(e) {
961
934
  const t = document.querySelector("title") ?? document.head ?? document.documentElement, n = new MutationObserver(e);
962
- return n.observe(t, bs), d("Attached%c TitleObserver%c to head", c, w), setTimeout(e), {
935
+ return n.observe(t, yr), d("Attached%c TitleObserver%c to head", c, z), setTimeout(e), {
963
936
  disconnect: () => {
964
937
  n.disconnect(), d("Detached%c TitleObserver", c);
965
938
  }
966
939
  };
967
940
  }
968
- function ws(e) {
941
+ function br(e) {
969
942
  const t = new IntersectionObserver(
970
943
  (o) => e(o.at(-1)?.isIntersecting ?? !1),
971
944
  {
972
945
  threshold: 0
973
946
  }
974
947
  ), n = document.documentElement;
975
- return t.observe(n), d("Attached%c VisibilityObserver%c to page", c, w), {
948
+ return t.observe(n), d("Attached%c VisibilityObserver%c to page", c, z), {
976
949
  disconnect: () => {
977
950
  t.disconnect(), d("Detached%c VisibilityObserver", c);
978
951
  }
979
952
  };
980
953
  }
981
- let Nt = /* @__PURE__ */ new Set();
982
- function zs(e) {
954
+ let At = /* @__PURE__ */ new Set();
955
+ function zr(e) {
983
956
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
984
957
  for (const o of e)
985
- o.closest(`[${te}]`) ? n.add(o) : t.add(o);
958
+ o.closest(`[${X}]`) ? n.add(o) : t.add(o);
986
959
  return n.size > 0 && queueMicrotask(() => {
987
- m("overflowIgnored"), d(`Ignoring elements with [data-iframe-ignore] > *:
988
- `, n), B();
960
+ h("overflowIgnored"), d(`Ignoring elements with [data-iframe-ignore] > *:
961
+ `, n), D();
989
962
  }), t;
990
963
  }
991
- function Tn() {
992
- const e = document.querySelectorAll(`[${Ut}]`), t = zs(e);
964
+ function Mn() {
965
+ const e = document.querySelectorAll(`[${Bt}]`), t = zr(e);
993
966
  let n = !1;
994
- return typeof Set.prototype.symmetricDifference === re && (n = t.symmetricDifference(Nt).size > 0), Nt = t, i.overflowedNodeSet = t, i.hasOverflow = t.size > 0, { hasOverflowUpdated: n, overflowedNodeSet: t };
967
+ return typeof Set.prototype.symmetricDifference === Se && (n = t.symmetricDifference(At).size > 0), At = t, r.overflowedNodeSet = t, r.hasOverflow = t.size > 0, { hasOverflowUpdated: n, overflowedNodeSet: t };
995
968
  }
996
- const R = {}, In = (e) => {
969
+ const O = {}, Rn = (e) => {
997
970
  const t = /* @__PURE__ */ new Set();
998
971
  for (const n of e) {
999
972
  t.add(n);
1000
- for (const o of ot(n)) t.add(o);
973
+ for (const o of tt(n)) t.add(o);
1001
974
  }
1002
975
  return d(`Inspecting:
1003
976
  `, t), t;
1004
- }, Es = (e) => {
977
+ }, wr = (e) => {
1005
978
  if (e.size === 0) return;
1006
- m("addObservers");
1007
- const t = In(e);
1008
- R.overflow.attachObservers(t), R.resize.attachObserverToNonStaticElements(t), B();
1009
- }, Ss = (e) => {
979
+ h("addObservers");
980
+ const t = Rn(e);
981
+ O.overflow.attachObservers(t), O.resize.attachObserverToNonStaticElements(t), D();
982
+ }, Sr = (e) => {
1010
983
  if (e.size === 0) return;
1011
- m("removeObservers");
1012
- const t = In(e);
1013
- R.overflow.detachObservers(t), R.resize.detachObservers(t), B();
984
+ h("removeObservers");
985
+ const t = Rn(e);
986
+ O.overflow.detachObservers(t), O.resize.detachObservers(t), D();
1014
987
  };
1015
- function Os({ addedNodes: e, removedNodes: t }) {
1016
- m("contentMutated"), i.applySelectors(), vn(), Tn(), B(), Ss(t), Es(e);
988
+ function Er({
989
+ addedNodes: e,
990
+ removedNodes: t
991
+ }) {
992
+ h("contentMutated"), r.applySelectors(), yn(), Mn(), D(), Sr(t), wr(e);
1017
993
  }
1018
- function Ms(e) {
1019
- Os(e), I(Yt, "Mutation Observed");
994
+ function Or(e) {
995
+ Er(e), M(qt, "Mutation Observed");
1020
996
  }
1021
- const ie = "Overflow", Rs = $e(ie), $s = $e(ie, !1), Ts = On(ie), Is = Mn(ie), As = (e) => e.hidden || e.offsetParent === null || e.style.display === Je, Cs = (e, t) => {
997
+ const ne = "Overflow", $r = Me(ne), Mr = Me(ne, !1), Rr = Sn(ne), Ir = En(ne), Tr = (e) => e.hidden || e.offsetParent === null || e.style.display === Qe, Ar = (e, t) => {
1022
998
  const n = t.side, o = {
1023
999
  root: t.root,
1024
1000
  rootMargin: "0px",
1025
1001
  threshold: 1
1026
- }, r = window?.requestAnimationFrame || ge, u = (E = !1) => e(E), l = (E, A) => E === 0 || E > A[n], p = (E, A) => E.toggleAttribute(Ut, A);
1027
- function v(E) {
1028
- for (const A of E) {
1029
- const { boundingClientRect: V, rootBounds: q, target: C } = A;
1030
- if (!q) continue;
1031
- const Nn = V[n], Pn = l(Nn, q) && !As(C);
1032
- p(C, Pn);
1002
+ }, s = window?.requestAnimationFrame || fe, u = (S = !1) => e(S), l = (S, R) => S === 0 || S > R[n], m = (S, R) => S.toggleAttribute(Bt, R);
1003
+ function b(S) {
1004
+ for (const R of S) {
1005
+ const { boundingClientRect: U, rootBounds: G, target: I } = R;
1006
+ if (!G) continue;
1007
+ const kn = U[n], Nn = l(kn, G) && !Tr(I);
1008
+ m(I, Nn);
1033
1009
  }
1034
- r(u);
1010
+ s(u);
1035
1011
  }
1036
- const f = new IntersectionObserver(v, o), z = /* @__PURE__ */ new WeakSet();
1037
- function h(E) {
1038
- const A = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set();
1039
- let q = 0;
1040
- for (const C of E)
1041
- if (C.nodeType === Node.ELEMENT_NODE) {
1042
- if (z.has(C)) {
1043
- A.add(C);
1012
+ const f = new IntersectionObserver(b, o), w = /* @__PURE__ */ new WeakSet();
1013
+ function g(S) {
1014
+ const R = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Set();
1015
+ let G = 0;
1016
+ for (const I of S)
1017
+ if (I.nodeType === Node.ELEMENT_NODE) {
1018
+ if (w.has(I)) {
1019
+ R.add(I);
1044
1020
  continue;
1045
1021
  }
1046
- f.observe(C), z.add(C), V.add(C), q += 1;
1022
+ f.observe(I), w.add(I), U.add(I), G += 1;
1047
1023
  }
1048
- Is(A), Ts(V), Rs(q), V.clear(), A.clear();
1024
+ Ir(R), Rr(U), $r(G), U.clear(), R.clear();
1049
1025
  }
1050
1026
  return {
1051
- attachObservers: h,
1052
- detachObservers: Rn(
1053
- ie,
1027
+ attachObservers: g,
1028
+ detachObservers: On(
1029
+ ne,
1054
1030
  f,
1055
- z,
1056
- $s
1031
+ w,
1032
+ Mr
1057
1033
  ),
1058
1034
  disconnect: () => {
1059
1035
  f.disconnect(), d("Detached%c OverflowObserver", c);
1060
1036
  }
1061
1037
  };
1062
1038
  };
1063
- function ks() {
1064
- const { hasOverflow: e } = i, { hasOverflowUpdated: t, overflowedNodeSet: n } = Tn();
1039
+ function kr() {
1040
+ const { hasOverflow: e } = r, { hasOverflowUpdated: t, overflowedNodeSet: n } = Mn();
1065
1041
  switch (!0) {
1066
1042
  case !t:
1067
1043
  return;
@@ -1073,382 +1049,376 @@ function ks() {
1073
1049
  default:
1074
1050
  d("No overflow detected");
1075
1051
  }
1076
- I(Qe, "Overflow updated");
1052
+ M(Ze, "Overflow updated");
1077
1053
  }
1078
- function Ns(e) {
1054
+ function Nr(e) {
1079
1055
  const t = {
1080
1056
  root: document.documentElement,
1081
- side: s.calculateHeight ? xe : _e
1057
+ side: i.calculateHeight ? Wt : Vt
1082
1058
  };
1083
- return R.overflow = Cs(ks, t), R.overflow.attachObservers(e), R.overflow;
1059
+ return O.overflow = Ar(kr, t), O.overflow.attachObservers(e), O.overflow;
1084
1060
  }
1085
- const ce = "Resize", Ps = $e(ce), Ls = $e(ce, !1), js = On(ce), xs = Mn(ce), ze = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Set();
1086
- let J;
1087
- function _s(e) {
1061
+ const oe = "Resize", Cr = Me(oe), Pr = Me(oe, !1), Lr = Sn(oe), jr = En(oe), ye = /* @__PURE__ */ new WeakSet(), Ce = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Set();
1062
+ let Q;
1063
+ function _r(e) {
1088
1064
  let t = 0;
1089
1065
  for (const n of e) {
1090
1066
  if (n.nodeType !== Node.ELEMENT_NODE) continue;
1091
1067
  const o = getComputedStyle(n)?.position;
1092
1068
  if (!(o === "" || o === "static")) {
1093
- if (ze.has(n)) {
1094
- Ne.add(n);
1069
+ if (ye.has(n)) {
1070
+ Ce.add(n);
1095
1071
  continue;
1096
1072
  }
1097
- J.observe(n), ze.add(n), Pe.add(n), t += 1;
1073
+ Q.observe(n), ye.add(n), Pe.add(n), t += 1;
1098
1074
  }
1099
1075
  }
1100
- xs(Ne), js(Pe), Ps(t), Pe.clear(), Ne.clear();
1101
- }
1102
- const Ds = (e) => (J = new ResizeObserver(e), J.observe(document.body), ze.add(document.body), d("Attached%c ResizeObserver%c to body", c, w), {
1103
- attachObserverToNonStaticElements: _s,
1104
- detachObservers: Rn(
1105
- ce,
1106
- J,
1107
- ze,
1108
- Ls
1076
+ jr(Ce), Lr(Pe), Cr(t), Pe.clear(), Ce.clear();
1077
+ }
1078
+ const xr = (e) => (Q = new ResizeObserver(e), Q.observe(document.body), ye.add(document.body), d("Attached%c ResizeObserver%c to body", c, z), {
1079
+ attachObserverToNonStaticElements: _r,
1080
+ detachObservers: On(
1081
+ oe,
1082
+ Q,
1083
+ ye,
1084
+ Pr
1109
1085
  ),
1110
1086
  disconnect: () => {
1111
- J.disconnect(), d("Detached%c ResizeObserver", c);
1087
+ Q.disconnect(), d("Detached%c ResizeObserver", c);
1112
1088
  }
1113
1089
  });
1114
- function Bs(e) {
1090
+ function Dr(e) {
1115
1091
  if (!Array.isArray(e) || e.length === 0) return;
1116
1092
  const t = e[0].target;
1117
- I(Zt, `Element resized <${io(t)}>`);
1093
+ M(Gt, `Element resized <${so(t)}>`);
1118
1094
  }
1119
- function Hs(e) {
1120
- return R.resize = Ds(Bs), R.resize.attachObserverToNonStaticElements(e), R.resize;
1095
+ function Br(e) {
1096
+ return O.resize = xr(Dr), O.resize.attachObserverToNonStaticElements(e), O.resize;
1121
1097
  }
1122
- let Pt;
1123
- function Fs() {
1098
+ let kt;
1099
+ function Fr() {
1124
1100
  const e = document.title;
1125
- e !== Pt && (Pt = e, a(`Title: %c${e}`, c), e && y(0, 0, Zn, e));
1101
+ e !== kt && (kt = e, a(`Title: %c${e}`, c), e && y(0, 0, Gn, e));
1126
1102
  }
1127
- function Ws(e) {
1128
- a(`Visible: %c${e}`, c), i.isHidden = !e, I(Qt, "Visibility changed");
1129
- }
1130
- function Us(e) {
1131
- nt.push(...e.map((t) => t.disconnect));
1132
- }
1133
- function Gs() {
1134
- m("attachObservers");
1135
- const e = ot(document.documentElement), t = [
1136
- ys(Ms),
1137
- Ns(e),
1138
- qo(),
1139
- Hs(e),
1140
- vs(Fs),
1141
- ws(Ws)
1103
+ function Hr(e) {
1104
+ a(`Visible: %c${e}`, c), r.isHidden = !e, M(Zt, "Visibility changed");
1105
+ }
1106
+ function Wr(e) {
1107
+ Xe.push(...e.map((t) => t.disconnect));
1108
+ }
1109
+ function Vr() {
1110
+ h("attachObservers");
1111
+ const e = tt(document.documentElement), t = [
1112
+ pr(Or),
1113
+ Nr(e),
1114
+ Ho(),
1115
+ Br(e),
1116
+ vr(Fr),
1117
+ br(Hr)
1142
1118
  ];
1143
- Us(t);
1119
+ Wr(t);
1144
1120
  }
1145
- const Lt = (e, t, n) => {
1121
+ const Nt = (e, t, n) => {
1146
1122
  if (n !== "") {
1147
1123
  a(`${e}: %c${n}`, c);
1148
1124
  for (const o of document.querySelectorAll(n))
1149
1125
  a(`Applying ${t} to:`, o), o.toggleAttribute(t, !0);
1150
1126
  }
1151
1127
  };
1152
- function Vs({ sizeSelector: e, ignoreSelector: t }) {
1128
+ function Ur({
1129
+ sizeSelector: e,
1130
+ ignoreSelector: t
1131
+ }) {
1153
1132
  return () => {
1154
- Lt("sizeSelector", Oe, e), Lt("ignoreSelector", te, t);
1133
+ Nt("sizeSelector", ze, e), Nt("ignoreSelector", X, t);
1155
1134
  };
1156
1135
  }
1157
- function qs() {
1136
+ function Gr() {
1158
1137
  const e = document.createElement("div");
1159
1138
  e.style.clear = "both", e.style.display = "block", e.style.height = "0", document.body.append(e);
1160
1139
  }
1161
- function Zs(e, t) {
1162
- return t.includes("-") && (T(`Negative CSS value ignored for ${e}`), t = ""), t;
1140
+ function qr(e, t) {
1141
+ return t.includes("-") && (x(`Negative CSS value ignored for ${e}`), t = ""), t;
1163
1142
  }
1164
- function Ge(e, t) {
1165
- t === void 0 || t === "" || t === eo || (document.body.style.setProperty(e, t), d(`Set body ${e}: %c${t}`, c));
1143
+ function We(e, t) {
1144
+ t === void 0 || t === "" || t === Jn || (document.body.style.setProperty(e, t), d(`Set body ${e}: %c${t}`, c));
1166
1145
  }
1167
- function Ys({ bodyMarginStr: e, bodyMargin: t }) {
1168
- e === void 0 && (e = `${t}px`), Ge("margin", Zs("margin", e));
1146
+ function Zr({
1147
+ bodyMarginStr: e,
1148
+ bodyMargin: t
1149
+ }) {
1150
+ e === void 0 && (e = `${t}px`), We("margin", qr("margin", e));
1169
1151
  }
1170
- const Qs = () => ({
1152
+ const Qr = () => ({
1171
1153
  x: document.documentElement.scrollLeft,
1172
1154
  y: document.documentElement.scrollTop
1173
1155
  });
1174
- function Js(e) {
1175
- const t = e.getBoundingClientRect(), n = Qs();
1156
+ function Yr(e) {
1157
+ const t = e.getBoundingClientRect(), n = Qr();
1176
1158
  return {
1177
- x: parseInt(t.left, W) + parseInt(n.x, W),
1178
- y: parseInt(t.top, W) + parseInt(n.y, W)
1159
+ x: parseInt(t.left, se) + parseInt(n.x, se),
1160
+ y: parseInt(t.top, se) + parseInt(n.y, se)
1179
1161
  };
1180
1162
  }
1181
- function Ks(e, t) {
1182
- const n = Js(t);
1163
+ function Jr(e, t) {
1164
+ const n = Yr(t);
1183
1165
  a(
1184
1166
  `Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,
1185
1167
  c,
1186
- w,
1168
+ z,
1187
1169
  c,
1188
- w,
1170
+ z,
1189
1171
  c
1190
- ), y(n.y, n.x, Wt);
1172
+ ), y(n.y, n.x, Dt);
1191
1173
  }
1192
- function at(e) {
1174
+ function it(e) {
1193
1175
  const t = e.split("#")[1] || e, n = decodeURIComponent(t), o = document.getElementById(n) || document.getElementsByName(n)[0];
1194
1176
  if (o !== void 0) {
1195
- Ks(t, o);
1177
+ Jr(t, o);
1196
1178
  return;
1197
1179
  }
1198
- a(`In page link (#${t}) not found in iframe, so sending to parent`), y(0, 0, Hn, `#${t}`);
1180
+ a(`In page link (#${t}) not found in iframe, so sending to parent`), y(0, 0, Dn, `#${t}`);
1199
1181
  }
1200
- function An() {
1182
+ function In() {
1201
1183
  const { hash: e, href: t } = window.location;
1202
- e !== "" && e !== "#" && at(t);
1184
+ e !== "" && e !== "#" && it(t);
1203
1185
  }
1204
- function Xs() {
1186
+ function Kr() {
1205
1187
  for (const e of document.querySelectorAll('a[href^="#"]'))
1206
- e.getAttribute("href") !== "#" && j(e, "click", (t) => {
1207
- t.preventDefault(), at(e.getAttribute("href"));
1188
+ e.getAttribute("href") !== "#" && P(e, "click", (t) => {
1189
+ t.preventDefault(), it(e.getAttribute("href"));
1208
1190
  });
1209
1191
  }
1192
+ function Xr() {
1193
+ P(window, "hashchange", In);
1194
+ }
1210
1195
  function ei() {
1211
- j(window, "hashchange", An);
1196
+ setTimeout(In, Yt);
1212
1197
  }
1213
1198
  function ti() {
1214
- setTimeout(An, Xt);
1215
- }
1216
- function ni() {
1217
- a("Setting up location.hash handlers"), Xs(), ei(), ti(), i.inPageLinks = {
1218
- findTarget: at
1199
+ a("Setting up location.hash handlers"), Kr(), Xr(), ei(), r.inPageLinks = {
1200
+ findTarget: it
1219
1201
  };
1220
1202
  }
1221
- function oi(e) {
1222
- const { mode: t } = s;
1223
- e ? t === 1 ? g(G(5)) : ni() : a("In page linking not enabled");
1203
+ function ni(e) {
1204
+ const { mode: t } = i;
1205
+ e ? nt(t) ? p(V(5)) : ti() : a("In page linking not enabled");
1224
1206
  }
1225
- const ri = "important";
1207
+ const oi = "important";
1226
1208
  function si() {
1227
- const e = (t) => t.style.setProperty(ne, Me, ri);
1209
+ const e = (t) => t.style.setProperty(we, k, oi);
1228
1210
  e(document.documentElement), e(document.body), a("Set HTML & body height: %cauto !important", c);
1229
1211
  }
1230
- const ii = "custom", ci = (e) => `<rb>Deprecated Option(${e}CalculationMethod)</>
1231
-
1232
- The use of <b>${e}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.
1233
-
1234
- See <u>https://iframe-resizer.com/api/child</> for more details.
1235
- `;
1236
- function jt(e, t) {
1237
- return typeof e !== re ? e : (g(ci(t)), t === ne ? S.custom = e : O.custom = e, ii);
1238
- }
1239
- const lt = (e) => (t, n) => {
1212
+ const ct = (e) => (t, n) => {
1240
1213
  if (n in t) {
1241
1214
  if (typeof t[n] === e) return t[n];
1242
1215
  throw new TypeError(`${n} is not a ${e}.`);
1243
1216
  }
1244
- }, Le = lt(re), le = lt(L), de = lt(oe), ai = (e) => e !== null && typeof e === Jn && !Array.isArray(e);
1245
- function li(e) {
1246
- const { calculateHeight: t, calculateWidth: n } = s;
1247
- let o, r;
1248
- return typeof e?.offset === L && (wo(Ie, Ae), t && (o = le(e, Ie)), n && (r = le(e, Ie))), typeof e?.offsetSize === L && (t && (o = le(e, Ae)), n && (r = le(e, Ae))), { offsetHeight: o, offsetWidth: r };
1217
+ }, Le = ct(Se), ie = ct(C), ce = ct(ee), ri = (e) => e !== null && typeof e === Zn && !Array.isArray(e);
1218
+ function ii(e) {
1219
+ const { calculateHeight: t, calculateWidth: n } = i;
1220
+ let o, s;
1221
+ return typeof e?.offset === C && (vo(Ie, Te), t && (o = ie(e, Ie)), n && (s = ie(e, Ie))), typeof e?.offsetSize === C && (t && (o = ie(e, Te)), n && (s = ie(e, Te))), { offsetHeight: o, offsetWidth: s };
1249
1222
  }
1250
- function di(e) {
1223
+ function ci(e) {
1251
1224
  a("Reading data from page:", Object.keys(e));
1252
- const { offsetHeight: t, offsetWidth: n } = li(e);
1225
+ const { offsetHeight: t, offsetWidth: n } = ii(e);
1253
1226
  return {
1254
1227
  offsetHeight: t,
1255
1228
  offsetWidth: n,
1256
- ignoreSelector: de(e, "ignoreSelector"),
1257
- key2: de(e, cr(0)),
1258
- sizeSelector: de(e, "sizeSelector"),
1259
- targetOrigin: de(e, "targetOrigin"),
1260
- heightCalcMode: jt(
1261
- e?.heightCalculationMethod,
1262
- ne
1263
- ),
1264
- widthCalcMode: jt(e?.widthCalculationMethod, Gt),
1229
+ ignoreSelector: ce(e, "ignoreSelector"),
1230
+ [St(3)]: ce(e, St(0)),
1231
+ sizeSelector: ce(e, "sizeSelector"),
1232
+ targetOrigin: ce(e, "targetOrigin"),
1265
1233
  onBeforeResize: Le(e, "onBeforeResize"),
1266
1234
  onMessage: Le(e, "onMessage"),
1267
1235
  onReady: Le(e, "onReady")
1268
1236
  };
1269
1237
  }
1270
- function ui() {
1271
- const { mode: e } = s;
1272
- if (e === 1) return {};
1238
+ function ai() {
1239
+ const { mode: e } = i;
1240
+ if (nt(e)) return {};
1273
1241
  const t = window.iframeResizer || window.iFrameResizer;
1274
- return ai(t) ? di(t) : {};
1242
+ return ri(t) ? ci(t) : {};
1275
1243
  }
1276
- const fi = (e) => e === "true", Cn = (e) => (t) => t === void 0 ? void 0 : e(t), x = Cn(fi), Y = Cn(Number), mi = (e) => ({
1244
+ const li = (e) => e === "true", Tn = (e) => (t) => t === void 0 ? void 0 : e(t), L = Tn(li), Z = Tn(Number), di = (e) => ({
1277
1245
  parentId: e[0],
1278
- bodyMargin: Y(e[1]),
1279
- calculateWidth: x(e[2]),
1280
- logging: x(e[3]),
1246
+ bodyMargin: Z(e[1]),
1247
+ calculateWidth: L(e[2]),
1248
+ logging: L(e[3]),
1281
1249
  // data[4] no longer used (was intervalTimer)
1282
- autoResize: x(e[6]),
1250
+ autoResize: L(e[6]),
1283
1251
  bodyMarginStr: e[7],
1284
1252
  heightCalcMode: e[8],
1285
1253
  bodyBackground: e[9],
1286
1254
  bodyPadding: e[10],
1287
- tolerance: Y(e[11]),
1288
- inPageLinks: x(e[12]),
1255
+ tolerance: Z(e[11]),
1256
+ inPageLinks: L(e[12]),
1289
1257
  // data[13] no longer used (was resizeFrom)
1290
1258
  widthCalcMode: e[14],
1291
- mouseEvents: x(e[15]),
1292
- offsetHeight: Y(e[16]),
1293
- offsetWidth: Y(e[17]),
1294
- calculateHeight: x(e[18]),
1259
+ mouseEvents: L(e[15]),
1260
+ offsetHeight: Z(e[16]),
1261
+ offsetWidth: Z(e[17]),
1262
+ calculateHeight: L(e[18]),
1295
1263
  key: e[19],
1296
1264
  version: e[20],
1297
- mode: Y(e[21]),
1265
+ mode: Z(e[21]),
1298
1266
  // sizeSelector: data[22] // Now only available via page settings
1299
- logExpand: x(e[23])
1267
+ logExpand: L(e[23])
1300
1268
  });
1301
- function hi(e) {
1302
- const { mode: t } = s;
1269
+ function ui(e) {
1270
+ const { mode: t } = i;
1303
1271
  e.forEach((n) => {
1304
1272
  try {
1305
1273
  n();
1306
1274
  } catch (o) {
1307
1275
  if (t < 0) throw o;
1308
- g(
1276
+ p(
1309
1277
  `<rb>Error in setup function</>
1310
1278
  <i>iframe-resizer</> detected an error during setup.
1311
1279
 
1312
1280
  Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`
1313
- ), sn(o);
1281
+ ), nn(o);
1314
1282
  }
1315
1283
  });
1316
1284
  }
1317
- function xt(e) {
1285
+ function Ct(e) {
1318
1286
  for (const [t, n] of Object.entries(e))
1319
- n !== void 0 && (s[t] = n);
1287
+ n !== void 0 && (i[t] = n);
1320
1288
  }
1321
- function gi({
1289
+ function fi({
1322
1290
  logExpand: e,
1323
1291
  logging: t,
1324
1292
  parentId: n
1325
1293
  }) {
1326
- po({ id: n, enabled: t, expand: e }), m("initReceived"), a(`Initialising iframe v${D} ${window.location.href}`);
1294
+ ho({ id: n, enabled: t, expand: e }), h("initReceived"), a(`Initialising iframe v${_} ${window.location.href}`);
1327
1295
  }
1328
- function pi(e) {
1329
- m("ready"), bn(tn(e)), a("Initialization complete", (({ key: t, key2: n, ...o }) => o)(s));
1296
+ function mi(e) {
1297
+ h("ready"), pn(Kt(e)), a("Initialization complete", (({ key: t, key2: n, ...o }) => o)(i));
1330
1298
  }
1331
- function yi({
1299
+ function hi({
1332
1300
  bodyBackground: e,
1333
1301
  bodyPadding: t,
1334
1302
  inPageLinks: n,
1335
1303
  onReady: o
1336
1304
  }) {
1337
- const r = Po(s), u = [
1338
- () => pr(s),
1339
- () => ar(s),
1340
- or,
1305
+ const s = No(i), u = [
1306
+ // @ts-ignore
1307
+ () => ys(i),
1308
+ // @ts-ignore
1309
+ () => ls(i),
1341
1310
  Xo,
1342
- pn,
1311
+ Qo,
1312
+ qo,
1313
+ Zo,
1314
+ Jo,
1315
+ fs,
1343
1316
  yn,
1344
- tr,
1345
- ur,
1346
- vn,
1347
- mr,
1348
- r ? ge : No,
1349
- () => Ys(s),
1350
- () => Ge("background", e),
1351
- () => Ge("padding", t),
1352
- r ? ge : si,
1353
- qs,
1354
- i.applySelectors,
1355
- () => oi(n),
1356
- kr,
1357
- () => Er(s),
1358
- Mr,
1359
- () => os(),
1360
- () => I(
1361
- Se,
1317
+ hs,
1318
+ s ? fe : ko,
1319
+ () => Zr(i),
1320
+ () => We("background", e),
1321
+ () => We("padding", t),
1322
+ s ? fe : si,
1323
+ Gr,
1324
+ r.applySelectors,
1325
+ () => ni(n),
1326
+ Cs,
1327
+ () => Es(i),
1328
+ Ms,
1329
+ () => nr(),
1330
+ () => M(
1331
+ be,
1362
1332
  "Init message from host page",
1363
1333
  void 0,
1364
1334
  void 0,
1365
- `${D}:${s.mode}`
1335
+ `${_}:${i.mode}`
1366
1336
  ),
1367
- Gs,
1368
- B
1337
+ Vr,
1338
+ D
1369
1339
  ];
1370
- hi(u), pi(o);
1340
+ ui(u), mi(o);
1371
1341
  }
1372
- function bi(e) {
1373
- i.firstRun && (xt(mi(e)), gi(s), xt(ui()), i.applySelectors = Vs(s), yi(s));
1342
+ function gi(e) {
1343
+ r.firstRun && (Ct(di(e)), fi(i), Ct(ai()), r.applySelectors = Ur(i), hi(i));
1374
1344
  }
1375
- function vi(e) {
1345
+ function pi(e) {
1376
1346
  if (document.readyState === "loading") {
1377
1347
  a("Page not ready, ignoring init message");
1378
1348
  return;
1379
1349
  }
1380
- const t = e.data.slice(Jt).split(Ee);
1381
- i.target = e.source, i.origin = e.origin, bi(t), i.firstRun = !1, setTimeout(() => {
1382
- i.initLock = !1;
1383
- }, Xt);
1350
+ const t = e.data.slice(Qt).split(ve);
1351
+ r.target = e.source, r.origin = e.origin, gi(t), r.firstRun = !1, setTimeout(() => {
1352
+ r.initLock = !1;
1353
+ }, Yt);
1384
1354
  }
1385
- const { freeze: wi } = Object, { parse: dt } = JSON, ut = (e) => wi(dt(e)), kn = (e) => y(0, 0, `${e}Stop`), Te = (e) => e.data.slice(e.data.indexOf(Ee) + 1), zi = (e) => So(e) ? Se : e.data.split("]")[1].split(Ee)[0];
1386
- function Ei(e) {
1387
- const t = Te(e);
1388
- a("onMessage called from parent:%c", c, ut(t)), Re(s.onMessage, dt(t));
1355
+ const { freeze: yi } = Object, { parse: at } = JSON, lt = (e) => yi(at(e)), An = (e) => y(0, 0, `${e}Stop`), Re = (e) => e.data.slice(e.data.indexOf(ve) + 1), vi = (e) => wo(e) ? be : e.data.split("]")[1].split(ve)[0];
1356
+ function bi(e) {
1357
+ const t = Re(e);
1358
+ a("onMessage called from parent:%c", c, lt(t)), Ee(i.onMessage, at(t));
1389
1359
  }
1390
- function Si(e) {
1391
- const { onPageInfo: t } = i, n = Te(e);
1392
- a("PageInfo received from parent:", ut(n)), t ? Re(t, dt(n)) : kn(Ht);
1360
+ function zi(e) {
1361
+ const { onPageInfo: t } = r, n = Re(e);
1362
+ a("PageInfo received from parent:", lt(n)), t ? Ee(t, at(n)) : An(_t);
1393
1363
  }
1394
- function Oi(e) {
1395
- const { onParentInfo: t } = i, n = ut(Te(e));
1396
- a("ParentInfo received from parent:", n), t ? Re(t, n) : kn(Ft);
1364
+ function wi(e) {
1365
+ const { onParentInfo: t } = r, n = lt(Re(e));
1366
+ a("ParentInfo received from parent:", n), t ? Ee(t, n) : An(xt);
1397
1367
  }
1398
- function Mi() {
1399
- if (i.initLock) {
1368
+ function Si() {
1369
+ if (r.initLock) {
1400
1370
  a("Page reset ignored by init");
1401
1371
  return;
1402
1372
  }
1403
- a("Page size reset by host page"), En("resetPage");
1373
+ a("Page size reset by host page"), zn("resetPage");
1404
1374
  }
1405
- function Ri() {
1406
- a("Resize requested by host page"), I(Ye, "Parent window requested size check");
1375
+ function Ei() {
1376
+ a("Resize requested by host page"), M(qe, "Parent window requested size check");
1407
1377
  }
1408
- const _t = (e) => i.inPageLinks.findTarget(Te(e)), Dt = {
1409
- init: vi,
1410
- reset: Mi,
1411
- resize: Ri,
1412
- moveToAnchor: _t,
1413
- inPageLink: _t,
1378
+ const Pt = (e) => r.inPageLinks.findTarget(Re(e)), Lt = {
1379
+ init: pi,
1380
+ reset: Si,
1381
+ resize: Ei,
1382
+ moveToAnchor: Pt,
1383
+ inPageLink: Pt,
1414
1384
  // Backward compatibility
1415
- pageInfo: Si,
1416
- parentInfo: Oi,
1417
- message: Ei
1385
+ pageInfo: zi,
1386
+ parentInfo: wi,
1387
+ message: bi
1418
1388
  };
1419
- function $i(e) {
1420
- const { firstRun: t } = i, n = zi(e);
1421
- switch (m(n), !0) {
1422
- case n in Dt:
1423
- Dt[n](e);
1389
+ function Oi(e) {
1390
+ const { firstRun: t } = r, n = vi(e);
1391
+ switch (h(n), !0) {
1392
+ case n in Lt:
1393
+ Lt[n](e);
1424
1394
  break;
1425
- case (t && Eo()):
1426
- T(
1395
+ case (t && zo()):
1396
+ x(
1427
1397
  `Ignored message of type "${n}". Received before initialization.`
1428
1398
  );
1429
1399
  break;
1430
1400
  default:
1431
- T(
1401
+ x(
1432
1402
  `Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`
1433
1403
  );
1434
1404
  }
1435
1405
  }
1436
- const ue = et((e) => {
1437
- zo(e) && $i(e);
1406
+ const ae = Je((e) => {
1407
+ bo(e) && Oi(e);
1438
1408
  });
1439
- function Ti() {
1409
+ function $i() {
1440
1410
  if ("iframeChildListener" in window) {
1441
- T("Already setup");
1411
+ x("Already setup");
1442
1412
  return;
1443
1413
  }
1444
- window.iframeChildListener = (t) => setTimeout(() => ue({ data: t, sameOrigin: !0 })), m("listen"), j(window, je, ue), j(document, Vt, vt), vt();
1414
+ window.iframeChildListener = (t) => setTimeout(() => ae({ data: t, sameOrigin: !0 })), h("listen"), P(window, je, ae), P(document, Ht, pt), pt();
1445
1415
  function e(t) {
1446
- return ue(t), i.win;
1416
+ return ae(t), r.win;
1447
1417
  }
1448
1418
  try {
1449
- top?.document?.getElementById("banner") && (i.win = {}, window.mockMsgListener = e, ln(window, je, ue), typeof window.define == "function" && window.define([], () => e));
1419
+ top?.document?.getElementById("banner") && (r.win = {}, window.mockMsgListener = e, rn(window, je, ae), typeof window.define == "function" && window.define([], () => e));
1450
1420
  } catch {
1451
1421
  }
1452
1422
  }
1453
- typeof window !== Kn && Ti();
1423
+ typeof window !== Qn && $i();
1454
1424
  //# sourceMappingURL=index.esm.js.map