@iframe-resizer/core 6.0.0-beta.2 → 6.0.0-beta.4

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 6.0.0-beta.2 2026-04-08 - 17:04:11.411Z_
28
+ _iframe-resizer version 6.0.0-beta.4 2026-04-10 - 14:49:38.324Z_
package/index.cjs.js CHANGED
@@ -1,35 +1,27 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("auto-console-group"),N="6.0.0-beta.2",ye="iframeResizer",S=":",tt="[iFrameResizerChild]Ready",me="autoResize",nt="beforeUnload",ot="close",it="inPageLink",$="init",be="iframeReady",st="lazy",B="load",R="message",rt="mouseenter",ct="mouseleave",ve="onload",ze="pageInfo",we="parentInfo",at="pageInfoStop",lt="parentInfoStop",W="reset",J="resize",ut="scrollBy",ft="scrollTo",pt="scrollToOffset",ht="title",ne=1,dt="height",gt="width",yt="offset",mt="offsetSize",oe="scroll",G=`
2
- `,bt="hidden",vt="child",U="parent",Y="string",zt="number",Ie="object",Ee="function",V="auto",wt="font-weight: bold;",Te="none",Oe="both",F="vertical",Le="horizontal",It="omit",Et=R.length,C="[iFrameSizer]",q=C.length,Tt=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),ie=Object.freeze({[ve]:1,[$]:1,[be]:1}),H="expanded",k="collapsed",X=0,K=1,Q=2,Ot=Object.freeze({[H]:1,[k]:1}),He="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",ke=e=>typeof e===Ie&&e!==null,ee=e=>typeof e===Y;function Lt(e){if(!ke(e))return!1;try{return e.tagName==="IFRAME"||e instanceof HTMLIFrameElement}catch{return!1}}const Ht=(e,...t)=>setTimeout(()=>e(...t),0),kt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},$t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),j=(e,t)=>Object.hasOwn?Object.hasOwn(e,t):$t(e,t),Mt=e=>e,St=e=>e.charAt(0).toUpperCase()+e.slice(1),Rt=e=>e?.__esModule?e.default:e,jt=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${St(t)}`)},At=e=>(t,n="renamed to")=>(o,s,a="",r="")=>e(r,`<rb>Deprecated ${t}(${o.replace("()","")})</>
3
-
4
- The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${a}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),$e={br:`
5
- `,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},Gt=Object.keys($e),Pt=new RegExp(`<(${Gt.join("|")})>`,"gi"),Nt=(e,t)=>$e[t]??"",Ct=e=>e.replace(Pt,Nt),xt=e=>e.replaceAll("<br>",G).replaceAll(/<\/?[^>]+>/gi,""),Me=e=>t=>e(ee(t)?window.chrome?Ct(t):xt(t):t),i={},Se=Rt(c);let te=!0;const _t=Se({expand:!1,label:U}),Ft=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,Dt=e=>i[e]?i[e].log:te;function Bt({enabled:e,expand:t,iframeId:n}){const o=Se({expand:t,label:Ft(n)});te=e,i[n]||(i[n]={console:o})}const O=e=>(t,...n)=>i[t]?i[t].console[e](...n):_t[e](...n),Re=e=>(t,...n)=>Dt(t)===!0?O(e)(t,...n):null,u=Re("log"),m=u,Wt=Re("debug"),z=O("warn"),Ut=O("error"),b=O("event"),Vt=O("purge"),qt=O("endAutoGroup"),je=O("errorBoundary");function Zt(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,te||t<1?wt:c.NORMAL))}const Jt=e=>(...t)=>[`${ye}(${e})`,...t].join(" "),Yt=Me(Mt),y=(e,...t)=>i[e]?i[e].console.warn(...t.map(Yt)):queueMicrotask(()=>{const n=Me(Jt(e));console?.warn(...t.map(n))}),Xt=At(y),Kt=Xt("Option"),Qt=e=>{typeof i[e.id].onInit===Ee&&(Kt("init()","onReady()","",e.id),i[e.id].onInit(e))},x=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:F,firstRun:!0,inPageLinks:!1,heightCalculationMethod:V,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:V,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:Qt,onResized(){},onScroll:()=>!0});let se=0;function en(e){const t=e?.id||x.id+se++;return document.getElementById(t)===null?t:`${t}${se++}`}function tn(e,t){let{id:n}=e;if(n&&!ee(n))throw new TypeError("Invalid id for iFrame. Expected String");return(!n||n==="")&&(n=en(t),e.id=n,b(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function nn(e){const{search:t}=window.location;if(t.includes("ifrlog"))switch(new URLSearchParams(t).get("ifrlog")){case String(X):{e.log=!1;break}case H:case String(Q):{e.log=H;break}case k:case String(K):{e.log=k;break}default:e.log=k}}const A=(e,t,n,o)=>e.addEventListener(t,n,o||!1),re=(e,t,n)=>e.removeEventListener(t,n,!1),on=e=>e.split(S).filter((t,n)=>n!==19).join(S);function sn(e,t,n){function o(f){const p=e in ie?on(t):t;m(n,f,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),m(n,`Message data: %c${p}`,c.HIGHLIGHT)}const{iframe:s,postMessageTarget:a,sameOrigin:r,targetOrigin:l}=i[n];if(r)try{s.contentWindow.iframeChildListener(C+t),o(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in ie?(i[n].sameOrigin=!1,u(n,"New iframe does not support same origin")):z(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${l.join(", ")}`);for(const f of l)a.postMessage(C+t,f)}function E(e,t,n){if(b(n,e),!i[n]?.postMessageTarget){z(n,"Iframe not found");return}sn(e,t,n)}const rn=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:o})=>n&&!o).forEach(({iframe:n})=>E(e,t,n.id));function cn(){document.hidden!==!0&&rn("tabVisible",J)}function an(e){if(e.boxSizing!=="border-box")return 0;const t=e.paddingTop?parseInt(e.paddingTop,10):0,n=e.paddingBottom?parseInt(e.paddingBottom,10):0;return t+n}function ln(e){if(e.boxSizing!=="border-box")return 0;const t=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,n=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return t+n}function un(e){const t=e.slice(q).split(":"),n=t[1]?Number(t[1]):0,o=i[t[0]]?.iframe,s=o?getComputedStyle(o):null,a=s?an(s)+ln(s):0,r={iframe:o,id:t[0],height:n+a,width:Number(t[2]),type:t[3],msg:t[4],message:t[4]};return t[5]&&(r.mode=t[5]),r}const fn={true:1,false:1,undefined:1};function pn(e){const{id:t,msg:n,iframe:o}=e,s=Lt(o);return s||(u(t,`Received: %c${n}`,c.HIGHLIGHT),z(t,"The target iframe was not found.")),s}function hn(e,t){const{id:n}=e,{data:o,origin:s}=t;if("sameOrigin"in t&&t.sameOrigin)return!0;const r=i[n]?.checkOrigin;function l(){function f(){u(n,`Checking connection is from allowed list of origins: %c${r}`,c.HIGHLIGHT);for(const h of r)if(h===s)return!0;return!1}function p(){const h=i[n]?.remoteHost;return u(n,`Checking connection is from: %c${h}`,c.HIGHLIGHT),s===h}return r.constructor===Array?f():p()}if(r&&`${s}`!="null"&&!l())throw new Error(`Unexpected message received from: ${s} for ${n}. Message was: ${o}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`);return!0}const dn=e=>C===`${e}`.slice(0,q)&&e.slice(q).split(":")[0]in i;function gn(e){const{id:t,type:n}=e,o=n in fn;return o&&u(t,"Ignoring init message from meta parent page"),o}function yn(e){try{i[e].sameOrigin=!!i[e]?.iframe?.contentWindow?.iframeChildListener}catch{i[e].sameOrigin=!1}u(e,`sameOrigin: %c${i[e].sameOrigin}`,c.HIGHLIGHT)}function mn(e,t){if(t!==N){if(t===void 0){y(e,`<rb>Legacy version detected in iframe</>
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@iframe-resizer/common/consts"),I=require("@iframe-resizer/common/utils"),ge=require("@iframe-resizer/common/deprecate"),W=require("@iframe-resizer/common/format-advise"),c=require("auto-console-group"),H=require("@iframe-resizer/common/listeners"),O=require("@iframe-resizer/common/mode"),i={},U=I.esModuleInterop(c);let $=!0;const de=U({expand:!1,label:o.PARENT}),he=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,me=e=>i[e]?i[e].log:$;function Ee({enabled:e,expand:t,iframeId:n}){const r=U({expand:t,label:he(n)});$=e,i[n]||(i[n]={console:r})}const A=e=>(t,...n)=>i[t]?i[t].console[e](...n):de[e](...n),V=e=>(t,...n)=>me(t)===!0?A(e)(t,...n):null,u=V("log"),b=u,Ie=V("debug"),w=A("warn"),pe=A("error"),T=A("event"),be=A("purge"),Oe=A("endAutoGroup"),j=A("errorBoundary");function Te(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,$||t<1?o.BOLD:c.NORMAL))}const we=e=>(...t)=>[`${o.LABEL}(${e})`,...t].join(" "),Le=W(I.id),p=(e,...t)=>i[e]?i[e].console.warn(...t.map(Le)):queueMicrotask(()=>{const n=W(we(e));console?.warn(...t.map(n))}),v=ge(p);v("Function");v("Method");v("Option");const y=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:o.VERTICAL,firstRun:!0,inPageLinks:!1,heightCalculationMethod:o.AUTO,id:"iframeResizer",log:!1,logExpand:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:o.AUTO,onBeforeClose:()=>!0,onAfterClose(){},onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady(){},onResized(){},onScroll:()=>!0});let k=0;function He(e){const t=e?.id||y.id+k++;return document.getElementById(t)===null?t:`${t}${k++}`}function Se(e,t){let{id:n}=e;if(n&&!I.isString(n))throw new TypeError("Invalid id for iframe. Expected String");return(!n||n==="")&&(n=He(t),e.id=n,T(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function Ae(e){const{search:t}=window.location;if(t.includes("ifrlog"))switch(new URLSearchParams(t).get("ifrlog")){case String(o.LOG_DISABLED):{e.log=!1;break}case o.EXPAND:case String(o.LOG_EXPANDED):{e.log=o.EXPAND;break}case o.COLLAPSE:case String(o.LOG_COLLAPSED):{e.log=o.COLLAPSE;break}default:e.log=o.COLLAPSE}}const Re=e=>e.split(o.SEPARATOR).filter((t,n)=>n!==19).join(o.SEPARATOR);function Ge(e,t,n){function r(g){const d=e in o.INIT_EVENTS?Re(t):t;b(n,g,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),b(n,`Message data: %c${d}`,c.HIGHLIGHT)}const{iframe:s,postMessageTarget:f,sameOrigin:a,targetOrigin:l}=i[n];if(a)try{s.contentWindow.iframeChildListener(o.MESSAGE_ID+t),r(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in o.INIT_EVENTS?(i[n].sameOrigin=!1,u(n,"New iframe does not support same origin")):w(n,"Same origin messaging failed, falling back to postMessage")}r(`Sending message to iframe: %c${n}%c targetOrigin: %c${l.join(", ")}`);for(const g of l)f.postMessage(o.MESSAGE_ID+t,g)}function G(e,t,n){if(T(n,e),!i[n]?.postMessageTarget){w(n,"Iframe not found");return}Ge(e,t,n)}const Me=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:r})=>n&&!r).forEach(({iframe:n})=>G(e,t,n.id));function ye(){document.hidden!==!0&&Me("tabVisible",o.RESIZE)}function Ne(e){if(e.boxSizing!=="border-box")return 0;const t=e.paddingTop?parseInt(e.paddingTop,10):0,n=e.paddingBottom?parseInt(e.paddingBottom,10):0;return t+n}function Pe(e){if(e.boxSizing!=="border-box")return 0;const t=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,n=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return t+n}function $e(e){const t=e.slice(o.MESSAGE_ID_LENGTH).split(":"),n=t[1]?Number(t[1]):0,r=i[t[0]]?.iframe,s=r?getComputedStyle(r):null,f=s?Ne(s)+Pe(s):0,a={iframe:r,id:t[0],height:n+f,width:Number(t[2]),type:t[3],msg:t[4],message:t[4]};return t[5]&&(a.mode=t[5]),a}const ve={true:1,false:1,undefined:1};function ke(e){const{id:t,msg:n,iframe:r}=e,s=I.isIframe(r);return s||(u(t,`Received: %c${n}`,c.HIGHLIGHT),w(t,"The target iframe was not found.")),s}function De(e,t){const{id:n}=e,{data:r,origin:s}=t;if("sameOrigin"in t&&t.sameOrigin)return!0;const a=i[n]?.checkOrigin;function l(){function g(){u(n,`Checking connection is from allowed list of origins: %c${a}`,c.HIGHLIGHT);for(const h of a)if(h===s)return!0;return!1}function d(){const h=i[n]?.remoteHost;return u(n,`Checking connection is from: %c${h}`,c.HIGHLIGHT),s===h}return a.constructor===Array?g():d()}if(a&&`${s}`!="null"&&!l())throw new Error(`Unexpected message received from: ${s} for ${n}. Message was: ${r}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`);return!0}const _e=e=>o.MESSAGE_ID===`${e}`.slice(0,o.MESSAGE_ID_LENGTH)&&e.slice(o.MESSAGE_ID_LENGTH).split(":")[0]in i;function Ce(e){const{id:t,type:n}=e,r=n in ve;return r&&u(t,"Ignoring init message from meta parent page"),r}function ze(e){try{i[e].sameOrigin=!!i[e]?.iframe?.contentWindow?.iframeChildListener}catch{i[e].sameOrigin=!1}u(e,`sameOrigin: %c${i[e].sameOrigin}`,c.HIGHLIGHT)}function Fe(e,t){if(t!==o.VERSION){if(t===void 0){p(e,`<rb>Legacy version detected in iframe</>
6
2
 
7
3
  Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
8
4
 
9
5
  See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
10
- `);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${N})`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT)}}function T(e,t,n){if(!i[e])return null;const o=i[e][t];if(typeof o!==Ee)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return Ht(o,n);try{return o(n)}catch(s){return console.error(s),z(e,`Error in ${t} callback`),null}}function bn(e,t){const{id:n,iframe:o}=e;u(n,`onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT,c.FOREGROUND),T(n,"onMessage",{iframe:o,message:JSON.parse(t)})}function P(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(S)+Et+t)}function ce(e,t){const{id:n,iframe:o,height:s,type:a,width:r}=t;let l={x:0,y:0};if(r===0&&s===0){const f=P(n,9).split(S);l={x:f[1],y:f[0]}}else l={x:r,y:s};T(n,e,{iframe:o,screenX:Number(l.x),screenY:Number(l.y),type:a})}const d={position:null,version:N};function Ae(){d.position=null}const vn=()=>d.position;function zn(e){d.position=e}function Ge(e){return d.position===null&&(d.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${d.position.x}%c, %c${d.position.y}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),d.position}function Pe(e){d.position!==null&&(window.scrollTo(d.position.x,d.position.y),m(e,`Set page position: %c${d.position.x}%c, %c${d.position.y}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),Ae())}function ae(e,t){const{id:n}=t,o=`${t[e]}px`;i[n].iframe.style[e]=o,m(n,`Set ${e}: %c${o}`,c.HIGHLIGHT)}function Ne(e){const{id:t}=e,{sizeHeight:n,sizeWidth:o}=i[t];n&&ae(dt,e),o&&ae(gt,e)}function le(e){const{id:t}=e;Ne(e),Pe(t),T(t,"onResized",e)}function Ce(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function xe(e){const{id:t}=e;if(T(t,"onBeforeClose",t)===!1){u(t,"Close iframe cancelled by onBeforeClose");return}u(t,`Removing iFrame: %c${t}`,c.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(n){z(t,n)}T(t,"onAfterClose",t),Ce(e)}function _e(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===$?"parent page":"child page"}`),Ge(t),Ne(e),E(W,W,t)}const Fe=(e,t)=>{const n={};return(o,s)=>{const{iframe:a}=i[s];function r(f,p){n[p]||(f(),n[p]=requestAnimationFrame(()=>{n[p]=null}))}function l(){E(`${o} (${e})`,`${e}:${t(a)}`,s)}r(l,s)}},De=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},Be=((e,t)=>n=>{let o=!1;const s=g=>()=>{i[n]?(!o||o===g)&&(e(g,n),o=g,requestAnimationFrame(()=>{o=!1})):h()},a=s(oe),r=s("resize window"),l=new ResizeObserver(s("pageObserver")),f=new ResizeObserver(s("iframeObserver"));function p(g,w){u(n,`${g}listeners for send${t}`),w(window,oe,a),w(window,J,r)}function h(){b(n,`stop${t}`),p("Remove ",re),l.disconnect(),f.disconnect(),i[n]&&re(i[n].iframe,B,h)}function L(){p("Add ",A),l.observe(document.body),f.observe(i[n].iframe)}i[n]&&(i[n][`stop${t}`]=h,A(i[n].iframe,B,h),L())});function wn(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:o,scrollX:s,innerHeight:a,innerWidth:r}=window,{clientHeight:l,clientWidth:f}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(l,a||0),clientWidth:Math.max(f,r||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:o,scrollLeft:s,documentHeight:l,documentWidth:f,windowHeight:a,windowWidth:r})}const In=Fe(ze,wn),En=Be(In,"PageInfo"),Tn=De("stopPageInfo");function On(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,o=typeof window<"u"&&window.visualViewport?window.visualViewport:{},{width:s=0,height:a=0,offsetLeft:r=0,offsetTop:l=0,pageLeft:f=0,pageTop:p=0,scale:h=1}=o;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:s,height:a,offsetLeft:r,offsetTop:l,pageLeft:f,pageTop:p,scale:h}})}const Ln=Fe(we,On),Hn=Be(Ln,"ParentInfo"),kn=De("stopParentInfo");function We(e){const t=e.getBoundingClientRect(),n=Ge(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function Ue(e){const{x:t,y:n}=vn(),o=i[e]?.iframe;if(T(e,"onScroll",{iframe:o,top:n,left:t,x:t,y:n})===!1){Ae();return}Pe(e)}function $n(e){const{id:t,height:n,width:o}=e,s=window.parentIframe||window.parentIFrame||window;m(t,`scrollBy: x: %c${o}%c y: %c${n}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),s.scrollBy(o,n)}const Ve=e=>t=>{const{id:n,iframe:o,height:s,width:a}=t;function r(g){zn(g),Ue(n)}function l(g,w){g[`scrollTo${e?"Offset":""}`](w.x,w.y)}const f=g=>({x:a+g.x,y:s+g.y}),p=e?We(o):{x:0,y:0},h=f(p),L=window.parentIframe||window.parentIFrame;m(n,`Reposition requested (offset x:%c${p.x}%c y:%c${p.y})`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),L?l(L,h):r(h)},Mn=Ve(!1),Sn=Ve(!0);function Rn(e,t,n){const{x:o,y:s}=We(n);m(e,`Moving to in page link: %c#${t}`,c.HIGHLIGHT),d.position={x:o,y:s},Ue(e),window.location.hash=t}function jn(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function An(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){Rn(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}jn(e,n)}function Gn(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function Pn(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,m(e,`Set iframe title attribute: %c${t}`,c.HIGHLIGHT))}const _=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,s=0;s<e.length;s++)o=e.codePointAt(s),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},v=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Nn=new Date,qe=e=>new Set(Array.from({length:9},e)),ue=" - lewpylk",M=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Cn=["<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.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> fvb jhu bzl aol <i>mpyza 11 johyhjalyz vm fvb spjluzl rlf</> av nla h 60% kpzjvbua ha oaawz://pmyhtl-ylzpgly.jvt/wypjpun.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.<iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz.","<yi> VLT rlf lewpylk</><iy><iy>Aol spjluzl rlf fvb hyl bzpun mvy <p>pmyhtl-ylzpgly</> pz myvt h wypvy flhy huk ohz lewpylk. Hu bwkhalk rlf pz ylslhzlk vu aol mpyza vm Uvcltily lhjo flhy.<iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz."],xn=e=>[e[0],...e.slice(1).map(t=>`${t}${ue}`),`${e[4]}${ue}`,...e.slice(1)],_n=xn(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),fe=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),Ze=Nn[v(M[4])](),Fn=qe((e,t)=>_(`${Ze+t}`)),Dn=qe((e,t)=>_(`${Ze-++t}`)),Bn=e=>Fn.has(e)?9:Dn.has(e)?5:-2,I=e=>v(Cn[e]),Wn=e=>v(_n[e]),Un=e=>{const t=e[v(M[0])]||e[v(M[1])]||e[v(M[2])]||e[v(M[3])];if(!t)return-1;const n=t.split("-");let o=(function(s="",a=""){let r=-2;const l=_(v(s));return l in fe&&(r=fe[l]),r===9?Bn(a):r})(...n);return o===0||(s=>s[2]===_(s[0]+s[1]))(n)||(o=-2),o};let Z=!1,Je=!1;function Ye(e,t=-3){if(Z)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw Vt(e),i[e].vAdvised||y(e||"Parent",`${I(n+2)}${I(2)}`),i[e].vAdvised=!0,I(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&Je||Zt(`v${N} (${Wn(n)})`,n),n){case 1:case 2:case 3:y("Parent",I(6));break;case 4:y("Parent",I(7));break;case 5:y("Parent",I(8));break;default:n<1&&y("Parent",I(3))}Z=!0}function Vn(e){if(Z)return;const{mode:t}=i[e];t>5&&Ye(e,t)}function qn(e){e?.log===-1&&(e.log=!1,Je=!0)}function Zn(e,t){i[e]&&(u(e,`First run for ${e}`),Ye(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function Jn(e){const{height:t,id:n,iframe:o,mode:s,message:a,type:r,width:l}=e,{lastMessage:f}=i[n];switch(i[n]?.firstRun&&Zn(n,s),u(n,`Received: %c${f}`,c.HIGHLIGHT),r){case me:i[n].autoResize=JSON.parse(P(n,9));break;case nt:m(n,"Ready state reset"),i[n].initialised=!1;break;case ot:xe(o);break;case it:An(n,P(n,9));break;case $:le(e),yn(n),mn(n,a),i[n].initialised=!0,T(n,"onReady",o);break;case R:bn(e,P(n,6));break;case rt:ce("onMouseEnter",e);break;case ct:ce("onMouseLeave",e);break;case ze:En(n);break;case we:Hn(n);break;case at:Tn(n);break;case lt:kn(n);break;case W:_e(e);break;case ut:$n(e);break;case ft:Mn(e);break;case pt:Sn(e);break;case ht:Pn(n,a);break;default:if(l===0&&t===0){z(n,`Unsupported message received (${r}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(l===0||t===0){u(n,"Ignoring message with 0 height or width");return}if(document.hidden){u(n,"Page hidden - ignored resize request");return}le(e)}}const Yn=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},Xn=e=>Object.values(i).forEach(Yn(e));function pe(e){const t=e.data;if(t===tt){Xn(e.source);return}if(!dn(t)){if(typeof t!==Y)return;b(U,"ignoredMessage"),Wt(U,t);return}const n=un(t),{id:o,type:s}=n;switch(b(o,s),!0){case!i[o]:throw new Error(`${s} No settings for ${o}. Message was: ${t}`);case!pn(n):case gn(n):case!hn(n,e):return;default:i[o].lastMessage=e.data,je(o,Jn)(n)}}const Kn=kt(()=>{A(window,R,pe),A(document,"visibilitychange",cn),window.iframeParentListener=e=>setTimeout(()=>pe({data:e,sameOrigin:!0}))}),he={};function Qn(e){if(he[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;he[e]=!0;const n=Array.from(t).flatMap(o=>[G,o,G]);return y(e,`<rb>Duplicate ID attributes detected</>
6
+ `);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${o.VERSION})`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT)}}function S(e,t,n){if(!i[e])return null;const r=i[e][t];if(typeof r!==o.FUNCTION)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return I.isolateUserCode(r,n);try{return r(n)}catch(s){return console.error(s),w(e,`Error in ${t} callback`),null}}function Be(e,t){const{id:n,iframe:r}=e;u(n,`onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT,c.FOREGROUND),S(n,"onMessage",{iframe:r,message:JSON.parse(t)})}function M(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(o.SEPARATOR)+o.MESSAGE_HEADER_LENGTH+t)}function D(e,t){const{id:n,iframe:r,height:s,type:f,width:a}=t;let l={x:0,y:0};if(a===0&&s===0){const g=M(n,9).split(o.SEPARATOR);l={x:g[1],y:g[0]}}else l={x:a,y:s};S(n,e,{iframe:r,screenX:Number(l.x),screenY:Number(l.y),type:f})}const m={position:null,version:o.VERSION};function q(){m.position=null}const xe=()=>m.position;function We(e){m.position=e}function X(e){return m.position===null&&(m.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${m.position.x}%c, %c${m.position.y}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),m.position}function Z(e){m.position!==null&&(window.scrollTo(m.position.x,m.position.y),b(e,`Set page position: %c${m.position.x}%c, %c${m.position.y}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),q())}function _(e,t){const{id:n}=t,r=`${t[e]}px`;i[n].iframe.style[e]=r,b(n,`Set ${e}: %c${r}`,c.HIGHLIGHT)}function Y(e){const{id:t}=e,{sizeHeight:n,sizeWidth:r}=i[t];n&&_(o.HEIGHT,e),r&&_(o.WIDTH,e)}function C(e){const{id:t}=e;Y(e),Z(t),S(t,"onResized",e)}function J(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function K(e){const{id:t}=e;if(S(t,"onBeforeClose",t)===!1){u(t,"Close iframe cancelled by onBeforeClose");return}u(t,`Removing iframe: %c${t}`,c.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(n){w(t,n)}S(t,"onAfterClose",t),J(e)}function Q(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===o.INIT?"parent page":"child page"}`),X(t),Y(e),G(o.RESET,o.RESET,t)}const ee=(e,t)=>{const n={};return(r,s)=>{const{iframe:f}=i[s];function a(g,d){n[d]||(g(),n[d]=requestAnimationFrame(()=>{n[d]=null}))}function l(){G(`${r} (${e})`,`${e}:${t(f)}`,s)}a(l,s)}},te=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},ne=((e,t)=>n=>{let r=!1;const s=E=>()=>{i[n]?(!r||r===E)&&(e(E,n),r=E,requestAnimationFrame(()=>{r=!1})):h()},f=s(o.SCROLL),a=s("resize window"),l=new ResizeObserver(s("pageObserver")),g=new ResizeObserver(s("iframeObserver"));function d(E,L){u(n,`${E}listeners for send${t}`),L(window,o.SCROLL,f),L(window,o.RESIZE,a)}function h(){T(n,`stop${t}`),d("Remove ",H.removeEventListener),l.disconnect(),g.disconnect(),i[n]&&H.removeEventListener(i[n].iframe,o.LOAD,h)}function R(){d("Add ",H.addEventListener),l.observe(document.body),g.observe(i[n].iframe)}i[n]&&(i[n][`stop${t}`]=h,H.addEventListener(i[n].iframe,o.LOAD,h),R())});function Ue(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:r,scrollX:s,innerHeight:f,innerWidth:a}=window,{clientHeight:l,clientWidth:g}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(l,f||0),clientWidth:Math.max(g,a||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:r,scrollLeft:s,documentHeight:l,documentWidth:g,windowHeight:f,windowWidth:a})}const Ve=ee(o.PAGE_INFO,Ue),je=ne(Ve,"PageInfo"),qe=te("stopPageInfo");function Xe(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,r=typeof window<"u"&&window.visualViewport?window.visualViewport:{},{width:s=0,height:f=0,offsetLeft:a=0,offsetTop:l=0,pageLeft:g=0,pageTop:d=0,scale:h=1}=r;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:s,height:f,offsetLeft:a,offsetTop:l,pageLeft:g,pageTop:d,scale:h}})}const Ze=ee(o.PARENT_INFO,Xe),Ye=ne(Ze,"ParentInfo"),Je=te("stopParentInfo");function oe(e){const t=e.getBoundingClientRect(),n=X(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function ie(e){const{x:t,y:n}=xe(),r=i[e]?.iframe;if(S(e,"onScroll",{iframe:r,top:n,left:t,x:t,y:n})===!1){q();return}Z(e)}function Ke(e){const{id:t,height:n,width:r}=e,s=window.parentIframe||window.parentIFrame||window;b(t,`scrollBy: x: %c${r}%c y: %c${n}`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),s.scrollBy(r,n)}const re=e=>t=>{const{id:n,iframe:r,height:s,width:f}=t;function a(E){We(E),ie(n)}function l(E,L){E[`scrollTo${e?"Offset":""}`](L.x,L.y)}const g=E=>({x:f+E.x,y:s+E.y}),d=e?oe(r):{x:0,y:0},h=g(d),R=window.parentIframe||window.parentIFrame;b(n,`Reposition requested (offset x:%c${d.x}%c y:%c${d.y})`,c.HIGHLIGHT,c.FOREGROUND,c.HIGHLIGHT),R?l(R,h):a(h)},Qe=re(!1),et=re(!0);function tt(e,t,n){const{x:r,y:s}=oe(n);b(e,`Moving to in page link: %c#${t}`,c.HIGHLIGHT),m.position={x:r,y:s},ie(e),window.location.hash=t}function nt(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function ot(e,t){const n=t.split("#")[1]||"",r=decodeURIComponent(n),s=document.getElementById(r)||document.getElementsByName(r)[0];if(s){tt(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}nt(e,n)}function it(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function rt(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,b(e,`Set iframe title attribute: %c${t}`,c.HIGHLIGHT))}let P=!1,se=!1;function ce(e,t=-3){if(P)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw be(e),i[e].vAdvised||p(e||"Parent",`${O.getModeData(n+2)}${O.getModeData(2)}`),i[e].vAdvised=!0,O.getModeData(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&se||Te(`v${o.VERSION} (${O.getModeLabel(n)})`,n),n){case 1:case 2:case 3:p("Parent",O.getModeData(6));break;case 4:p("Parent",O.getModeData(7));break;case 5:p("Parent",O.getModeData(8));break;default:n<1&&p("Parent",O.getModeData(3))}P=!0}function st(e){if(P)return;const{mode:t}=i[e];t>5&&ce(e,t)}function ct(e){e?.log===-1&&(e.log=!1,se=!0)}function at(e,t){i[e]&&(u(e,`First run for ${e}`),ce(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function lt(e){const{height:t,id:n,iframe:r,mode:s,message:f,type:a,width:l}=e,{lastMessage:g}=i[n];switch(i[n]?.firstRun&&at(n,s),u(n,`Received: %c${g}`,c.HIGHLIGHT),a){case o.AUTO_RESIZE:i[n].autoResize=JSON.parse(M(n,9));break;case o.BEFORE_UNLOAD:b(n,"Ready state reset"),i[n].initialised=!1;break;case o.CLOSE:K(r);break;case o.IN_PAGE_LINK:ot(n,M(n,9));break;case o.INIT:C(e),ze(n),Fe(n,f),i[n].initialised=!0,S(n,"onReady",r);break;case o.MESSAGE:Be(e,M(n,6));break;case o.MOUSE_ENTER:D("onMouseEnter",e);break;case o.MOUSE_LEAVE:D("onMouseLeave",e);break;case o.PAGE_INFO:je(n);break;case o.PARENT_INFO:Ye(n);break;case o.PAGE_INFO_STOP:qe(n);break;case o.PARENT_INFO_STOP:Je(n);break;case o.RESET:Q(e);break;case o.SCROLL_BY:Ke(e);break;case o.SCROLL_TO:Qe(e);break;case o.SCROLL_TO_OFFSET:et(e);break;case o.TITLE:rt(n,f);break;default:if(l===0&&t===0){w(n,`Unsupported message received (${a}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(l===0||t===0){u(n,"Ignoring message with 0 height or width");return}if(document.hidden){u(n,"Page hidden - ignored resize request");return}C(e)}}const ft=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},ut=e=>Object.values(i).forEach(ft(e));function z(e){const t=e.data;if(t===o.CHILD_READY_MESSAGE){ut(e.source);return}if(!_e(t)){if(typeof t!==o.STRING)return;T(o.PARENT,"ignoredMessage"),Ie(o.PARENT,t);return}const n=$e(t),{id:r,type:s}=n;switch(T(r,s),!0){case!i[r]:throw new Error(`${s} No settings for ${r}. Message was: ${t}`);case!ke(n):case Ce(n):case!De(n,e):return;default:i[r].lastMessage=e.data,j(r,lt)(n)}}const gt=I.once(()=>{H.addEventListener(window,o.MESSAGE,z),H.addEventListener(document,"visibilitychange",ye),window.iframeParentListener=e=>setTimeout(()=>z({data:e,sameOrigin:!0}))}),F={};function dt(e){if(F[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;F[e]=!0;const n=Array.from(t).flatMap(r=>[o.NEW_LINE,r,o.NEW_LINE]);return p(e,`<rb>Duplicate ID attributes detected</>
11
7
 
12
8
  The <b>${e}</> ID is not unique. Having multiple iframes on the same page with the same ID causes problems with communication between the iframe and parent page. Please ensure that the ID of each iframe has a unique value.
13
9
 
14
- Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,G),!1}const eo=`<rb>Deprecated Method Name</>
15
-
16
- The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${He}`,to=`<rb>Deprecated Method</>
17
-
18
- Use of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As there are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code.`;function no(e){if(i[e]){const{iframe:t}=i[e],n={close:xe.bind(null,t),disconnect:Ce.bind(null,t),moveToAnchor(o){jt(o,Y,"moveToAnchor(anchor) anchor"),E("Move to anchor",`moveToAnchor:${o}`,e)},removeListeners(){y(e,eo),this.disconnect()},resize(){y(e,to),E("Window resize",J,e)},sendMessage(o){o=JSON.stringify(o),E(R,`${R}:${o}`,e)}};t.iframeResizer=n,t.iFrameResizer=n}}const oo="8",io="32",so=vt,ro=!0;function co(e){const{autoResize:t,bodyBackground:n,bodyMargin:o,bodyPadding:s,heightCalculationMethod:a,inPageLinks:r,license:l,log:f,logExpand:p,mouseEvents:h,offsetHeight:L,offsetWidth:g,mode:w,sizeHeight:Xe,sizeWidth:Ke,tolerance:Qe,widthCalculationMethod:et}=i[e];return[e,oo,Ke,f,io,ro,t,o,a,n,s,Qe,r,so,et,h,L,g,Xe,l,d.version,w,"",p].join(S)}const ao="0";function lo(e){const{bodyMargin:t}=i[e];(typeof t===zt||t===ao)&&(i[e].bodyMargin=`${t}px`)}const uo=e=>{try{return new URL(e).origin}catch{return null}},fo=e=>typeof e===Ie&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function po(e,t){const{checkOrigin:n,iframe:{src:o,sandbox:s},initialisedFirstPage:a,waitForLoad:r}=t[e],l=uo(o);b(e,"noResponse"),y(e,`<rb>No response from iframe</>
10
+ Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,o.NEW_LINE),!1}function ht(e){if(i[e]){const{iframe:t}=i[e];t.iframeResizer={close:K.bind(null,t),disconnect:J.bind(null,t),moveToAnchor(n){I.typeAssert(n,o.STRING,"moveToAnchor(anchor) anchor"),G("Move to anchor",`moveToAnchor:${n}`,e)},sendMessage(n){n=JSON.stringify(n),G(o.MESSAGE,`${o.MESSAGE}:${n}`,e)}}}}const mt="8",Et="32",It=o.CHILD,pt=!0;function bt(e){const{autoResize:t,bodyBackground:n,bodyMargin:r,bodyPadding:s,heightCalculationMethod:f,inPageLinks:a,license:l,log:g,logExpand:d,mouseEvents:h,offsetHeight:R,offsetWidth:E,mode:L,sizeHeight:ae,sizeWidth:le,tolerance:fe,widthCalculationMethod:ue}=i[e];return[e,mt,le,g,Et,pt,t,r,f,n,s,fe,a,It,ue,h,R,E,ae,l,m.version,L,"",d].join(o.SEPARATOR)}const Ot="0";function Tt(e){const{bodyMargin:t}=i[e];(typeof t===o.NUMBER||t===Ot)&&(i[e].bodyMargin=`${t}px`)}const wt=e=>{try{return new URL(e).origin}catch{return null}},Lt=e=>typeof e===o.OBJECT&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function Ht(e,t){const{checkOrigin:n,iframe:{src:r,sandbox:s},initialisedFirstPage:f,waitForLoad:a}=t[e],l=wt(r);T(e,"noResponse"),p(e,`<rb>No response from iframe</>
19
11
 
20
12
  The iframe (<i>${e}</>) has not responded within ${t[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
21
13
  ${n&&l?`
22
14
  The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${l}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.
23
- `:""}${r&&!a?`
15
+ `:""}${a&&!f?`
24
16
  The <b>waitForLoad</> option is currently set to <bb>true</>. If the iframe loads before <i>iframe-resizer</> runs, this option will prevent <i>iframe-resizer</> initialising. To disable this option, set <b>waitForLoad</> to <bb>false</>.
25
- `:""}${fo(s)?`
17
+ `:""}${Lt(s)?`
26
18
  The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
27
19
  `:""}
28
20
  This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.
29
- `)}function ho(e,t){function n(){if(t[e]===void 0)return;const{initialised:a,loadErrorShown:r}=t[e];if(t[e].msgTimeout=void 0,a){t[e].initialisedFirstPage=!0;return}r||(t[e].loadErrorShown=!0,po(e,t))}const{msgTimeout:o,warningTimeout:s}=t[e];s&&(o&&clearTimeout(o),t[e].msgTimeout=setTimeout(n,s))}const go=1,yo=e=>e.loading===st,mo=e=>e===$;function bo(e){i[e]?.heightCalculationMethod in Tt&&_e({id:e,iframe:i[e].iframe,height:ne,width:ne,type:$})}function vo(e,t){A(e,B,()=>setTimeout(t,go))}const zo=e=>{const{src:t,srcdoc:n}=e;return!n&&(t==null||t===""||t==="about:blank")};function wo(e,t){const{iframe:n,waitForLoad:o}=i[e];if(o!==!0){if(zo(n)){setTimeout(()=>{b(e,"noContent"),m(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(t)}}function Io(e,t){const n=s=>()=>{if(!i[e])return;const{firstRun:a,iframe:r}=i[e];E(s,t,e),mo(s)&&yo(r)||ho(e,i),a||bo(e)},{iframe:o}=i[e];i[e].initChild=n(be),vo(o,n(ve)),wo(e,n($))}function Eo(e,t){return t?(("sizeWidth"in t||"sizeHeight"in t||me in t)&&y(e,`<rb>Deprecated Option</>
21
+ `)}function St(e,t){function n(){if(t[e]===void 0)return;const{initialised:f,loadErrorShown:a}=t[e];if(t[e].msgTimeout=void 0,f){t[e].initialisedFirstPage=!0;return}a||(t[e].loadErrorShown=!0,Ht(e,t))}const{msgTimeout:r,warningTimeout:s}=t[e];s&&(r&&clearTimeout(r),t[e].msgTimeout=setTimeout(n,s))}const At=1,Rt=e=>e.loading===o.LAZY,Gt=e=>e===o.INIT;function Mt(e){i[e]?.heightCalculationMethod in o.RESET_REQUIRED_METHODS&&Q({id:e,iframe:i[e].iframe,height:o.MIN_SIZE,width:o.MIN_SIZE,type:o.INIT})}function yt(e,t){const n=()=>setTimeout(t,At);H.addEventListener(e,o.LOAD,n)}const Nt=e=>{const{src:t,srcdoc:n}=e;return!n&&(t==null||t===""||t==="about:blank")};function Pt(e,t){const{iframe:n,waitForLoad:r}=i[e];if(r!==!0){if(Nt(n)){setTimeout(()=>{T(e,"noContent"),b(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(t)}}function $t(e,t){const n=s=>()=>{if(!i[e])return;const{firstRun:f,iframe:a}=i[e];G(s,t,e),Gt(s)&&Rt(a)||St(e,i),f||Mt(e)},{iframe:r}=i[e];i[e].initChild=n(o.INIT_FROM_IFRAME),yt(r,n(o.ONLOAD)),Pt(e,n(o.INIT))}function vt(e,t){return t?(("sizeWidth"in t||"sizeHeight"in t||o.AUTO_RESIZE in t)&&p(e,`<rb>Deprecated Option</>
30
22
 
31
- The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${F}</>, <bb>${Le}</>, <bb>${Oe}</> or <bb>${Te}</>.
32
- `),t):{}}function To(e){i[e].warningTimeout||m(e,"warningTimeout:%c disabled",c.HIGHLIGHT)}function Oo(e,{offset:t,offsetSize:n}){const o=n||t;o&&(i[e].direction===F?(i[e].offsetHeight=o,u(e,`Offset height: %c${o}`,c.HIGHLIGHT)):(i[e].offsetWidth=o,u(e,`Offset width: %c${o}`,c.HIGHLIGHT)))}function Lo(e){const{direction:t}=i[e];switch(t){case F:break;case Le:i[e].sizeHeight=!1;case Oe:i[e].sizeWidth=!0;break;case Te:i[e].sizeWidth=!1,i[e].sizeHeight=!1,i[e].autoResize=!1;break;default:throw new TypeError(`Direction value of "${t}" is not valid`)}u(e,`direction: %c${t}`,c.HIGHLIGHT)}const de=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function Ho(e){const{checkOrigin:t,remoteHost:n}=i[e];Array.isArray(t)&&t.length===0&&z(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),i[e].targetOrigin=Array.isArray(t)?t.map(de):[t===!1?"*":de(n)]}function ko(e){const{id:t}=e;i[t].postMessageTarget===null&&(i[t].postMessageTarget=e.contentWindow)}function D(e,t,n){j(i[e],t)&&(y(e,`<rb>Deprecated option</>
23
+ The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${o.VERTICAL}</>, <bb>${o.HORIZONTAL}</>, <bb>${o.BOTH}</> or <bb>${o.NONE}</>.
24
+ `),t):{}}function kt(e){i[e].warningTimeout||b(e,"warningTimeout:%c disabled",c.HIGHLIGHT)}function Dt(e,{offset:t,offsetSize:n}){const r=n||t;r&&(i[e].direction===o.VERTICAL?(i[e].offsetHeight=r,u(e,`Offset height: %c${r}`,c.HIGHLIGHT)):(i[e].offsetWidth=r,u(e,`Offset width: %c${r}`,c.HIGHLIGHT)))}function _t(e){const{direction:t}=i[e];switch(t){case o.VERTICAL:break;case o.HORIZONTAL:i[e].sizeHeight=!1;case o.BOTH:i[e].sizeWidth=!0;break;case o.NONE:i[e].sizeWidth=!1,i[e].sizeHeight=!1,i[e].autoResize=!1;break;default:throw new TypeError(`Direction value of "${t}" is not valid`)}u(e,`direction: %c${t}`,c.HIGHLIGHT)}const B=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function Ct(e){const{checkOrigin:t,remoteHost:n}=i[e];Array.isArray(t)&&t.length===0&&w(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),i[e].targetOrigin=Array.isArray(t)?t.map(B):[t===!1?"*":B(n)]}function zt(e){const{id:t}=e;i[t].postMessageTarget===null&&(i[t].postMessageTarget=e.contentWindow)}function N(e,t,n){I.hasOwn(i[e],t)&&(p(e,`<rb>Deprecated option</>
33
25
 
34
- The <b>${t}</> option has been renamed to <b>${n}</>. ${He}`),i[e][n]=i[e][t],delete i[e][t])}function $o(e){D(e,yt,mt),D(e,"onClose","onBeforeClose"),D(e,"onClosed","onAfterClose")}const Mo=e=>j(e,"onMouseEnter")||j(e,"onMouseLeave");function So(e,t){const{id:n}=e;i[n]={...i[n],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...x,...Eo(n,t),mouseEvents:Mo(t),mode:Un(t),syncTitle:Gn(n)},$o(n),Lo(n),Oo(n,t),To(n),ko(e),Ho(n)}const Ro="yes",ge="no";function jo(e){const{id:t}=e;switch(u(t,`Iframe scrolling ${i[t]?.scrolling?"enabled":"disabled"} for ${t}`),e.style.overflow=i[t]?.scrolling===!1?bt:V,i[t]?.scrolling){case It:break;case!0:e.scrolling=Ro;break;case!1:e.scrolling=ge;break;default:e.scrolling=i[t]?.scrolling||ge}}function Ao(e,t,n){So(t,n),u(e,`src: %c${t.srcdoc||t.src}`,c.HIGHLIGHT),Vn(e),jo(t),lo(e),Io(e,co(e)),no(e),u(e,"Setup complete")}function Go(e,t){const{id:n}=e;b(n,"setup"),Qn(n)&&Ao(n,e,t),qt(n)}function Po(e,t){t.log===X?t.log=!1:t.log===K?t.log=k:t.log===Q&&(t.log=H);const n=j(t,"log"),o=ee(t.log),s=n?o?!0:t.log:x.log;j(t,"logExpand")||(t.logExpand=n&&o?t.log===H:x.logExpand),qn(t),Bt({enabled:s,expand:t.logExpand,iframeId:e}),o&&!(t.log in Ot)&&Ut(e,`Invalid value for options.log: Accepted values are "${H}" and "${k}"`),t.log=s}function No(e){if(!ke(e))throw new TypeError("Options is not an object");return Kn(),nn(e),t=>{const n=tn(t,e);return ye in t?(b(n,"alreadySetup"),z(n,`Ignored iframe (${n}), already setup.`)):(Po(n,e),je(n,Go)(t,e)),t?.iframeResizer}}exports.LOG_COLLAPSED=K;exports.LOG_DISABLED=X;exports.LOG_EXPANDED=Q;exports.default=No;
26
+ The <b>${t}</> option has been renamed to <b>${n}</>. ${o.REMOVED_NEXT_VERSION}`),i[e][n]=i[e][t],delete i[e][t])}function Ft(e){N(e,o.OFFSET,o.OFFSET_SIZE),N(e,"onClose","onBeforeClose"),N(e,"onClosed","onAfterClose")}const Bt=e=>I.hasOwn(e,"onMouseEnter")||I.hasOwn(e,"onMouseLeave");function xt(e,t){const{id:n}=e;i[n]={...i[n],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...y,...vt(n,t),mouseEvents:Bt(t),mode:O(t),syncTitle:it(n)},Ft(n),_t(n),Dt(n,t),kt(n),zt(e),Ct(n)}const Wt="yes",x="no";function Ut(e){const{id:t}=e;switch(u(t,`Iframe scrolling ${i[t]?.scrolling?"enabled":"disabled"} for ${t}`),e.style.overflow=i[t]?.scrolling===!1?o.HIDDEN:o.AUTO,i[t]?.scrolling){case o.OMIT:break;case!0:e.scrolling=Wt;break;case!1:e.scrolling=x;break;default:e.scrolling=i[t]?.scrolling||x}}function Vt(e,t,n){xt(t,n),u(e,`src: %c${t.srcdoc||t.src}`,c.HIGHLIGHT),st(e),Ut(t),Tt(e),$t(e,bt(e)),ht(e),u(e,"Setup complete")}function jt(e,t){const{id:n}=e;T(n,"setup"),dt(n)&&Vt(n,e,t),Oe(n)}function qt(e,t){t.log===o.LOG_DISABLED?t.log=!1:t.log===o.LOG_COLLAPSED?t.log=o.COLLAPSE:t.log===o.LOG_EXPANDED&&(t.log=o.EXPAND);const n=I.hasOwn(t,"log"),r=I.isString(t.log),s=n?r?!0:t.log:y.log;I.hasOwn(t,"logExpand")||(t.logExpand=n&&r?t.log===o.EXPAND:y.logExpand),ct(t),Ee({enabled:s,expand:t.logExpand,iframeId:e}),r&&!(t.log in o.LOG_OPTIONS)&&pe(e,`Invalid value for options.log: Accepted values are "${o.EXPAND}" and "${o.COLLAPSE}"`),t.log=s}function Xt(e){if(!I.isObject(e))throw new TypeError("Options is not an object");return gt(),Ae(e),t=>{const n=Se(t,e);return o.LABEL in t?(T(n,"alreadySetup"),w(n,`Ignored iframe (${n}), already setup.`)):(qt(n,e),j(n,jt)(t,e)),t?.iframeResizer}}Object.defineProperty(exports,"LOG_COLLAPSED",{enumerable:!0,get:()=>o.LOG_COLLAPSED});Object.defineProperty(exports,"LOG_DISABLED",{enumerable:!0,get:()=>o.LOG_DISABLED});Object.defineProperty(exports,"LOG_EXPANDED",{enumerable:!0,get:()=>o.LOG_EXPANDED});exports.default=Xt;
35
27
  //# sourceMappingURL=index.cjs.js.map