UNPKG

@iframe-resizer/core

Version:

Keep iframes sized to their content.

21 lines (18 loc) 19.6 kB
/*! * @preserve * * @module iframe-resizer/core 5.5.1 (umd) - 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. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("auto-console-group")):"function"==typeof define&&define.amd?define(["auto-console-group"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).createResizer=t(e.acg)}(this,function(e){"use strict";const t="5.5.1",i="none",o="vertical",n="horizontal",r="[iFrameSizer]",s=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),a="onload",l="init",c=Object.freeze({[a]: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=["spjluzl","rlf","clyzpvu"],b=["<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."],v=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],w=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),z=e=>g(b[e]),j=e=>{const t=e[g(y[0])]||e[g(y[1])]||e[g(y[2])];if(!t)return-1;const i=t.split("-");let o=function(e=""){let t=-2;const i=m(g(e));return i in w&&(t=w[i]),t}(i[0]);return 0===o||(e=>e[2]===m(e[0]+e[1]))(i)||(o=-2),o},$=e=>e,T=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)),I=(k=e,k?.__esModule?k.default:k);var k;let H={},x=!1;const O=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const R=e=>(t,...i)=>H[t]?.console[e](...i);var M;const L=(M="log",(e,...t)=>!0===(e=>H[e]?H[e].log:x)(e)?R(M)(e,...t):null),S=R("warn"),E=R("error"),W=R("event"),A=R("purge"),C=R("errorBoundary");const N=(e,...t)=>H[e]?H[e].console.warn(T($)(...t)):queueMicrotask(()=>console?.warn(T((e=>(...t)=>[`iframeResizer(${e})`,...t].join(" "))(e))(...t))),G=(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</>.`))(N),B=G("Option");function F(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"));N(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 P={},q=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:o,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 P[e.id].onInit&&(B("init()","onReady()","",e.id),P[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),D={position:null,version:t};function U(i){function o(){Q(k),_(H),$("onResized",k)}function n(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=>I.slice(I.indexOf(":")+7+e);const l=(e,t)=>(i,o)=>{const n={};var r,s;r=function(){te(`${i} (${e})`,`${e}:${t()}`,o)},n[s=o]||(r(),n[s]=requestAnimationFrame(()=>{n[s]=null}))},c=(e,t)=>()=>{let i=!1;const o=t=>()=>{P[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(){W(l,`stop${t}`),s(0,h),c.disconnect(),u.disconnect(),h(P[l].iframe,"load",a)}const l=H,c=new ResizeObserver(o("pageObserver")),u=new ResizeObserver(o("iframeObserver"));P[l]&&(P[l][`stop${t}`]=a,p(P[l].iframe,"load",a),s(0,p),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(P[l].iframe,{attributes:!0,childList:!1,subtree:!1}))},u=e=>()=>{e in P[H]&&(P[H][e](),delete P[H][e])},d=l("pageInfo",function(){const e=document.body.getBoundingClientRect(),t=k.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})}),f=l("parentInfo",function(){const{iframe:e}=k,{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}})}),m=c(d,"PageInfo"),g=c(f,"ParentInfo"),y=u("stopPageInfo"),b=u("stopParentInfo");function v(e){const t=e.getBoundingClientRect();return X(),{x:Number(t.left)+Number(D.position.x),y:Number(t.top)+Number(D.position.y)}}function w(t){const i=t?v(k.iframe):{x:0,y:0};L(H,`Reposition requested (offset x:%c${i.x}%c y:%c${i.y})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT);const o=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(k,i),n=window.parentIframe||window.parentIFrame;n?function(e,i){e["scrollTo"+(t?"Offset":"")](i.x,i.y)}(n,o):function(e){D.position=e,z(H)}(o)}function z(e){const{x:t,y:i}=D.position,o=P[e]?.iframe;!1!==$("onScroll",{iframe:o,top:i,left:t,x:t,y:i})?_(e):Y()}function j(e){let t={};if(0===k.width&&0===k.height){const e=a(9).split(":");t={x:e[1],y:e[0]}}else t={x:k.width,y:k.height};$(e,{iframe:k.iframe,screenX:Number(t.x),screenY:Number(t.y),type:k.type})}const $=(e,t)=>J(H,e,t);function T(){const{height:i,iframe:n,msg:r,type:s,width:l}=k;switch(P[H]?.firstRun&&function(){if(!P[H])return;ae(H,k.mode),P[H].firstRun=!1}(),s){case"close":V(n);break;case"message":u=a(6),$("onMessage",{iframe:k.iframe,message:JSON.parse(u)});break;case"mouseenter":j("onMouseEnter");break;case"mouseleave":j("onMouseLeave");break;case"autoResize":P[H].autoResize=JSON.parse(a(9));break;case"scrollBy":!function(){const t=k.width,i=k.height,o=window.parentIframe||window.parentIFrame||window;L(H,`scrollBy: x: %c${t}%c y: %c${i}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),o.scrollBy(t,i)}();break;case"scrollTo":w(!1);break;case"scrollToOffset":w(!0);break;case"pageInfo":m();break;case"parentInfo":g();break;case"pageInfoStop":y();break;case"parentInfoStop":b();break;case"inPageLink":!function(t){const i=t.split("#")[1]||"",o=decodeURIComponent(i);let n=document.getElementById(o)||document.getElementsByName(o)[0];n?function(){const t=v(n);L(H,`Moving to in page link: %c#${i}`,e.HIGHLIGHT),D.position={x:t.x,y:t.y},z(H),window.location.hash=i}():window.top!==window.self&&function(){const e=window.parentIframe||window.parentIFrame;e&&e.moveToAnchor(i)}()}(a(9));break;case"title":!function(t,i){P[i]?.syncTitle&&(P[i].iframe.title=t,L(i,`Set iframe title attribute: %c${t}`,e.HIGHLIGHT))}(r,H);break;case"reset":K(k);break;case"init":o(),function(e){try{P[e].sameOrigin=!!P[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){P[e].sameOrigin=!1}}(H),(c=r)!==t&&(void 0!==c||N(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")),ne=!0,$("onReady",n);break;default:if(0===l&&0===i)return void S(H,`Unsupported message received (${s}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===l||0===i)return;if(document.hidden)return;o()}var c,u}let I=i.data,k={},H=null;"[iFrameResizerChild]Ready"!==I?r===`${I}`.slice(0,13)&&I.slice(13).split(":")[0]in P&&(k=function(){const e=I.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=P[e[0]]?.iframe,o=getComputedStyle(i),r={iframe:i,id:e[0],height:t+n(o)+s(o),width:Number(e[2]),type:e[3],msg:e[4]};return e[5]&&(r.mode=e[5]),r}(),H=k.id,H?(W(H,k.type),C(H,function(){!function(e){if(!P[e])throw new Error(`${k.type} No settings for ${e}. Message was: ${I}`)}(H),k.type in{}||(P[H].loaded=!0,(null!==k.iframe||(S(H,`The iframe (${k.id}) was not found.`),0))&&function(){const{origin:e,sameOrigin:t}=i;if(t)return!0;let o=P[H]?.checkOrigin;if(o&&"null"!=`${e}`&&!(o.constructor===Array?function(){let t=0,i=!1;for(;t<o.length;t++)if(o[t]===e){i=!0;break}return i}():function(){const t=P[H]?.remoteHost;return e===t}()))throw new Error(`Unexpected message received from: ${e} for ${k.iframe.id}. Message was: ${i.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&T())})()):S("","iframeResizer received messageData without id, message was: ",I)):Object.keys(P).forEach(e=>{te("iFrame requested init",ie(e),e)})}function J(e,t,i){let o=null,n=null;if(P[e]){if(o=P[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),S(e,`Error in ${t} callback`)}else((e,...t)=>{setTimeout(()=>e(...t),0)})(o,i)}return n}function Z(e){const{id:t}=e;delete P[t],delete e.iframeResizer}function V(e){const{id:t}=e;if(!1!==J(t,"onBeforeClose",t)){try{e.parentNode&&e.remove()}catch(e){S(t,e)}J(t,"onAfterClose",t),Z(e)}}function X(e){null===D.position&&(D.position={x:window.scrollX,y:window.scrollY})}function Y(){D.position=null}function _(t){null!==D.position&&(window.scrollTo(D.position.x,D.position.y),L(t,`Set page position: %c${D.position.x}%c, %c${D.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Y())}function K(e){X(e.id),Q(e),te("reset","reset",e.id)}function Q(t){function i(i){const n=`${t[i]}px`;t.iframe.style[i]=n,L(o,`Set ${i}: %c${n}`,e.HIGHLIGHT)}const{id:o}=t,{sizeHeight:n,sizeWidth:r}=P[o];n&&i("height"),r&&i("width")}H=P;const ee=e=>e.split(":").filter((e,t)=>19!==t).join(":");function te(t,i,o){function n(n){const r=t in c?ee(i):i;L(o,n,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),L(o,`Message data: %c${r}`,e.HIGHLIGHT)}W(o,t),P[o]&&(P[o]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:t,sameOrigin:s,targetOrigin:a}=P[o];if(s)try{return e.contentWindow.iframeChildListener(r+i),void n(`Sending message to iframe %c${o}%c via sameOrigin`)}catch(e){}n(`Sending message to iframe: %c${o}%c targetOrigin: %c${a}`),t.postMessage(r+i,a)}():S(o,`Iframe(${o}) not found`))}function ie(e){const t=P[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,D.version,t.mode,"",t.logExpand].join(":")}let oe=0,ne=!1,re=!1,se=!1;function ae(i,o=-3){if(re)return;const n=Math.max(P[i].mode,o);if(n>P[i]&&(P[i].mode=n),n<0)throw A(i),P[i].vAdvised||N(i||"Parent",`${z(n+2)}${z(2)}`),P[i].vAdvised=!0,z(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");n>-1&&se||function(t,i){queueMicrotask(()=>console.info(`%ciframe-resizer ${t}`,x||i<1?"font-weight: bold;":e.NORMAL))}(`v${t} (${(e=>g(v[e]))(n)})`,n),n<1&&N("Parent",z(3)),re=!0}function le(){!1===document.hidden&&function(e,t){const i=e=>P[e]?.autoResize&&!P[e]?.firstRun;Object.keys(P).forEach(function(o){i(o)&&te(e,t,o)})}("Tab Visible","resize")}const ce=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})(()=>{p(window,"message",U),p(document,"visibilitychange",le),window.iframeParentListener=e=>setTimeout(()=>U({data:e,sameOrigin:!0}))});return e=>t=>{function r(){if(P[v]){const{iframe:e}=P[v],t={close:V.bind(null,e),disconnect:Z.bind(null,e),removeListeners(){N(v,"<rb>Deprecated Method Name</>\n\nThe emoveListeners()</> method has been renamed to isconnect()</>.\n"),this.disconnect()},resize(){N(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."),te.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"),te("Move to anchor",`moveToAnchor:${e}`,v)},sendMessage(e){te("message",`message:${e=JSON.stringify(e)}`,v)}};e.iframeResizer=t,e.iFrameResizer=t}}function c(e){const{id:i}=t,{waitForLoad:o}=P[i];F(i,P),p(t,"load",function(){te(a,`${e}:${ne}`,i),function(){const e=P[v]?.firstRun,i=P[v]?.heightCalculationMethod in s;!e&&i&&K({iframe:t,height:0,width:0,type:"init"})}()}),!1===o&&te(l,`${e}:${ne}`,i)}function d(e){return e?(("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&N(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>"${o}"</>, <i>"${n}"</> or <i>"${i}"</>.\n`),e):{}}function h(e){const t=P[e]?.iframe?.title;return""===t||void 0===t}function m(e,t){Object.hasOwn(P[v],e)&&(N(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</>.`),P[v][t]=P[v][e],delete P[v][e])}const g=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");function y(e){var r,s;P[v]={...P[v],iframe:t,firstRun:!0,remoteHost:t?.src.split("/").slice(0,3).join("/"),...q,...d(e),mouseEvents:g(e),mode:j(e),syncTitle:h(v)},m("offset","offsetSize"),m("onClose","onBeforeClose"),m("onClosed","onAfterClose"),W(v,"setup"),function(){const{direction:e}=P[v];switch(e){case o:break;case n:P[v].sizeHeight=!1;case"both":P[v].sizeWidth=!0;break;case i:P[v].sizeWidth=!1,P[v].sizeHeight=!1,P[v].autoResize=!1;break;default:throw new TypeError(v,`Direction value of "${e}" is not valid`)}}(),(r=e?.offsetSize||e?.offset)&&(P[v].direction===o?P[v].offsetHeight=r:P[v].offsetWidth=r),e?.offset&&N(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===P[v].postMessageTarget&&(P[v].postMessageTarget=t.contentWindow),P[v].targetOrigin=!0===P[v].checkOrigin?""===(s=P[v].remoteHost)||null!==s.match(/^(about:blank|javascript:|file:\/\/)/)?"*":s:"*"}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||q.id+oe++;return null!==document.getElementById(t)&&(t+=oe++),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=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:q.log;Object.hasOwn(t,"logExpand")||(t.logExpand=i&&o?t.log===u:q.logExpand),function(e){-1===e?.log&&(e.log=!1,se=!0)}(t),function({enabled:e,expand:t,iframeId:i}){const o=I({expand:t,label:O(i)});x=e,H[i]||(H[i]={console:o})}({enabled:n,expand:t.logExpand,iframeId:e}),o&&!(t.log in f)&&E(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),t.log=n}(v,e),C(v,function(e){b()?S(v,`Ignored iframe (${v}), already setup.`):(y(e),function(){if(re)return;const{mode:e}=P[v];-1!==e&&ae(v,e)}(),ce(),function(){switch(t.style.overflow=!1===P[v]?.scrolling?"hidden":"auto",P[v]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=P[v]?P[v].scrolling:"no"}}(),function(){const{bodyMargin:e}=P[v];"number"!=typeof e&&"0"!==e||(P[v].bodyMargin=`${e}px`)}(),c(ie(v)),r())})(e),t?.iframeResizer}});