@iframe-resizer/core
Version:
Keep iframes sized to their content.
21 lines (18 loc) • 19.2 kB
JavaScript
/*!
* @preserve
*
* @module iframe-resizer/core 5.5.1 (esm) - 2025-08-01
*
* @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.5.1",r="none",s="vertical",a="horizontal",l="[iFrameSizer]",c=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),u="onload",d="init",f=Object.freeze({[u]:1,[d]:1}),p="expanded",h="collapsed",m=Object.freeze({[p]:1,[h]:1}),g=(e,t,i,o)=>e.addEventListener(t,i,o||!1),y=(e,t,i)=>e.removeEventListener(t,i,!1),b=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)},v=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),w=["spjluzl","rlf","clyzpvu"],z=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."],j=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],$=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),k=e=>v(z[e]),x=e=>{const t=e[v(w[0])]||e[v(w[1])]||e[v(w[2])];if(!t)return-1;const i=t.split("-");let o=function(e=""){let t=-2;const i=b(v(e));return i in $&&(t=$[i]),t}(i[0]);return 0===o||(e=>e[2]===b(e[0]+e[1]))(i)||(o=-2),o},T=e=>e,M=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),O=(S=e,S?.__esModule?S.default:S);var S;let R={},I=!1;const E=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const W=e=>(t,...i)=>R[t]?.console[e](...i);var A;const C=(A="log",(e,...t)=>!0===(e=>R[e]?R[e].log:I)(e)?W(A)(e,...t):null),L=W("warn"),N=W("error"),B=W("event"),H=W("purge"),P=W("errorBoundary");const F=(e,...t)=>R[e]?R[e].console.warn(M(T)(...t)):queueMicrotask(()=>console?.warn(M((e=>(...t)=>[`iframeResizer(${e})`,...t].join(" "))(e))(...t))),q=(e=>(t,i="renamed to")=>(o,n,r="",s="")=>e(s,`<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</>.`))(F),D=q("Option");function U(e,t){const{warningTimeout:i}=t[e];0!==i&&(t[e].msgTimeout=setTimeout(function(){if(void 0===t[e])return;const{loaded:i,loadErrorShown:o}=t[e];i||o||(t[e].loadErrorShown=!0,function(e,t){const{iframe:i,waitForLoad:o}=t[e],{sandbox:n}=i,r="object"==typeof n&&n.length>0&&!(n.contains("allow-scripts")&&n.contains("allow-same-origin"));F(e,`<rb>No response from iframe</>\n \nThe iframe (<i>${e}</>) has not responded within ${t[e].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 <b>'true'</>. If the iframe loads before <i>iframe-resizer</> runs, this option will prevent <i>iframe-resizer</> initialising. To disable this option, set <b>waitForLoad</> to <b>'false'</>. \n":""}${r?"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\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`)}(e,t))},i))}const J={},Z=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:s,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",onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof J[e.id].onInit&&(D("init()","onReady()","",e.id),J[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),V={position:null,version:n};function X(e){function t(){ie(M),ee(O),k("onResized",M)}function r(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 a=e=>T.slice(T.indexOf(":")+7+e);const c=(e,t)=>(i,o)=>{const n={};var r,s;r=function(){ne(`${i} (${e})`,`${e}:${t()}`,o)},n[s=o]||(r(),n[s]=requestAnimationFrame(()=>{n[s]=null}))},u=(e,t)=>()=>{let i=!1;const o=t=>()=>{J[l]?i&&i!==t||(e(t,l),i=t,requestAnimationFrame(()=>{i=!1})):a()},n=o("scroll"),r=o("resize window");function s(e,t){t(window,"scroll",n),t(window,"resize",r)}function a(){B(l,`stop${t}`),s(0,y),c.disconnect(),u.disconnect(),y(J[l].iframe,"load",a)}const l=O,c=new ResizeObserver(o("pageObserver")),u=new ResizeObserver(o("iframeObserver"));J[l]&&(J[l][`stop${t}`]=a,g(J[l].iframe,"load",a),s(0,g),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(J[l].iframe,{attributes:!0,childList:!1,subtree:!1}))},d=e=>()=>{e in J[O]&&(J[O][e](),delete J[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:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(s,n||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:o,documentHeight:s,documentWidth:a,windowHeight:n,windowWidth:r})}),p=c("parentInfo",function(){const{iframe:e}=M,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:o,height:n,offsetLeft:r,offsetTop:s,pageLeft:a,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:s,pageLeft:a,pageTop:l,scale:c}})}),h=u(f,"PageInfo"),m=u(p,"ParentInfo"),b=d("stopPageInfo"),v=d("stopParentInfo");function w(e){const t=e.getBoundingClientRect();return K(),{x:Number(t.left)+Number(V.position.x),y:Number(t.top)+Number(V.position.y)}}function z(e){const t=e?w(M.iframe):{x:0,y:0};C(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){V.position=e,j(O)}(n)}function j(e){const{x:t,y:i}=V.position,o=J[e]?.iframe;!1!==k("onScroll",{iframe:o,top:i,left:t,x:t,y:i})?ee(e):Q()}function $(e){let t={};if(0===M.width&&0===M.height){const e=a(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)=>Y(O,e,t);function x(){const{height:e,iframe:r,msg:s,type:l,width:c}=M;switch(J[O]?.firstRun&&function(){if(!J[O])return;ue(O,M.mode),J[O].firstRun=!1}(),l){case"close":G(r);break;case"message":d=a(6),k("onMessage",{iframe:M.iframe,message:JSON.parse(d)});break;case"mouseenter":$("onMouseEnter");break;case"mouseleave":$("onMouseLeave");break;case"autoResize":J[O].autoResize=JSON.parse(a(9));break;case"scrollBy":!function(){const e=M.width,t=M.height,n=window.parentIframe||window.parentIFrame||window;C(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":h();break;case"parentInfo":m();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);C(O,`Moving to in page link: %c#${t}`,i),V.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)}()}(a(9));break;case"title":!function(e,t){J[t]?.syncTitle&&(J[t].iframe.title=e,C(t,`Set iframe title attribute: %c${e}`,i))}(s,O);break;case"reset":te(M);break;case"init":t(),function(e){try{J[e].sameOrigin=!!J[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){J[e].sameOrigin=!1}}(O),(u=s)!==n&&(void 0!==u||F(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")),ae=!0,k("onReady",r);break;default:if(0===c&&0===e)return void L(O,`Unsupported message received (${l}), 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?l===`${T}`.slice(0,13)&&T.slice(13).split(":")[0]in J&&(M=function(){const e=T.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=J[e[0]]?.iframe,o=getComputedStyle(i),n={iframe:i,id:e[0],height:t+r(o)+s(o),width:Number(e[2]),type:e[3],msg:e[4]};return e[5]&&(n.mode=e[5]),n}(),O=M.id,O?(B(O,M.type),P(O,function(){!function(e){if(!J[e])throw new Error(`${M.type} No settings for ${e}. Message was: ${T}`)}(O),M.type in{}||(J[O].loaded=!0,(null!==M.iframe||(L(O,`The iframe (${M.id}) was not found.`),0))&&function(){const{origin:t,sameOrigin:i}=e;if(i)return!0;let o=J[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=J[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())})()):L("","iframeResizer received messageData without id, message was: ",T)):Object.keys(J).forEach(e=>{ne("iFrame requested init",re(e),e)})}function Y(e,t,i){let o=null,n=null;if(J[e]){if(o=J[e][t],"function"!=typeof o)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onBeforeClose"===t||"onScroll"===t)try{n=o(i)}catch(i){console.error(i),L(e,`Error in ${t} callback`)}else((e,...t)=>{setTimeout(()=>e(...t),0)})(o,i)}return n}function _(e){const{id:t}=e;delete J[t],delete e.iframeResizer}function G(e){const{id:t}=e;if(!1!==Y(t,"onBeforeClose",t)){try{e.parentNode&&e.remove()}catch(e){L(t,e)}Y(t,"onAfterClose",t),_(e)}}function K(e){null===V.position&&(V.position={x:window.scrollX,y:window.scrollY})}function Q(){V.position=null}function ee(e){null!==V.position&&(window.scrollTo(V.position.x,V.position.y),C(e,`Set page position: %c${V.position.x}%c, %c${V.position.y}`,i,o,i),Q())}function te(e){K(e.id),ie(e),ne("reset","reset",e.id)}function ie(e){function t(t){const n=`${e[t]}px`;e.iframe.style[t]=n,C(o,`Set ${t}: %c${n}`,i)}const{id:o}=e,{sizeHeight:n,sizeWidth:r}=J[o];n&&t("height"),r&&t("width")}R=J;const oe=e=>e.split(":").filter((e,t)=>19!==t).join(":");function ne(e,t,n){function r(r){const s=e in f?oe(t):t;C(n,r,i,o,i),C(n,`Message data: %c${s}`,i)}B(n,e),J[n]&&(J[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:i,sameOrigin:o,targetOrigin:s}=J[n];if(o)try{return e.contentWindow.iframeChildListener(l+t),void r(`Sending message to iframe %c${n}%c via sameOrigin`)}catch(e){}r(`Sending message to iframe: %c${n}%c targetOrigin: %c${s}`),i.postMessage(l+t,s)}():L(n,`Iframe(${n}) not found`))}function re(e){const t=J[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,"",t.logExpand].join(":")}let se=0,ae=!1,le=!1,ce=!1;function ue(e,i=-3){if(le)return;const o=Math.max(J[e].mode,i);if(o>J[e]&&(J[e].mode=o),o<0)throw H(e),J[e].vAdvised||F(e||"Parent",`${k(o+2)}${k(2)}`),J[e].vAdvised=!0,k(o+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");o>-1&&ce||function(e,i){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,I||i<1?"font-weight: bold;":t))}(`v${n} (${(e=>v(j[e]))(o)})`,o),o<1&&F("Parent",k(3)),le=!0}const de=e=>t=>{function i(){if(J[v]){const{iframe:e}=J[v],t={close:G.bind(null,e),disconnect:_.bind(null,e),removeListeners(){F(v,"<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize(){F(v,"<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."),ne.bind(null,"Window resize","resize",v)},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"),ne("Move to anchor",`moveToAnchor:${e}`,v)},sendMessage(e){ne("message",`message:${e=JSON.stringify(e)}`,v)}};e.iframeResizer=t,e.iFrameResizer=t}}function o(e){const{id:i}=t,{waitForLoad:o}=J[i];U(i,J),g(t,"load",function(){ne(u,`${e}:${ae}`,i),function(){const e=J[v]?.firstRun,i=J[v]?.heightCalculationMethod in c;!e&&i&&te({iframe:t,height:0,width:0,type:"init"})}()}),!1===o&&ne(d,`${e}:${ae}`,i)}function n(e){return e?(("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&F(v,`<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>"${s}"</>, <i>"${a}"</> or <i>"${r}"</>.\n`),e):{}}function l(e){const t=J[e]?.iframe?.title;return""===t||void 0===t}function f(e,t){Object.hasOwn(J[v],e)&&(F(v,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${t}</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.`),J[v][t]=J[v][e],delete J[v][e])}const h=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");function y(e){var i,o;J[v]={...J[v],iframe:t,firstRun:!0,remoteHost:t?.src.split("/").slice(0,3).join("/"),...Z,...n(e),mouseEvents:h(e),mode:x(e),syncTitle:l(v)},f("offset","offsetSize"),f("onClose","onBeforeClose"),f("onClosed","onAfterClose"),B(v,"setup"),function(){const{direction:e}=J[v];switch(e){case s:break;case a:J[v].sizeHeight=!1;case"both":J[v].sizeWidth=!0;break;case r:J[v].sizeWidth=!1,J[v].sizeHeight=!1,J[v].autoResize=!1;break;default:throw new TypeError(v,`Direction value of "${e}" is not valid`)}}(),(i=e?.offsetSize||e?.offset)&&(J[v].direction===s?J[v].offsetHeight=i:J[v].offsetWidth=i),e?.offset&&F(v,"<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===J[v].postMessageTarget&&(J[v].postMessageTarget=t.contentWindow),J[v].targetOrigin=!0===J[v].checkOrigin?""===(o=J[v].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const b=()=>"iframeResizer"in t,v=function(i){if(i&&"string"!=typeof i)throw new TypeError("Invalid id for iFrame. Expected String");return""!==i&&i||(i=function(){let t=e?.id||Z.id+se++;return null!==document.getElementById(t)&&(t+=se++),t}(),t.id=i),i}(t.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=p,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:Z.log;Object.hasOwn(t,"logExpand")||(t.logExpand=i&&o?t.log===p:Z.logExpand),function(e){-1===e?.log&&(e.log=!1,ce=!0)}(t),function({enabled:e,expand:t,iframeId:i}){const o=O({expand:t,label:E(i)});I=e,R[i]||(R[i]={console:o})}({enabled:n,expand:t.logExpand,iframeId:e}),o&&!(t.log in m)&&N(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),t.log=n}(v,e),P(v,function(e){b()?L(v,`Ignored iframe (${v}), already setup.`):(y(e),function(){if(le)return;const{mode:e}=J[v];-1!==e&&ue(v,e)}(),pe(),function(){switch(t.style.overflow=!1===J[v]?.scrolling?"hidden":"auto",J[v]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=J[v]?J[v].scrolling:"no"}}(),function(){const{bodyMargin:e}=J[v];"number"!=typeof e&&"0"!==e||(J[v].bodyMargin=`${e}px`)}(),o(re(v)),i())})(e),t?.iframeResizer};function fe(){!1===document.hidden&&function(e,t){const i=e=>J[e]?.autoResize&&!J[e]?.firstRun;Object.keys(J).forEach(function(o){i(o)&&ne(e,t,o)})}("Tab Visible","resize")}const pe=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})(()=>{g(window,"message",X),g(document,"visibilitychange",fe),window.iframeParentListener=e=>setTimeout(()=>X({data:e,sameOrigin:!0}))});export{de as default};