@iframe-resizer/core 6.0.0-beta.4 → 6.0.0-beta.5

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,12 +1,7 @@
1
- import { PARENT as H, LABEL as ce, BOLD as Ge, AUTO as F, VERTICAL as x, COLLAPSE as S, LOG_COLLAPSED as ae, LOG_EXPANDED as fe, EXPAND as v, LOG_DISABLED as le, MESSAGE_ID as W, INIT_EVENTS as Z, SEPARATOR as R, RESIZE as ue, MESSAGE_ID_LENGTH as G, VERSION as C, FUNCTION as Ue, MESSAGE_HEADER_LENGTH as Ve, HEIGHT as je, WIDTH as qe, INIT as P, RESET as U, LOAD as V, SCROLL as X, PAGE_INFO as ge, PARENT_INFO as de, TITLE as Ye, SCROLL_TO_OFFSET as Ze, SCROLL_TO as Xe, SCROLL_BY as Je, PARENT_INFO_STOP as Ke, PAGE_INFO_STOP as Qe, MOUSE_LEAVE as et, MOUSE_ENTER as tt, MESSAGE as z, IN_PAGE_LINK as nt, CLOSE as ot, BEFORE_UNLOAD as it, AUTO_RESIZE as he, CHILD_READY_MESSAGE as rt, STRING as me, NEW_LINE as D, CHILD as st, NUMBER as ct, OBJECT as at, INIT_FROM_IFRAME as ft, LAZY as lt, RESET_REQUIRED_METHODS as ut, MIN_SIZE as J, ONLOAD as gt, HORIZONTAL as pe, BOTH as be, NONE as we, REMOVED_NEXT_VERSION as dt, OFFSET_SIZE as ht, OFFSET as mt, HIDDEN as pt, OMIT as bt, LOG_OPTIONS as wt } from "@iframe-resizer/common/consts";
2
- import { LOG_COLLAPSED as $o, LOG_DISABLED as Mo, LOG_EXPANDED as Lo } from "@iframe-resizer/common/consts";
3
- import { esModuleInterop as Et, id as Ot, isString as Ee, isIframe as Tt, isolateUserCode as It, once as yt, typeAssert as $t, hasOwn as k, isObject as Mt } from "@iframe-resizer/common/utils";
4
- import Lt from "@iframe-resizer/common/deprecate";
5
- import Oe from "@iframe-resizer/common/format-advise";
6
- import St, { NORMAL as vt, HIGHLIGHT as a, FOREGROUND as E } from "auto-console-group";
7
- import { addEventListener as A, removeEventListener as K } from "@iframe-resizer/common/listeners";
8
- import Rt, { getModeData as I, getModeLabel as kt } from "@iframe-resizer/common/mode";
9
- const o = {}, Te = Et(St);
1
+ import { esModuleInterop as Ge, PARENT as H, createFormatAdvise as ce, id as Ue, deprecate as Ve, LABEL as ae, BOLD as je, AUTO as F, VERTICAL as x, isString as le, COLLAPSE as S, LOG_COLLAPSED as fe, LOG_EXPANDED as ue, EXPAND as v, LOG_DISABLED as ge, MESSAGE_ID as W, INIT_EVENTS as Z, SEPARATOR as R, RESIZE as de, MESSAGE_ID_LENGTH as G, isIframe as qe, VERSION as C, FUNCTION as Ye, isolateUserCode as Ze, MESSAGE_HEADER_LENGTH as Xe, HEIGHT as Je, WIDTH as Ke, INIT as P, RESET as U, addEventListener as k, LOAD as V, removeEventListener as X, SCROLL as J, PAGE_INFO as he, PARENT_INFO as me, getModeData as I, getModeLabel as Qe, TITLE as et, SCROLL_TO_OFFSET as tt, SCROLL_TO as nt, SCROLL_BY as ot, PARENT_INFO_STOP as it, PAGE_INFO_STOP as rt, MOUSE_LEAVE as st, MOUSE_ENTER as ct, MESSAGE as z, IN_PAGE_LINK as at, CLOSE as lt, BEFORE_UNLOAD as ft, AUTO_RESIZE as pe, once as ut, CHILD_READY_MESSAGE as gt, STRING as be, NEW_LINE as D, typeAssert as dt, CHILD as ht, NUMBER as mt, OBJECT as pt, INIT_FROM_IFRAME as bt, LAZY as wt, RESET_REQUIRED_METHODS as Et, MIN_SIZE as K, ONLOAD as Ot, HORIZONTAL as we, BOTH as Ee, NONE as Oe, hasOwn as A, REMOVED_NEXT_VERSION as Tt, OFFSET_SIZE as It, OFFSET as yt, setMode as $t, HIDDEN as Mt, OMIT as Lt, LOG_OPTIONS as St, isObject as vt } from "@iframe-resizer/common";
2
+ import { LOG_COLLAPSED as Eo, LOG_DISABLED as Oo, LOG_EXPANDED as To } from "@iframe-resizer/common";
3
+ import Rt, { NORMAL as kt, HIGHLIGHT as a, FOREGROUND as E } from "auto-console-group";
4
+ const o = {}, Te = Ge(Rt);
10
5
  let q = !0;
11
6
  const At = Te({
12
7
  expand: !1,
@@ -25,22 +20,22 @@ function Ct({
25
20
  console: i
26
21
  });
27
22
  }
28
- const $ = (e) => (t, ...n) => o[t] ? o[t].console[e](...n) : At[e](...n), Ie = (e) => (t, ...n) => Nt(t) === !0 ? $(e)(t, ...n) : null, l = Ie("log"), b = l, zt = Ie("debug"), O = $("warn"), _t = $("error"), w = $("event"), xt = $("purge"), Dt = $("endAutoGroup"), ye = $("errorBoundary");
23
+ const $ = (e) => (t, ...n) => o[t] ? o[t].console[e](...n) : At[e](...n), Ie = (e) => (t, ...n) => Nt(t) === !0 ? $(e)(t, ...n) : null, f = Ie("log"), b = f, zt = Ie("debug"), O = $("warn"), _t = $("error"), w = $("event"), xt = $("purge"), Dt = $("endAutoGroup"), ye = $("errorBoundary");
29
24
  function Bt(e, t) {
30
25
  queueMicrotask(
31
26
  () => (
32
27
  // eslint-disable-next-line no-console
33
28
  console.info(
34
29
  `%ciframe-resizer ${e}`,
35
- q || t < 1 ? Ge : vt
30
+ q || t < 1 ? je : kt
36
31
  )
37
32
  )
38
33
  );
39
34
  }
40
- const Ht = (e) => (...t) => [`${ce}(${e})`, ...t].join(" "), Ft = Oe(Ot), p = (e, ...t) => o[e] ? o[e].console.warn(...t.map(Ft)) : queueMicrotask(() => {
41
- const n = Oe(Ht(e));
35
+ const Ht = (e) => (...t) => [`${ae}(${e})`, ...t].join(" "), Ft = ce(Ue), p = (e, ...t) => o[e] ? o[e].console.warn(...t.map(Ft)) : queueMicrotask(() => {
36
+ const n = ce(Ht(e));
42
37
  console?.warn(...t.map(n));
43
- }), Y = Lt(p);
38
+ }), Y = Ve(p);
44
39
  Y("Function");
45
40
  Y("Method");
46
41
  Y("Option");
@@ -92,25 +87,25 @@ function Wt(e) {
92
87
  }
93
88
  function Gt(e, t) {
94
89
  let { id: n } = e;
95
- if (n && !Ee(n))
90
+ if (n && !le(n))
96
91
  throw new TypeError("Invalid id for iframe. Expected String");
97
- return (!n || n === "") && (n = Wt(t), e.id = n, w(n, "assignId"), l(n, `Added missing iframe ID: ${n} (${e.src})`)), n;
92
+ return (!n || n === "") && (n = Wt(t), e.id = n, w(n, "assignId"), f(n, `Added missing iframe ID: ${n} (${e.src})`)), n;
98
93
  }
99
94
  function Ut(e) {
100
95
  const { search: t } = window.location;
101
96
  if (t.includes("ifrlog"))
102
97
  switch (new URLSearchParams(t).get("ifrlog")) {
103
- case String(le): {
98
+ case String(ge): {
104
99
  e.log = !1;
105
100
  break;
106
101
  }
107
102
  case v:
108
- case String(fe): {
103
+ case String(ue): {
109
104
  e.log = v;
110
105
  break;
111
106
  }
112
107
  case S:
113
- case String(ae): {
108
+ case String(fe): {
114
109
  e.log = S;
115
110
  break;
116
111
  }
@@ -124,19 +119,19 @@ function jt(e, t, n) {
124
119
  const g = e in Z ? Vt(t) : t;
125
120
  b(n, u, a, E, a), b(n, `Message data: %c${g}`, a);
126
121
  }
127
- const { iframe: r, postMessageTarget: f, sameOrigin: s, targetOrigin: c } = o[n];
122
+ const { iframe: r, postMessageTarget: l, sameOrigin: s, targetOrigin: c } = o[n];
128
123
  if (s)
129
124
  try {
130
125
  r.contentWindow.iframeChildListener(W + t), i(`Sending message to iframe %c${n}%c via same origin%c`);
131
126
  return;
132
127
  } catch {
133
- e in Z ? (o[n].sameOrigin = !1, l(n, "New iframe does not support same origin")) : O(n, "Same origin messaging failed, falling back to postMessage");
128
+ e in Z ? (o[n].sameOrigin = !1, f(n, "New iframe does not support same origin")) : O(n, "Same origin messaging failed, falling back to postMessage");
134
129
  }
135
130
  i(
136
131
  `Sending message to iframe: %c${n}%c targetOrigin: %c${c.join(", ")}`
137
132
  );
138
133
  for (const u of c)
139
- f.postMessage(W + t, u);
134
+ l.postMessage(W + t, u);
140
135
  }
141
136
  function L(e, t, n) {
142
137
  if (w(n, e), !o[n]?.postMessageTarget) {
@@ -147,7 +142,7 @@ function L(e, t, n) {
147
142
  }
148
143
  const qt = (e, t) => Object.values(o).filter(({ autoResize: n, firstRun: i }) => n && !i).forEach(({ iframe: n }) => L(e, t, n.id));
149
144
  function Yt() {
150
- document.hidden !== !0 && qt("tabVisible", ue);
145
+ document.hidden !== !0 && qt("tabVisible", de);
151
146
  }
152
147
  function Zt(e) {
153
148
  if (e.boxSizing !== "border-box") return 0;
@@ -160,10 +155,10 @@ function Xt(e) {
160
155
  return t + n;
161
156
  }
162
157
  function Jt(e) {
163
- const t = e.slice(G).split(":"), n = t[1] ? Number(t[1]) : 0, i = o[t[0]]?.iframe, r = i ? getComputedStyle(i) : null, f = r ? Zt(r) + Xt(r) : 0, s = {
158
+ const t = e.slice(G).split(":"), n = t[1] ? Number(t[1]) : 0, i = o[t[0]]?.iframe, r = i ? getComputedStyle(i) : null, l = r ? Zt(r) + Xt(r) : 0, s = {
164
159
  iframe: i,
165
160
  id: t[0],
166
- height: n + f,
161
+ height: n + l,
167
162
  width: Number(t[2]),
168
163
  type: t[3],
169
164
  msg: t[4],
@@ -173,8 +168,8 @@ function Jt(e) {
173
168
  }
174
169
  const Kt = { true: 1, false: 1, undefined: 1 };
175
170
  function Qt(e) {
176
- const { id: t, msg: n, iframe: i } = e, r = Tt(i);
177
- return r || (l(t, `Received: %c${n}`, a), O(t, "The target iframe was not found.")), r;
171
+ const { id: t, msg: n, iframe: i } = e, r = qe(i);
172
+ return r || (f(t, `Received: %c${n}`, a), O(t, "The target iframe was not found.")), r;
178
173
  }
179
174
  function en(e, t) {
180
175
  const { id: n } = e, { data: i, origin: r } = t;
@@ -182,7 +177,7 @@ function en(e, t) {
182
177
  const s = o[n]?.checkOrigin;
183
178
  function c() {
184
179
  function u() {
185
- l(
180
+ f(
186
181
  n,
187
182
  `Checking connection is from allowed list of origins: %c${s}`,
188
183
  a
@@ -194,7 +189,7 @@ function en(e, t) {
194
189
  }
195
190
  function g() {
196
191
  const d = o[n]?.remoteHost;
197
- return l(n, `Checking connection is from: %c${d}`, a), r === d;
192
+ return f(n, `Checking connection is from: %c${d}`, a), r === d;
198
193
  }
199
194
  return s.constructor === Array ? u() : g();
200
195
  }
@@ -207,7 +202,7 @@ function en(e, t) {
207
202
  const tn = (e) => W === `${e}`.slice(0, G) && e.slice(G).split(":")[0] in o;
208
203
  function nn(e) {
209
204
  const { id: t, type: n } = e, i = n in Kt;
210
- return i && l(t, "Ignoring init message from meta parent page"), i;
205
+ return i && f(t, "Ignoring init message from meta parent page"), i;
211
206
  }
212
207
  function on(e) {
213
208
  try {
@@ -215,7 +210,7 @@ function on(e) {
215
210
  } catch {
216
211
  o[e].sameOrigin = !1;
217
212
  }
218
- l(e, `sameOrigin: %c${o[e].sameOrigin}`, a);
213
+ f(e, `sameOrigin: %c${o[e].sameOrigin}`, a);
219
214
  }
220
215
  function rn(e, t) {
221
216
  if (t !== C) {
@@ -231,7 +226,7 @@ See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
231
226
  );
232
227
  return;
233
228
  }
234
- l(
229
+ f(
235
230
  e,
236
231
  `Version mismatch (Child: %c${t}%c !== Parent: %c${C})`,
237
232
  a,
@@ -243,10 +238,10 @@ See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
243
238
  function y(e, t, n) {
244
239
  if (!o[e]) return null;
245
240
  const i = o[e][t];
246
- if (typeof i !== Ue)
241
+ if (typeof i !== Ye)
247
242
  throw new TypeError(`${t} on iframe[${e}] is not a function`);
248
243
  if (t !== "onBeforeClose" && t !== "onScroll")
249
- return It(i, n);
244
+ return Ze(i, n);
250
245
  try {
251
246
  return i(n);
252
247
  } catch (r) {
@@ -255,7 +250,7 @@ function y(e, t, n) {
255
250
  }
256
251
  function sn(e, t) {
257
252
  const { id: n, iframe: i } = e;
258
- l(
253
+ f(
259
254
  n,
260
255
  `onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,
261
256
  a,
@@ -270,11 +265,11 @@ function sn(e, t) {
270
265
  function N(e, t) {
271
266
  const { lastMessage: n } = o[e];
272
267
  return n.slice(
273
- n.indexOf(R) + Ve + t
268
+ n.indexOf(R) + Xe + t
274
269
  );
275
270
  }
276
271
  function ee(e, t) {
277
- const { id: n, iframe: i, height: r, type: f, width: s } = t;
272
+ const { id: n, iframe: i, height: r, type: l, width: s } = t;
278
273
  let c = { x: 0, y: 0 };
279
274
  if (s === 0 && r === 0) {
280
275
  const u = N(n, 9).split(R);
@@ -291,7 +286,7 @@ function ee(e, t) {
291
286
  iframe: i,
292
287
  screenX: Number(c.x),
293
288
  screenY: Number(c.y),
294
- type: f
289
+ type: l
295
290
  });
296
291
  }
297
292
  const h = {
@@ -309,7 +304,7 @@ function Me(e) {
309
304
  return h.position === null && (h.position = {
310
305
  x: window.scrollX,
311
306
  y: window.scrollY
312
- }), l(
307
+ }), f(
313
308
  e,
314
309
  `Get page position: %c${h.position.x}%c, %c${h.position.y}`,
315
310
  a,
@@ -332,7 +327,7 @@ function te(e, t) {
332
327
  }
333
328
  function Se(e) {
334
329
  const { id: t } = e, { sizeHeight: n, sizeWidth: i } = o[t];
335
- n && te(je, e), i && te(qe, e);
330
+ n && te(Je, e), i && te(Ke, e);
336
331
  }
337
332
  function ne(e) {
338
333
  const { id: t } = e;
@@ -340,15 +335,15 @@ function ne(e) {
340
335
  }
341
336
  function ve(e) {
342
337
  const { id: t } = e;
343
- l(t, "Disconnected from iframe"), delete o[t], delete e.iframeResizer;
338
+ f(t, "Disconnected from iframe"), delete o[t], delete e.iframeResizer;
344
339
  }
345
340
  function Re(e) {
346
341
  const { id: t } = e;
347
342
  if (y(t, "onBeforeClose", t) === !1) {
348
- l(t, "Close iframe cancelled by onBeforeClose");
343
+ f(t, "Close iframe cancelled by onBeforeClose");
349
344
  return;
350
345
  }
351
- l(t, `Removing iframe: %c${t}`, a);
346
+ f(t, `Removing iframe: %c${t}`, a);
352
347
  try {
353
348
  e.parentNode && e.remove();
354
349
  } catch (n) {
@@ -358,7 +353,7 @@ function Re(e) {
358
353
  }
359
354
  function ke(e) {
360
355
  const { id: t, type: n } = e;
361
- l(
356
+ f(
362
357
  t,
363
358
  `Size reset requested by ${n === P ? "parent page" : "child page"}`
364
359
  ), Me(t), Se(e), L(U, U, t);
@@ -366,14 +361,14 @@ function ke(e) {
366
361
  const Ae = (e, t) => {
367
362
  const n = {};
368
363
  return (i, r) => {
369
- const { iframe: f } = o[r];
364
+ const { iframe: l } = o[r];
370
365
  function s(u, g) {
371
366
  n[g] || (u(), n[g] = requestAnimationFrame(() => {
372
367
  n[g] = null;
373
368
  }));
374
369
  }
375
370
  function c() {
376
- L(`${i} (${e})`, `${e}:${t(f)}`, r);
371
+ L(`${i} (${e})`, `${e}:${t(l)}`, r);
377
372
  }
378
373
  s(c, r);
379
374
  };
@@ -387,25 +382,25 @@ const Ae = (e, t) => {
387
382
  o[n] ? (!i || i === m) && (e(m, n), i = m, requestAnimationFrame(() => {
388
383
  i = !1;
389
384
  })) : d();
390
- }, f = r(X), s = r("resize window"), c = new ResizeObserver(r("pageObserver")), u = new ResizeObserver(r("iframeObserver"));
385
+ }, l = r(J), s = r("resize window"), c = new ResizeObserver(r("pageObserver")), u = new ResizeObserver(r("iframeObserver"));
391
386
  function g(m, T) {
392
- l(n, `${m}listeners for send${t}`), T(window, X, f), T(window, ue, s);
387
+ f(n, `${m}listeners for send${t}`), T(window, J, l), T(window, de, s);
393
388
  }
394
389
  function d() {
395
- w(n, `stop${t}`), g("Remove ", K), c.disconnect(), u.disconnect(), o[n] && K(o[n].iframe, V, d);
390
+ w(n, `stop${t}`), g("Remove ", X), c.disconnect(), u.disconnect(), o[n] && X(o[n].iframe, V, d);
396
391
  }
397
392
  function M() {
398
- g("Add ", A), c.observe(document.body), u.observe(o[n].iframe);
393
+ g("Add ", k), c.observe(document.body), u.observe(o[n].iframe);
399
394
  }
400
- o[n] && (o[n][`stop${t}`] = d, A(o[n].iframe, V, d), M());
395
+ o[n] && (o[n][`stop${t}`] = d, k(o[n].iframe, V, d), M());
401
396
  })
402
397
  );
403
- function fn(e) {
404
- const t = document.body.getBoundingClientRect(), n = e.getBoundingClientRect(), { scrollY: i, scrollX: r, innerHeight: f, innerWidth: s } = window, { clientHeight: c, clientWidth: u } = document.documentElement;
398
+ function ln(e) {
399
+ const t = document.body.getBoundingClientRect(), n = e.getBoundingClientRect(), { scrollY: i, scrollX: r, innerHeight: l, innerWidth: s } = window, { clientHeight: c, clientWidth: u } = document.documentElement;
405
400
  return JSON.stringify({
406
401
  iframeHeight: n.height,
407
402
  iframeWidth: n.width,
408
- clientHeight: Math.max(c, f || 0),
403
+ clientHeight: Math.max(c, l || 0),
409
404
  clientWidth: Math.max(u, s || 0),
410
405
  offsetTop: Math.trunc(n.top - t.top),
411
406
  offsetLeft: Math.trunc(n.left - t.left),
@@ -413,18 +408,18 @@ function fn(e) {
413
408
  scrollLeft: r,
414
409
  documentHeight: c,
415
410
  documentWidth: u,
416
- windowHeight: f,
411
+ windowHeight: l,
417
412
  windowWidth: s
418
413
  });
419
414
  }
420
- const ln = Ae(ge, fn), un = Ne(
421
- ln,
415
+ const fn = Ae(he, ln), un = Ne(
416
+ fn,
422
417
  "PageInfo"
423
418
  ), gn = Pe("stopPageInfo");
424
419
  function dn(e) {
425
420
  const { scrollWidth: t, scrollHeight: n } = document.documentElement, i = typeof window < "u" && window.visualViewport ? window.visualViewport : {}, {
426
421
  width: r = 0,
427
- height: f = 0,
422
+ height: l = 0,
428
423
  offsetLeft: s = 0,
429
424
  offsetTop: c = 0,
430
425
  pageLeft: u = 0,
@@ -439,7 +434,7 @@ function dn(e) {
439
434
  },
440
435
  viewport: {
441
436
  width: r,
442
- height: f,
437
+ height: l,
443
438
  offsetLeft: s,
444
439
  offsetTop: c,
445
440
  pageLeft: u,
@@ -448,7 +443,7 @@ function dn(e) {
448
443
  }
449
444
  });
450
445
  }
451
- const hn = Ae(de, dn), mn = Ne(
446
+ const hn = Ae(me, dn), mn = Ne(
452
447
  hn,
453
448
  "ParentInfo"
454
449
  ), pn = Pe("stopParentInfo");
@@ -478,7 +473,7 @@ function bn(e) {
478
473
  ), r.scrollBy(i, n);
479
474
  }
480
475
  const _e = (e) => (t) => {
481
- const { id: n, iframe: i, height: r, width: f } = t;
476
+ const { id: n, iframe: i, height: r, width: l } = t;
482
477
  function s(m) {
483
478
  an(m), ze(n);
484
479
  }
@@ -489,7 +484,7 @@ const _e = (e) => (t) => {
489
484
  );
490
485
  }
491
486
  const u = (m) => ({
492
- x: f + m.x,
487
+ x: l + m.x,
493
488
  y: r + m.y
494
489
  }), g = e ? Ce(i) : { x: 0, y: 0 }, d = u(g), M = window.parentIframe || window.parentIFrame;
495
490
  b(
@@ -507,7 +502,7 @@ function On(e, t, n) {
507
502
  function Tn(e, t) {
508
503
  const n = window.parentIframe || window.parentIFrame;
509
504
  if (!n) {
510
- l(e, `In page link #${t} not found`);
505
+ f(e, `In page link #${t} not found`);
511
506
  return;
512
507
  }
513
508
  n.moveToAnchor(t);
@@ -519,7 +514,7 @@ function In(e, t) {
519
514
  return;
520
515
  }
521
516
  if (window.top === window.self) {
522
- l(e, `In page link #${n} not found`);
517
+ f(e, `In page link #${n} not found`);
523
518
  return;
524
519
  }
525
520
  Tn(e, n);
@@ -537,7 +532,7 @@ function De(e, t = -3) {
537
532
  const n = Math.max(o[e].mode, t);
538
533
  if (n > o[e].mode && (o[e].mode = n), n < 0)
539
534
  throw xt(e), o[e].vAdvised || p(e || "Parent", `${I(n + 2)}${I(2)}`), o[e].vAdvised = !0, I(n + 2).replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
540
- switch (n > 5 && xe || Bt(`v${C} (${kt(n)})`, n), n) {
535
+ switch (n > 5 && xe || Bt(`v${C} (${Qe(n)})`, n), n) {
541
536
  case 1:
542
537
  case 2:
543
538
  case 3:
@@ -563,61 +558,61 @@ function Ln(e) {
563
558
  e?.log === -1 && (e.log = !1, xe = !0);
564
559
  }
565
560
  function Sn(e, t) {
566
- o[e] && (l(e, `First run for ${e}`), De(e, t === void 0 ? void 0 : Number(t)), o[e].firstRun = !1);
561
+ o[e] && (f(e, `First run for ${e}`), De(e, t === void 0 ? void 0 : Number(t)), o[e].firstRun = !1);
567
562
  }
568
563
  function vn(e) {
569
- const { height: t, id: n, iframe: i, mode: r, message: f, type: s, width: c } = e, { lastMessage: u } = o[n];
570
- switch (o[n]?.firstRun && Sn(n, r), l(n, `Received: %c${u}`, a), s) {
571
- case he:
564
+ const { height: t, id: n, iframe: i, mode: r, message: l, type: s, width: c } = e, { lastMessage: u } = o[n];
565
+ switch (o[n]?.firstRun && Sn(n, r), f(n, `Received: %c${u}`, a), s) {
566
+ case pe:
572
567
  o[n].autoResize = JSON.parse(N(n, 9));
573
568
  break;
574
- case it:
569
+ case ft:
575
570
  b(n, "Ready state reset"), o[n].initialised = !1;
576
571
  break;
577
- case ot:
572
+ case lt:
578
573
  Re(i);
579
574
  break;
580
- case nt:
575
+ case at:
581
576
  In(n, N(n, 9));
582
577
  break;
583
578
  case P:
584
- ne(e), on(n), rn(n, f), o[n].initialised = !0, y(n, "onReady", i);
579
+ ne(e), on(n), rn(n, l), o[n].initialised = !0, y(n, "onReady", i);
585
580
  break;
586
581
  case z:
587
582
  sn(e, N(n, 6));
588
583
  break;
589
- case tt:
584
+ case ct:
590
585
  ee("onMouseEnter", e);
591
586
  break;
592
- case et:
587
+ case st:
593
588
  ee("onMouseLeave", e);
594
589
  break;
595
- case ge:
590
+ case he:
596
591
  un(n);
597
592
  break;
598
- case de:
593
+ case me:
599
594
  mn(n);
600
595
  break;
601
- case Qe:
596
+ case rt:
602
597
  gn(n);
603
598
  break;
604
- case Ke:
599
+ case it:
605
600
  pn(n);
606
601
  break;
607
602
  case U:
608
603
  ke(e);
609
604
  break;
610
- case Je:
605
+ case ot:
611
606
  bn(e);
612
607
  break;
613
- case Xe:
608
+ case nt:
614
609
  wn(e);
615
610
  break;
616
- case Ze:
611
+ case tt:
617
612
  En(e);
618
613
  break;
619
- case Ye:
620
- $n(n, f);
614
+ case et:
615
+ $n(n, l);
621
616
  break;
622
617
  default:
623
618
  if (c === 0 && t === 0) {
@@ -628,11 +623,11 @@ function vn(e) {
628
623
  return;
629
624
  }
630
625
  if (c === 0 || t === 0) {
631
- l(n, "Ignoring message with 0 height or width");
626
+ f(n, "Ignoring message with 0 height or width");
632
627
  return;
633
628
  }
634
629
  if (document.hidden) {
635
- l(n, "Page hidden - ignored resize request");
630
+ f(n, "Page hidden - ignored resize request");
636
631
  return;
637
632
  }
638
633
  ne(e);
@@ -646,12 +641,12 @@ const Rn = (e) => ({
646
641
  }, kn = (e) => Object.values(o).forEach(Rn(e));
647
642
  function oe(e) {
648
643
  const t = e.data;
649
- if (t === rt) {
644
+ if (t === gt) {
650
645
  kn(e.source);
651
646
  return;
652
647
  }
653
648
  if (!tn(t)) {
654
- if (typeof t !== me) return;
649
+ if (typeof t !== be) return;
655
650
  w(H, "ignoredMessage"), zt(H, t);
656
651
  return;
657
652
  }
@@ -667,8 +662,8 @@ function oe(e) {
667
662
  o[i].lastMessage = e.data, ye(i, vn)(n);
668
663
  }
669
664
  }
670
- const An = yt(() => {
671
- A(window, z, oe), A(document, "visibilitychange", Yt), window.iframeParentListener = (e) => setTimeout(() => oe({ data: e, sameOrigin: !0 }));
665
+ const An = ut(() => {
666
+ k(window, z, oe), k(document, "visibilitychange", Yt), window.iframeParentListener = (e) => setTimeout(() => oe({ data: e, sameOrigin: !0 }));
672
667
  }), ie = {};
673
668
  function Pn(e) {
674
669
  if (ie[e] === !0) return !1;
@@ -698,7 +693,7 @@ function Nn(e) {
698
693
  close: Re.bind(null, t),
699
694
  disconnect: ve.bind(null, t),
700
695
  moveToAnchor(n) {
701
- $t(n, me, "moveToAnchor(anchor) anchor"), L("Move to anchor", `moveToAnchor:${n}`, e);
696
+ dt(n, be, "moveToAnchor(anchor) anchor"), L("Move to anchor", `moveToAnchor:${n}`, e);
702
697
  },
703
698
  sendMessage(n) {
704
699
  n = JSON.stringify(n), L(z, `${z}:${n}`, e);
@@ -706,14 +701,14 @@ function Nn(e) {
706
701
  };
707
702
  }
708
703
  }
709
- const Cn = "8", zn = "32", _n = st, xn = !0;
704
+ const Cn = "8", zn = "32", _n = ht, xn = !0;
710
705
  function Dn(e) {
711
706
  const {
712
707
  autoResize: t,
713
708
  bodyBackground: n,
714
709
  bodyMargin: i,
715
710
  bodyPadding: r,
716
- heightCalculationMethod: f,
711
+ heightCalculationMethod: l,
717
712
  inPageLinks: s,
718
713
  license: c,
719
714
  log: u,
@@ -737,7 +732,7 @@ function Dn(e) {
737
732
  xn,
738
733
  t,
739
734
  i,
740
- f,
735
+ l,
741
736
  n,
742
737
  r,
743
738
  Fe,
@@ -759,7 +754,7 @@ function Dn(e) {
759
754
  const Bn = "0";
760
755
  function Hn(e) {
761
756
  const { bodyMargin: t } = o[e];
762
- (typeof t === ct || t === Bn) && (o[e].bodyMargin = `${t}px`);
757
+ (typeof t === mt || t === Bn) && (o[e].bodyMargin = `${t}px`);
763
758
  }
764
759
  const Fn = (e) => {
765
760
  try {
@@ -767,12 +762,12 @@ const Fn = (e) => {
767
762
  } catch {
768
763
  return null;
769
764
  }
770
- }, Wn = (e) => typeof e === at && e.length > 0 && !(e.contains("allow-scripts") && e.contains("allow-same-origin"));
765
+ }, Wn = (e) => typeof e === pt && e.length > 0 && !(e.contains("allow-scripts") && e.contains("allow-same-origin"));
771
766
  function Gn(e, t) {
772
767
  const {
773
768
  checkOrigin: n,
774
769
  iframe: { src: i, sandbox: r },
775
- initialisedFirstPage: f,
770
+ initialisedFirstPage: l,
776
771
  waitForLoad: s
777
772
  } = t[e], c = Fn(i);
778
773
  w(e, "noResponse"), p(
@@ -782,7 +777,7 @@ function Gn(e, t) {
782
777
  The iframe (<i>${e}</>) has not responded within ${t[e].warningTimeout / 1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
783
778
  ${n && c ? `
784
779
  The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${c}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.
785
- ` : ""}${s && !f ? `
780
+ ` : ""}${s && !l ? `
786
781
  The <b>waitForLoad</> option is currently set to <bb>true</>. If the iframe loads before <i>iframe-resizer</> runs, this option will prevent <i>iframe-resizer</> initialising. To disable this option, set <b>waitForLoad</> to <bb>false</>.
787
782
  ` : ""}${Wn(r) ? `
788
783
  The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
@@ -794,8 +789,8 @@ This message can be ignored if everything is working, or you can set the <b>warn
794
789
  function Un(e, t) {
795
790
  function n() {
796
791
  if (t[e] === void 0) return;
797
- const { initialised: f, loadErrorShown: s } = t[e];
798
- if (t[e].msgTimeout = void 0, f) {
792
+ const { initialised: l, loadErrorShown: s } = t[e];
793
+ if (t[e].msgTimeout = void 0, l) {
799
794
  t[e].initialisedFirstPage = !0;
800
795
  return;
801
796
  }
@@ -804,18 +799,18 @@ function Un(e, t) {
804
799
  const { msgTimeout: i, warningTimeout: r } = t[e];
805
800
  r && (i && clearTimeout(i), t[e].msgTimeout = setTimeout(n, r));
806
801
  }
807
- const Vn = 1, jn = (e) => e.loading === lt, qn = (e) => e === P;
802
+ const Vn = 1, jn = (e) => e.loading === wt, qn = (e) => e === P;
808
803
  function Yn(e) {
809
- o[e]?.heightCalculationMethod in ut && ke({
804
+ o[e]?.heightCalculationMethod in Et && ke({
810
805
  id: e,
811
806
  iframe: o[e].iframe,
812
- height: J,
813
- width: J,
807
+ height: K,
808
+ width: K,
814
809
  type: P
815
810
  });
816
811
  }
817
812
  function Zn(e, t) {
818
- A(e, V, () => setTimeout(t, Vn));
813
+ k(e, V, () => setTimeout(t, Vn));
819
814
  }
820
815
  const Xn = (e) => {
821
816
  const { src: t, srcdoc: n } = e;
@@ -836,17 +831,17 @@ function Jn(e, t) {
836
831
  function Kn(e, t) {
837
832
  const n = (r) => () => {
838
833
  if (!o[e]) return;
839
- const { firstRun: f, iframe: s } = o[e];
840
- L(r, t, e), qn(r) && jn(s) || Un(e, o), f || Yn(e);
834
+ const { firstRun: l, iframe: s } = o[e];
835
+ L(r, t, e), qn(r) && jn(s) || Un(e, o), l || Yn(e);
841
836
  }, { iframe: i } = o[e];
842
- o[e].initChild = n(ft), Zn(i, n(gt)), Jn(e, n(P));
837
+ o[e].initChild = n(bt), Zn(i, n(Ot)), Jn(e, n(P));
843
838
  }
844
839
  function Qn(e, t) {
845
- return t ? (("sizeWidth" in t || "sizeHeight" in t || he in t) && p(
840
+ return t ? (("sizeWidth" in t || "sizeHeight" in t || pe in t) && p(
846
841
  e,
847
842
  `<rb>Deprecated Option</>
848
843
 
849
- The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${x}</>, <bb>${pe}</>, <bb>${be}</> or <bb>${we}</>.
844
+ The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${x}</>, <bb>${we}</>, <bb>${Ee}</> or <bb>${Oe}</>.
850
845
  `
851
846
  ), t) : {};
852
847
  }
@@ -855,26 +850,26 @@ function eo(e) {
855
850
  }
856
851
  function to(e, { offset: t, offsetSize: n }) {
857
852
  const i = n || t;
858
- i && (o[e].direction === x ? (o[e].offsetHeight = i, l(e, `Offset height: %c${i}`, a)) : (o[e].offsetWidth = i, l(e, `Offset width: %c${i}`, a)));
853
+ i && (o[e].direction === x ? (o[e].offsetHeight = i, f(e, `Offset height: %c${i}`, a)) : (o[e].offsetWidth = i, f(e, `Offset width: %c${i}`, a)));
859
854
  }
860
855
  function no(e) {
861
856
  const { direction: t } = o[e];
862
857
  switch (t) {
863
858
  case x:
864
859
  break;
865
- case pe:
860
+ case we:
866
861
  o[e].sizeHeight = !1;
867
862
  // eslint-disable-next-line no-fallthrough
868
- case be:
863
+ case Ee:
869
864
  o[e].sizeWidth = !0;
870
865
  break;
871
- case we:
866
+ case Oe:
872
867
  o[e].sizeWidth = !1, o[e].sizeHeight = !1, o[e].autoResize = !1;
873
868
  break;
874
869
  default:
875
870
  throw new TypeError(`Direction value of "${t}" is not valid`);
876
871
  }
877
- l(e, `direction: %c${t}`, a);
872
+ f(e, `direction: %c${t}`, a);
878
873
  }
879
874
  const re = (e) => e === "" || e.match(/^(about:blank|javascript:|file:\/\/)/) !== null ? "*" : e;
880
875
  function oo(e) {
@@ -889,17 +884,17 @@ function io(e) {
889
884
  o[t].postMessageTarget === null && (o[t].postMessageTarget = e.contentWindow);
890
885
  }
891
886
  function B(e, t, n) {
892
- k(o[e], t) && (p(
887
+ A(o[e], t) && (p(
893
888
  e,
894
889
  `<rb>Deprecated option</>
895
890
 
896
- The <b>${t}</> option has been renamed to <b>${n}</>. ${dt}`
891
+ The <b>${t}</> option has been renamed to <b>${n}</>. ${Tt}`
897
892
  ), o[e][n] = o[e][t], delete o[e][t]);
898
893
  }
899
894
  function ro(e) {
900
- B(e, mt, ht), B(e, "onClose", "onBeforeClose"), B(e, "onClosed", "onAfterClose");
895
+ B(e, yt, It), B(e, "onClose", "onBeforeClose"), B(e, "onClosed", "onAfterClose");
901
896
  }
902
- const so = (e) => k(e, "onMouseEnter") || k(e, "onMouseLeave");
897
+ const so = (e) => A(e, "onMouseEnter") || A(e, "onMouseLeave");
903
898
  function co(e, t) {
904
899
  const { id: n } = e;
905
900
  o[n] = {
@@ -909,18 +904,18 @@ function co(e, t) {
909
904
  ..._,
910
905
  ...Qn(n, t),
911
906
  mouseEvents: so(t),
912
- mode: Rt(t),
907
+ mode: $t(t),
913
908
  syncTitle: yn(n)
914
909
  }, ro(n), no(n), to(n, t), eo(n), io(e), oo(n);
915
910
  }
916
911
  const ao = "yes", se = "no";
917
- function fo(e) {
912
+ function lo(e) {
918
913
  const { id: t } = e;
919
- switch (l(
914
+ switch (f(
920
915
  t,
921
916
  `Iframe scrolling ${o[t]?.scrolling ? "enabled" : "disabled"} for ${t}`
922
- ), e.style.overflow = o[t]?.scrolling === !1 ? pt : F, o[t]?.scrolling) {
923
- case bt:
917
+ ), e.style.overflow = o[t]?.scrolling === !1 ? Mt : F, o[t]?.scrolling) {
918
+ case Lt:
924
919
  break;
925
920
  case !0:
926
921
  e.scrolling = ao;
@@ -932,36 +927,36 @@ function fo(e) {
932
927
  e.scrolling = o[t]?.scrolling || se;
933
928
  }
934
929
  }
935
- function lo(e, t, n) {
936
- co(t, n), l(e, `src: %c${t.srcdoc || t.src}`, a), Mn(e), fo(t), Hn(e), Kn(e, Dn(e)), Nn(e), l(e, "Setup complete");
930
+ function fo(e, t, n) {
931
+ co(t, n), f(e, `src: %c${t.srcdoc || t.src}`, a), Mn(e), lo(t), Hn(e), Kn(e, Dn(e)), Nn(e), f(e, "Setup complete");
937
932
  }
938
933
  function uo(e, t) {
939
934
  const { id: n } = e;
940
- w(n, "setup"), Pn(n) && lo(n, e, t), Dt(n);
935
+ w(n, "setup"), Pn(n) && fo(n, e, t), Dt(n);
941
936
  }
942
937
  function go(e, t) {
943
- t.log === le ? t.log = !1 : t.log === ae ? t.log = S : t.log === fe && (t.log = v);
944
- const n = k(t, "log"), i = Ee(t.log), r = n ? i ? !0 : t.log : _.log;
945
- k(t, "logExpand") || (t.logExpand = n && i ? t.log === v : _.logExpand), Ln(t), Ct({
938
+ t.log === ge ? t.log = !1 : t.log === fe ? t.log = S : t.log === ue && (t.log = v);
939
+ const n = A(t, "log"), i = le(t.log), r = n ? i ? !0 : t.log : _.log;
940
+ A(t, "logExpand") || (t.logExpand = n && i ? t.log === v : _.logExpand), Ln(t), Ct({
946
941
  enabled: r,
947
942
  expand: t.logExpand,
948
943
  iframeId: e
949
- }), i && !(t.log in wt) && _t(
944
+ }), i && !(t.log in St) && _t(
950
945
  e,
951
946
  `Invalid value for options.log: Accepted values are "${v}" and "${S}"`
952
947
  ), t.log = r;
953
948
  }
954
- function To(e) {
955
- if (!Mt(e)) throw new TypeError("Options is not an object");
949
+ function po(e) {
950
+ if (!vt(e)) throw new TypeError("Options is not an object");
956
951
  return An(), Ut(e), (t) => {
957
952
  const n = Gt(t, e);
958
- return ce in t ? (w(n, "alreadySetup"), O(n, `Ignored iframe (${n}), already setup.`)) : (go(n, e), ye(n, uo)(t, e)), t?.iframeResizer;
953
+ return ae in t ? (w(n, "alreadySetup"), O(n, `Ignored iframe (${n}), already setup.`)) : (go(n, e), ye(n, uo)(t, e)), t?.iframeResizer;
959
954
  };
960
955
  }
961
956
  export {
962
- $o as LOG_COLLAPSED,
963
- Mo as LOG_DISABLED,
964
- Lo as LOG_EXPANDED,
965
- To as default
957
+ Eo as LOG_COLLAPSED,
958
+ Oo as LOG_DISABLED,
959
+ To as LOG_EXPANDED,
960
+ po as default
966
961
  };
967
962
  //# sourceMappingURL=index.esm.js.map