UNPKG

@iframe-resizer/core

Version:

Keep iframes sized to their content.

21 lines (18 loc) 18.9 kB
/*! * @preserve * * @module iframe-resizer/core 5.4.6 (esm) - 2025-04-24 * * @license GPL-3.0 for non-commercial use only. * For commercial use, you must purchase a license from * https://iframe-resizer.com/pricing * * @description Keep same and cross domain iFrames sized to their content * * @author David J. Bradshaw <info@iframe-resizer.com> * * @see {@link https://iframe-resizer.com} * * @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. */ import e,{NORMAL as t,HIGHLIGHT as i,FOREGROUND as o}from"auto-console-group";const n="5.4.6",r="[iFrameSizer]",a=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),s="onload",l="init",c=Object.freeze({[s]:1,[l]:1}),u="expanded",d="collapsed",f=Object.freeze({[u]:1,[d]:1}),p=(e,t,i,o)=>e.addEventListener(t,i,o||!1),h=(e,t,i)=>e.removeEventListener(t,i,!1),m=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let o,n=0;n<e.length;n++)o=e.codePointAt(n),t=Math.imul(t^o,2246822519),i=Math.imul(i^o,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)},g=e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-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</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."],b=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],v=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),w=e=>g(y[e]),z=e=>{const t=e[g("spjluzl")];if(!t)return-1;const i=t.split("-");let o=function(e=""){let t=-2;const i=m(g(e));return i in v&&(t=v[i]),t}(i[0]);return 0===o||(e=>e[2]===m(e[0]+e[1]))(i)||(o=-2),o},j=e=>e,$=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),k=(x=e,x?.__esModule?x.default:x);var x;let T={},M=!1;const O=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const S=e=>(t,...i)=>T[t]?.console[e](...i);var I;const R=(I="log",(e,...t)=>!0===(e=>T[e]?T[e].log:M)(e)?S(I)(e,...t):null),E=S("warn"),W=S("error"),L=S("event"),C=S("purge"),A=S("errorBoundary");const N=(e,...t)=>T[e]?T[e].console.warn($(j)(...t)):queueMicrotask((()=>console?.warn($((e=>(...t)=>[`iframeResizer(${e})`,...t].join(" "))(e))(...t)))),H=(e=>(t,i="renamed to")=>(o,n,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${i} <b>${n}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(N),F=H("Option"),B={},P=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,logExpand:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof B[e.id].onInit&&(F("init()","onReady()","",e.id),B[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),q={position:null,version:n};function D(e){function t(){G(M),Y(O),k("onResized",M)}function a(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function s(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const l=e=>T.slice(T.indexOf(":")+7+e);const c=(e,t)=>(i,o)=>{const n={};var r,a;r=function(){Q(`${i} (${e})`,`${e}:${t()}`,o)},n[a=o]||(r(),n[a]=requestAnimationFrame((()=>{n[a]=null})))},u=(e,t)=>()=>{let i=!1;const o=t=>()=>{B[l]?i&&i!==t||(e(t,l),i=t,requestAnimationFrame((()=>{i=!1}))):s()},n=o("scroll"),r=o("resize window");function a(e,t){t(window,"scroll",n),t(window,"resize",r)}function s(){L(l,`stop${t}`),a(0,h),c.disconnect(),u.disconnect(),h(B[l].iframe,"load",s)}const l=O,c=new ResizeObserver(o("pageObserver")),u=new ResizeObserver(o("iframeObserver"));B[l]&&(B[l][`stop${t}`]=s,p(B[l].iframe,"load",s),a(0,p),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(B[l].iframe,{attributes:!0,childList:!1,subtree:!1}))},d=e=>()=>{e in B[O]&&(B[O][e](),delete B[O][e])},f=c("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=M.iframe.getBoundingClientRect(),{scrollY:i,scrollX:o,innerHeight:n,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,n||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:o,documentHeight:a,documentWidth:s,windowHeight:n,windowWidth:r})})),m=c("parentInfo",(function(){const{iframe:e}=M,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:o,height:n,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:o,height:n,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),g=u(f,"PageInfo"),y=u(m,"ParentInfo"),b=d("stopPageInfo"),v=d("stopParentInfo");function w(e){const t=e.getBoundingClientRect();return V(),{x:Number(t.left)+Number(q.position.x),y:Number(t.top)+Number(q.position.y)}}function z(e){const t=e?w(M.iframe):{x:0,y:0};R(O,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,i,o,i);const n=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(M,t),r=window.parentIframe||window.parentIFrame;r?function(t,i){t["scrollTo"+(e?"Offset":"")](i.x,i.y)}(r,n):function(e){q.position=e,j(O)}(n)}function j(e){const{x:t,y:i}=q.position,o=B[e]?.iframe;!1!==k("onScroll",{iframe:o,top:i,left:t,x:t,y:i})?Y(e):X()}function $(e){let t={};if(0===M.width&&0===M.height){const e=l(9).split(":");t={x:e[1],y:e[0]}}else t={x:M.width,y:M.height};k(e,{iframe:M.iframe,screenX:Number(t.x),screenY:Number(t.y),type:M.type})}const k=(e,t)=>J(O,e,t);function x(){const{height:e,iframe:r,msg:a,type:s,width:c}=M;switch(B[O]?.firstRun&&B[O]&&(B[O].firstRun=!1),s){case"close":Z(r);break;case"message":d=l(6),k("onMessage",{iframe:M.iframe,message:JSON.parse(d)});break;case"mouseenter":$("onMouseEnter");break;case"mouseleave":$("onMouseLeave");break;case"autoResize":B[O].autoResize=JSON.parse(l(9));break;case"scrollBy":!function(){const e=M.width,t=M.height,n=window.parentIframe||window.parentIFrame||window;R(O,`scrollBy: x: %c${e}%c y: %c${t}`,i,o,i),n.scrollBy(e,t)}();break;case"scrollTo":z(!1);break;case"scrollToOffset":z(!0);break;case"pageInfo":g();break;case"parentInfo":y();break;case"pageInfoStop":b();break;case"parentInfoStop":v();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",o=decodeURIComponent(t);let n=document.getElementById(o)||document.getElementsByName(o)[0];n?function(){const e=w(n);R(O,`Moving to in page link: %c#${t}`,i),q.position={x:e.x,y:e.y},j(O),window.location.hash=t}():window.top!==window.self&&function(){const e=window.parentIframe||window.parentIFrame;e&&e.moveToAnchor(t)}()}(l(9));break;case"title":!function(e,t){B[t]?.syncTitle&&(B[t].iframe.title=e,R(t,`Set iframe title attribute: %c${e}`,i))}(a,O);break;case"reset":_(M);break;case"init":t(),function(e){try{B[e].sameOrigin=!!B[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){B[e].sameOrigin=!1}}(O),(u=a)!==n&&(void 0!==u||N(O,"<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")),ie=!0,k("onReady",r);break;default:if(0===c&&0===e)return void E(O,`Unsupported message received (${s}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===c||0===e)return;if(document.hidden)return;t()}var u,d}let T=e.data,M={},O=null;"[iFrameResizerChild]Ready"!==T?r===`${T}`.slice(0,13)&&T.slice(13).split(":")[0]in B&&(M=function(){const e=T.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=B[e[0]]?.iframe,o=getComputedStyle(i);return{iframe:i,id:e[0],height:t+a(o)+s(o),width:Number(e[2]),type:e[3],msg:e[4]}}(),O=M.id,O?(L(O,M.type),A(O,(function(){!function(e){if(!B[e])throw new Error(`${M.type} No settings for ${e}. Message was: ${T}`)}(O),M.type in{true:1,false:1,undefined:1}||(B[O].loaded=!0,(null!==M.iframe||(E(O,`The iframe (${M.id}) was not found.`),0))&&function(){const{origin:t,sameOrigin:i}=e;if(i)return!0;let o=B[O]?.checkOrigin;if(o&&"null"!=`${t}`&&!(o.constructor===Array?function(){let e=0,i=!1;for(;e<o.length;e++)if(o[e]===t){i=!0;break}return i}():function(){const e=B[O]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${M.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}()&&x())}))()):E("","iframeResizer received messageData without id, message was: ",T)):Object.keys(B).forEach((e=>{B[e].mode>=0&&Q("iFrame requested init",ee(e),e)}))}function J(e,t,i){let o=null,n=null;if(B[e]){if(o=B[e][t],"function"!=typeof o)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{n=o(i)}catch(i){console.error(i),E(e,`Error in ${t} callback`)}else setTimeout((()=>o(i)))}return n}function U(e){const{id:t}=e;delete B[t],delete e.iframeResizer}function Z(e){const{id:t}=e;if(!1!==J(t,"onClose",t)){try{e.parentNode&&e.remove()}catch(e){E(t,e)}J(t,"onClosed",t),U(e)}}function V(e){null===q.position&&(q.position={x:window.scrollX,y:window.scrollY})}function X(){q.position=null}function Y(e){null!==q.position&&(window.scrollTo(q.position.x,q.position.y),R(e,`Set page position: %c${q.position.x}%c, %c${q.position.y}`,i,o,i),X())}function _(e){V(e.id),G(e),Q("reset","reset",e.id)}function G(e){function t(t){const n=`${e[t]}px`;e.iframe.style[t]=n,R(o,`Set ${t}: %c${n}`,i)}const{id:o}=e,{sizeHeight:n,sizeWidth:r}=B[o];n&&t("height"),r&&t("width")}T=B;const K=e=>e.split(":").filter(((e,t)=>19!==t)).join(":");function Q(e,t,n,a){function s(r){const a=e in c?K(t):t;R(n,r,i,o,i),R(n,`Message data: %c${a}`,i)}L(n,e),B[n]&&(B[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:i,sameOrigin:o,targetOrigin:a}=B[n];if(o)try{return e.contentWindow.iframeChildListener(r+t),void s(`Sending message to iframe %c${n}%c via sameOrigin`)}catch(e){}s(`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`),i.postMessage(r+t,a)}():E(n,`Iframe(${n}) not found`),a&&B[n]?.warningTimeout&&(B[n].msgTimeout=setTimeout((function(){if(void 0===B[n])return;const{iframe:e,loaded:t,loadErrorShown:i,waitForLoad:o}=B[n],{sandbox:r}=e,a="object"==typeof r&&r.length>0;t||i||(B[n].loadErrorShown=!0,N(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${B[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'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 <i>'false'</>. \n":""}${!a||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!a||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}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.\n`))}),B[n].warningTimeout)))}function ee(e){const t=B[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,q.version,t.mode,"",t.logExpand].join(":")}let te=0,ie=!1,oe=!1;const ne=e=>i=>{function o(){if(B[j]){const{iframe:e}=B[j],t={close:Z.bind(null,e),disconnect:U.bind(null,e),removeListeners(){N(j,"<rb>Deprecated Method Name</>\n\nThe emoveListeners()</> method has been renamed to isconnect()</>.\n"),this.disconnect()},resize(){N(j,"<rb>Deprecated Method</>\n \nUse of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As their are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code."),Q.bind(null,"Window resize","resize",j)},moveToAnchor(e){((e,t,i)=>{if(typeof e!==t)throw new TypeError(`${i} is not a ${o=t,o.charAt(0).toUpperCase()+o.slice(1)}`);var o})(e,"string","moveToAnchor(anchor) anchor"),Q("Move to anchor",`moveToAnchor:${e}`,j)},sendMessage(e){Q("message",`message:${e=JSON.stringify(e)}`,j)}};e.iframeResizer=t,e.iFrameResizer=t}}function r(e){const{id:t}=i,{mode:o,waitForLoad:n}=B[t];-1!==o&&-2!==o&&(p(i,"load",(function(){Q(s,`${e}:${ie}`,t,!0),function(){const e=B[j]?.firstRun,t=B[j]?.heightCalculationMethod in a;!e&&t&&_({iframe:i,height:0,width:0,type:"init"})}()})),!1===n&&Q(l,`${e}:${ie}`,t,!0))}function c(e){return e?(("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&N(j,'<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 d(){const{mode:i}=B[j];if(i<0)throw N("Parent",`${w(i+2)}${w(2)}`),C(j),w(i+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");oe||i>0&&e.vInfoDisable||function(e,i){queueMicrotask((()=>console.info(`%ciframe-resizer ${e}`,M||i<1?"font-weight: bold;":t)))}(`v${n} (${(e=>g(b[e]))(i)})`,i),!oe&&i<1&&N("Parent",w(3)),oe=!0}function h(e){const t=B[e]?.iframe?.title;return""===t||void 0===t}const m=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");function y(e){var t,o;B[j]={...B[j],iframe:i,firstRun:!0,remoteHost:i?.src.split("/").slice(0,3).join("/"),...P,...c(e),mouseEvents:m(e),mode:z(e),syncTitle:h(j)},L(j,"setup"),function(){const{direction:e}=B[j];if("horizontal"===e)return B[j].sizeWidth=!0,void(B[j].sizeHeight=!1);if("none"===e)return B[j].sizeWidth=!1,B[j].sizeHeight=!1,void(B[j].autoResize=!1);if("vertical"!==e)throw new TypeError(j,`Direction value of "${e}" is not valid`)}(),(t=e?.offsetSize||e?.offset)&&("vertical"===B[j].direction?B[j].offsetHeight=t:B[j].offsetWidth=t),e?.offset&&N(j,"<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===B[j].postMessageTarget&&(B[j].postMessageTarget=i.contentWindow),B[j].targetOrigin=!0===B[j].checkOrigin?""===(o=B[j].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const v=()=>"iframeResizer"in i,j=function(t){if(t&&"string"!=typeof t)throw new TypeError("Invalid id for iFrame. Expected String");return""!==t&&t||(t=function(){let t=e?.id||P.id+te++;return null!==document.getElementById(t)&&(t+=te++),t}(),i.id=t),t}(i.id);if("object"!=typeof e)throw new TypeError("Options is not an object");return function(e){const{search:t}=window.location;t.includes("ifrlog")&&(e.log=u,e.logExpand=!t.includes("ifrlog=collapsed"))}(e),function(e,t){const i=Object.hasOwn(t,"log"),o="string"==typeof t.log,n=i?!!o||t.log:P.log;Object.hasOwn(t,"logExpand")||(t.logExpand=i&&o?t.log===u:P.logExpand),function(e){-1===e?.log&&(e.log=!1,e.vInfoDisable=!0)}(t),function({enabled:e,expand:t,iframeId:i}){const o=k({expand:t,label:O(i)});M=e,T[i]||(T[i]={console:o})}({enabled:n,expand:t.logExpand,iframeId:e}),o&&!(t.log in f)&&W(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),t.log=n}(j,e),A(j,(function(e){v()?E(j,`Ignored iframe (${j}), already setup.`):(y(e),d(),ae(),function(){switch(i.style.overflow=!1===B[j]?.scrolling?"hidden":"auto",B[j]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=B[j]?B[j].scrolling:"no"}}(),function(){const{bodyMargin:e}=B[j];"number"!=typeof e&&"0"!==e||(B[j].bodyMargin=`${e}px`)}(),r(ee(j)),o())}))(e),i?.iFrameResizer};function re(){!1===document.hidden&&function(e,t){const i=e=>B[e]?.autoResize&&!B[e]?.firstRun;Object.keys(B).forEach((function(o){i(o)&&Q(e,t,o)}))}("Tab Visible","resize")}const ae=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{p(window,"message",D),p(document,"visibilitychange",re),window.iframeParentListener=e=>setTimeout((()=>D({data:e,sameOrigin:!0})))}));export{ne as default};