@iframe-resizer/child 6.0.0-beta.3 → 6.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js CHANGED
@@ -1,32 +1,28 @@
1
- (function(s,T){typeof exports=="object"&&typeof module<"u"?T(require("auto-console-group")):typeof define=="function"&&define.amd?define(["auto-console-group"],T):(s=typeof globalThis<"u"?globalThis:s||self,T(s.acg))})(this,(function(s){"use strict";const T="6.0.0-beta.3",ve="iframeResizer",zn="[iFrameResizerChild]Ready",wn="autoResize",En="beforeUnload",In="close",On="inPageLink",te="init",be="message",Sn="mouseenter",Rn="mouseleave",Xe="pageHide",Tn="pageInfo",et="parentInfo",Hn="parentInfoStop",Mn="scrollBy",Ln="scrollTo",tt="scrollToOffset",kn="title",ze="data-iframe-size",nt="data-iframe-overflowed",B="data-iframe-ignore",ne="height",ot="width",st="offsetSize",U="string",G="number",An="boolean",Nn="object",we="function",$n="undefined",Gn="false",Cn="null",W="auto",rt="readystatechange",it="bottom",ct="right",Ee="autoResizeEnabled",at=Symbol("sizeChanged"),Ie="manualResize",Oe="parentResize",Se={[Ie]:1,[Oe]:1},lt="setOffsetSize",ut="resizeObserver",Re="overflowObserver",dt="mutationObserver",ft="visibilityObserver",jn="font-weight: bold;",Te="none",mt="No change in content size detected",oe="[iFrameSizer]",ht=oe.length,Pn=W,pt=128,yt=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),_n=e=>typeof e===U,se=(e,...t)=>setTimeout(()=>e(...t),0),gt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},re=e=>e,vt=1e3,C=e=>Math.round(e*vt)/vt,bt=e=>e.charAt(0).toUpperCase()+e.slice(1),k=e=>`${e}`!=""&&e!==void 0,Dn=e=>e(),xn=e=>e.toLowerCase();function Fn(e){switch(!0){case!k(e):return"";case k(e.id):return`${e.nodeName}#${e.id}`;case k(e.name):return`${e.nodeName} (${e.name}`;case k(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const Bn=e=>e?.__esModule?e.default:e,w=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${bt(t)}`)},zt={br:`
2
- `,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},Un=Object.keys(zt),Wn=new RegExp(`<(${Un.join("|")})>`,"gi"),Vn=(e,t)=>zt[t]??"",qn=e=>e.replace(Wn,Vn),Zn=e=>e.replaceAll("<br>",`
3
- `).replaceAll(/<\/?[^>]+>/gi,""),Yn=e=>t=>e(_n(t)?window.chrome?qn(t):Zn(t):t);let He=!0,wt=ve;const V=Bn(s)({label:`${ve}(child)`,expand:!1});function Qn(e){wt=e.id||ve,V.label(`${wt}`),V.expand(e.expand),He=e.enabled}const Et=e=>(...t)=>He?V[e](...t):!0,l=Et("log"),u=l,ie=Et("debug");function Jn(e,t){console.info(`%ciframe-resizer ${e}`,He||t<1?jn:s.NORMAL)}const{assert:Kn,endAutoGroup:j,error:It,errorBoundary:Me,event:h,label:ii,purge:ci,warn:_}=V,Ot=Yn(re),z=(...e)=>V.warn(...e.map(Ot)),Xn=(...e)=>console.warn(...e.map(Ot)),Le=[];function St(e,t){l(`${e} event listener: %c${t}`,s.HIGHLIGHT)}const Rt=(e,t,n,o)=>{e.removeEventListener(t,n,o),St("Removed",t)},A=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Le.push(()=>Rt(e,t,n,o)),St("Added",t)},i={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let Tt=!1;function Ht(e){const t=window?.iframeResizer?.targetOrigin||"*",n=Array.isArray(t)?t:[t];for(const o of n)e.postMessage(zn,o)}function Mt(){if(document.readyState==="loading"||!i.firstRun||Tt)return;const{parent:e,top:t}=window;h("ready"),l("Sending%c ready%c to parent from",s.HIGHLIGHT,s.FOREGROUND,window.location.href),Ht(e),e!==t&&Ht(t),Tt=!0}const Lt="iframeResize",eo=e=>oe===`${e.data}`.slice(0,ht),to=()=>Lt in window||window.jQuery!==void 0&&Lt in window.jQuery.prototype,no=e=>e.data.split(":")[2]in{true:1,false:1},oo=()=>[document.documentElement,document.body],so=["min-height","min-width","max-height","max-width"],kt=new Set,ro=e=>!!e&&e!=="0px"&&e!==W&&e!==Te,At=e=>e.tagName?e.tagName.toLowerCase():"unknown",Nt=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),io=(e,t)=>ro(Nt(e,t));function co(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}function ao({href:e}){kt.has(e)||(l("Unable to access stylesheet:",e),kt.add(e))}function lo(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[]){if(!("selectorText"in o))continue;const r=o;if(!e.matches(r.selectorText))continue;const d=r.style.getPropertyValue(t);if(!d)continue;const{ownerNode:a}=n;return{source:a instanceof Element&&a.tagName==="STYLE"?"an inline <style> block":`stylesheet (${n.href})`,value:d}}}catch{ao(n)}return{source:"cross-origin stylesheet",value:Nt(e,t)}}const uo=(e,t)=>co(e,t)||lo(e,t),fo=(e,t)=>{const{source:n,value:o}=uo(e,t),r=At(e);z(`The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${r}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.
1
+ (function(n,i){typeof exports=="object"&&typeof module<"u"?i(require("@iframe-resizer/common"),require("auto-console-group")):typeof define=="function"&&define.amd?define(["@iframe-resizer/common","auto-console-group"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.common,n.acg))})(this,(function(n,i){"use strict";let ne=!0,Ae=n.LABEL;const C=n.esModuleInterop(i)({label:`${n.LABEL}(child)`,expand:!1});function St(e){Ae=e.id||n.LABEL,C.label(`${Ae}`),C.expand(e.expand),ne=e.enabled}const Ne=e=>(...t)=>ne?C[e](...t):!0,d=Ne("log"),f=d,W=Ne("debug");function Tt(e,t){console.info(`%ciframe-resizer ${e}`,ne||t<1?n.BOLD:i.NORMAL)}const{assert:Rt,endAutoGroup:G,error:Me,errorBoundary:re,event:E,label:ps,purge:Os,warn:$}=C,Le=n.createFormatAdvise(n.id),T=(...e)=>C.warn(...e.map(Le)),bt=(...e)=>console.warn(...e.map(Le)),se=n.deprecate((e,t)=>T(t));se("Method"),se("Method","replaced with"),se("Option");const ie=[];function Ge(e,t){d(`${e} event listener: %c${t}`,i.HIGHLIGHT)}const ze=(e,t,r,s)=>{e.removeEventListener(t,r,s),Ge("Removed",t)},N=(e,t,r,s=!1)=>{e.addEventListener(t,r,s),ie.push(()=>ze(e,t,r,s)),Ge("Added",t)},a={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let $e=!1;function _e(e){const t=window?.iframeResizer?.targetOrigin||"*",r=Array.isArray(t)?t:[t];for(const s of r)e.postMessage(n.CHILD_READY_MESSAGE,s)}function ke(){if(document.readyState==="loading"||!a.firstRun||$e)return;const{parent:e,top:t}=window;E("ready"),d("Sending%c ready%c to parent from",i.HIGHLIGHT,i.FOREGROUND,window.location.href),_e(e),e!==t&&_e(t),$e=!0}const Ce="iframeResize",wt=e=>n.MESSAGE_ID===`${e.data}`.slice(0,n.MESSAGE_ID_LENGTH),vt=()=>Ce in window||window.jQuery!==void 0&&Ce in window.jQuery.prototype,yt=e=>e.data.split(n.SEPARATOR)[2]in{true:1,false:1},Ht=()=>[document.documentElement,document.body],At=["min-height","min-width","max-height","max-width"],De=new Set,Nt=e=>!!e&&e!=="0px"&&e!==n.AUTO&&e!==n.NONE,Pe=e=>e.tagName?e.tagName.toLowerCase():"unknown",Be=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Mt=(e,t)=>Nt(Be(e,t));function Lt(e,t){const r=e.style.getPropertyValue(t);return r?{source:"an inline style attribute",value:r}:null}function Gt({href:e}){De.has(e)||(d("Unable to access stylesheet:",e),De.add(e))}function zt(e,t){for(const r of document.styleSheets)try{for(const s of r.cssRules||[]){if(!("selectorText"in s))continue;const o=s;if(!e.matches(o.selectorText))continue;const u=o.style.getPropertyValue(t);if(!u)continue;const{ownerNode:l}=r;return{source:l instanceof Element&&l.tagName==="STYLE"?"an inline <style> block":`stylesheet (${r.href})`,value:u}}}catch{Gt(r)}return{source:"cross-origin stylesheet",value:Be(e,t)}}const $t=(e,t)=>Lt(e,t)||zt(e,t),_t=(e,t)=>{const{source:r,value:s}=$t(e,t),o=Pe(e);T(`The <b>${t}</> CSS property is set to <b>${s}</> on the <b><${o}></> element via ${r}. This may cause issues with the correct operation of <i>iframe-resizer</>.
4
2
 
5
- If you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function mo(){for(const e of oo())for(const t of so)l(`Checking <${At(e)}> for blocking CSS: ${t}`),io(e,t)&&fo(e,t)}const ho=({calculateWidth:e,calculateHeight:t})=>e===t,c={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:W,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:W,onBeforeResize:void 0,onMessage:()=>{_("onMessage function not defined")},onReady:()=>{}};function po(){try{i.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{l("Cross domain iframe detected")}}let $t=0;function yo(e){const t=e.length===1?"":"s";_(`%c[${B}]%c found on %c${e.length}%c element${t}`,s.BOLD,s.NORMAL,s.BOLD,s.NORMAL)}function go(){const e=document.querySelectorAll(`*[${B}]`),t=e.length>0;return t&&e.length!==$t&&(yo(e),$t=e.length),t}const ce=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),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)},H=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),vo=new Date,Gt=e=>new Set(Array.from({length:9},e)),Ct=" - lewpylk",D=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],bo=["<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</>. 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.","<yi>Bzl dpao slnhjf jspluaz</><iy><iy>Dolu bzpun <p>pmyhtl-ylzpgly</> jopsk whjrhnl dpao hu vskly clyzpvu vm aol whylua, fvb jhu zla aol spjluzl rlf pu aol pmyhtl. Mvy klahpsz vu ovd av zla aopz bw, wslhzl zll aol kvjbtluahapvu ha:<iy><iy>oaawz://pmyhtl-ylzpgly.jvt/zlabw/jopsk/#spjluzl"],zo=e=>[e[0],...e.slice(1).map(t=>`${t}${Ct}`),`${e[4]}${Ct}`,...e.slice(1)],wo=zo(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),jt=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),Eo=new Set([1,6]),Pt=vo[H(D[4])](),Io=Gt((e,t)=>ce(`${Pt+t}`)),Oo=Gt((e,t)=>ce(`${Pt-++t}`)),So=e=>Io.has(e)?9:Oo.has(e)?5:-2,ke=e=>Eo.has(e),M=e=>H(bo[e]),Ro=e=>H(wo[e]),_t=e=>H(D[e]),Dt=e=>{const t=e[H(D[0])]||e[H(D[1])]||e[H(D[2])]||e[H(D[3])];if(!t)return-1;const n=t.split("-");let o=(function(r="",d=""){let a=-2;const f=ce(H(r));return f in jt&&(a=jt[f]),a===9?So(d):a})(...n);return o===0||(r=>r[2]===ce(r[0]+r[1]))(n)||(o=-2),o};function To(e,t,n){(!k(n)||t>-1&&e>t)&&(Jn(`v${T} (${Ro(e)})`,e),e===0&&Xn(M(3)))}function Ho({key:e,key2:t,mode:n,version:o}){const r=n,d=k(e)?Dt({key:e}):-1,a=k(t)?Dt({key:t}):-1;let f;switch(n=Math.max(d,a),n){case-2:case-1:f=`${M(Math.min(d,a)+2)}${M(2)}`,i.firstRun=!1;break;case 1:case 2:case 3:f=M(6);break;case 4:f=M(7);break;case 5:f=M(8);break}if(n>=0&&To(n,r,o),(!k(o)||!i.firstRun)&&(f&&z(f),n<0))throw z(M(9)),f.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");c.mode=n}const Mo="BackCompat",Lo=`<rb>Quirks Mode Detected</>
3
+ If you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function kt(){for(const e of Ht())for(const t of At)d(`Checking <${Pe(e)}> for blocking CSS: ${t}`),Mt(e,t)&&_t(e,t)}const Ct=({calculateWidth:e,calculateHeight:t})=>e===t,c={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:n.AUTO,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:n.AUTO,onBeforeResize:void 0,onMessage:()=>{$("onMessage function not defined")},onReady:()=>{}};function Dt(){try{a.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{d("Cross domain iframe detected")}}let Fe=0;function Pt(e){const t=e.length===1?"":"s";$(`%c[${n.IGNORE_ATTR}]%c found on %c${e.length}%c element${t}`,i.BOLD,i.NORMAL,i.BOLD,i.NORMAL)}function Bt(){const e=document.querySelectorAll(`*[${n.IGNORE_ATTR}]`),t=e.length>0;return t&&e.length!==Fe&&(Pt(e),Fe=e.length),t}function Ft(e,t,r){(!n.isDef(r)||t>-1&&e>t)&&(Tt(`v${n.VERSION} (${n.getModeLabel(e)})`,e),e===0&&bt(n.getModeData(3)))}function Ut({key:e,key2:t,mode:r,version:s}){const o=r,u=n.isDef(e)?n.setMode({key:e}):-1,l=n.isDef(t)?n.setMode({key:t}):-1;let g;switch(r=Math.max(u,l),r){case-2:case-1:g=`${n.getModeData(Math.min(u,l)+2)}${n.getModeData(2)}`,a.firstRun=!1;break;case 1:case 2:case 3:g=n.getModeData(6);break;case 4:g=n.getModeData(7);break;case 5:g=n.getModeData(8);break}if(r>=0&&Ft(r,o,s),(!n.isDef(s)||!a.firstRun)&&(g&&T(g),r<0))throw T(n.getModeData(9)),g.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");c.mode=r}const mt="BackCompat",xt=`<rb>Quirks Mode Detected</>
6
4
 
7
5
  This iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.
8
6
 
9
7
  For more information see <u>https://iframe-resizer.com/quirks-mode</>.
10
- `;function ko(){document.compatMode===Mo&&z(Lo)}const Ao="complete";let xt=!1;function Ft(e){document.readyState===Ao?se(e):xt||A(document,rt,()=>Ft(e)),xt=!0}const No=()=>{u(`Set targetOrigin for parent: %c${c.targetOrigin}`,s.HIGHLIGHT),c.autoResize!==!0&&l("Auto Resize disabled")};function Bt(){i.taggedElements=document.querySelectorAll(`[${ze}]`),i.hasTags=i.taggedElements.length>0,l(`Tagged elements found: %c${i.hasTags}`,s.HIGHLIGHT)}const $o=`<rb>Legacy version detected on parent page</>
8
+ `;function Vt(){document.compatMode===mt&&T(xt)}const Wt="complete";let Ue=!1;function me(e){document.readyState===Wt?n.isolateUserCode(e):Ue||N(document,n.READY_STATE_CHANGE,()=>me(e)),Ue=!0}const Zt=()=>{f(`Set targetOrigin for parent: %c${c.targetOrigin}`,i.HIGHLIGHT),c.autoResize!==!0&&d("Auto Resize disabled")};function xe(){a.taggedElements=document.querySelectorAll(`[${n.SIZE_ATTR}]`),a.hasTags=a.taggedElements.length>0,d(`Tagged elements found: %c${a.hasTags}`,i.HIGHLIGHT)}const qt=`<rb>Legacy version detected on parent page</>
11
9
 
12
10
  Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
13
11
 
14
12
  See <u>https://iframe-resizer.com/setup/</> for more details.
15
- `,Go=e=>`<b>Version mismatch</>
13
+ `,jt=e=>`<b>Version mismatch</>
16
14
 
17
15
  The parent and child pages are running different versions of <i>iframe resizer</>.
18
16
 
19
- Parent page: ${e} - Child page: ${T}.
20
- `;function Co({version:e}){!e||e===""||e===Gn?z($o):e!==T&&z(Go(e))}const jo=gt(()=>z(M(4)));function Po(e){if(!i.timerActive)return;const t=C(performance.now()-i.totalTime),n=e===te?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;l(n,s.HIGHLIGHT)}function _o(e){return e===void 0?e=c.targetOrigin:l(`Message targetOrigin: %c${e}`,s.HIGHLIGHT),e}function Do(e,t){const{mode:n}=c,{sameOrigin:o,target:r}=i;if(o)try{window.parent.iframeParentListener(oe+e)}catch(d){if(ke(n))jo();else throw new Error(d);return!1}else{Kn(r,"Internal error: postMessage target is undefined");const d=_o(t),a=Array.isArray(d)?d:[d];for(const f of a)r.postMessage(oe+e,f)}return!0}function Ut(e,t,n,o,r){const{parentId:d}=c,{sameOrigin:a}=i,f=`${e}:${t}`,v=`${d}:${f}:${n}${o===void 0?"":`:${o}`}`;c.mode<-1||!Do(v,r)||(Po(n),u(`Sending message to parent page via ${a?"sameOrigin":"postMessage"}: %c%c${v}`,s.ITALIC,s.HIGHLIGHT))}const g=Me((e,t,n,o,r)=>{h(n),Ut(e,t,n,o,r),j()}),xo=e=>g(0,0,e.type,`${e.screenY}:${e.screenX}`);function Wt(e,t){l(`Add event listener: %c${t}`,s.HIGHLIGHT),A(window.document,e,xo)}function Fo({mouseEvents:e}){e===!0&&(Wt(Sn,"Mouse Enter"),Wt(Rn,"Mouse Leave"))}const Bo=()=>g(0,0,En);function Uo({persisted:e}){e||Bo(),h(Xe),u("Page persisted:",e),!e&&Le.forEach(Dn)}const Wo=()=>A(window,xn(Xe),Uo),Vt=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function Vo(e,t){const{calculateHeight:n,calculateWidth:o}=c,{height:r,width:d}=i;return n&&Vt(r,e)||o&&Vt(d,t)}const N=[s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT],ae={height:0,width:0},x={height:0,width:0};function F(e,t,n){return x[e]=t,ae[e]=n,t}function qo(e){const t=e.getOffset();return t!==0&&u(`Page offsetSize: %c${t}px`,s.HIGHLIGHT),t}const Zo=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function qt(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=i,r=e.label,d=r===ne,a=e.boundingClientRect(),f=Math.ceil(a),v=Math.floor(a),m=Zo(e),b=`HTML: %c${a}px %cPage: %c${m}px`;let p;switch(!0){case!e.enabled():return Math.max(m,1);case n:u("Found element with data-iframe-size attribute"),p=e.taggedElement();break;case(!t&&i.firstRun&&x[r]===0&&ae[r]===0):u(`Initial page size values: ${b}`,...N),p=F(r,a,m);break;case(o&&a===x[r]&&m===ae[r]):u(`Size unchanged: ${b}`,...N),p=Math.max(a,m);break;case(a===0&&m!==0):u(`Page is hidden: ${b}`,...N),p=m;break;case(!t&&a!==x[r]&&m<=ae[r]):u(`New <html> size: ${b} `,...N),u(`Previous <html> size: %c${x[r]}px`,s.HIGHLIGHT),p=F(r,a,m);break;case!d:p=e.taggedElement();break;case(!t&&a<x[r]):u(`<html> size decreased: ${b}`,...N),p=F(r,a,m);break;case(m===v||m===f):u(`<html> size equals page size: ${b}`,...N),p=F(r,a,m);break;case a>m:u(`Page size < <html> size: ${b}`,...N),p=F(r,a,m);break;case t:u("Found elements possibly overflowing <html> "),p=e.taggedElement();break;default:u(`Using <html> size: ${b}`,...N),p=F(r,a,m)}return u(`Content ${r}: %c${p}px`,s.HIGHLIGHT),p+=qo(e),Math.max(p,1)}const Yo=5*1e3,Qo=4,Jo=10,Ko=100,Ae="--ifr-start",le="--ifr-end",Zt="--ifr-measure",y=[];let ue={},Yt=0,Ne;function Qt(){try{performance.clearMarks(Ae),performance.clearMarks(le),performance.clearMeasures(Zt)}catch{}}function Xo(){Ne=setInterval(()=>{if(y.length<Jo||ue.hasTags&&ue.len<25)return;y.sort();const e=Math.min(y.reduce((n,o)=>n+o,0)/y.length,y[Math.floor(y.length/2)]),t=C(e);t>Yt&&(Yt=t,h("performanceObserver"),l("Mean time:",C(y[Math.floor(y.length/2)])),l("Median time:",C(y.reduce((n,o)=>n+o,0)/y.length)),l("Average time:",t),l("Max time:",C(Math.max(...y)))),Qt(),!(e<=Qo)&&(clearInterval(Ne),z(`<rb>Performance Warning</>
17
+ Parent page: ${e} - Child page: ${n.VERSION}.
18
+ `;function Yt({version:e}){!e||e===""||e===n.FALSE?T(qt):e!==n.VERSION&&T(jt(e))}const Qt=n.once(()=>T(n.getModeData(4)));function Kt(e){if(!a.timerActive)return;const t=n.round(performance.now()-a.totalTime),r=e===n.INIT?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;d(r,i.HIGHLIGHT)}function Jt(e){return e===void 0?e=c.targetOrigin:d(`Message targetOrigin: %c${e}`,i.HIGHLIGHT),e}function Xt(e,t){const{mode:r}=c,{sameOrigin:s,target:o}=a;if(s)try{window.parent.iframeParentListener(n.MESSAGE_ID+e)}catch(u){if(n.checkMode(r))Qt();else throw new Error(u);return!1}else{Rt(o,"Internal error: postMessage target is undefined");const u=Jt(t),l=Array.isArray(u)?u:[u];for(const g of l)o.postMessage(n.MESSAGE_ID+e,g)}return!0}function Ve(e,t,r,s,o){const{parentId:u}=c,{sameOrigin:l}=a,g=`${e}:${t}`,S=`${u}:${g}:${r}${s===void 0?"":`:${s}`}`;c.mode<-1||!Xt(S,o)||(Kt(r),f(`Sending message to parent page via ${l?"sameOrigin":"postMessage"}: %c%c${S}`,i.ITALIC,i.HIGHLIGHT))}const O=re((e,t,r,s,o)=>{E(r),Ve(e,t,r,s,o),G()}),en=e=>O(0,0,e.type,`${e.screenY}:${e.screenX}`);function We(e,t){d(`Add event listener: %c${t}`,i.HIGHLIGHT),N(window.document,e,en)}function tn({mouseEvents:e}){e===!0&&(We(n.MOUSE_ENTER,"Mouse Enter"),We(n.MOUSE_LEAVE,"Mouse Leave"))}const nn=()=>O(0,0,n.BEFORE_UNLOAD);function rn({persisted:e}){e||nn(),E(n.PAGE_HIDE),f("Page persisted:",e),!e&&ie.forEach(n.invoke)}const sn=()=>N(window,n.lower(n.PAGE_HIDE),rn),Ze=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function on(e,t){const{calculateHeight:r,calculateWidth:s}=c,{height:o,width:u}=a;return r&&Ze(o,e)||s&&Ze(u,t)}const M=[i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT],Z={height:0,width:0},_={height:0,width:0};function k(e,t,r){return _[e]=t,Z[e]=r,t}function an(e){const t=e.getOffset();return t!==0&&f(`Page offsetSize: %c${t}px`,i.HIGHLIGHT),t}const cn=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function qe(e){const{hasOverflow:t,hasTags:r,triggerLocked:s}=a,o=e.label,u=o===n.HEIGHT,l=e.boundingClientRect(),g=Math.ceil(l),S=Math.floor(l),h=cn(e),R=`HTML: %c${l}px %cPage: %c${h}px`;let I;switch(!0){case!e.enabled():return Math.max(h,n.MIN_SIZE);case r:f("Found element with data-iframe-size attribute"),I=e.taggedElement();break;case(!t&&a.firstRun&&_[o]===0&&Z[o]===0):f(`Initial page size values: ${R}`,...M),I=k(o,l,h);break;case(s&&l===_[o]&&h===Z[o]):f(`Size unchanged: ${R}`,...M),I=Math.max(l,h);break;case(l===0&&h!==0):f(`Page is hidden: ${R}`,...M),I=h;break;case(!t&&l!==_[o]&&h<=Z[o]):f(`New <html> size: ${R} `,...M),f(`Previous <html> size: %c${_[o]}px`,i.HIGHLIGHT),I=k(o,l,h);break;case!u:I=e.taggedElement();break;case(!t&&l<_[o]):f(`<html> size decreased: ${R}`,...M),I=k(o,l,h);break;case(h===S||h===g):f(`<html> size equals page size: ${R}`,...M),I=k(o,l,h);break;case l>h:f(`Page size < <html> size: ${R}`,...M),I=k(o,l,h);break;case t:f("Found elements possibly overflowing <html> "),I=e.taggedElement();break;default:f(`Using <html> size: ${R}`,...M),I=k(o,l,h)}return f(`Content ${o}: %c${I}px`,i.HIGHLIGHT),I+=an(e),Math.max(I,n.MIN_SIZE)}const dn=5*1e3,ln=4,fn=10,un=100,oe="--ifr-start",q="--ifr-end",je="--ifr-measure",p=[];let j={},Ye=0,ae;function Qe(){try{performance.clearMarks(oe),performance.clearMarks(q),performance.clearMeasures(je)}catch{}}function gn(){ae=setInterval(()=>{if(p.length<fn||j.hasTags&&j.len<25)return;p.sort();const e=Math.min(p.reduce((r,s)=>r+s,0)/p.length,p[Math.floor(p.length/2)]),t=n.round(e);t>Ye&&(Ye=t,E("performanceObserver"),d("Mean time:",n.round(p[Math.floor(p.length/2)])),d("Median time:",n.round(p.reduce((r,s)=>r+s,0)/p.length)),d("Average time:",t),d("Max time:",n.round(Math.max(...p)))),Qe(),!(e<=ln)&&(clearInterval(ae),T(`<rb>Performance Warning</>
21
19
 
22
- Calculating the page size is taking an excessive amount of time (${C(e)}ms).
20
+ Calculating the page size is taking an excessive amount of time (${n.round(e)}ms).
23
21
 
24
- To improve performance add the <b>data-iframe-size</> attribute to the ${ue.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},Yo)}function es(e){e.getEntries().forEach(t=>{if(t.name===le)try{const{duration:n}=performance.measure(Zt,Ae,le);ue=t.detail,y.push(n),y.length>Ko&&y.shift()}catch{}})}function ts(){u("Attached%c PerformanceObserver%c to page",s.HIGHLIGHT,s.FOREGROUND);const e=new PerformanceObserver(es);return e.observe({entryTypes:["mark"]}),Xo(),{disconnect:()=>{Qt(),clearInterval(Ne),e.disconnect(),u("Detached%c PerformanceObserver",s.HIGHLIGHT)}}}const ns=e=>`:not(${e})`,os=`* ${Array.from(yt).map(ns).join("")}`,$e=e=>e.querySelectorAll(os);function ss(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=i;return t?o:e?Array.from(n):$e(document.documentElement)}function rs(e,t){const n=`margin-${t}`;let o,r=document.documentElement,d=i.hasTags?1:document.documentElement.getBoundingClientRect().bottom;for(const a of e)o=a.getBoundingClientRect()[t]+parseFloat(getComputedStyle(a).getPropertyValue(n)),o>d&&(d=o,r=a);return{maxEl:r,maxVal:d}}function Jt(e){performance.mark(Ae);const t=bt(e),{logging:n}=c,{hasTags:o}=i,r=ss(),{maxEl:d,maxVal:a}=rs(r,e);return u(`${t} position calculated from:`,d),u(`Checked %c${r.length}%c elements`,s.HIGHLIGHT,s.FOREGROUND),performance.mark(le,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),a}const Ge={label:ne,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>qt(Ge),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>Jt(it)},Ce={label:ot,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>qt(Ce),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>Jt(ct)};function is(e,t,n){const o=c.onBeforeResize(e,t,n);if(o===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(o))throw new TypeError(`Invalid value returned from onBeforeResize(): ${o}, expected Number`);if(o<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least 1`);return o}const Kt=(e,t)=>(n,o)=>{const r=e[n]();return e.enabled()&&c.onBeforeResize!==void 0?is(r,o,t):r},cs=Kt(Ge,ne),as=Kt(Ce,ot);function ls(){(window.scrollY!==0||window.scrollX!==0)&&(u("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0))}function us(e,t,n,o){const{heightCalcMode:r,widthCalcMode:d}=c;ls();const a=n??cs(r,e),f=o??as(d,e),v=Vo(a,f)?at:e;switch(l(`Resize event: %c${t}`,s.HIGHLIGHT),v){case te:case Ee:case at:case Ie:case Oe:i.height=a,i.width=f;case lt:return i;case Re:case dt:case ut:case ft:{l(mt);break}default:u(mt)}return null}let de=!1,je=!1,q=null;function ds(e,t,n,o,r){const{autoResize:d}=c,{isHidden:a}=i;switch(h(e),!0){case(a===!0&&!(e in Se)):{if(je===!0)break;l("Iframe hidden - Ignored resize request"),je=!0,de=!1,cancelAnimationFrame(q),q=null;break}case(de===!0&&e!==Re&&!(e in Se)):{l("Resize already pending - Ignored resize request");break}case(!d&&!(e in Se)):{u("Resizing disabled");break}default:{je=!1,de=!0,i.totalTime=performance.now(),i.timerActive=!0;const f=us(e,t,n,o);f&&Ut(f.height,f.width,e,r),q||(q=requestAnimationFrame(()=>{de=!1,q=null,h("requestAnimationFrame"),ie(`Reset sendPending: %c${e}`,s.HIGHLIGHT)})),i.timerActive=!1}}j()}const E=Me(ds);function Xt({eventType:e,eventName:t}){A(window,t,()=>E(t,e),{passive:!0})}function fs(){Xt({eventType:"After Print",eventName:"afterprint"}),Xt({eventType:"Before Print",eventName:"beforeprint"})}function ms(){if(i.triggerLocked){l("TriggerLock blocked calculation");return}i.triggerLocked=!0,ie("Trigger event lock on"),requestAnimationFrame(()=>{i.triggerLocked=!1,ie("Trigger event lock off")})}function en(e){const{heightCalcMode:t,widthCalcMode:n}=c,o=Ge[t](),r=Ce[n]();l(`Reset trigger event: %c${e}`,s.HIGHLIGHT),g(o,r,e)}function hs(e){const t=c.heightCalcMode;l(`Reset trigger event: %c${e}`,s.HIGHLIGHT),c.heightCalcMode=Pn,ms(),en("reset"),c.heightCalcMode=t}const ps=`Auto Resize can not be changed when <b>direction</> is set to '${Te}'.`;function ys(e){w(e,An,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=c;return o===!1&&n===!1?(h(Ee),z(ps),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>E(Ee,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),g(0,0,wn,JSON.stringify(c.autoResize)),c.autoResize)}function gs(e){w(e,U,"parentIframe.moveToAnchor(anchor) anchor"),i.inPageLinks.findTarget(e)}function vs(e){w(e,G,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,E(lt,`parentIframe.setOffsetSize(${e})`)}const bs=()=>i.origin;function zs(e){w(e,U,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),l(`Set targetOrigin: %c${e}`,s.HIGHLIGHT),c.targetOrigin=e}function ws(e){return w(e,we,"parentIframe.getParentProps(callback) callback"),i.onParentInfo=e,g(0,0,et),()=>{i.onParentInfo=null,g(0,0,Hn)}}function Es(e,t){e!==void 0&&w(e,G,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&w(t,G,"parentIframe.resize(customHeight, customWidth) customWidth");const n=e===void 0?"":e,o=t===void 0?"":`,${t}`,r=`${n}${o}`;E(Ie,`parentIframe.resize(${r})`,e,t)}const Pe=e=>(t,n)=>{w(t,G,`parentIframe.${e}(x, y) x`),w(n,G,`parentIframe.${e}(x, y) y`),g(n,t,e)},Is=Pe(Mn),Os=Pe(Ln),Ss=Pe(tt);function Rs(e,t){t&&w(t,U,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),g(0,0,be,JSON.stringify(e),t)}const Ts=()=>g(0,0,In),Hs=()=>c.parentId,Ms=()=>hs("parentIframe.reset");function Ls(){const{win:e}=i;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:ys,close:Ts,getId:Hs,getParentOrigin:bs,getParentProps:ws,moveToAnchor:gs,reset:Ms,setOffsetSize:vs,scrollBy:Is,scrollTo:Os,scrollToOffset:Ss,sendMessage:Rs,setTargetOrigin:zs,resize:Es}))}const Z=(e="")=>t=>n=>{n.size>0&&ie(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[`
25
- `,o]))},ks=(e="")=>t=>n=>{n.size>0&&It(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[`
26
- `,o]))},tn=Z("attached to"),nn=ks("already attached"),As=Z("detached from"),fe=(e,t=!0)=>n=>{n>0&&u(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,s.HIGHLIGHT,s.NORMAL,s.HIGHLIGHT,s.NORMAL)},on=(e,t,n,o)=>{const r=As(e);return d=>{const a=new Set;let f=0;for(const v of d)n.has(v)&&(t.unobserve(v),n.delete(v),a.add(v),f+=1);r(a),o(f),a.clear()}},sn=16,rn=2,Ns=200,_e="Mutation",I=new Set,$=new Set,De=new Set,me=[],$s={attributes:!0,attributeFilter:[B,ze],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let xe=1,Fe,Be=!1,Ue=0;const Gs=Z("added")(_e),Cs=Z("removed (page)")(_e),js=Z("removed (added)")(_e),cn=e=>e.nodeType!==Node.ELEMENT_NODE||yt.has(e.tagName.toLowerCase());function Ps(e){const t=e.addedNodes;for(const n of t)cn(n)||I.add(n)}function _s(e){const t=e.removedNodes;for(const n of t)cn(n)||(I.has(n)?(I.delete(n),De.add(n)):$.add(n))}const Ds=e=>{u("Mutations:",e);for(const t of e)Ps(t),_s(t);Gs(I),Cs($),js(De),De.clear()};function xs(){$.size>0&&l(`Detected %c${$.size} %cremoved element${$.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND),I.size>0&&l(`Found %c${I.size} %cnew element${I.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND)}const Fs=e=>()=>{const t=performance.now(),n=t-Ue,o=sn*xe+++rn;if(n>o&&n<Ns){h("mutationThrottled"),u("Update delayed due to heavy workload on the callStack"),u(`EventLoop busy time: %c${C(n)}ms %c> Max wait: %c${o-rn}ms`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),setTimeout(Fe,sn*xe),Ue=t;return}xe=1,me.forEach(Ds),me.length=0,Be=!1,xs(),e({addedNodes:I,removedNodes:$}),I.clear(),$.clear()};function Bs(e){me.push(e),!Be&&(Ue=performance.now(),Be=!0,requestAnimationFrame(Fe))}function Us(e){const t=new window.MutationObserver(Bs),n=document.body||document.documentElement;return Fe=Fs(e),t.observe(n,$s),u("Attached%c MutationObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{I.clear(),$.clear(),me.length=0,t.disconnect(),u("Detached%c MutationObserver",s.HIGHLIGHT)}}}const Ws={characterData:!0,childList:!0,subtree:!0};function Vs(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,Ws),u("Attached%c TitleObserver%c to head",s.HIGHLIGHT,s.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),u("Detached%c TitleObserver",s.HIGHLIGHT)}}}function qs(e){const t=new IntersectionObserver(o=>e(o.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),u("Attached%c VisibilityObserver%c to page",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{t.disconnect(),u("Detached%c VisibilityObserver",s.HIGHLIGHT)}}}let an=new Set;function Zs(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${B}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{h("overflowIgnored"),u(`Ignoring elements with [data-iframe-ignore] > *:
27
- `,n),j()}),t}function ln(){const e=document.querySelectorAll(`[${nt}]`),t=Zs(e);let n=!0;return typeof Set.prototype.symmetricDifference===we&&(n=t.symmetricDifference(an).size>0),an=t,i.overflowedNodeSet=t,i.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const O={},un=e=>{const t=new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const o of $e(n))t.add(o)}return u(`Inspecting:
28
- `,t),t},Ys=e=>{if(e.size===0)return;h("addObservers");const t=un(e);O.overflow.attachObservers(t),O.resize.attachObserverToNonStaticElements(t),j()},Qs=e=>{if(e.size===0)return;h("removeObservers");const t=un(e);O.overflow.detachObservers(t),O.resize.detachObservers(t),j()};function Js({addedNodes:e,removedNodes:t}){h("contentMutated"),i.applySelectors(),Bt(),ln(),j(),Qs(t),Ys(e)}function Ks(e){Js(e),E(dt,"Mutation Observed")}const Y="Overflow",Xs=fe(Y),er=fe(Y,!1),tr=tn(Y),nr=nn(Y),or=e=>e instanceof HTMLElement&&(!!e.hidden||e.offsetParent===null||e.style.display===Te),sr=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||re,d=(S=!1)=>e(S),a=(S,L)=>S===0||S>L[n],f=(S,L)=>{S.toggleAttribute(nt,L)};function v(S){for(const L of S){const{boundingClientRect:X,rootBounds:ee,target:R}=L;if(!ee)continue;const ei=X[n],ti=a(ei,ee)&&!(R instanceof HTMLElement&&or(R));f(R,ti)}r(d)}const m=new IntersectionObserver(v,o),b=new WeakSet;function p(S){const L=new Set,X=new Set;let ee=0;for(const R of S)if(R instanceof Element){if(b.has(R)){L.add(R);continue}m.observe(R),b.add(R),X.add(R),ee+=1}nr(L),tr(X),Xs(ee),X.clear(),L.clear()}return{attachObservers:p,detachObservers:on(Y,m,b,er),disconnect:()=>{m.disconnect(),u("Detached%c OverflowObserver",s.HIGHLIGHT)}}};function rr(){const{hasOverflow:e}=i,{hasOverflowUpdated:t,overflowedNodeSet:n}=ln();switch(!0){case!t:return;case n.size>1:u("Overflowed Elements:",n);break;case e:break;default:u("No overflow detected")}E(Re,"Overflow updated")}function ir(e){const t={root:document.documentElement,side:c.calculateHeight?it:ct};return O.overflow=sr(rr,t),O.overflow.attachObservers(e),O.overflow}const Q="Resize",cr=fe(Q),ar=fe(Q,!1),lr=tn(Q),ur=nn(Q),he=new WeakSet,We=new Set,Ve=new Set;let J;function dr(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const o=getComputedStyle(n)?.position;if(!(o===""||o==="static")){if(he.has(n)){We.add(n);continue}J.observe(n),he.add(n),Ve.add(n),t+=1}}ur(We),lr(Ve),cr(t),Ve.clear(),We.clear()}const fr=e=>(J=new ResizeObserver(e),J.observe(document.body),he.add(document.body),u("Attached%c ResizeObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{attachObserverToNonStaticElements:dr,detachObservers:on(Q,J,he,ar),disconnect:()=>{J.disconnect(),u("Detached%c ResizeObserver",s.HIGHLIGHT)}});function mr(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;E(ut,`Element resized <${Fn(t)}>`)}function hr(e){return O.resize=fr(mr),O.resize.attachObserverToNonStaticElements(e),O.resize}let dn;function pr(){const e=document.title;e!==dn&&(dn=e,l(`Title: %c${e}`,s.HIGHLIGHT),e&&g(0,0,kn,e))}function yr(e){l(`Visible: %c${e}`,s.HIGHLIGHT),i.isHidden=!e,E(ft,"Visibility changed")}function gr(e){Le.push(...e.map(t=>t.disconnect))}function vr(){h("attachObservers");const e=$e(document.documentElement),t=[Us(Ks),ir(e),ts(),hr(e),Vs(pr),qs(yr)];gr(t)}const fn=(e,t,n)=>{if(n!==""){l(`${e}: %c${n}`,s.HIGHLIGHT);for(const o of document.querySelectorAll(n))l(`Applying ${t} to:`,o),o.toggleAttribute(t,!0)}};function br({sizeSelector:e,ignoreSelector:t}){return()=>{fn("sizeSelector",ze,e),fn("ignoreSelector",B,t)}}function zr(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function wr(e,t){return t.includes("-")&&(_(`Negative CSS value ignored for ${e}`),t=""),t}function qe(e,t){t===void 0||t===""||t===Cn||(document.body.style.setProperty(e,t),u(`Set body ${e}: %c${t}`,s.HIGHLIGHT))}function Er({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),qe("margin",wr("margin",e))}const Ir=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Or(e){const t=e.getBoundingClientRect(),n=Ir();return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function Sr(e,t){const n=Or(t);l(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),g(n.y,n.x,tt)}function Ze(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];if(o!==void 0){Sr(t,o);return}l(`In page link (#${t}) not found in iframe, so sending to parent`),g(0,0,On,`#${t}`)}function mn(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&Ze(t)}function Rr(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&A(e,"click",t=>{t.preventDefault(),Ze(e.getAttribute("href"))})}function Tr(){A(window,"hashchange",mn)}function Hr(){setTimeout(mn,pt)}function Mr(){l("Setting up location.hash handlers"),Rr(),Tr(),Hr(),i.inPageLinks={findTarget:Ze}}function Lr(e){const{mode:t}=c;e?ke(t)?z(M(5)):Mr():l("In page linking not enabled")}const kr="important";function Ar(){const e=t=>t.style.setProperty(ne,W,kr);e(document.documentElement),e(document.body),l("Set HTML & body height: %cauto !important",s.HIGHLIGHT)}const Ye=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Qe=Ye(we),hn=Ye(G),pe=Ye(U),Nr=e=>e!==null&&typeof e===Nn&&!Array.isArray(e);function $r(e){const{calculateHeight:t,calculateWidth:n}=c;let o,r;return typeof e?.offsetSize===G&&(t&&(o=hn(e,st)),n&&(r=hn(e,st))),{offsetHeight:o,offsetWidth:r}}function Gr(e){l("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=$r(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:pe(e,"ignoreSelector"),[_t(3)]:pe(e,_t(0)),sizeSelector:pe(e,"sizeSelector"),targetOrigin:pe(e,"targetOrigin"),onBeforeResize:Qe(e,"onBeforeResize"),onMessage:Qe(e,"onMessage"),onReady:Qe(e,"onReady")}}function Cr(){const{mode:e}=c;if(ke(e))return{};const t=window.iframeResizer||window.iFrameResizer;return Nr(t)?Gr(t):{}}const jr=e=>e==="true",pn=e=>t=>t===void 0?void 0:e(t),P=pn(jr),K=pn(Number),Pr=e=>({parentId:e[0],bodyMargin:K(e[1]),calculateWidth:P(e[2]),logging:P(e[3]),autoResize:P(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:K(e[11]),inPageLinks:P(e[12]),mouseEvents:P(e[15]),offsetHeight:K(e[16]),offsetWidth:K(e[17]),calculateHeight:P(e[18]),key:e[19],version:e[20],mode:K(e[21]),logExpand:P(e[23])});function _r(e){const{mode:t}=c;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;z(`<rb>Error in setup function</>
22
+ To improve performance add the <b>data-iframe-size</> attribute to the ${j.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},dn)}function hn(e){e.getEntries().forEach(t=>{if(t.name===q)try{const{duration:r}=performance.measure(je,oe,q);j=t.detail,p.push(r),p.length>un&&p.shift()}catch{}})}function En(){f("Attached%c PerformanceObserver%c to page",i.HIGHLIGHT,i.FOREGROUND);const e=new PerformanceObserver(hn);return e.observe({entryTypes:["mark"]}),gn(),{disconnect:()=>{Qe(),clearInterval(ae),e.disconnect(),f("Detached%c PerformanceObserver",i.HIGHLIGHT)}}}const In=e=>`:not(${e})`,pn=`* ${Array.from(n.IGNORE_TAGS).map(In).join("")}`,ce=e=>e.querySelectorAll(pn);function On(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:r,taggedElements:s}=a;return t?s:e?Array.from(r):ce(document.documentElement)}function Sn(e,t){const r=`margin-${t}`;let s,o=document.documentElement,u=a.hasTags?n.MIN_SIZE:document.documentElement.getBoundingClientRect().bottom;for(const l of e)s=l.getBoundingClientRect()[t]+parseFloat(getComputedStyle(l).getPropertyValue(r)),s>u&&(u=s,o=l);return{maxEl:o,maxVal:u}}function Ke(e){performance.mark(oe);const t=n.capitalizeFirstLetter(e),{logging:r}=c,{hasTags:s}=a,o=On(),{maxEl:u,maxVal:l}=Sn(o,e);return f(`${t} position calculated from:`,u),f(`Checked %c${o.length}%c elements`,i.HIGHLIGHT,i.FOREGROUND),performance.mark(q,{detail:{hasTags:s,len:o.length,logging:r,Side:t}}),l}const de={label:n.HEIGHT,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>qe(de),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>Ke(n.HEIGHT_EDGE)},le={label:n.WIDTH,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>qe(le),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>Ke(n.WIDTH_EDGE)};function Tn(e,t,r){const s=c.onBeforeResize(e,t,r);if(s===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(s))throw new TypeError(`Invalid value returned from onBeforeResize(): ${s}, expected Number`);if(s<n.MIN_SIZE)throw new RangeError(`Out of range value returned from onBeforeResize(): ${s}, must be at least ${n.MIN_SIZE}`);return s}const Je=(e,t)=>(r,s)=>{const o=e[r]();return e.enabled()&&c.onBeforeResize!==void 0?Tn(o,s,t):o},Rn=Je(de,n.HEIGHT),bn=Je(le,n.WIDTH);function wn(){(window.scrollY!==0||window.scrollX!==0)&&(f("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0))}function vn(e,t,r,s){const{heightCalcMode:o,widthCalcMode:u}=c;wn();const l=r??Rn(o,e),g=s??bn(u,e),S=on(l,g)?n.SIZE_CHANGE_DETECTED:e;switch(d(`Resize event: %c${t}`,i.HIGHLIGHT),S){case n.INIT:case n.ENABLE:case n.SIZE_CHANGE_DETECTED:case n.MANUAL_RESIZE_REQUEST:case n.PARENT_RESIZE_REQUEST:a.height=l,a.width=g;case n.SET_OFFSET_SIZE:return a;case n.OVERFLOW_OBSERVER:case n.MUTATION_OBSERVER:case n.RESIZE_OBSERVER:case n.VISIBILITY_OBSERVER:{d(n.NO_CHANGE);break}default:f(n.NO_CHANGE)}return null}let Y=!1,fe=!1,D=null;function yn(e,t,r,s,o){const{autoResize:u}=c,{isHidden:l}=a;switch(E(e),!0){case(l===!0&&!(e in n.IGNORE_DISABLE_RESIZE)):{if(fe===!0)break;d("Iframe hidden - Ignored resize request"),fe=!0,Y=!1,cancelAnimationFrame(D),D=null;break}case(Y===!0&&e!==n.OVERFLOW_OBSERVER&&!(e in n.IGNORE_DISABLE_RESIZE)):{d("Resize already pending - Ignored resize request");break}case(!u&&!(e in n.IGNORE_DISABLE_RESIZE)):{f("Resizing disabled");break}default:{fe=!1,Y=!0,a.totalTime=performance.now(),a.timerActive=!0;const g=vn(e,t,r,s);g&&Ve(g.height,g.width,e,o),D||(D=requestAnimationFrame(()=>{Y=!1,D=null,E("requestAnimationFrame"),W(`Reset sendPending: %c${e}`,i.HIGHLIGHT)})),a.timerActive=!1}}G()}const b=re(yn);function Xe({eventType:e,eventName:t}){N(window,t,()=>b(t,e),{passive:!0})}function Hn(){Xe({eventType:"After Print",eventName:"afterprint"}),Xe({eventType:"Before Print",eventName:"beforeprint"})}function An(){if(a.triggerLocked){d("TriggerLock blocked calculation");return}a.triggerLocked=!0,W("Trigger event lock on"),requestAnimationFrame(()=>{a.triggerLocked=!1,W("Trigger event lock off")})}function et(e){const{heightCalcMode:t,widthCalcMode:r}=c,s=de[t](),o=le[r]();d(`Reset trigger event: %c${e}`,i.HIGHLIGHT),O(s,o,e)}function Nn(e){const t=c.heightCalcMode;d(`Reset trigger event: %c${e}`,i.HIGHLIGHT),c.heightCalcMode=n.HEIGHT_CALC_MODE_DEFAULT,An(),et("reset"),c.heightCalcMode=t}const Mn=`Auto Resize can not be changed when <b>direction</> is set to '${n.NONE}'.`;function Ln(e){n.typeAssert(e,n.BOOLEAN,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:r,calculateWidth:s}=c;return s===!1&&r===!1?(E(n.ENABLE),T(Mn),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>b(n.ENABLE,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),O(0,0,n.AUTO_RESIZE,JSON.stringify(c.autoResize)),c.autoResize)}function Gn(e){n.typeAssert(e,n.STRING,"parentIframe.moveToAnchor(anchor) anchor"),a.inPageLinks.findTarget(e)}function zn(e){n.typeAssert(e,n.NUMBER,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,b(n.SET_OFFSET_SIZE,`parentIframe.setOffsetSize(${e})`)}const $n=()=>a.origin;function _n(e){n.typeAssert(e,n.STRING,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),d(`Set targetOrigin: %c${e}`,i.HIGHLIGHT),c.targetOrigin=e}function kn(e){return n.typeAssert(e,n.FUNCTION,"parentIframe.getParentProps(callback) callback"),a.onParentInfo=e,O(0,0,n.PARENT_INFO),()=>{a.onParentInfo=null,O(0,0,n.PARENT_INFO_STOP)}}function Cn(e,t){e!==void 0&&n.typeAssert(e,n.NUMBER,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&n.typeAssert(t,n.NUMBER,"parentIframe.resize(customHeight, customWidth) customWidth");const r=e===void 0?"":e,s=t===void 0?"":`,${t}`,o=`${r}${s}`;b(n.MANUAL_RESIZE_REQUEST,`parentIframe.resize(${o})`,e,t)}const ue=e=>(t,r)=>{n.typeAssert(t,n.NUMBER,`parentIframe.${e}(x, y) x`),n.typeAssert(r,n.NUMBER,`parentIframe.${e}(x, y) y`),O(r,t,e)},Dn=ue(n.SCROLL_BY),Pn=ue(n.SCROLL_TO),Bn=ue(n.SCROLL_TO_OFFSET);function Fn(e,t){t&&n.typeAssert(t,n.STRING,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),O(0,0,n.MESSAGE,JSON.stringify(e),t)}const Un=()=>O(0,0,n.CLOSE),mn=()=>c.parentId,xn=()=>Nn("parentIframe.reset");function Vn(){const{win:e}=a;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:Ln,close:Un,getId:mn,getParentOrigin:$n,getParentProps:kn,moveToAnchor:Gn,reset:xn,setOffsetSize:zn,scrollBy:Dn,scrollTo:Pn,scrollToOffset:Bn,sendMessage:Fn,setTargetOrigin:_n,resize:Cn}))}const P=(e="")=>t=>r=>{r.size>0&&W(`${t}Observer ${e}:`,...Array.from(r).flatMap(s=>[n.NEW_LINE,s]))},Wn=(e="")=>t=>r=>{r.size>0&&Me(`${t}Observer ${e}:`,...Array.from(r).flatMap(s=>[n.NEW_LINE,s]))},tt=P("attached to"),nt=Wn("already attached"),Zn=P("detached from"),Q=(e,t=!0)=>r=>{r>0&&f(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${r}%c element${r===1?"":"s"}`,i.HIGHLIGHT,i.NORMAL,i.HIGHLIGHT,i.NORMAL)},rt=(e,t,r,s)=>{const o=Zn(e);return u=>{const l=new Set;let g=0;for(const S of u)r.has(S)&&(t.unobserve(S),r.delete(S),l.add(S),g+=1);o(l),s(g),l.clear()}},st=16,it=2,qn=200,ge="Mutation",w=new Set,L=new Set,he=new Set,K=[],jn={attributes:!0,attributeFilter:[n.IGNORE_ATTR,n.SIZE_ATTR],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ee=1,Ie,pe=!1,Oe=0;const Yn=P("added")(ge),Qn=P("removed (page)")(ge),Kn=P("removed (added)")(ge),ot=e=>e.nodeType!==Node.ELEMENT_NODE||n.IGNORE_TAGS.has(e.tagName.toLowerCase());function Jn(e){const t=e.addedNodes;for(const r of t)ot(r)||w.add(r)}function Xn(e){const t=e.removedNodes;for(const r of t)ot(r)||(w.has(r)?(w.delete(r),he.add(r)):L.add(r))}const er=e=>{f("Mutations:",e);for(const t of e)Jn(t),Xn(t);Yn(w),Qn(L),Kn(he),he.clear()};function tr(){L.size>0&&d(`Detected %c${L.size} %cremoved element${L.size>1?"s":""}`,i.HIGHLIGHT,i.FOREGROUND),w.size>0&&d(`Found %c${w.size} %cnew element${w.size>1?"s":""}`,i.HIGHLIGHT,i.FOREGROUND)}const nr=e=>()=>{const t=performance.now(),r=t-Oe,s=st*Ee+++it;if(r>s&&r<qn){E("mutationThrottled"),f("Update delayed due to heavy workload on the callStack"),f(`EventLoop busy time: %c${n.round(r)}ms %c> Max wait: %c${s-it}ms`,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT),setTimeout(Ie,st*Ee),Oe=t;return}Ee=1,K.forEach(er),K.length=0,pe=!1,tr(),e({addedNodes:w,removedNodes:L}),w.clear(),L.clear()};function rr(e){K.push(e),!pe&&(Oe=performance.now(),pe=!0,requestAnimationFrame(Ie))}function sr(e){const t=new window.MutationObserver(rr),r=document.body||document.documentElement;return Ie=nr(e),t.observe(r,jn),f("Attached%c MutationObserver%c to body",i.HIGHLIGHT,i.FOREGROUND),{disconnect:()=>{w.clear(),L.clear(),K.length=0,t.disconnect(),f("Detached%c MutationObserver",i.HIGHLIGHT)}}}const ir={characterData:!0,childList:!0,subtree:!0};function or(e){const t=document.querySelector("title")??document.head??document.documentElement,r=new MutationObserver(e);return r.observe(t,ir),f("Attached%c TitleObserver%c to head",i.HIGHLIGHT,i.FOREGROUND),setTimeout(e),{disconnect:()=>{r.disconnect(),f("Detached%c TitleObserver",i.HIGHLIGHT)}}}function ar(e){const t=new IntersectionObserver(s=>e(s.at(-1)?.isIntersecting??!1),{threshold:0}),r=document.documentElement;return t.observe(r),f("Attached%c VisibilityObserver%c to page",i.HIGHLIGHT,i.FOREGROUND),{disconnect:()=>{t.disconnect(),f("Detached%c VisibilityObserver",i.HIGHLIGHT)}}}let at=new Set;function cr(e){const t=new Set,r=new Set;for(const s of e)s.closest(`[${n.IGNORE_ATTR}]`)?r.add(s):t.add(s);return r.size>0&&queueMicrotask(()=>{E("overflowIgnored"),f(`Ignoring elements with [data-iframe-ignore] > *:
23
+ `,r),G()}),t}function ct(){const e=document.querySelectorAll(`[${n.OVERFLOW_ATTR}]`),t=cr(e);let r=!0;return typeof Set.prototype.symmetricDifference===n.FUNCTION&&(r=t.symmetricDifference(at).size>0),at=t,a.overflowedNodeSet=t,a.hasOverflow=t.size>0,{hasOverflowUpdated:r,overflowedNodeSet:t}}const v={},dt=e=>{const t=new Set;for(const r of e)if(r instanceof Element){t.add(r);for(const s of ce(r))t.add(s)}return f(`Inspecting:
24
+ `,t),t},dr=e=>{if(e.size===0)return;E("addObservers");const t=dt(e);v.overflow.attachObservers(t),v.resize.attachObserverToNonStaticElements(t),G()},lr=e=>{if(e.size===0)return;E("removeObservers");const t=dt(e);v.overflow.detachObservers(t),v.resize.detachObservers(t),G()};function fr({addedNodes:e,removedNodes:t}){E("contentMutated"),a.applySelectors(),xe(),ct(),G(),lr(t),dr(e)}function ur(e){fr(e),b(n.MUTATION_OBSERVER,"Mutation Observed")}const B="Overflow",gr=Q(B),hr=Q(B,!1),Er=tt(B),Ir=nt(B),pr=e=>e instanceof HTMLElement&&(!!e.hidden||e.offsetParent===null||e.style.display===n.NONE),Or=(e,t)=>{const r=t.side||n.HEIGHT_EDGE,s={root:t.root,rootMargin:"0px",threshold:1},o=window?.requestAnimationFrame||n.id,u=(y=!1)=>e(y),l=(y,A)=>y===0||y>A[r],g=(y,A)=>{y.toggleAttribute(n.OVERFLOW_ATTR,A)};function S(y){for(const A of y){const{boundingClientRect:x,rootBounds:V,target:H}=A;if(!V)continue;const hs=x[r],Es=l(hs,V)&&!(H instanceof HTMLElement&&pr(H));g(H,Es)}o(u)}const h=new IntersectionObserver(S,s),R=new WeakSet;function I(y){const A=new Set,x=new Set;let V=0;for(const H of y)if(H instanceof Element){if(R.has(H)){A.add(H);continue}h.observe(H),R.add(H),x.add(H),V+=1}Ir(A),Er(x),gr(V),x.clear(),A.clear()}return{attachObservers:I,detachObservers:rt(B,h,R,hr),disconnect:()=>{h.disconnect(),f("Detached%c OverflowObserver",i.HIGHLIGHT)}}};function Sr(){const{hasOverflow:e}=a,{hasOverflowUpdated:t,overflowedNodeSet:r}=ct();switch(!0){case!t:return;case r.size>1:f("Overflowed Elements:",r);break;case e:break;default:f("No overflow detected")}b(n.OVERFLOW_OBSERVER,"Overflow updated")}function Tr(e){const t={root:document.documentElement,side:c.calculateHeight?n.HEIGHT_EDGE:n.WIDTH_EDGE};return v.overflow=Or(Sr,t),v.overflow.attachObservers(e),v.overflow}const F="Resize",Rr=Q(F),br=Q(F,!1),wr=tt(F),vr=nt(F),J=new WeakSet,Se=new Set,Te=new Set;let U;function yr(e){let t=0;for(const r of e){if(!(r instanceof Element))continue;const s=getComputedStyle(r)?.position;if(!(s===""||s==="static")){if(J.has(r)){Se.add(r);continue}U.observe(r),J.add(r),Te.add(r),t+=1}}vr(Se),wr(Te),Rr(t),Te.clear(),Se.clear()}const Hr=e=>(U=new ResizeObserver(e),U.observe(document.body),J.add(document.body),f("Attached%c ResizeObserver%c to body",i.HIGHLIGHT,i.FOREGROUND),{attachObserverToNonStaticElements:yr,detachObservers:rt(F,U,J,br),disconnect:()=>{U.disconnect(),f("Detached%c ResizeObserver",i.HIGHLIGHT)}});function Ar(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;b(n.RESIZE_OBSERVER,`Element resized <${n.getElementName(t)}>`)}function Nr(e){return v.resize=Hr(Ar),v.resize.attachObserverToNonStaticElements(e),v.resize}let lt;function Mr(){const e=document.title;e!==lt&&(lt=e,d(`Title: %c${e}`,i.HIGHLIGHT),e&&O(0,0,n.TITLE,e))}function Lr(e){d(`Visible: %c${e}`,i.HIGHLIGHT),a.isHidden=!e,b(n.VISIBILITY_OBSERVER,"Visibility changed")}function Gr(e){ie.push(...e.map(t=>t.disconnect))}function zr(){E("attachObservers");const e=ce(document.documentElement),t=[sr(ur),Tr(e),En(),Nr(e),or(Mr),ar(Lr)];Gr(t)}const ft=(e,t,r)=>{if(r!==""){d(`${e}: %c${r}`,i.HIGHLIGHT);for(const s of document.querySelectorAll(r))d(`Applying ${t} to:`,s),s.toggleAttribute(t,!0)}};function $r({sizeSelector:e,ignoreSelector:t}){return()=>{ft("sizeSelector",n.SIZE_ATTR,e),ft("ignoreSelector",n.IGNORE_ATTR,t)}}function _r(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function kr(e,t){return t.includes("-")&&($(`Negative CSS value ignored for ${e}`),t=""),t}function Re(e,t){t===void 0||t===""||t===n.NULL||(document.body.style.setProperty(e,t),f(`Set body ${e}: %c${t}`,i.HIGHLIGHT))}function Cr({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),Re("margin",kr("margin",e))}const Dr=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Pr(e){const t=e.getBoundingClientRect(),r=Dr();return{x:Math.round(t.left+r.x),y:Math.round(t.top+r.y)}}function Br(e,t){const r=Pr(t);d(`Moving to in page link (%c#${e}%c) at x: %c${r.x}%c y: %c${r.y}`,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT),O(r.y,r.x,n.SCROLL_TO_OFFSET)}function be(e){const t=e.split("#")[1]||e,r=decodeURIComponent(t),s=document.getElementById(r)||document.getElementsByName(r)[0];if(s!==void 0){Br(t,s);return}d(`In page link (#${t}) not found in iframe, so sending to parent`),O(0,0,n.IN_PAGE_LINK,`#${t}`)}function ut(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&be(t)}function Fr(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&N(e,"click",t=>{t.preventDefault(),be(e.getAttribute("href"))})}function Ur(){N(window,"hashchange",ut)}function mr(){setTimeout(ut,n.EVENT_CANCEL_TIMER)}function xr(){d("Setting up location.hash handlers"),Fr(),Ur(),mr(),a.inPageLinks={findTarget:be}}function Vr(e){const{mode:t}=c;e?n.checkMode(t)?T(n.getModeData(5)):xr():d("In page linking not enabled")}const Wr="important";function Zr(){const e=t=>t.style.setProperty(n.HEIGHT,n.AUTO,Wr);e(document.documentElement),e(document.body),d("Set HTML & body height: %cauto !important",i.HIGHLIGHT)}const we=e=>(t,r)=>{if(r in t){if(typeof t[r]===e)return t[r];throw new TypeError(`${r} is not a ${e}.`)}},ve=we(n.FUNCTION),gt=we(n.NUMBER),X=we(n.STRING),qr=e=>e!==null&&typeof e===n.OBJECT&&!Array.isArray(e);function jr(e){const{calculateHeight:t,calculateWidth:r}=c;let s,o;return typeof e?.offsetSize===n.NUMBER&&(t&&(s=gt(e,n.OFFSET_SIZE)),r&&(o=gt(e,n.OFFSET_SIZE))),{offsetHeight:s,offsetWidth:o}}function Yr(e){d("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:r}=jr(e);return{offsetHeight:t,offsetWidth:r,ignoreSelector:X(e,"ignoreSelector"),[n.getKey(3)]:X(e,n.getKey(0)),sizeSelector:X(e,"sizeSelector"),targetOrigin:X(e,"targetOrigin"),onBeforeResize:ve(e,"onBeforeResize"),onMessage:ve(e,"onMessage"),onReady:ve(e,"onReady")}}function Qr(){const{mode:e}=c;if(n.checkMode(e))return{};const t=window.iframeResizer||window.iFrameResizer;return qr(t)?Yr(t):{}}const Kr=e=>e==="true",ht=e=>t=>t===void 0?void 0:e(t),z=ht(Kr),m=ht(Number),Jr=e=>({parentId:e[0],bodyMargin:m(e[1]),calculateWidth:z(e[2]),logging:z(e[3]),autoResize:z(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:m(e[11]),inPageLinks:z(e[12]),mouseEvents:z(e[15]),offsetHeight:m(e[16]),offsetWidth:m(e[17]),calculateHeight:z(e[18]),key:e[19],version:e[20],mode:m(e[21]),logExpand:z(e[23])});function Xr(e){const{mode:t}=c;e.forEach(r=>{try{r()}catch(s){if(t<0)throw s;T(`<rb>Error in setup function</>
29
25
  <i>iframe-resizer</> detected an error during setup.
30
26
 
31
- Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),It(o)}})}function yn(e){for(const[t,n]of Object.entries(e))n!==void 0&&(c[t]=n)}function Dr({logExpand:e,logging:t,parentId:n=""}){Qn({id:n,enabled:t,expand:e}),h("initReceived"),l(`Initialising iframe v${T} ${window.location.href}`)}function xr(e){h("ready"),Ft(gt(e)),l("Initialization complete",(({key:t,key2:n,...o})=>o)(c))}function Fr({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const r=ho(c),d=[go,po,ko,Bt,No,r?re:mo,()=>Er(c),()=>qe("background",e),()=>qe("padding",t),r?re:Ar,zr,i.applySelectors,()=>Lr(n),fs,()=>Fo(c),Wo,()=>Ls(),()=>E(te,"Init message from host page",void 0,void 0,`${T}:${c.mode}`),vr,j];Co(c),Ho(c),_r(d),xr(o)}function Br(e){i.firstRun&&(yn(Pr(e)),Dr(c),yn(Cr()),i.applySelectors=br(c),Fr(c))}function Ur(e){if(document.readyState==="loading"){l("Page not ready, ignoring init message");return}const t=e.data.slice(ht).split(":");i.target=e.source,i.origin=e.origin,Br(t),i.firstRun=!1,setTimeout(()=>{i.initLock=!1},pt)}const{freeze:Wr}=Object,{parse:Je}=JSON,Ke=e=>Wr(Je(e)),gn=e=>g(0,0,`${e}Stop`),ye=e=>e.data.slice(e.data.indexOf(":")+1),Vr=e=>no(e)?te:e.data.split("]")[1].split(":")[0];function qr(e){const t=ye(e);l("onMessage called from parent:%c",s.HIGHLIGHT,Ke(t)),se(c.onMessage,Je(t))}function Zr(e){const{onPageInfo:t}=i,n=ye(e);l("PageInfo received from parent:",Ke(n)),t?se(t,Je(n)):gn(Tn)}function Yr(e){const{onParentInfo:t}=i,n=Ke(ye(e));l("ParentInfo received from parent:",n),t?se(t,n):gn(et)}function Qr(){if(i.initLock){l("Page reset ignored by init");return}l("Page size reset by host page"),en("resetPage")}function Jr(){l("Resize requested by host page"),E(Oe,"Parent window requested size check")}const vn=e=>i.inPageLinks.findTarget(ye(e)),bn={init:Ur,reset:Qr,resize:Jr,moveToAnchor:vn,inPageLink:vn,pageInfo:Zr,parentInfo:Yr,message:qr};function Kr(e){const{firstRun:t}=i,n=Vr(e);switch(h(n),!0){case n in bn:bn[n](e);break;case(t&&to()):_(`Ignored message of type "${n}". Received before initialization.`);break;default:_(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const ge=Me(e=>{eo(e)&&Kr(e)});function Xr(){if("iframeChildListener"in window){_("Already setup");return}window.iframeChildListener=(t=>{setTimeout(()=>ge({data:t,sameOrigin:!0}))}),h("listen"),A(window,be,ge),A(document,rt,Mt),Mt();function e(t){return ge(t),i.win}try{top?.document?.getElementById("banner")&&(i.win={},window.mockMsgListener=e,Rt(window,be,ge),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==$n&&Xr()}));
27
+ Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Me(s)}})}function Et(e){for(const[t,r]of Object.entries(e))r!==void 0&&(c[t]=r)}function es({logExpand:e,logging:t,parentId:r=""}){St({id:r,enabled:t,expand:e}),E("initReceived"),d(`Initialising iframe v${n.VERSION} ${window.location.href}`)}function ts(e){E("ready"),me(n.once(e)),d("Initialization complete",(({key:t,key2:r,...s})=>s)(c))}function ns({bodyBackground:e,bodyPadding:t,inPageLinks:r,onReady:s}){const o=Ct(c),u=[Bt,Dt,Vt,xe,Zt,o?n.id:kt,()=>Cr(c),()=>Re("background",e),()=>Re("padding",t),o?n.id:Zr,_r,a.applySelectors,()=>Vr(r),Hn,()=>tn(c),sn,()=>Vn(),()=>b(n.INIT,"Init message from host page",void 0,void 0,`${n.VERSION}:${c.mode}`),zr,G];Yt(c),Ut(c),Xr(u),ts(s)}function rs(e){a.firstRun&&(Et(Jr(e)),es(c),Et(Qr()),a.applySelectors=$r(c),ns(c))}function ss(e){if(document.readyState==="loading"){d("Page not ready, ignoring init message");return}const t=e.data.slice(n.MESSAGE_ID_LENGTH).split(n.SEPARATOR);a.target=e.source,a.origin=e.origin,rs(t),a.firstRun=!1,setTimeout(()=>{a.initLock=!1},n.EVENT_CANCEL_TIMER)}const{freeze:is}=Object,{parse:ye}=JSON,He=e=>is(ye(e)),It=e=>O(0,0,`${e}Stop`),ee=e=>e.data.slice(e.data.indexOf(n.SEPARATOR)+1),os=e=>yt(e)?n.INIT:e.data.split("]")[1].split(n.SEPARATOR)[0];function as(e){const t=ee(e);d("onMessage called from parent:%c",i.HIGHLIGHT,He(t)),n.isolateUserCode(c.onMessage,ye(t))}function cs(e){const{onPageInfo:t}=a,r=ee(e);d("PageInfo received from parent:",He(r)),t?n.isolateUserCode(t,ye(r)):It(n.PAGE_INFO)}function ds(e){const{onParentInfo:t}=a,r=He(ee(e));d("ParentInfo received from parent:",r),t?n.isolateUserCode(t,r):It(n.PARENT_INFO)}function ls(){if(a.initLock){d("Page reset ignored by init");return}d("Page size reset by host page"),et("resetPage")}function fs(){d("Resize requested by host page"),b(n.PARENT_RESIZE_REQUEST,"Parent window requested size check")}const pt=e=>a.inPageLinks.findTarget(ee(e)),Ot={init:ss,reset:ls,resize:fs,moveToAnchor:pt,inPageLink:pt,pageInfo:cs,parentInfo:ds,message:as};function us(e){const{firstRun:t}=a,r=os(e);switch(E(r),!0){case r in Ot:Ot[r](e);break;case(t&&vt()):$(`Ignored message of type "${r}". Received before initialization.`);break;default:$(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const te=re(e=>{wt(e)&&us(e)});function gs(){if("iframeChildListener"in window){$("Already setup");return}window.iframeChildListener=(t=>{setTimeout(()=>te({data:t,sameOrigin:!0}))}),E("listen"),N(window,n.MESSAGE,te),N(document,n.READY_STATE_CHANGE,ke),ke();function e(t){return te(t),a.win}try{top?.document?.getElementById("banner")&&(a.win={},window.mockMsgListener=e,ze(window,n.MESSAGE,te),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==n.UNDEFINED&&gs()}));
32
28
  //# sourceMappingURL=index.umd.js.map