New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iframe-resizer

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iframe-resizer - npm Package Compare versions

Comparing version 5.1.5-beta.1 to 5.2.3

18

index.cjs.js
/*!
* @preserve
*
* @module iframe-resizer/legacy 5.1.5-beta.1 (cjs) - 2024-07-10
* @module iframe-resizer/legacy 5.2.3 (cjs) - 2024-08-05
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @desciption Keep same and cross domain iFrames sized to their content
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
* @see {@link https://iframe-resizer.com}
*

@@ -30,3 +30,3 @@ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.

Version 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.
Going forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.

@@ -36,3 +36,3 @@ Please see https://iframe-resizer.com/upgrade for more details.

console.warn(msg);
console.info(msg);

@@ -39,0 +39,0 @@ const index_esm = {

/*!
* @preserve
*
* @module iframe-resizer/legacy 5.1.5-beta.1 (esm) - 2024-07-10
* @module iframe-resizer/legacy 5.2.3 (esm) - 2024-08-05
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @desciption Keep same and cross domain iFrames sized to their content
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
* @see {@link https://iframe-resizer.com}
*

@@ -28,3 +28,3 @@ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.

Version 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.
Going forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.

@@ -34,3 +34,3 @@ Please see https://iframe-resizer.com/upgrade for more details.

console.warn(msg);
console.info(msg);

@@ -37,0 +37,0 @@ const index_esm = {

/*!
* @preserve
*
* @module iframe-resizer/legacy (child) 5.1.5-beta.1 (iife)
* @module iframe-resizer/legacy (child) 5.2.3 (iife)
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @desciption Keep same and cross domain iFrames sized to their content
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
* @see {@link https://iframe-resizer.com}
*

@@ -20,2 +20,2 @@ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.

!function(){"use strict";const e="5.1.5-beta.1",t=10,n="data-iframe-size";const o=(e,t,n,o)=>e.addEventListener(t,n,o||!1),i=(e,t,n)=>e.removeEventListener(t,n,!1),r=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const a=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(r[e]),l={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},c={height:()=>(de("Custom height calculation function not defined"),He.auto()),width:()=>(de("Custom width calculation function not defined"),Ue.auto())},s={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},u=128,d={},m="checkVisibility"in window,f="auto",p="[iFrameSizer]",h=p.length,y={max:1,min:1,bodyScroll:1,documentElementScroll:1},g=["body"],v="scroll";let b,w,z=!0,S="",$=0,j="",E=null,P="",O=!0,M=!1,A=null,C=!0,T=!1,k=1,I=f,x=!0,N="",R={},B=!0,q=!1,L=0,W=!1,D="",H="child",U=null,F=!1,V="",J=window.parent,Z="*",Q=0,X=!1,Y="",G=1,K=v,_=window,ee=()=>{de("onMessage function not defined")},te=()=>{},ne=null,oe=null;const ie=e=>""!=`${e}`&&void 0!==e,re=new WeakSet,ae=e=>"object"==typeof e&&re.add(e);function le(e){switch(!0){case!ie(e):return"";case ie(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ie(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ie(e.className)?`.${e.className}`:"")}}function ce(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\n"," ")}...`:e}const se=(...e)=>[`[iframe-resizer][${D}]`,...e].join(" "),ue=(...e)=>console?.info(se(...e)),de=(...e)=>console?.warn(se(...e)),me=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(se)(...e)),fe=e=>me(e);function pe(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=N.slice(h).split(":");D=t[0],$=void 0===t[1]?$:Number(t[1]),M=void 0===t[2]?M:e(t[2]),q=void 0===t[3]?q:e(t[3]),z=void 0===t[6]?z:e(t[6]),j=t[7],I=void 0===t[8]?I:t[8],S=t[9],P=t[10],Q=void 0===t[11]?Q:Number(t[11]),R.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],K=void 0===t[14]?K:t[14],W=void 0===t[15]?W:e(t[15]),b=void 0===t[16]?b:Number(t[16]),w=void 0===t[17]?w:Number(t[17]),O=void 0===t[18]?O:e(t[18]),t[19],Y=t[20]||Y,L=void 0===t[21]?L:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;ee=e?.onMessage||ee,te=e?.onReady||te,"number"==typeof e?.offset&&(O&&(b=e?.offset),M&&(w=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(V=e.sizeSelector),Z=e?.targetOrigin||Z,I=e?.heightCalculationMethod||I,K=e?.widthCalculationMethod||K}function t(e,t){return"function"==typeof e&&(c[t]=e,e="custom"),e}if(1===L)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),I=t(I,"height"),K=t(K,"width"))}(),function(){void 0===j&&(j=`${$}px`);he("margin",function(e,t){t.includes("-")&&(de(`Negative CSS value ignored for ${e}`),t="");return t}("margin",j))}(),he("background",S),he("padding",P),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),ye(),L<0?fe(`${a(L+2)}${a(2)}`):Y.codePointAt(0)>4||L<2&&fe(a(3)),function(){if(!Y||""===Y||"false"===Y)return void me("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n");Y!==e&&me(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Y} - Child page: ${e}.\n`)}(),ze(),Se(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.setAttribute(n,null)}));t("data-iframe-height"),t("data-iframe-width"),e&&me("<rb>Deprecated Attributes</>\n \nThe <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</>.")}(),document.querySelectorAll(`[${n}]`).length>0&&("auto"===I&&(I="autoOverflow"),"auto"===K&&(K="autoOverflow")),be(),function(){if(1===L)return;_.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===z?(z=!0,$e()):!1===e&&!0===z&&(z=!1,ve("remove"),U?.disconnect(),E?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(z)),z),close(){Xe(0,0,"close")},getId:()=>D,getPageInfo(e){if("function"==typeof e)return ne=e,Xe(0,0,"pageInfo"),void me("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ne=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return oe=e,Xe(0,0,"parentInfo"),()=>{oe=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){me("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){R.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){I=e,ze()},setWidthCalculationMethod(e){K=e,Se()},setTargetOrigin(e){Z=e},resize(e,t){Ve("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){me("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),_.parentIFrame=_.parentIframe}(),function(){if(!0!==W)return;function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){o(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),$e(),R=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function i(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&o(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){o(window,"hashchange",r)}function c(){setTimeout(r,u)}function s(){a(),l(),c()}R.enable&&(1===L?me("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:i}}(),ae(document.documentElement),ae(document.body),Ve("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),te(),B=!1}function he(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ye(){""!==V&&document.querySelectorAll(V).forEach((e=>{e.dataset.iframeSize=!0}))}function ge(e){({add(t){function n(){Ve(e.eventName,e.eventType)}d[t]=n,o(window,t,n,{passive:!0})},remove(e){const t=d[e];delete d[e],i(window,e,t)}})[e.method](e.eventName)}function ve(e){ge({method:e,eventType:"After Print",eventName:"afterprint"}),ge({method:e,eventType:"Before Print",eventName:"beforeprint"}),ge({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function be(){const e=document.querySelectorAll(`[${n}]`);T=e.length>0,A=T?e:Re(document)()}function we(e,t,n,o){return t!==e&&(e in n||(de(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in s&&me(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function ze(){I=we(I,f,He,"height")}function Se(){K=we(K,v,Ue,"width")}function $e(){!0===z&&(ve("add"),E=function(){function e(e){e.forEach(Te),ye(),be()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),U=new ResizeObserver(Ee),Ce(window.document))}let je;function Ee(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;je=()=>Ve("resizeObserver",`Resize Observed: ${le(t)}`),setTimeout((()=>{je&&je(),je=void 0}),0)}const Pe=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Oe=()=>[...Re(document)()].filter(Pe),Me=new WeakSet;function Ae(e){e&&(Me.has(e)||(U.observe(e),Me.add(e)))}function Ce(e){[...Oe(),...g.flatMap((t=>e.querySelector(t)))].forEach(Ae)}function Te(e){"childList"===e.type&&Ce(e.target)}let ke=4,Ie=4;function xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=A.length,r=document.documentElement,a=T?0:document.documentElement.getBoundingClientRect().bottom,c=performance.now();var s;A.forEach((t=>{T||!m||t.checkVisibility(l)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>a&&(a=o,r=t)):i-=1})),c=performance.now()-c,i>1&&(s=r,re.has(s)||(ae(s),ue(`\nHeight calculated from: ${le(s)} (${ce(s)})`)));const u=`\nParsed ${i} element${1===i?"":"s"} in ${c.toPrecision(3)}ms\n${t} ${T?"tagged ":""}element found at: ${a}px\nPosition calculated from HTML element: ${le(r)} (${ce(r,100)})`;return c<4||i<99||T||B||ke<c&&ke<Ie&&(ke=1.2*c,me(`<rb>Performance Warning</>\n\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\n${u}`)),Ie=c,a}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Re=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)");let Be=!1;function qe({ceilBoundingSize:e,dimension:t,getDimension:n,isHeight:o,scrollSize:i}){if(!Be)return Be=!0,n.taggedElement();const r=o?"bottom":"right";return me(`<rb>Detected content overflowing html element</>\n \nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${r} margin, and position of every visible HTML element will have a performance impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \n \nWhen present the ${r} margin of the ${o?"lowest":"right most"} element with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\n\nMore info: https://iframe-resizer.com/performance.\n\n(Page size: ${i} > document size: ${e})`),o?I="autoOverflow":K="autoOverflow",n.taggedElement()}const Le={height:0,width:0},We={height:0,width:0};function De(e,t){function n(){return We[i]=r,Le[i]=c,r}const o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===We[i]&&0===Le[i]:if(e.taggedElement(!0)<=a)return n();break;case X&&r===We[i]&&c===Le[i]:return Math.max(r,c);case 0===r:return c;case!t&&r!==We[i]&&c<=Le[i]:return n();case!o:return t?e.taggedElement():qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c});case!t&&r<We[i]:case c===l||c===a:case r>c:return n();case!t:return qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const He={enabled:()=>O,getOffset:()=>b,type:"height",auto:()=>De(He,!1),autoOverflow:()=>De(He,!0),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>c.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ne(He)),min:()=>Math.min(...Ne(He)),grow:()=>He.max(),lowestElement:()=>xe("bottom"),taggedElement:()=>xe("bottom")},Ue={enabled:()=>M,getOffset:()=>w,type:"width",auto:()=>De(Ue,!1),autoOverflow:()=>De(Ue,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>c.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ne(Ue)),min:()=>Math.min(...Ne(Ue)),rightMostElement:()=>xe("right"),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>xe("right")};function Fe(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Q);return r=void 0===n?He[I]():n,a=void 0===o?Ue[K]():o,O&&e(k,r)||M&&e(G,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(O&&I in y||M&&K in y)&&Qe():(Je(),k=r,G=a,Xe(k,G,e,i))}function Ve(e,t,n,o,i){document.hidden||Fe(e,0,n,o,i)}function Je(){X||(X=!0,requestAnimationFrame((()=>{X=!1})))}function Ze(e){k=He[I](),G=Ue[K](),Xe(k,G,e)}function Qe(e){const t=I;I=f,Je(),Ze("reset"),I=t}function Xe(e,t,n,o,i){L<-1||(void 0!==i||(i=Z),function(){const r=`${D}:${`${e+(b||0)}:${t+(w||0)}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(p+r):J.postMessage(p+r,i)}())}function Ye(e){const t={init:function(){N=e.data,J=e.source,pe(),C=!1,setTimeout((()=>{x=!1}),u)},reset(){x||Ze("resetPage")},resize(){Ve("resizeParent")},moveToAnchor(){R.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ne?ne(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();oe?oe(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();ee(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};p===`${e.data}`.slice(0,h)&&(!1!==C?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||de(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),o(window,"message",Ye),o(window,"readystatechange",Ge),Ge())}();
!function(){"use strict";const e="5.2.3",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="";const m=e=>""!=`${e}`&&void 0!==e;const f=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),p=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),h=(...e)=>console?.warn(f(...e)),y=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(f)(...e)),g=e=>y(e);let v=[];const b=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),v=document.querySelectorAll(`[${o}]`),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},w=()=>v.length>0,z=1e5,S="--ifr-start",E="--ifr-end",j="--ifr-measure",$=[],P=new WeakSet,C=e=>"object"==typeof e&&P.add(e),O=e=>Math.floor(e*z)/z;let A=null,M=null,T={};const k=setInterval((()=>{if($.length<10)return;if(T.hasTags&&T.len<25)return;$.sort();const e=Math.min($.reduce(((e,t)=>e+t),0)/$.length,$[Math.floor($.length/2)]);e<=4||(clearInterval(k),y(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${O(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${T.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function I(e){e.getEntries().forEach((e=>{if(e.name===E){const{duration:t}=performance.measure(j,S,E);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;T=e,P.has(M)||A===M||i&&o<=1||(r||C(M),A=M,p(`\n${n} position calculated from:`,M,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${O(t)}ms`))}(e.detail,t),$.push(t),$.length>100&&$.shift()}}))}function N(){new PerformanceObserver(I).observe({entryTypes:["mark"]}),C(document.documentElement),C(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",N):N()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(h("Custom height calculation function not defined"),Ue.auto()),width:()=>(h("Custom width calculation function not defined"),De.auto())},f={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},p=128,z={},j="checkVisibility"in window,$="auto",P="[iFrameSizer]",C=P.length,O={max:1,min:1,bodyScroll:1,documentElementScroll:1},A=["body"],T="scroll";let k,I,N=!0,R="",x=0,B="",q=null,W="",L=!0,F=!1,U=!0,D=!1,V=1,J=$,H=!0,Z="",Q={},X=!1,Y=0,G=!1,K="",_=d,ee="child",te=null,ne=!1,oe="",ie=[],re=window.parent,ae="*",le=0,se=!1,ce="",de=1,ue=T,me=window,fe=()=>{h("onMessage function not defined")},pe=()=>{},he=null,ye=null;function ge(){var o,d;!function(){const e=e=>"true"===e,t=Z.slice(C).split(":");K=t[0],x=void 0===t[1]?x:Number(t[1]),F=void 0===t[2]?F:e(t[2]),X=void 0===t[3]?X:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],J=void 0===t[8]?J:t[8],R=t[9],W=t[10],le=void 0===t[11]?le:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ee=void 0===t[13]?ee:t[13],ue=void 0===t[14]?ue:t[14],G=void 0===t[15]?G:e(t[15]),k=void 0===t[16]?k:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),L=void 0===t[18]?L:e(t[18]),t[19],ce=t[20]||ce,Y=void 0===t[21]?Y:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;fe=e?.onMessage||fe,pe=e?.onReady||pe,"number"==typeof e?.offset&&(y("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),L&&(k=e?.offset),F&&(I=e?.offset)),"number"==typeof e?.offsetSize&&(L&&(k=e?.offsetSize),F&&(I=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(oe=e.sizeSelector),ae=e?.targetOrigin||ae,J=e?.heightCalculationMethod||J,ue=e?.widthCalculationMethod||ue}function t(e,t){return"function"==typeof e&&(l[t]=e,e="custom"),e}1!==Y&&"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),J=t(J,"height"),ue=t(ue,"width"))}(),u={id:K,logging:X}.id,function(){try{ne="iframeParentListener"in window.parent}catch(e){}}(),Y<0?g(`${s(Y+2)}${s(2)}`):ce.codePointAt(0)>4||Y<2&&g(s(3)),ce&&""!==ce&&"false"!==ce?ce!==e&&y(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ce} - Child page: ${e}.\n`):y("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&y("<rb>Deprecated Attributes</>\n \nThe <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</>.")}(),be(),L!==F&&(_=b({onChange:c(ve),side:L?i:r})),1!==Y&&(me.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,Oe()):!1===e&&!0===N&&(N=!1,je("remove"),te?.disconnect(),q?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(N)),N),close(){Xe(0,0,"close")},getId:()=>K,getPageInfo(e){if("function"==typeof e)return he=e,Xe(0,0,"pageInfo"),void y("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");he=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ye=e,Xe(0,0,"parentInfo"),()=>{ye=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){y("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Q.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){J=e,Pe()},setWidthCalculationMethod(e){ue=e,Ce()},setTargetOrigin(e){ae=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){y("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),me.parentIFrame=me.parentIframe),function(){function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){a(window.document,t,e)}!0===G&&(t("mouseenter"),t("mouseleave"))}(),Q=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,p)}function c(){r(),l(),s()}return Q.enable&&(1===Y?y("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),we(qe(document)()),void 0===B&&(B=`${x}px`),ze("margin",(o="margin",(d=B).includes("-")&&(h(`Negative CSS value ignored for ${o}`),d=""),d)),ze("background",R),ze("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),Se()}const ve=()=>{Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),Oe(),pe()};function be(){ie=document.querySelectorAll(`[${n}]`),D=ie.length>0}function we(e){D?setTimeout(ve):_(e)}function ze(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Se(){""!==oe&&document.querySelectorAll(oe).forEach((e=>{e.dataset.iframeSize=!0}))}function Ee(e){({add(t){function n(){Je(e.eventName,e.eventType)}z[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=z[e];var n,o;delete z[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function je(e){Ee({method:e,eventType:"After Print",eventName:"afterprint"}),Ee({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ee({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function $e(e,t,n,o){return t!==e&&(e in n||(h(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in f&&y(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function Pe(){J=$e(J,$,Ue,"height")}function Ce(){ue=$e(ue,T,De,"width")}function Oe(){!0===N&&(je("add"),q=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n;if(u>r*s+++a&&u<l)return setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Se(),be(),we(e),e.forEach(Re),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}const m=u();return{disconnect(){m.disconnect()}}}(),te=new ResizeObserver(Me),Re(window.document))}let Ae;function Me(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ae=()=>Je("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!m(e):return"";case m(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case m(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(m(e.className)?`.${e.className}`:"")}}(t)}`),setTimeout((()=>{Ae&&Ae(),Ae=void 0}),0)}const Te=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...qe(document)()].filter(Te),Ie=new WeakSet;function Ne(e){e&&(Ie.has(e)||(te.observe(e),Ie.add(e)))}function Re(e){[...ke(),...A.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function xe(e){performance.mark(S);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=D?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(S);const l=D?ie:w()?v:qe(document)();let s=l.length;return l.forEach((t=>{D||!j||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1})),M=r,performance.mark(E,{detail:{Side:t,len:s,hasTags:D,logging:X}}),a}const Be=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],qe=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),We={height:0,width:0},Le={height:0,width:0};function Fe(e){function t(){return Le[i]=r,We[i]=s,r}const n=w(),o=e===Ue,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case D:return e.taggedElement();case!n&&0===Le[i]&&0===We[i]:return t();case se&&r===Le[i]&&s===We[i]:return Math.max(r,s);case 0===r:return s;case!n&&r!==Le[i]&&s<=We[i]:return t();case!o:return e.taggedElement();case!n&&r<Le[i]:case s===l||s===a:case r>s:return t()}return Math.max(e.taggedElement(),t())}const Ue={enabled:()=>L,getOffset:()=>k,auto:()=>Fe(Ue),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ue.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Be(Ue)),min:()=>Math.min(...Be(Ue)),grow:()=>Ue.max(),lowestElement:()=>xe(i),taggedElement:()=>xe(i)},De={enabled:()=>F,getOffset:()=>I,auto:()=>Fe(De),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Be(De)),min:()=>Math.min(...Be(De)),rightMostElement:()=>xe(r),scroll:()=>Math.max(De.bodyScroll(),De.documentElementScroll()),taggedElement:()=>xe(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=le);return r=void 0===n?Ue[J]():n,a=void 0===o?De[ue]():o,L&&e(V,r)||F&&e(de,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(L&&J in O||F&&ue in O)&&Qe():(He(),V=r,de=a,Xe(V,de,e,i))}function Je(e,t,n,o,i){document.hidden||Ve(e,0,n,o,i)}function He(){se||(se=!0,requestAnimationFrame((()=>{se=!1})))}function Ze(e){V=Ue[J](),de=De[ue](),Xe(V,de,e)}function Qe(e){const t=J;J=$,He(),Ze("reset"),J=t}function Xe(e,t,n,o,i){Y<-1||(void 0!==i||(i=ae),function(){const r=`${K}:${e+(k||0)}:${t+(I||0)}:${n}${void 0===o?"":`:${o}`}`;ne?window.parent.iframeParentListener(P+r):re.postMessage(P+r,i)}())}function Ye(e){const t={init:function(){Z=e.data,re=e.source,ge(),U=!1,setTimeout((()=>{H=!1}),p)},reset(){H||Ze("resetPage")},resize(){Je("resizeParent")},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();he?he(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();ye?ye(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();fe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};P===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||h(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),a(window,"message",Ye),a(window,"readystatechange",Ge),Ge()}()}();
/*!
* @preserve
*
* @module iframe-resizer/legacy (child) 5.1.5-beta.1 (iife)
* @module iframe-resizer/legacy (child) 5.2.3 (iife)
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @desciption Keep same and cross domain iFrames sized to their content
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
* @see {@link https://iframe-resizer.com}
*

@@ -20,2 +20,2 @@ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.

!function(){"use strict";const e="5.1.5-beta.1",t=10,n="data-iframe-size";const o=(e,t,n,o)=>e.addEventListener(t,n,o||!1),i=(e,t,n)=>e.removeEventListener(t,n,!1),r=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const a=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(r[e]),l={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},c={height:()=>(de("Custom height calculation function not defined"),He.auto()),width:()=>(de("Custom width calculation function not defined"),Ue.auto())},s={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},u=128,d={},m="checkVisibility"in window,f="auto",p="[iFrameSizer]",h=p.length,y={max:1,min:1,bodyScroll:1,documentElementScroll:1},g=["body"],v="scroll";let b,w,z=!0,S="",$=0,j="",E=null,P="",O=!0,M=!1,A=null,C=!0,T=!1,k=1,I=f,x=!0,N="",R={},B=!0,q=!1,L=0,W=!1,D="",H="child",U=null,F=!1,V="",J=window.parent,Z="*",Q=0,X=!1,Y="",G=1,K=v,_=window,ee=()=>{de("onMessage function not defined")},te=()=>{},ne=null,oe=null;const ie=e=>""!=`${e}`&&void 0!==e,re=new WeakSet,ae=e=>"object"==typeof e&&re.add(e);function le(e){switch(!0){case!ie(e):return"";case ie(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ie(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ie(e.className)?`.${e.className}`:"")}}function ce(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\n"," ")}...`:e}const se=(...e)=>[`[iframe-resizer][${D}]`,...e].join(" "),ue=(...e)=>console?.info(se(...e)),de=(...e)=>console?.warn(se(...e)),me=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(se)(...e)),fe=e=>me(e);function pe(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=N.slice(h).split(":");D=t[0],$=void 0===t[1]?$:Number(t[1]),M=void 0===t[2]?M:e(t[2]),q=void 0===t[3]?q:e(t[3]),z=void 0===t[6]?z:e(t[6]),j=t[7],I=void 0===t[8]?I:t[8],S=t[9],P=t[10],Q=void 0===t[11]?Q:Number(t[11]),R.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],K=void 0===t[14]?K:t[14],W=void 0===t[15]?W:e(t[15]),b=void 0===t[16]?b:Number(t[16]),w=void 0===t[17]?w:Number(t[17]),O=void 0===t[18]?O:e(t[18]),t[19],Y=t[20]||Y,L=void 0===t[21]?L:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;ee=e?.onMessage||ee,te=e?.onReady||te,"number"==typeof e?.offset&&(O&&(b=e?.offset),M&&(w=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(V=e.sizeSelector),Z=e?.targetOrigin||Z,I=e?.heightCalculationMethod||I,K=e?.widthCalculationMethod||K}function t(e,t){return"function"==typeof e&&(c[t]=e,e="custom"),e}if(1===L)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),I=t(I,"height"),K=t(K,"width"))}(),function(){void 0===j&&(j=`${$}px`);he("margin",function(e,t){t.includes("-")&&(de(`Negative CSS value ignored for ${e}`),t="");return t}("margin",j))}(),he("background",S),he("padding",P),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),ye(),L<0?fe(`${a(L+2)}${a(2)}`):Y.codePointAt(0)>4||L<2&&fe(a(3)),function(){if(!Y||""===Y||"false"===Y)return void me("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n");Y!==e&&me(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Y} - Child page: ${e}.\n`)}(),ze(),Se(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.setAttribute(n,null)}));t("data-iframe-height"),t("data-iframe-width"),e&&me("<rb>Deprecated Attributes</>\n \nThe <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</>.")}(),document.querySelectorAll(`[${n}]`).length>0&&("auto"===I&&(I="autoOverflow"),"auto"===K&&(K="autoOverflow")),be(),function(){if(1===L)return;_.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===z?(z=!0,$e()):!1===e&&!0===z&&(z=!1,ve("remove"),U?.disconnect(),E?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(z)),z),close(){Xe(0,0,"close")},getId:()=>D,getPageInfo(e){if("function"==typeof e)return ne=e,Xe(0,0,"pageInfo"),void me("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ne=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return oe=e,Xe(0,0,"parentInfo"),()=>{oe=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){me("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){R.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){I=e,ze()},setWidthCalculationMethod(e){K=e,Se()},setTargetOrigin(e){Z=e},resize(e,t){Ve("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){me("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),_.parentIFrame=_.parentIframe}(),function(){if(!0!==W)return;function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){o(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),$e(),R=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function i(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&o(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){o(window,"hashchange",r)}function c(){setTimeout(r,u)}function s(){a(),l(),c()}R.enable&&(1===L?me("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:i}}(),ae(document.documentElement),ae(document.body),Ve("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),te(),B=!1}function he(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ye(){""!==V&&document.querySelectorAll(V).forEach((e=>{e.dataset.iframeSize=!0}))}function ge(e){({add(t){function n(){Ve(e.eventName,e.eventType)}d[t]=n,o(window,t,n,{passive:!0})},remove(e){const t=d[e];delete d[e],i(window,e,t)}})[e.method](e.eventName)}function ve(e){ge({method:e,eventType:"After Print",eventName:"afterprint"}),ge({method:e,eventType:"Before Print",eventName:"beforeprint"}),ge({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function be(){const e=document.querySelectorAll(`[${n}]`);T=e.length>0,A=T?e:Re(document)()}function we(e,t,n,o){return t!==e&&(e in n||(de(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in s&&me(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function ze(){I=we(I,f,He,"height")}function Se(){K=we(K,v,Ue,"width")}function $e(){!0===z&&(ve("add"),E=function(){function e(e){e.forEach(Te),ye(),be()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),U=new ResizeObserver(Ee),Ce(window.document))}let je;function Ee(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;je=()=>Ve("resizeObserver",`Resize Observed: ${le(t)}`),setTimeout((()=>{je&&je(),je=void 0}),0)}const Pe=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Oe=()=>[...Re(document)()].filter(Pe),Me=new WeakSet;function Ae(e){e&&(Me.has(e)||(U.observe(e),Me.add(e)))}function Ce(e){[...Oe(),...g.flatMap((t=>e.querySelector(t)))].forEach(Ae)}function Te(e){"childList"===e.type&&Ce(e.target)}let ke=4,Ie=4;function xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=A.length,r=document.documentElement,a=T?0:document.documentElement.getBoundingClientRect().bottom,c=performance.now();var s;A.forEach((t=>{T||!m||t.checkVisibility(l)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>a&&(a=o,r=t)):i-=1})),c=performance.now()-c,i>1&&(s=r,re.has(s)||(ae(s),ue(`\nHeight calculated from: ${le(s)} (${ce(s)})`)));const u=`\nParsed ${i} element${1===i?"":"s"} in ${c.toPrecision(3)}ms\n${t} ${T?"tagged ":""}element found at: ${a}px\nPosition calculated from HTML element: ${le(r)} (${ce(r,100)})`;return c<4||i<99||T||B||ke<c&&ke<Ie&&(ke=1.2*c,me(`<rb>Performance Warning</>\n\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\n${u}`)),Ie=c,a}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Re=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)");let Be=!1;function qe({ceilBoundingSize:e,dimension:t,getDimension:n,isHeight:o,scrollSize:i}){if(!Be)return Be=!0,n.taggedElement();const r=o?"bottom":"right";return me(`<rb>Detected content overflowing html element</>\n \nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${r} margin, and position of every visible HTML element will have a performance impact on more complex pages. \n\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \n \nWhen present the ${r} margin of the ${o?"lowest":"right most"} element with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\n\nMore info: https://iframe-resizer.com/performance.\n\n(Page size: ${i} > document size: ${e})`),o?I="autoOverflow":K="autoOverflow",n.taggedElement()}const Le={height:0,width:0},We={height:0,width:0};function De(e,t){function n(){return We[i]=r,Le[i]=c,r}const o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===We[i]&&0===Le[i]:if(e.taggedElement(!0)<=a)return n();break;case X&&r===We[i]&&c===Le[i]:return Math.max(r,c);case 0===r:return c;case!t&&r!==We[i]&&c<=Le[i]:return n();case!o:return t?e.taggedElement():qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c});case!t&&r<We[i]:case c===l||c===a:case r>c:return n();case!t:return qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const He={enabled:()=>O,getOffset:()=>b,type:"height",auto:()=>De(He,!1),autoOverflow:()=>De(He,!0),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>c.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ne(He)),min:()=>Math.min(...Ne(He)),grow:()=>He.max(),lowestElement:()=>xe("bottom"),taggedElement:()=>xe("bottom")},Ue={enabled:()=>M,getOffset:()=>w,type:"width",auto:()=>De(Ue,!1),autoOverflow:()=>De(Ue,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>c.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ne(Ue)),min:()=>Math.min(...Ne(Ue)),rightMostElement:()=>xe("right"),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>xe("right")};function Fe(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Q);return r=void 0===n?He[I]():n,a=void 0===o?Ue[K]():o,O&&e(k,r)||M&&e(G,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(O&&I in y||M&&K in y)&&Qe():(Je(),k=r,G=a,Xe(k,G,e,i))}function Ve(e,t,n,o,i){document.hidden||Fe(e,0,n,o,i)}function Je(){X||(X=!0,requestAnimationFrame((()=>{X=!1})))}function Ze(e){k=He[I](),G=Ue[K](),Xe(k,G,e)}function Qe(e){const t=I;I=f,Je(),Ze("reset"),I=t}function Xe(e,t,n,o,i){L<-1||(void 0!==i||(i=Z),function(){const r=`${D}:${`${e+(b||0)}:${t+(w||0)}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(p+r):J.postMessage(p+r,i)}())}function Ye(e){const t={init:function(){N=e.data,J=e.source,pe(),C=!1,setTimeout((()=>{x=!1}),u)},reset(){x||Ze("resetPage")},resize(){Ve("resizeParent")},moveToAnchor(){R.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ne?ne(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();oe?oe(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();ee(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};p===`${e.data}`.slice(0,h)&&(!1!==C?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||de(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),o(window,"message",Ye),o(window,"readystatechange",Ge),Ge())}();
!function(){"use strict";const e="5.2.3",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="";const m=e=>""!=`${e}`&&void 0!==e;const f=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),p=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),h=(...e)=>console?.warn(f(...e)),y=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(f)(...e)),g=e=>y(e);let v=[];const b=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),v=document.querySelectorAll(`[${o}]`),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},w=()=>v.length>0,z=1e5,S="--ifr-start",E="--ifr-end",j="--ifr-measure",$=[],P=new WeakSet,C=e=>"object"==typeof e&&P.add(e),O=e=>Math.floor(e*z)/z;let A=null,M=null,T={};const k=setInterval((()=>{if($.length<10)return;if(T.hasTags&&T.len<25)return;$.sort();const e=Math.min($.reduce(((e,t)=>e+t),0)/$.length,$[Math.floor($.length/2)]);e<=4||(clearInterval(k),y(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${O(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${T.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function I(e){e.getEntries().forEach((e=>{if(e.name===E){const{duration:t}=performance.measure(j,S,E);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;T=e,P.has(M)||A===M||i&&o<=1||(r||C(M),A=M,p(`\n${n} position calculated from:`,M,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${O(t)}ms`))}(e.detail,t),$.push(t),$.length>100&&$.shift()}}))}function N(){new PerformanceObserver(I).observe({entryTypes:["mark"]}),C(document.documentElement),C(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",N):N()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(h("Custom height calculation function not defined"),Ue.auto()),width:()=>(h("Custom width calculation function not defined"),De.auto())},f={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},p=128,z={},j="checkVisibility"in window,$="auto",P="[iFrameSizer]",C=P.length,O={max:1,min:1,bodyScroll:1,documentElementScroll:1},A=["body"],T="scroll";let k,I,N=!0,R="",x=0,B="",q=null,W="",L=!0,F=!1,U=!0,D=!1,V=1,J=$,H=!0,Z="",Q={},X=!1,Y=0,G=!1,K="",_=d,ee="child",te=null,ne=!1,oe="",ie=[],re=window.parent,ae="*",le=0,se=!1,ce="",de=1,ue=T,me=window,fe=()=>{h("onMessage function not defined")},pe=()=>{},he=null,ye=null;function ge(){var o,d;!function(){const e=e=>"true"===e,t=Z.slice(C).split(":");K=t[0],x=void 0===t[1]?x:Number(t[1]),F=void 0===t[2]?F:e(t[2]),X=void 0===t[3]?X:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],J=void 0===t[8]?J:t[8],R=t[9],W=t[10],le=void 0===t[11]?le:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ee=void 0===t[13]?ee:t[13],ue=void 0===t[14]?ue:t[14],G=void 0===t[15]?G:e(t[15]),k=void 0===t[16]?k:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),L=void 0===t[18]?L:e(t[18]),t[19],ce=t[20]||ce,Y=void 0===t[21]?Y:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;fe=e?.onMessage||fe,pe=e?.onReady||pe,"number"==typeof e?.offset&&(y("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),L&&(k=e?.offset),F&&(I=e?.offset)),"number"==typeof e?.offsetSize&&(L&&(k=e?.offsetSize),F&&(I=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(oe=e.sizeSelector),ae=e?.targetOrigin||ae,J=e?.heightCalculationMethod||J,ue=e?.widthCalculationMethod||ue}function t(e,t){return"function"==typeof e&&(l[t]=e,e="custom"),e}1!==Y&&"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),J=t(J,"height"),ue=t(ue,"width"))}(),u={id:K,logging:X}.id,function(){try{ne="iframeParentListener"in window.parent}catch(e){}}(),Y<0?g(`${s(Y+2)}${s(2)}`):ce.codePointAt(0)>4||Y<2&&g(s(3)),ce&&""!==ce&&"false"!==ce?ce!==e&&y(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ce} - Child page: ${e}.\n`):y("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&y("<rb>Deprecated Attributes</>\n \nThe <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</>.")}(),be(),L!==F&&(_=b({onChange:c(ve),side:L?i:r})),1!==Y&&(me.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,Oe()):!1===e&&!0===N&&(N=!1,je("remove"),te?.disconnect(),q?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(N)),N),close(){Xe(0,0,"close")},getId:()=>K,getPageInfo(e){if("function"==typeof e)return he=e,Xe(0,0,"pageInfo"),void y("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");he=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ye=e,Xe(0,0,"parentInfo"),()=>{ye=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){y("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Q.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){J=e,Pe()},setWidthCalculationMethod(e){ue=e,Ce()},setTargetOrigin(e){ae=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){y("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),me.parentIFrame=me.parentIframe),function(){function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){a(window.document,t,e)}!0===G&&(t("mouseenter"),t("mouseleave"))}(),Q=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,p)}function c(){r(),l(),s()}return Q.enable&&(1===Y?y("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),we(qe(document)()),void 0===B&&(B=`${x}px`),ze("margin",(o="margin",(d=B).includes("-")&&(h(`Negative CSS value ignored for ${o}`),d=""),d)),ze("background",R),ze("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),Se()}const ve=()=>{Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),Oe(),pe()};function be(){ie=document.querySelectorAll(`[${n}]`),D=ie.length>0}function we(e){D?setTimeout(ve):_(e)}function ze(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Se(){""!==oe&&document.querySelectorAll(oe).forEach((e=>{e.dataset.iframeSize=!0}))}function Ee(e){({add(t){function n(){Je(e.eventName,e.eventType)}z[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=z[e];var n,o;delete z[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function je(e){Ee({method:e,eventType:"After Print",eventName:"afterprint"}),Ee({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ee({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function $e(e,t,n,o){return t!==e&&(e in n||(h(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in f&&y(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function Pe(){J=$e(J,$,Ue,"height")}function Ce(){ue=$e(ue,T,De,"width")}function Oe(){!0===N&&(je("add"),q=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n;if(u>r*s+++a&&u<l)return setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Se(),be(),we(e),e.forEach(Re),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}const m=u();return{disconnect(){m.disconnect()}}}(),te=new ResizeObserver(Me),Re(window.document))}let Ae;function Me(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ae=()=>Je("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!m(e):return"";case m(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case m(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(m(e.className)?`.${e.className}`:"")}}(t)}`),setTimeout((()=>{Ae&&Ae(),Ae=void 0}),0)}const Te=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...qe(document)()].filter(Te),Ie=new WeakSet;function Ne(e){e&&(Ie.has(e)||(te.observe(e),Ie.add(e)))}function Re(e){[...ke(),...A.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function xe(e){performance.mark(S);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=D?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(S);const l=D?ie:w()?v:qe(document)();let s=l.length;return l.forEach((t=>{D||!j||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1})),M=r,performance.mark(E,{detail:{Side:t,len:s,hasTags:D,logging:X}}),a}const Be=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],qe=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),We={height:0,width:0},Le={height:0,width:0};function Fe(e){function t(){return Le[i]=r,We[i]=s,r}const n=w(),o=e===Ue,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case D:return e.taggedElement();case!n&&0===Le[i]&&0===We[i]:return t();case se&&r===Le[i]&&s===We[i]:return Math.max(r,s);case 0===r:return s;case!n&&r!==Le[i]&&s<=We[i]:return t();case!o:return e.taggedElement();case!n&&r<Le[i]:case s===l||s===a:case r>s:return t()}return Math.max(e.taggedElement(),t())}const Ue={enabled:()=>L,getOffset:()=>k,auto:()=>Fe(Ue),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ue.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Be(Ue)),min:()=>Math.min(...Be(Ue)),grow:()=>Ue.max(),lowestElement:()=>xe(i),taggedElement:()=>xe(i)},De={enabled:()=>F,getOffset:()=>I,auto:()=>Fe(De),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Be(De)),min:()=>Math.min(...Be(De)),rightMostElement:()=>xe(r),scroll:()=>Math.max(De.bodyScroll(),De.documentElementScroll()),taggedElement:()=>xe(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=le);return r=void 0===n?Ue[J]():n,a=void 0===o?De[ue]():o,L&&e(V,r)||F&&e(de,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(L&&J in O||F&&ue in O)&&Qe():(He(),V=r,de=a,Xe(V,de,e,i))}function Je(e,t,n,o,i){document.hidden||Ve(e,0,n,o,i)}function He(){se||(se=!0,requestAnimationFrame((()=>{se=!1})))}function Ze(e){V=Ue[J](),de=De[ue](),Xe(V,de,e)}function Qe(e){const t=J;J=$,He(),Ze("reset"),J=t}function Xe(e,t,n,o,i){Y<-1||(void 0!==i||(i=ae),function(){const r=`${K}:${e+(k||0)}:${t+(I||0)}:${n}${void 0===o?"":`:${o}`}`;ne?window.parent.iframeParentListener(P+r):re.postMessage(P+r,i)}())}function Ye(e){const t={init:function(){Z=e.data,re=e.source,ge(),U=!1,setTimeout((()=>{H=!1}),p)},reset(){H||Ze("resetPage")},resize(){Je("resizeParent")},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();he?he(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();ye?ye(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();fe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};P===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||h(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),a(window,"message",Ye),a(window,"readystatechange",Ge),Ge()}()}();
/*!
* @preserve
*
* @module iframe-resizer/legacy (parent) 5.1.5-beta.1 (umd) - 2024-07-10
* @module iframe-resizer/legacy (parent) 5.2.3 (umd) - 2024-08-05
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @desciption Keep same and cross domain iFrames sized to their content
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
* @see {@link https://iframe-resizer.com}
*

@@ -20,1302 +20,2 @@ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.iframeResize = factory());
})(this, (function () { 'use strict';
const msg = `IFRAME-RESIZER 5
This package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.
Version 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.
Please see https://iframe-resizer.com/upgrade for more details.
`;
console.warn(msg);
const encode = (s) =>
s
.replaceAll('<br>', '\n')
.replaceAll('<rb>', '\u001B[31;1m')
.replaceAll('</>', '\u001B[m')
.replaceAll('<b>', '\u001B[1m')
.replaceAll('<i>', '\u001B[3m')
.replaceAll('<u>', '\u001B[4m');
const remove = (s) => s.replaceAll('<br>', '\n').replaceAll(/<[/a-z]+>/gi, '');
const formatAdvise = (formatLogMsg) => (msg) =>
window.chrome // Only show formatting in Chrome as not supported in other browsers
? formatLogMsg(encode(msg))
: formatLogMsg(remove(msg));
const msgId$1 = '[iframe-resizer]';
function setLogEnabled(enabled) {
}
function getMyID(iframeId) {
if (window.top === window.self) {
return `Parent page: ${iframeId}`
}
return window?.parentIFrame?.getId
? `${window.parentIFrame.getId()}: ${iframeId}`
: `Nested parent page: ${iframeId}`
}
const formatLogHeader = (iframeId) => `${msgId$1}[${getMyID(iframeId)}]`;
const formatLogMsg =
(iframeId) =>
(...msg) =>
[`${msgId$1}[${iframeId}]`, ...msg].join(' ');
const output = (type, iframeId, ...msg) =>
// eslint-disable-next-line no-console
window?.console[type](formatLogHeader(iframeId), ...msg);
const info = (iframeId, ...msg) => output('info', iframeId, ...msg);
const warn = (iframeId, ...msg) => output('warn', iframeId, ...msg);
const advise = (iframeId, msg) =>
// eslint-disable-next-line no-console
console?.warn(formatAdvise(formatLogMsg(iframeId))(msg));
const VERSION = '5.1.5-beta.1';
const msgHeader = 'message';
const msgHeaderLen = msgHeader.length;
const msgId = '[iFrameSizer]'; // Must match iframe msg ID
const msgIdLen = msgId.length;
const resetRequiredMethods = Object.freeze({
max: 1,
scroll: 1,
bodyScroll: 1,
documentElementScroll: 1,
});
const addEventListener = (el, evt, func, options) =>
el.addEventListener(evt, func, options || false);
const removeEventListener = (el, evt, func) =>
el.removeEventListener(evt, func, false);
const l = (l) => {
if (!l) return ''
let p = -559038744,
y = 1103547984;
for (let z, t = 0; t < l.length; t++)
(z = l.codePointAt(t)),
(p = Math.imul(p ^ z, 2246822519)),
(y = Math.imul(y ^ z, 3266489917));
return (
(p ^= Math.imul(p ^ (y >>> 15), 1935289751)),
(y ^= Math.imul(y ^ (p >>> 15), 3405138345)),
(p ^= y >>> 16),
(y ^= p >>> 16),
(2097152 * (y >>> 0) + (p >>> 11)).toString(36)
)
},
p = (l) =>
l.replaceAll(/[A-Za-z]/g, (l) =>
String.fromCodePoint(
(l <= 'Z' ? 90 : 122) >= (l = l.codePointAt(0) + 19) ? l : l - 26,
),
),
y = [
'<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>.',
],
z = ['NWSc3', 'zvsv', 'wyv', 'ibzpulzz', 'vlt'],
t = Object.fromEntries(
[
'2cgs7fdf4xb',
'1c9ctcccr4z',
'1q2pc4eebgb',
'ueokt0969w',
'w2zxchhgqz',
'1umuxblj2e5',
].map((l, p) => [l, Math.max(0, p - 1)]),
);
const getModeData = (l) => p(y[l]);
const getModeLabel = (l) => p(z[l]);
const setMode = (y) => {
const z = y[p('spjluzl')];
if (!z) return -1
const u = z.split('-');
let v = (function (y = '') {
let z = -2;
const u = l(p(y));
return u in t && (z = t[u]), z
})(u[0]);
return 0 === v || ((p) => p[2] === l(p[0] + p[1]))(u) || (v = -2), v
};
const once = (fn) => {
let done = false;
return function () {
return done
? undefined
: ((done = true), Reflect.apply(fn, this, arguments))
}
};
const settings = {};
const onReadyDeprecated = (messageData) => {
if (typeof settings[messageData.id].onInit === 'function') {
advise(
messageData.id,
`
\u001B[31;1mDeprecated Option\u001B[m
The \u001B[1monInit()\u001B[m function is deprecated and has been replaced with \u001B[1monReady()\u001B[m. It will be removed in a future version of iFrame Resizer.
`,
);
settings[messageData.id].onInit(messageData);
}
};
const defaults = Object.freeze({
autoResize: true,
bodyBackground: null,
bodyMargin: null,
bodyPadding: null,
checkOrigin: true,
direction: 'vertical',
inPageLinks: false,
heightCalculationMethod: 'auto',
id: 'iFrameResizer',
log: false,
license: undefined,
mouseEvents: true,
offsetHeight: null,
offsetWidth: null,
postMessageTarget: null,
sameDomain: false,
scrolling: false,
sizeHeight: true,
// sizeSelector: '',
sizeWidth: false,
warningTimeout: 5000,
tolerance: 0,
waitForLoad: false,
widthCalculationMethod: 'auto',
onClose: () => true,
onClosed() {},
onInit: false,
onMessage: null,
onMouseEnter() {},
onMouseLeave() {},
onReady: onReadyDeprecated,
onResized() {},
onScroll: () => true,
});
const page = {
position: null,
version: VERSION,
};
function iframeListener(event) {
function resizeIFrame() {
setSize(messageData);
setPagePosition();
on('onResized', messageData);
}
function getPaddingEnds(compStyle) {
if (compStyle.boxSizing !== 'border-box') {
return 0
}
const top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0;
const bot = compStyle.paddingBottom
? parseInt(compStyle.paddingBottom, 10)
: 0;
return top + bot
}
function getBorderEnds(compStyle) {
if (compStyle.boxSizing !== 'border-box') {
return 0
}
const top = compStyle.borderTopWidth
? parseInt(compStyle.borderTopWidth, 10)
: 0;
const bot = compStyle.borderBottomWidth
? parseInt(compStyle.borderBottomWidth, 10)
: 0;
return top + bot
}
function processMsg() {
const data = msg.slice(msgIdLen).split(':');
const height = data[1] ? Number(data[1]) : 0;
const iframe = settings[data[0]]?.iframe;
const compStyle = getComputedStyle(iframe);
return {
iframe,
id: data[0],
height: height + getPaddingEnds(compStyle) + getBorderEnds(compStyle),
width: Number(data[2]),
type: data[3],
msg: data[4],
}
}
function isMessageFromIFrame() {
function checkAllowedOrigin() {
function checkList() {
let i = 0;
let retCode = false;
for (; i < checkOrigin.length; i++) {
if (checkOrigin[i] === origin) {
retCode = true;
break
}
}
return retCode
}
function checkSingle() {
const remoteHost = settings[iframeId]?.remoteHost;
return origin === remoteHost
}
return checkOrigin.constructor === Array ? checkList() : checkSingle()
}
const { origin, sameDomain } = event;
if (sameDomain) {
return true
}
let checkOrigin = settings[iframeId]?.checkOrigin;
if (checkOrigin && `${origin}` !== 'null' && !checkAllowedOrigin()) {
throw new Error(
`Unexpected message received from: ${origin} for ${messageData.iframe.id}. Message was: ${event.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`,
)
}
return true
}
function isMessageForUs() {
return (
msgId === `${msg}`.slice(0, msgIdLen) &&
msg.slice(msgIdLen).split(':')[0] in settings
) // ''+Protects against non-string msg
}
function isMessageFromMetaParent() {
// Test if this message is from a parent above us. This is an ugly test, however, updating
// the message format would break backwards compatibility.
const retCode = messageData.type in { true: 1, false: 1, undefined: 1 };
return retCode
}
function getMsgBody(offset) {
return msg.slice(msg.indexOf(':') + msgHeaderLen + offset)
}
function forwardMsgFromIFrame(msgBody) {
on('onMessage', {
iframe: messageData.iframe,
message: JSON.parse(msgBody),
});
}
function getPageInfo() {
const bodyPosition = document.body.getBoundingClientRect();
const iFramePosition = messageData.iframe.getBoundingClientRect();
const { scrollY, scrollX, innerHeight, innerWidth } = window;
const { clientHeight, clientWidth } = document.documentElement;
return JSON.stringify({
iframeHeight: iFramePosition.height,
iframeWidth: iFramePosition.width,
clientHeight: Math.max(clientHeight, innerHeight || 0),
clientWidth: Math.max(clientWidth, innerWidth || 0),
offsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),
offsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),
scrollTop: scrollY,
scrollLeft: scrollX,
documentHeight: clientHeight,
documentWidth: clientWidth,
windowHeight: innerHeight,
windowWidth: innerWidth,
})
}
function getParentProps() {
const { iframe } = messageData;
const { scrollWidth, scrollHeight } = document.documentElement;
const { width, height, offsetLeft, offsetTop, pageLeft, pageTop, scale } =
window.visualViewport;
return JSON.stringify({
iframe: iframe.getBoundingClientRect(),
document: {
scrollWidth,
scrollHeight,
},
viewport: {
width,
height,
offsetLeft,
offsetTop,
pageLeft,
pageTop,
scale,
},
})
}
const sendInfoToIframe = (type, infoFunction) => (requestType, iframeId) => {
const gate = {};
function throttle(func, frameId) {
if (!gate[frameId]) {
func();
gate[frameId] = requestAnimationFrame(() => {
gate[frameId] = null;
});
}
}
function gatedTrigger() {
trigger(
`Send ${type} (${requestType})`,
`${type}:${infoFunction()}`,
iframeId,
);
}
throttle(gatedTrigger, iframeId);
};
const startInfoMonitor = (sendInfoToIframe, type) => () => {
const sendInfo = (requestType) => () => {
if (settings[id]) {
sendInfoToIframe(requestType, id);
} else {
stop();
}
};
function setListener(requestType, listener) {
listener(window, 'scroll', sendInfo('scroll'));
listener(window, 'resize', sendInfo('resize window'));
}
function stop() {
setListener('Remove ', removeEventListener);
pageObserver.disconnect();
iframeObserver.disconnect();
}
function start() {
setListener('Add ', addEventListener);
pageObserver.observe(document.body, {
attributes: true,
childList: true,
subtree: true,
});
iframeObserver.observe(settings[id].iframe, {
attributes: true,
childList: false,
subtree: false,
});
}
const id = iframeId; // Create locally scoped copy of iFrame ID
const pageObserver = new ResizeObserver(sendInfo('page observed'));
const iframeObserver = new ResizeObserver(sendInfo('iframe observed'));
start();
if (settings[id]) {
settings[id][`stop${type}`] = stop;
}
};
const stopInfoMonitor = (stopFunction) => () => {
if (stopFunction in settings[iframeId]) {
settings[iframeId][stopFunction]();
delete settings[iframeId][stopFunction];
}
};
const sendPageInfoToIframe = sendInfoToIframe('pageInfo', getPageInfo);
const sendParentInfoToIframe = sendInfoToIframe('parentInfo', getParentProps);
const startPageInfoMonitor = startInfoMonitor(
sendPageInfoToIframe,
'PageInfo',
);
const startParentInfoMonitor = startInfoMonitor(
sendParentInfoToIframe,
'ParentInfo',
);
const stopPageInfoMonitor = stopInfoMonitor('stopPageInfo');
const stopParentInfoMonitor = stopInfoMonitor('stopParentInfo');
function checkIFrameExists() {
let retBool = true;
if (messageData.iframe === null) {
warn(iframeId, `The iframe (${messageData.id}) was not found.`);
retBool = false;
}
return retBool
}
function getElementPosition(target) {
const iFramePosition = target.getBoundingClientRect();
getPagePosition();
return {
x: Number(iFramePosition.left) + Number(page.position.x),
y: Number(iFramePosition.top) + Number(page.position.y),
}
}
function scrollBy() {
const x = messageData.width;
const y = messageData.height;
const target = window.parentIframe || window;
target.scrollBy(x, y);
}
function scrollRequestFromChild(addOffset) {
/* istanbul ignore next */ // Not testable in Karma
function reposition() {
page.position = newPosition;
scrollTo(iframeId);
}
function scrollParent() {
if (window.parentIFrame) {
window.parentIFrame[`scrollTo${addOffset ? 'Offset' : ''}`](
newPosition.x,
newPosition.y,
);
} else {
warn(
iframeId,
'Unable to scroll to requested position, window.parentIFrame not found',
);
}
}
const calcOffset = (messageData, offset) => ({
x: messageData.width + offset.x,
y: messageData.height + offset.y,
});
const offset = addOffset
? getElementPosition(messageData.iframe)
: { x: 0, y: 0 };
let newPosition = calcOffset(messageData, offset);
if (window.top === window.self) {
reposition();
} else {
scrollParent();
}
}
function scrollTo(iframeId) {
const { x, y } = page.position;
const iframe = settings[iframeId]?.iframe;
if (on('onScroll', { iframe, top: y, left: x, x, y }) === false) {
unsetPagePosition();
return
}
setPagePosition();
}
function findTarget(location) {
function jumpToTarget() {
const jumpPosition = getElementPosition(target);
page.position = {
x: jumpPosition.x,
y: jumpPosition.y,
};
scrollTo(iframeId);
}
function jumpToParent() {
if (window.parentIFrame) {
window.parentIFrame.moveToAnchor(hash);
return
}
}
const hash = location.split('#')[1] || '';
const hashData = decodeURIComponent(hash);
let target =
document.getElementById(hashData) ||
document.getElementsByName(hashData)[0];
if (target) {
jumpToTarget();
return
}
if (window.top === window.self) {
return
}
jumpToParent();
}
function onMouse(event) {
let mousePos = {};
if (messageData.width === 0 && messageData.height === 0) {
const data = getMsgBody(9).split(':');
mousePos = {
x: data[1],
y: data[0],
};
} else {
mousePos = {
x: messageData.width,
y: messageData.height,
};
}
on(event, {
iframe: messageData.iframe,
screenX: Number(mousePos.x),
screenY: Number(mousePos.y),
type: messageData.type,
});
}
const on = (funcName, val) => chkEvent(iframeId, funcName, val);
function checkSameDomain(id) {
try {
settings[id].sameDomain =
!!settings[id]?.iframe?.contentWindow?.iframeChildListener;
} catch (error) {
settings[id].sameDomain = false;
}
}
function checkVersion(version) {
if (version === VERSION) return
if (version === undefined) {
advise(
iframeId,
`<rb>Legacy version detected in iframe</>
Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
`,
);
return
}
}
function setTitle(title, iframeId) {
if (!settings[iframeId]?.syncTitle) return
settings[iframeId].iframe.title = title;
}
function started() {
setup = true;
}
function actionMsg() {
if (settings[iframeId]?.firstRun) firstRun();
switch (messageData.type) {
case 'close':
closeIFrame(messageData.iframe);
break
case 'message':
forwardMsgFromIFrame(getMsgBody(6));
break
case 'mouseenter':
onMouse('onMouseEnter');
break
case 'mouseleave':
onMouse('onMouseLeave');
break
case 'autoResize':
settings[iframeId].autoResize = JSON.parse(getMsgBody(9));
break
case 'scrollBy':
scrollBy();
break
case 'scrollTo':
scrollRequestFromChild(false);
break
case 'scrollToOffset':
scrollRequestFromChild(true);
break
case 'pageInfo':
sendPageInfoToIframe('start', iframeId);
startPageInfoMonitor();
break
case 'parentInfo':
sendParentInfoToIframe('start', iframeId);
startParentInfoMonitor();
break
case 'pageInfoStop':
stopPageInfoMonitor();
break
case 'parentInfoStop':
stopParentInfoMonitor();
break
case 'inPageLink':
findTarget(getMsgBody(9));
break
case 'title':
setTitle(messageData.msg, iframeId);
break
case 'reset':
resetIFrame(messageData);
break
case 'init':
resizeIFrame();
checkSameDomain(iframeId);
checkVersion(messageData.msg);
started();
on('onReady', messageData.iframe);
break
default:
if (messageData.width === 0 && messageData.height === 0) {
warn(
`Unsupported message received (${messageData.type}), this is likely due to the iframe containing a later ` +
`version of iframe-resizer than the parent page`,
);
return
}
if (messageData.width === 0 || messageData.height === 0) {
return
}
// Recheck document.hidden here, as only Firefox
// correctly supports this in the iframe
if (document.hidden) {
return
}
resizeIFrame();
}
}
function checkSettings(iframeId) {
if (!settings[iframeId]) {
throw new Error(
`${messageData.type} No settings for ${iframeId}. Message was: ${msg}`,
)
}
}
function iFrameReadyMsgReceived() {
Object.keys(settings).forEach((iframeId) => {
if (settings[iframeId].mode >= 0)
trigger('iFrame requested init', createOutgoingMsg(iframeId), iframeId);
});
}
function firstRun() {
if (settings[iframeId]) {
settings[iframeId].firstRun = false;
}
}
let msg = event.data;
let messageData = {};
let iframeId = null;
if (msg === '[iFrameResizerChild]Ready') {
iFrameReadyMsgReceived();
return
}
if (!isMessageForUs()) {
return
}
messageData = processMsg();
iframeId = messageData.id;
if (!iframeId) {
warn('iframeResizer received messageData without id, message was: ', msg);
return
}
checkSettings(iframeId);
if (!isMessageFromMetaParent()) {
settings[iframeId].loaded = true;
if (checkIFrameExists() && isMessageFromIFrame()) {
actionMsg();
}
}
}
function chkEvent(iframeId, funcName, val) {
let func = null;
let retVal = null;
if (settings[iframeId]) {
func = settings[iframeId][funcName];
if (typeof func === 'function') {
retVal = func(val);
} else {
throw new TypeError(
`${funcName} on iFrame[${iframeId}] is not a function`,
)
}
}
return retVal
}
function removeIframeListeners(iframe) {
const iframeId = iframe.id;
delete settings[iframeId];
}
function closeIFrame(iframe) {
const iframeId = iframe.id;
if (chkEvent(iframeId, 'onClose', iframeId) === false) {
return
}
try {
// Catch race condition error with React
if (iframe.parentNode) {
iframe.remove();
}
} catch (error) {
warn(error);
}
chkEvent(iframeId, 'onClosed', iframeId);
removeIframeListeners(iframe);
}
function getPagePosition(iframeId) {
if (page.position === null) {
page.position = {
x: window.scrollX,
y: window.scrollY,
};
}
}
function unsetPagePosition() {
page.position = null;
}
function setPagePosition(iframeId) {
if (page.position !== null) {
window.scrollTo(page.position.x, page.position.y);
unsetPagePosition();
}
}
function resetIFrame(messageData) {
getPagePosition(messageData.id);
setSize(messageData);
trigger('reset', 'reset', messageData.id);
}
function setSize(messageData) {
const iframeId = messageData.id;
function setDimension(dimension) {
const size = `${messageData[dimension]}px`;
messageData.iframe.style[dimension] = size;
}
if (settings[iframeId].sizeHeight) {
setDimension('height');
}
if (settings[iframeId].sizeWidth) {
setDimension('width');
}
}
function trigger(calleeMsg, msg, id, noResponseWarning) {
function postMessageToIFrame() {
const { postMessageTarget, targetOrigin } = settings[id];
if (settings[id].sameDomain) {
try {
settings[id].iframe.contentWindow.iframeChildListener(msgId + msg);
return
} catch (error) {
}
}
postMessageTarget.postMessage(msgId + msg, targetOrigin);
}
function iFrameNotFound() {
warn(id, `[${calleeMsg}] IFrame(${id}) not found`);
}
function chkAndSend() {
if (!settings[id]?.postMessageTarget) {
iFrameNotFound();
return
}
postMessageToIFrame();
}
function warnOnNoResponse() {
function warning() {
if (settings[id] === undefined) return // iframe has been closed while we where waiting
if (!settings[id].loaded && !settings[id].loadErrorShown) {
settings[id].loadErrorShown = true;
advise(
id,
`
<rb>No response from iFrame</>
The iframe (<i>${id}</>) has not responded within ${settings[id].warningTimeout / 1000} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.
`,
);
}
}
if (!!noResponseWarning && !!settings[id]?.warningTimeout) {
settings[id].msgTimeout = setTimeout(warning, settings[id].warningTimeout);
}
}
if (settings[id]) {
chkAndSend();
warnOnNoResponse();
}
}
function createOutgoingMsg(iframeId) {
const iframeSettings = settings[iframeId];
return [
iframeId,
'8', // Backwards compatibility (PaddingV1)
iframeSettings.sizeWidth,
iframeSettings.log,
'32', // Backwards compatibility (Interval)
true, // Backwards compatibility (EnablePublicMethods)
iframeSettings.autoResize,
iframeSettings.bodyMargin,
iframeSettings.heightCalculationMethod,
iframeSettings.bodyBackground,
iframeSettings.bodyPadding,
iframeSettings.tolerance,
iframeSettings.inPageLinks,
'child', // Backwards compatibility (resizeFrom)
iframeSettings.widthCalculationMethod,
iframeSettings.mouseEvents,
iframeSettings.offsetHeight,
iframeSettings.offsetWidth,
iframeSettings.sizeHeight,
iframeSettings.license,
page.version,
iframeSettings.mode,
// iframeSettings.sizeSelector,
].join(':')
}
let count = 0;
let setup = false;
let vAdvised = false;
const connectResizer = (options) => (iframe) => {
function newId() {
let id = options?.id || defaults.id + count++;
if (document.getElementById(id) !== null) {
id += count++;
}
return id
}
function ensureHasId(iframeId) {
if (iframeId && typeof iframeId !== 'string') {
throw new TypeError('Invalid id for iFrame. Expected String')
}
if (iframeId === '' || !iframeId) {
// eslint-disable-next-line no-multi-assign
iframe.id = iframeId = newId();
setLogEnabled((options || {}).log);
}
return iframeId
}
function setScrolling() {
iframe.style.overflow =
settings[iframeId]?.scrolling === false ? 'hidden' : 'auto';
switch (settings[iframeId]?.scrolling) {
case 'omit':
break
case true:
iframe.scrolling = 'yes';
break
case false:
iframe.scrolling = 'no';
break
default:
iframe.scrolling = settings[iframeId]
? settings[iframeId].scrolling
: 'no';
}
}
function setupBodyMarginValues() {
const { bodyMargin } = settings[iframeId];
if (typeof bodyMargin === 'number' || bodyMargin === '0') {
settings[iframeId].bodyMargin = `${bodyMargin}px`;
}
}
function checkReset() {
const firstRun = settings[iframeId]?.firstRun;
const resetRequestMethod =
settings[iframeId]?.heightCalculationMethod in resetRequiredMethods;
if (!firstRun && resetRequestMethod) {
resetIFrame({ iframe, height: 0, width: 0, type: 'init' });
}
}
function setupIFrameObject() {
if (settings[iframeId]) {
const resizer = {
close: closeIFrame.bind(null, settings[iframeId].iframe),
disconnect: removeIframeListeners.bind(null, settings[iframeId].iframe),
removeListeners() {
advise(
iframeId,
`
<rb>Deprecated Method Name</>
The \u001B[removeListeners()</> method has been renamed to \u001B[disconnect()</>.
`,
);
this.disconnect();
},
resize: trigger.bind(null, 'Window resize', 'resize', iframeId),
moveToAnchor(anchor) {
trigger('Move to anchor', `moveToAnchor:${anchor}`, iframeId);
},
sendMessage(message) {
message = JSON.stringify(message);
trigger('Send Message', `message:${message}`, iframeId);
},
};
settings[iframeId].iframe.iframeResizer = resizer;
settings[iframeId].iframe.iFrameResizer = resizer;
}
}
// We have to call trigger twice, as we can not be sure if all
// iframes have completed loading when this code runs. The
// event listener also catches the page changing in the iFrame.
function init(msg) {
function iFrameLoaded() {
trigger('iFrame.onload', `${msg}:${setup}`, id, true);
checkReset();
}
const { id } = iframe;
if (settings[id].mode === -1) return // modal()
if (settings[id].mode === -2) return
addEventListener(iframe, 'load', iFrameLoaded);
if (settings[id].waitForLoad === false)
trigger('init', `${msg}:${setup}`, id, true);
}
function checkOptions(options) {
if (!options) return {}
if (typeof options !== 'object') {
throw new TypeError('Options is not an object')
}
if (
'sizeWidth' in options ||
'sizeHeight' in options ||
'autoResize' in options
) {
advise(
iframeId,
`<rb>Deprecated Option</>
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.
`,
);
}
return options
}
function checkMode() {
const { mode } = settings[iframeId];
if (mode < 0) advise('Parent', `${getModeData(mode + 2)}${getModeData(2)}`);
if (vAdvised || mode < 0) return
vAdvised = true;
info(`v${VERSION} (${getModeLabel(mode)})`);
if (mode < 1) advise('Parent', getModeData(3));
}
function setDirection() {
if (settings[iframeId].direction === 'horizontal') {
settings[iframeId].sizeWidth = true;
settings[iframeId].sizeHeight = false;
return
}
if (settings[iframeId].direction === 'none') {
settings[iframeId].sizeWidth = false;
settings[iframeId].sizeHeight = false;
settings[iframeId].autoResize = false;
return
}
if (settings[iframeId].direction !== 'vertical') {
throw new TypeError(
iframeId,
`Direction value of "${settings[iframeId].direction}" is not valid`,
)
}
}
function setOffset(offset) {
if (!offset) return
if (settings[iframeId].direction === 'vertical') {
settings[iframeId].offsetHeight = offset;
} else {
settings[iframeId].offsetWidth = offset;
}
}
function getTargetOrigin(remoteHost) {
return remoteHost === '' ||
remoteHost.match(/^(about:blank|javascript:|file:\/\/)/) !== null
? '*'
: remoteHost
}
function getPostMessageTarget() {
if (settings[iframeId].postMessageTarget === null)
settings[iframeId].postMessageTarget = iframe.contentWindow;
}
function chkTitle(iframeId) {
const title = settings[iframeId]?.iframe?.title;
return title === '' || title === undefined
}
function processOptions(options) {
settings[iframeId] = {
iframe,
firstRun: true,
remoteHost: iframe?.src.split('/').slice(0, 3).join('/'),
...defaults,
...checkOptions(options),
mode: setMode(options),
syncTitle: chkTitle(iframeId),
};
setDirection();
setOffset(options?.offset);
getPostMessageTarget();
settings[iframeId].targetOrigin =
settings[iframeId].checkOrigin === true
? getTargetOrigin(settings[iframeId].remoteHost)
: '*';
}
function beenHere() {
return iframeId in settings && 'iFrameResizer' in iframe
}
const iframeId = ensureHasId(iframe.id);
if (beenHere()) {
warn(iframeId, 'Ignored iFrame, already setup.');
} else {
processOptions(options);
checkMode();
setupEventListenersOnce();
setScrolling();
setupBodyMarginValues();
init(createOutgoingMsg(iframeId));
setupIFrameObject();
}
return iframe?.iFrameResizer
};
function sendTriggerMsg(eventName, event) {
function triggerEnabledIframe(iframeId) {
if (isIFrameResizeEnabled(iframeId)) {
trigger(eventName, event, iframeId);
}
}
const isIFrameResizeEnabled = (iframeId) =>
settings[iframeId]?.autoResize && !settings[iframeId]?.firstRun;
Object.keys(settings).forEach(triggerEnabledIframe);
}
function tabVisible() {
if (document.hidden === false) {
sendTriggerMsg('Tab Visible', 'resize');
}
}
const setupEventListenersOnce = once(() => {
addEventListener(window, 'message', iframeListener);
addEventListener(document, 'visibilitychange', tabVisible);
window.iframeParentListener = (data) =>
iframeListener({ data, sameDomain: true });
});
const id = '[iframeResizer] ';
function createIframeResize() {
function setup(element) {
switch (true) {
case !element:
throw new TypeError(`${id}iframe is not defined`)
case !element.tagName:
throw new TypeError(`${id}Not a valid DOM element`)
case element.tagName.toUpperCase() !== 'IFRAME':
throw new TypeError(
`${id}Expected <IFRAME> tag, found <${element.tagName}>`,
)
default:
connectWithOptions(element);
iFrames.push(element);
}
}
let connectWithOptions;
let iFrames;
return function (options, target) {
if (typeof window === 'undefined') return [] // don't run for server side render
connectWithOptions = connectResizer(options);
iFrames = []; // Only return iFrames passed in on this call
switch (typeof target) {
case 'undefined':
case 'string':
document.querySelectorAll(target || 'iframe').forEach(setup);
break
case 'object':
setup(target);
break
default:
throw new TypeError(`${id}Unexpected data type (${typeof target})`)
}
return Object.freeze(iFrames)
}
}
const iframeResize = createIframeResize();
if (typeof window !== 'undefined') {
window.iFrameResize =
window.iFrameResize ||
function (...args) {
advise('', 'Deprecated: iFrameResize(), please use iframeResize()');
iframeResize(...args);
};
}
return iframeResize;
}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="[iframe-resizer]";const t=t=>`${e}[${function(e){return window.top===window.self?`Parent page: ${e}`:window?.parentIFrame?.getId?`${window.parentIFrame.getId()}: ${e}`:`Nested parent page: ${e}`}(t)}]`,i=(e,i,...n)=>window?.console[e](t(i),...n),n=(e,...t)=>i("warn",e,...t),o=(t,i)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))((t=>(...i)=>[`${e}[${t}]`,...i].join(" "))(t))(i)),r="5.2.3",a="[iFrameSizer]",s=a.length,l=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),c=(e,t,i,n)=>e.addEventListener(t,i,n||!1),d=(e,t,i)=>e.removeEventListener(t,i,!1),u=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),t=Math.imul(t^n,2246822519),i=Math.imul(i^n,3266489917);return t^=Math.imul(t^i>>>15,1935289751),i^=Math.imul(i^t>>>15,3405138345),t^=i>>>16,i^=t>>>16,(2097152*(i>>>0)+(t>>>11)).toString(36)},f=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),p=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."],h=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],m=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),y=e=>f(p[e]),g=e=>{const t=e[f("spjluzl")];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=u(f(e));return i in m&&(t=m[i]),t}(i[0]);return 0===n||(e=>e[2]===u(e[0]+e[1]))(i)||(n=-2),n},w={},b=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof w[e.id].onInit&&(o(e.id,"\nDeprecated Option\n\nThe onInit() function is deprecated and has been replaced with onReady(). It will be removed in a future version of iFrame Resizer.\n "),w[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),v={position:null,version:r};function z(e){function t(){S(P),I(),L("onResized",P)}function i(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function l(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}function u(e){return O.slice(O.indexOf(":")+7+e)}const f=(e,t)=>(i,n)=>{const o={};var r,a;r=function(){x(`Send ${e} (${i})`,`${e}:${t()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},p=(e,t)=>()=>{const i=t=>()=>{w[r]?e(t,r):o()};function n(e,t){t(window,"scroll",i("scroll")),t(window,"resize",i("resize window"))}function o(){n(0,d),a.disconnect(),s.disconnect()}const r=H,a=new ResizeObserver(i("page observed")),s=new ResizeObserver(i("iframe observed"));n(0,c),a.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),s.observe(w[r].iframe,{attributes:!0,childList:!1,subtree:!1}),w[r]&&(w[r][`stop${t}`]=o)},h=e=>()=>{e in w[H]&&(w[H][e](),delete w[H][e])},m=f("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=P.iframe.getBoundingClientRect(),{scrollY:i,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),y=f("parentInfo",(function(){const{iframe:e}=P,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:i},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),g=p(m,"PageInfo"),b=p(y,"ParentInfo"),z=h("stopPageInfo"),k=h("stopParentInfo");function F(e){const t=e.getBoundingClientRect();return R(),{x:Number(t.left)+Number(v.position.x),y:Number(t.top)+Number(v.position.y)}}function N(e){const t=e?F(P.iframe):{x:0,y:0};let i=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(P,t);window.top===window.self?(v.position=i,A(H)):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](i.x,i.y):n(H,"Unable to scroll to requested position, window.parentIFrame not found")}function A(e){const{x:t,y:i}=v.position,n=w[e]?.iframe;!1!==L("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?I():$()}function C(e){let t={};if(0===P.width&&0===P.height){const e=u(9).split(":");t={x:e[1],y:e[0]}}else t={x:P.width,y:P.height};L(e,{iframe:P.iframe,screenX:Number(t.x),screenY:Number(t.y),type:P.type})}const L=(e,t)=>j(H,e,t);let O=e.data,P={},H=null;"[iFrameResizerChild]Ready"!==O?a===`${O}`.slice(0,s)&&O.slice(s).split(":")[0]in w&&(P=function(){const e=O.slice(s).split(":"),t=e[1]?Number(e[1]):0,n=w[e[0]]?.iframe,o=getComputedStyle(n);return{iframe:n,id:e[0],height:t+i(o)+l(o),width:Number(e[2]),type:e[3],msg:e[4]}}(),H=P.id,H?(function(e){if(!w[e])throw new Error(`${P.type} No settings for ${e}. Message was: ${O}`)}(H),P.type in{true:1,false:1,undefined:1}||(w[H].loaded=!0,function(){let e=!0;return null===P.iframe&&(n(H,`The iframe (${P.id}) was not found.`),e=!1),e}()&&function(){const{origin:t,sameDomain:i}=e;if(i)return!0;let n=w[H]?.checkOrigin;if(n&&"null"!=`${t}`&&!(n.constructor===Array?function(){let e=0,i=!1;for(;e<n.length;e++)if(n[e]===t){i=!0;break}return i}():function(){const e=w[H]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${P.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(w[H]?.firstRun&&w[H]&&(w[H].firstRun=!1),P.type){case"close":T(P.iframe);break;case"message":i=u(6),L("onMessage",{iframe:P.iframe,message:JSON.parse(i)});break;case"mouseenter":C("onMouseEnter");break;case"mouseleave":C("onMouseLeave");break;case"autoResize":w[H].autoResize=JSON.parse(u(9));break;case"scrollBy":!function(){const e=P.width,t=P.height;(window.parentIframe||window).scrollBy(e,t)}();break;case"scrollTo":N(!1);break;case"scrollToOffset":N(!0);break;case"pageInfo":m("start",H),g();break;case"parentInfo":y("start",H),b();break;case"pageInfoStop":z();break;case"parentInfoStop":k();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",i=decodeURIComponent(t);let n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){const e=F(n);v.position={x:e.x,y:e.y},A(H),window.location.hash=t}():window.top!==window.self&&window.parentIFrame&&window.parentIFrame.moveToAnchor(t)}(u(9));break;case"title":!function(e,t){w[t]?.syncTitle&&(w[t].iframe.title=e)}(P.msg,H);break;case"reset":M(P);break;case"init":t(),function(e){try{w[e].sameDomain=!!w[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){w[e].sameDomain=!1}}(H),(e=P.msg)!==r&&(void 0!==e||o(H,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),W=!0,L("onReady",P.iframe);break;default:if(0===P.width&&0===P.height)return void n(`Unsupported message received (${P.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===P.width||0===P.height)return;if(document.hidden)return;t()}var e,i}())):n("iframeResizer received messageData without id, message was: ",O)):Object.keys(w).forEach((e=>{w[e].mode>=0&&x("iFrame requested init",E(e),e)}))}function j(e,t,i){let n=null,o=null;if(w[e]){if(n=w[e][t],"function"!=typeof n)throw new TypeError(`${t} on iFrame[${e}] is not a function`);o=n(i)}return o}function k(e){const t=e.id;delete w[t]}function T(e){const t=e.id;if(!1!==j(t,"onClose",t)){try{e.parentNode&&e.remove()}catch(e){n(e)}j(t,"onClosed",t),k(e)}}function R(e){null===v.position&&(v.position={x:window.scrollX,y:window.scrollY})}function $(){v.position=null}function I(e){null!==v.position&&(window.scrollTo(v.position.x,v.position.y),$())}function M(e){R(e.id),S(e),x("reset","reset",e.id)}function S(e){const t=e.id;function i(t){const i=`${e[t]}px`;e.iframe.style[t]=i}w[t].sizeHeight&&i("height"),w[t].sizeWidth&&i("width")}function x(e,t,i,r){w[i]&&(w[i]?.postMessageTarget?function(){const{postMessageTarget:e,targetOrigin:n}=w[i];if(w[i].sameDomain)try{return void w[i].iframe.contentWindow.iframeChildListener(a+t)}catch(e){}e.postMessage(a+t,n)}():n(i,`[${e}] IFrame(${i}) not found`),r&&w[i]?.warningTimeout&&(w[i].msgTimeout=setTimeout((function(){if(void 0===w[i])return;const{waitForLoad:e}=w[i];w[i].loaded||w[i].loadErrorShown||(w[i].loadErrorShown=!0,o(i,`\n<rb>No response from iFrame</>\n \nThe iframe (<i>${i}</>) has not responded within ${w[i].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${e?"\nThe <b>waitForLoad</> option is currently set to <b>true</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <b>false</>. \n":""}\nThis message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),w[i].warningTimeout)))}function E(e){const t=w[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,v.version,t.mode].join(":")}let F=0,W=!1,N=!1;const A=e=>t=>{function a(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&o(d,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function s(e){const t=w[e]?.iframe?.title;return""===t||void 0===t}const d=function(i){if(i&&"string"!=typeof i)throw new TypeError("Invalid id for iFrame. Expected String");return""!==i&&i||(t.id=i=function(){let t=e?.id||b.id+F++;return null!==document.getElementById(t)&&(t+=F++),t}(),(e||{}).log),i}(t.id);return d in w&&"iFrameResizer"in t?n(d,"Ignored iFrame, already setup."):(function(e){var i,n;w[d]={iframe:t,firstRun:!0,remoteHost:t?.src.split("/").slice(0,3).join("/"),...b,...a(e),mode:g(e),syncTitle:s(d)},function(){if("horizontal"===w[d].direction)return w[d].sizeWidth=!0,void(w[d].sizeHeight=!1);if("none"===w[d].direction)return w[d].sizeWidth=!1,w[d].sizeHeight=!1,void(w[d].autoResize=!1);if("vertical"!==w[d].direction)throw new TypeError(d,`Direction value of "${w[d].direction}" is not valid`)}(),(i=e?.offsetSize||e?.offset)&&("vertical"===w[d].direction?w[d].offsetHeight=i:w[d].offsetWidth=i),e?.offset&&o(d,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===w[d].postMessageTarget&&(w[d].postMessageTarget=t.contentWindow),w[d].targetOrigin=!0===w[d].checkOrigin?""===(n=w[d].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*"}(e),function(){const{mode:e}=w[d];e<0&&o("Parent",`${y(e+2)}${y(2)}`),N||e<0||(N=!0,((e,...t)=>{i("info",e,...t)})(`v${r} (${(e=>f(h[e]))(e)})`),e<1&&o("Parent",y(3)))}(),L(),function(){switch(t.style.overflow=!1===w[d]?.scrolling?"hidden":"auto",w[d]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=w[d]?w[d].scrolling:"no"}}(),function(){const{bodyMargin:e}=w[d];"number"!=typeof e&&"0"!==e||(w[d].bodyMargin=`${e}px`)}(),function(e){const{id:i}=t;-1!==w[i].mode&&-2!==w[i].mode&&(c(t,"load",(function(){x("iFrame.onload",`${e}:${W}`,i,!0),function(){const e=w[d]?.firstRun,i=w[d]?.heightCalculationMethod in l;!e&&i&&M({iframe:t,height:0,width:0,type:"init"})}()})),!1===w[i].waitForLoad&&x("init",`${e}:${W}`,i,!0))}(E(d)),function(){if(w[d]){const e={close:T.bind(null,w[d].iframe),disconnect:k.bind(null,w[d].iframe),removeListeners(){o(d,"\n<rb>Deprecated Method Name</>\n\nThe emoveListeners()</> method has been renamed to isconnect()</>.\n"),this.disconnect()},resize:x.bind(null,"Window resize","resize",d),moveToAnchor(e){x("Move to anchor",`moveToAnchor:${e}`,d)},sendMessage(e){x("Send Message",`message:${e=JSON.stringify(e)}`,d)}};w[d].iframe.iframeResizer=e,w[d].iframe.iFrameResizer=e}}()),t?.iFrameResizer};function C(){!1===document.hidden&&function(e,t){const i=e=>w[e]?.autoResize&&!w[e]?.firstRun;Object.keys(w).forEach((function(n){i(n)&&x(e,t,n)}))}("Tab Visible","resize")}const L=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{c(window,"message",z),c(document,"visibilitychange",C),window.iframeParentListener=e=>z({data:e,sameDomain:!0})})),O="[iframeResizer] ";const P=function(){function e(e){switch(!0){case!e:throw new TypeError(`${O}iframe is not defined`);case!e.tagName:throw new TypeError(`${O}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${O}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),i.push(e)}}let t,i;return function(n,o){if("undefined"==typeof window)return[];switch(t=A(n),i=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${O}Unexpected data type (${typeof o})`)}return Object.freeze(i)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){o("","Deprecated: iFrameResize(), please use iframeResize()"),P(...e)}),P}));
/*!
* @preserve
*
* @module iframe-resizer/legacy (parent) 5.1.5-beta.1 (umd) - 2024-07-10
* @module iframe-resizer/legacy (parent) 5.2.3 (umd) - 2024-08-05
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @desciption Keep same and cross domain iFrames sized to their content
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
* @see {@link https://iframe-resizer.com}
*

@@ -20,1302 +20,2 @@ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.iframeResize = factory());
})(this, (function () { 'use strict';
const msg = `IFRAME-RESIZER 5
This package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.
Version 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.
Please see https://iframe-resizer.com/upgrade for more details.
`;
console.warn(msg);
const encode = (s) =>
s
.replaceAll('<br>', '\n')
.replaceAll('<rb>', '\u001B[31;1m')
.replaceAll('</>', '\u001B[m')
.replaceAll('<b>', '\u001B[1m')
.replaceAll('<i>', '\u001B[3m')
.replaceAll('<u>', '\u001B[4m');
const remove = (s) => s.replaceAll('<br>', '\n').replaceAll(/<[/a-z]+>/gi, '');
const formatAdvise = (formatLogMsg) => (msg) =>
window.chrome // Only show formatting in Chrome as not supported in other browsers
? formatLogMsg(encode(msg))
: formatLogMsg(remove(msg));
const msgId$1 = '[iframe-resizer]';
function setLogEnabled(enabled) {
}
function getMyID(iframeId) {
if (window.top === window.self) {
return `Parent page: ${iframeId}`
}
return window?.parentIFrame?.getId
? `${window.parentIFrame.getId()}: ${iframeId}`
: `Nested parent page: ${iframeId}`
}
const formatLogHeader = (iframeId) => `${msgId$1}[${getMyID(iframeId)}]`;
const formatLogMsg =
(iframeId) =>
(...msg) =>
[`${msgId$1}[${iframeId}]`, ...msg].join(' ');
const output = (type, iframeId, ...msg) =>
// eslint-disable-next-line no-console
window?.console[type](formatLogHeader(iframeId), ...msg);
const info = (iframeId, ...msg) => output('info', iframeId, ...msg);
const warn = (iframeId, ...msg) => output('warn', iframeId, ...msg);
const advise = (iframeId, msg) =>
// eslint-disable-next-line no-console
console?.warn(formatAdvise(formatLogMsg(iframeId))(msg));
const VERSION = '5.1.5-beta.1';
const msgHeader = 'message';
const msgHeaderLen = msgHeader.length;
const msgId = '[iFrameSizer]'; // Must match iframe msg ID
const msgIdLen = msgId.length;
const resetRequiredMethods = Object.freeze({
max: 1,
scroll: 1,
bodyScroll: 1,
documentElementScroll: 1,
});
const addEventListener = (el, evt, func, options) =>
el.addEventListener(evt, func, options || false);
const removeEventListener = (el, evt, func) =>
el.removeEventListener(evt, func, false);
const l = (l) => {
if (!l) return ''
let p = -559038744,
y = 1103547984;
for (let z, t = 0; t < l.length; t++)
(z = l.codePointAt(t)),
(p = Math.imul(p ^ z, 2246822519)),
(y = Math.imul(y ^ z, 3266489917));
return (
(p ^= Math.imul(p ^ (y >>> 15), 1935289751)),
(y ^= Math.imul(y ^ (p >>> 15), 3405138345)),
(p ^= y >>> 16),
(y ^= p >>> 16),
(2097152 * (y >>> 0) + (p >>> 11)).toString(36)
)
},
p = (l) =>
l.replaceAll(/[A-Za-z]/g, (l) =>
String.fromCodePoint(
(l <= 'Z' ? 90 : 122) >= (l = l.codePointAt(0) + 19) ? l : l - 26,
),
),
y = [
'<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>.',
],
z = ['NWSc3', 'zvsv', 'wyv', 'ibzpulzz', 'vlt'],
t = Object.fromEntries(
[
'2cgs7fdf4xb',
'1c9ctcccr4z',
'1q2pc4eebgb',
'ueokt0969w',
'w2zxchhgqz',
'1umuxblj2e5',
].map((l, p) => [l, Math.max(0, p - 1)]),
);
const getModeData = (l) => p(y[l]);
const getModeLabel = (l) => p(z[l]);
const setMode = (y) => {
const z = y[p('spjluzl')];
if (!z) return -1
const u = z.split('-');
let v = (function (y = '') {
let z = -2;
const u = l(p(y));
return u in t && (z = t[u]), z
})(u[0]);
return 0 === v || ((p) => p[2] === l(p[0] + p[1]))(u) || (v = -2), v
};
const once = (fn) => {
let done = false;
return function () {
return done
? undefined
: ((done = true), Reflect.apply(fn, this, arguments))
}
};
const settings = {};
const onReadyDeprecated = (messageData) => {
if (typeof settings[messageData.id].onInit === 'function') {
advise(
messageData.id,
`
\u001B[31;1mDeprecated Option\u001B[m
The \u001B[1monInit()\u001B[m function is deprecated and has been replaced with \u001B[1monReady()\u001B[m. It will be removed in a future version of iFrame Resizer.
`,
);
settings[messageData.id].onInit(messageData);
}
};
const defaults = Object.freeze({
autoResize: true,
bodyBackground: null,
bodyMargin: null,
bodyPadding: null,
checkOrigin: true,
direction: 'vertical',
inPageLinks: false,
heightCalculationMethod: 'auto',
id: 'iFrameResizer',
log: false,
license: undefined,
mouseEvents: true,
offsetHeight: null,
offsetWidth: null,
postMessageTarget: null,
sameDomain: false,
scrolling: false,
sizeHeight: true,
// sizeSelector: '',
sizeWidth: false,
warningTimeout: 5000,
tolerance: 0,
waitForLoad: false,
widthCalculationMethod: 'auto',
onClose: () => true,
onClosed() {},
onInit: false,
onMessage: null,
onMouseEnter() {},
onMouseLeave() {},
onReady: onReadyDeprecated,
onResized() {},
onScroll: () => true,
});
const page = {
position: null,
version: VERSION,
};
function iframeListener(event) {
function resizeIFrame() {
setSize(messageData);
setPagePosition();
on('onResized', messageData);
}
function getPaddingEnds(compStyle) {
if (compStyle.boxSizing !== 'border-box') {
return 0
}
const top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0;
const bot = compStyle.paddingBottom
? parseInt(compStyle.paddingBottom, 10)
: 0;
return top + bot
}
function getBorderEnds(compStyle) {
if (compStyle.boxSizing !== 'border-box') {
return 0
}
const top = compStyle.borderTopWidth
? parseInt(compStyle.borderTopWidth, 10)
: 0;
const bot = compStyle.borderBottomWidth
? parseInt(compStyle.borderBottomWidth, 10)
: 0;
return top + bot
}
function processMsg() {
const data = msg.slice(msgIdLen).split(':');
const height = data[1] ? Number(data[1]) : 0;
const iframe = settings[data[0]]?.iframe;
const compStyle = getComputedStyle(iframe);
return {
iframe,
id: data[0],
height: height + getPaddingEnds(compStyle) + getBorderEnds(compStyle),
width: Number(data[2]),
type: data[3],
msg: data[4],
}
}
function isMessageFromIFrame() {
function checkAllowedOrigin() {
function checkList() {
let i = 0;
let retCode = false;
for (; i < checkOrigin.length; i++) {
if (checkOrigin[i] === origin) {
retCode = true;
break
}
}
return retCode
}
function checkSingle() {
const remoteHost = settings[iframeId]?.remoteHost;
return origin === remoteHost
}
return checkOrigin.constructor === Array ? checkList() : checkSingle()
}
const { origin, sameDomain } = event;
if (sameDomain) {
return true
}
let checkOrigin = settings[iframeId]?.checkOrigin;
if (checkOrigin && `${origin}` !== 'null' && !checkAllowedOrigin()) {
throw new Error(
`Unexpected message received from: ${origin} for ${messageData.iframe.id}. Message was: ${event.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`,
)
}
return true
}
function isMessageForUs() {
return (
msgId === `${msg}`.slice(0, msgIdLen) &&
msg.slice(msgIdLen).split(':')[0] in settings
) // ''+Protects against non-string msg
}
function isMessageFromMetaParent() {
// Test if this message is from a parent above us. This is an ugly test, however, updating
// the message format would break backwards compatibility.
const retCode = messageData.type in { true: 1, false: 1, undefined: 1 };
return retCode
}
function getMsgBody(offset) {
return msg.slice(msg.indexOf(':') + msgHeaderLen + offset)
}
function forwardMsgFromIFrame(msgBody) {
on('onMessage', {
iframe: messageData.iframe,
message: JSON.parse(msgBody),
});
}
function getPageInfo() {
const bodyPosition = document.body.getBoundingClientRect();
const iFramePosition = messageData.iframe.getBoundingClientRect();
const { scrollY, scrollX, innerHeight, innerWidth } = window;
const { clientHeight, clientWidth } = document.documentElement;
return JSON.stringify({
iframeHeight: iFramePosition.height,
iframeWidth: iFramePosition.width,
clientHeight: Math.max(clientHeight, innerHeight || 0),
clientWidth: Math.max(clientWidth, innerWidth || 0),
offsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),
offsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),
scrollTop: scrollY,
scrollLeft: scrollX,
documentHeight: clientHeight,
documentWidth: clientWidth,
windowHeight: innerHeight,
windowWidth: innerWidth,
})
}
function getParentProps() {
const { iframe } = messageData;
const { scrollWidth, scrollHeight } = document.documentElement;
const { width, height, offsetLeft, offsetTop, pageLeft, pageTop, scale } =
window.visualViewport;
return JSON.stringify({
iframe: iframe.getBoundingClientRect(),
document: {
scrollWidth,
scrollHeight,
},
viewport: {
width,
height,
offsetLeft,
offsetTop,
pageLeft,
pageTop,
scale,
},
})
}
const sendInfoToIframe = (type, infoFunction) => (requestType, iframeId) => {
const gate = {};
function throttle(func, frameId) {
if (!gate[frameId]) {
func();
gate[frameId] = requestAnimationFrame(() => {
gate[frameId] = null;
});
}
}
function gatedTrigger() {
trigger(
`Send ${type} (${requestType})`,
`${type}:${infoFunction()}`,
iframeId,
);
}
throttle(gatedTrigger, iframeId);
};
const startInfoMonitor = (sendInfoToIframe, type) => () => {
const sendInfo = (requestType) => () => {
if (settings[id]) {
sendInfoToIframe(requestType, id);
} else {
stop();
}
};
function setListener(requestType, listener) {
listener(window, 'scroll', sendInfo('scroll'));
listener(window, 'resize', sendInfo('resize window'));
}
function stop() {
setListener('Remove ', removeEventListener);
pageObserver.disconnect();
iframeObserver.disconnect();
}
function start() {
setListener('Add ', addEventListener);
pageObserver.observe(document.body, {
attributes: true,
childList: true,
subtree: true,
});
iframeObserver.observe(settings[id].iframe, {
attributes: true,
childList: false,
subtree: false,
});
}
const id = iframeId; // Create locally scoped copy of iFrame ID
const pageObserver = new ResizeObserver(sendInfo('page observed'));
const iframeObserver = new ResizeObserver(sendInfo('iframe observed'));
start();
if (settings[id]) {
settings[id][`stop${type}`] = stop;
}
};
const stopInfoMonitor = (stopFunction) => () => {
if (stopFunction in settings[iframeId]) {
settings[iframeId][stopFunction]();
delete settings[iframeId][stopFunction];
}
};
const sendPageInfoToIframe = sendInfoToIframe('pageInfo', getPageInfo);
const sendParentInfoToIframe = sendInfoToIframe('parentInfo', getParentProps);
const startPageInfoMonitor = startInfoMonitor(
sendPageInfoToIframe,
'PageInfo',
);
const startParentInfoMonitor = startInfoMonitor(
sendParentInfoToIframe,
'ParentInfo',
);
const stopPageInfoMonitor = stopInfoMonitor('stopPageInfo');
const stopParentInfoMonitor = stopInfoMonitor('stopParentInfo');
function checkIFrameExists() {
let retBool = true;
if (messageData.iframe === null) {
warn(iframeId, `The iframe (${messageData.id}) was not found.`);
retBool = false;
}
return retBool
}
function getElementPosition(target) {
const iFramePosition = target.getBoundingClientRect();
getPagePosition();
return {
x: Number(iFramePosition.left) + Number(page.position.x),
y: Number(iFramePosition.top) + Number(page.position.y),
}
}
function scrollBy() {
const x = messageData.width;
const y = messageData.height;
const target = window.parentIframe || window;
target.scrollBy(x, y);
}
function scrollRequestFromChild(addOffset) {
/* istanbul ignore next */ // Not testable in Karma
function reposition() {
page.position = newPosition;
scrollTo(iframeId);
}
function scrollParent() {
if (window.parentIFrame) {
window.parentIFrame[`scrollTo${addOffset ? 'Offset' : ''}`](
newPosition.x,
newPosition.y,
);
} else {
warn(
iframeId,
'Unable to scroll to requested position, window.parentIFrame not found',
);
}
}
const calcOffset = (messageData, offset) => ({
x: messageData.width + offset.x,
y: messageData.height + offset.y,
});
const offset = addOffset
? getElementPosition(messageData.iframe)
: { x: 0, y: 0 };
let newPosition = calcOffset(messageData, offset);
if (window.top === window.self) {
reposition();
} else {
scrollParent();
}
}
function scrollTo(iframeId) {
const { x, y } = page.position;
const iframe = settings[iframeId]?.iframe;
if (on('onScroll', { iframe, top: y, left: x, x, y }) === false) {
unsetPagePosition();
return
}
setPagePosition();
}
function findTarget(location) {
function jumpToTarget() {
const jumpPosition = getElementPosition(target);
page.position = {
x: jumpPosition.x,
y: jumpPosition.y,
};
scrollTo(iframeId);
}
function jumpToParent() {
if (window.parentIFrame) {
window.parentIFrame.moveToAnchor(hash);
return
}
}
const hash = location.split('#')[1] || '';
const hashData = decodeURIComponent(hash);
let target =
document.getElementById(hashData) ||
document.getElementsByName(hashData)[0];
if (target) {
jumpToTarget();
return
}
if (window.top === window.self) {
return
}
jumpToParent();
}
function onMouse(event) {
let mousePos = {};
if (messageData.width === 0 && messageData.height === 0) {
const data = getMsgBody(9).split(':');
mousePos = {
x: data[1],
y: data[0],
};
} else {
mousePos = {
x: messageData.width,
y: messageData.height,
};
}
on(event, {
iframe: messageData.iframe,
screenX: Number(mousePos.x),
screenY: Number(mousePos.y),
type: messageData.type,
});
}
const on = (funcName, val) => chkEvent(iframeId, funcName, val);
function checkSameDomain(id) {
try {
settings[id].sameDomain =
!!settings[id]?.iframe?.contentWindow?.iframeChildListener;
} catch (error) {
settings[id].sameDomain = false;
}
}
function checkVersion(version) {
if (version === VERSION) return
if (version === undefined) {
advise(
iframeId,
`<rb>Legacy version detected in iframe</>
Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
`,
);
return
}
}
function setTitle(title, iframeId) {
if (!settings[iframeId]?.syncTitle) return
settings[iframeId].iframe.title = title;
}
function started() {
setup = true;
}
function actionMsg() {
if (settings[iframeId]?.firstRun) firstRun();
switch (messageData.type) {
case 'close':
closeIFrame(messageData.iframe);
break
case 'message':
forwardMsgFromIFrame(getMsgBody(6));
break
case 'mouseenter':
onMouse('onMouseEnter');
break
case 'mouseleave':
onMouse('onMouseLeave');
break
case 'autoResize':
settings[iframeId].autoResize = JSON.parse(getMsgBody(9));
break
case 'scrollBy':
scrollBy();
break
case 'scrollTo':
scrollRequestFromChild(false);
break
case 'scrollToOffset':
scrollRequestFromChild(true);
break
case 'pageInfo':
sendPageInfoToIframe('start', iframeId);
startPageInfoMonitor();
break
case 'parentInfo':
sendParentInfoToIframe('start', iframeId);
startParentInfoMonitor();
break
case 'pageInfoStop':
stopPageInfoMonitor();
break
case 'parentInfoStop':
stopParentInfoMonitor();
break
case 'inPageLink':
findTarget(getMsgBody(9));
break
case 'title':
setTitle(messageData.msg, iframeId);
break
case 'reset':
resetIFrame(messageData);
break
case 'init':
resizeIFrame();
checkSameDomain(iframeId);
checkVersion(messageData.msg);
started();
on('onReady', messageData.iframe);
break
default:
if (messageData.width === 0 && messageData.height === 0) {
warn(
`Unsupported message received (${messageData.type}), this is likely due to the iframe containing a later ` +
`version of iframe-resizer than the parent page`,
);
return
}
if (messageData.width === 0 || messageData.height === 0) {
return
}
// Recheck document.hidden here, as only Firefox
// correctly supports this in the iframe
if (document.hidden) {
return
}
resizeIFrame();
}
}
function checkSettings(iframeId) {
if (!settings[iframeId]) {
throw new Error(
`${messageData.type} No settings for ${iframeId}. Message was: ${msg}`,
)
}
}
function iFrameReadyMsgReceived() {
Object.keys(settings).forEach((iframeId) => {
if (settings[iframeId].mode >= 0)
trigger('iFrame requested init', createOutgoingMsg(iframeId), iframeId);
});
}
function firstRun() {
if (settings[iframeId]) {
settings[iframeId].firstRun = false;
}
}
let msg = event.data;
let messageData = {};
let iframeId = null;
if (msg === '[iFrameResizerChild]Ready') {
iFrameReadyMsgReceived();
return
}
if (!isMessageForUs()) {
return
}
messageData = processMsg();
iframeId = messageData.id;
if (!iframeId) {
warn('iframeResizer received messageData without id, message was: ', msg);
return
}
checkSettings(iframeId);
if (!isMessageFromMetaParent()) {
settings[iframeId].loaded = true;
if (checkIFrameExists() && isMessageFromIFrame()) {
actionMsg();
}
}
}
function chkEvent(iframeId, funcName, val) {
let func = null;
let retVal = null;
if (settings[iframeId]) {
func = settings[iframeId][funcName];
if (typeof func === 'function') {
retVal = func(val);
} else {
throw new TypeError(
`${funcName} on iFrame[${iframeId}] is not a function`,
)
}
}
return retVal
}
function removeIframeListeners(iframe) {
const iframeId = iframe.id;
delete settings[iframeId];
}
function closeIFrame(iframe) {
const iframeId = iframe.id;
if (chkEvent(iframeId, 'onClose', iframeId) === false) {
return
}
try {
// Catch race condition error with React
if (iframe.parentNode) {
iframe.remove();
}
} catch (error) {
warn(error);
}
chkEvent(iframeId, 'onClosed', iframeId);
removeIframeListeners(iframe);
}
function getPagePosition(iframeId) {
if (page.position === null) {
page.position = {
x: window.scrollX,
y: window.scrollY,
};
}
}
function unsetPagePosition() {
page.position = null;
}
function setPagePosition(iframeId) {
if (page.position !== null) {
window.scrollTo(page.position.x, page.position.y);
unsetPagePosition();
}
}
function resetIFrame(messageData) {
getPagePosition(messageData.id);
setSize(messageData);
trigger('reset', 'reset', messageData.id);
}
function setSize(messageData) {
const iframeId = messageData.id;
function setDimension(dimension) {
const size = `${messageData[dimension]}px`;
messageData.iframe.style[dimension] = size;
}
if (settings[iframeId].sizeHeight) {
setDimension('height');
}
if (settings[iframeId].sizeWidth) {
setDimension('width');
}
}
function trigger(calleeMsg, msg, id, noResponseWarning) {
function postMessageToIFrame() {
const { postMessageTarget, targetOrigin } = settings[id];
if (settings[id].sameDomain) {
try {
settings[id].iframe.contentWindow.iframeChildListener(msgId + msg);
return
} catch (error) {
}
}
postMessageTarget.postMessage(msgId + msg, targetOrigin);
}
function iFrameNotFound() {
warn(id, `[${calleeMsg}] IFrame(${id}) not found`);
}
function chkAndSend() {
if (!settings[id]?.postMessageTarget) {
iFrameNotFound();
return
}
postMessageToIFrame();
}
function warnOnNoResponse() {
function warning() {
if (settings[id] === undefined) return // iframe has been closed while we where waiting
if (!settings[id].loaded && !settings[id].loadErrorShown) {
settings[id].loadErrorShown = true;
advise(
id,
`
<rb>No response from iFrame</>
The iframe (<i>${id}</>) has not responded within ${settings[id].warningTimeout / 1000} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.
`,
);
}
}
if (!!noResponseWarning && !!settings[id]?.warningTimeout) {
settings[id].msgTimeout = setTimeout(warning, settings[id].warningTimeout);
}
}
if (settings[id]) {
chkAndSend();
warnOnNoResponse();
}
}
function createOutgoingMsg(iframeId) {
const iframeSettings = settings[iframeId];
return [
iframeId,
'8', // Backwards compatibility (PaddingV1)
iframeSettings.sizeWidth,
iframeSettings.log,
'32', // Backwards compatibility (Interval)
true, // Backwards compatibility (EnablePublicMethods)
iframeSettings.autoResize,
iframeSettings.bodyMargin,
iframeSettings.heightCalculationMethod,
iframeSettings.bodyBackground,
iframeSettings.bodyPadding,
iframeSettings.tolerance,
iframeSettings.inPageLinks,
'child', // Backwards compatibility (resizeFrom)
iframeSettings.widthCalculationMethod,
iframeSettings.mouseEvents,
iframeSettings.offsetHeight,
iframeSettings.offsetWidth,
iframeSettings.sizeHeight,
iframeSettings.license,
page.version,
iframeSettings.mode,
// iframeSettings.sizeSelector,
].join(':')
}
let count = 0;
let setup = false;
let vAdvised = false;
const connectResizer = (options) => (iframe) => {
function newId() {
let id = options?.id || defaults.id + count++;
if (document.getElementById(id) !== null) {
id += count++;
}
return id
}
function ensureHasId(iframeId) {
if (iframeId && typeof iframeId !== 'string') {
throw new TypeError('Invalid id for iFrame. Expected String')
}
if (iframeId === '' || !iframeId) {
// eslint-disable-next-line no-multi-assign
iframe.id = iframeId = newId();
setLogEnabled((options || {}).log);
}
return iframeId
}
function setScrolling() {
iframe.style.overflow =
settings[iframeId]?.scrolling === false ? 'hidden' : 'auto';
switch (settings[iframeId]?.scrolling) {
case 'omit':
break
case true:
iframe.scrolling = 'yes';
break
case false:
iframe.scrolling = 'no';
break
default:
iframe.scrolling = settings[iframeId]
? settings[iframeId].scrolling
: 'no';
}
}
function setupBodyMarginValues() {
const { bodyMargin } = settings[iframeId];
if (typeof bodyMargin === 'number' || bodyMargin === '0') {
settings[iframeId].bodyMargin = `${bodyMargin}px`;
}
}
function checkReset() {
const firstRun = settings[iframeId]?.firstRun;
const resetRequestMethod =
settings[iframeId]?.heightCalculationMethod in resetRequiredMethods;
if (!firstRun && resetRequestMethod) {
resetIFrame({ iframe, height: 0, width: 0, type: 'init' });
}
}
function setupIFrameObject() {
if (settings[iframeId]) {
const resizer = {
close: closeIFrame.bind(null, settings[iframeId].iframe),
disconnect: removeIframeListeners.bind(null, settings[iframeId].iframe),
removeListeners() {
advise(
iframeId,
`
<rb>Deprecated Method Name</>
The \u001B[removeListeners()</> method has been renamed to \u001B[disconnect()</>.
`,
);
this.disconnect();
},
resize: trigger.bind(null, 'Window resize', 'resize', iframeId),
moveToAnchor(anchor) {
trigger('Move to anchor', `moveToAnchor:${anchor}`, iframeId);
},
sendMessage(message) {
message = JSON.stringify(message);
trigger('Send Message', `message:${message}`, iframeId);
},
};
settings[iframeId].iframe.iframeResizer = resizer;
settings[iframeId].iframe.iFrameResizer = resizer;
}
}
// We have to call trigger twice, as we can not be sure if all
// iframes have completed loading when this code runs. The
// event listener also catches the page changing in the iFrame.
function init(msg) {
function iFrameLoaded() {
trigger('iFrame.onload', `${msg}:${setup}`, id, true);
checkReset();
}
const { id } = iframe;
if (settings[id].mode === -1) return // modal()
if (settings[id].mode === -2) return
addEventListener(iframe, 'load', iFrameLoaded);
if (settings[id].waitForLoad === false)
trigger('init', `${msg}:${setup}`, id, true);
}
function checkOptions(options) {
if (!options) return {}
if (typeof options !== 'object') {
throw new TypeError('Options is not an object')
}
if (
'sizeWidth' in options ||
'sizeHeight' in options ||
'autoResize' in options
) {
advise(
iframeId,
`<rb>Deprecated Option</>
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.
`,
);
}
return options
}
function checkMode() {
const { mode } = settings[iframeId];
if (mode < 0) advise('Parent', `${getModeData(mode + 2)}${getModeData(2)}`);
if (vAdvised || mode < 0) return
vAdvised = true;
info(`v${VERSION} (${getModeLabel(mode)})`);
if (mode < 1) advise('Parent', getModeData(3));
}
function setDirection() {
if (settings[iframeId].direction === 'horizontal') {
settings[iframeId].sizeWidth = true;
settings[iframeId].sizeHeight = false;
return
}
if (settings[iframeId].direction === 'none') {
settings[iframeId].sizeWidth = false;
settings[iframeId].sizeHeight = false;
settings[iframeId].autoResize = false;
return
}
if (settings[iframeId].direction !== 'vertical') {
throw new TypeError(
iframeId,
`Direction value of "${settings[iframeId].direction}" is not valid`,
)
}
}
function setOffset(offset) {
if (!offset) return
if (settings[iframeId].direction === 'vertical') {
settings[iframeId].offsetHeight = offset;
} else {
settings[iframeId].offsetWidth = offset;
}
}
function getTargetOrigin(remoteHost) {
return remoteHost === '' ||
remoteHost.match(/^(about:blank|javascript:|file:\/\/)/) !== null
? '*'
: remoteHost
}
function getPostMessageTarget() {
if (settings[iframeId].postMessageTarget === null)
settings[iframeId].postMessageTarget = iframe.contentWindow;
}
function chkTitle(iframeId) {
const title = settings[iframeId]?.iframe?.title;
return title === '' || title === undefined
}
function processOptions(options) {
settings[iframeId] = {
iframe,
firstRun: true,
remoteHost: iframe?.src.split('/').slice(0, 3).join('/'),
...defaults,
...checkOptions(options),
mode: setMode(options),
syncTitle: chkTitle(iframeId),
};
setDirection();
setOffset(options?.offset);
getPostMessageTarget();
settings[iframeId].targetOrigin =
settings[iframeId].checkOrigin === true
? getTargetOrigin(settings[iframeId].remoteHost)
: '*';
}
function beenHere() {
return iframeId in settings && 'iFrameResizer' in iframe
}
const iframeId = ensureHasId(iframe.id);
if (beenHere()) {
warn(iframeId, 'Ignored iFrame, already setup.');
} else {
processOptions(options);
checkMode();
setupEventListenersOnce();
setScrolling();
setupBodyMarginValues();
init(createOutgoingMsg(iframeId));
setupIFrameObject();
}
return iframe?.iFrameResizer
};
function sendTriggerMsg(eventName, event) {
function triggerEnabledIframe(iframeId) {
if (isIFrameResizeEnabled(iframeId)) {
trigger(eventName, event, iframeId);
}
}
const isIFrameResizeEnabled = (iframeId) =>
settings[iframeId]?.autoResize && !settings[iframeId]?.firstRun;
Object.keys(settings).forEach(triggerEnabledIframe);
}
function tabVisible() {
if (document.hidden === false) {
sendTriggerMsg('Tab Visible', 'resize');
}
}
const setupEventListenersOnce = once(() => {
addEventListener(window, 'message', iframeListener);
addEventListener(document, 'visibilitychange', tabVisible);
window.iframeParentListener = (data) =>
iframeListener({ data, sameDomain: true });
});
const id = '[iframeResizer] ';
function createIframeResize() {
function setup(element) {
switch (true) {
case !element:
throw new TypeError(`${id}iframe is not defined`)
case !element.tagName:
throw new TypeError(`${id}Not a valid DOM element`)
case element.tagName.toUpperCase() !== 'IFRAME':
throw new TypeError(
`${id}Expected <IFRAME> tag, found <${element.tagName}>`,
)
default:
connectWithOptions(element);
iFrames.push(element);
}
}
let connectWithOptions;
let iFrames;
return function (options, target) {
if (typeof window === 'undefined') return [] // don't run for server side render
connectWithOptions = connectResizer(options);
iFrames = []; // Only return iFrames passed in on this call
switch (typeof target) {
case 'undefined':
case 'string':
document.querySelectorAll(target || 'iframe').forEach(setup);
break
case 'object':
setup(target);
break
default:
throw new TypeError(`${id}Unexpected data type (${typeof target})`)
}
return Object.freeze(iFrames)
}
}
const iframeResize = createIframeResize();
if (typeof window !== 'undefined') {
window.iFrameResize =
window.iFrameResize ||
function (...args) {
advise('', 'Deprecated: iFrameResize(), please use iframeResize()');
iframeResize(...args);
};
}
return iframeResize;
}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="[iframe-resizer]";const t=t=>`${e}[${function(e){return window.top===window.self?`Parent page: ${e}`:window?.parentIFrame?.getId?`${window.parentIFrame.getId()}: ${e}`:`Nested parent page: ${e}`}(t)}]`,i=(e,i,...n)=>window?.console[e](t(i),...n),n=(e,...t)=>i("warn",e,...t),o=(t,i)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))((t=>(...i)=>[`${e}[${t}]`,...i].join(" "))(t))(i)),r="5.2.3",a="[iFrameSizer]",s=a.length,l=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),c=(e,t,i,n)=>e.addEventListener(t,i,n||!1),d=(e,t,i)=>e.removeEventListener(t,i,!1),u=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),t=Math.imul(t^n,2246822519),i=Math.imul(i^n,3266489917);return t^=Math.imul(t^i>>>15,1935289751),i^=Math.imul(i^t>>>15,3405138345),t^=i>>>16,i^=t>>>16,(2097152*(i>>>0)+(t>>>11)).toString(36)},f=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),p=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."],h=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],m=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),y=e=>f(p[e]),g=e=>{const t=e[f("spjluzl")];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=u(f(e));return i in m&&(t=m[i]),t}(i[0]);return 0===n||(e=>e[2]===u(e[0]+e[1]))(i)||(n=-2),n},w={},b=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof w[e.id].onInit&&(o(e.id,"\nDeprecated Option\n\nThe onInit() function is deprecated and has been replaced with onReady(). It will be removed in a future version of iFrame Resizer.\n "),w[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),v={position:null,version:r};function z(e){function t(){S(P),I(),L("onResized",P)}function i(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function l(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}function u(e){return O.slice(O.indexOf(":")+7+e)}const f=(e,t)=>(i,n)=>{const o={};var r,a;r=function(){x(`Send ${e} (${i})`,`${e}:${t()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},p=(e,t)=>()=>{const i=t=>()=>{w[r]?e(t,r):o()};function n(e,t){t(window,"scroll",i("scroll")),t(window,"resize",i("resize window"))}function o(){n(0,d),a.disconnect(),s.disconnect()}const r=H,a=new ResizeObserver(i("page observed")),s=new ResizeObserver(i("iframe observed"));n(0,c),a.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),s.observe(w[r].iframe,{attributes:!0,childList:!1,subtree:!1}),w[r]&&(w[r][`stop${t}`]=o)},h=e=>()=>{e in w[H]&&(w[H][e](),delete w[H][e])},m=f("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=P.iframe.getBoundingClientRect(),{scrollY:i,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),y=f("parentInfo",(function(){const{iframe:e}=P,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:i},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),g=p(m,"PageInfo"),b=p(y,"ParentInfo"),z=h("stopPageInfo"),k=h("stopParentInfo");function F(e){const t=e.getBoundingClientRect();return R(),{x:Number(t.left)+Number(v.position.x),y:Number(t.top)+Number(v.position.y)}}function N(e){const t=e?F(P.iframe):{x:0,y:0};let i=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(P,t);window.top===window.self?(v.position=i,A(H)):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](i.x,i.y):n(H,"Unable to scroll to requested position, window.parentIFrame not found")}function A(e){const{x:t,y:i}=v.position,n=w[e]?.iframe;!1!==L("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?I():$()}function C(e){let t={};if(0===P.width&&0===P.height){const e=u(9).split(":");t={x:e[1],y:e[0]}}else t={x:P.width,y:P.height};L(e,{iframe:P.iframe,screenX:Number(t.x),screenY:Number(t.y),type:P.type})}const L=(e,t)=>j(H,e,t);let O=e.data,P={},H=null;"[iFrameResizerChild]Ready"!==O?a===`${O}`.slice(0,s)&&O.slice(s).split(":")[0]in w&&(P=function(){const e=O.slice(s).split(":"),t=e[1]?Number(e[1]):0,n=w[e[0]]?.iframe,o=getComputedStyle(n);return{iframe:n,id:e[0],height:t+i(o)+l(o),width:Number(e[2]),type:e[3],msg:e[4]}}(),H=P.id,H?(function(e){if(!w[e])throw new Error(`${P.type} No settings for ${e}. Message was: ${O}`)}(H),P.type in{true:1,false:1,undefined:1}||(w[H].loaded=!0,function(){let e=!0;return null===P.iframe&&(n(H,`The iframe (${P.id}) was not found.`),e=!1),e}()&&function(){const{origin:t,sameDomain:i}=e;if(i)return!0;let n=w[H]?.checkOrigin;if(n&&"null"!=`${t}`&&!(n.constructor===Array?function(){let e=0,i=!1;for(;e<n.length;e++)if(n[e]===t){i=!0;break}return i}():function(){const e=w[H]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${P.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(w[H]?.firstRun&&w[H]&&(w[H].firstRun=!1),P.type){case"close":T(P.iframe);break;case"message":i=u(6),L("onMessage",{iframe:P.iframe,message:JSON.parse(i)});break;case"mouseenter":C("onMouseEnter");break;case"mouseleave":C("onMouseLeave");break;case"autoResize":w[H].autoResize=JSON.parse(u(9));break;case"scrollBy":!function(){const e=P.width,t=P.height;(window.parentIframe||window).scrollBy(e,t)}();break;case"scrollTo":N(!1);break;case"scrollToOffset":N(!0);break;case"pageInfo":m("start",H),g();break;case"parentInfo":y("start",H),b();break;case"pageInfoStop":z();break;case"parentInfoStop":k();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",i=decodeURIComponent(t);let n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){const e=F(n);v.position={x:e.x,y:e.y},A(H),window.location.hash=t}():window.top!==window.self&&window.parentIFrame&&window.parentIFrame.moveToAnchor(t)}(u(9));break;case"title":!function(e,t){w[t]?.syncTitle&&(w[t].iframe.title=e)}(P.msg,H);break;case"reset":M(P);break;case"init":t(),function(e){try{w[e].sameDomain=!!w[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){w[e].sameDomain=!1}}(H),(e=P.msg)!==r&&(void 0!==e||o(H,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),W=!0,L("onReady",P.iframe);break;default:if(0===P.width&&0===P.height)return void n(`Unsupported message received (${P.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===P.width||0===P.height)return;if(document.hidden)return;t()}var e,i}())):n("iframeResizer received messageData without id, message was: ",O)):Object.keys(w).forEach((e=>{w[e].mode>=0&&x("iFrame requested init",E(e),e)}))}function j(e,t,i){let n=null,o=null;if(w[e]){if(n=w[e][t],"function"!=typeof n)throw new TypeError(`${t} on iFrame[${e}] is not a function`);o=n(i)}return o}function k(e){const t=e.id;delete w[t]}function T(e){const t=e.id;if(!1!==j(t,"onClose",t)){try{e.parentNode&&e.remove()}catch(e){n(e)}j(t,"onClosed",t),k(e)}}function R(e){null===v.position&&(v.position={x:window.scrollX,y:window.scrollY})}function $(){v.position=null}function I(e){null!==v.position&&(window.scrollTo(v.position.x,v.position.y),$())}function M(e){R(e.id),S(e),x("reset","reset",e.id)}function S(e){const t=e.id;function i(t){const i=`${e[t]}px`;e.iframe.style[t]=i}w[t].sizeHeight&&i("height"),w[t].sizeWidth&&i("width")}function x(e,t,i,r){w[i]&&(w[i]?.postMessageTarget?function(){const{postMessageTarget:e,targetOrigin:n}=w[i];if(w[i].sameDomain)try{return void w[i].iframe.contentWindow.iframeChildListener(a+t)}catch(e){}e.postMessage(a+t,n)}():n(i,`[${e}] IFrame(${i}) not found`),r&&w[i]?.warningTimeout&&(w[i].msgTimeout=setTimeout((function(){if(void 0===w[i])return;const{waitForLoad:e}=w[i];w[i].loaded||w[i].loadErrorShown||(w[i].loadErrorShown=!0,o(i,`\n<rb>No response from iFrame</>\n \nThe iframe (<i>${i}</>) has not responded within ${w[i].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${e?"\nThe <b>waitForLoad</> option is currently set to <b>true</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <b>false</>. \n":""}\nThis message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),w[i].warningTimeout)))}function E(e){const t=w[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,v.version,t.mode].join(":")}let F=0,W=!1,N=!1;const A=e=>t=>{function a(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&o(d,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function s(e){const t=w[e]?.iframe?.title;return""===t||void 0===t}const d=function(i){if(i&&"string"!=typeof i)throw new TypeError("Invalid id for iFrame. Expected String");return""!==i&&i||(t.id=i=function(){let t=e?.id||b.id+F++;return null!==document.getElementById(t)&&(t+=F++),t}(),(e||{}).log),i}(t.id);return d in w&&"iFrameResizer"in t?n(d,"Ignored iFrame, already setup."):(function(e){var i,n;w[d]={iframe:t,firstRun:!0,remoteHost:t?.src.split("/").slice(0,3).join("/"),...b,...a(e),mode:g(e),syncTitle:s(d)},function(){if("horizontal"===w[d].direction)return w[d].sizeWidth=!0,void(w[d].sizeHeight=!1);if("none"===w[d].direction)return w[d].sizeWidth=!1,w[d].sizeHeight=!1,void(w[d].autoResize=!1);if("vertical"!==w[d].direction)throw new TypeError(d,`Direction value of "${w[d].direction}" is not valid`)}(),(i=e?.offsetSize||e?.offset)&&("vertical"===w[d].direction?w[d].offsetHeight=i:w[d].offsetWidth=i),e?.offset&&o(d,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===w[d].postMessageTarget&&(w[d].postMessageTarget=t.contentWindow),w[d].targetOrigin=!0===w[d].checkOrigin?""===(n=w[d].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*"}(e),function(){const{mode:e}=w[d];e<0&&o("Parent",`${y(e+2)}${y(2)}`),N||e<0||(N=!0,((e,...t)=>{i("info",e,...t)})(`v${r} (${(e=>f(h[e]))(e)})`),e<1&&o("Parent",y(3)))}(),L(),function(){switch(t.style.overflow=!1===w[d]?.scrolling?"hidden":"auto",w[d]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=w[d]?w[d].scrolling:"no"}}(),function(){const{bodyMargin:e}=w[d];"number"!=typeof e&&"0"!==e||(w[d].bodyMargin=`${e}px`)}(),function(e){const{id:i}=t;-1!==w[i].mode&&-2!==w[i].mode&&(c(t,"load",(function(){x("iFrame.onload",`${e}:${W}`,i,!0),function(){const e=w[d]?.firstRun,i=w[d]?.heightCalculationMethod in l;!e&&i&&M({iframe:t,height:0,width:0,type:"init"})}()})),!1===w[i].waitForLoad&&x("init",`${e}:${W}`,i,!0))}(E(d)),function(){if(w[d]){const e={close:T.bind(null,w[d].iframe),disconnect:k.bind(null,w[d].iframe),removeListeners(){o(d,"\n<rb>Deprecated Method Name</>\n\nThe emoveListeners()</> method has been renamed to isconnect()</>.\n"),this.disconnect()},resize:x.bind(null,"Window resize","resize",d),moveToAnchor(e){x("Move to anchor",`moveToAnchor:${e}`,d)},sendMessage(e){x("Send Message",`message:${e=JSON.stringify(e)}`,d)}};w[d].iframe.iframeResizer=e,w[d].iframe.iFrameResizer=e}}()),t?.iFrameResizer};function C(){!1===document.hidden&&function(e,t){const i=e=>w[e]?.autoResize&&!w[e]?.firstRun;Object.keys(w).forEach((function(n){i(n)&&x(e,t,n)}))}("Tab Visible","resize")}const L=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{c(window,"message",z),c(document,"visibilitychange",C),window.iframeParentListener=e=>z({data:e,sameDomain:!0})})),O="[iframeResizer] ";const P=function(){function e(e){switch(!0){case!e:throw new TypeError(`${O}iframe is not defined`);case!e.tagName:throw new TypeError(`${O}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${O}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),i.push(e)}}let t,i;return function(n,o){if("undefined"==typeof window)return[];switch(t=A(n),i=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${O}Unexpected data type (${typeof o})`)}return Object.freeze(i)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){o("","Deprecated: iFrameResize(), please use iframeResize()"),P(...e)}),P}));
{
"name": "iframe-resizer",
"version": "5.1.5-beta.1",
"version": "5.2.3",
"license": "GPL-3.0",

@@ -41,6 +41,6 @@ "homepage": "https://iframe-resizer.com",

"dependencies": {
"@iframe-resizer/child": "5.1.5-beta.1",
"@iframe-resizer/jquery": "5.1.5-beta.1",
"@iframe-resizer/parent": "5.1.5-beta.1"
"@iframe-resizer/child": "5.2.3",
"@iframe-resizer/jquery": "5.2.3",
"@iframe-resizer/parent": "5.2.3"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc