@iframe-resizer/core 5.5.9 → 6.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,20 +1,1002 @@
1
- /*!
2
- * @preserve
3
- *
4
- * @module iframe-resizer/core 5.5.9 (esm) - 2026-02-06
5
- *
6
- * @license GPL-3.0 for non-commercial use only.
7
- * For commercial use, you must purchase a license from
8
- * https://iframe-resizer.com/pricing
9
- *
10
- * @description Keep same and cross domain iFrames sized to their content
11
- *
12
- * @author David J. Bradshaw <info@iframe-resizer.com>
13
- *
14
- * @see {@link https://iframe-resizer.com}
15
- *
16
- * @copyright (c) 2013 - 2026, David J. Bradshaw. All rights reserved.
17
- */
18
-
19
-
20
- import e,{NORMAL as t,HIGHLIGHT as i,FOREGROUND as n}from"auto-console-group";const o="5.5.9",r="iframeResizer",a=":",s="autoResize",l="init",c="iframeReady",u="load",d="message",f="onload",p="pageInfo",h="parentInfo",m="reset",g="resize",y="scroll",b="\n",v="child",w="parent",z="string",$="object",j="function",k="auto",T="none",x="both",M="vertical",S="horizontal",I="[iFrameSizer]",O=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),R=Object.freeze({[f]:1,[l]:1,[c]:1}),C="expanded",W="collapsed",E=Object.freeze({[C]:1,[W]:1}),L="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",A=(e,t,i,n)=>e.addEventListener(t,i,n||!1),N=(e,t,i)=>e.removeEventListener(t,i,!1),P=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)},B=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),H=["spjluzl","rlf","clyzpvu"],F=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],q=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],D=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),U=e=>B(F[e]),J=e=>{const t=e[B(H[0])]||e[B(H[1])]||e[B(H[2])];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=P(B(e));return i in D&&(t=D[i]),t>4?t-4:t}(i[0]);return 0===n||(e=>e[2]===P(e[0]+e[1]))(i)||(n=-2),n},Z=Object.hasOwn||((e,t)=>Object.prototype.hasOwnProperty.call(e,t)),V={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},X=Object.keys(V),Y=new RegExp(`<(${X.join("|")})>`,"gi"),_=(e,t)=>V[t]??"",G=e=>t=>e(typeof t===z?window.chrome?t.replace(Y,_):(e=>e.replaceAll("<br>",b).replaceAll(/<\/?[^>]+>/gi,""))(t):t),K={},Q=(ee=e,ee?.__esModule?ee.default:ee);var ee;let te=!0;const ie=Q({expand:!1,label:w}),ne=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const oe=e=>(t,...i)=>K[t]?K[t].console[e](...i):ie[e](...i);var re;const ae=(re="log",(e,...t)=>!0===(e=>K[e]?K[e].log:te)(e)?oe(re)(e,...t):null),se=oe("warn"),le=oe("error"),ce=oe("event"),ue=oe("purge"),de=oe("endAutoGroup"),fe=oe("errorBoundary");const pe=G(e=>e),he=(e,...t)=>K[e]?K[e].console.warn(...t.map(pe)):queueMicrotask(()=>{const i=G((e=>(...t)=>[`${r}(${e})`,...t].join(" "))(e));console?.warn(...t.map(i))}),me=(e=>(t,i="renamed to")=>(n,o,r="",a="")=>e(a,`<rb>Deprecated ${t}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${t.toLowerCase()} has been ${i} <b>${o}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(he),ge=me("Option");function ye(e){const{checkOrigin:t,iframe:{id:i,src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:a,warningTimeout:s}=e,l=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);ce(i,"noResponse"),he(i,`<rb>No response from iframe</>\n\nThe iframe (<i>${i}</>) has not responded within ${s/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&l?`\nThe <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${l}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.\n`:""}${a&&!r?"\nThe <b>waitForLoad</> option is currently set to <bb>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 <bb>false</>.\n":""}${(e=>typeof e===$&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin")))(o)?"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>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`)}const be={};const ve=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:M,firstRun:!0,inPageLinks:!1,heightCalculationMethod:k,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:k,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof K[e.id].onInit===j&&(ge("init()","onReady()","",e.id),K[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),we={position:null,version:o};function ze(e){function t(){Ie(F),Me(U),E("onResized",F)}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 c(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const f=e=>B.slice(B.indexOf(a)+7+e);const b=(e,t)=>(i,n)=>{const o={};var r,a;r=function(){Re(`${i} (${e})`,`${e}:${t()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame(()=>{o[a]=null}))},v=(e,t)=>()=>{let i=!1;const n=t=>()=>{K[l]?i&&i!==t||(e(t,l),i=t,requestAnimationFrame(()=>{i=!1})):s()},o=n(y),r=n("resize window");function a(e,t){t(window,y,o),t(window,g,r)}function s(){ce(l,`stop${t}`),a(0,N),c.disconnect(),d.disconnect(),N(K[l].iframe,u,s)}const l=U,c=new ResizeObserver(n("pageObserver")),d=new ResizeObserver(n("iframeObserver"));K[l]&&(K[l][`stop${t}`]=s,A(K[l].iframe,u,s),a(0,A),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),d.observe(K[l].iframe,{attributes:!0,childList:!1,subtree:!1}))},$=e=>()=>{e in K[U]&&(K[U][e](),delete K[U][e])},j=b(p,function(){const e=document.body.getBoundingClientRect(),t=F.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})}),k=b(h,function(){const{iframe:e}=F,{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}})}),T=v(j,"PageInfo"),x=v(k,"ParentInfo"),M=$("stopPageInfo"),S=$("stopParentInfo");function O(e){const t=e.getBoundingClientRect();return Te(),{x:Number(t.left)+Number(we.position.x),y:Number(t.top)+Number(we.position.y)}}function R(e){const t=e?O(F.iframe):{x:0,y:0};ae(U,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,i,n,i);const o=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(F,t),r=window.parentIframe||window.parentIFrame;r?function(t,i){setTimeout(()=>t["scrollTo"+(e?"Offset":"")](i.x,i.y))}(r,o):function(e){we.position=e,C(U)}(o)}function C(e){const{x:t,y:i}=we.position,n=K[e]?.iframe;!1!==E("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?Me(e):xe()}function W(e){let t={};if(0===F.width&&0===F.height){const e=f(9).split(a);t={x:e[1],y:e[0]}}else t={x:F.width,y:F.height};E(e,{iframe:F.iframe,screenX:Number(t.x),screenY:Number(t.y),type:F.type})}const E=(e,t)=>$e(U,e,t);function L(){const{height:e,iframe:r,msg:a,type:c,width:u}=F;switch(K[U]?.firstRun&&function(){if(!K[U])return;Le(U,F.mode),K[U].firstRun=!1}(),c){case"close":ke(r);break;case d:y=f(6),E("onMessage",{iframe:F.iframe,message:JSON.parse(y)});break;case"mouseenter":W("onMouseEnter");break;case"mouseleave":W("onMouseLeave");break;case"beforeUnload":ae(U,"Ready state reset"),K[U].initialised=!1;break;case s:K[U].autoResize=JSON.parse(f(9));break;case"scrollBy":!function(){const e=F.width,t=F.height,o=window.parentIframe||window.parentIFrame||window;ae(U,`scrollBy: x: %c${e}%c y: %c${t}`,i,n,i),o.scrollBy(e,t)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case p:T();break;case h:x();break;case"pageInfoStop":M();break;case"parentInfoStop":S();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const e=O(o);ae(U,`Moving to in page link: %c#${t}`,i),we.position={x:e.x,y:e.y},C(U),window.location.hash=t}():window.top!==window.self&&function(){const e=window.parentIframe||window.parentIFrame;e&&e.moveToAnchor(t)}()}(f(9));break;case"title":!function(e,t){K[t]?.syncTitle&&(K[t].iframe.title=e,ae(t,`Set iframe title attribute: %c${e}`,i))}(a,U);break;case m:Se(F);break;case l:t(),function(e){try{K[e].sameOrigin=!!K[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){K[e].sameOrigin=!1}}(U),(g=a)!==o&&(void 0!==g||he(U,"<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")),K[U].initialised=!0,E("onReady",r);break;default:if(0===u&&0===e)return void se(U,`Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===u||0===e)return;if(document.hidden)return;t()}var g,y}function P(e){if(!K[e])throw new Error(`${F.type} No settings for ${e}. Message was: ${B}`)}let B=e.data;if("[iFrameResizerChild]Ready"===B)return H=e.source,void Object.values(K).forEach((e=>({initChild:t,postMessageTarget:i})=>{e===i&&t()})(H));var H;if(!(e=>I===`${e}`.slice(0,13)&&e.slice(13).split(a)[0]in K)(B)){if(typeof B!==z)return;return void ce(w,"ignoredMessage")}const F=function(e){const t=e.slice(13).split(a),i=t[1]?Number(t[1]):0,n=K[t[0]]?.iframe,o=getComputedStyle(n),s={iframe:n,id:t[0],height:i+r(o)+c(o),width:Number(t[2]),type:t[3],msg:t[4]};return t[5]&&(s.mode=t[5]),s}(B),{id:q,type:D}=F,U=q;U?(ce(U,D),fe(U,function(t){P(U),F.type in{true:1,false:1,undefined:1}||(null!==F.iframe||(se(U,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:t,sameOrigin:i}=e;if(i)return!0;let n=K[U]?.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=K[U]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${F.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}()&&L()})(B)):se("","iframeResizer received messageData without id, message was: ",B)}function $e(e,t,i){let n=null,o=null;if(K[e]){if(n=K[e][t],typeof n!==j)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onBeforeClose"===t||"onScroll"===t)try{o=n(i)}catch(i){console.error(i),se(e,`Error in ${t} callback`)}else((e,...t)=>{setTimeout(()=>e(...t),0)})(n,i)}return o}function je(e){const{id:t}=e;delete K[t],delete e.iframeResizer}function ke(e){const{id:t}=e;if(!1!==$e(t,"onBeforeClose",t)){try{e.parentNode&&e.remove()}catch(e){se(t,e)}$e(t,"onAfterClose",t),je(e)}}function Te(e){null===we.position&&(we.position={x:window.scrollX,y:window.scrollY})}function xe(){we.position=null}function Me(e){null!==we.position&&(window.scrollTo(we.position.x,we.position.y),ae(e,`Set page position: %c${we.position.x}%c, %c${we.position.y}`,i,n,i),xe())}function Se(e){Te(e.id),Ie(e),Re(m,m,e.id)}function Ie(e){function t(t){const o=`${e[t]}px`;e.iframe.style[t]=o,ae(n,`Set ${t}: %c${o}`,i)}const{id:n}=e,{sizeHeight:o,sizeWidth:r}=K[n];o&&t("height"),r&&t("width")}const Oe=e=>e.split(a).filter((e,t)=>19!==t).join(a);function Re(e,t,o){function r(r){const a=e in R?Oe(t):t;ae(o,r,i,n,i),ae(o,`Message data: %c${a}`,i)}ce(o,e),K[o]&&(K[o]?.postMessageTarget?function(){const{iframe:i,postMessageTarget:n,sameOrigin:a,targetOrigin:s}=K[o];if(a)try{return i.contentWindow.iframeChildListener(I+t),void r(`Sending message to iframe %c${o}%c via same origin%c`)}catch(t){e in R?K[o].sameOrigin=!1:se(o,"Same origin messaging failed, falling back to postMessage")}r(`Sending message to iframe: %c${o}%c targetOrigin: %c${s}`),n.postMessage(I+t,s)}():se(o,`Iframe(${o}) not found`))}let Ce=0,We=!1,Ee=!1;function Le(e,i=-3){if(We)return;const n=Math.max(K[e].mode,i);if(n>K[e].mode&&(K[e].mode=n),n<0)throw ue(e),K[e].vAdvised||he(e||"Parent",`${U(n+2)}${U(2)}`),K[e].vAdvised=!0,U(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");n>0&&Ee||function(e,i){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,te||i<1?"font-weight: bold;":t))}(`v${o} (${(e=>B(q[e]))(n)})`,n),n<1&&he("Parent",U(3)),We=!0}const Ae=e=>t=>{function n(){K[R]?.heightCalculationMethod in O&&Se({iframe:t,height:1,width:1,type:l})}function o(){if(K[R]){const{iframe:e}=K[R],t={close:ke.bind(null,e),disconnect:je.bind(null,e),removeListeners(){he(R,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${L}\n`),this.disconnect()},resize(){he(R,"<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."),Re.bind(null,"Window resize",g,R)},moveToAnchor(e){((e,t,i)=>{if(typeof e!==t)throw new TypeError(`${i} is not a ${n=t,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,z,"moveToAnchor(anchor) anchor"),Re("Move to anchor",`moveToAnchor:${e}`,R)},sendMessage(e){e=JSON.stringify(e),Re(d,`${d}:${e}`,R)}};e.iframeResizer=t,e.iFrameResizer=t}}function p(e,t){const i=i=>()=>{if(!K[e])return;const{firstRun:o,iframe:r}=K[e];Re(i,t,e),(e=>e===l)(i)&&(e=>"lazy"===e.loading)(r)||function(e,t){const i=t[e],{msgTimeout:n,warningTimeout:o}=i;o&&(n&&clearTimeout(n),i.msgTimeout=setTimeout(function(){const i=t[e];void 0!==i&&((e=>{e.msgTimeout=void 0})(i),function(e){const{initialised:t}=e;return t&&(e.initialisedFirstPage=!0),t}(i)||ye(i))},o))}(e,K),o||n()},{iframe:o}=K[e];K[e].initChild=i(c),function(e,t){A(e,u,()=>setTimeout(t,1))}(o,i(f)),function(e,t){const{iframe:i,waitForLoad:n}=K[e];!0!==n&&((e=>{const{src:t,srcdoc:i}=e;return!i&&(null==t||""===t||"about:blank"===t)})(i)?setTimeout(()=>{ce(e,"noContent"),ae(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(t))}(e,i(l))}function h(e){return e?(("sizeWidth"in e||"sizeHeight"in e||s in e)&&he(R,`<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 <bb>${M}</>, <bb>${S}</>, <bb>${x}</> or <bb>${T}</>.\n`),e):{}}function m(e){const t=K[e]?.iframe?.title;return""===t||void 0===t}function y(e,t){Z(K[R],e)&&(he(R,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${t}</>. ${L}`),K[R][t]=K[R][e],delete K[R][e])}const w=e=>Z(e,"onMouseEnter")||Z(e,"onMouseLeave");function j(e){var n,o;K[R]={...K[R],iframe:t,remoteHost:t?.src.split("/").slice(0,3).join("/"),...ve,...h(e),mouseEvents:w(e),mode:J(e),syncTitle:m(R)},y("offset","offsetSize"),y("onClose","onBeforeClose"),y("onClosed","onAfterClose"),ce(R,"setup"),function(){const{direction:e}=K[R];switch(e){case M:break;case S:K[R].sizeHeight=!1;case x:K[R].sizeWidth=!0;break;case T:K[R].sizeWidth=!1,K[R].sizeHeight=!1,K[R].autoResize=!1;break;default:throw new TypeError(R,`Direction value of "${e}" is not valid`)}}(),(n=e?.offsetSize||e?.offset)&&(K[R].direction===M?K[R].offsetHeight=n:K[R].offsetWidth=n),K[R].warningTimeout||ae(R,"warningTimeout:%c disabled",i),null===K[R].postMessageTarget&&(K[R].postMessageTarget=t.contentWindow),K[R].targetOrigin=!0===K[R].checkOrigin?""===(o=K[R].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const I=()=>r in t,R=function(i){if(i&&typeof i!==z)throw new TypeError("Invalid id for iFrame. Expected String");return""!==i&&i||(i=function(){let t=e?.id||ve.id+Ce++;return null!==document.getElementById(t)&&(t+=Ce++),t}(),t.id=i,ce(i,"assignId")),i}(t.id);if(typeof e!==$)throw new TypeError("Options is not an object");return function(e){const{search:t}=window.location;t.includes("ifrlog")&&(e.log=W,e.logExpand=t.includes("ifrlog=expanded"))}(e),function(e,t){const i=Z(t,"log"),n=typeof t.log===z,o=i?!!n||t.log:ve.log;Z(t,"logExpand")||(t.logExpand=i&&n?t.log===C:ve.logExpand),function(e){-1===e?.log&&(e.log=!1,Ee=!0)}(t),function({enabled:e,expand:t,iframeId:i}){const n=Q({expand:t,label:ne(i)});te=e,K[i]||(K[i]={console:n})}({enabled:o,expand:t.logExpand,iframeId:e}),n&&!(t.log in E)&&le(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),t.log=o}(R,e),fe(R,function(e){I()?se(R,`Ignored iframe (${R}), already setup.`):(j(e),function(e){if(!0===be[e])return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;be[e]=!0;const i=Array.from(t).flatMap(e=>[b,e,b]);he(e,`<rb>Duplicate ID attributes detected</>\n\nThe <b>${e}</> ID is not unique. Having multiple iframes on the same page with the same ID causes problems with communication between the iframe and parent page. Please ensure that the ID of each iframe has a unique value.\n\nFound <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...i,b)}(R),function(){if(We)return;const{mode:e}=K[R];-1!==e&&Le(R,e)}(),Pe(),function(){switch(t.style.overflow=!1===K[R]?.scrolling?"hidden":k,K[R]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=K[R]?K[R].scrolling:"no"}}(),function(){const{bodyMargin:e}=K[R];"number"!=typeof e&&"0"!==e||(K[R].bodyMargin=`${e}px`)}(),p(R,function(e){const{autoResize:t,bodyBackground:i,bodyMargin:n,bodyPadding:o,heightCalculationMethod:r,inPageLinks:s,license:l,log:c,logExpand:u,mouseEvents:d,offsetHeight:f,offsetWidth:p,mode:h,sizeHeight:m,sizeWidth:g,tolerance:y,widthCalculationMethod:b}=K[e];return[e,"8",g,c,"32",!0,t,n,r,i,o,y,s,v,b,d,f,p,m,l,we.version,h,"",u].join(a)}(R)),o(),de(R))})(e),t?.iframeResizer};function Ne(){!0!==document.hidden&&((e,t)=>{Object.values(K).filter(({autoResize:e,firstRun:t})=>e&&!t).forEach(({iframe:i})=>Re(e,t,i.id))})("tabVisible",g)}const Pe=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})(()=>{A(window,d,ze),A(document,"visibilitychange",Ne),window.iframeParentListener=e=>setTimeout(()=>ze({data:e,sameOrigin:!0}))});export{Ae as default};
1
+ import Je, { NORMAL as Ye, HIGHLIGHT as l, FOREGROUND as v } from "auto-console-group";
2
+ const C = "6.0.0-beta.0", pe = "iframeResizer", S = ":", Xe = "[iFrameResizerChild]Ready", de = "autoResize", Ke = "beforeUnload", Qe = "close", et = "inPageLink", $ = "init", he = "iframeReady", tt = "lazy", W = "load", R = "message", nt = "mouseenter", ot = "mouseleave", ge = "onload", me = "pageInfo", be = "parentInfo", it = "pageInfoStop", rt = "parentInfoStop", H = "reset", Z = "resize", st = "scrollBy", ct = "scrollTo", at = "scrollToOffset", lt = "title", Q = 1, ut = "height", ft = "width", pt = "offset", dt = "offsetSize", ee = "scroll", P = `
3
+ `, ht = "hidden", gt = "child", D = "parent", J = "string", mt = "number", ye = "object", ve = "function", G = "auto", bt = "font-weight: bold;", we = "none", ze = "both", F = "vertical", Ee = "horizontal", yt = R.length, x = "[iFrameSizer]", U = x.length, vt = Object.freeze({
4
+ max: 1,
5
+ scroll: 1,
6
+ bodyScroll: 1,
7
+ documentElementScroll: 1
8
+ }), te = Object.freeze({
9
+ [ge]: 1,
10
+ [$]: 1,
11
+ [he]: 1
12
+ }), V = "expanded", Y = "collapsed", wt = Object.freeze({
13
+ [V]: 1,
14
+ [Y]: 1
15
+ }), Oe = "Use of the old name will be removed in a future version of <i>iframe-resizer</>.", Te = (e) => typeof e === ye && e !== null, X = (e) => typeof e === J;
16
+ function zt(e) {
17
+ if (!Te(e)) return !1;
18
+ try {
19
+ return e.tagName === "IFRAME" || e instanceof HTMLIFrameElement;
20
+ } catch {
21
+ return !1;
22
+ }
23
+ }
24
+ const Et = (e, ...t) => setTimeout(() => e(...t), 0), Ot = (e) => {
25
+ let t = !1;
26
+ return function(...n) {
27
+ return t ? void 0 : (t = !0, e.apply(this, n));
28
+ };
29
+ }, Tt = (e, t) => Object.prototype.hasOwnProperty.call(e, t), k = (e, t) => Object.hasOwn ? Object.hasOwn(e, t) : Tt(e, t), It = (e) => e, Mt = (e) => e.charAt(0).toUpperCase() + e.slice(1), $t = (e) => (
30
+ // eslint-disable-next-line no-underscore-dangle
31
+ e?.__esModule ? e.default : e
32
+ ), St = (e, t, n) => {
33
+ if (typeof e !== t)
34
+ throw new TypeError(`${n} is not a ${Mt(t)}`);
35
+ }, Rt = (e) => (t, n = "renamed to") => (o, r, s = "", c = "") => e(
36
+ c,
37
+ `<rb>Deprecated ${t}(${o.replace("()", "")})</>
38
+
39
+ The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${s}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`
40
+ ), Ie = {
41
+ br: `
42
+ `,
43
+ rb: "\x1B[31;1m",
44
+ // red bold
45
+ bb: "\x1B[34;1m",
46
+ // blue bold
47
+ b: "\x1B[1m",
48
+ // bold
49
+ i: "\x1B[3m",
50
+ // italic
51
+ u: "\x1B[4m",
52
+ // underline
53
+ "/": "\x1B[m"
54
+ // reset
55
+ }, kt = Object.keys(Ie), jt = new RegExp(`<(${kt.join("|")})>`, "gi"), Lt = (e, t) => Ie[t] ?? "", At = (e) => e.replace(jt, Lt), Pt = (e) => e.replaceAll("<br>", P).replaceAll(/<\/?[^>]+>/gi, ""), Me = (e) => (t) => e(
56
+ X(t) ? window.chrome ? At(t) : Pt(t) : t
57
+ ), i = {}, $e = $t(Je);
58
+ let K = !0;
59
+ const Nt = $e({
60
+ expand: !1,
61
+ label: D
62
+ }), Ct = (e) => window.top === window.self ? `parent(${e})` : `nested parent(${e})`, xt = (e) => i[e] ? i[e].log : K;
63
+ function _t({ enabled: e, expand: t, iframeId: n }) {
64
+ const o = $e({
65
+ expand: t,
66
+ label: Ct(n)
67
+ });
68
+ K = e, i[n] || (i[n] = {
69
+ console: o
70
+ });
71
+ }
72
+ const I = (e) => (t, ...n) => i[t] ? i[t].console[e](...n) : Nt[e](...n), Se = (e) => (t, ...n) => xt(t) === !0 ? I(e)(t, ...n) : null, u = Se("log"), m = u, Ft = Se("debug"), M = I("warn"), Bt = I("error"), y = I("event"), Wt = I("purge"), Ht = I("endAutoGroup"), Re = I("errorBoundary");
73
+ function Dt(e, t) {
74
+ queueMicrotask(
75
+ () => (
76
+ // eslint-disable-next-line no-console
77
+ console.info(
78
+ `%ciframe-resizer ${e}`,
79
+ K || t < 1 ? bt : Ye
80
+ )
81
+ )
82
+ );
83
+ }
84
+ const Gt = (e) => (...t) => [`${pe}(${e})`, ...t].join(" "), Ut = Me(It), b = (e, ...t) => i[e] ? i[e].console.warn(...t.map(Ut)) : queueMicrotask(() => {
85
+ const n = Me(Gt(e));
86
+ console?.warn(...t.map(n));
87
+ }), Vt = Rt(b), qt = Vt("Option"), Zt = (e) => {
88
+ typeof i[e.id].onInit === ve && (qt("init()", "onReady()", "", e.id), i[e.id].onInit(e));
89
+ }, _ = Object.freeze({
90
+ autoResize: !0,
91
+ bodyBackground: null,
92
+ bodyMargin: null,
93
+ bodyPadding: null,
94
+ checkOrigin: !0,
95
+ direction: F,
96
+ firstRun: !0,
97
+ inPageLinks: !1,
98
+ heightCalculationMethod: G,
99
+ id: "iFrameResizer",
100
+ // TODO: v6 change to 'iframeResizer'
101
+ log: !1,
102
+ logExpand: !1,
103
+ license: void 0,
104
+ mouseEvents: !0,
105
+ offsetHeight: null,
106
+ offsetWidth: null,
107
+ postMessageTarget: null,
108
+ sameDomain: !1,
109
+ scrolling: !1,
110
+ sizeHeight: !0,
111
+ // sizeSelector: '',
112
+ sizeWidth: !1,
113
+ tolerance: 0,
114
+ waitForLoad: !1,
115
+ warningTimeout: 5e3,
116
+ widthCalculationMethod: G,
117
+ onBeforeClose: () => !0,
118
+ onAfterClose() {
119
+ },
120
+ onInit: !1,
121
+ onMessage: null,
122
+ onMouseEnter() {
123
+ },
124
+ onMouseLeave() {
125
+ },
126
+ onReady: Zt,
127
+ onResized() {
128
+ },
129
+ onScroll: () => !0
130
+ });
131
+ let ne = 0;
132
+ function Jt(e) {
133
+ const t = e?.id || _.id + ne++;
134
+ return document.getElementById(t) === null ? t : `${t}${ne++}`;
135
+ }
136
+ function Yt(e, t) {
137
+ let { id: n } = e;
138
+ if (n && !X(n))
139
+ throw new TypeError("Invalid id for iFrame. Expected String");
140
+ return (!n || n === "") && (n = Jt(t), e.id = n, y(n, "assignId"), u(n, `Added missing iframe ID: ${n} (${e.src})`)), n;
141
+ }
142
+ function Xt(e) {
143
+ const { search: t } = window.location;
144
+ t.includes("ifrlog") && (e.log = Y, e.logExpand = t.includes("ifrlog=expanded"));
145
+ }
146
+ const j = (e, t, n, o) => e.addEventListener(t, n, o || !1), oe = (e, t, n) => e.removeEventListener(t, n, !1), Kt = (e) => e.split(S).filter((t, n) => n !== 19).join(S);
147
+ function Qt(e, t, n) {
148
+ function o(f) {
149
+ const p = e in te ? Kt(t) : t;
150
+ m(n, f, l, v, l), m(n, `Message data: %c${p}`, l);
151
+ }
152
+ const { iframe: r, postMessageTarget: s, sameOrigin: c, targetOrigin: a } = i[n];
153
+ if (c)
154
+ try {
155
+ r.contentWindow.iframeChildListener(x + t), o(`Sending message to iframe %c${n}%c via same origin%c`);
156
+ return;
157
+ } catch {
158
+ e in te ? (i[n].sameOrigin = !1, u(n, "New iframe does not support same origin")) : M(n, "Same origin messaging failed, falling back to postMessage");
159
+ }
160
+ o(
161
+ `Sending message to iframe: %c${n}%c targetOrigin: %c${a}`
162
+ ), s.postMessage(x + t, a);
163
+ }
164
+ function O(e, t, n) {
165
+ if (y(n, e), !i[n]?.postMessageTarget) {
166
+ M(n, "Iframe not found");
167
+ return;
168
+ }
169
+ Qt(e, t, n);
170
+ }
171
+ const en = (e, t) => Object.values(i).filter(({ autoResize: n, firstRun: o }) => n && !o).forEach(({ iframe: n }) => O(e, t, n.id));
172
+ function tn() {
173
+ document.hidden !== !0 && en("tabVisible", Z);
174
+ }
175
+ function nn(e) {
176
+ if (e.boxSizing !== "border-box") return 0;
177
+ const t = e.paddingTop ? parseInt(e.paddingTop, 10) : 0, n = e.paddingBottom ? parseInt(e.paddingBottom, 10) : 0;
178
+ return t + n;
179
+ }
180
+ function on(e) {
181
+ if (e.boxSizing !== "border-box") return 0;
182
+ const t = e.borderTopWidth ? parseInt(e.borderTopWidth, 10) : 0, n = e.borderBottomWidth ? parseInt(e.borderBottomWidth, 10) : 0;
183
+ return t + n;
184
+ }
185
+ function rn(e) {
186
+ const t = e.slice(U).split(":"), n = t[1] ? Number(t[1]) : 0, o = i[t[0]]?.iframe, r = getComputedStyle(o), s = {
187
+ iframe: o,
188
+ id: t[0],
189
+ height: n + nn(r) + on(r),
190
+ width: Number(t[2]),
191
+ type: t[3],
192
+ msg: t[4],
193
+ message: t[4]
194
+ };
195
+ return t[5] && (s.mode = t[5]), s;
196
+ }
197
+ const sn = { true: 1, false: 1, undefined: 1 };
198
+ function cn(e) {
199
+ const { id: t, msg: n, iframe: o } = e, r = zt(o);
200
+ return r || (u(t, `Received: %c${n}`, l), M(t, "The target iframe was not found.")), r;
201
+ }
202
+ function an(e, t) {
203
+ function n() {
204
+ function f() {
205
+ u(
206
+ o,
207
+ `Checking connection is from allowed list of origins: %c${a}`,
208
+ l
209
+ );
210
+ for (const g of a)
211
+ if (g === s)
212
+ return !0;
213
+ return !1;
214
+ }
215
+ function p() {
216
+ const g = i[o]?.remoteHost;
217
+ return u(o, `Checking connection is from: %c${g}`, l), s === g;
218
+ }
219
+ return a.constructor === Array ? f() : p();
220
+ }
221
+ const { id: o } = e, { data: r, origin: s } = t;
222
+ if ("sameOrigin" in t && t.sameOrigin) return !0;
223
+ let a = i[o]?.checkOrigin;
224
+ if (a && `${s}` != "null" && !n())
225
+ throw new Error(
226
+ `Unexpected message received from: ${s} for ${o}. Message was: ${r}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`
227
+ );
228
+ return !0;
229
+ }
230
+ const ln = (e) => x === `${e}`.slice(0, U) && e.slice(U).split(":")[0] in i;
231
+ function un(e) {
232
+ const { id: t, type: n } = e, o = n in sn;
233
+ return o && u(t, "Ignoring init message from meta parent page"), o;
234
+ }
235
+ function fn(e) {
236
+ try {
237
+ i[e].sameOrigin = !!i[e]?.iframe?.contentWindow?.iframeChildListener;
238
+ } catch {
239
+ i[e].sameOrigin = !1;
240
+ }
241
+ u(e, `sameOrigin: %c${i[e].sameOrigin}`, l);
242
+ }
243
+ function pn(e, t) {
244
+ if (t !== C) {
245
+ if (t === void 0) {
246
+ b(
247
+ e,
248
+ `<rb>Legacy version detected in iframe</>
249
+
250
+ Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
251
+
252
+ See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
253
+ `
254
+ );
255
+ return;
256
+ }
257
+ u(
258
+ e,
259
+ `Version mismatch (Child: %c${t}%c !== Parent: %c${C})`,
260
+ l,
261
+ v,
262
+ l
263
+ );
264
+ }
265
+ }
266
+ function T(e, t, n) {
267
+ if (!i[e]) return null;
268
+ const o = i[e][t];
269
+ if (typeof o !== ve)
270
+ throw new TypeError(`${t} on iframe[${e}] is not a function`);
271
+ if (t !== "onBeforeClose" && t !== "onScroll")
272
+ return Et(o, n);
273
+ try {
274
+ return o(n);
275
+ } catch (r) {
276
+ return console.error(r), M(e, `Error in ${t} callback`), null;
277
+ }
278
+ }
279
+ function dn(e, t) {
280
+ const { id: n, iframe: o } = e;
281
+ u(
282
+ n,
283
+ `onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,
284
+ l,
285
+ v,
286
+ l,
287
+ v
288
+ ), T(n, "onMessage", {
289
+ iframe: o,
290
+ message: JSON.parse(t)
291
+ });
292
+ }
293
+ function N(e, t) {
294
+ const { lastMessage: n } = i[e];
295
+ return n.slice(
296
+ n.indexOf(S) + yt + t
297
+ );
298
+ }
299
+ function ie(e, t) {
300
+ const { id: n, iframe: o, height: r, type: s, width: c } = t;
301
+ let a = { x: 0, y: 0 };
302
+ if (c === 0 && r === 0) {
303
+ const f = N(n, 9).split(S);
304
+ a = {
305
+ x: f[1],
306
+ y: f[0]
307
+ };
308
+ } else
309
+ a = {
310
+ x: c,
311
+ y: r
312
+ };
313
+ T(n, e, {
314
+ iframe: o,
315
+ screenX: Number(a.x),
316
+ screenY: Number(a.y),
317
+ type: s
318
+ });
319
+ }
320
+ const d = {
321
+ position: null,
322
+ version: C
323
+ };
324
+ function ke() {
325
+ d.position = null;
326
+ }
327
+ const hn = () => d.position;
328
+ function gn(e) {
329
+ d.position = e;
330
+ }
331
+ function je(e) {
332
+ return d.position === null && (d.position = {
333
+ x: window.scrollX,
334
+ y: window.scrollY
335
+ }), u(
336
+ e,
337
+ `Get page position: %c${d.position.x}%c, %c${d.position.y}`,
338
+ l,
339
+ v,
340
+ l
341
+ ), d.position;
342
+ }
343
+ function Le(e) {
344
+ d.position !== null && (window.scrollTo(d.position.x, d.position.y), m(
345
+ e,
346
+ `Set page position: %c${d.position.x}%c, %c${d.position.y}`,
347
+ l,
348
+ v,
349
+ l
350
+ ), ke());
351
+ }
352
+ function re(e, t) {
353
+ const { id: n } = t, o = `${t[e]}px`;
354
+ i[n].iframe.style[e] = o, m(n, `Set ${e}: %c${o}`, l);
355
+ }
356
+ function Ae(e) {
357
+ const { id: t } = e, { sizeHeight: n, sizeWidth: o } = i[t];
358
+ n && re(ut, e), o && re(ft, e);
359
+ }
360
+ function se(e) {
361
+ const { id: t } = e;
362
+ Ae(e), Le(t), T(t, "onResized", e);
363
+ }
364
+ function Pe(e) {
365
+ const { id: t } = e;
366
+ u(t, "Disconnected from iframe"), delete i[t], delete e.iframeResizer;
367
+ }
368
+ function Ne(e) {
369
+ const { id: t } = e;
370
+ if (T(t, "onBeforeClose", t) === !1) {
371
+ u(t, "Close iframe cancelled by onBeforeClose");
372
+ return;
373
+ }
374
+ u(t, `Removing iFrame: %c${t}`, l);
375
+ try {
376
+ e.parentNode && e.remove();
377
+ } catch (n) {
378
+ M(t, n);
379
+ }
380
+ T(t, "onAfterClose", t), Pe(e);
381
+ }
382
+ function Ce(e) {
383
+ const { id: t, type: n } = e;
384
+ u(
385
+ t,
386
+ `Size reset requested by ${n === $ ? "parent page" : "child page"}`
387
+ ), je(t), Ae(e), O(H, H, t);
388
+ }
389
+ const xe = (e, t) => {
390
+ const n = {};
391
+ return (o, r) => {
392
+ const { iframe: s } = i[r];
393
+ function c(f, p) {
394
+ n[p] || (f(), n[p] = requestAnimationFrame(() => {
395
+ n[p] = null;
396
+ }));
397
+ }
398
+ function a() {
399
+ O(`${o} (${e})`, `${e}:${t(s)}`, r);
400
+ }
401
+ c(a, r);
402
+ };
403
+ }, _e = (e) => (t) => {
404
+ e in i[t] && (i[t][e](), delete i[t][e]);
405
+ }, Fe = (e, t) => (n) => {
406
+ let o = !1;
407
+ const r = (h) => () => {
408
+ i[n] ? (!o || o === h) && (e(h, n), o = h, requestAnimationFrame(() => {
409
+ o = !1;
410
+ })) : f();
411
+ }, s = r(ee), c = r("resize window");
412
+ function a(h, z) {
413
+ u(n, `${h}listeners for send${t}`), z(window, ee, s), z(window, Z, c);
414
+ }
415
+ function f() {
416
+ y(n, `stop${t}`), a("Remove ", oe), g.disconnect(), w.disconnect(), i[n] && oe(i[n].iframe, W, f);
417
+ }
418
+ function p() {
419
+ a("Add ", j), g.observe(document.body), w.observe(i[n].iframe);
420
+ }
421
+ const g = new ResizeObserver(r("pageObserver")), w = new ResizeObserver(r("iframeObserver"));
422
+ i[n] && (i[n][`stop${t}`] = f, j(i[n].iframe, W, f), p());
423
+ };
424
+ function mn(e) {
425
+ const t = document.body.getBoundingClientRect(), n = e.getBoundingClientRect(), { scrollY: o, scrollX: r, innerHeight: s, innerWidth: c } = window, { clientHeight: a, clientWidth: f } = document.documentElement;
426
+ return JSON.stringify({
427
+ iframeHeight: n.height,
428
+ iframeWidth: n.width,
429
+ clientHeight: Math.max(a, s || 0),
430
+ clientWidth: Math.max(f, c || 0),
431
+ offsetTop: Math.trunc(n.top - t.top),
432
+ offsetLeft: Math.trunc(n.left - t.left),
433
+ scrollTop: o,
434
+ scrollLeft: r,
435
+ documentHeight: a,
436
+ documentWidth: f,
437
+ windowHeight: s,
438
+ windowWidth: c
439
+ });
440
+ }
441
+ const bn = xe(me, mn), yn = Fe(
442
+ bn,
443
+ "PageInfo"
444
+ ), vn = _e("stopPageInfo");
445
+ function wn(e) {
446
+ const { scrollWidth: t, scrollHeight: n } = document.documentElement, { width: o, height: r, offsetLeft: s, offsetTop: c, pageLeft: a, pageTop: f, scale: p } = window.visualViewport;
447
+ return JSON.stringify({
448
+ iframe: e.getBoundingClientRect(),
449
+ document: {
450
+ scrollWidth: t,
451
+ scrollHeight: n
452
+ },
453
+ viewport: {
454
+ width: o,
455
+ height: r,
456
+ offsetLeft: s,
457
+ offsetTop: c,
458
+ pageLeft: a,
459
+ pageTop: f,
460
+ scale: p
461
+ }
462
+ });
463
+ }
464
+ const zn = xe(be, wn), En = Fe(
465
+ zn,
466
+ "ParentInfo"
467
+ ), On = _e("stopParentInfo");
468
+ function Be(e) {
469
+ const t = e.getBoundingClientRect(), n = je(e.id);
470
+ return {
471
+ x: Number(t.left) + Number(n.x),
472
+ y: Number(t.top) + Number(n.y)
473
+ };
474
+ }
475
+ function We(e) {
476
+ const { x: t, y: n } = hn(), o = i[e]?.iframe;
477
+ if (T(e, "onScroll", { iframe: o, top: n, left: t, x: t, y: n }) === !1) {
478
+ ke();
479
+ return;
480
+ }
481
+ Le(e);
482
+ }
483
+ function Tn(e) {
484
+ const { id: t, height: n, width: o } = e, r = window.parentIframe || window.parentIFrame || window;
485
+ m(
486
+ t,
487
+ `scrollBy: x: %c${o}%c y: %c${n}`,
488
+ l,
489
+ v,
490
+ l
491
+ ), r.scrollBy(o, n);
492
+ }
493
+ const He = (e) => (t) => {
494
+ function n(h) {
495
+ gn(h), We(s);
496
+ }
497
+ function o(h, z) {
498
+ h[`scrollTo${e ? "Offset" : ""}`](z.x, z.y);
499
+ }
500
+ const r = (h) => ({
501
+ x: f + h.x,
502
+ y: a + h.y
503
+ }), { id: s, iframe: c, height: a, width: f } = t, p = e ? Be(c) : { x: 0, y: 0 }, g = r(p), w = window.parentIframe || window.parentIFrame;
504
+ m(
505
+ s,
506
+ `Reposition requested (offset x:%c${p.x}%c y:%c${p.y})`,
507
+ l,
508
+ v,
509
+ l
510
+ ), w ? o(w, g) : n(g);
511
+ }, In = He(!1), Mn = He(!0);
512
+ function $n(e, t, n) {
513
+ const { x: o, y: r } = Be(n);
514
+ m(e, `Moving to in page link: %c#${t}`, l), d.position = { x: o, y: r }, We(e), window.location.hash = t;
515
+ }
516
+ function Sn(e, t) {
517
+ const n = window.parentIframe || window.parentIFrame;
518
+ if (!n) {
519
+ u(e, `In page link #${t} not found`);
520
+ return;
521
+ }
522
+ n.moveToAnchor(t);
523
+ }
524
+ function Rn(e, t) {
525
+ const n = t.split("#")[1] || "", o = decodeURIComponent(n), r = document.getElementById(o) || document.getElementsByName(o)[0];
526
+ if (r) {
527
+ $n(e, n, r);
528
+ return;
529
+ }
530
+ if (window.top === window.self) {
531
+ u(e, `In page link #${n} not found`);
532
+ return;
533
+ }
534
+ Sn(e, n);
535
+ }
536
+ function kn(e) {
537
+ const t = i[e]?.iframe?.title;
538
+ return t === "" || t === void 0;
539
+ }
540
+ function jn(e, t) {
541
+ i[e]?.syncTitle && (i[e].iframe.title = t, m(e, `Set iframe title attribute: %c${t}`, l));
542
+ }
543
+ const ce = (e) => {
544
+ if (!e) return "";
545
+ let t = -559038744, n = 1103547984;
546
+ for (let o, r = 0; r < e.length; r++)
547
+ o = e.codePointAt(r), t = Math.imul(t ^ o, 2246822519), n = Math.imul(n ^ o, 3266489917);
548
+ return t ^= Math.imul(t ^ n >>> 15, 1935289751), n ^= Math.imul(n ^ t >>> 15, 3405138345), t ^= n >>> 16, n ^= t >>> 16, (2097152 * (n >>> 0) + (t >>> 11)).toString(36);
549
+ }, E = (e) => e.replace(
550
+ /[A-Za-z]/g,
551
+ (t) => String.fromCodePoint(
552
+ (t <= "Z" ? 90 : 122) >= (t = t.codePointAt(0) + 19) ? t : t - 26
553
+ )
554
+ ), L = ["spjluzl", "rlf", "clyzpvu", "rlf2"], Ln = [
555
+ "<yi>Puchspk Spjluzl Rlf</><iy><iy>",
556
+ "<yi>Tpzzpun Spjluzl Rlf</><iy><iy>",
557
+ "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</>",
558
+ "<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</>.",
559
+ "<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.",
560
+ "Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."
561
+ ], An = ["NWSc3", "zvsv", "wyv", "ibzpulzz", "vlt"], ae = Object.fromEntries(
562
+ [
563
+ "2cgs7fdf4xb",
564
+ "1c9ctcccr4z",
565
+ "1q2pc4eebgb",
566
+ "ueokt0969w",
567
+ "w2zxchhgqz",
568
+ "1umuxblj2e5",
569
+ "2b5sdlfhbev",
570
+ "zo4ui3arjo",
571
+ "oclbb4thgl"
572
+ ].map((e, t) => [e, Math.max(0, t - 1)])
573
+ ), A = (e) => E(Ln[e]), Pn = (e) => E(An[e]), Nn = (e) => {
574
+ const t = e[E(L[0])] || e[E(L[1])] || e[E(L[2])] || e[E(L[3])];
575
+ if (!t) return -1;
576
+ const n = t.split("-");
577
+ let o = (function(r = "") {
578
+ let s = -2;
579
+ const c = ce(E(r));
580
+ return c in ae && (s = ae[c]), s > 4 ? s - 4 : s;
581
+ })(n[0]);
582
+ return o === 0 || ((r) => r[2] === ce(r[0] + r[1]))(n) || (o = -2), o;
583
+ };
584
+ let q = !1, De = !1;
585
+ function Ge(e, t = -3) {
586
+ if (q) return;
587
+ const n = Math.max(i[e].mode, t);
588
+ if (n > i[e].mode && (i[e].mode = n), n < 0)
589
+ throw Wt(e), i[e].vAdvised || b(e || "Parent", `${A(n + 2)}${A(2)}`), i[e].vAdvised = !0, A(n + 2).replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
590
+ n > 0 && De || Dt(`v${C} (${Pn(n)})`, n), n < 1 && b("Parent", A(3)), q = !0;
591
+ }
592
+ function Cn(e) {
593
+ if (q) return;
594
+ const { mode: t } = i[e];
595
+ t !== -1 && Ge(e, t);
596
+ }
597
+ function xn(e) {
598
+ e?.log === -1 && (e.log = !1, De = !0);
599
+ }
600
+ function _n(e, t) {
601
+ i[e] && (u(e, `First run for ${e}`), Ge(e, t !== void 0 ? Number(t) : void 0), i[e].firstRun = !1);
602
+ }
603
+ function Fn(e) {
604
+ const { height: t, id: n, iframe: o, mode: r, message: s, type: c, width: a } = e, { lastMessage: f } = i[n];
605
+ switch (i[n]?.firstRun && _n(n, r), u(n, `Received: %c${f}`, l), c) {
606
+ case de:
607
+ i[n].autoResize = JSON.parse(N(n, 9));
608
+ break;
609
+ case Ke:
610
+ m(n, "Ready state reset"), i[n].initialised = !1;
611
+ break;
612
+ case Qe:
613
+ Ne(o);
614
+ break;
615
+ case et:
616
+ Rn(n, N(n, 9));
617
+ break;
618
+ case $:
619
+ se(e), fn(n), pn(n, s), i[n].initialised = !0, T(n, "onReady", o);
620
+ break;
621
+ case R:
622
+ dn(e, N(n, 6));
623
+ break;
624
+ case nt:
625
+ ie("onMouseEnter", e);
626
+ break;
627
+ case ot:
628
+ ie("onMouseLeave", e);
629
+ break;
630
+ case me:
631
+ yn(n);
632
+ break;
633
+ case be:
634
+ En(n);
635
+ break;
636
+ case it:
637
+ vn(n);
638
+ break;
639
+ case rt:
640
+ On(n);
641
+ break;
642
+ case H:
643
+ Ce(e);
644
+ break;
645
+ case st:
646
+ Tn(e);
647
+ break;
648
+ case ct:
649
+ In(e);
650
+ break;
651
+ case at:
652
+ Mn(e);
653
+ break;
654
+ case lt:
655
+ jn(n, s);
656
+ break;
657
+ default:
658
+ if (a === 0 && t === 0) {
659
+ M(
660
+ n,
661
+ `Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`
662
+ );
663
+ return;
664
+ }
665
+ if (a === 0 || t === 0) {
666
+ u(n, "Ignoring message with 0 height or width");
667
+ return;
668
+ }
669
+ if (document.hidden) {
670
+ u(n, "Page hidden - ignored resize request");
671
+ return;
672
+ }
673
+ se(e);
674
+ }
675
+ }
676
+ const Bn = (e) => ({ initChild: t, postMessageTarget: n }) => {
677
+ e === n && t();
678
+ }, Wn = (e) => Object.values(i).forEach(Bn(e));
679
+ function le(e) {
680
+ const t = e.data;
681
+ if (t === Xe) {
682
+ Wn(e.source);
683
+ return;
684
+ }
685
+ if (!ln(t)) {
686
+ if (typeof t !== J) return;
687
+ y(D, "ignoredMessage"), Ft(D, t);
688
+ return;
689
+ }
690
+ const n = rn(t), { id: o, type: r } = n;
691
+ switch (y(o, r), !0) {
692
+ case !i[o]:
693
+ throw new Error(`${r} No settings for ${o}. Message was: ${t}`);
694
+ case !cn(n):
695
+ case un(n):
696
+ case !an(n, e):
697
+ return;
698
+ default:
699
+ i[o].lastMessage = e.data, Re(o, Fn)(n);
700
+ }
701
+ }
702
+ const Hn = Ot(() => {
703
+ j(window, R, le), j(document, "visibilitychange", tn), window.iframeParentListener = (e) => setTimeout(() => le({ data: e, sameOrigin: !0 }));
704
+ }), ue = {};
705
+ function Dn(e) {
706
+ if (ue[e] === !0) return !1;
707
+ const t = document.querySelectorAll(`iframe#${CSS.escape(e)}`);
708
+ if (t.length <= 1) return !0;
709
+ ue[e] = !0;
710
+ const n = Array.from(t).flatMap((o) => [
711
+ P,
712
+ o,
713
+ P
714
+ ]);
715
+ return b(
716
+ e,
717
+ `<rb>Duplicate ID attributes detected</>
718
+
719
+ The <b>${e}</> ID is not unique. Having multiple iframes on the same page with the same ID causes problems with communication between the iframe and parent page. Please ensure that the ID of each iframe has a unique value.
720
+
721
+ Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,
722
+ ...n,
723
+ P
724
+ ), !1;
725
+ }
726
+ const Gn = `<rb>Deprecated Method Name</>
727
+
728
+ The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${Oe}`, Un = `<rb>Deprecated Method</>
729
+
730
+ Use of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As there 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.`;
731
+ function Vn(e) {
732
+ if (i[e]) {
733
+ const { iframe: t } = i[e], n = {
734
+ close: Ne.bind(null, t),
735
+ disconnect: Pe.bind(null, t),
736
+ moveToAnchor(o) {
737
+ St(o, J, "moveToAnchor(anchor) anchor"), O("Move to anchor", `moveToAnchor:${o}`, e);
738
+ },
739
+ removeListeners() {
740
+ b(e, Gn), this.disconnect();
741
+ },
742
+ resize() {
743
+ b(e, Un), O("Window resize", Z, e);
744
+ },
745
+ sendMessage(o) {
746
+ o = JSON.stringify(o), O(R, `${R}:${o}`, e);
747
+ }
748
+ };
749
+ t.iframeResizer = n, t.iFrameResizer = n;
750
+ }
751
+ }
752
+ const qn = "8", Zn = "32", Jn = gt, Yn = !0;
753
+ function Xn(e) {
754
+ const {
755
+ autoResize: t,
756
+ bodyBackground: n,
757
+ bodyMargin: o,
758
+ bodyPadding: r,
759
+ heightCalculationMethod: s,
760
+ inPageLinks: c,
761
+ license: a,
762
+ log: f,
763
+ logExpand: p,
764
+ mouseEvents: g,
765
+ offsetHeight: w,
766
+ offsetWidth: h,
767
+ mode: z,
768
+ sizeHeight: Ue,
769
+ // sizeSelector,
770
+ sizeWidth: Ve,
771
+ tolerance: qe,
772
+ widthCalculationMethod: Ze
773
+ } = i[e];
774
+ return [
775
+ e,
776
+ qn,
777
+ Ve,
778
+ f,
779
+ Zn,
780
+ Yn,
781
+ t,
782
+ o,
783
+ s,
784
+ n,
785
+ r,
786
+ qe,
787
+ c,
788
+ Jn,
789
+ Ze,
790
+ g,
791
+ w,
792
+ h,
793
+ Ue,
794
+ a,
795
+ d.version,
796
+ z,
797
+ "",
798
+ // sizeSelector,
799
+ p
800
+ ].join(S);
801
+ }
802
+ const Kn = "0";
803
+ function Qn(e) {
804
+ const { bodyMargin: t } = i[e];
805
+ (typeof t === mt || t === Kn) && (i[e].bodyMargin = `${t}px`);
806
+ }
807
+ const eo = (e) => {
808
+ try {
809
+ return new URL(e).origin;
810
+ } catch {
811
+ return null;
812
+ }
813
+ }, to = (e) => typeof e === ye && e.length > 0 && !(e.contains("allow-scripts") && e.contains("allow-same-origin"));
814
+ function no(e, t) {
815
+ const {
816
+ checkOrigin: n,
817
+ iframe: { src: o, sandbox: r },
818
+ initialisedFirstPage: s,
819
+ waitForLoad: c
820
+ } = t[e], a = eo(o);
821
+ y(e, "noResponse"), b(
822
+ e,
823
+ `<rb>No response from iframe</>
824
+
825
+ The iframe (<i>${e}</>) has not responded within ${t[e].warningTimeout / 1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
826
+ ${n && a ? `
827
+ The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${a}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.
828
+ ` : ""}${c && !s ? `
829
+ The <b>waitForLoad</> option is currently set to <bb>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 <bb>false</>.
830
+ ` : ""}${to(r) ? `
831
+ The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
832
+ ` : ""}
833
+ 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.
834
+ `
835
+ );
836
+ }
837
+ function oo(e, t) {
838
+ function n() {
839
+ if (t[e] === void 0) return;
840
+ const { initialised: s, loadErrorShown: c } = t[e];
841
+ if (t[e].msgTimeout = void 0, s) {
842
+ t[e].initialisedFirstPage = !0;
843
+ return;
844
+ }
845
+ c || (t[e].loadErrorShown = !0, no(e, t));
846
+ }
847
+ const { msgTimeout: o, warningTimeout: r } = t[e];
848
+ r && (o && clearTimeout(o), t[e].msgTimeout = setTimeout(n, r));
849
+ }
850
+ const io = 1, ro = (e) => e.loading === tt, so = (e) => e === $;
851
+ function co(e) {
852
+ i[e]?.heightCalculationMethod in vt && Ce({
853
+ id: e,
854
+ iframe: i[e].iframe,
855
+ height: Q,
856
+ width: Q,
857
+ type: $
858
+ });
859
+ }
860
+ function ao(e, t) {
861
+ j(e, W, () => setTimeout(t, io));
862
+ }
863
+ const lo = (e) => {
864
+ const { src: t, srcdoc: n } = e;
865
+ return !n && (t == null || t === "" || t === "about:blank");
866
+ };
867
+ function uo(e, t) {
868
+ const { iframe: n, waitForLoad: o } = i[e];
869
+ if (o !== !0) {
870
+ if (lo(n)) {
871
+ setTimeout(() => {
872
+ y(e, "noContent"), m(e, "No content detected in the iframe, delaying initialisation");
873
+ });
874
+ return;
875
+ }
876
+ setTimeout(t);
877
+ }
878
+ }
879
+ function fo(e, t) {
880
+ const n = (r) => () => {
881
+ if (!i[e]) return;
882
+ const { firstRun: s, iframe: c } = i[e];
883
+ O(r, t, e), so(r) && ro(c) || oo(e, i), s || co(e);
884
+ }, { iframe: o } = i[e];
885
+ i[e].initChild = n(he), ao(o, n(ge)), uo(e, n($));
886
+ }
887
+ function po(e, t) {
888
+ return t ? (("sizeWidth" in t || "sizeHeight" in t || de in t) && b(
889
+ e,
890
+ `<rb>Deprecated Option</>
891
+
892
+ The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${F}</>, <bb>${Ee}</>, <bb>${ze}</> or <bb>${we}</>.
893
+ `
894
+ ), t) : {};
895
+ }
896
+ function ho(e) {
897
+ i[e].warningTimeout || m(e, "warningTimeout:%c disabled", l);
898
+ }
899
+ function go(e, { offset: t, offsetSize: n }) {
900
+ const o = n || t;
901
+ o && (i[e].direction === F ? (i[e].offsetHeight = o, u(e, `Offset height: %c${o}`, l)) : (i[e].offsetWidth = o, u(e, `Offset width: %c${o}`, l)));
902
+ }
903
+ function mo(e) {
904
+ const { direction: t } = i[e];
905
+ switch (t) {
906
+ case F:
907
+ break;
908
+ case Ee:
909
+ i[e].sizeHeight = !1;
910
+ // eslint-disable-next-line no-fallthrough
911
+ case ze:
912
+ i[e].sizeWidth = !0;
913
+ break;
914
+ case we:
915
+ i[e].sizeWidth = !1, i[e].sizeHeight = !1, i[e].autoResize = !1;
916
+ break;
917
+ default:
918
+ throw new TypeError(`Direction value of "${t}" is not valid`);
919
+ }
920
+ u(e, `direction: %c${t}`, l);
921
+ }
922
+ const bo = (e) => e === "" || e.match(/^(about:blank|javascript:|file:\/\/)/) !== null ? "*" : e;
923
+ function yo(e) {
924
+ i[e].targetOrigin = i[e].checkOrigin === !0 ? bo(i[e].remoteHost) : "*";
925
+ }
926
+ function vo(e) {
927
+ const { id: t } = e;
928
+ i[t].postMessageTarget === null && (i[t].postMessageTarget = e.contentWindow);
929
+ }
930
+ function B(e, t, n) {
931
+ k(i[e], t) && (b(
932
+ e,
933
+ `<rb>Deprecated option</>
934
+
935
+ The <b>${t}</> option has been renamed to <b>${n}</>. ${Oe}`
936
+ ), i[e][n] = i[e][t], delete i[e][t]);
937
+ }
938
+ function wo(e) {
939
+ B(e, pt, dt), B(e, "onClose", "onBeforeClose"), B(e, "onClosed", "onAfterClose");
940
+ }
941
+ const zo = (e) => k(e, "onMouseEnter") || k(e, "onMouseLeave");
942
+ function Eo(e, t) {
943
+ const { id: n } = e;
944
+ i[n] = {
945
+ ...i[n],
946
+ iframe: e,
947
+ remoteHost: e?.src.split("/").slice(0, 3).join("/"),
948
+ ..._,
949
+ ...po(n, t),
950
+ mouseEvents: zo(t),
951
+ mode: Nn(t),
952
+ syncTitle: kn(n)
953
+ }, wo(n), mo(n), go(n, t), ho(n), vo(e), yo(n);
954
+ }
955
+ const Oo = "yes", fe = "no", To = "omit";
956
+ function Io(e) {
957
+ const { id: t } = e;
958
+ switch (u(
959
+ t,
960
+ `Iframe scrolling ${i[t]?.scrolling ? "enabled" : "disabled"} for ${t}`
961
+ ), e.style.overflow = i[t]?.scrolling === !1 ? ht : G, i[t]?.scrolling) {
962
+ case To:
963
+ break;
964
+ case !0:
965
+ e.scrolling = Oo;
966
+ break;
967
+ case !1:
968
+ e.scrolling = fe;
969
+ break;
970
+ default:
971
+ e.scrolling = i[t]?.scrolling || fe;
972
+ }
973
+ }
974
+ function Mo(e, t, n) {
975
+ Eo(t, n), u(e, `src: %c${t.srcdoc || t.src}`, l), Cn(e), Io(t), Qn(e), fo(e, Xn(e)), Vn(e), u(e, "Setup complete");
976
+ }
977
+ function $o(e, t) {
978
+ const { id: n } = e;
979
+ y(n, "setup"), Dn(n) && Mo(n, e, t), Ht(n);
980
+ }
981
+ function So(e, t) {
982
+ const n = k(t, "log"), o = X(t.log), r = n ? o ? !0 : t.log : _.log;
983
+ k(t, "logExpand") || (t.logExpand = n && o ? t.log === V : _.logExpand), xn(t), _t({
984
+ enabled: r,
985
+ expand: t.logExpand,
986
+ iframeId: e
987
+ }), o && !(t.log in wt) && Bt(
988
+ e,
989
+ `Invalid value for options.log: Accepted values are "${V}" and "${Y}"`
990
+ ), t.log = r;
991
+ }
992
+ function ko(e) {
993
+ if (!Te(e)) throw new TypeError("Options is not an object");
994
+ return Hn(), Xt(e), (t) => {
995
+ const n = Yt(t, e);
996
+ return pe in t ? (y(n, "alreadySetup"), M(n, `Ignored iframe (${n}), already setup.`)) : (So(n, e), Re(n, $o)(t, e)), t?.iframeResizer;
997
+ };
998
+ }
999
+ export {
1000
+ ko as default
1001
+ };
1002
+ //# sourceMappingURL=index.esm.js.map