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

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  This package is part of the __[iframe-resizer](https://iframe-resizer.com)__ library, which automatically resizes the height and width of both same-origin and cross-origin iframes to match their content. It also includes a range of features designed to address common issues associated with using iframes.
8
8
 
9
9
 
10
- __For more information, visit [iframe-resizer.com](https://iframe-resizer.com).__
10
+ __For more information, please visit [iframe-resizer.com](https://iframe-resizer.com).__
11
11
 
12
12
  ## Install
13
13
 
@@ -25,4 +25,4 @@ yarn add @iframe-resizer/child
25
25
 
26
26
  ---
27
27
 
28
- _iframe-resizer version 6.0.0-beta.0 2026-02-23 - 11:30:19.850Z_
28
+ _iframe-resizer version 6.0.0-beta.2 2026-04-08 - 17:04:12.360Z_
@@ -28,7 +28,11 @@ declare module '@iframe-resizer/child' {
28
28
  /**
29
29
  * Called before new size is set. Return a number to modify the new size.
30
30
  */
31
- onBeforeResize?(newSize: number): number
31
+ onBeforeResize?(
32
+ newSize: number,
33
+ event: string,
34
+ direction: 'height' | 'width',
35
+ ): number
32
36
 
33
37
  /**
34
38
  * Receive message posted from the parent page with the iframe.iframeResizer.sendMessage() method.
package/index.cjs.js CHANGED
@@ -1,52 +1,43 @@
1
- "use strict";const s=require("auto-console-group"),D="6.0.0-beta.0",Ue="iframeResizer",we=":",An="[iFrameResizerChild]Ready",Nn="autoResize",Cn="beforeUnload",Gn="close",kn="inPageLink",ze="init",Ce="message",Pn="mouseenter",Dn="mouseleave",Pt="pageHide",Dt="pageInfo",jt="parentInfo",jn="pageInfoStop",xn="parentInfoStop",_n="scrollBy",Bn="scrollTo",xt="scrollToOffset",Fn="title",B=10,J=1,Oe="data-iframe-size",_t="data-iframe-overflowed",X="data-iframe-ignore",ee="height",Bt="width",Re="offset",He="offsetSize",Un="scroll",We=`
2
- `,te="string",C="number",Wn="boolean",Vn="object",ne="function",qn="undefined",Zn="false",Yn="null",Ee="auto",Ft="readystatechange",Ge="bottom",ke="right",Pe="autoResizeEnabled",dt=Symbol("sizeChanged"),Ve="manualResize",qe="parentResize",ut={[Ve]:1,[qe]:1},Ut="setOffsetSize",Wt="resizeObserver",Ze="overflowObserver",Vt="mutationObserver",qt="visibilityObserver",Qn="font-weight: bold;",Ye="none",ft="No change in content size detected",fe="[iFrameSizer]",Zt=fe.length,Qe=Ee,Yt=Un,Qt=128,Jt=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),Jn=e=>(t,n="renamed to")=>(o,r,u="",l="")=>e(l,`<rb>Deprecated ${t}(${o.replace("()","")})</>
1
+ "use strict";const s=require("auto-console-group"),j="6.0.0-beta.2",Fe="iframeResizer",ge=":",$n="[iFrameResizerChild]Ready",An="autoResize",Ln="beforeUnload",kn="close",Nn="inPageLink",pe="init",ke="message",Gn="mouseenter",Pn="mouseleave",kt="pageHide",Nt="pageInfo",Gt="parentInfo",Cn="pageInfoStop",jn="parentInfoStop",Dn="scrollBy",_n="scrollTo",Pt="scrollToOffset",Fn="title",Y=1,ye="data-iframe-size",Ct="data-iframe-overflowed",J="data-iframe-ignore",ve="height",jt="width",Se="offset",Te="offsetSize",xe=`
2
+ `,K="string",N="number",xn="boolean",Bn="object",be="function",Un="undefined",Vn="false",Wn="null",L="auto",Dt="readystatechange",_t="bottom",Ft="right",Ne="autoResizeEnabled",ct=Symbol("sizeChanged"),Be="manualResize",Ue="parentResize",Re={[Be]:1,[Ue]:1},xt="setOffsetSize",Bt="resizeObserver",Ve="overflowObserver",Ut="mutationObserver",Vt="visibilityObserver",qn="font-weight: bold;",We="none",at="No change in content size detected",ae="[iFrameSizer]",Wt=ae.length,Zn=L,qt=128,Zt=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),Yn=e=>(t,n="renamed to")=>(o,r,d="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>
3
3
 
4
- 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</>.`),Kn=e=>typeof e===te,Ie=(e,...t)=>setTimeout(()=>e(...t),0),Kt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},me=e=>e,mt=1e3,P=e=>Math.round(e*mt)/mt,Xt=e=>e.charAt(0).toUpperCase()+e.slice(1),F=e=>`${e}`!=""&&e!==void 0,Xn=e=>e(),eo=e=>e.toLowerCase();function to(e){switch(!0){case!F(e):return"";case F(e.id):return`${e.nodeName}#${e.id}`;case F(e.name):return`${e.nodeName} (${e.name}`;case F(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const no=e=>e?.__esModule?e.default:e,T=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Xt(t)}`)},en={br:`
5
- `,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},oo=Object.keys(en),ro=new RegExp(`<(${oo.join("|")})>`,"gi"),so=(e,t)=>en[t]??"",io=e=>e.replace(ro,so),co=e=>e.replaceAll("<br>",We).replaceAll(/<\/?[^>]+>/gi,""),ao=e=>t=>e(Kn(t)?window.chrome?io(t):co(t):t);let Je=!0,De=Ue;const lo=no(s),K=lo({label:`${Ue}(child)`,expand:!1});function uo(e){De=e.id||Ue,K.label(`${De}`),K.expand(e.expand),Je=e.enabled}const tn=e=>(...t)=>Je?K[e](...t):!0,a=tn("log"),d=a,he=tn("debug");function fo(e,t){console.info(`${De} %ciframe-resizer ${e}`,Je||t<1?Qn:s.NORMAL)}const{assert:Ii,endAutoGroup:j,error:nn,errorBoundary:Ke,event:m,label:Si,purge:Ti,warn:R}=K,mo=ao(me),g=(...e)=>K.warn(...e.map(mo)),Xe=Jn((e,t)=>g(t)),on=Xe("Method"),ho=Xe("Method","replaced with"),go=Xe("Option"),et=[];function rn(e,t){a(`${e} event listener: %c${t}`,s.HIGHLIGHT)}const sn=(e,t,n,o)=>{e.removeEventListener(t,n,o),rn("Removed",t)},G=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),et.push(()=>sn(e,t,n,o)),rn("Added",t)},c={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let ht=!1;const gt=e=>e.postMessage(An,window?.iframeResizer?.targetOrigin||"*");function pt(){if(document.readyState==="loading"||!c.firstRun||ht)return;const{parent:e,top:t}=window;m("ready"),a("Sending%c ready%c to parent from",s.HIGHLIGHT,s.FOREGROUND,window.location.href),gt(e),e!==t&&gt(t),ht=!0}const yt="iframeResize",po=e=>fe===`${e.data}`.slice(0,Zt),yo=()=>yt in window||window.jQuery!==void 0&&yt in window.jQuery.prototype,bo=e=>e.data.split(we)[2]in{true:1,false:1},vo=()=>[document.documentElement,document.body],wo=["min-height","min-width","max-height","max-width"],bt=new Set,zo=e=>!!e&&e!=="0px"&&e!==Ee&&e!==Ye,cn=e=>e.tagName?e.tagName.toLowerCase():"unknown",an=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Oo=(e,t)=>zo(an(e,t));function Eo(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}function Io({href:e}){bt.has(e)||(a("Unable to access stylesheet:",e),bt.add(e))}function So(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const r=o.style[t];if(r)return{source:n.ownerNode.tagName==="STYLE"?"an inline <style> block":`stylesheet (${n.href})`,value:r}}}catch{Io(n)}return{source:"cross-origin stylesheet",value:an(e,t)}}const To=(e,t)=>Eo(e,t)||So(e,t),Ro=(e,t)=>{const{source:n,value:o}=To(e,t),r=cn(e);g(`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</>.
4
+ The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${d}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),Qn=e=>typeof e===K,ze=(e,...t)=>setTimeout(()=>e(...t),0),Yt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},le=e=>e,lt=1e3,C=e=>Math.round(e*lt)/lt,Qt=e=>e.charAt(0).toUpperCase()+e.slice(1),A=e=>`${e}`!=""&&e!==void 0,Jn=e=>e(),Kn=e=>e.toLowerCase();function Xn(e){switch(!0){case!A(e):return"";case A(e.id):return`${e.nodeName}#${e.id}`;case A(e.name):return`${e.nodeName} (${e.name}`;case A(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const eo=e=>e?.__esModule?e.default:e,S=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Qt(t)}`)},Jt={br:`
5
+ `,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},to=Object.keys(Jt),no=new RegExp(`<(${to.join("|")})>`,"gi"),oo=(e,t)=>Jt[t]??"",ro=e=>e.replace(no,oo),so=e=>e.replaceAll("<br>",xe).replaceAll(/<\/?[^>]+>/gi,""),io=e=>t=>e(Qn(t)?window.chrome?ro(t):so(t):t);let qe=!0,Ge=Fe;const co=eo(s),Q=co({label:`${Fe}(child)`,expand:!1});function ao(e){Ge=e.id||Fe,Q.label(`${Ge}`),Q.expand(e.expand),qe=e.enabled}const Kt=e=>(...t)=>qe?Q[e](...t):!0,l=Kt("log"),u=l,de=Kt("debug");function lo(e,t){console.info(`${Ge} %ciframe-resizer ${e}`,qe||t<1?qn:s.NORMAL)}const{assert:uo,endAutoGroup:_,error:Xt,errorBoundary:Ze,event:h,label:Ei,purge:Si,warn:D}=Q,fo=io(le),p=(...e)=>Q.warn(...e.map(fo)),Ye=Yn((e,t)=>p(t)),en=Ye("Method"),mo=Ye("Method","replaced with"),ho=Ye("Option"),Qe=[];function tn(e,t){l(`${e} event listener: %c${t}`,s.HIGHLIGHT)}const nn=(e,t,n,o)=>{e.removeEventListener(t,n,o),tn("Removed",t)},G=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Qe.push(()=>nn(e,t,n,o)),tn("Added",t)},i={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let dt=!1;function ut(e){const t=window?.iframeResizer?.targetOrigin||"*",n=Array.isArray(t)?t:[t];for(const o of n)e.postMessage($n,o)}function ft(){if(document.readyState==="loading"||!i.firstRun||dt)return;const{parent:e,top:t}=window;h("ready"),l("Sending%c ready%c to parent from",s.HIGHLIGHT,s.FOREGROUND,window.location.href),ut(e),e!==t&&ut(t),dt=!0}const mt="iframeResize",go=e=>ae===`${e.data}`.slice(0,Wt),po=()=>mt in window||window.jQuery!==void 0&&mt in window.jQuery.prototype,yo=e=>e.data.split(ge)[2]in{true:1,false:1},vo=()=>[document.documentElement,document.body],bo=["min-height","min-width","max-height","max-width"],ht=new Set,zo=e=>!!e&&e!=="0px"&&e!==L&&e!==We,on=e=>e.tagName?e.tagName.toLowerCase():"unknown",rn=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),wo=(e,t)=>zo(rn(e,t));function Io(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}function Oo({href:e}){ht.has(e)||(l("Unable to access stylesheet:",e),ht.add(e))}function Eo(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[]){if(!("selectorText"in o))continue;const r=o;if(!e.matches(r.selectorText))continue;const d=r.style.getPropertyValue(t);if(!d)continue;const{ownerNode:a}=n;return{source:a instanceof Element&&a.tagName==="STYLE"?"an inline <style> block":`stylesheet (${n.href})`,value:d}}}catch{Oo(n)}return{source:"cross-origin stylesheet",value:rn(e,t)}}const So=(e,t)=>Io(e,t)||Eo(e,t),To=(e,t)=>{const{source:n,value:o}=So(e,t),r=on(e);p(`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</>.
6
6
 
7
- 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.`)};function Ho(){for(const e of vo())for(const t of wo)a(`Checking <${cn(e)}> for blocking CSS: ${t}`),Oo(e,t)&&Ro(e,t)}const Mo=({calculateWidth:e,calculateHeight:t})=>e===t,i={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:Qe,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:Yt,onBeforeResize:void 0,onMessage:()=>{R("onMessage function not defined")},onReady:()=>{}},$o=e=>`:not(${e})`,Lo=`* ${Array.from(Jt).map($o).join("")}`,tt=e=>e.querySelectorAll(Lo),ge=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],L=[s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT],de={height:0,width:0},_={height:0,width:0};function x(e,t,n){return _[e]=t,de[e]=n,t}function Ao(e){const t=e.getOffset();return t!==0&&d(`Page offsetSize: %c${t}px`,s.HIGHLIGHT),t}const No=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function ln(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=c,r=e.label,u=r===ee,l=e.boundingClientRect(),p=Math.ceil(l),v=Math.floor(l),f=No(e),w=`HTML: %c${l}px %cPage: %c${f}px`;let h;switch(!0){case!e.enabled():return Math.max(f,J);case n:d("Found element with data-iframe-size attribute"),h=e.taggedElement();break;case(!t&&c.firstRun&&_[r]===0&&de[r]===0):d(`Initial page size values: ${w}`,...L),h=x(r,l,f);break;case(o&&l===_[r]&&f===de[r]):d(`Size unchanged: ${w}`,...L),h=Math.max(l,f);break;case(l===0&&f!==0):d(`Page is hidden: ${w}`,...L),h=f;break;case(!t&&l!==_[r]&&f<=de[r]):d(`New <html> size: ${w} `,...L),d(`Previous <html> size: %c${_[r]}px`,s.HIGHLIGHT),h=x(r,l,f);break;case!u:h=e.taggedElement();break;case(!t&&l<_[r]):d(`<html> size decreased: ${w}`,...L),h=x(r,l,f);break;case(f===v||f===p):d(`<html> size equals page size: ${w}`,...L),h=x(r,l,f);break;case l>f:d(`Page size < <html> size: ${w}`,...L),h=x(r,l,f);break;case t:d("Found elements possibly overflowing <html> "),h=e.taggedElement();break;default:d(`Using <html> size: ${w}`,...L),h=x(r,l,f)}return d(`Content ${r}: %c${h}px`,s.HIGHLIGHT),h+=Ao(e),Math.max(h,J)}const Co=()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,B)+parseInt(t.marginBottom,B)},Go=1e3,ko=5*Go,Po=4,Do=10,jo=100,nt="--ifr-start",pe="--ifr-end",dn="--ifr-measure",b=[];let ue={},vt=0,je;function un(){try{performance.clearMarks(nt),performance.clearMarks(pe),performance.clearMeasures(dn)}catch{}}function xo(){je=setInterval(()=>{if(b.length<Do||ue.hasTags&&ue.len<25)return;b.sort();const e=Math.min(b.reduce((n,o)=>n+o,0)/b.length,b[Math.floor(b.length/2)]),t=P(e);t>vt&&(vt=t,m("performanceObserver"),a("Mean time:",P(b[Math.floor(b.length/2)])),a("Median time:",P(b.reduce((n,o)=>n+o,0)/b.length)),a("Average time:",t),a("Max time:",P(Math.max(...b)))),un(),!(e<=Po)&&(clearInterval(je),g(`<rb>Performance Warning</>
7
+ 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.`)};function Ro(){for(const e of vo())for(const t of bo)l(`Checking <${on(e)}> for blocking CSS: ${t}`),wo(e,t)&&To(e,t)}const Ho=({calculateWidth:e,calculateHeight:t})=>e===t,c={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:L,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:L,onBeforeResize:void 0,onMessage:()=>{D("onMessage function not defined")},onReady:()=>{}},M=[s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT],ie={height:0,width:0},x={height:0,width:0};function F(e,t,n){return x[e]=t,ie[e]=n,t}function Mo(e){const t=e.getOffset();return t!==0&&u(`Page offsetSize: %c${t}px`,s.HIGHLIGHT),t}const $o=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function sn(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=i,r=e.label,d=r===ve,a=e.boundingClientRect(),f=Math.ceil(a),b=Math.floor(a),m=$o(e),z=`HTML: %c${a}px %cPage: %c${m}px`;let g;switch(!0){case!e.enabled():return Math.max(m,Y);case n:u("Found element with data-iframe-size attribute"),g=e.taggedElement();break;case(!t&&i.firstRun&&x[r]===0&&ie[r]===0):u(`Initial page size values: ${z}`,...M),g=F(r,a,m);break;case(o&&a===x[r]&&m===ie[r]):u(`Size unchanged: ${z}`,...M),g=Math.max(a,m);break;case(a===0&&m!==0):u(`Page is hidden: ${z}`,...M),g=m;break;case(!t&&a!==x[r]&&m<=ie[r]):u(`New <html> size: ${z} `,...M),u(`Previous <html> size: %c${x[r]}px`,s.HIGHLIGHT),g=F(r,a,m);break;case!d:g=e.taggedElement();break;case(!t&&a<x[r]):u(`<html> size decreased: ${z}`,...M),g=F(r,a,m);break;case(m===b||m===f):u(`<html> size equals page size: ${z}`,...M),g=F(r,a,m);break;case a>m:u(`Page size < <html> size: ${z}`,...M),g=F(r,a,m);break;case t:u("Found elements possibly overflowing <html> "),g=e.taggedElement();break;default:u(`Using <html> size: ${z}`,...M),g=F(r,a,m)}return u(`Content ${r}: %c${g}px`,s.HIGHLIGHT),g+=Mo(e),Math.max(g,Y)}const Ao=1e3,Lo=5*Ao,ko=4,No=10,Go=100,Je="--ifr-start",ue="--ifr-end",cn="--ifr-measure",v=[];let ce={},gt=0,Pe;function an(){try{performance.clearMarks(Je),performance.clearMarks(ue),performance.clearMeasures(cn)}catch{}}function Po(){Pe=setInterval(()=>{if(v.length<No||ce.hasTags&&ce.len<25)return;v.sort();const e=Math.min(v.reduce((n,o)=>n+o,0)/v.length,v[Math.floor(v.length/2)]),t=C(e);t>gt&&(gt=t,h("performanceObserver"),l("Mean time:",C(v[Math.floor(v.length/2)])),l("Median time:",C(v.reduce((n,o)=>n+o,0)/v.length)),l("Average time:",t),l("Max time:",C(Math.max(...v)))),an(),!(e<=ko)&&(clearInterval(Pe),p(`<rb>Performance Warning</>
8
8
 
9
- Calculating the page size is taking an excessive amount of time (${P(e)}ms).
9
+ Calculating the page size is taking an excessive amount of time (${C(e)}ms).
10
10
 
11
- To improve performance add the <b>data-iframe-size</> attribute to the ${ue.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},ko)}function _o(e){e.getEntries().forEach(t=>{if(t.name===pe)try{const{duration:n}=performance.measure(dn,nt,pe);ue=t.detail,b.push(n),b.length>jo&&b.shift()}catch{}})}function Bo(){d("Attached%c PerformanceObserver%c to page",s.HIGHLIGHT,s.FOREGROUND);const e=new PerformanceObserver(_o);return e.observe({entryTypes:["mark"]}),xo(),{disconnect:()=>{un(),clearInterval(je),e.disconnect(),d("Detached%c PerformanceObserver",s.HIGHLIGHT)}}}function Fo(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=c;return t?o:e?Array.from(n):tt(document.documentElement)}function Uo(e,t){const n=`margin-${t}`;let o,r=document.documentElement,u=c.hasTags?J:document.documentElement.getBoundingClientRect().bottom;for(const l of e)o=l.getBoundingClientRect()[t]+parseFloat(getComputedStyle(l).getPropertyValue(n)),o>u&&(u=o,r=l);return{maxEl:r,maxVal:u}}function ye(e){performance.mark(nt);const t=Xt(e),{logging:n}=i,{hasTags:o}=c,r=Fo(),{maxEl:u,maxVal:l}=Uo(r,e);return d(`${t} position calculated from:`,u),d(`Checked %c${r.length}%c elements`,s.HIGHLIGHT,s.FOREGROUND),performance.mark(pe,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),l}const O={label:ee,enabled:()=>i.calculateHeight,getOffset:()=>i.offsetHeight,auto:()=>ln(O),bodyOffset:Co,bodyScroll:()=>document.body.scrollHeight,offset:()=>O.bodyOffset(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...ge(O)),min:()=>Math.min(...ge(O)),grow:()=>O.max(),lowestElement:()=>ye(Ge),taggedElement:()=>ye(Ge),custom:()=>(R("Custom height calculation function not defined"),O.auto())},E={label:Bt,enabled:()=>i.calculateWidth,getOffset:()=>i.offsetWidth,auto:()=>ln(E),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...ge(E)),min:()=>Math.min(...ge(E)),rightMostElement:()=>ye(ke),scroll:()=>Math.max(E.bodyScroll(),E.documentElementScroll()),taggedElement:()=>ye(ke),custom:()=>(R("Custom width calculation function not defined"),E.auto())},Wo={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},Vo=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:
11
+ To improve performance add the <b>data-iframe-size</> attribute to the ${ce.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},Lo)}function Co(e){e.getEntries().forEach(t=>{if(t.name===ue)try{const{duration:n}=performance.measure(cn,Je,ue);ce=t.detail,v.push(n),v.length>Go&&v.shift()}catch{}})}function jo(){u("Attached%c PerformanceObserver%c to page",s.HIGHLIGHT,s.FOREGROUND);const e=new PerformanceObserver(Co);return e.observe({entryTypes:["mark"]}),Po(),{disconnect:()=>{an(),clearInterval(Pe),e.disconnect(),u("Detached%c PerformanceObserver",s.HIGHLIGHT)}}}const Do=e=>`:not(${e})`,_o=`* ${Array.from(Zt).map(Do).join("")}`,Ke=e=>e.querySelectorAll(_o);function Fo(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=i;return t?o:e?Array.from(n):Ke(document.documentElement)}function xo(e,t){const n=`margin-${t}`;let o,r=document.documentElement,d=i.hasTags?Y:document.documentElement.getBoundingClientRect().bottom;for(const a of e)o=a.getBoundingClientRect()[t]+parseFloat(getComputedStyle(a).getPropertyValue(n)),o>d&&(d=o,r=a);return{maxEl:r,maxVal:d}}function ln(e){performance.mark(Je);const t=Qt(e),{logging:n}=c,{hasTags:o}=i,r=Fo(),{maxEl:d,maxVal:a}=xo(r,e);return u(`${t} position calculated from:`,d),u(`Checked %c${r.length}%c elements`,s.HIGHLIGHT,s.FOREGROUND),performance.mark(ue,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),a}const we={label:ve,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>sn(we),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>ln(_t)},Ie={label:jt,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>sn(Ie),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>ln(Ft)};function dn(e,t){const{label:n}=t;return e&&e!==L&&p(`<rb>Ignored ${n}CalculationMethod (${e})</>
12
12
 
13
- window.iframeResizer = {
14
- license: 'xxxx',
15
- ${e}CalculationMethod: '${Ee}',
16
- }
17
- `;function qo(e,t){const n=i.version?"remove this option.":Vo(e);g(`<rb>Deprecated ${e}CalculationMethod (${t})</>
13
+ 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.
18
14
 
19
- This version of <i>iframe-resizer</> can auto detect the most suitable ${e} calculation method. It is recommended that you ${n}
20
- `)}function fn(e,t,n){const{label:o}=n;return t!==e&&(e in n||(R(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in Wo&&qo(o,e)),a(`Set ${o} calculation method: %c${e}`,s.HIGHLIGHT),e}function mn(){i.heightCalcMode=fn(i.heightCalcMode,Qe,O)}function hn(){i.widthCalcMode=fn(i.widthCalcMode,Yt,E)}function Zo(){try{c.sameOrigin=i.mode===1||"iframeParentListener"in window.parent}catch{a("Cross domain iframe detected")}}const Yo=`<rb>Deprecated Attributes</>
15
+ 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.
16
+ `),l(`Set ${n} calculation method: %c${L}`,s.HIGHLIGHT),L}function Bo(){c.heightCalcMode=dn(c.heightCalcMode,we)}function Uo(){c.widthCalcMode=dn(c.widthCalcMode,Ie)}function Vo(){try{i.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{l("Cross domain iframe detected")}}const Wo=`<rb>Deprecated Attributes</>
21
17
 
22
- 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</>.`;function Qo(){let e=!1;const t=n=>document.querySelectorAll(`[${n}]`).forEach(o=>{o.toggleAttribute(Oe,!0),o.removeAttribute(n),e=!0});t("data-iframe-height"),t("data-iframe-width"),e&&g(Yo)}let wt=0;function Jo(e){const t=e.length===1?"":"s";R(`%c[${X}]%c found on %c${e.length}%c element${t}`,s.BOLD,s.NORMAL,s.BOLD,s.NORMAL)}function Ko(){const e=document.querySelectorAll(`*[${X}]`),t=e.length>0;return t&&e.length!==wt&&(Jo(e),wt=e.length),t}const zt=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);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)},A=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Y=["spjluzl","rlf","clyzpvu","rlf2"],Xo=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","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</>","<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</>.","<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.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],er=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],Ot=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),U=e=>A(Xo[e]),tr=e=>A(er[e]),nr=e=>A(Y[e]),Et=e=>{const t=e[A(Y[0])]||e[A(Y[1])]||e[A(Y[2])]||e[A(Y[3])];if(!t)return-1;const n=t.split("-");let o=(function(r=""){let u=-2;const l=zt(A(r));return l in Ot&&(u=Ot[l]),u>4?u-4:u})(n[0]);return o===0||(r=>r[2]===zt(r[0]+r[1]))(n)||(o=-2),o};function or({key:e,key2:t,mode:n,version:o}){const r=n,u=Et({key:e}),l=Et({key2:t});if(i.mode=n=Math.max(u,l),n<0){if(n=Math.min(u,l),g(`${U(n+2)}${U(2)}`),F(o))throw c.firstRun=!1,U(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!F(o)||r>-1&&n>r)&&(sessionStorage.getItem("ifr")!==D&&fo(`v${D} (${tr(n)})`,n),n<2&&g(U(3)),sessionStorage.setItem("ifr",D))}const rr="BackCompat",sr=`<rb>Quirks Mode Detected</>
18
+ 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</>.`;function qo(){let e=!1;const t=n=>document.querySelectorAll(`[${n}]`).forEach(o=>{o.toggleAttribute(ye,!0),o.removeAttribute(n),e=!0});t("data-iframe-height"),t("data-iframe-width"),e&&p(Wo)}let pt=0;function Zo(e){const t=e.length===1?"":"s";D(`%c[${J}]%c found on %c${e.length}%c element${t}`,s.BOLD,s.NORMAL,s.BOLD,s.NORMAL)}function Yo(){const e=document.querySelectorAll(`*[${J}]`),t=e.length>0;return t&&e.length!==pt&&(Zo(e),pt=e.length),t}const fe=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);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)},H=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Qo=new Date,un=e=>new Set(Array.from({length:9},e)),yt=" - lewpylk",B=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Jo=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","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</>","<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</>.","<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.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> fvb jhu bzl aol <i>mpyza 11 johyhjalyz vm fvb spjluzl rlf</> av nla h 60% kpzjvbua ha oaawz://pmyhtl-ylzpgly.jvt/wypjpun.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.<iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz.","<yi> VLT rlf lewpylk</><iy><iy>Aol spjluzl rlf fvb hyl bzpun mvy <p>pmyhtl-ylzpgly</> pz myvt h wypvy flhy huk ohz lewpylk. Hu bwkhalk rlf pz ylslhzlk vu aol mpyza vm Uvcltily lhjo flhy.<iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz."],Ko=e=>[e[0],...e.slice(1).map(t=>`${t}${yt}`),`${e[4]}${yt}`,...e.slice(1)],Xo=Ko(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),vt=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),er=new Set([1,6]),fn=Qo[H(B[4])](),tr=un((e,t)=>fe(`${fn+t}`)),nr=un((e,t)=>fe(`${fn-++t}`)),or=e=>tr.has(e)?9:nr.has(e)?5:-2,Xe=e=>er.has(e),$=e=>H(Jo[e]),rr=e=>H(Xo[e]),bt=e=>H(B[e]),zt=e=>{const t=e[H(B[0])]||e[H(B[1])]||e[H(B[2])]||e[H(B[3])];if(!t)return-1;const n=t.split("-");let o=(function(r="",d=""){let a=-2;const f=fe(H(r));return f in vt&&(a=vt[f]),a===9?or(d):a})(...n);return o===0||(r=>r[2]===fe(r[0]+r[1]))(n)||(o=-2),o};function sr(e,t,n){if(!A(n)||t>-1&&e>t){try{if(sessionStorage.getItem("ifr")===j)return}catch{}lo(`v${j} (${rr(e)})`,e),e<2&&p($(3));try{sessionStorage.setItem("ifr",j)}catch{}}}function ir({key:e,key2:t,mode:n,version:o}){const r=n,d=A(e)?zt({key:e}):-1,a=A(t)?zt({key:t}):-1;let f;switch(n=Math.max(d,a),n){case-2:case-1:f=`${$(Math.min(d,a)+2)}${$(2)}`,i.firstRun=!1;break;case 1:case 2:case 3:f=$(6);break;case 4:f=$(7);break;case 5:f=$(8);break}if(sr(n,r,o),(!A(o)||!i.firstRun)&&(f&&p(f),n<0))throw f.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");c.mode=n}const cr="BackCompat",ar=`<rb>Quirks Mode Detected</>
23
19
 
24
20
  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</>.
25
21
 
26
22
  For more information see <u>https://iframe-resizer.com/quirks-mode</>.
27
- `;function ir(){document.compatMode===rr&&g(sr)}const cr="complete";let It=!1;function gn(e){document.readyState===cr?Ie(e):It||G(document,Ft,()=>gn(e)),It=!0}const ar=()=>{d(`Set targetOrigin for parent: %c${i.targetOrigin}`,s.HIGHLIGHT),i.autoResize!==!0&&a("Auto Resize disabled")};function pn(){c.taggedElements=document.querySelectorAll(`[${Oe}]`),c.hasTags=c.taggedElements.length>0,a(`Tagged elements found: %c${c.hasTags}`,s.HIGHLIGHT)}const lr=`<rb>Legacy version detected on parent page</>
23
+ `;function lr(){document.compatMode===cr&&p(ar)}const dr="complete";let wt=!1;function mn(e){document.readyState===dr?ze(e):wt||G(document,Dt,()=>mn(e)),wt=!0}const ur=()=>{u(`Set targetOrigin for parent: %c${c.targetOrigin}`,s.HIGHLIGHT),c.autoResize!==!0&&l("Auto Resize disabled")};function hn(){i.taggedElements=document.querySelectorAll(`[${ye}]`),i.hasTags=i.taggedElements.length>0,l(`Tagged elements found: %c${i.hasTags}`,s.HIGHLIGHT)}const fr=`<rb>Legacy version detected on parent page</>
28
24
 
29
25
  Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
30
26
 
31
27
  See <u>https://iframe-resizer.com/setup/</> for more details.
32
- `,dr=e=>`<b>Version mismatch</>
28
+ `,mr=e=>`<b>Version mismatch</>
33
29
 
34
30
  The parent and child pages are running different versions of <i>iframe resizer</>.
35
31
 
36
- Parent page: ${e} - Child page: ${D}.
37
- `;function ur({version:e}){!e||e===""||e===Zn?g(lr):e!==D&&g(dr(e))}const fr=Kt(()=>g(U(4)));function mr(e){if(!c.timerActive)return;const t=P(performance.now()-c.totalTime),n=e===ze?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;a(n,s.HIGHLIGHT)}function hr(e){return e===void 0?e=i.targetOrigin:a(`Message targetOrigin: %c${e}`,s.HIGHLIGHT),e}function gr(e,t){const{mode:n}=i,{sameOrigin:o,target:r}=c;if(o)try{window.parent.iframeParentListener(fe+e)}catch(u){if(n===1)fr();else throw u;return!1}else r.postMessage(fe+e,hr(t));return!0}function yn(e,t,n,o,r){const{parentId:u}=i,{sameOrigin:l}=c,p=`${e}:${t}`,v=`${u}:${p}:${n}${o===void 0?"":`:${o}`}`;i.mode<-1||!gr(v,r)||(mr(n),d(`Sending message to parent page via ${l?"sameOrigin":"postMessage"}: %c%c${v}`,s.ITALIC,s.HIGHLIGHT))}const y=Ke((e,t,n,o,r)=>{m(n),yn(e,t,n,o,r),j()}),pr=e=>y(0,0,e.type,`${e.screenY}:${e.screenX}`);function St(e,t){a(`Add event listener: %c${t}`,s.HIGHLIGHT),G(window.document,e,pr)}function yr({mouseEvents:e}){e===!0&&(St(Pn,"Mouse Enter"),St(Dn,"Mouse Leave"))}const br=()=>y(0,0,Cn);function vr({persisted:e}){e||br(),m(Pt),d("Page persisted:",e),!e&&et.forEach(Xn)}const wr=()=>G(window,eo(Pt),vr),Tt=(e,t)=>!(Math.abs(e-t)<=i.tolerance);function zr(e,t){const{calculateHeight:n,calculateWidth:o}=i,{height:r,width:u}=c;return n&&Tt(r,e)||o&&Tt(u,t)}function Or(e){const t=i.onBeforeResize(e);if(t===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<J)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least ${J}`);return t}const bn=e=>t=>{const n=e[t]();return e.enabled()&&i.onBeforeResize!==void 0?Or(n):n},Er=bn(O),Ir=bn(E);function Sr(e,t,n,o){const{heightCalcMode:r,widthCalcMode:u}=i,l=n??Er(r),p=o??Ir(u),v=zr(l,p)?dt:e;switch(a(`Resize event: %c${t}`,s.HIGHLIGHT),v){case ze:case Pe:case dt:case Ve:case qe:c.height=l,c.width=p;case Ut:return c;case Ze:case Vt:case Wt:case qt:{a(ft);break}default:d(ft)}return null}let ie=!1,Me=!1,q=null;function Tr(e,t,n,o,r){const{autoResize:u}=i,{isHidden:l}=c;switch(m(e),!0){case l===!0:{if(Me===!0)break;a("Iframe hidden - Ignored resize request"),Me=!0,ie=!1,cancelAnimationFrame(q),q=null;break}case(ie===!0&&e!==Ze&&!(e in ut)):{a("Resize already pending - Ignored resize request");break}case(!u&&!(e in ut)):{d("Resizing disabled");break}default:{Me=!1,ie=!0,c.totalTime=performance.now(),c.timerActive=!0;const p=Sr(e,t,n,o);p&&yn(p.height,p.width,e,r),q||(q=requestAnimationFrame(()=>{ie=!1,q=null,m("requestAnimationFrame"),he(`Reset sendPending: %c${e}`,s.HIGHLIGHT)})),c.timerActive=!1}}j()}const H=Ke(Tr);function Rt({eventType:e,eventName:t}){G(window,t,()=>H(t,e),{passive:!0})}function Rr(){Rt({eventType:"After Print",eventName:"afterprint"}),Rt({eventType:"Before Print",eventName:"beforeprint"})}function Hr(){if(c.triggerLocked){a("TriggerLock blocked calculation");return}c.triggerLocked=!0,he("Trigger event lock on"),requestAnimationFrame(()=>{c.triggerLocked=!1,he("Trigger event lock off")})}function vn(e){const{heightCalcMode:t,widthCalcMode:n}=i,o=O[t](),r=E[n]();a(`Reset trigger event: %c${e}`,s.HIGHLIGHT),y(o,r,e)}function Mr(e){const t=i.heightCalcMode;a(`Reset trigger event: %c${e}`,s.HIGHLIGHT),i.heightCalcMode=Qe,Hr(),vn("reset"),i.heightCalcMode=t}const $r=`Auto Resize can not be changed when <b>direction</> is set to '${Ye}'.`;function Lr(e){T(e,Wn,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=i;return o===!1&&n===!1?(m(Pe),g($r),!1):(e===!0&&t===!1?(i.autoResize=!0,queueMicrotask(()=>H(Pe,"Auto Resize enabled"))):e===!1&&t===!0&&(i.autoResize=!1),y(0,0,Nn,JSON.stringify(i.autoResize)),i.autoResize)}function Ar(e){i.heightCalcMode=e,mn()}function Nr(e){i.widthCalcMode=e,hn()}function Cr(e){T(e,te,"parentIframe.moveToAnchor(anchor) anchor"),c.inPageLinks.findTarget(e)}function Gr(e){T(e,C,"parentIframe.setOffsetSize(offset) offset"),i.offsetHeight=e,i.offsetWidth=e,H(Ut,`parentIframe.setOffsetSize(${e})`)}function kr(){return m("getOrigin"),on("getOrigin()","getParentOrigin()"),c.origin}const Pr=()=>c.origin;function Dr(e){T(e,te,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),a(`Set targetOrigin: %c${e}`,s.HIGHLIGHT),i.targetOrigin=e}function jr(e){if(typeof e===ne){c.onPageInfo=e,y(0,0,Dt),ho("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");return}c.onPageInfo=null,y(0,0,jn)}function wn(e){return T(e,ne,"parentIframe.getParentProps(callback) callback"),c.onParentInfo=e,y(0,0,jt),()=>{c.onParentInfo=null,y(0,0,xn)}}function xr(e){on("getParentProperties()","getParentProps()"),wn(e)}const _r=e=>`<rb>Deprecated API object name</>
32
+ Parent page: ${e} - Child page: ${j}.
33
+ `;function hr({version:e}){!e||e===""||e===Vn?p(fr):e!==j&&p(mr(e))}const gr=Yt(()=>p($(4)));function pr(e){if(!i.timerActive)return;const t=C(performance.now()-i.totalTime),n=e===pe?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;l(n,s.HIGHLIGHT)}function yr(e){return e===void 0?e=c.targetOrigin:l(`Message targetOrigin: %c${e}`,s.HIGHLIGHT),e}function vr(e,t){const{mode:n}=c,{sameOrigin:o,target:r}=i;if(o)try{window.parent.iframeParentListener(ae+e)}catch(d){if(Xe(n))gr();else throw d;return!1}else{uo(r,"Internal error: postMessage target is undefined");const d=yr(t),a=Array.isArray(d)?d:[d];for(const f of a)r.postMessage(ae+e,f)}return!0}function gn(e,t,n,o,r){const{parentId:d}=c,{sameOrigin:a}=i,f=`${e}:${t}`,b=`${d}:${f}:${n}${o===void 0?"":`:${o}`}`;c.mode<-1||!vr(b,r)||(pr(n),u(`Sending message to parent page via ${a?"sameOrigin":"postMessage"}: %c%c${b}`,s.ITALIC,s.HIGHLIGHT))}const y=Ze((e,t,n,o,r)=>{h(n),gn(e,t,n,o,r),_()}),br=e=>y(0,0,e.type,`${e.screenY}:${e.screenX}`);function It(e,t){l(`Add event listener: %c${t}`,s.HIGHLIGHT),G(window.document,e,br)}function zr({mouseEvents:e}){e===!0&&(It(Gn,"Mouse Enter"),It(Pn,"Mouse Leave"))}const wr=()=>y(0,0,Ln);function Ir({persisted:e}){e||wr(),h(kt),u("Page persisted:",e),!e&&Qe.forEach(Jn)}const Or=()=>G(window,Kn(kt),Ir),Ot=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function Er(e,t){const{calculateHeight:n,calculateWidth:o}=c,{height:r,width:d}=i;return n&&Ot(r,e)||o&&Ot(d,t)}function Sr(e,t,n){const o=c.onBeforeResize(e,t,n);if(o===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(o))throw new TypeError(`Invalid value returned from onBeforeResize(): ${o}, expected Number`);if(o<Y)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least ${Y}`);return o}const pn=(e,t)=>(n,o)=>{const r=e[n]();return e.enabled()&&c.onBeforeResize!==void 0?Sr(r,o,t):r},Tr=pn(we,ve),Rr=pn(Ie,jt);function Hr(){(window.scrollY!==0||window.scrollX!==0)&&(u("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0))}function Mr(e,t,n,o){const{heightCalcMode:r,widthCalcMode:d}=c;Hr();const a=n??Tr(r,e),f=o??Rr(d,e),b=Er(a,f)?ct:e;switch(l(`Resize event: %c${t}`,s.HIGHLIGHT),b){case pe:case Ne:case ct:case Be:case Ue:i.height=a,i.width=f;case xt:return i;case Ve:case Ut:case Bt:case Vt:{l(at);break}default:u(at)}return null}let ne=!1,He=!1,W=null;function $r(e,t,n,o,r){const{autoResize:d}=c,{isHidden:a}=i;switch(h(e),!0){case(a===!0&&!(e in Re)):{if(He===!0)break;l("Iframe hidden - Ignored resize request"),He=!0,ne=!1,cancelAnimationFrame(W),W=null;break}case(ne===!0&&e!==Ve&&!(e in Re)):{l("Resize already pending - Ignored resize request");break}case(!d&&!(e in Re)):{u("Resizing disabled");break}default:{He=!1,ne=!0,i.totalTime=performance.now(),i.timerActive=!0;const f=Mr(e,t,n,o);f&&gn(f.height,f.width,e,r),W||(W=requestAnimationFrame(()=>{ne=!1,W=null,h("requestAnimationFrame"),de(`Reset sendPending: %c${e}`,s.HIGHLIGHT)})),i.timerActive=!1}}_()}const T=Ze($r);function Et({eventType:e,eventName:t}){G(window,t,()=>T(t,e),{passive:!0})}function Ar(){Et({eventType:"After Print",eventName:"afterprint"}),Et({eventType:"Before Print",eventName:"beforeprint"})}function Lr(){if(i.triggerLocked){l("TriggerLock blocked calculation");return}i.triggerLocked=!0,de("Trigger event lock on"),requestAnimationFrame(()=>{i.triggerLocked=!1,de("Trigger event lock off")})}function yn(e){const{heightCalcMode:t,widthCalcMode:n}=c,o=we[t](),r=Ie[n]();l(`Reset trigger event: %c${e}`,s.HIGHLIGHT),y(o,r,e)}function kr(e){const t=c.heightCalcMode;l(`Reset trigger event: %c${e}`,s.HIGHLIGHT),c.heightCalcMode=Zn,Lr(),yn("reset"),c.heightCalcMode=t}const Nr=`Auto Resize can not be changed when <b>direction</> is set to '${We}'.`;function Gr(e){S(e,xn,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=c;return o===!1&&n===!1?(h(Ne),p(Nr),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>T(Ne,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),y(0,0,An,JSON.stringify(c.autoResize)),c.autoResize)}function Pr(e){S(e,K,"parentIframe.moveToAnchor(anchor) anchor"),i.inPageLinks.findTarget(e)}function Cr(e){S(e,N,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,T(xt,`parentIframe.setOffsetSize(${e})`)}function jr(){return h("getOrigin"),en("getOrigin()","getParentOrigin()"),i.origin}const Dr=()=>i.origin;function _r(e){S(e,K,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),l(`Set targetOrigin: %c${e}`,s.HIGHLIGHT),c.targetOrigin=e}function Fr(e){if(typeof e===be){i.onPageInfo=e,y(0,0,Nt),mo("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");return}i.onPageInfo=null,y(0,0,Cn)}function vn(e){return S(e,be,"parentIframe.getParentProps(callback) callback"),i.onParentInfo=e,y(0,0,Gt),()=>{i.onParentInfo=null,y(0,0,jn)}}function xr(e){return en("getParentProperties()","getParentProps()"),vn(e)}const Br=e=>`<rb>Deprecated API object name</>
38
34
  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.
39
35
 
40
36
  Called property: '${String(e)}'
41
- `;function Br(e){const t=new Set;return new Proxy(e,{get(n,o){t.has(o)||(g(_r(o)),t.add(o));const r=n[o],u=Object.getOwnPropertyDescriptor(n,o);return u&&!u.configurable&&!u.writable?r:typeof r=="function"?r.bind(n):r}})}function Fr(e,t){e!==void 0&&T(e,C,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&T(t,C,"parentIframe.resize(customHeight, customWidth) customWidth");const n=`${e||""}${t?`,${t}`:""}`;H(Ve,`parentIframe.resize(${n})`,e,t)}const ot=e=>(t,n)=>{T(t,C,`parentIframe.${e}(x, y) x`),T(n,C,`parentIframe.${e}(x, y) y`),y(n,t,e)},Ur=ot(_n),Wr=ot(Bn),Vr=ot(xt);function qr(e,t){t&&T(t,te,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),y(0,0,Ce,JSON.stringify(e),t)}const Zr=()=>y(0,0,Gn),Yr=()=>i.parentId,Qr=()=>Mr("parentIframe.reset"),Jr=()=>R("parentIframe.size() has been renamed parentIframe.resize()");function Kr(){const{win:e}=c;i.mode!==1&&(e.parentIframe=Object.freeze({autoResize:Lr,close:Zr,getId:Yr,getOrigin:kr,getParentOrigin:Pr,getPageInfo:jr,getParentProps:wn,getParentProperties:xr,moveToAnchor:Cr,reset:Qr,setOffsetSize:Gr,scrollBy:Ur,scrollTo:Wr,scrollToOffset:Vr,sendMessage:qr,setHeightCalculationMethod:Ar,setWidthCalculationMethod:Nr,setTargetOrigin:Dr,resize:Fr,size:Jr}),e.parentIFrame=Br(e.parentIframe))}const oe=(e="")=>t=>n=>{n.size>0&&he(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[We,o]))},Xr=(e="")=>t=>n=>{n.size>0&&nn(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[We,o]))},zn=oe("attached to"),On=Xr("already attached"),es=oe("detached from"),Se=(e,t=!0)=>n=>{n>0&&d(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,s.HIGHLIGHT,s.NORMAL,s.HIGHLIGHT,s.NORMAL)},En=(e,t,n,o)=>{const r=es(e);return u=>{const l=new Set;let p=0;for(const v of u)n.has(v)&&(t.unobserve(v),n.delete(v),l.add(v),p+=1);r(l),o(p),l.clear()}},Ht=16,Mt=2,ts=200,rt="Mutation",I=new Set,N=new Set,xe=new Set,be=[],ns={attributes:!0,attributeFilter:[X,Oe],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let $e=1,st,_e=!1,Be=0;const os=oe("added")(rt),rs=oe("removed (page)")(rt),ss=oe("removed (added)")(rt),In=e=>e.nodeType!==Node.ELEMENT_NODE||Jt.has(e.tagName.toLowerCase());function is(e){const t=e.addedNodes;for(const n of t)In(n)||I.add(n)}function cs(e){const t=e.removedNodes;for(const n of t)In(n)||(I.has(n)?(I.delete(n),xe.add(n)):N.add(n))}const as=e=>{d("Mutations:",e);for(const t of e)is(t),cs(t);os(I),rs(N),ss(xe),xe.clear()};function ls(){N.size>0&&a(`Detected %c${N.size} %cremoved element${N.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND),I.size>0&&a(`Found %c${I.size} %cnew element${I.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND)}const ds=e=>()=>{const t=performance.now(),n=t-Be,o=Ht*$e+++Mt;if(n>o&&n<ts){m("mutationThrottled"),d("Update delayed due to heavy workload on the callStack"),d(`EventLoop busy time: %c${P(n)}ms %c> Max wait: %c${o-Mt}ms`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),setTimeout(st,Ht*$e),Be=t;return}$e=1,be.forEach(as),be.length=0,_e=!1,ls(),e({addedNodes:I,removedNodes:N}),I.clear(),N.clear()};function us(e){be.push(e),!_e&&(Be=performance.now(),_e=!0,requestAnimationFrame(st))}function fs(e){const t=new window.MutationObserver(us),n=document.body||document.documentElement;return st=ds(e),t.observe(n,ns),d("Attached%c MutationObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{...t,disconnect:()=>{I.clear(),N.clear(),be.length=0,t.disconnect(),d("Detached%c MutationObserver",s.HIGHLIGHT)}}}const ms={characterData:!0,childList:!0,subtree:!0};function hs(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,ms),d("Attached%c TitleObserver%c to head",s.HIGHLIGHT,s.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),d("Detached%c TitleObserver",s.HIGHLIGHT)}}}function gs(e){const t=new IntersectionObserver(o=>e(o.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),d("Attached%c VisibilityObserver%c to page",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{t.disconnect(),d("Detached%c VisibilityObserver",s.HIGHLIGHT)}}}let $t=new Set;function ps(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${X}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{m("overflowIgnored"),d(`Ignoring elements with [data-iframe-ignore] > *:
42
- `,n),j()}),t}function Sn(){const e=document.querySelectorAll(`[${_t}]`),t=ps(e);let n=!1;return typeof Set.prototype.symmetricDifference===ne&&(n=t.symmetricDifference($t).size>0),$t=t,c.overflowedNodeSet=t,c.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const S={},Tn=e=>{const t=new Set;for(const n of e){t.add(n);for(const o of tt(n))t.add(o)}return d(`Inspecting:
43
- `,t),t},ys=e=>{if(e.size===0)return;m("addObservers");const t=Tn(e);S.overflow.attachObservers(t),S.resize.attachObserverToNonStaticElements(t),j()},bs=e=>{if(e.size===0)return;m("removeObservers");const t=Tn(e);S.overflow.detachObservers(t),S.resize.detachObservers(t),j()};function vs({addedNodes:e,removedNodes:t}){m("contentMutated"),c.applySelectors(),pn(),Sn(),j(),bs(t),ys(e)}function ws(e){vs(e),H(Vt,"Mutation Observed")}const re="Overflow",zs=Se(re),Os=Se(re,!1),Es=zn(re),Is=On(re),Ss=e=>e.hidden||e.offsetParent===null||e.style.display===Ye,Ts=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||me,u=(z=!1)=>e(z),l=(z,M)=>z===0||z>M[n],p=(z,M)=>z.toggleAttribute(_t,M);function v(z){for(const M of z){const{boundingClientRect:W,rootBounds:V,target:$}=M;if(!V)continue;const $n=W[n],Ln=l($n,V)&&!Ss($);p($,Ln)}r(u)}const f=new IntersectionObserver(v,o),w=new WeakSet;function h(z){const M=new Set,W=new Set;let V=0;for(const $ of z)if($.nodeType===Node.ELEMENT_NODE){if(w.has($)){M.add($);continue}f.observe($),w.add($),W.add($),V+=1}Is(M),Es(W),zs(V),W.clear(),M.clear()}return{attachObservers:h,detachObservers:En(re,f,w,Os),disconnect:()=>{f.disconnect(),d("Detached%c OverflowObserver",s.HIGHLIGHT)}}};function Rs(){const{hasOverflow:e}=c,{hasOverflowUpdated:t,overflowedNodeSet:n}=Sn();switch(!0){case!t:return;case n.size>1:d("Overflowed Elements:",n);break;case e:break;default:d("No overflow detected")}H(Ze,"Overflow updated")}function Hs(e){const t={root:document.documentElement,side:i.calculateHeight?Ge:ke};return S.overflow=Ts(Rs,t),S.overflow.attachObservers(e),S.overflow}const se="Resize",Ms=Se(se),$s=Se(se,!1),Ls=zn(se),As=On(se),ve=new WeakSet,Le=new Set,Ae=new Set;let Q;function Ns(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const o=getComputedStyle(n)?.position;if(!(o===""||o==="static")){if(ve.has(n)){Le.add(n);continue}Q.observe(n),ve.add(n),Ae.add(n),t+=1}}As(Le),Ls(Ae),Ms(t),Ae.clear(),Le.clear()}const Cs=e=>(Q=new ResizeObserver(e),Q.observe(document.body),ve.add(document.body),d("Attached%c ResizeObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{attachObserverToNonStaticElements:Ns,detachObservers:En(se,Q,ve,$s),disconnect:()=>{Q.disconnect(),d("Detached%c ResizeObserver",s.HIGHLIGHT)}});function Gs(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;H(Wt,`Element resized <${to(t)}>`)}function ks(e){return S.resize=Cs(Gs),S.resize.attachObserverToNonStaticElements(e),S.resize}let Lt;function Ps(){const e=document.title;e!==Lt&&(Lt=e,a(`Title: %c${e}`,s.HIGHLIGHT),e&&y(0,0,Fn,e))}function Ds(e){a(`Visible: %c${e}`,s.HIGHLIGHT),c.isHidden=!e,H(qt,"Visibility changed")}function js(e){et.push(...e.map(t=>t.disconnect))}function xs(){m("attachObservers");const e=tt(document.documentElement),t=[fs(ws),Hs(e),Bo(),ks(e),hs(Ps),gs(Ds)];js(t)}const At=(e,t,n)=>{if(n!==""){a(`${e}: %c${n}`,s.HIGHLIGHT);for(const o of document.querySelectorAll(n))a(`Applying ${t} to:`,o),o.toggleAttribute(t,!0)}};function _s({sizeSelector:e,ignoreSelector:t}){return()=>{At("sizeSelector",Oe,e),At("ignoreSelector",X,t)}}function Bs(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Fs(e,t){return t.includes("-")&&(R(`Negative CSS value ignored for ${e}`),t=""),t}function Fe(e,t){t===void 0||t===""||t===Yn||(document.body.style.setProperty(e,t),d(`Set body ${e}: %c${t}`,s.HIGHLIGHT))}function Us({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),Fe("margin",Fs("margin",e))}const Ws=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Vs(e){const t=e.getBoundingClientRect(),n=Ws();return{x:parseInt(t.left,B)+parseInt(n.x,B),y:parseInt(t.top,B)+parseInt(n.y,B)}}function qs(e,t){const n=Vs(t);a(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),y(n.y,n.x,xt)}function it(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];if(o!==void 0){qs(t,o);return}a(`In page link (#${t}) not found in iframe, so sending to parent`),y(0,0,kn,`#${t}`)}function Rn(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&it(t)}function Zs(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&G(e,"click",t=>{t.preventDefault(),it(e.getAttribute("href"))})}function Ys(){G(window,"hashchange",Rn)}function Qs(){setTimeout(Rn,Qt)}function Js(){a("Setting up location.hash handlers"),Zs(),Ys(),Qs(),c.inPageLinks={findTarget:it}}function Ks(e){const{mode:t}=i;e?t===1?g(U(5)):Js():a("In page linking not enabled")}const Xs="important";function ei(){const e=t=>t.style.setProperty(ee,Ee,Xs);e(document.documentElement),e(document.body),a("Set HTML & body height: %cauto !important",s.HIGHLIGHT)}const ti="custom",ni=e=>`<rb>Deprecated Option(${e}CalculationMethod)</>
44
-
45
- 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.
46
-
47
- See <u>https://iframe-resizer.com/api/child</> for more details.
48
- `;function Nt(e,t){return typeof e!==ne?e:(g(ni(t)),t===ee?O.custom=e:E.custom=e,ti)}const ct=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ne=ct(ne),ce=ct(C),ae=ct(te),oi=e=>e!==null&&typeof e===Vn&&!Array.isArray(e);function ri(e){const{calculateHeight:t,calculateWidth:n}=i;let o,r;return typeof e?.offset===C&&(go(Re,He),t&&(o=ce(e,Re)),n&&(r=ce(e,Re))),typeof e?.offsetSize===C&&(t&&(o=ce(e,He)),n&&(r=ce(e,He))),{offsetHeight:o,offsetWidth:r}}function si(e){a("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=ri(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:ae(e,"ignoreSelector"),key2:ae(e,nr(0)),sizeSelector:ae(e,"sizeSelector"),targetOrigin:ae(e,"targetOrigin"),heightCalcMode:Nt(e?.heightCalculationMethod,ee),widthCalcMode:Nt(e?.widthCalculationMethod,Bt),onBeforeResize:Ne(e,"onBeforeResize"),onMessage:Ne(e,"onMessage"),onReady:Ne(e,"onReady")}}function ii(){const{mode:e}=i;if(e===1)return{};const t=window.iframeResizer||window.iFrameResizer;return oi(t)?si(t):{}}const ci=e=>e==="true",Hn=e=>t=>t===void 0?void 0:e(t),k=Hn(ci),Z=Hn(Number),ai=e=>({parentId:e[0],bodyMargin:Z(e[1]),calculateWidth:k(e[2]),logging:k(e[3]),autoResize:k(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:Z(e[11]),inPageLinks:k(e[12]),widthCalcMode:e[14],mouseEvents:k(e[15]),offsetHeight:Z(e[16]),offsetWidth:Z(e[17]),calculateHeight:k(e[18]),key:e[19],version:e[20],mode:Z(e[21]),logExpand:k(e[23])});function li(e){const{mode:t}=i;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;g(`<rb>Error in setup function</>
37
+ `;function Ur(e){const t=new Set;return new Proxy(e,{get(n,o,r){t.has(o)||(p(Br(o)),t.add(o));const d=Reflect.get(n,o,r),a=Object.getOwnPropertyDescriptor(n,o);return a&&!a.configurable&&!a.writable?d:typeof d=="function"?d.bind(n):d}})}function Vr(e,t){e!==void 0&&S(e,N,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&S(t,N,"parentIframe.resize(customHeight, customWidth) customWidth");const n=e===void 0?"":e,o=t===void 0?"":`,${t}`,r=`${n}${o}`;T(Be,`parentIframe.resize(${r})`,e,t)}const et=e=>(t,n)=>{S(t,N,`parentIframe.${e}(x, y) x`),S(n,N,`parentIframe.${e}(x, y) y`),y(n,t,e)},Wr=et(Dn),qr=et(_n),Zr=et(Pt);function Yr(e,t){t&&S(t,K,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),y(0,0,ke,JSON.stringify(e),t)}const Qr=()=>y(0,0,kn),Jr=()=>c.parentId,Kr=()=>kr("parentIframe.reset"),Xr=()=>D("parentIframe.size() has been renamed parentIframe.resize()");function es(){const{win:e}=i;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:Gr,close:Qr,getId:Jr,getOrigin:jr,getParentOrigin:Dr,getPageInfo:Fr,getParentProps:vn,getParentProperties:xr,moveToAnchor:Pr,reset:Kr,setOffsetSize:Cr,scrollBy:Wr,scrollTo:qr,scrollToOffset:Zr,sendMessage:Yr,setTargetOrigin:_r,resize:Vr,size:Xr}),e.parentIFrame=Ur(e.parentIframe))}const X=(e="")=>t=>n=>{n.size>0&&de(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[xe,o]))},ts=(e="")=>t=>n=>{n.size>0&&Xt(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[xe,o]))},bn=X("attached to"),zn=ts("already attached"),ns=X("detached from"),Oe=(e,t=!0)=>n=>{n>0&&u(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,s.HIGHLIGHT,s.NORMAL,s.HIGHLIGHT,s.NORMAL)},wn=(e,t,n,o)=>{const r=ns(e);return d=>{const a=new Set;let f=0;for(const b of d)n.has(b)&&(t.unobserve(b),n.delete(b),a.add(b),f+=1);r(a),o(f),a.clear()}},St=16,Tt=2,os=200,tt="Mutation",O=new Set,k=new Set,Ce=new Set,me=[],rs={attributes:!0,attributeFilter:[J,ye],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Me=1,nt,je=!1,De=0;const ss=X("added")(tt),is=X("removed (page)")(tt),cs=X("removed (added)")(tt),In=e=>e.nodeType!==Node.ELEMENT_NODE||Zt.has(e.tagName.toLowerCase());function as(e){const t=e.addedNodes;for(const n of t)In(n)||O.add(n)}function ls(e){const t=e.removedNodes;for(const n of t)In(n)||(O.has(n)?(O.delete(n),Ce.add(n)):k.add(n))}const ds=e=>{u("Mutations:",e);for(const t of e)as(t),ls(t);ss(O),is(k),cs(Ce),Ce.clear()};function us(){k.size>0&&l(`Detected %c${k.size} %cremoved element${k.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND),O.size>0&&l(`Found %c${O.size} %cnew element${O.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND)}const fs=e=>()=>{const t=performance.now(),n=t-De,o=St*Me+++Tt;if(n>o&&n<os){h("mutationThrottled"),u("Update delayed due to heavy workload on the callStack"),u(`EventLoop busy time: %c${C(n)}ms %c> Max wait: %c${o-Tt}ms`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),setTimeout(nt,St*Me),De=t;return}Me=1,me.forEach(ds),me.length=0,je=!1,us(),e({addedNodes:O,removedNodes:k}),O.clear(),k.clear()};function ms(e){me.push(e),!je&&(De=performance.now(),je=!0,requestAnimationFrame(nt))}function hs(e){const t=new window.MutationObserver(ms),n=document.body||document.documentElement;return nt=fs(e),t.observe(n,rs),u("Attached%c MutationObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{O.clear(),k.clear(),me.length=0,t.disconnect(),u("Detached%c MutationObserver",s.HIGHLIGHT)}}}const gs={characterData:!0,childList:!0,subtree:!0};function ps(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,gs),u("Attached%c TitleObserver%c to head",s.HIGHLIGHT,s.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),u("Detached%c TitleObserver",s.HIGHLIGHT)}}}function ys(e){const t=new IntersectionObserver(o=>e(o.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),u("Attached%c VisibilityObserver%c to page",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{t.disconnect(),u("Detached%c VisibilityObserver",s.HIGHLIGHT)}}}let Rt=new Set;function vs(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${J}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{h("overflowIgnored"),u(`Ignoring elements with [data-iframe-ignore] > *:
38
+ `,n),_()}),t}function On(){const e=document.querySelectorAll(`[${Ct}]`),t=vs(e);let n=!0;return typeof Set.prototype.symmetricDifference===be&&(n=t.symmetricDifference(Rt).size>0),Rt=t,i.overflowedNodeSet=t,i.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const E={},En=e=>{const t=new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const o of Ke(n))t.add(o)}return u(`Inspecting:
39
+ `,t),t},bs=e=>{if(e.size===0)return;h("addObservers");const t=En(e);E.overflow.attachObservers(t),E.resize.attachObserverToNonStaticElements(t),_()},zs=e=>{if(e.size===0)return;h("removeObservers");const t=En(e);E.overflow.detachObservers(t),E.resize.detachObservers(t),_()};function ws({addedNodes:e,removedNodes:t}){h("contentMutated"),i.applySelectors(),hn(),On(),_(),zs(t),bs(e)}function Is(e){ws(e),T(Ut,"Mutation Observed")}const ee="Overflow",Os=Oe(ee),Es=Oe(ee,!1),Ss=bn(ee),Ts=zn(ee),Rs=e=>e instanceof HTMLElement&&(!!e.hidden||e.offsetParent===null||e.style.display===We),Hs=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||le,d=(w=!1)=>e(w),a=(w,R)=>w===0||w>R[n],f=(w,R)=>{w.toggleAttribute(Ct,R)};function b(w){for(const R of w){const{boundingClientRect:U,rootBounds:V,target:I}=R;if(!V)continue;const Hn=U[n],Mn=a(Hn,V)&&!(I instanceof HTMLElement&&Rs(I));f(I,Mn)}r(d)}const m=new IntersectionObserver(b,o),z=new WeakSet;function g(w){const R=new Set,U=new Set;let V=0;for(const I of w)if(I instanceof Element){if(z.has(I)){R.add(I);continue}m.observe(I),z.add(I),U.add(I),V+=1}Ts(R),Ss(U),Os(V),U.clear(),R.clear()}return{attachObservers:g,detachObservers:wn(ee,m,z,Es),disconnect:()=>{m.disconnect(),u("Detached%c OverflowObserver",s.HIGHLIGHT)}}};function Ms(){const{hasOverflow:e}=i,{hasOverflowUpdated:t,overflowedNodeSet:n}=On();switch(!0){case!t:return;case n.size>1:u("Overflowed Elements:",n);break;case e:break;default:u("No overflow detected")}T(Ve,"Overflow updated")}function $s(e){const t={root:document.documentElement,side:c.calculateHeight?_t:Ft};return E.overflow=Hs(Ms,t),E.overflow.attachObservers(e),E.overflow}const te="Resize",As=Oe(te),Ls=Oe(te,!1),ks=bn(te),Ns=zn(te),he=new WeakSet,$e=new Set,Ae=new Set;let Z;function Gs(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const o=getComputedStyle(n)?.position;if(!(o===""||o==="static")){if(he.has(n)){$e.add(n);continue}Z.observe(n),he.add(n),Ae.add(n),t+=1}}Ns($e),ks(Ae),As(t),Ae.clear(),$e.clear()}const Ps=e=>(Z=new ResizeObserver(e),Z.observe(document.body),he.add(document.body),u("Attached%c ResizeObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{attachObserverToNonStaticElements:Gs,detachObservers:wn(te,Z,he,Ls),disconnect:()=>{Z.disconnect(),u("Detached%c ResizeObserver",s.HIGHLIGHT)}});function Cs(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;T(Bt,`Element resized <${Xn(t)}>`)}function js(e){return E.resize=Ps(Cs),E.resize.attachObserverToNonStaticElements(e),E.resize}let Ht;function Ds(){const e=document.title;e!==Ht&&(Ht=e,l(`Title: %c${e}`,s.HIGHLIGHT),e&&y(0,0,Fn,e))}function _s(e){l(`Visible: %c${e}`,s.HIGHLIGHT),i.isHidden=!e,T(Vt,"Visibility changed")}function Fs(e){Qe.push(...e.map(t=>t.disconnect))}function xs(){h("attachObservers");const e=Ke(document.documentElement),t=[hs(Is),$s(e),jo(),js(e),ps(Ds),ys(_s)];Fs(t)}const Mt=(e,t,n)=>{if(n!==""){l(`${e}: %c${n}`,s.HIGHLIGHT);for(const o of document.querySelectorAll(n))l(`Applying ${t} to:`,o),o.toggleAttribute(t,!0)}};function Bs({sizeSelector:e,ignoreSelector:t}){return()=>{Mt("sizeSelector",ye,e),Mt("ignoreSelector",J,t)}}function Us(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Vs(e,t){return t.includes("-")&&(D(`Negative CSS value ignored for ${e}`),t=""),t}function _e(e,t){t===void 0||t===""||t===Wn||(document.body.style.setProperty(e,t),u(`Set body ${e}: %c${t}`,s.HIGHLIGHT))}function Ws({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),_e("margin",Vs("margin",e))}const qs=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Zs(e){const t=e.getBoundingClientRect(),n=qs();return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function Ys(e,t){const n=Zs(t);l(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),y(n.y,n.x,Pt)}function ot(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];if(o!==void 0){Ys(t,o);return}l(`In page link (#${t}) not found in iframe, so sending to parent`),y(0,0,Nn,`#${t}`)}function Sn(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&ot(t)}function Qs(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&G(e,"click",t=>{t.preventDefault(),ot(e.getAttribute("href"))})}function Js(){G(window,"hashchange",Sn)}function Ks(){setTimeout(Sn,qt)}function Xs(){l("Setting up location.hash handlers"),Qs(),Js(),Ks(),i.inPageLinks={findTarget:ot}}function ei(e){const{mode:t}=c;e?Xe(t)?p($(5)):Xs():l("In page linking not enabled")}const ti="important";function ni(){const e=t=>t.style.setProperty(ve,L,ti);e(document.documentElement),e(document.body),l("Set HTML & body height: %cauto !important",s.HIGHLIGHT)}const rt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Le=rt(be),oe=rt(N),re=rt(K),oi=e=>e!==null&&typeof e===Bn&&!Array.isArray(e);function ri(e){const{calculateHeight:t,calculateWidth:n}=c;let o,r;return typeof e?.offset===N&&(ho(Se,Te),t&&(o=oe(e,Se)),n&&(r=oe(e,Se))),typeof e?.offsetSize===N&&(t&&(o=oe(e,Te)),n&&(r=oe(e,Te))),{offsetHeight:o,offsetWidth:r}}function si(e){l("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=ri(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:re(e,"ignoreSelector"),[bt(3)]:re(e,bt(0)),sizeSelector:re(e,"sizeSelector"),targetOrigin:re(e,"targetOrigin"),onBeforeResize:Le(e,"onBeforeResize"),onMessage:Le(e,"onMessage"),onReady:Le(e,"onReady")}}function ii(){const{mode:e}=c;if(Xe(e))return{};const t=window.iframeResizer||window.iFrameResizer;return oi(t)?si(t):{}}const ci=e=>e==="true",Tn=e=>t=>t===void 0?void 0:e(t),P=Tn(ci),q=Tn(Number),ai=e=>({parentId:e[0],bodyMargin:q(e[1]),calculateWidth:P(e[2]),logging:P(e[3]),autoResize:P(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:q(e[11]),inPageLinks:P(e[12]),widthCalcMode:e[14],mouseEvents:P(e[15]),offsetHeight:q(e[16]),offsetWidth:q(e[17]),calculateHeight:P(e[18]),key:e[19],version:e[20],mode:q(e[21]),logExpand:P(e[23])});function li(e){const{mode:t}=c;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;p(`<rb>Error in setup function</>
49
40
  <i>iframe-resizer</> detected an error during setup.
50
41
 
51
- Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),nn(o)}})}function Ct(e){for(const[t,n]of Object.entries(e))n!==void 0&&(i[t]=n)}function di({logExpand:e,logging:t,parentId:n}){uo({id:n,enabled:t,expand:e}),m("initReceived"),a(`Initialising iframe v${D} ${window.location.href}`)}function ui(e){m("ready"),gn(Kt(e)),a("Initialization complete",(({key:t,key2:n,...o})=>o)(i))}function fi({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const r=Mo(i),u=[()=>ur(i),()=>or(i),Ko,Zo,mn,hn,Qo,ir,pn,ar,r?me:Ho,()=>Us(i),()=>Fe("background",e),()=>Fe("padding",t),r?me:ei,Bs,c.applySelectors,()=>Ks(n),Rr,()=>yr(i),wr,()=>Kr(),()=>H(ze,"Init message from host page",void 0,void 0,`${D}:${i.mode}`),xs,j];li(u),ui(o)}function mi(e){c.firstRun&&(Ct(ai(e)),di(i),Ct(ii()),c.applySelectors=_s(i),fi(i))}function hi(e){if(document.readyState==="loading"){a("Page not ready, ignoring init message");return}const t=e.data.slice(Zt).split(we);c.target=e.source,c.origin=e.origin,mi(t),c.firstRun=!1,setTimeout(()=>{c.initLock=!1},Qt)}const{freeze:gi}=Object,{parse:at}=JSON,lt=e=>gi(at(e)),Mn=e=>y(0,0,`${e}Stop`),Te=e=>e.data.slice(e.data.indexOf(we)+1),pi=e=>bo(e)?ze:e.data.split("]")[1].split(we)[0];function yi(e){const t=Te(e);a("onMessage called from parent:%c",s.HIGHLIGHT,lt(t)),Ie(i.onMessage,at(t))}function bi(e){const{onPageInfo:t}=c,n=Te(e);a("PageInfo received from parent:",lt(n)),t?Ie(t,at(n)):Mn(Dt)}function vi(e){const{onParentInfo:t}=c,n=lt(Te(e));a("ParentInfo received from parent:",n),t?Ie(t,n):Mn(jt)}function wi(){if(c.initLock){a("Page reset ignored by init");return}a("Page size reset by host page"),vn("resetPage")}function zi(){a("Resize requested by host page"),H(qe,"Parent window requested size check")}const Gt=e=>c.inPageLinks.findTarget(Te(e)),kt={init:hi,reset:wi,resize:zi,moveToAnchor:Gt,inPageLink:Gt,pageInfo:bi,parentInfo:vi,message:yi};function Oi(e){const{firstRun:t}=c,n=pi(e);switch(m(n),!0){case n in kt:kt[n](e);break;case(t&&yo()):R(`Ignored message of type "${n}". Received before initialization.`);break;default:R(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const le=Ke(e=>{po(e)&&Oi(e)});function Ei(){if("iframeChildListener"in window){R("Already setup");return}window.iframeChildListener=t=>setTimeout(()=>le({data:t,sameOrigin:!0})),m("listen"),G(window,Ce,le),G(document,Ft,pt),pt();function e(t){return le(t),c.win}try{top?.document?.getElementById("banner")&&(c.win={},window.mockMsgListener=e,sn(window,Ce,le),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==qn&&Ei();
42
+ Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Xt(o)}})}function $t(e){for(const[t,n]of Object.entries(e))n!==void 0&&(c[t]=n)}function di({logExpand:e,logging:t,parentId:n=""}){ao({id:n,enabled:t,expand:e}),h("initReceived"),l(`Initialising iframe v${j} ${window.location.href}`)}function ui(e){h("ready"),mn(Yt(e)),l("Initialization complete",(({key:t,key2:n,...o})=>o)(c))}function fi({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const r=Ho(c),d=[Yo,Vo,Bo,Uo,qo,lr,hn,ur,r?le:Ro,()=>Ws(c),()=>_e("background",e),()=>_e("padding",t),r?le:ni,Us,i.applySelectors,()=>ei(n),Ar,()=>zr(c),Or,()=>es(),()=>T(pe,"Init message from host page",void 0,void 0,`${j}:${c.mode}`),xs,_];hr(c),ir(c),li(d),ui(o)}function mi(e){i.firstRun&&($t(ai(e)),di(c),$t(ii()),i.applySelectors=Bs(c),fi(c))}function hi(e){if(document.readyState==="loading"){l("Page not ready, ignoring init message");return}const t=e.data.slice(Wt).split(ge);i.target=e.source,i.origin=e.origin,mi(t),i.firstRun=!1,setTimeout(()=>{i.initLock=!1},qt)}const{freeze:gi}=Object,{parse:st}=JSON,it=e=>gi(st(e)),Rn=e=>y(0,0,`${e}Stop`),Ee=e=>e.data.slice(e.data.indexOf(ge)+1),pi=e=>yo(e)?pe:e.data.split("]")[1].split(ge)[0];function yi(e){const t=Ee(e);l("onMessage called from parent:%c",s.HIGHLIGHT,it(t)),ze(c.onMessage,st(t))}function vi(e){const{onPageInfo:t}=i,n=Ee(e);l("PageInfo received from parent:",it(n)),t?ze(t,st(n)):Rn(Nt)}function bi(e){const{onParentInfo:t}=i,n=it(Ee(e));l("ParentInfo received from parent:",n),t?ze(t,n):Rn(Gt)}function zi(){if(i.initLock){l("Page reset ignored by init");return}l("Page size reset by host page"),yn("resetPage")}function wi(){l("Resize requested by host page"),T(Ue,"Parent window requested size check")}const At=e=>i.inPageLinks.findTarget(Ee(e)),Lt={init:hi,reset:zi,resize:wi,moveToAnchor:At,inPageLink:At,pageInfo:vi,parentInfo:bi,message:yi};function Ii(e){const{firstRun:t}=i,n=pi(e);switch(h(n),!0){case n in Lt:Lt[n](e);break;case(t&&po()):D(`Ignored message of type "${n}". Received before initialization.`);break;default:D(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const se=Ze(e=>{go(e)&&Ii(e)});function Oi(){if("iframeChildListener"in window){D("Already setup");return}window.iframeChildListener=(t=>setTimeout(()=>se({data:t,sameOrigin:!0}))),h("listen"),G(window,ke,se),G(document,Dt,ft),ft();function e(t){return se(t),i.win}try{top?.document?.getElementById("banner")&&(i.win={},window.mockMsgListener=e,nn(window,ke,se),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==Un&&Oi();
52
43
  //# sourceMappingURL=index.cjs.js.map