@iframe-resizer/core 5.5.8-beta.1 → 5.5.8-beta.2

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/README.md CHANGED
@@ -25,4 +25,4 @@ yarn add @iframe-resizer/core
25
25
 
26
26
  ---
27
27
 
28
- _iframe-resizer version 5.5.8-beta.1 2026-01-22 - 11:48:53.539Z_
28
+ _iframe-resizer version 5.5.8-beta.2 2026-01-23 - 11:49:46.192Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/core 5.5.8-beta.1 (cjs) - 2026-01-22
4
+ * @module iframe-resizer/core 5.5.8-beta.2 (cjs) - 2026-01-23
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- "use strict";const e=require("auto-console-group"),i="5.5.8-beta.1",t="iframeResizer",n=":",o="autoResize",r="init",s="iframeReady",a="load",l="message",c="onload",d="pageInfo",u="parentInfo",f="reset",p="resize",m="scroll",h="\n",g="child",y="parent",b="string",v="object",w="function",z="auto",H="none",I="both",$="vertical",T="horizontal",j="[iFrameSizer]",k=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),G=Object.freeze({[c]:1,[r]:1,[s]:1}),O="expanded",R="collapsed",x=Object.freeze({[O]:1,[R]:1}),L="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",M=(e,i,t,n)=>e.addEventListener(i,t,n||!1),S=(e,i,t)=>e.removeEventListener(i,t,!1),E=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},C=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),N=["spjluzl","rlf","clyzpvu"],W=["<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."],A=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],F=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,i)=>[e,Math.max(0,i-1)])),D=e=>C(W[e]),P=e=>{const i=e[C(N[0])]||e[C(N[1])]||e[C(N[2])];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=E(C(e));return t in F&&(i=F[t]),i}(t[0]);return 0===n||(e=>e[2]===E(e[0]+e[1]))(t)||(n=-2),n},B=Object.hasOwn||((e,i)=>Object.prototype.hasOwnProperty.call(e,i)),q={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},U=Object.keys(q),J=new RegExp(`<(${U.join("|")})>`,"gi"),V=(e,i)=>q[i]??"",Z=e=>i=>e(typeof i===b?window.chrome?i.replace(J,V):(e=>e.replaceAll("<br>",h).replaceAll(/<\/?[^>]+>/gi,""))(i):i),X={},Y=(_=e,_?.__esModule?_.default:_);var _;let K=!0;const Q=Y({expand:!1,label:y}),ee=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const ie=e=>(i,...t)=>X[i]?X[i].console[e](...t):Q[e](...t),te=e=>(i,...t)=>!0===(e=>X[e]?X[e].log:K)(i)?ie(e)(i,...t):null,ne=te("log"),oe=ne,re=te("debug"),se=ie("warn"),ae=ie("error"),le=ie("event"),ce=ie("purge"),de=ie("endAutoGroup"),ue=ie("errorBoundary");const fe=Z(e=>e),pe=(e,...i)=>X[e]?X[e].console.warn(...i.map(fe)):queueMicrotask(()=>{const n=Z((e=>(...i)=>[`${t}(${e})`,...i].join(" "))(e));console?.warn(...i.map(n))}),me=(e=>(i,t="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${i}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${i.toLowerCase()} has been ${t} <b>${o}</>. ${r}Use of the old ${i.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(pe),he=me("Option");function ge(e,i){const{checkOrigin:t,iframe:{src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:s}=i[e],a=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);le(e,"noResponse"),pe(e,`<rb>No response from iframe</>\n\nThe iframe (<i>${e}</>) has not responded within ${i[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&a?`\nThe <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.\n`:""}${s&&!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===v&&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 ye={};const be=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:$,firstRun:!0,inPageLinks:!1,heightCalculationMethod:z,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:z,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof X[e.id].onInit===w&&(he("init()","onReady()","",e.id),X[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),ve={position:null,version:i};function we(t){function s(){Ge(F),je(B),E("onResized",F)}function c(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function h(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const g=e=>W.slice(W.indexOf(n)+7+e);const v=(e,i)=>(t,n)=>{const o={};var r,s;r=function(){Re(`${t} (${e})`,`${e}:${i()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame(()=>{o[s]=null}))},w=(e,i)=>()=>{let t=!1;const n=i=>()=>{X[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame(()=>{t=!1})):l()},o=n(m),r=n("resize window");function s(e,t){ne(c,`${e}listeners for send${i}`),t(window,m,o),t(window,p,r)}function l(){le(c,`stop${i}`),s("Remove ",S),d.disconnect(),u.disconnect(),S(X[c].iframe,a,l)}const c=B,d=new ResizeObserver(n("pageObserver")),u=new ResizeObserver(n("iframeObserver"));X[c]&&(X[c][`stop${i}`]=l,M(X[c].iframe,a,l),s("Add ",M),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(X[c].iframe,{attributes:!0,childList:!1,subtree:!1}))},z=e=>()=>{e in X[B]&&(X[B][e](),delete X[B][e])},H=v(d,function(){const e=document.body.getBoundingClientRect(),i=F.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})}),I=v(u,function(){const{iframe:e}=F,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})}),$=w(H,"PageInfo"),T=w(I,"ParentInfo"),k=z("stopPageInfo"),G=z("stopParentInfo");function O(e){const i=e.getBoundingClientRect();return $e(B),{x:Number(i.left)+Number(ve.position.x),y:Number(i.top)+Number(ve.position.y)}}function R(i){const t=i?O(F.iframe):{x:0,y:0};oe(B,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT);const n=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(F,t),o=window.parentIframe||window.parentIFrame;o?function(e,t){setTimeout(()=>e["scrollTo"+(i?"Offset":"")](t.x,t.y))}(o,n):function(e){ve.position=e,x(B)}(n)}function x(e){const{x:i,y:t}=ve.position,n=X[e]?.iframe;!1!==E("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?je(e):Te()}function L(e){let i={};if(0===F.width&&0===F.height){const e=g(9).split(n);i={x:e[1],y:e[0]}}else i={x:F.width,y:F.height};E(e,{iframe:F.iframe,screenX:Number(i.x),screenY:Number(i.y),type:F.type})}const E=(e,i)=>ze(B,e,i);function C(){const{height:t,iframe:n,msg:a,type:c,width:p}=F;switch(X[B]?.firstRun&&function(){if(!X[B])return;ne(B,`First run for ${B}`),Se(B,F.mode),X[B].firstRun=!1}(),c){case"close":Ie(n);break;case l:h=g(6),ne(B,`onMessage passed: {iframe: %c${F.iframe.id}%c, message: %c${h}%c}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND),E("onMessage",{iframe:F.iframe,message:JSON.parse(h)});break;case"mouseenter":L("onMouseEnter");break;case"mouseleave":L("onMouseLeave");break;case"beforeUnload":oe(B,"Ready state reset"),X[B].initialised=!1;break;case o:X[B].autoResize=JSON.parse(g(9));break;case"scrollBy":!function(){const i=F.width,t=F.height,n=window.parentIframe||window.parentIFrame||window;oe(B,`scrollBy: x: %c${i}%c y: %c${t}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),n.scrollBy(i,t)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case d:$();break;case u:T();break;case"pageInfoStop":k();break;case"parentInfoStop":G();break;case"inPageLink":!function(i){const t=i.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const i=O(o);oe(B,`Moving to in page link: %c#${t}`,e.HIGHLIGHT),ve.position={x:i.x,y:i.y},x(B),window.location.hash=t}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):ne(B,`In page link #${t} not found`)}():ne(B,`In page link #${t} not found`)}(g(9));break;case"title":!function(i,t){X[t]?.syncTitle&&(X[t].iframe.title=i,oe(t,`Set iframe title attribute: %c${i}`,e.HIGHLIGHT))}(a,B);break;case f:ke(F);break;case r:s(),function(i){try{X[i].sameOrigin=!!X[i]?.iframe?.contentWindow?.iframeChildListener}catch(e){X[i].sameOrigin=!1}ne(i,`sameOrigin: %c${X[i].sameOrigin}`,e.HIGHLIGHT)}(B),(m=a)!==i&&(void 0!==m?ne(B,`Version mismatch (Child: %c${m}%c !== Parent: %c${i})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT):pe(B,"<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")),X[B].initialised=!0,E("onReady",n);break;default:if(0===p&&0===t)return void se(B,`Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===p||0===t)return void ne(B,"Ignoring message with 0 height or width");if(document.hidden)return void ne(B,"Page hidden - ignored resize request");s()}var m,h}function N(e){if(!X[e])throw new Error(`${F.type} No settings for ${e}. Message was: ${W}`)}let W=t.data;if("[iFrameResizerChild]Ready"===W)return A=t.source,void Object.values(X).forEach((e=>({initChild:i,postMessageTarget:t})=>{e===t&&i()})(A));var A;if(!(e=>j===`${e}`.slice(0,13)&&e.slice(13).split(n)[0]in X)(W)){if(typeof W!==b)return;return le(y,"ignoredMessage"),void re(y,W)}const F=function(e){const i=e.slice(13).split(n),t=i[1]?Number(i[1]):0,o=X[i[0]]?.iframe,r=getComputedStyle(o),s={iframe:o,id:i[0],height:t+c(r)+h(r),width:Number(i[2]),type:i[3],msg:i[4]};return i[5]&&(s.mode=i[5]),s}(W),{id:D,type:P}=F,B=D;B?(le(B,P),ue(B,function(i){N(B),function(){const e=F.type in{true:1,false:1,undefined:1};return e&&ne(B,"Ignoring init message from meta parent page"),e}()||(ne(B,`Received: %c${i}`,e.HIGHLIGHT),(null!==F.iframe||(se(B,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:i,sameOrigin:n}=t;if(n)return!0;let o=X[B]?.checkOrigin;if(o&&"null"!=`${i}`&&!(o.constructor===Array?function(){let t=0,n=!1;for(ne(B,`Checking connection is from allowed list of origins: %c${o}`,e.HIGHLIGHT);t<o.length;t++)if(o[t]===i){n=!0;break}return n}():function(){const t=X[B]?.remoteHost;return ne(B,`Checking connection is from: %c${t}`,e.HIGHLIGHT),i===t}()))throw new Error(`Unexpected message received from: ${i} for ${F.iframe.id}. Message was: ${t.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&C())})(W)):se("","iframeResizer received messageData without id, message was: ",W)}function ze(e,i,t){let n=null,o=null;if(X[e]){if(n=X[e][i],typeof n!==w)throw new TypeError(`${i} on iFrame[${e}] is not a function`);if("onBeforeClose"===i||"onScroll"===i)try{o=n(t)}catch(t){console.error(t),se(e,`Error in ${i} callback`)}else((e,...i)=>{setTimeout(()=>e(...i),0)})(n,t)}return o}function He(e){const{id:i}=e;ne(i,"Disconnected from iframe"),delete X[i],delete e.iframeResizer}function Ie(i){const{id:t}=i;if(!1!==ze(t,"onBeforeClose",t)){ne(t,`Removing iFrame: %c${t}`,e.HIGHLIGHT);try{i.parentNode&&i.remove()}catch(e){se(t,e)}ze(t,"onAfterClose",t),He(i)}else ne(t,"Close iframe cancelled by onBeforeClose")}function $e(i){null===ve.position&&(ve.position={x:window.scrollX,y:window.scrollY},ne(i,`Get page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT))}function Te(){ve.position=null}function je(i){null!==ve.position&&(window.scrollTo(ve.position.x,ve.position.y),oe(i,`Set page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Te())}function ke(e){ne(e.id,"Size reset requested by "+(e.type===r?"parent page":"child page")),$e(e.id),Ge(e),Re(f,f,e.id)}function Ge(i){function t(t){const o=`${i[t]}px`;i.iframe.style[t]=o,oe(n,`Set ${t}: %c${o}`,e.HIGHLIGHT)}const{id:n}=i,{sizeHeight:o,sizeWidth:r}=X[n];o&&t("height"),r&&t("width")}const Oe=e=>e.split(n).filter((e,i)=>19!==i).join(n);function Re(i,t,n){function o(o){const r=i in G?Oe(t):t;oe(n,o,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),oe(n,`Message data: %c${r}`,e.HIGHLIGHT)}le(n,i),X[n]&&(X[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:r,sameOrigin:s,targetOrigin:a}=X[n];if(s)try{return e.contentWindow.iframeChildListener(j+t),void o(`Sending message to iframe %c${n}%c via same origin%c`)}catch(e){i in G?(X[n].sameOrigin=!1,ne(n,"New iframe does not support same origin")):se(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`),r.postMessage(j+t,a)}():se(n,`Iframe(${n}) not found`))}let xe=0,Le=!1,Me=!1;function Se(t,n=-3){if(Le)return;const o=Math.max(X[t].mode,n);if(o>X[t].mode&&(X[t].mode=o),o<0)throw ce(t),X[t].vAdvised||pe(t||"Parent",`${D(o+2)}${D(2)}`),X[t].vAdvised=!0,D(o+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");o>0&&Me||function(i,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${i}`,K||t<1?"font-weight: bold;":e.NORMAL))}(`v${i} (${(e=>C(A[e]))(o)})`,o),o<1&&pe("Parent",D(3)),Le=!0}function Ee(){!0!==document.hidden&&((e,i)=>{Object.values(X).filter(({autoResize:e,firstRun:i})=>e&&!i).forEach(({iframe:t})=>Re(e,i,t.id))})("tabVisible",p)}const Ce=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})(()=>{M(window,l,we),M(document,"visibilitychange",Ee),window.iframeParentListener=e=>setTimeout(()=>we({data:e,sameOrigin:!0}))});module.exports=i=>d=>{function u(){X[C]?.heightCalculationMethod in k&&ke({iframe:d,height:1,width:1,type:r})}function f(){if(X[C]){const{iframe:e}=X[C],i={close:Ie.bind(null,e),disconnect:He.bind(null,e),removeListeners(){pe(C,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${L}\n`),this.disconnect()},resize(){pe(C,"<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",p,C)},moveToAnchor(e){((e,i,t)=>{if(typeof e!==i)throw new TypeError(`${t} is not a ${n=i,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,b,"moveToAnchor(anchor) anchor"),Re("Move to anchor",`moveToAnchor:${e}`,C)},sendMessage(e){e=JSON.stringify(e),Re(l,`${l}:${e}`,C)}};e.iframeResizer=i,e.iFrameResizer=i}}function m(e,i){const t=t=>()=>{if(!X[e])return;const{firstRun:n,iframe:o}=X[e];Re(t,i,e),(e=>e===r)(t)&&(e=>"lazy"===e.loading)(o)||function(e,i){const{msgTimeout:t,warningTimeout:n}=i[e];n&&(t&&clearTimeout(t),i[e].msgTimeout=setTimeout(function(){if(void 0===i[e])return;const{initialised:t,loadErrorShown:n}=i[e];i[e].msgTimeout=void 0,t?i[e].initialisedFirstPage=!0:n||(i[e].loadErrorShown=!0,ge(e,i))},n))}(e,X),n||u()},{iframe:n}=X[e];X[e].initChild=t(s),function(e,i){M(e,a,()=>setTimeout(i,1))}(n,t(c)),function(e,i){const{iframe:t,waitForLoad:n}=X[e];!0!==n&&((e=>{const{src:i,srcdoc:t}=e;return!t&&(null==i||""===i||"about:blank"===i)})(t)?setTimeout(()=>{le(e,"noContent"),oe(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(i))}(e,t(r))}function y(e){return e?(("sizeWidth"in e||"sizeHeight"in e||o in e)&&pe(C,`<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>${$}</>, <bb>${T}</>, <bb>${I}</> or <bb>${H}</>.\n`),e):{}}function w(e){const i=X[e]?.iframe?.title;return""===i||void 0===i}function j(e,i){B(X[C],e)&&(pe(C,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${i}</>. ${L}`),X[C][i]=X[C][e],delete X[C][e])}const G=e=>B(e,"onMouseEnter")||B(e,"onMouseLeave");function S(i){var t,n;X[C]={...X[C],iframe:d,remoteHost:d?.src.split("/").slice(0,3).join("/"),...be,...y(i),mouseEvents:G(i),mode:P(i),syncTitle:w(C)},j("offset","offsetSize"),j("onClose","onBeforeClose"),j("onClosed","onAfterClose"),le(C,"setup"),function(){const{direction:i}=X[C];switch(i){case $:break;case T:X[C].sizeHeight=!1;case I:X[C].sizeWidth=!0;break;case H:X[C].sizeWidth=!1,X[C].sizeHeight=!1,X[C].autoResize=!1;break;default:throw new TypeError(C,`Direction value of "${i}" is not valid`)}ne(C,`direction: %c${i}`,e.HIGHLIGHT)}(),(t=i?.offsetSize||i?.offset)&&(X[C].direction===$?(X[C].offsetHeight=t,ne(C,`Offset height: %c${t}`,e.HIGHLIGHT)):(X[C].offsetWidth=t,ne(C,`Offset width: %c${t}`,e.HIGHLIGHT))),X[C].warningTimeout||oe(C,"warningTimeout:%c disabled",e.HIGHLIGHT),null===X[C].postMessageTarget&&(X[C].postMessageTarget=d.contentWindow),X[C].targetOrigin=!0===X[C].checkOrigin?""===(n=X[C].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*"}const E=()=>t in d,C=function(e){if(e&&typeof e!==b)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=i?.id||be.id+xe++;return null!==document.getElementById(e)&&(e+=xe++),e}(),d.id=e,le(e,"assignId"),ne(e,`Added missing iframe ID: ${e} (${d.src})`)),e}(d.id);if(typeof i!==v)throw new TypeError("Options is not an object");return function(e){const{search:i}=window.location;i.includes("ifrlog")&&(e.log=R,e.logExpand=i.includes("ifrlog=expanded"))}(i),function(e,i){const t=B(i,"log"),n=typeof i.log===b,o=t?!!n||i.log:be.log;B(i,"logExpand")||(i.logExpand=t&&n?i.log===O:be.logExpand),function(e){-1===e?.log&&(e.log=!1,Me=!0)}(i),function({enabled:e,expand:i,iframeId:t}){const n=Y({expand:i,label:ee(t)});K=e,X[t]||(X[t]={console:n})}({enabled:o,expand:i.logExpand,iframeId:e}),n&&!(i.log in x)&&ae(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),i.log=o}(C,i),ue(C,function(i){E()?se(C,`Ignored iframe (${C}), already setup.`):(S(i),function(e){if(!0===ye[e])return!1;const i=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(i.length<=1)return!0;ye[e]=!0;const t=Array.from(i).flatMap(e=>[h,e,h]);pe(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>${i.length}</> iframes with the <b>${e}</> ID:`,...t,h)}(C),ne(C,`src: %c${d.srcdoc||d.src}`,e.HIGHLIGHT),function(){if(Le)return;const{mode:e}=X[C];-1!==e&&Se(C,e)}(),Ce(),function(){switch(ne(C,`Iframe scrolling ${X[C]?.scrolling?"enabled":"disabled"} for ${C}`),d.style.overflow=!1===X[C]?.scrolling?"hidden":z,X[C]?.scrolling){case"omit":break;case!0:d.scrolling="yes";break;case!1:d.scrolling="no";break;default:d.scrolling=X[C]?X[C].scrolling:"no"}}(),function(){const{bodyMargin:e}=X[C];"number"!=typeof e&&"0"!==e||(X[C].bodyMargin=`${e}px`)}(),m(C,function(e){const{autoResize:i,bodyBackground:t,bodyMargin:o,bodyPadding:r,heightCalculationMethod:s,inPageLinks:a,license:l,log:c,logExpand:d,mouseEvents:u,offsetHeight:f,offsetWidth:p,mode:m,sizeHeight:h,sizeWidth:y,tolerance:b,widthCalculationMethod:v}=X[e];return[e,"8",y,c,"32",!0,i,o,s,t,r,b,a,g,v,u,f,p,h,l,ve.version,m,"",d].join(n)}(C)),f(),ne(C,"Setup complete"),de(C))})(i),d?.iframeResizer};
20
+ "use strict";const e=require("auto-console-group"),i="5.5.8-beta.2",t="iframeResizer",n=":",o="autoResize",r="init",s="iframeReady",a="load",l="message",c="onload",d="pageInfo",u="parentInfo",f="reset",p="resize",m="scroll",h="\n",g="child",y="parent",b="string",v="object",w="function",z="auto",H="none",I="both",$="vertical",T="horizontal",j="[iFrameSizer]",k=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),G=Object.freeze({[c]:1,[r]:1,[s]:1}),O="expanded",R="collapsed",x=Object.freeze({[O]:1,[R]:1}),L="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",M=(e,i,t,n)=>e.addEventListener(i,t,n||!1),S=(e,i,t)=>e.removeEventListener(i,t,!1),E=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},C=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),N=["spjluzl","rlf","clyzpvu"],W=["<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."],A=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],F=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,i)=>[e,Math.max(0,i-1)])),D=e=>C(W[e]),P=e=>{const i=e[C(N[0])]||e[C(N[1])]||e[C(N[2])];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=E(C(e));return t in F&&(i=F[t]),i}(t[0]);return 0===n||(e=>e[2]===E(e[0]+e[1]))(t)||(n=-2),n},B=Object.hasOwn||((e,i)=>Object.prototype.hasOwnProperty.call(e,i)),q={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},U=Object.keys(q),J=new RegExp(`<(${U.join("|")})>`,"gi"),V=(e,i)=>q[i]??"",Z=e=>i=>e(typeof i===b?window.chrome?i.replace(J,V):(e=>e.replaceAll("<br>",h).replaceAll(/<\/?[^>]+>/gi,""))(i):i),X={},Y=(_=e,_?.__esModule?_.default:_);var _;let K=!0;const Q=Y({expand:!1,label:y}),ee=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const ie=e=>(i,...t)=>X[i]?X[i].console[e](...t):Q[e](...t),te=e=>(i,...t)=>!0===(e=>X[e]?X[e].log:K)(i)?ie(e)(i,...t):null,ne=te("log"),oe=ne,re=te("debug"),se=ie("warn"),ae=ie("error"),le=ie("event"),ce=ie("purge"),de=ie("endAutoGroup"),ue=ie("errorBoundary");const fe=Z(e=>e),pe=(e,...i)=>X[e]?X[e].console.warn(...i.map(fe)):queueMicrotask(()=>{const n=Z((e=>(...i)=>[`${t}(${e})`,...i].join(" "))(e));console?.warn(...i.map(n))}),me=(e=>(i,t="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${i}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${i.toLowerCase()} has been ${t} <b>${o}</>. ${r}Use of the old ${i.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(pe),he=me("Option");function ge(e,i){const{checkOrigin:t,iframe:{src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:s}=i[e],a=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);le(e,"noResponse"),pe(e,`<rb>No response from iframe</>\n\nThe iframe (<i>${e}</>) has not responded within ${i[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&a?`\nThe <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.\n`:""}${s&&!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===v&&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 ye={};const be=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:$,firstRun:!0,inPageLinks:!1,heightCalculationMethod:z,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:z,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof X[e.id].onInit===w&&(he("init()","onReady()","",e.id),X[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),ve={position:null,version:i};function we(t){function s(){Ge(F),je(B),E("onResized",F)}function c(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function h(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const g=e=>W.slice(W.indexOf(n)+7+e);const v=(e,i)=>(t,n)=>{const o={};var r,s;r=function(){Re(`${t} (${e})`,`${e}:${i()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame(()=>{o[s]=null}))},w=(e,i)=>()=>{let t=!1;const n=i=>()=>{X[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame(()=>{t=!1})):l()},o=n(m),r=n("resize window");function s(e,t){ne(c,`${e}listeners for send${i}`),t(window,m,o),t(window,p,r)}function l(){le(c,`stop${i}`),s("Remove ",S),d.disconnect(),u.disconnect(),S(X[c].iframe,a,l)}const c=B,d=new ResizeObserver(n("pageObserver")),u=new ResizeObserver(n("iframeObserver"));X[c]&&(X[c][`stop${i}`]=l,M(X[c].iframe,a,l),s("Add ",M),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(X[c].iframe,{attributes:!0,childList:!1,subtree:!1}))},z=e=>()=>{e in X[B]&&(X[B][e](),delete X[B][e])},H=v(d,function(){const e=document.body.getBoundingClientRect(),i=F.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})}),I=v(u,function(){const{iframe:e}=F,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})}),$=w(H,"PageInfo"),T=w(I,"ParentInfo"),k=z("stopPageInfo"),G=z("stopParentInfo");function O(e){const i=e.getBoundingClientRect();return $e(B),{x:Number(i.left)+Number(ve.position.x),y:Number(i.top)+Number(ve.position.y)}}function R(i){const t=i?O(F.iframe):{x:0,y:0};oe(B,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT);const n=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(F,t),o=window.parentIframe||window.parentIFrame;o?function(e,t){setTimeout(()=>e["scrollTo"+(i?"Offset":"")](t.x,t.y))}(o,n):function(e){ve.position=e,x(B)}(n)}function x(e){const{x:i,y:t}=ve.position,n=X[e]?.iframe;!1!==E("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?je(e):Te()}function L(e){let i={};if(0===F.width&&0===F.height){const e=g(9).split(n);i={x:e[1],y:e[0]}}else i={x:F.width,y:F.height};E(e,{iframe:F.iframe,screenX:Number(i.x),screenY:Number(i.y),type:F.type})}const E=(e,i)=>ze(B,e,i);function C(){const{height:t,iframe:n,msg:a,type:c,width:p}=F;switch(X[B]?.firstRun&&function(){if(!X[B])return;ne(B,`First run for ${B}`),Se(B,F.mode),X[B].firstRun=!1}(),c){case"close":Ie(n);break;case l:h=g(6),ne(B,`onMessage passed: {iframe: %c${F.iframe.id}%c, message: %c${h}%c}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND),E("onMessage",{iframe:F.iframe,message:JSON.parse(h)});break;case"mouseenter":L("onMouseEnter");break;case"mouseleave":L("onMouseLeave");break;case"beforeUnload":oe(B,"Ready state reset"),X[B].initialised=!1;break;case o:X[B].autoResize=JSON.parse(g(9));break;case"scrollBy":!function(){const i=F.width,t=F.height,n=window.parentIframe||window.parentIFrame||window;oe(B,`scrollBy: x: %c${i}%c y: %c${t}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),n.scrollBy(i,t)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case d:$();break;case u:T();break;case"pageInfoStop":k();break;case"parentInfoStop":G();break;case"inPageLink":!function(i){const t=i.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const i=O(o);oe(B,`Moving to in page link: %c#${t}`,e.HIGHLIGHT),ve.position={x:i.x,y:i.y},x(B),window.location.hash=t}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):ne(B,`In page link #${t} not found`)}():ne(B,`In page link #${t} not found`)}(g(9));break;case"title":!function(i,t){X[t]?.syncTitle&&(X[t].iframe.title=i,oe(t,`Set iframe title attribute: %c${i}`,e.HIGHLIGHT))}(a,B);break;case f:ke(F);break;case r:s(),function(i){try{X[i].sameOrigin=!!X[i]?.iframe?.contentWindow?.iframeChildListener}catch(e){X[i].sameOrigin=!1}ne(i,`sameOrigin: %c${X[i].sameOrigin}`,e.HIGHLIGHT)}(B),(m=a)!==i&&(void 0!==m?ne(B,`Version mismatch (Child: %c${m}%c !== Parent: %c${i})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT):pe(B,"<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")),X[B].initialised=!0,E("onReady",n);break;default:if(0===p&&0===t)return void se(B,`Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===p||0===t)return void ne(B,"Ignoring message with 0 height or width");if(document.hidden)return void ne(B,"Page hidden - ignored resize request");s()}var m,h}function N(e){if(!X[e])throw new Error(`${F.type} No settings for ${e}. Message was: ${W}`)}let W=t.data;if("[iFrameResizerChild]Ready"===W)return A=t.source,void Object.values(X).forEach((e=>({initChild:i,postMessageTarget:t})=>{e===t&&i()})(A));var A;if(!(e=>j===`${e}`.slice(0,13)&&e.slice(13).split(n)[0]in X)(W)){if(typeof W!==b)return;return le(y,"ignoredMessage"),void re(y,W)}const F=function(e){const i=e.slice(13).split(n),t=i[1]?Number(i[1]):0,o=X[i[0]]?.iframe,r=getComputedStyle(o),s={iframe:o,id:i[0],height:t+c(r)+h(r),width:Number(i[2]),type:i[3],msg:i[4]};return i[5]&&(s.mode=i[5]),s}(W),{id:D,type:P}=F,B=D;B?(le(B,P),ue(B,function(i){N(B),function(){const e=F.type in{true:1,false:1,undefined:1};return e&&ne(B,"Ignoring init message from meta parent page"),e}()||(ne(B,`Received: %c${i}`,e.HIGHLIGHT),(null!==F.iframe||(se(B,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:i,sameOrigin:n}=t;if(n)return!0;let o=X[B]?.checkOrigin;if(o&&"null"!=`${i}`&&!(o.constructor===Array?function(){let t=0,n=!1;for(ne(B,`Checking connection is from allowed list of origins: %c${o}`,e.HIGHLIGHT);t<o.length;t++)if(o[t]===i){n=!0;break}return n}():function(){const t=X[B]?.remoteHost;return ne(B,`Checking connection is from: %c${t}`,e.HIGHLIGHT),i===t}()))throw new Error(`Unexpected message received from: ${i} for ${F.iframe.id}. Message was: ${t.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&C())})(W)):se("","iframeResizer received messageData without id, message was: ",W)}function ze(e,i,t){let n=null,o=null;if(X[e]){if(n=X[e][i],typeof n!==w)throw new TypeError(`${i} on iFrame[${e}] is not a function`);if("onBeforeClose"===i||"onScroll"===i)try{o=n(t)}catch(t){console.error(t),se(e,`Error in ${i} callback`)}else((e,...i)=>{setTimeout(()=>e(...i),0)})(n,t)}return o}function He(e){const{id:i}=e;ne(i,"Disconnected from iframe"),delete X[i],delete e.iframeResizer}function Ie(i){const{id:t}=i;if(!1!==ze(t,"onBeforeClose",t)){ne(t,`Removing iFrame: %c${t}`,e.HIGHLIGHT);try{i.parentNode&&i.remove()}catch(e){se(t,e)}ze(t,"onAfterClose",t),He(i)}else ne(t,"Close iframe cancelled by onBeforeClose")}function $e(i){null===ve.position&&(ve.position={x:window.scrollX,y:window.scrollY},ne(i,`Get page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT))}function Te(){ve.position=null}function je(i){null!==ve.position&&(window.scrollTo(ve.position.x,ve.position.y),oe(i,`Set page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Te())}function ke(e){ne(e.id,"Size reset requested by "+(e.type===r?"parent page":"child page")),$e(e.id),Ge(e),Re(f,f,e.id)}function Ge(i){function t(t){const o=`${i[t]}px`;i.iframe.style[t]=o,oe(n,`Set ${t}: %c${o}`,e.HIGHLIGHT)}const{id:n}=i,{sizeHeight:o,sizeWidth:r}=X[n];o&&t("height"),r&&t("width")}const Oe=e=>e.split(n).filter((e,i)=>19!==i).join(n);function Re(i,t,n){function o(o){const r=i in G?Oe(t):t;oe(n,o,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),oe(n,`Message data: %c${r}`,e.HIGHLIGHT)}le(n,i),X[n]&&(X[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:r,sameOrigin:s,targetOrigin:a}=X[n];if(s)try{return e.contentWindow.iframeChildListener(j+t),void o(`Sending message to iframe %c${n}%c via same origin%c`)}catch(e){i in G?(X[n].sameOrigin=!1,ne(n,"New iframe does not support same origin")):se(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`),r.postMessage(j+t,a)}():se(n,`Iframe(${n}) not found`))}let xe=0,Le=!1,Me=!1;function Se(t,n=-3){if(Le)return;const o=Math.max(X[t].mode,n);if(o>X[t].mode&&(X[t].mode=o),o<0)throw ce(t),X[t].vAdvised||pe(t||"Parent",`${D(o+2)}${D(2)}`),X[t].vAdvised=!0,D(o+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");o>0&&Me||function(i,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${i}`,K||t<1?"font-weight: bold;":e.NORMAL))}(`v${i} (${(e=>C(A[e]))(o)})`,o),o<1&&pe("Parent",D(3)),Le=!0}function Ee(){!0!==document.hidden&&((e,i)=>{Object.values(X).filter(({autoResize:e,firstRun:i})=>e&&!i).forEach(({iframe:t})=>Re(e,i,t.id))})("tabVisible",p)}const Ce=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})(()=>{M(window,l,we),M(document,"visibilitychange",Ee),window.iframeParentListener=e=>setTimeout(()=>we({data:e,sameOrigin:!0}))});module.exports=i=>d=>{function u(){X[C]?.heightCalculationMethod in k&&ke({iframe:d,height:1,width:1,type:r})}function f(){if(X[C]){const{iframe:e}=X[C],i={close:Ie.bind(null,e),disconnect:He.bind(null,e),removeListeners(){pe(C,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${L}\n`),this.disconnect()},resize(){pe(C,"<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",p,C)},moveToAnchor(e){((e,i,t)=>{if(typeof e!==i)throw new TypeError(`${t} is not a ${n=i,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,b,"moveToAnchor(anchor) anchor"),Re("Move to anchor",`moveToAnchor:${e}`,C)},sendMessage(e){e=JSON.stringify(e),Re(l,`${l}:${e}`,C)}};e.iframeResizer=i,e.iFrameResizer=i}}function m(e,i){const t=t=>()=>{if(!X[e])return;const{firstRun:n,iframe:o}=X[e];Re(t,i,e),(e=>e===r)(t)&&(e=>"lazy"===e.loading)(o)||function(e,i){const{msgTimeout:t,warningTimeout:n}=i[e];n&&(t&&clearTimeout(t),i[e].msgTimeout=setTimeout(function(){if(void 0===i[e])return;const{initialised:t,loadErrorShown:n}=i[e];i[e].msgTimeout=void 0,t?i[e].initialisedFirstPage=!0:n||(i[e].loadErrorShown=!0,ge(e,i))},n))}(e,X),n||u()},{iframe:n}=X[e];X[e].initChild=t(s),function(e,i){M(e,a,()=>setTimeout(i,1))}(n,t(c)),function(e,i){const{iframe:t,waitForLoad:n}=X[e];!0!==n&&((e=>{const{src:i,srcdoc:t}=e;return!t&&(null==i||""===i||"about:blank"===i)})(t)?setTimeout(()=>{le(e,"noContent"),oe(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(i))}(e,t(r))}function y(e){return e?(("sizeWidth"in e||"sizeHeight"in e||o in e)&&pe(C,`<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>${$}</>, <bb>${T}</>, <bb>${I}</> or <bb>${H}</>.\n`),e):{}}function w(e){const i=X[e]?.iframe?.title;return""===i||void 0===i}function j(e,i){B(X[C],e)&&(pe(C,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${i}</>. ${L}`),X[C][i]=X[C][e],delete X[C][e])}const G=e=>B(e,"onMouseEnter")||B(e,"onMouseLeave");function S(i){var t,n;X[C]={...X[C],iframe:d,remoteHost:d?.src.split("/").slice(0,3).join("/"),...be,...y(i),mouseEvents:G(i),mode:P(i),syncTitle:w(C)},j("offset","offsetSize"),j("onClose","onBeforeClose"),j("onClosed","onAfterClose"),le(C,"setup"),function(){const{direction:i}=X[C];switch(i){case $:break;case T:X[C].sizeHeight=!1;case I:X[C].sizeWidth=!0;break;case H:X[C].sizeWidth=!1,X[C].sizeHeight=!1,X[C].autoResize=!1;break;default:throw new TypeError(C,`Direction value of "${i}" is not valid`)}ne(C,`direction: %c${i}`,e.HIGHLIGHT)}(),(t=i?.offsetSize||i?.offset)&&(X[C].direction===$?(X[C].offsetHeight=t,ne(C,`Offset height: %c${t}`,e.HIGHLIGHT)):(X[C].offsetWidth=t,ne(C,`Offset width: %c${t}`,e.HIGHLIGHT))),X[C].warningTimeout||oe(C,"warningTimeout:%c disabled",e.HIGHLIGHT),null===X[C].postMessageTarget&&(X[C].postMessageTarget=d.contentWindow),X[C].targetOrigin=!0===X[C].checkOrigin?""===(n=X[C].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*"}const E=()=>t in d,C=function(e){if(e&&typeof e!==b)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=i?.id||be.id+xe++;return null!==document.getElementById(e)&&(e+=xe++),e}(),d.id=e,le(e,"assignId"),ne(e,`Added missing iframe ID: ${e} (${d.src})`)),e}(d.id);if(typeof i!==v)throw new TypeError("Options is not an object");return function(e){const{search:i}=window.location;i.includes("ifrlog")&&(e.log=R,e.logExpand=i.includes("ifrlog=expanded"))}(i),function(e,i){const t=B(i,"log"),n=typeof i.log===b,o=t?!!n||i.log:be.log;B(i,"logExpand")||(i.logExpand=t&&n?i.log===O:be.logExpand),function(e){-1===e?.log&&(e.log=!1,Me=!0)}(i),function({enabled:e,expand:i,iframeId:t}){const n=Y({expand:i,label:ee(t)});K=e,X[t]||(X[t]={console:n})}({enabled:o,expand:i.logExpand,iframeId:e}),n&&!(i.log in x)&&ae(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),i.log=o}(C,i),ue(C,function(i){E()?se(C,`Ignored iframe (${C}), already setup.`):(S(i),function(e){if(!0===ye[e])return!1;const i=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(i.length<=1)return!0;ye[e]=!0;const t=Array.from(i).flatMap(e=>[h,e,h]);pe(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>${i.length}</> iframes with the <b>${e}</> ID:`,...t,h)}(C),ne(C,`src: %c${d.srcdoc||d.src}`,e.HIGHLIGHT),function(){if(Le)return;const{mode:e}=X[C];-1!==e&&Se(C,e)}(),Ce(),function(){switch(ne(C,`Iframe scrolling ${X[C]?.scrolling?"enabled":"disabled"} for ${C}`),d.style.overflow=!1===X[C]?.scrolling?"hidden":z,X[C]?.scrolling){case"omit":break;case!0:d.scrolling="yes";break;case!1:d.scrolling="no";break;default:d.scrolling=X[C]?X[C].scrolling:"no"}}(),function(){const{bodyMargin:e}=X[C];"number"!=typeof e&&"0"!==e||(X[C].bodyMargin=`${e}px`)}(),m(C,function(e){const{autoResize:i,bodyBackground:t,bodyMargin:o,bodyPadding:r,heightCalculationMethod:s,inPageLinks:a,license:l,log:c,logExpand:d,mouseEvents:u,offsetHeight:f,offsetWidth:p,mode:m,sizeHeight:h,sizeWidth:y,tolerance:b,widthCalculationMethod:v}=X[e];return[e,"8",y,c,"32",!0,i,o,s,t,r,b,a,g,v,u,f,p,h,l,ve.version,m,"",d].join(n)}(C)),f(),ne(C,"Setup complete"),de(C))})(i),d?.iframeResizer};
21
21
  //# sourceMappingURL=index.cjs.js.map
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/core 5.5.8-beta.1 (esm) - 2026-01-22
4
+ * @module iframe-resizer/core 5.5.8-beta.2 (esm) - 2026-01-23
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- import e,{NORMAL as i,HIGHLIGHT as t,FOREGROUND as n}from"auto-console-group";const o="5.5.8-beta.1",r="iframeResizer",s=":",a="autoResize",l="init",c="iframeReady",d="load",u="message",f="onload",p="pageInfo",m="parentInfo",h="reset",g="resize",y="scroll",b="\n",v="child",w="parent",z="string",$="object",j="function",k="auto",T="none",x="both",M="vertical",I="horizontal",S="[iFrameSizer]",O=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),R=Object.freeze({[f]:1,[l]:1,[c]:1}),C="expanded",E="collapsed",W=Object.freeze({[C]:1,[E]:1}),A="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",L=(e,i,t,n)=>e.addEventListener(i,t,n||!1),N=(e,i,t)=>e.removeEventListener(i,t,!1),P=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>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"].map((e,i)=>[e,Math.max(0,i-1)])),U=e=>B(F[e]),J=e=>{const i=e[B(H[0])]||e[B(H[1])]||e[B(H[2])];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=P(B(e));return t in D&&(i=D[t]),i}(t[0]);return 0===n||(e=>e[2]===P(e[0]+e[1]))(t)||(n=-2),n},V=Object.hasOwn||((e,i)=>Object.prototype.hasOwnProperty.call(e,i)),Z={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},X=Object.keys(Z),Y=new RegExp(`<(${X.join("|")})>`,"gi"),G=(e,i)=>Z[i]??"",_=e=>i=>e(typeof i===z?window.chrome?i.replace(Y,G):(e=>e.replaceAll("<br>",b).replaceAll(/<\/?[^>]+>/gi,""))(i):i),K={},Q=(ee=e,ee?.__esModule?ee.default:ee);var ee;let ie=!0;const te=Q({expand:!1,label:w}),ne=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const oe=e=>(i,...t)=>K[i]?K[i].console[e](...t):te[e](...t),re=e=>(i,...t)=>!0===(e=>K[e]?K[e].log:ie)(i)?oe(e)(i,...t):null,se=re("log"),ae=se,le=re("debug"),ce=oe("warn"),de=oe("error"),ue=oe("event"),fe=oe("purge"),pe=oe("endAutoGroup"),me=oe("errorBoundary");const he=_(e=>e),ge=(e,...i)=>K[e]?K[e].console.warn(...i.map(he)):queueMicrotask(()=>{const t=_((e=>(...i)=>[`${r}(${e})`,...i].join(" "))(e));console?.warn(...i.map(t))}),ye=(e=>(i,t="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${i}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${i.toLowerCase()} has been ${t} <b>${o}</>. ${r}Use of the old ${i.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(ge),be=ye("Option");function ve(e,i){const{checkOrigin:t,iframe:{src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:s}=i[e],a=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);ue(e,"noResponse"),ge(e,`<rb>No response from iframe</>\n\nThe iframe (<i>${e}</>) has not responded within ${i[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&a?`\nThe <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.\n`:""}${s&&!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 we={};const ze=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&&(be("init()","onReady()","",e.id),K[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),$e={position:null,version:o};function je(e){function i(){Re(F),Se(U),W("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(s)+7+e);const b=(e,i)=>(t,n)=>{const o={};var r,s;r=function(){Ee(`${t} (${e})`,`${e}:${i()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame(()=>{o[s]=null}))},v=(e,i)=>()=>{let t=!1;const n=i=>()=>{K[l]?t&&t!==i||(e(i,l),t=i,requestAnimationFrame(()=>{t=!1})):a()},o=n(y),r=n("resize window");function s(e,t){se(l,`${e}listeners for send${i}`),t(window,y,o),t(window,g,r)}function a(){ue(l,`stop${i}`),s("Remove ",N),c.disconnect(),u.disconnect(),N(K[l].iframe,d,a)}const l=U,c=new ResizeObserver(n("pageObserver")),u=new ResizeObserver(n("iframeObserver"));K[l]&&(K[l][`stop${i}`]=a,L(K[l].iframe,d,a),s("Add ",L),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.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(),i=F.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})}),k=b(m,function(){const{iframe:e}=F,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})}),T=v(j,"PageInfo"),x=v(k,"ParentInfo"),M=$("stopPageInfo"),I=$("stopParentInfo");function O(e){const i=e.getBoundingClientRect();return Me(U),{x:Number(i.left)+Number($e.position.x),y:Number(i.top)+Number($e.position.y)}}function R(e){const i=e?O(F.iframe):{x:0,y:0};ae(U,`Reposition requested (offset x:%c${i.x}%c y:%c${i.y})`,t,n,t);const o=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(F,i),r=window.parentIframe||window.parentIFrame;r?function(i,t){setTimeout(()=>i["scrollTo"+(e?"Offset":"")](t.x,t.y))}(r,o):function(e){$e.position=e,C(U)}(o)}function C(e){const{x:i,y:t}=$e.position,n=K[e]?.iframe;!1!==W("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?Se(e):Ie()}function E(e){let i={};if(0===F.width&&0===F.height){const e=f(9).split(s);i={x:e[1],y:e[0]}}else i={x:F.width,y:F.height};W(e,{iframe:F.iframe,screenX:Number(i.x),screenY:Number(i.y),type:F.type})}const W=(e,i)=>ke(U,e,i);function A(){const{height:e,iframe:r,msg:s,type:c,width:d}=F;switch(K[U]?.firstRun&&function(){if(!K[U])return;se(U,`First run for ${U}`),Ne(U,F.mode),K[U].firstRun=!1}(),c){case"close":xe(r);break;case u:y=f(6),se(U,`onMessage passed: {iframe: %c${F.iframe.id}%c, message: %c${y}%c}`,t,n,t,n),W("onMessage",{iframe:F.iframe,message:JSON.parse(y)});break;case"mouseenter":E("onMouseEnter");break;case"mouseleave":E("onMouseLeave");break;case"beforeUnload":ae(U,"Ready state reset"),K[U].initialised=!1;break;case a:K[U].autoResize=JSON.parse(f(9));break;case"scrollBy":!function(){const e=F.width,i=F.height,o=window.parentIframe||window.parentIFrame||window;ae(U,`scrollBy: x: %c${e}%c y: %c${i}`,t,n,t),o.scrollBy(e,i)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case p:T();break;case m:x();break;case"pageInfoStop":M();break;case"parentInfoStop":I();break;case"inPageLink":!function(e){const i=e.split("#")[1]||"",n=decodeURIComponent(i);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const e=O(o);ae(U,`Moving to in page link: %c#${i}`,t),$e.position={x:e.x,y:e.y},C(U),window.location.hash=i}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(i):se(U,`In page link #${i} not found`)}():se(U,`In page link #${i} not found`)}(f(9));break;case"title":!function(e,i){K[i]?.syncTitle&&(K[i].iframe.title=e,ae(i,`Set iframe title attribute: %c${e}`,t))}(s,U);break;case h:Oe(F);break;case l:i(),function(e){try{K[e].sameOrigin=!!K[e]?.iframe?.contentWindow?.iframeChildListener}catch(i){K[e].sameOrigin=!1}se(e,`sameOrigin: %c${K[e].sameOrigin}`,t)}(U),(g=s)!==o&&(void 0!==g?se(U,`Version mismatch (Child: %c${g}%c !== Parent: %c${o})`,t,n,t):ge(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,W("onReady",r);break;default:if(0===d&&0===e)return void ce(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===d||0===e)return void se(U,"Ignoring message with 0 height or width");if(document.hidden)return void se(U,"Page hidden - ignored resize request");i()}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:i,postMessageTarget:t})=>{e===t&&i()})(H));var H;if(!(e=>S===`${e}`.slice(0,13)&&e.slice(13).split(s)[0]in K)(B)){if(typeof B!==z)return;return ue(w,"ignoredMessage"),void le(w,B)}const F=function(e){const i=e.slice(13).split(s),t=i[1]?Number(i[1]):0,n=K[i[0]]?.iframe,o=getComputedStyle(n),a={iframe:n,id:i[0],height:t+r(o)+c(o),width:Number(i[2]),type:i[3],msg:i[4]};return i[5]&&(a.mode=i[5]),a}(B),{id:q,type:D}=F,U=q;U?(ue(U,D),me(U,function(i){P(U),function(){const e=F.type in{true:1,false:1,undefined:1};return e&&se(U,"Ignoring init message from meta parent page"),e}()||(se(U,`Received: %c${i}`,t),(null!==F.iframe||(ce(U,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:i,sameOrigin:n}=e;if(n)return!0;let o=K[U]?.checkOrigin;if(o&&"null"!=`${i}`&&!(o.constructor===Array?function(){let e=0,n=!1;for(se(U,`Checking connection is from allowed list of origins: %c${o}`,t);e<o.length;e++)if(o[e]===i){n=!0;break}return n}():function(){const e=K[U]?.remoteHost;return se(U,`Checking connection is from: %c${e}`,t),i===e}()))throw new Error(`Unexpected message received from: ${i} 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}()&&A())})(B)):ce("","iframeResizer received messageData without id, message was: ",B)}function ke(e,i,t){let n=null,o=null;if(K[e]){if(n=K[e][i],typeof n!==j)throw new TypeError(`${i} on iFrame[${e}] is not a function`);if("onBeforeClose"===i||"onScroll"===i)try{o=n(t)}catch(t){console.error(t),ce(e,`Error in ${i} callback`)}else((e,...i)=>{setTimeout(()=>e(...i),0)})(n,t)}return o}function Te(e){const{id:i}=e;se(i,"Disconnected from iframe"),delete K[i],delete e.iframeResizer}function xe(e){const{id:i}=e;if(!1!==ke(i,"onBeforeClose",i)){se(i,`Removing iFrame: %c${i}`,t);try{e.parentNode&&e.remove()}catch(e){ce(i,e)}ke(i,"onAfterClose",i),Te(e)}else se(i,"Close iframe cancelled by onBeforeClose")}function Me(e){null===$e.position&&($e.position={x:window.scrollX,y:window.scrollY},se(e,`Get page position: %c${$e.position.x}%c, %c${$e.position.y}`,t,n,t))}function Ie(){$e.position=null}function Se(e){null!==$e.position&&(window.scrollTo($e.position.x,$e.position.y),ae(e,`Set page position: %c${$e.position.x}%c, %c${$e.position.y}`,t,n,t),Ie())}function Oe(e){se(e.id,"Size reset requested by "+(e.type===l?"parent page":"child page")),Me(e.id),Re(e),Ee(h,h,e.id)}function Re(e){function i(i){const o=`${e[i]}px`;e.iframe.style[i]=o,ae(n,`Set ${i}: %c${o}`,t)}const{id:n}=e,{sizeHeight:o,sizeWidth:r}=K[n];o&&i("height"),r&&i("width")}const Ce=e=>e.split(s).filter((e,i)=>19!==i).join(s);function Ee(e,i,o){function r(r){const s=e in R?Ce(i):i;ae(o,r,t,n,t),ae(o,`Message data: %c${s}`,t)}ue(o,e),K[o]&&(K[o]?.postMessageTarget?function(){const{iframe:t,postMessageTarget:n,sameOrigin:s,targetOrigin:a}=K[o];if(s)try{return t.contentWindow.iframeChildListener(S+i),void r(`Sending message to iframe %c${o}%c via same origin%c`)}catch(i){e in R?(K[o].sameOrigin=!1,se(o,"New iframe does not support same origin")):ce(o,"Same origin messaging failed, falling back to postMessage")}r(`Sending message to iframe: %c${o}%c targetOrigin: %c${a}`),n.postMessage(S+i,a)}():ce(o,`Iframe(${o}) not found`))}let We=0,Ae=!1,Le=!1;function Ne(e,t=-3){if(Ae)return;const n=Math.max(K[e].mode,t);if(n>K[e].mode&&(K[e].mode=n),n<0)throw fe(e),K[e].vAdvised||ge(e||"Parent",`${U(n+2)}${U(2)}`),K[e].vAdvised=!0,U(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");n>0&&Le||function(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,ie||t<1?"font-weight: bold;":i))}(`v${o} (${(e=>B(q[e]))(n)})`,n),n<1&&ge("Parent",U(3)),Ae=!0}const Pe=e=>i=>{function n(){K[R]?.heightCalculationMethod in O&&Oe({iframe:i,height:1,width:1,type:l})}function o(){if(K[R]){const{iframe:e}=K[R],i={close:xe.bind(null,e),disconnect:Te.bind(null,e),removeListeners(){ge(R,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${A}\n`),this.disconnect()},resize(){ge(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."),Ee.bind(null,"Window resize",g,R)},moveToAnchor(e){((e,i,t)=>{if(typeof e!==i)throw new TypeError(`${t} is not a ${n=i,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,z,"moveToAnchor(anchor) anchor"),Ee("Move to anchor",`moveToAnchor:${e}`,R)},sendMessage(e){e=JSON.stringify(e),Ee(u,`${u}:${e}`,R)}};e.iframeResizer=i,e.iFrameResizer=i}}function p(e,i){const t=t=>()=>{if(!K[e])return;const{firstRun:o,iframe:r}=K[e];Ee(t,i,e),(e=>e===l)(t)&&(e=>"lazy"===e.loading)(r)||function(e,i){const{msgTimeout:t,warningTimeout:n}=i[e];n&&(t&&clearTimeout(t),i[e].msgTimeout=setTimeout(function(){if(void 0===i[e])return;const{initialised:t,loadErrorShown:n}=i[e];i[e].msgTimeout=void 0,t?i[e].initialisedFirstPage=!0:n||(i[e].loadErrorShown=!0,ve(e,i))},n))}(e,K),o||n()},{iframe:o}=K[e];K[e].initChild=t(c),function(e,i){L(e,d,()=>setTimeout(i,1))}(o,t(f)),function(e,i){const{iframe:t,waitForLoad:n}=K[e];!0!==n&&((e=>{const{src:i,srcdoc:t}=e;return!t&&(null==i||""===i||"about:blank"===i)})(t)?setTimeout(()=>{ue(e,"noContent"),ae(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(i))}(e,t(l))}function m(e){return e?(("sizeWidth"in e||"sizeHeight"in e||a in e)&&ge(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>${I}</>, <bb>${x}</> or <bb>${T}</>.\n`),e):{}}function h(e){const i=K[e]?.iframe?.title;return""===i||void 0===i}function y(e,i){V(K[R],e)&&(ge(R,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${i}</>. ${A}`),K[R][i]=K[R][e],delete K[R][e])}const w=e=>V(e,"onMouseEnter")||V(e,"onMouseLeave");function j(e){var n,o;K[R]={...K[R],iframe:i,remoteHost:i?.src.split("/").slice(0,3).join("/"),...ze,...m(e),mouseEvents:w(e),mode:J(e),syncTitle:h(R)},y("offset","offsetSize"),y("onClose","onBeforeClose"),y("onClosed","onAfterClose"),ue(R,"setup"),function(){const{direction:e}=K[R];switch(e){case M:break;case I: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`)}se(R,`direction: %c${e}`,t)}(),(n=e?.offsetSize||e?.offset)&&(K[R].direction===M?(K[R].offsetHeight=n,se(R,`Offset height: %c${n}`,t)):(K[R].offsetWidth=n,se(R,`Offset width: %c${n}`,t))),K[R].warningTimeout||ae(R,"warningTimeout:%c disabled",t),null===K[R].postMessageTarget&&(K[R].postMessageTarget=i.contentWindow),K[R].targetOrigin=!0===K[R].checkOrigin?""===(o=K[R].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const S=()=>r in i,R=function(t){if(t&&typeof t!==z)throw new TypeError("Invalid id for iFrame. Expected String");return""!==t&&t||(t=function(){let i=e?.id||ze.id+We++;return null!==document.getElementById(i)&&(i+=We++),i}(),i.id=t,ue(t,"assignId"),se(t,`Added missing iframe ID: ${t} (${i.src})`)),t}(i.id);if(typeof e!==$)throw new TypeError("Options is not an object");return function(e){const{search:i}=window.location;i.includes("ifrlog")&&(e.log=E,e.logExpand=i.includes("ifrlog=expanded"))}(e),function(e,i){const t=V(i,"log"),n=typeof i.log===z,o=t?!!n||i.log:ze.log;V(i,"logExpand")||(i.logExpand=t&&n?i.log===C:ze.logExpand),function(e){-1===e?.log&&(e.log=!1,Le=!0)}(i),function({enabled:e,expand:i,iframeId:t}){const n=Q({expand:i,label:ne(t)});ie=e,K[t]||(K[t]={console:n})}({enabled:o,expand:i.logExpand,iframeId:e}),n&&!(i.log in W)&&de(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),i.log=o}(R,e),me(R,function(e){S()?ce(R,`Ignored iframe (${R}), already setup.`):(j(e),function(e){if(!0===we[e])return!1;const i=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(i.length<=1)return!0;we[e]=!0;const t=Array.from(i).flatMap(e=>[b,e,b]);ge(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>${i.length}</> iframes with the <b>${e}</> ID:`,...t,b)}(R),se(R,`src: %c${i.srcdoc||i.src}`,t),function(){if(Ae)return;const{mode:e}=K[R];-1!==e&&Ne(R,e)}(),He(),function(){switch(se(R,`Iframe scrolling ${K[R]?.scrolling?"enabled":"disabled"} for ${R}`),i.style.overflow=!1===K[R]?.scrolling?"hidden":k,K[R]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.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:i,bodyBackground:t,bodyMargin:n,bodyPadding:o,heightCalculationMethod:r,inPageLinks:a,license:l,log:c,logExpand:d,mouseEvents:u,offsetHeight:f,offsetWidth:p,mode:m,sizeHeight:h,sizeWidth:g,tolerance:y,widthCalculationMethod:b}=K[e];return[e,"8",g,c,"32",!0,i,n,r,t,o,y,a,v,b,u,f,p,h,l,$e.version,m,"",d].join(s)}(R)),o(),se(R,"Setup complete"),pe(R))})(e),i?.iframeResizer};function Be(){!0!==document.hidden&&((e,i)=>{Object.values(K).filter(({autoResize:e,firstRun:i})=>e&&!i).forEach(({iframe:t})=>Ee(e,i,t.id))})("tabVisible",g)}const He=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})(()=>{L(window,u,je),L(document,"visibilitychange",Be),window.iframeParentListener=e=>setTimeout(()=>je({data:e,sameOrigin:!0}))});export{Pe as default};
20
+ import e,{NORMAL as i,HIGHLIGHT as t,FOREGROUND as n}from"auto-console-group";const o="5.5.8-beta.2",r="iframeResizer",s=":",a="autoResize",l="init",c="iframeReady",d="load",u="message",f="onload",p="pageInfo",m="parentInfo",h="reset",g="resize",y="scroll",b="\n",v="child",w="parent",z="string",$="object",j="function",k="auto",T="none",x="both",M="vertical",I="horizontal",S="[iFrameSizer]",O=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),R=Object.freeze({[f]:1,[l]:1,[c]:1}),C="expanded",E="collapsed",W=Object.freeze({[C]:1,[E]:1}),A="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",L=(e,i,t,n)=>e.addEventListener(i,t,n||!1),N=(e,i,t)=>e.removeEventListener(i,t,!1),P=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>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"].map((e,i)=>[e,Math.max(0,i-1)])),U=e=>B(F[e]),J=e=>{const i=e[B(H[0])]||e[B(H[1])]||e[B(H[2])];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=P(B(e));return t in D&&(i=D[t]),i}(t[0]);return 0===n||(e=>e[2]===P(e[0]+e[1]))(t)||(n=-2),n},V=Object.hasOwn||((e,i)=>Object.prototype.hasOwnProperty.call(e,i)),Z={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},X=Object.keys(Z),Y=new RegExp(`<(${X.join("|")})>`,"gi"),G=(e,i)=>Z[i]??"",_=e=>i=>e(typeof i===z?window.chrome?i.replace(Y,G):(e=>e.replaceAll("<br>",b).replaceAll(/<\/?[^>]+>/gi,""))(i):i),K={},Q=(ee=e,ee?.__esModule?ee.default:ee);var ee;let ie=!0;const te=Q({expand:!1,label:w}),ne=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const oe=e=>(i,...t)=>K[i]?K[i].console[e](...t):te[e](...t),re=e=>(i,...t)=>!0===(e=>K[e]?K[e].log:ie)(i)?oe(e)(i,...t):null,se=re("log"),ae=se,le=re("debug"),ce=oe("warn"),de=oe("error"),ue=oe("event"),fe=oe("purge"),pe=oe("endAutoGroup"),me=oe("errorBoundary");const he=_(e=>e),ge=(e,...i)=>K[e]?K[e].console.warn(...i.map(he)):queueMicrotask(()=>{const t=_((e=>(...i)=>[`${r}(${e})`,...i].join(" "))(e));console?.warn(...i.map(t))}),ye=(e=>(i,t="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${i}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${i.toLowerCase()} has been ${t} <b>${o}</>. ${r}Use of the old ${i.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(ge),be=ye("Option");function ve(e,i){const{checkOrigin:t,iframe:{src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:s}=i[e],a=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);ue(e,"noResponse"),ge(e,`<rb>No response from iframe</>\n\nThe iframe (<i>${e}</>) has not responded within ${i[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&a?`\nThe <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.\n`:""}${s&&!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 we={};const ze=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&&(be("init()","onReady()","",e.id),K[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),$e={position:null,version:o};function je(e){function i(){Re(F),Se(U),W("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(s)+7+e);const b=(e,i)=>(t,n)=>{const o={};var r,s;r=function(){Ee(`${t} (${e})`,`${e}:${i()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame(()=>{o[s]=null}))},v=(e,i)=>()=>{let t=!1;const n=i=>()=>{K[l]?t&&t!==i||(e(i,l),t=i,requestAnimationFrame(()=>{t=!1})):a()},o=n(y),r=n("resize window");function s(e,t){se(l,`${e}listeners for send${i}`),t(window,y,o),t(window,g,r)}function a(){ue(l,`stop${i}`),s("Remove ",N),c.disconnect(),u.disconnect(),N(K[l].iframe,d,a)}const l=U,c=new ResizeObserver(n("pageObserver")),u=new ResizeObserver(n("iframeObserver"));K[l]&&(K[l][`stop${i}`]=a,L(K[l].iframe,d,a),s("Add ",L),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.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(),i=F.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})}),k=b(m,function(){const{iframe:e}=F,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})}),T=v(j,"PageInfo"),x=v(k,"ParentInfo"),M=$("stopPageInfo"),I=$("stopParentInfo");function O(e){const i=e.getBoundingClientRect();return Me(U),{x:Number(i.left)+Number($e.position.x),y:Number(i.top)+Number($e.position.y)}}function R(e){const i=e?O(F.iframe):{x:0,y:0};ae(U,`Reposition requested (offset x:%c${i.x}%c y:%c${i.y})`,t,n,t);const o=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(F,i),r=window.parentIframe||window.parentIFrame;r?function(i,t){setTimeout(()=>i["scrollTo"+(e?"Offset":"")](t.x,t.y))}(r,o):function(e){$e.position=e,C(U)}(o)}function C(e){const{x:i,y:t}=$e.position,n=K[e]?.iframe;!1!==W("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?Se(e):Ie()}function E(e){let i={};if(0===F.width&&0===F.height){const e=f(9).split(s);i={x:e[1],y:e[0]}}else i={x:F.width,y:F.height};W(e,{iframe:F.iframe,screenX:Number(i.x),screenY:Number(i.y),type:F.type})}const W=(e,i)=>ke(U,e,i);function A(){const{height:e,iframe:r,msg:s,type:c,width:d}=F;switch(K[U]?.firstRun&&function(){if(!K[U])return;se(U,`First run for ${U}`),Ne(U,F.mode),K[U].firstRun=!1}(),c){case"close":xe(r);break;case u:y=f(6),se(U,`onMessage passed: {iframe: %c${F.iframe.id}%c, message: %c${y}%c}`,t,n,t,n),W("onMessage",{iframe:F.iframe,message:JSON.parse(y)});break;case"mouseenter":E("onMouseEnter");break;case"mouseleave":E("onMouseLeave");break;case"beforeUnload":ae(U,"Ready state reset"),K[U].initialised=!1;break;case a:K[U].autoResize=JSON.parse(f(9));break;case"scrollBy":!function(){const e=F.width,i=F.height,o=window.parentIframe||window.parentIFrame||window;ae(U,`scrollBy: x: %c${e}%c y: %c${i}`,t,n,t),o.scrollBy(e,i)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case p:T();break;case m:x();break;case"pageInfoStop":M();break;case"parentInfoStop":I();break;case"inPageLink":!function(e){const i=e.split("#")[1]||"",n=decodeURIComponent(i);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const e=O(o);ae(U,`Moving to in page link: %c#${i}`,t),$e.position={x:e.x,y:e.y},C(U),window.location.hash=i}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(i):se(U,`In page link #${i} not found`)}():se(U,`In page link #${i} not found`)}(f(9));break;case"title":!function(e,i){K[i]?.syncTitle&&(K[i].iframe.title=e,ae(i,`Set iframe title attribute: %c${e}`,t))}(s,U);break;case h:Oe(F);break;case l:i(),function(e){try{K[e].sameOrigin=!!K[e]?.iframe?.contentWindow?.iframeChildListener}catch(i){K[e].sameOrigin=!1}se(e,`sameOrigin: %c${K[e].sameOrigin}`,t)}(U),(g=s)!==o&&(void 0!==g?se(U,`Version mismatch (Child: %c${g}%c !== Parent: %c${o})`,t,n,t):ge(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,W("onReady",r);break;default:if(0===d&&0===e)return void ce(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===d||0===e)return void se(U,"Ignoring message with 0 height or width");if(document.hidden)return void se(U,"Page hidden - ignored resize request");i()}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:i,postMessageTarget:t})=>{e===t&&i()})(H));var H;if(!(e=>S===`${e}`.slice(0,13)&&e.slice(13).split(s)[0]in K)(B)){if(typeof B!==z)return;return ue(w,"ignoredMessage"),void le(w,B)}const F=function(e){const i=e.slice(13).split(s),t=i[1]?Number(i[1]):0,n=K[i[0]]?.iframe,o=getComputedStyle(n),a={iframe:n,id:i[0],height:t+r(o)+c(o),width:Number(i[2]),type:i[3],msg:i[4]};return i[5]&&(a.mode=i[5]),a}(B),{id:q,type:D}=F,U=q;U?(ue(U,D),me(U,function(i){P(U),function(){const e=F.type in{true:1,false:1,undefined:1};return e&&se(U,"Ignoring init message from meta parent page"),e}()||(se(U,`Received: %c${i}`,t),(null!==F.iframe||(ce(U,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:i,sameOrigin:n}=e;if(n)return!0;let o=K[U]?.checkOrigin;if(o&&"null"!=`${i}`&&!(o.constructor===Array?function(){let e=0,n=!1;for(se(U,`Checking connection is from allowed list of origins: %c${o}`,t);e<o.length;e++)if(o[e]===i){n=!0;break}return n}():function(){const e=K[U]?.remoteHost;return se(U,`Checking connection is from: %c${e}`,t),i===e}()))throw new Error(`Unexpected message received from: ${i} 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}()&&A())})(B)):ce("","iframeResizer received messageData without id, message was: ",B)}function ke(e,i,t){let n=null,o=null;if(K[e]){if(n=K[e][i],typeof n!==j)throw new TypeError(`${i} on iFrame[${e}] is not a function`);if("onBeforeClose"===i||"onScroll"===i)try{o=n(t)}catch(t){console.error(t),ce(e,`Error in ${i} callback`)}else((e,...i)=>{setTimeout(()=>e(...i),0)})(n,t)}return o}function Te(e){const{id:i}=e;se(i,"Disconnected from iframe"),delete K[i],delete e.iframeResizer}function xe(e){const{id:i}=e;if(!1!==ke(i,"onBeforeClose",i)){se(i,`Removing iFrame: %c${i}`,t);try{e.parentNode&&e.remove()}catch(e){ce(i,e)}ke(i,"onAfterClose",i),Te(e)}else se(i,"Close iframe cancelled by onBeforeClose")}function Me(e){null===$e.position&&($e.position={x:window.scrollX,y:window.scrollY},se(e,`Get page position: %c${$e.position.x}%c, %c${$e.position.y}`,t,n,t))}function Ie(){$e.position=null}function Se(e){null!==$e.position&&(window.scrollTo($e.position.x,$e.position.y),ae(e,`Set page position: %c${$e.position.x}%c, %c${$e.position.y}`,t,n,t),Ie())}function Oe(e){se(e.id,"Size reset requested by "+(e.type===l?"parent page":"child page")),Me(e.id),Re(e),Ee(h,h,e.id)}function Re(e){function i(i){const o=`${e[i]}px`;e.iframe.style[i]=o,ae(n,`Set ${i}: %c${o}`,t)}const{id:n}=e,{sizeHeight:o,sizeWidth:r}=K[n];o&&i("height"),r&&i("width")}const Ce=e=>e.split(s).filter((e,i)=>19!==i).join(s);function Ee(e,i,o){function r(r){const s=e in R?Ce(i):i;ae(o,r,t,n,t),ae(o,`Message data: %c${s}`,t)}ue(o,e),K[o]&&(K[o]?.postMessageTarget?function(){const{iframe:t,postMessageTarget:n,sameOrigin:s,targetOrigin:a}=K[o];if(s)try{return t.contentWindow.iframeChildListener(S+i),void r(`Sending message to iframe %c${o}%c via same origin%c`)}catch(i){e in R?(K[o].sameOrigin=!1,se(o,"New iframe does not support same origin")):ce(o,"Same origin messaging failed, falling back to postMessage")}r(`Sending message to iframe: %c${o}%c targetOrigin: %c${a}`),n.postMessage(S+i,a)}():ce(o,`Iframe(${o}) not found`))}let We=0,Ae=!1,Le=!1;function Ne(e,t=-3){if(Ae)return;const n=Math.max(K[e].mode,t);if(n>K[e].mode&&(K[e].mode=n),n<0)throw fe(e),K[e].vAdvised||ge(e||"Parent",`${U(n+2)}${U(2)}`),K[e].vAdvised=!0,U(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");n>0&&Le||function(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,ie||t<1?"font-weight: bold;":i))}(`v${o} (${(e=>B(q[e]))(n)})`,n),n<1&&ge("Parent",U(3)),Ae=!0}const Pe=e=>i=>{function n(){K[R]?.heightCalculationMethod in O&&Oe({iframe:i,height:1,width:1,type:l})}function o(){if(K[R]){const{iframe:e}=K[R],i={close:xe.bind(null,e),disconnect:Te.bind(null,e),removeListeners(){ge(R,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${A}\n`),this.disconnect()},resize(){ge(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."),Ee.bind(null,"Window resize",g,R)},moveToAnchor(e){((e,i,t)=>{if(typeof e!==i)throw new TypeError(`${t} is not a ${n=i,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,z,"moveToAnchor(anchor) anchor"),Ee("Move to anchor",`moveToAnchor:${e}`,R)},sendMessage(e){e=JSON.stringify(e),Ee(u,`${u}:${e}`,R)}};e.iframeResizer=i,e.iFrameResizer=i}}function p(e,i){const t=t=>()=>{if(!K[e])return;const{firstRun:o,iframe:r}=K[e];Ee(t,i,e),(e=>e===l)(t)&&(e=>"lazy"===e.loading)(r)||function(e,i){const{msgTimeout:t,warningTimeout:n}=i[e];n&&(t&&clearTimeout(t),i[e].msgTimeout=setTimeout(function(){if(void 0===i[e])return;const{initialised:t,loadErrorShown:n}=i[e];i[e].msgTimeout=void 0,t?i[e].initialisedFirstPage=!0:n||(i[e].loadErrorShown=!0,ve(e,i))},n))}(e,K),o||n()},{iframe:o}=K[e];K[e].initChild=t(c),function(e,i){L(e,d,()=>setTimeout(i,1))}(o,t(f)),function(e,i){const{iframe:t,waitForLoad:n}=K[e];!0!==n&&((e=>{const{src:i,srcdoc:t}=e;return!t&&(null==i||""===i||"about:blank"===i)})(t)?setTimeout(()=>{ue(e,"noContent"),ae(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(i))}(e,t(l))}function m(e){return e?(("sizeWidth"in e||"sizeHeight"in e||a in e)&&ge(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>${I}</>, <bb>${x}</> or <bb>${T}</>.\n`),e):{}}function h(e){const i=K[e]?.iframe?.title;return""===i||void 0===i}function y(e,i){V(K[R],e)&&(ge(R,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${i}</>. ${A}`),K[R][i]=K[R][e],delete K[R][e])}const w=e=>V(e,"onMouseEnter")||V(e,"onMouseLeave");function j(e){var n,o;K[R]={...K[R],iframe:i,remoteHost:i?.src.split("/").slice(0,3).join("/"),...ze,...m(e),mouseEvents:w(e),mode:J(e),syncTitle:h(R)},y("offset","offsetSize"),y("onClose","onBeforeClose"),y("onClosed","onAfterClose"),ue(R,"setup"),function(){const{direction:e}=K[R];switch(e){case M:break;case I: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`)}se(R,`direction: %c${e}`,t)}(),(n=e?.offsetSize||e?.offset)&&(K[R].direction===M?(K[R].offsetHeight=n,se(R,`Offset height: %c${n}`,t)):(K[R].offsetWidth=n,se(R,`Offset width: %c${n}`,t))),K[R].warningTimeout||ae(R,"warningTimeout:%c disabled",t),null===K[R].postMessageTarget&&(K[R].postMessageTarget=i.contentWindow),K[R].targetOrigin=!0===K[R].checkOrigin?""===(o=K[R].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const S=()=>r in i,R=function(t){if(t&&typeof t!==z)throw new TypeError("Invalid id for iFrame. Expected String");return""!==t&&t||(t=function(){let i=e?.id||ze.id+We++;return null!==document.getElementById(i)&&(i+=We++),i}(),i.id=t,ue(t,"assignId"),se(t,`Added missing iframe ID: ${t} (${i.src})`)),t}(i.id);if(typeof e!==$)throw new TypeError("Options is not an object");return function(e){const{search:i}=window.location;i.includes("ifrlog")&&(e.log=E,e.logExpand=i.includes("ifrlog=expanded"))}(e),function(e,i){const t=V(i,"log"),n=typeof i.log===z,o=t?!!n||i.log:ze.log;V(i,"logExpand")||(i.logExpand=t&&n?i.log===C:ze.logExpand),function(e){-1===e?.log&&(e.log=!1,Le=!0)}(i),function({enabled:e,expand:i,iframeId:t}){const n=Q({expand:i,label:ne(t)});ie=e,K[t]||(K[t]={console:n})}({enabled:o,expand:i.logExpand,iframeId:e}),n&&!(i.log in W)&&de(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),i.log=o}(R,e),me(R,function(e){S()?ce(R,`Ignored iframe (${R}), already setup.`):(j(e),function(e){if(!0===we[e])return!1;const i=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(i.length<=1)return!0;we[e]=!0;const t=Array.from(i).flatMap(e=>[b,e,b]);ge(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>${i.length}</> iframes with the <b>${e}</> ID:`,...t,b)}(R),se(R,`src: %c${i.srcdoc||i.src}`,t),function(){if(Ae)return;const{mode:e}=K[R];-1!==e&&Ne(R,e)}(),He(),function(){switch(se(R,`Iframe scrolling ${K[R]?.scrolling?"enabled":"disabled"} for ${R}`),i.style.overflow=!1===K[R]?.scrolling?"hidden":k,K[R]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.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:i,bodyBackground:t,bodyMargin:n,bodyPadding:o,heightCalculationMethod:r,inPageLinks:a,license:l,log:c,logExpand:d,mouseEvents:u,offsetHeight:f,offsetWidth:p,mode:m,sizeHeight:h,sizeWidth:g,tolerance:y,widthCalculationMethod:b}=K[e];return[e,"8",g,c,"32",!0,i,n,r,t,o,y,a,v,b,u,f,p,h,l,$e.version,m,"",d].join(s)}(R)),o(),se(R,"Setup complete"),pe(R))})(e),i?.iframeResizer};function Be(){!0!==document.hidden&&((e,i)=>{Object.values(K).filter(({autoResize:e,firstRun:i})=>e&&!i).forEach(({iframe:t})=>Ee(e,i,t.id))})("tabVisible",g)}const He=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})(()=>{L(window,u,je),L(document,"visibilitychange",Be),window.iframeParentListener=e=>setTimeout(()=>je({data:e,sameOrigin:!0}))});export{Pe as default};
21
21
  //# sourceMappingURL=index.esm.js.map
package/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/core 5.5.8-beta.1 (umd) - 2026-01-22
4
+ * @module iframe-resizer/core 5.5.8-beta.2 (umd) - 2026-01-23
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("auto-console-group")):"function"==typeof define&&define.amd?define(["auto-console-group"],i):(e="undefined"!=typeof globalThis?globalThis:e||self).createResizer=i(e.acg)}(this,function(e){"use strict";const i="5.5.8-beta.1",t="iframeResizer",n=":",o="autoResize",r="init",s="iframeReady",a="load",l="message",c="onload",d="pageInfo",u="parentInfo",f="reset",p="resize",m="scroll",h="\n",g="child",y="parent",b="string",v="object",w="function",z="auto",H="none",I="both",$="vertical",T="horizontal",j="[iFrameSizer]",k=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),G=Object.freeze({[c]:1,[r]:1,[s]:1}),O="expanded",R="collapsed",x=Object.freeze({[O]:1,[R]:1}),L="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",M=(e,i,t,n)=>e.addEventListener(i,t,n||!1),S=(e,i,t)=>e.removeEventListener(i,t,!1),E=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},C=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),N=["spjluzl","rlf","clyzpvu"],W=["<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."],A=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],F=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,i)=>[e,Math.max(0,i-1)])),D=e=>C(W[e]),P=e=>{const i=e[C(N[0])]||e[C(N[1])]||e[C(N[2])];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=E(C(e));return t in F&&(i=F[t]),i}(t[0]);return 0===n||(e=>e[2]===E(e[0]+e[1]))(t)||(n=-2),n},B=Object.hasOwn||((e,i)=>Object.prototype.hasOwnProperty.call(e,i)),q={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},U=Object.keys(q),J=new RegExp(`<(${U.join("|")})>`,"gi"),V=(e,i)=>q[i]??"",Z=e=>i=>e(typeof i===b?window.chrome?i.replace(J,V):(e=>e.replaceAll("<br>",h).replaceAll(/<\/?[^>]+>/gi,""))(i):i),X={},Y=(_=e,_?.__esModule?_.default:_);var _;let K=!0;const Q=Y({expand:!1,label:y}),ee=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const ie=e=>(i,...t)=>X[i]?X[i].console[e](...t):Q[e](...t),te=e=>(i,...t)=>!0===(e=>X[e]?X[e].log:K)(i)?ie(e)(i,...t):null,ne=te("log"),oe=ne,re=te("debug"),se=ie("warn"),ae=ie("error"),le=ie("event"),ce=ie("purge"),de=ie("endAutoGroup"),ue=ie("errorBoundary");const fe=Z(e=>e),pe=(e,...i)=>X[e]?X[e].console.warn(...i.map(fe)):queueMicrotask(()=>{const n=Z((e=>(...i)=>[`${t}(${e})`,...i].join(" "))(e));console?.warn(...i.map(n))}),me=(e=>(i,t="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${i}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${i.toLowerCase()} has been ${t} <b>${o}</>. ${r}Use of the old ${i.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(pe),he=me("Option");function ge(e,i){const{checkOrigin:t,iframe:{src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:s}=i[e],a=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);le(e,"noResponse"),pe(e,`<rb>No response from iframe</>\n\nThe iframe (<i>${e}</>) has not responded within ${i[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&a?`\nThe <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.\n`:""}${s&&!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===v&&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 ye={};const be=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:$,firstRun:!0,inPageLinks:!1,heightCalculationMethod:z,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:z,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof X[e.id].onInit===w&&(he("init()","onReady()","",e.id),X[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),ve={position:null,version:i};function we(t){function s(){Ge(F),je(B),E("onResized",F)}function c(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function h(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const g=e=>W.slice(W.indexOf(n)+7+e);const v=(e,i)=>(t,n)=>{const o={};var r,s;r=function(){Re(`${t} (${e})`,`${e}:${i()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame(()=>{o[s]=null}))},w=(e,i)=>()=>{let t=!1;const n=i=>()=>{X[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame(()=>{t=!1})):l()},o=n(m),r=n("resize window");function s(e,t){ne(c,`${e}listeners for send${i}`),t(window,m,o),t(window,p,r)}function l(){le(c,`stop${i}`),s("Remove ",S),d.disconnect(),u.disconnect(),S(X[c].iframe,a,l)}const c=B,d=new ResizeObserver(n("pageObserver")),u=new ResizeObserver(n("iframeObserver"));X[c]&&(X[c][`stop${i}`]=l,M(X[c].iframe,a,l),s("Add ",M),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(X[c].iframe,{attributes:!0,childList:!1,subtree:!1}))},z=e=>()=>{e in X[B]&&(X[B][e](),delete X[B][e])},H=v(d,function(){const e=document.body.getBoundingClientRect(),i=F.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})}),I=v(u,function(){const{iframe:e}=F,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})}),$=w(H,"PageInfo"),T=w(I,"ParentInfo"),k=z("stopPageInfo"),G=z("stopParentInfo");function O(e){const i=e.getBoundingClientRect();return $e(B),{x:Number(i.left)+Number(ve.position.x),y:Number(i.top)+Number(ve.position.y)}}function R(i){const t=i?O(F.iframe):{x:0,y:0};oe(B,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT);const n=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(F,t),o=window.parentIframe||window.parentIFrame;o?function(e,t){setTimeout(()=>e["scrollTo"+(i?"Offset":"")](t.x,t.y))}(o,n):function(e){ve.position=e,x(B)}(n)}function x(e){const{x:i,y:t}=ve.position,n=X[e]?.iframe;!1!==E("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?je(e):Te()}function L(e){let i={};if(0===F.width&&0===F.height){const e=g(9).split(n);i={x:e[1],y:e[0]}}else i={x:F.width,y:F.height};E(e,{iframe:F.iframe,screenX:Number(i.x),screenY:Number(i.y),type:F.type})}const E=(e,i)=>ze(B,e,i);function C(){const{height:t,iframe:n,msg:a,type:c,width:p}=F;switch(X[B]?.firstRun&&function(){if(!X[B])return;ne(B,`First run for ${B}`),Se(B,F.mode),X[B].firstRun=!1}(),c){case"close":Ie(n);break;case l:h=g(6),ne(B,`onMessage passed: {iframe: %c${F.iframe.id}%c, message: %c${h}%c}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND),E("onMessage",{iframe:F.iframe,message:JSON.parse(h)});break;case"mouseenter":L("onMouseEnter");break;case"mouseleave":L("onMouseLeave");break;case"beforeUnload":oe(B,"Ready state reset"),X[B].initialised=!1;break;case o:X[B].autoResize=JSON.parse(g(9));break;case"scrollBy":!function(){const i=F.width,t=F.height,n=window.parentIframe||window.parentIFrame||window;oe(B,`scrollBy: x: %c${i}%c y: %c${t}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),n.scrollBy(i,t)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case d:$();break;case u:T();break;case"pageInfoStop":k();break;case"parentInfoStop":G();break;case"inPageLink":!function(i){const t=i.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const i=O(o);oe(B,`Moving to in page link: %c#${t}`,e.HIGHLIGHT),ve.position={x:i.x,y:i.y},x(B),window.location.hash=t}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):ne(B,`In page link #${t} not found`)}():ne(B,`In page link #${t} not found`)}(g(9));break;case"title":!function(i,t){X[t]?.syncTitle&&(X[t].iframe.title=i,oe(t,`Set iframe title attribute: %c${i}`,e.HIGHLIGHT))}(a,B);break;case f:ke(F);break;case r:s(),function(i){try{X[i].sameOrigin=!!X[i]?.iframe?.contentWindow?.iframeChildListener}catch(e){X[i].sameOrigin=!1}ne(i,`sameOrigin: %c${X[i].sameOrigin}`,e.HIGHLIGHT)}(B),(m=a)!==i&&(void 0!==m?ne(B,`Version mismatch (Child: %c${m}%c !== Parent: %c${i})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT):pe(B,"<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")),X[B].initialised=!0,E("onReady",n);break;default:if(0===p&&0===t)return void se(B,`Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===p||0===t)return void ne(B,"Ignoring message with 0 height or width");if(document.hidden)return void ne(B,"Page hidden - ignored resize request");s()}var m,h}function N(e){if(!X[e])throw new Error(`${F.type} No settings for ${e}. Message was: ${W}`)}let W=t.data;if("[iFrameResizerChild]Ready"===W)return A=t.source,void Object.values(X).forEach((e=>({initChild:i,postMessageTarget:t})=>{e===t&&i()})(A));var A;if(!(e=>j===`${e}`.slice(0,13)&&e.slice(13).split(n)[0]in X)(W)){if(typeof W!==b)return;return le(y,"ignoredMessage"),void re(y,W)}const F=function(e){const i=e.slice(13).split(n),t=i[1]?Number(i[1]):0,o=X[i[0]]?.iframe,r=getComputedStyle(o),s={iframe:o,id:i[0],height:t+c(r)+h(r),width:Number(i[2]),type:i[3],msg:i[4]};return i[5]&&(s.mode=i[5]),s}(W),{id:D,type:P}=F,B=D;B?(le(B,P),ue(B,function(i){N(B),function(){const e=F.type in{true:1,false:1,undefined:1};return e&&ne(B,"Ignoring init message from meta parent page"),e}()||(ne(B,`Received: %c${i}`,e.HIGHLIGHT),(null!==F.iframe||(se(B,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:i,sameOrigin:n}=t;if(n)return!0;let o=X[B]?.checkOrigin;if(o&&"null"!=`${i}`&&!(o.constructor===Array?function(){let t=0,n=!1;for(ne(B,`Checking connection is from allowed list of origins: %c${o}`,e.HIGHLIGHT);t<o.length;t++)if(o[t]===i){n=!0;break}return n}():function(){const t=X[B]?.remoteHost;return ne(B,`Checking connection is from: %c${t}`,e.HIGHLIGHT),i===t}()))throw new Error(`Unexpected message received from: ${i} for ${F.iframe.id}. Message was: ${t.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&C())})(W)):se("","iframeResizer received messageData without id, message was: ",W)}function ze(e,i,t){let n=null,o=null;if(X[e]){if(n=X[e][i],typeof n!==w)throw new TypeError(`${i} on iFrame[${e}] is not a function`);if("onBeforeClose"===i||"onScroll"===i)try{o=n(t)}catch(t){console.error(t),se(e,`Error in ${i} callback`)}else((e,...i)=>{setTimeout(()=>e(...i),0)})(n,t)}return o}function He(e){const{id:i}=e;ne(i,"Disconnected from iframe"),delete X[i],delete e.iframeResizer}function Ie(i){const{id:t}=i;if(!1!==ze(t,"onBeforeClose",t)){ne(t,`Removing iFrame: %c${t}`,e.HIGHLIGHT);try{i.parentNode&&i.remove()}catch(e){se(t,e)}ze(t,"onAfterClose",t),He(i)}else ne(t,"Close iframe cancelled by onBeforeClose")}function $e(i){null===ve.position&&(ve.position={x:window.scrollX,y:window.scrollY},ne(i,`Get page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT))}function Te(){ve.position=null}function je(i){null!==ve.position&&(window.scrollTo(ve.position.x,ve.position.y),oe(i,`Set page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Te())}function ke(e){ne(e.id,"Size reset requested by "+(e.type===r?"parent page":"child page")),$e(e.id),Ge(e),Re(f,f,e.id)}function Ge(i){function t(t){const o=`${i[t]}px`;i.iframe.style[t]=o,oe(n,`Set ${t}: %c${o}`,e.HIGHLIGHT)}const{id:n}=i,{sizeHeight:o,sizeWidth:r}=X[n];o&&t("height"),r&&t("width")}const Oe=e=>e.split(n).filter((e,i)=>19!==i).join(n);function Re(i,t,n){function o(o){const r=i in G?Oe(t):t;oe(n,o,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),oe(n,`Message data: %c${r}`,e.HIGHLIGHT)}le(n,i),X[n]&&(X[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:r,sameOrigin:s,targetOrigin:a}=X[n];if(s)try{return e.contentWindow.iframeChildListener(j+t),void o(`Sending message to iframe %c${n}%c via same origin%c`)}catch(e){i in G?(X[n].sameOrigin=!1,ne(n,"New iframe does not support same origin")):se(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`),r.postMessage(j+t,a)}():se(n,`Iframe(${n}) not found`))}let xe=0,Le=!1,Me=!1;function Se(t,n=-3){if(Le)return;const o=Math.max(X[t].mode,n);if(o>X[t].mode&&(X[t].mode=o),o<0)throw ce(t),X[t].vAdvised||pe(t||"Parent",`${D(o+2)}${D(2)}`),X[t].vAdvised=!0,D(o+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");o>0&&Me||function(i,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${i}`,K||t<1?"font-weight: bold;":e.NORMAL))}(`v${i} (${(e=>C(A[e]))(o)})`,o),o<1&&pe("Parent",D(3)),Le=!0}function Ee(){!0!==document.hidden&&((e,i)=>{Object.values(X).filter(({autoResize:e,firstRun:i})=>e&&!i).forEach(({iframe:t})=>Re(e,i,t.id))})("tabVisible",p)}const Ce=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})(()=>{M(window,l,we),M(document,"visibilitychange",Ee),window.iframeParentListener=e=>setTimeout(()=>we({data:e,sameOrigin:!0}))});return i=>d=>{function u(){X[C]?.heightCalculationMethod in k&&ke({iframe:d,height:1,width:1,type:r})}function f(){if(X[C]){const{iframe:e}=X[C],i={close:Ie.bind(null,e),disconnect:He.bind(null,e),removeListeners(){pe(C,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${L}\n`),this.disconnect()},resize(){pe(C,"<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",p,C)},moveToAnchor(e){((e,i,t)=>{if(typeof e!==i)throw new TypeError(`${t} is not a ${n=i,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,b,"moveToAnchor(anchor) anchor"),Re("Move to anchor",`moveToAnchor:${e}`,C)},sendMessage(e){e=JSON.stringify(e),Re(l,`${l}:${e}`,C)}};e.iframeResizer=i,e.iFrameResizer=i}}function m(e,i){const t=t=>()=>{if(!X[e])return;const{firstRun:n,iframe:o}=X[e];Re(t,i,e),(e=>e===r)(t)&&(e=>"lazy"===e.loading)(o)||function(e,i){const{msgTimeout:t,warningTimeout:n}=i[e];n&&(t&&clearTimeout(t),i[e].msgTimeout=setTimeout(function(){if(void 0===i[e])return;const{initialised:t,loadErrorShown:n}=i[e];i[e].msgTimeout=void 0,t?i[e].initialisedFirstPage=!0:n||(i[e].loadErrorShown=!0,ge(e,i))},n))}(e,X),n||u()},{iframe:n}=X[e];X[e].initChild=t(s),function(e,i){M(e,a,()=>setTimeout(i,1))}(n,t(c)),function(e,i){const{iframe:t,waitForLoad:n}=X[e];!0!==n&&((e=>{const{src:i,srcdoc:t}=e;return!t&&(null==i||""===i||"about:blank"===i)})(t)?setTimeout(()=>{le(e,"noContent"),oe(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(i))}(e,t(r))}function y(e){return e?(("sizeWidth"in e||"sizeHeight"in e||o in e)&&pe(C,`<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>${$}</>, <bb>${T}</>, <bb>${I}</> or <bb>${H}</>.\n`),e):{}}function w(e){const i=X[e]?.iframe?.title;return""===i||void 0===i}function j(e,i){B(X[C],e)&&(pe(C,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${i}</>. ${L}`),X[C][i]=X[C][e],delete X[C][e])}const G=e=>B(e,"onMouseEnter")||B(e,"onMouseLeave");function S(i){var t,n;X[C]={...X[C],iframe:d,remoteHost:d?.src.split("/").slice(0,3).join("/"),...be,...y(i),mouseEvents:G(i),mode:P(i),syncTitle:w(C)},j("offset","offsetSize"),j("onClose","onBeforeClose"),j("onClosed","onAfterClose"),le(C,"setup"),function(){const{direction:i}=X[C];switch(i){case $:break;case T:X[C].sizeHeight=!1;case I:X[C].sizeWidth=!0;break;case H:X[C].sizeWidth=!1,X[C].sizeHeight=!1,X[C].autoResize=!1;break;default:throw new TypeError(C,`Direction value of "${i}" is not valid`)}ne(C,`direction: %c${i}`,e.HIGHLIGHT)}(),(t=i?.offsetSize||i?.offset)&&(X[C].direction===$?(X[C].offsetHeight=t,ne(C,`Offset height: %c${t}`,e.HIGHLIGHT)):(X[C].offsetWidth=t,ne(C,`Offset width: %c${t}`,e.HIGHLIGHT))),X[C].warningTimeout||oe(C,"warningTimeout:%c disabled",e.HIGHLIGHT),null===X[C].postMessageTarget&&(X[C].postMessageTarget=d.contentWindow),X[C].targetOrigin=!0===X[C].checkOrigin?""===(n=X[C].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*"}const E=()=>t in d,C=function(e){if(e&&typeof e!==b)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=i?.id||be.id+xe++;return null!==document.getElementById(e)&&(e+=xe++),e}(),d.id=e,le(e,"assignId"),ne(e,`Added missing iframe ID: ${e} (${d.src})`)),e}(d.id);if(typeof i!==v)throw new TypeError("Options is not an object");return function(e){const{search:i}=window.location;i.includes("ifrlog")&&(e.log=R,e.logExpand=i.includes("ifrlog=expanded"))}(i),function(e,i){const t=B(i,"log"),n=typeof i.log===b,o=t?!!n||i.log:be.log;B(i,"logExpand")||(i.logExpand=t&&n?i.log===O:be.logExpand),function(e){-1===e?.log&&(e.log=!1,Me=!0)}(i),function({enabled:e,expand:i,iframeId:t}){const n=Y({expand:i,label:ee(t)});K=e,X[t]||(X[t]={console:n})}({enabled:o,expand:i.logExpand,iframeId:e}),n&&!(i.log in x)&&ae(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),i.log=o}(C,i),ue(C,function(i){E()?se(C,`Ignored iframe (${C}), already setup.`):(S(i),function(e){if(!0===ye[e])return!1;const i=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(i.length<=1)return!0;ye[e]=!0;const t=Array.from(i).flatMap(e=>[h,e,h]);pe(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>${i.length}</> iframes with the <b>${e}</> ID:`,...t,h)}(C),ne(C,`src: %c${d.srcdoc||d.src}`,e.HIGHLIGHT),function(){if(Le)return;const{mode:e}=X[C];-1!==e&&Se(C,e)}(),Ce(),function(){switch(ne(C,`Iframe scrolling ${X[C]?.scrolling?"enabled":"disabled"} for ${C}`),d.style.overflow=!1===X[C]?.scrolling?"hidden":z,X[C]?.scrolling){case"omit":break;case!0:d.scrolling="yes";break;case!1:d.scrolling="no";break;default:d.scrolling=X[C]?X[C].scrolling:"no"}}(),function(){const{bodyMargin:e}=X[C];"number"!=typeof e&&"0"!==e||(X[C].bodyMargin=`${e}px`)}(),m(C,function(e){const{autoResize:i,bodyBackground:t,bodyMargin:o,bodyPadding:r,heightCalculationMethod:s,inPageLinks:a,license:l,log:c,logExpand:d,mouseEvents:u,offsetHeight:f,offsetWidth:p,mode:m,sizeHeight:h,sizeWidth:y,tolerance:b,widthCalculationMethod:v}=X[e];return[e,"8",y,c,"32",!0,i,o,s,t,r,b,a,g,v,u,f,p,h,l,ve.version,m,"",d].join(n)}(C)),f(),ne(C,"Setup complete"),de(C))})(i),d?.iframeResizer}});
20
+ !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("auto-console-group")):"function"==typeof define&&define.amd?define(["auto-console-group"],i):(e="undefined"!=typeof globalThis?globalThis:e||self).createResizer=i(e.acg)}(this,function(e){"use strict";const i="5.5.8-beta.2",t="iframeResizer",n=":",o="autoResize",r="init",s="iframeReady",a="load",l="message",c="onload",d="pageInfo",u="parentInfo",f="reset",p="resize",m="scroll",h="\n",g="child",y="parent",b="string",v="object",w="function",z="auto",H="none",I="both",$="vertical",T="horizontal",j="[iFrameSizer]",k=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),G=Object.freeze({[c]:1,[r]:1,[s]:1}),O="expanded",R="collapsed",x=Object.freeze({[O]:1,[R]:1}),L="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",M=(e,i,t,n)=>e.addEventListener(i,t,n||!1),S=(e,i,t)=>e.removeEventListener(i,t,!1),E=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},C=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),N=["spjluzl","rlf","clyzpvu"],W=["<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."],A=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],F=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,i)=>[e,Math.max(0,i-1)])),D=e=>C(W[e]),P=e=>{const i=e[C(N[0])]||e[C(N[1])]||e[C(N[2])];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=E(C(e));return t in F&&(i=F[t]),i}(t[0]);return 0===n||(e=>e[2]===E(e[0]+e[1]))(t)||(n=-2),n},B=Object.hasOwn||((e,i)=>Object.prototype.hasOwnProperty.call(e,i)),q={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},U=Object.keys(q),J=new RegExp(`<(${U.join("|")})>`,"gi"),V=(e,i)=>q[i]??"",Z=e=>i=>e(typeof i===b?window.chrome?i.replace(J,V):(e=>e.replaceAll("<br>",h).replaceAll(/<\/?[^>]+>/gi,""))(i):i),X={},Y=(_=e,_?.__esModule?_.default:_);var _;let K=!0;const Q=Y({expand:!1,label:y}),ee=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const ie=e=>(i,...t)=>X[i]?X[i].console[e](...t):Q[e](...t),te=e=>(i,...t)=>!0===(e=>X[e]?X[e].log:K)(i)?ie(e)(i,...t):null,ne=te("log"),oe=ne,re=te("debug"),se=ie("warn"),ae=ie("error"),le=ie("event"),ce=ie("purge"),de=ie("endAutoGroup"),ue=ie("errorBoundary");const fe=Z(e=>e),pe=(e,...i)=>X[e]?X[e].console.warn(...i.map(fe)):queueMicrotask(()=>{const n=Z((e=>(...i)=>[`${t}(${e})`,...i].join(" "))(e));console?.warn(...i.map(n))}),me=(e=>(i,t="renamed to")=>(n,o,r="",s="")=>e(s,`<rb>Deprecated ${i}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${i.toLowerCase()} has been ${t} <b>${o}</>. ${r}Use of the old ${i.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(pe),he=me("Option");function ge(e,i){const{checkOrigin:t,iframe:{src:n,sandbox:o},initialisedFirstPage:r,waitForLoad:s}=i[e],a=(e=>{try{return new URL(e).origin}catch(e){return null}})(n);le(e,"noResponse"),pe(e,`<rb>No response from iframe</>\n\nThe iframe (<i>${e}</>) has not responded within ${i[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${t&&a?`\nThe <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.\n`:""}${s&&!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===v&&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 ye={};const be=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:$,firstRun:!0,inPageLinks:!1,heightCalculationMethod:z,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:z,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof X[e.id].onInit===w&&(he("init()","onReady()","",e.id),X[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),ve={position:null,version:i};function we(t){function s(){Ge(F),je(B),E("onResized",F)}function c(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function h(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const g=e=>W.slice(W.indexOf(n)+7+e);const v=(e,i)=>(t,n)=>{const o={};var r,s;r=function(){Re(`${t} (${e})`,`${e}:${i()}`,n)},o[s=n]||(r(),o[s]=requestAnimationFrame(()=>{o[s]=null}))},w=(e,i)=>()=>{let t=!1;const n=i=>()=>{X[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame(()=>{t=!1})):l()},o=n(m),r=n("resize window");function s(e,t){ne(c,`${e}listeners for send${i}`),t(window,m,o),t(window,p,r)}function l(){le(c,`stop${i}`),s("Remove ",S),d.disconnect(),u.disconnect(),S(X[c].iframe,a,l)}const c=B,d=new ResizeObserver(n("pageObserver")),u=new ResizeObserver(n("iframeObserver"));X[c]&&(X[c][`stop${i}`]=l,M(X[c].iframe,a,l),s("Add ",M),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(X[c].iframe,{attributes:!0,childList:!1,subtree:!1}))},z=e=>()=>{e in X[B]&&(X[B][e](),delete X[B][e])},H=v(d,function(){const e=document.body.getBoundingClientRect(),i=F.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:s,clientWidth:a}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(s,o||0),clientWidth:Math.max(a,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:s,documentWidth:a,windowHeight:o,windowWidth:r})}),I=v(u,function(){const{iframe:e}=F,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:s,pageLeft:a,pageTop:l,scale:c}})}),$=w(H,"PageInfo"),T=w(I,"ParentInfo"),k=z("stopPageInfo"),G=z("stopParentInfo");function O(e){const i=e.getBoundingClientRect();return $e(B),{x:Number(i.left)+Number(ve.position.x),y:Number(i.top)+Number(ve.position.y)}}function R(i){const t=i?O(F.iframe):{x:0,y:0};oe(B,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT);const n=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(F,t),o=window.parentIframe||window.parentIFrame;o?function(e,t){setTimeout(()=>e["scrollTo"+(i?"Offset":"")](t.x,t.y))}(o,n):function(e){ve.position=e,x(B)}(n)}function x(e){const{x:i,y:t}=ve.position,n=X[e]?.iframe;!1!==E("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?je(e):Te()}function L(e){let i={};if(0===F.width&&0===F.height){const e=g(9).split(n);i={x:e[1],y:e[0]}}else i={x:F.width,y:F.height};E(e,{iframe:F.iframe,screenX:Number(i.x),screenY:Number(i.y),type:F.type})}const E=(e,i)=>ze(B,e,i);function C(){const{height:t,iframe:n,msg:a,type:c,width:p}=F;switch(X[B]?.firstRun&&function(){if(!X[B])return;ne(B,`First run for ${B}`),Se(B,F.mode),X[B].firstRun=!1}(),c){case"close":Ie(n);break;case l:h=g(6),ne(B,`onMessage passed: {iframe: %c${F.iframe.id}%c, message: %c${h}%c}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND),E("onMessage",{iframe:F.iframe,message:JSON.parse(h)});break;case"mouseenter":L("onMouseEnter");break;case"mouseleave":L("onMouseLeave");break;case"beforeUnload":oe(B,"Ready state reset"),X[B].initialised=!1;break;case o:X[B].autoResize=JSON.parse(g(9));break;case"scrollBy":!function(){const i=F.width,t=F.height,n=window.parentIframe||window.parentIFrame||window;oe(B,`scrollBy: x: %c${i}%c y: %c${t}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),n.scrollBy(i,t)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case d:$();break;case u:T();break;case"pageInfoStop":k();break;case"parentInfoStop":G();break;case"inPageLink":!function(i){const t=i.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const i=O(o);oe(B,`Moving to in page link: %c#${t}`,e.HIGHLIGHT),ve.position={x:i.x,y:i.y},x(B),window.location.hash=t}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):ne(B,`In page link #${t} not found`)}():ne(B,`In page link #${t} not found`)}(g(9));break;case"title":!function(i,t){X[t]?.syncTitle&&(X[t].iframe.title=i,oe(t,`Set iframe title attribute: %c${i}`,e.HIGHLIGHT))}(a,B);break;case f:ke(F);break;case r:s(),function(i){try{X[i].sameOrigin=!!X[i]?.iframe?.contentWindow?.iframeChildListener}catch(e){X[i].sameOrigin=!1}ne(i,`sameOrigin: %c${X[i].sameOrigin}`,e.HIGHLIGHT)}(B),(m=a)!==i&&(void 0!==m?ne(B,`Version mismatch (Child: %c${m}%c !== Parent: %c${i})`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT):pe(B,"<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")),X[B].initialised=!0,E("onReady",n);break;default:if(0===p&&0===t)return void se(B,`Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===p||0===t)return void ne(B,"Ignoring message with 0 height or width");if(document.hidden)return void ne(B,"Page hidden - ignored resize request");s()}var m,h}function N(e){if(!X[e])throw new Error(`${F.type} No settings for ${e}. Message was: ${W}`)}let W=t.data;if("[iFrameResizerChild]Ready"===W)return A=t.source,void Object.values(X).forEach((e=>({initChild:i,postMessageTarget:t})=>{e===t&&i()})(A));var A;if(!(e=>j===`${e}`.slice(0,13)&&e.slice(13).split(n)[0]in X)(W)){if(typeof W!==b)return;return le(y,"ignoredMessage"),void re(y,W)}const F=function(e){const i=e.slice(13).split(n),t=i[1]?Number(i[1]):0,o=X[i[0]]?.iframe,r=getComputedStyle(o),s={iframe:o,id:i[0],height:t+c(r)+h(r),width:Number(i[2]),type:i[3],msg:i[4]};return i[5]&&(s.mode=i[5]),s}(W),{id:D,type:P}=F,B=D;B?(le(B,P),ue(B,function(i){N(B),function(){const e=F.type in{true:1,false:1,undefined:1};return e&&ne(B,"Ignoring init message from meta parent page"),e}()||(ne(B,`Received: %c${i}`,e.HIGHLIGHT),(null!==F.iframe||(se(B,`The iframe (${F.id}) was not found.`),0))&&function(){const{origin:i,sameOrigin:n}=t;if(n)return!0;let o=X[B]?.checkOrigin;if(o&&"null"!=`${i}`&&!(o.constructor===Array?function(){let t=0,n=!1;for(ne(B,`Checking connection is from allowed list of origins: %c${o}`,e.HIGHLIGHT);t<o.length;t++)if(o[t]===i){n=!0;break}return n}():function(){const t=X[B]?.remoteHost;return ne(B,`Checking connection is from: %c${t}`,e.HIGHLIGHT),i===t}()))throw new Error(`Unexpected message received from: ${i} for ${F.iframe.id}. Message was: ${t.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&C())})(W)):se("","iframeResizer received messageData without id, message was: ",W)}function ze(e,i,t){let n=null,o=null;if(X[e]){if(n=X[e][i],typeof n!==w)throw new TypeError(`${i} on iFrame[${e}] is not a function`);if("onBeforeClose"===i||"onScroll"===i)try{o=n(t)}catch(t){console.error(t),se(e,`Error in ${i} callback`)}else((e,...i)=>{setTimeout(()=>e(...i),0)})(n,t)}return o}function He(e){const{id:i}=e;ne(i,"Disconnected from iframe"),delete X[i],delete e.iframeResizer}function Ie(i){const{id:t}=i;if(!1!==ze(t,"onBeforeClose",t)){ne(t,`Removing iFrame: %c${t}`,e.HIGHLIGHT);try{i.parentNode&&i.remove()}catch(e){se(t,e)}ze(t,"onAfterClose",t),He(i)}else ne(t,"Close iframe cancelled by onBeforeClose")}function $e(i){null===ve.position&&(ve.position={x:window.scrollX,y:window.scrollY},ne(i,`Get page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT))}function Te(){ve.position=null}function je(i){null!==ve.position&&(window.scrollTo(ve.position.x,ve.position.y),oe(i,`Set page position: %c${ve.position.x}%c, %c${ve.position.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Te())}function ke(e){ne(e.id,"Size reset requested by "+(e.type===r?"parent page":"child page")),$e(e.id),Ge(e),Re(f,f,e.id)}function Ge(i){function t(t){const o=`${i[t]}px`;i.iframe.style[t]=o,oe(n,`Set ${t}: %c${o}`,e.HIGHLIGHT)}const{id:n}=i,{sizeHeight:o,sizeWidth:r}=X[n];o&&t("height"),r&&t("width")}const Oe=e=>e.split(n).filter((e,i)=>19!==i).join(n);function Re(i,t,n){function o(o){const r=i in G?Oe(t):t;oe(n,o,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),oe(n,`Message data: %c${r}`,e.HIGHLIGHT)}le(n,i),X[n]&&(X[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:r,sameOrigin:s,targetOrigin:a}=X[n];if(s)try{return e.contentWindow.iframeChildListener(j+t),void o(`Sending message to iframe %c${n}%c via same origin%c`)}catch(e){i in G?(X[n].sameOrigin=!1,ne(n,"New iframe does not support same origin")):se(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`),r.postMessage(j+t,a)}():se(n,`Iframe(${n}) not found`))}let xe=0,Le=!1,Me=!1;function Se(t,n=-3){if(Le)return;const o=Math.max(X[t].mode,n);if(o>X[t].mode&&(X[t].mode=o),o<0)throw ce(t),X[t].vAdvised||pe(t||"Parent",`${D(o+2)}${D(2)}`),X[t].vAdvised=!0,D(o+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");o>0&&Me||function(i,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${i}`,K||t<1?"font-weight: bold;":e.NORMAL))}(`v${i} (${(e=>C(A[e]))(o)})`,o),o<1&&pe("Parent",D(3)),Le=!0}function Ee(){!0!==document.hidden&&((e,i)=>{Object.values(X).filter(({autoResize:e,firstRun:i})=>e&&!i).forEach(({iframe:t})=>Re(e,i,t.id))})("tabVisible",p)}const Ce=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})(()=>{M(window,l,we),M(document,"visibilitychange",Ee),window.iframeParentListener=e=>setTimeout(()=>we({data:e,sameOrigin:!0}))});return i=>d=>{function u(){X[C]?.heightCalculationMethod in k&&ke({iframe:d,height:1,width:1,type:r})}function f(){if(X[C]){const{iframe:e}=X[C],i={close:Ie.bind(null,e),disconnect:He.bind(null,e),removeListeners(){pe(C,`<rb>Deprecated Method Name</>\n\nThe <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${L}\n`),this.disconnect()},resize(){pe(C,"<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",p,C)},moveToAnchor(e){((e,i,t)=>{if(typeof e!==i)throw new TypeError(`${t} is not a ${n=i,n.charAt(0).toUpperCase()+n.slice(1)}`);var n})(e,b,"moveToAnchor(anchor) anchor"),Re("Move to anchor",`moveToAnchor:${e}`,C)},sendMessage(e){e=JSON.stringify(e),Re(l,`${l}:${e}`,C)}};e.iframeResizer=i,e.iFrameResizer=i}}function m(e,i){const t=t=>()=>{if(!X[e])return;const{firstRun:n,iframe:o}=X[e];Re(t,i,e),(e=>e===r)(t)&&(e=>"lazy"===e.loading)(o)||function(e,i){const{msgTimeout:t,warningTimeout:n}=i[e];n&&(t&&clearTimeout(t),i[e].msgTimeout=setTimeout(function(){if(void 0===i[e])return;const{initialised:t,loadErrorShown:n}=i[e];i[e].msgTimeout=void 0,t?i[e].initialisedFirstPage=!0:n||(i[e].loadErrorShown=!0,ge(e,i))},n))}(e,X),n||u()},{iframe:n}=X[e];X[e].initChild=t(s),function(e,i){M(e,a,()=>setTimeout(i,1))}(n,t(c)),function(e,i){const{iframe:t,waitForLoad:n}=X[e];!0!==n&&((e=>{const{src:i,srcdoc:t}=e;return!t&&(null==i||""===i||"about:blank"===i)})(t)?setTimeout(()=>{le(e,"noContent"),oe(e,"No content detected in the iframe, delaying initialisation")}):setTimeout(i))}(e,t(r))}function y(e){return e?(("sizeWidth"in e||"sizeHeight"in e||o in e)&&pe(C,`<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>${$}</>, <bb>${T}</>, <bb>${I}</> or <bb>${H}</>.\n`),e):{}}function w(e){const i=X[e]?.iframe?.title;return""===i||void 0===i}function j(e,i){B(X[C],e)&&(pe(C,`<rb>Deprecated option</>\n\nThe <b>${e}</> option has been renamed to <b>${i}</>. ${L}`),X[C][i]=X[C][e],delete X[C][e])}const G=e=>B(e,"onMouseEnter")||B(e,"onMouseLeave");function S(i){var t,n;X[C]={...X[C],iframe:d,remoteHost:d?.src.split("/").slice(0,3).join("/"),...be,...y(i),mouseEvents:G(i),mode:P(i),syncTitle:w(C)},j("offset","offsetSize"),j("onClose","onBeforeClose"),j("onClosed","onAfterClose"),le(C,"setup"),function(){const{direction:i}=X[C];switch(i){case $:break;case T:X[C].sizeHeight=!1;case I:X[C].sizeWidth=!0;break;case H:X[C].sizeWidth=!1,X[C].sizeHeight=!1,X[C].autoResize=!1;break;default:throw new TypeError(C,`Direction value of "${i}" is not valid`)}ne(C,`direction: %c${i}`,e.HIGHLIGHT)}(),(t=i?.offsetSize||i?.offset)&&(X[C].direction===$?(X[C].offsetHeight=t,ne(C,`Offset height: %c${t}`,e.HIGHLIGHT)):(X[C].offsetWidth=t,ne(C,`Offset width: %c${t}`,e.HIGHLIGHT))),X[C].warningTimeout||oe(C,"warningTimeout:%c disabled",e.HIGHLIGHT),null===X[C].postMessageTarget&&(X[C].postMessageTarget=d.contentWindow),X[C].targetOrigin=!0===X[C].checkOrigin?""===(n=X[C].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*"}const E=()=>t in d,C=function(e){if(e&&typeof e!==b)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=i?.id||be.id+xe++;return null!==document.getElementById(e)&&(e+=xe++),e}(),d.id=e,le(e,"assignId"),ne(e,`Added missing iframe ID: ${e} (${d.src})`)),e}(d.id);if(typeof i!==v)throw new TypeError("Options is not an object");return function(e){const{search:i}=window.location;i.includes("ifrlog")&&(e.log=R,e.logExpand=i.includes("ifrlog=expanded"))}(i),function(e,i){const t=B(i,"log"),n=typeof i.log===b,o=t?!!n||i.log:be.log;B(i,"logExpand")||(i.logExpand=t&&n?i.log===O:be.logExpand),function(e){-1===e?.log&&(e.log=!1,Me=!0)}(i),function({enabled:e,expand:i,iframeId:t}){const n=Y({expand:i,label:ee(t)});K=e,X[t]||(X[t]={console:n})}({enabled:o,expand:i.logExpand,iframeId:e}),n&&!(i.log in x)&&ae(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),i.log=o}(C,i),ue(C,function(i){E()?se(C,`Ignored iframe (${C}), already setup.`):(S(i),function(e){if(!0===ye[e])return!1;const i=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(i.length<=1)return!0;ye[e]=!0;const t=Array.from(i).flatMap(e=>[h,e,h]);pe(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>${i.length}</> iframes with the <b>${e}</> ID:`,...t,h)}(C),ne(C,`src: %c${d.srcdoc||d.src}`,e.HIGHLIGHT),function(){if(Le)return;const{mode:e}=X[C];-1!==e&&Se(C,e)}(),Ce(),function(){switch(ne(C,`Iframe scrolling ${X[C]?.scrolling?"enabled":"disabled"} for ${C}`),d.style.overflow=!1===X[C]?.scrolling?"hidden":z,X[C]?.scrolling){case"omit":break;case!0:d.scrolling="yes";break;case!1:d.scrolling="no";break;default:d.scrolling=X[C]?X[C].scrolling:"no"}}(),function(){const{bodyMargin:e}=X[C];"number"!=typeof e&&"0"!==e||(X[C].bodyMargin=`${e}px`)}(),m(C,function(e){const{autoResize:i,bodyBackground:t,bodyMargin:o,bodyPadding:r,heightCalculationMethod:s,inPageLinks:a,license:l,log:c,logExpand:d,mouseEvents:u,offsetHeight:f,offsetWidth:p,mode:m,sizeHeight:h,sizeWidth:y,tolerance:b,widthCalculationMethod:v}=X[e];return[e,"8",y,c,"32",!0,i,o,s,t,r,b,a,g,v,u,f,p,h,l,ve.version,m,"",d].join(n)}(C)),f(),ne(C,"Setup complete"),de(C))})(i),d?.iframeResizer}});
21
21
  //# sourceMappingURL=index.umd.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/core",
3
- "version": "5.5.8-beta.1",
3
+ "version": "5.5.8-beta.2",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {