@iframe-resizer/child 5.5.6-beta.2 → 5.5.7-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.5.6-beta.2 (esm) - 2025-09-05
4
+ * @module iframe-resizer/child 5.5.7-beta.1 (esm) - 2025-09-21
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- import e,{NORMAL as t,HIGHLIGHT as n,FOREGROUND as o,ITALIC as r,BOLD as i}from"auto-console-group";const a="5.5.6-beta.2",s="iframeResizer",c="beforeUnload",l="init",d="message",u="pageInfo",m="parentInfo",f="scrollToOffset",p="title",h=10,g="data-iframe-size",y="data-iframe-overflowed",b="data-iframe-ignore",v="height",z="width",w="readystatechange",$="bottom",S="right",O="autoResizeEnabled",M=Symbol("sizeChanged"),k="manualResize",E="parentResize",I={[k]:1,[E]:1},T="setOffsetSize",j="resizeObserver",x="overflowObserver",A="mutationObserver",P="visibilityObserver",N="No change in content size detected",C="[iFrameSizer]",R=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),q=(e,t,n,o)=>e.addEventListener(t,n,o||!1),L=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)},B=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),D=["spjluzl","rlf","clyzpvu"],W=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."],F=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],V=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),H=e=>B(W[e]),U=e=>{const t=e[B(D[0])]||e[B(D[1])]||e[B(D[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=L(B(e));return n in V&&(t=V[n]),t}(n[0]);return 0===o||(e=>e[2]===L(e[0]+e[1]))(n)||(o=-2),o},Z=(e,...t)=>setTimeout(()=>e(...t),0),J=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},_=e=>e,Q=e=>Math.round(1e3*e)/1e3,Y=e=>e.charAt(0).toUpperCase()+e.slice(1),G=e=>""!=`${e}`&&void 0!==e;const X=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Y(t)}`)};let K=!0,ee=s;var te;const ne=(te=e,te?.__esModule?te.default:te)({label:`${s}(child)`,expand:!1});const oe=e=>(...t)=>!K||ne[e](...t),re=oe("log"),ie=re,ae=oe("debug");const{assert:se,endAutoGroup:ce,error:le,errorBoundary:de,event:ue,label:me,purge:fe,warn:pe}=ne,he=e=>{return ne.warn((t=_,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},ge=he,ye=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>he(t)),be=ye("Method"),ve=ye("Method","replaced with"),ze=ye("Option"),we=["min-height","min-width","max-height","max-width"],$e=new Set,Se=e=>e.tagName?e.tagName.toLowerCase():"unknown",Oe=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Me=(e,t)=>{return(n=Oe(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function ke({href:e}){$e.has(e)||(re("Unable to access stylesheet:",e),$e.add(e))}const Ee=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){ke(n)}return{source:"cross-origin stylesheet",value:Oe(e,t)}}(e,t),Ie=(e,t)=>{const{source:n,value:o}=Ee(e,t),r=Se(e);he(`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</>.\n\nIf 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 Te(){for(const e of[document.documentElement,document.body])for(const t of we)re(`Checking <${Se(e)}> for blocking CSS: ${t}`),Me(e,t)&&Ie(e,t)}const je=e=>t=>void 0===t?void 0:e(t),xe=je(e=>"true"===e),Ae=je(Number),Pe=(e="")=>t=>n=>{n.size>0&&ae(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Ne=Pe("attached to"),Ce=((e="")=>t=>n=>{n.size>0&&le(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Re=Pe("detached from"),qe=(e,o=!0)=>r=>{r>0&&ie(`${o?"At":"De"}tached ${e}Observer ${o?"to":"from"} %c${r}%c element${1===r?"":"s"}`,n,t)},Le=(e,t,n,o)=>{const r=Re(e);return e=>{const i=new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},Be="Mutation",De=new Set,We=new Set,Fe=new Set,Ve=[],He={attributes:!0,attributeFilter:[b,g],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ue,Ze=1,Je=!1,_e=0;const Qe=Pe("added")(Be),Ye=Pe("removed (page)")(Be),Ge=Pe("removed (added)")(Be),Xe=e=>e.nodeType!==Node.ELEMENT_NODE||R.has(e.tagName.toLowerCase());function Ke(e){const t=e.addedNodes;for(const e of t)Xe(e)||De.add(e)}function et(e){const t=e.removedNodes;for(const e of t)Xe(e)||(De.has(e)?(De.delete(e),Fe.add(e)):We.add(e))}const tt=e=>{ie("Mutations:",e);for(const t of e)Ke(t),et(t);Qe(De),Ye(We),Ge(Fe),Fe.clear()};const nt=e=>()=>{const t=performance.now(),r=t-_e,i=16*Ze+++2;if(r>i&&r<200)return ue("mutationThrottled"),ie("Update delayed due to heavy workload on the callStack"),ie(`EventLoop busy time: %c${Q(r)}ms %c> Max wait: %c${i-2}ms`,n,o,n),setTimeout(Ue,16*Ze),void(_e=t);Ze=1,Ve.forEach(tt),Ve.length=0,Je=!1,We.size>0&&re(`Detected %c${We.size} %cremoved element${We.size>1?"s":""}`,n,o),De.size>0&&re(`Found %c${De.size} %cnew element${De.size>1?"s":""}`,n,o),e({addedNodes:De,removedNodes:We}),De.clear(),We.clear()};function ot(e){Ve.push(e),Je||(_e=performance.now(),Je=!0,requestAnimationFrame(Ue))}function rt(e){const t=new window.MutationObserver(ot),n=document.body||document.documentElement;return Ue=nt(e),t.observe(n,He),ie("Attached MutationObserver to body"),{...t,disconnect:()=>{De.clear(),We.clear(),Ve.length=0,t.disconnect(),ie("Detached MutationObserver")}}}const it="Overflow",at=qe(it),st=qe(it,!1),ct=Ne(it),lt=Ce(it),dt=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,ut=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||_,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(y,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t;if(!o)continue;const i=e[n],c=a(i,o)&&!dt(r);s(r,c)}r(i)},o),l=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(l.has(r)?t.add(r):(c.observe(r),l.add(r),n.add(r),o+=1));lt(t),ct(n),at(o),n.clear(),t.clear()},detachObservers:Le(it,c,l,st),disconnect:()=>{c.disconnect(),ie("Detached OverflowObserver")}}},mt="--ifr-start",ft="--ifr-end",pt="--ifr-measure",ht=[];let gt,yt={},bt=0;function vt(){try{performance.clearMarks(mt),performance.clearMarks(ft),performance.clearMeasures(pt)}catch{}}function zt(e){e.getEntries().forEach(e=>{if(e.name===ft)try{const{duration:t}=performance.measure(pt,mt,ft);yt=e.detail,ht.push(t),ht.length>100&&ht.shift()}catch{}})}function wt(){ie("Attached PerformanceObserver to page");const e=new PerformanceObserver(zt);return e.observe({entryTypes:["mark"]}),gt=setInterval(()=>{if(ht.length<10)return;if(yt.hasTags&&yt.len<25)return;ht.sort();const e=Math.min(ht.reduce((e,t)=>e+t,0)/ht.length,ht[Math.floor(ht.length/2)]),t=Q(e);t>bt&&(bt=t,ue("performanceObserver"),re("Mean time:",Q(ht[Math.floor(ht.length/2)])),re("Median time:",Q(ht.reduce((e,t)=>e+t,0)/ht.length)),re("Average time:",t),re("Max time:",Q(Math.max(...ht)))),vt(),e<=4||(clearInterval(gt),he(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${Q(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${yt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{vt(),clearInterval(gt),e.disconnect(),ie("Detached PerformanceObserver")}}}const $t="Resize",St=qe($t),Ot=qe($t,!1),Mt=Ne($t),kt=Ce($t),Et=new WeakSet,It=new Set,Tt=new Set;let jt;function xt(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(Et.has(n)?It.add(n):(jt.observe(n),Et.add(n),Tt.add(n),t+=1))}kt(It),Mt(Tt),St(t),Tt.clear(),It.clear()}function At(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;return t.observe(n),ie("Attached VisibilityObserver to page"),{disconnect:()=>{t.disconnect(),ie("Detached VisibilityObserver")}}}const Pt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Nt=Pt("function"),Ct=Pt("number"),Rt=Pt("string");"undefined"!=typeof window&&function(){const e={height:()=>(pe("Custom height calculation function not defined"),In.auto()),width:()=>(pe("Custom width calculation function not defined"),Tn.auto())},L={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},W={},V="auto",te=[],oe="scroll";let fe,ye,we,$e,Se,Oe,Me,ke,Ee,Ie=!0,je="",Pe=0,Ne="",Ce="",Re=!1,qe=!0,Be=!1,De=!0,We=!1,Fe=!1,Ve=!0,He=!1,Ue=1,Ze=V,Je="",_e=!0,Qe={},Ye=!1,Ge=!1,Xe=!1,Ke=0,et=!1,tt=0,nt=0,ot=new Set,it="",at="child",st=!1,ct="",lt=[],dt=window.parent,pt="*",ht=0,gt=!1,yt=1,bt=oe,vt=window,zt=()=>{pe("onMessage function not defined")},St=()=>{},Mt=null,kt=null;function It(t){var o;!function(e){it=e[0]??it,Pe=Ae(e[1])??Pe,Be=xe(e[2])??Be,Xe=xe(e[3])??Xe,Ie=xe(e[6])??Ie,Ne=e[7]??Ne,Ze=e[8]??Ze,je=e[9]??je,Ce=e[10]??Ce,ht=Ae(e[11])??ht,Qe.enable=xe(e[12])??!1,at=e[13]??at,bt=e[14]??bt,et=xe(e[15])??et,tt=Ae(e[16])??tt,nt=Ae(e[17])??nt,qe=xe(e[18])??qe,fe=e[19]??fe,ke=e[20]??ke,Ke=Ae(e[21])??Ke,Ge=xe(e[23])??Ge}(t),ee=(o={id:it,enabled:Xe,expand:Ge}).id||s,ne.label(`${ee}`),ne.expand(o.expand),K=o.enabled,re(`Initialising iframe v${a} ${window.location.href}`),function(){function t(e){re("Reading data from page:",Object.keys(e)),Ee=Nt(e,"onBeforeResize")??Ee,zt=Nt(e,"onMessage")??zt,St=Nt(e,"onReady")??St,"number"==typeof e?.offset&&(ze("offset","offsetSize"),qe&&(tt=Ct(e,"offset")??tt),Be&&(nt=Ct(e,"offset")??nt)),"number"==typeof e?.offsetSize&&(qe&&(tt=Ct(e,"offsetSize")??tt),Be&&(nt=Ct(e,"offsetSize")??nt)),ye=Rt(e,B(D[0]))??ye,Je=Rt(e,"ignoreSelector")??Je,ct=Rt(e,"sizeSelector")??ct,pt=Rt(e,"targetOrigin")??pt,Ze=e?.heightCalculationMethod||Ze,bt=e?.widthCalculationMethod||bt}function o(t,n){return"function"==typeof t&&(he(`<rb>Deprecated Option(${n}CalculationMethod)</>\n\nThe use of <b>${n}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),e[n]=t,t="custom"),t}if(1===Ke)return;const r=window.iframeResizer||window.iFrameResizer;"object"==typeof r&&(t(r),Ze=o(Ze,v),bt=o(bt,z),ie(`Set targetOrigin for parent: %c${pt}`,n))}(),[Wt,Vt,tn,Bt,Ft,Kt,en,Gt,Dt,qt,Re?_:Te,Zt,sn,an,rn,Jt,()=>Ht("background",je),()=>Ht("padding",Ce),Re?_:_t,on,nn,vn,Tt].forEach(e=>{try{e()}catch(e){if(Ke<0)throw e;he("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),le(e)}}),Pt(J(St)),re("Initialization complete"),Rn(l,"Init message from host page",void 0,void 0,`${a}:${Ke}`),document.title&&""!==document.title&&Bn(0,0,p,document.title)}function Tt(){q(window,c.toLowerCase(),()=>{te.forEach(e=>e()),Bn(0,0,c)})}function Pt(e){"complete"===document.readyState?Z(e):q(document,w,()=>Pt(e))}function qt(){lt=document.querySelectorAll(`[${g}]`),He=lt.length>0,re(`Tagged elements found: %c${He}`,n)}let Lt=0;function Bt(){const e=document.querySelectorAll(`*[${b}]`);return We=e.length>0,We&&e.length!==Lt&&(function(e){const n=1===e.length?"":"s";pe(`%c[${b}]%c found on %c${e.length}%c element${n}`,i,t,i,t)}(e),Lt=e.length),We}function Dt(){"BackCompat"===document.compatMode&&he("<rb>Quirks Mode Detected</>\n\nThis 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</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n")}function Wt(){ke&&""!==ke&&"false"!==ke?ke!==a&&he(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ke} - Child page: ${a}.\n`):he("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n")}function Ft(){try{st=1===Ke||"iframeParentListener"in window.parent}catch(e){re("Cross domain iframe detected")}}function Vt(){Be===qe&&(Re=!0)}function Ht(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),ie(`Set body ${e}: %c${t}`,n))}function Ut(e,t,o){if(""!==o){re(`${e}: %c${o}`,n);for(const e of document.querySelectorAll(o))re(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Zt(){Ut("sizeSelector",g,ct),Ut("ignoreSelector",b,Je)}function Jt(){var e,t;void 0===Ne&&(Ne=`${Pe}px`),Ht("margin",(e="margin",(t=Ne).includes("-")&&(pe(`Negative CSS value ignored for ${e}`),t=""),t))}function _t(){const e=e=>e.style.setProperty(v,"auto","important");e(document.documentElement),e(document.body),re("Set HTML & body height: %cauto !important",n)}function Qt(e){({add(t){function n(){Rn(e.eventName,e.eventType)}W[t]=n,q(window,t,n,{passive:!0})},remove(e){const t=W[e];var n,o;delete W[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),re(`${Y(e.method)} event listener: %c${e.eventType}`,n)}function Yt(e){Qt({method:e,eventType:"After Print",eventName:"afterprint"}),Qt({method:e,eventType:"Before Print",eventName:"beforeprint"}),Qt({method:e,eventType:"Ready State Change",eventName:w})}function Gt(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&he("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}function Xt(e,t,o){const{label:r}=o;return t!==e&&(e in o||(pe(`${e} is not a valid option for ${r}CalculationMethod.`),e=t),e in L)&&he(`<rb>Deprecated ${r}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${ke?"remove this option.":`set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page. This can be done on the child page by adding the following code:\n \nwindow.iframeResizer = {\n license: 'xxxx',\n ${r}CalculationMethod: 'auto',\n}\n`}\n`),re(`Set ${r} calculation method: %c${e}`,n),e}function Kt(){Ze=Xt(Ze,V,In)}function en(){bt=Xt(bt,oe,Tn)}function tn(){const e=Ke,n=U({key:fe}),o=U({key:ye});if(Ke=Math.max(n,o),Ke<0){if(Ke=Math.min(n,o),he(`${H(Ke+2)}${H(2)}`),G(ke))throw H(Ke+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!G(ke)||e>-1&&Ke>e)&&(sessionStorage.getItem("ifr")!==a&&function(e,n){console.info(`${ee} %ciframe-resizer ${e}`,K||n<1?"font-weight: bold;":t)}(`v${a} (${(e=>B(F[e]))(Ke)})`,Ke),Ke<2&&ge(H(3)),sessionStorage.setItem("ifr",a))}function nn(){!0!==Ie&&re("Auto Resize disabled"),Yt("add"),te.push(()=>Yt("remove"))}function on(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function rn(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,h)+parseInt(n.x,h),y:parseInt(t.top,h)+parseInt(n.y,h)}}function t(t){const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(re(`In page link (#${r}) not found in iframe, so sending to parent`),Bn(0,0,"inPageLink",`#${r}`)):function(t){const i=e(t);re(`Moving to in page link (%c#${r}%c) at x: %c${i.x}%c y: %c${i.y}`,n,o,n,o,n),Bn(i.y,i.x,f)}(a)}function r(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}Qe.enable?1===Ke?he("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):(re("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&q(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),q(window,"hashchange",r),setTimeout(r,128)):re("In page linking not enabled"),Qe={findTarget:t}}function an(){function e(e){Bn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){re(`Add event listener: %c${o}`,n),q(window.document,t,e)}!0===et&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}function sn(){1!==Ke&&(vt.parentIframe=Object.freeze({autoResize:e=>(X(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Be&&!1===qe?(ue(O),he("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Ie?(Ie=!0,queueMicrotask(()=>Rn(O,"Auto Resize enabled"))):!1===e&&!0===Ie&&(Ie=!1),Bn(0,0,"autoResize",JSON.stringify(Ie)),Ie)),close(){Bn(0,0,"close")},getId:()=>it,getOrigin:()=>(ue("getOrigin"),be("getOrigin()","getParentOrigin()"),we),getParentOrigin:()=>we,getPageInfo(e){if("function"==typeof e)return Mt=e,Bn(0,0,u),void ve("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Mt=null,Bn(0,0,"pageInfoStop")},getParentProps:e=>(X(e,"function","parentIframe.getParentProps(callback) callback"),kt=e,Bn(0,0,m),()=>{kt=null,Bn(0,0,"parentInfoStop")}),getParentProperties(e){be("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){X(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Qe.findTarget(e)},reset(){!function(){const e=Ze;Ze=V,re(`Reset trigger event: %c${"parentIframe.reset"}`,n),gt?re("TriggerLock blocked calculation"):(gt=!0,ae("Trigger event lock on"),requestAnimationFrame(()=>{gt=!1,ae("Trigger event lock off")})),qn("reset"),Ze=e}()},setOffsetSize(e){X(e,"number","parentIframe.setOffsetSize(offset) offset"),tt=e,nt=e,Rn(T,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){X(e,"number","parentIframe.scrollBy(x, y) x"),X(t,"number","parentIframe.scrollBy(x, y) y"),Bn(t,e,"scrollBy")},scrollTo(e,t){X(e,"number","parentIframe.scrollTo(x, y) x"),X(t,"number","parentIframe.scrollTo(x, y) y"),Bn(t,e,"scrollTo")},scrollToOffset(e,t){X(e,"number","parentIframe.scrollToOffset(x, y) x"),X(t,"number","parentIframe.scrollToOffset(x, y) y"),Bn(t,e,f)},sendMessage(e,t){t&&X(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Bn(0,0,d,JSON.stringify(e),t)},setHeightCalculationMethod(e){Ze=e,Kt()},setWidthCalculationMethod(e){bt=e,en()},setTargetOrigin(e){X(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),re(`Set targetOrigin: %c${e}`,n),pt=e},resize(e,t){void 0!==e&&X(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&X(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Rn(k,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){be("size()","resize()"),this.resize(e,t)}}),vt.parentIFrame=vt.parentIframe)}let cn=new Set;function ln(){const e=document.querySelectorAll(`[${y}]`);ot=function(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(()=>{ue("overflowIgnored"),ie("Ignoring elements with [data-iframe-ignore] > *:\n",n),ce()}),t}(e),Fe=ot.size>0,"function"==typeof Set.prototype.symmetricDifference&&(Ve=ot.symmetricDifference(cn).size>0),cn=ot}function dn(){switch(ln(),!0){case!Ve:return;case ot.size>1:ie("Overflowed Elements:",ot);break;case Fe:break;default:ie("No overflow detected")}Rn(x,"Overflow updated")}function un(e){const t={root:document.documentElement,side:qe?$:S};return $e=ut(dn,t),$e.attachObservers(e),$e}function mn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Rn(j,`Element resized <${function(e){switch(!0){case!G(e):return"";case G(e.id):return`${e.nodeName}#${e.id}`;case G(e.name):return`${e.nodeName} (${e.name}`;case G(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function fn(e){return jt=new ResizeObserver(mn),jt.observe(document.body),Et.add(document.body),ie("Attached ResizeObserver to body"),Se={attachObserverToNonStaticElements:xt,detachObservers:Le($t,jt,Et,Ot),disconnect:()=>{jt.disconnect(),ie("Detached ResizeObserver")}},Se.attachObserverToNonStaticElements(e),Se}function pn(e){re(`Visible: %c${e}`,n),Ye=!e,Rn(P,"Visibility changed")}const hn=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of Sn(n))t.add(e)}return ie("Inspecting:\n",t),t},gn=e=>{if(0===e.size)return;ue("addObservers");const t=hn(e);$e.attachObservers(t),Se.attachObserverToNonStaticElements(t),ce()},yn=e=>{if(0===e.size)return;ue("removeObservers");const t=hn(e);$e.detachObservers(t),Se.detachObservers(t),ce()};function bn(e){!function({addedNodes:e,removedNodes:t}){ue("contentMutated"),Zt(),qt(),ln(),ce(),yn(t),gn(e)}(e),Rn(A,"Mutation Observed")}function vn(){const e=Sn(document.documentElement);var t;re("Attaching Observers"),t=[rt(bn),un(e),wt(),fn(e),At(pn)],te.push(...t.map(e=>e.disconnect))}function zn(e){performance.mark(mt);const t=Y(e);let r=1,i=document.documentElement,a=He?0:document.documentElement.getBoundingClientRect().bottom;const s=He?lt:Fe?Array.from(ot):Sn(document.documentElement);for(const t of s)r=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),r>a&&(a=r,i=t);return ie(`${t} position calculated from:`,i),ie(`Checked %c${s.length}%c elements`,n,o),performance.mark(ft,{detail:{hasTags:He,len:s.length,logging:Xe,Side:t}}),a}const wn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],$n=`* ${Array.from(R).map(e=>`:not(${e})`).join("")}`,Sn=e=>e.querySelectorAll($n),On={height:0,width:0},Mn={height:0,width:0},kn=[n,o,n];function En(e){function t(){return Mn[r]=i,On[r]=c,Math.max(i,1)}const o=e===In,r=e.label,i=e.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${i}px %cPage: %c${c}px`;let d=1;switch(!0){case!e.enabled():return Math.max(c,1);case He:ie("Found element with data-iframe-size attribute"),d=e.taggedElement();break;case!Fe&&De&&0===Mn[r]&&0===On[r]:ie(`Initial page size values: ${l}`,...kn),d=t();break;case gt&&i===Mn[r]&&c===On[r]:ie(`Size unchanged: ${l}`,...kn),d=Math.max(i,c);break;case 0===i&&0!==c:ie(`Page is hidden: ${l}`,...kn),d=c;break;case!Fe&&i!==Mn[r]&&c<=On[r]:ie(`New <html> size: ${l} `,...kn),ie(`Previous <html> size: %c${Mn[r]}px`,n),d=t();break;case!o:d=e.taggedElement();break;case!Fe&&i<Mn[r]:ie(`<html> size decreased: ${l}`,...kn),d=t();break;case c===s||c===a:ie(`<html> size equals page size: ${l}`,...kn),d=t();break;case i>c:ie(`Page size < <html> size: ${l}`,...kn),d=t();break;case Fe:ie("Found elements possibly overflowing <html> "),d=e.taggedElement();break;default:ie(`Using <html> size: ${l}`,...kn),d=t()}return ie(`Content ${r}: %c${d}px`,n),d+=function(e){const t=e.getOffset();return 0!==t&&ie(`Page offsetSize: %c${t}px`,n),t}(e),Math.max(d,1)}const In={label:v,enabled:()=>qe,getOffset:()=>tt,auto:()=>En(In),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,h)+parseInt(t.marginBottom,h)},bodyScroll:()=>document.body.scrollHeight,offset:()=>In.bodyOffset(),custom:()=>e.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...wn(In)),min:()=>Math.min(...wn(In)),grow:()=>In.max(),lowestElement:()=>zn($),taggedElement:()=>zn($)},Tn={label:z,enabled:()=>Be,getOffset:()=>nt,auto:()=>En(Tn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>e.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...wn(Tn)),min:()=>Math.min(...wn(Tn)),rightMostElement:()=>zn(S),scroll:()=>Math.max(Tn.bodyScroll(),Tn.documentElementScroll()),taggedElement:()=>zn(S)},jn=(e,t)=>!(Math.abs(e-t)<=ht);function xn(e,t){const n=e[t](),o=e.enabled()&&void 0!==Ee?function(e){const t=Ee(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least 1`);return t}(n):n;return se(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let An=!1;const Pn=J(()=>ge(H(4)));let Nn,Cn=!1;const Rn=de((e,t,o,r,i)=>{switch(ue(e),!0){case!0===Ye:if(!0===Cn)break;re("Iframe hidden - Ignored resize request"),Cn=!0,An=!1,cancelAnimationFrame(Nn);break;case!0===An&&e!==x:re("Resize already pending - Ignored resize request");break;case!Ie&&!(e in I):ie("Resizing disabled");break;default:Cn=!1,An=!0,Me=performance.now(),Oe=!0,Nn=requestAnimationFrame(()=>{An=!1,ue("requestAnimationFrame"),ae(`Reset sendPending: %c${e}`,n)}),function(e,t,o,r,i){const a=o??xn(In,Ze),s=r??xn(Tn,bt),c=qe&&jn(Ue,a)||Be&&jn(yt,s)?M:e;switch(re(`Resize event: %c${t}`,n),c){case l:case O:case M:Ue=a,yt=s;case T:Ln(Ue,yt,e,i);break;case x:case A:case j:case P:re(N);break;default:ie(N)}Oe=!1}(e,t,o,r,i)}ce()});function qn(e){Ue=In[Ze](),yt=Tn[bt](),Bn(Ue,yt,e)}function Ln(e,t,o,i,a){Ke<-1||(void 0!==a?re(`Message targetOrigin: %c${a}`,n):a=pt,function(){const s=`${it}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(st)try{window.parent.iframeParentListener(C+s)}catch(e){if(1!==Ke)throw e;return void Pn()}else dt.postMessage(C+s,a);Oe&&re(function(){const e=Q(performance.now()-Me);return o===l?`Initialised iframe in %c${e}ms`:`Size calculated in %c${e}ms`}(),n),ie(`Sending message to parent page via ${st?"sameOrigin":"postMessage"}: %c%c${s}`,r,n)}())}const Bn=de((e,t,n,o,r)=>{ue(n),Ln(e,t,n,o,r),ce()}),Dn=de(function(e){ue("onMessage");const{freeze:t}=Object,{parse:o}=JSON,r=e=>t(o(e)),i=e=>Bn(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void re("Page not ready, ignoring init message");const t=e.data.slice(13).split(":");dt=e.source,we=e.origin,It(t),De=!1,setTimeout(()=>{_e=!1},128)},reset(){_e?re("Page reset ignored by init"):(re("Page size reset by host page"),qn("resetPage"))},resize(){re("Resize requested by host page"),Rn(E,"Parent window requested size check")},moveToAnchor(){Qe.findTarget(c())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=c();re("PageInfo received from parent:",r(e)),Mt?Z(Mt,o(e)):i(u)},parentInfo(){const e=r(c());re("ParentInfo received from parent:",e),kt?Z(kt,e):i(m)},message(){const e=c();re("onMessage called from parent:%c",n,r(e)),Z(zt,o(e))}},s=()=>e.data.split("]")[1].split(":")[0],c=()=>e.data.slice(e.data.indexOf(":")+1),d=()=>e.data.split(":")[2]in{true:1,false:1};function f(){const t=s();ue(t),t in a?a[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||d()||pe(`Unexpected message (${e.data})`)}C===`${e.data}`.slice(0,13)&&function(){if(!1!==De)return d()?(me(s()),ue(l),void a.init()):void re(`Ignored message of type "${s()}". Received before initialization.`);f()}()});let Wn=!1;const Fn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function Vn(){if("loading"===document.readyState||!De||Wn)return;const{parent:e,top:t}=window;ue("ready"),re("Sending%c ready%c to parent from",n,o,window.location.href),Fn(e),e!==t&&Fn(t),Wn=!0}"iframeChildListener"in window?pe("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Dn({data:e,sameOrigin:!0})),q(window,d,Dn),q(document,w,Vn),Vn())}();
20
+ import e,{NORMAL as t,HIGHLIGHT as n,FOREGROUND as o,ITALIC as r,BOLD as a}from"auto-console-group";const i="5.5.7-beta.1",s="iframeResizer",c=":",l="init",d="message",u="pageHide",m="pageInfo",f="parentInfo",p="scrollToOffset",h="title",g=10,y="data-iframe-size",b="data-iframe-overflowed",v="data-iframe-ignore",z="height",w="width",$="offset",S="offsetSize",O="string",M="number",k="object",E="function",I="auto",j="readystatechange",T="bottom",x="right",A="autoResizeEnabled",P=Symbol("sizeChanged"),N="manualResize",C="parentResize",R={[N]:1,[C]:1},L="setOffsetSize",q="resizeObserver",B="overflowObserver",D="mutationObserver",W="visibilityObserver",F="No change in content size detected",V="[iFrameSizer]",H=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),U=(e,t,n,o)=>e.addEventListener(t,n,o||!1),Z=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)},J=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),_=["spjluzl","rlf","clyzpvu"],Q=["<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."],Y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],G=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),X=e=>J(Q[e]),K=e=>{const t=e[J(_[0])]||e[J(_[1])]||e[J(_[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=Z(J(e));return n in G&&(t=G[n]),t}(n[0]);return 0===o||(e=>e[2]===Z(e[0]+e[1]))(n)||(o=-2),o},ee=(e,...t)=>setTimeout(()=>e(...t),0),te=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},ne=e=>e,oe=e=>Math.round(1e3*e)/1e3,re=e=>e.charAt(0).toUpperCase()+e.slice(1),ae=e=>""!=`${e}`&&void 0!==e,ie=e=>e();const se=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${re(t)}`)};let ce=!0,le=s;var de;const ue=(de=e,de?.__esModule?de.default:de)({label:`${s}(child)`,expand:!1});const me=e=>(...t)=>!ce||ue[e](...t),fe=me("log"),pe=fe,he=me("debug");const{assert:ge,endAutoGroup:ye,error:be,errorBoundary:ve,event:ze,label:we,purge:$e,warn:Se}=ue,Oe=e=>{return ue.warn((t=ne,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},Me=(e=>(t,n="renamed to")=>(o,r,a="",i="")=>e(i,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${a}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>Oe(t)),ke=Me("Method"),Ee=Me("Method","replaced with"),Ie=Me("Option"),je=["min-height","min-width","max-height","max-width"],Te=new Set,xe=e=>e.tagName?e.tagName.toLowerCase():"unknown",Ae=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Pe=(e,t)=>{return(n=Ae(e,t))&&"0px"!==n&&n!==I&&"none"!==n;var n};function Ne({href:e}){Te.has(e)||(fe("Unable to access stylesheet:",e),Te.add(e))}const Ce=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){Ne(n)}return{source:"cross-origin stylesheet",value:Ae(e,t)}}(e,t),Re=(e,t)=>{const{source:n,value:o}=Ce(e,t),r=xe(e);Oe(`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</>.\n\nIf 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 Le(){for(const e of[document.documentElement,document.body])for(const t of je)fe(`Checking <${xe(e)}> for blocking CSS: ${t}`),Pe(e,t)&&Re(e,t)}const qe=e=>t=>void 0===t?void 0:e(t),Be=qe(e=>"true"===e),De=qe(Number),We=(e="")=>t=>n=>{n.size>0&&he(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Fe=We("attached to"),Ve=((e="")=>t=>n=>{n.size>0&&be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),He=We("detached from"),Ue=(e,o=!0)=>r=>{r>0&&pe(`${o?"At":"De"}tached ${e}Observer ${o?"to":"from"} %c${r}%c element${1===r?"":"s"}`,n,t)},Ze=(e,t,n,o)=>{const r=He(e);return e=>{const a=new Set;let i=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),a.add(o),i+=1);r(a),o(i),a.clear()}},Je="Mutation",_e=new Set,Qe=new Set,Ye=new Set,Ge=[],Xe={attributes:!0,attributeFilter:[v,y],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ke,et=1,tt=!1,nt=0;const ot=We("added")(Je),rt=We("removed (page)")(Je),at=We("removed (added)")(Je),it=e=>e.nodeType!==Node.ELEMENT_NODE||H.has(e.tagName.toLowerCase());function st(e){const t=e.addedNodes;for(const e of t)it(e)||_e.add(e)}function ct(e){const t=e.removedNodes;for(const e of t)it(e)||(_e.has(e)?(_e.delete(e),Ye.add(e)):Qe.add(e))}const lt=e=>{pe("Mutations:",e);for(const t of e)st(t),ct(t);ot(_e),rt(Qe),at(Ye),Ye.clear()};const dt=e=>()=>{const t=performance.now(),r=t-nt,a=16*et+++2;if(r>a&&r<200)return ze("mutationThrottled"),pe("Update delayed due to heavy workload on the callStack"),pe(`EventLoop busy time: %c${oe(r)}ms %c> Max wait: %c${a-2}ms`,n,o,n),setTimeout(Ke,16*et),void(nt=t);et=1,Ge.forEach(lt),Ge.length=0,tt=!1,Qe.size>0&&fe(`Detected %c${Qe.size} %cremoved element${Qe.size>1?"s":""}`,n,o),_e.size>0&&fe(`Found %c${_e.size} %cnew element${_e.size>1?"s":""}`,n,o),e({addedNodes:_e,removedNodes:Qe}),_e.clear(),Qe.clear()};function ut(e){Ge.push(e),tt||(nt=performance.now(),tt=!0,requestAnimationFrame(Ke))}function mt(e){const t=new window.MutationObserver(ut),n=document.body||document.documentElement;return Ke=dt(e),t.observe(n,Xe),pe("Attached MutationObserver to body"),{...t,disconnect:()=>{_e.clear(),Qe.clear(),Ge.length=0,t.disconnect(),pe("Detached MutationObserver")}}}const ft="Overflow",pt=Ue(ft),ht=Ue(ft,!1),gt=Fe(ft),yt=Ve(ft),bt=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,vt=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||ne,a=(t=!1)=>e(t),i=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(b,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t;if(!o)continue;const a=e[n],c=i(a,o)&&!bt(r);s(r,c)}r(a)},o),l=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(l.has(r)?t.add(r):(c.observe(r),l.add(r),n.add(r),o+=1));yt(t),gt(n),pt(o),n.clear(),t.clear()},detachObservers:Ze(ft,c,l,ht),disconnect:()=>{c.disconnect(),pe("Detached OverflowObserver")}}},zt="--ifr-start",wt="--ifr-end",$t="--ifr-measure",St=[];let Ot,Mt={},kt=0;function Et(){try{performance.clearMarks(zt),performance.clearMarks(wt),performance.clearMeasures($t)}catch{}}function It(e){e.getEntries().forEach(e=>{if(e.name===wt)try{const{duration:t}=performance.measure($t,zt,wt);Mt=e.detail,St.push(t),St.length>100&&St.shift()}catch{}})}function jt(){pe("Attached PerformanceObserver to page");const e=new PerformanceObserver(It);return e.observe({entryTypes:["mark"]}),Ot=setInterval(()=>{if(St.length<10)return;if(Mt.hasTags&&Mt.len<25)return;St.sort();const e=Math.min(St.reduce((e,t)=>e+t,0)/St.length,St[Math.floor(St.length/2)]),t=oe(e);t>kt&&(kt=t,ze("performanceObserver"),fe("Mean time:",oe(St[Math.floor(St.length/2)])),fe("Median time:",oe(St.reduce((e,t)=>e+t,0)/St.length)),fe("Average time:",t),fe("Max time:",oe(Math.max(...St)))),Et(),e<=4||(clearInterval(Ot),Oe(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${oe(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Mt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{Et(),clearInterval(Ot),e.disconnect(),pe("Detached PerformanceObserver")}}}const Tt="Resize",xt=Ue(Tt),At=Ue(Tt,!1),Pt=Fe(Tt),Nt=Ve(Tt),Ct=new WeakSet,Rt=new Set,Lt=new Set;let qt;function Bt(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(Ct.has(n)?Rt.add(n):(qt.observe(n),Ct.add(n),Lt.add(n),t+=1))}Nt(Rt),Pt(Lt),xt(t),Lt.clear(),Rt.clear()}function Dt(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;return t.observe(n),pe("Attached VisibilityObserver to page"),{disconnect:()=>{t.disconnect(),pe("Detached VisibilityObserver")}}}const Wt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ft=Wt(E),Vt=Wt(M),Ht=Wt(O);"undefined"!=typeof window&&function(){const e={height:()=>(Se("Custom height calculation function not defined"),Ln.auto()),width:()=>(Se("Custom width calculation function not defined"),qn.auto())},Z={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},Q={},G=I,de=[],me="scroll";let $e,Me,je,Te,xe,Ae,Pe,Ne,Ce,Re=!0,qe="",We=0,Fe="",Ve="",He=!1,Ue=!0,Je=!1,_e=!0,Qe=!1,Ye=!1,Ge=!0,Xe=!1,Ke=1,et=G,tt="",nt=!0,ot={},rt=!1,at=!1,it=!1,st=0,ct=!1,lt=0,dt=0,ut=new Set,ft="",pt="child",ht=!1,gt="",yt=[],bt=window.parent,$t="*",St=0,Ot=!1,Mt=1,kt=me,Et=window,It=()=>{Se("onMessage function not defined")},xt=()=>{},Pt=null,Nt=null;function Rt(t){var o;!function(e){ft=e[0]??ft,We=De(e[1])??We,Je=Be(e[2])??Je,it=Be(e[3])??it,Re=Be(e[6])??Re,Fe=e[7]??Fe,et=e[8]??et,qe=e[9]??qe,Ve=e[10]??Ve,St=De(e[11])??St,ot.enable=Be(e[12])??!1,pt=e[13]??pt,kt=e[14]??kt,ct=Be(e[15])??ct,lt=De(e[16])??lt,dt=De(e[17])??dt,Ue=Be(e[18])??Ue,$e=e[19]??$e,Ne=e[20]??Ne,st=De(e[21])??st,at=Be(e[23])??at}(t),le=(o={id:ft,enabled:it,expand:at}).id||s,ue.label(`${le}`),ue.expand(o.expand),ce=o.enabled,fe(`Initialising iframe v${i} ${window.location.href}`),function(){function t(e){fe("Reading data from page:",Object.keys(e)),Ce=Ft(e,"onBeforeResize")??Ce,It=Ft(e,"onMessage")??It,xt=Ft(e,"onReady")??xt,typeof e?.offset===M&&(Ie($,S),Ue&&(lt=Vt(e,$)??lt),Je&&(dt=Vt(e,$)??dt)),typeof e?.offsetSize===M&&(Ue&&(lt=Vt(e,S)??lt),Je&&(dt=Vt(e,S)??dt)),Me=Ht(e,J(_[0]))??Me,tt=Ht(e,"ignoreSelector")??tt,gt=Ht(e,"sizeSelector")??gt,$t=Ht(e,"targetOrigin")??$t,et=e?.heightCalculationMethod||et,kt=e?.widthCalculationMethod||kt}function o(t,n){return typeof t===E&&(Oe(`<rb>Deprecated Option(${n}CalculationMethod)</>\n\nThe use of <b>${n}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),e[n]=t,t="custom"),t}if(1===st)return;const r=window.iframeResizer||window.iFrameResizer;typeof r===k&&(t(r),et=o(et,z),kt=o(kt,w),pe(`Set targetOrigin for parent: %c${$t}`,n))}(),[Yt,Xt,un,_t,Gt,ln,dn,sn,Qt,Zt,He?ne:Le,tn,gn,hn,pn,nn,()=>Kt("background",qe),()=>Kt("padding",Ve),He?ne:on,fn,mn,In,Wt].forEach(e=>{try{e()}catch(e){if(st<0)throw e;Oe("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),be(e)}}),Ut(te(xt)),fe("Initialization complete"),Un(l,"Init message from host page",void 0,void 0,`${i}:${st}`),document.title&&""!==document.title&&_n(0,0,h,document.title)}function Lt({persisted:e}){e||_n(0,0,"beforeUnload"),ze(u),pe("Page persisted:",e),e||de.forEach(ie)}const Wt=()=>U(window,u.toLowerCase(),Lt);function Ut(e){"complete"===document.readyState?ee(e):U(document,j,()=>Ut(e))}function Zt(){yt=document.querySelectorAll(`[${y}]`),Xe=yt.length>0,fe(`Tagged elements found: %c${Xe}`,n)}let Jt=0;function _t(){const e=document.querySelectorAll(`*[${v}]`);return Qe=e.length>0,Qe&&e.length!==Jt&&(function(e){const n=1===e.length?"":"s";Se(`%c[${v}]%c found on %c${e.length}%c element${n}`,a,t,a,t)}(e),Jt=e.length),Qe}function Qt(){"BackCompat"===document.compatMode&&Oe("<rb>Quirks Mode Detected</>\n\nThis 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</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n")}function Yt(){Ne&&""!==Ne&&"false"!==Ne?Ne!==i&&Oe(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ne} - Child page: ${i}.\n`):Oe("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n")}function Gt(){try{ht=1===st||"iframeParentListener"in window.parent}catch(e){fe("Cross domain iframe detected")}}function Xt(){Je===Ue&&(He=!0)}function Kt(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),pe(`Set body ${e}: %c${t}`,n))}function en(e,t,o){if(""!==o){fe(`${e}: %c${o}`,n);for(const e of document.querySelectorAll(o))fe(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function tn(){en("sizeSelector",y,gt),en("ignoreSelector",v,tt)}function nn(){var e,t;void 0===Fe&&(Fe=`${We}px`),Kt("margin",(e="margin",(t=Fe).includes("-")&&(Se(`Negative CSS value ignored for ${e}`),t=""),t))}function on(){const e=e=>e.style.setProperty(z,I,"important");e(document.documentElement),e(document.body),fe("Set HTML & body height: %cauto !important",n)}function rn(e){({add(t){function n(){Un(e.eventName,e.eventType)}Q[t]=n,U(window,t,n,{passive:!0})},remove(e){const t=Q[e];var n,o;delete Q[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),fe(`${re(e.method)} event listener: %c${e.eventType}`,n)}function an(e){rn({method:e,eventType:"After Print",eventName:"afterprint"}),rn({method:e,eventType:"Before Print",eventName:"beforeprint"}),rn({method:e,eventType:"Ready State Change",eventName:j})}function sn(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(y,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&Oe("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}function cn(e,t,o){const{label:r}=o;return t!==e&&(e in o||(Se(`${e} is not a valid option for ${r}CalculationMethod.`),e=t),e in Z)&&Oe(`<rb>Deprecated ${r}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${Ne?"remove this option.":`set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page. This can be done on the child page by adding the following code:\n \nwindow.iframeResizer = {\n license: 'xxxx',\n ${r}CalculationMethod: AUTO,\n}\n`}\n`),fe(`Set ${r} calculation method: %c${e}`,n),e}function ln(){et=cn(et,G,Ln)}function dn(){kt=cn(kt,me,qn)}function un(){const e=st,n=K({key:$e}),o=K({key:Me});if(st=Math.max(n,o),st<0){if(st=Math.min(n,o),Oe(`${X(st+2)}${X(2)}`),ae(Ne))throw X(st+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!ae(Ne)||e>-1&&st>e)&&(sessionStorage.getItem("ifr")!==i&&function(e,n){console.info(`${le} %ciframe-resizer ${e}`,ce||n<1?"font-weight: bold;":t)}(`v${i} (${(e=>J(Y[e]))(st)})`,st),st<2&&Oe(X(3)),sessionStorage.setItem("ifr",i))}function mn(){!0!==Re&&fe("Auto Resize disabled"),an("add"),de.push(()=>an("remove"))}function fn(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function pn(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,g)+parseInt(n.x,g),y:parseInt(t.top,g)+parseInt(n.y,g)}}function t(t){const r=t.split("#")[1]||t,a=decodeURIComponent(r),i=document.getElementById(a)||document.getElementsByName(a)[0];void 0===i?(fe(`In page link (#${r}) not found in iframe, so sending to parent`),_n(0,0,"inPageLink",`#${r}`)):function(t){const a=e(t);fe(`Moving to in page link (%c#${r}%c) at x: %c${a.x}%c y: %c${a.y}`,n,o,n,o,n),_n(a.y,a.x,p)}(i)}function r(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}const{enable:a}=ot;a?1===st?Oe(X(5)):(fe("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&U(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),U(window,"hashchange",r),setTimeout(r,128)):fe("In page linking not enabled"),ot={...ot,findTarget:t}}function hn(){function e(e){_n(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){fe(`Add event listener: %c${o}`,n),U(window.document,t,e)}!0===ct&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}function gn(){1!==st&&(Et.parentIframe=Object.freeze({autoResize:e=>(se(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Je&&!1===Ue?(ze(A),Oe("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Re?(Re=!0,queueMicrotask(()=>Un(A,"Auto Resize enabled"))):!1===e&&!0===Re&&(Re=!1),_n(0,0,"autoResize",JSON.stringify(Re)),Re)),close(){_n(0,0,"close")},getId:()=>ft,getOrigin:()=>(ze("getOrigin"),ke("getOrigin()","getParentOrigin()"),je),getParentOrigin:()=>je,getPageInfo(e){if(typeof e===E)return Pt=e,_n(0,0,m),void Ee("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Pt=null,_n(0,0,"pageInfoStop")},getParentProps:e=>(se(e,E,"parentIframe.getParentProps(callback) callback"),Nt=e,_n(0,0,f),()=>{Nt=null,_n(0,0,"parentInfoStop")}),getParentProperties(e){ke("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){se(e,O,"parentIframe.moveToAnchor(anchor) anchor"),ot.findTarget(e)},reset(){!function(){const e=et;et=G,fe(`Reset trigger event: %c${"parentIframe.reset"}`,n),Ot?fe("TriggerLock blocked calculation"):(Ot=!0,he("Trigger event lock on"),requestAnimationFrame(()=>{Ot=!1,he("Trigger event lock off")})),Zn("reset"),et=e}()},setOffsetSize(e){se(e,M,"parentIframe.setOffsetSize(offset) offset"),lt=e,dt=e,Un(L,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){se(e,M,"parentIframe.scrollBy(x, y) x"),se(t,M,"parentIframe.scrollBy(x, y) y"),_n(t,e,"scrollBy")},scrollTo(e,t){se(e,M,"parentIframe.scrollTo(x, y) x"),se(t,M,"parentIframe.scrollTo(x, y) y"),_n(t,e,"scrollTo")},scrollToOffset(e,t){se(e,M,"parentIframe.scrollToOffset(x, y) x"),se(t,M,"parentIframe.scrollToOffset(x, y) y"),_n(t,e,p)},sendMessage(e,t){t&&se(t,O,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),_n(0,0,d,JSON.stringify(e),t)},setHeightCalculationMethod(e){et=e,ln()},setWidthCalculationMethod(e){kt=e,dn()},setTargetOrigin(e){se(e,O,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),fe(`Set targetOrigin: %c${e}`,n),$t=e},resize(e,t){void 0!==e&&se(e,M,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&se(t,M,"parentIframe.resize(customHeight, customWidth) customWidth"),Un(N,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ke("size()","resize()"),this.resize(e,t)}}),Et.parentIFrame=Et.parentIframe)}let yn=new Set;function bn(){const e=document.querySelectorAll(`[${b}]`);ut=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${v}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{ze("overflowIgnored"),pe("Ignoring elements with [data-iframe-ignore] > *:\n",n),ye()}),t}(e),Ye=ut.size>0,typeof Set.prototype.symmetricDifference===E&&(Ge=ut.symmetricDifference(yn).size>0),yn=ut}function vn(){switch(bn(),!0){case!Ge:return;case ut.size>1:pe("Overflowed Elements:",ut);break;case Ye:break;default:pe("No overflow detected")}Un(B,"Overflow updated")}function zn(e){const t={root:document.documentElement,side:Ue?T:x};return Te=vt(vn,t),Te.attachObservers(e),Te}function wn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Un(q,`Element resized <${function(e){switch(!0){case!ae(e):return"";case ae(e.id):return`${e.nodeName}#${e.id}`;case ae(e.name):return`${e.nodeName} (${e.name}`;case ae(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function $n(e){return qt=new ResizeObserver(wn),qt.observe(document.body),Ct.add(document.body),pe("Attached ResizeObserver to body"),xe={attachObserverToNonStaticElements:Bt,detachObservers:Ze(Tt,qt,Ct,At),disconnect:()=>{qt.disconnect(),pe("Detached ResizeObserver")}},xe.attachObserverToNonStaticElements(e),xe}function Sn(e){fe(`Visible: %c${e}`,n),rt=!e,Un(W,"Visibility changed")}const On=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of An(n))t.add(e)}return pe("Inspecting:\n",t),t},Mn=e=>{if(0===e.size)return;ze("addObservers");const t=On(e);Te.attachObservers(t),xe.attachObserverToNonStaticElements(t),ye()},kn=e=>{if(0===e.size)return;ze("removeObservers");const t=On(e);Te.detachObservers(t),xe.detachObservers(t),ye()};function En(e){!function({addedNodes:e,removedNodes:t}){ze("contentMutated"),tn(),Zt(),bn(),ye(),kn(t),Mn(e)}(e),Un(D,"Mutation Observed")}function In(){const e=An(document.documentElement);var t;fe("Attaching Observers"),t=[mt(En),zn(e),jt(),$n(e),Dt(Sn)],de.push(...t.map(e=>e.disconnect))}function jn(e){performance.mark(zt);const t=re(e);let r=1,a=document.documentElement,i=Xe?0:document.documentElement.getBoundingClientRect().bottom;const s=Xe?yt:Ye?Array.from(ut):An(document.documentElement);for(const t of s)r=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),r>i&&(i=r,a=t);return pe(`${t} position calculated from:`,a),pe(`Checked %c${s.length}%c elements`,n,o),performance.mark(wt,{detail:{hasTags:Xe,len:s.length,logging:it,Side:t}}),i}const Tn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xn=`* ${Array.from(H).map(e=>`:not(${e})`).join("")}`,An=e=>e.querySelectorAll(xn),Pn={height:0,width:0},Nn={height:0,width:0},Cn=[n,o,n];function Rn(e){function t(){return Nn[r]=a,Pn[r]=c,Math.max(a,1)}const o=e===Ln,r=e.label,a=e.boundingClientRect(),i=Math.ceil(a),s=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${a}px %cPage: %c${c}px`;let d=1;switch(!0){case!e.enabled():return Math.max(c,1);case Xe:pe("Found element with data-iframe-size attribute"),d=e.taggedElement();break;case!Ye&&_e&&0===Nn[r]&&0===Pn[r]:pe(`Initial page size values: ${l}`,...Cn),d=t();break;case Ot&&a===Nn[r]&&c===Pn[r]:pe(`Size unchanged: ${l}`,...Cn),d=Math.max(a,c);break;case 0===a&&0!==c:pe(`Page is hidden: ${l}`,...Cn),d=c;break;case!Ye&&a!==Nn[r]&&c<=Pn[r]:pe(`New <html> size: ${l} `,...Cn),pe(`Previous <html> size: %c${Nn[r]}px`,n),d=t();break;case!o:d=e.taggedElement();break;case!Ye&&a<Nn[r]:pe(`<html> size decreased: ${l}`,...Cn),d=t();break;case c===s||c===i:pe(`<html> size equals page size: ${l}`,...Cn),d=t();break;case a>c:pe(`Page size < <html> size: ${l}`,...Cn),d=t();break;case Ye:pe("Found elements possibly overflowing <html> "),d=e.taggedElement();break;default:pe(`Using <html> size: ${l}`,...Cn),d=t()}return pe(`Content ${r}: %c${d}px`,n),d+=function(e){const t=e.getOffset();return 0!==t&&pe(`Page offsetSize: %c${t}px`,n),t}(e),Math.max(d,1)}const Ln={label:z,enabled:()=>Ue,getOffset:()=>lt,auto:()=>Rn(Ln),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,g)+parseInt(t.marginBottom,g)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ln.bodyOffset(),custom:()=>e.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Tn(Ln)),min:()=>Math.min(...Tn(Ln)),grow:()=>Ln.max(),lowestElement:()=>jn(T),taggedElement:()=>jn(T)},qn={label:w,enabled:()=>Je,getOffset:()=>dt,auto:()=>Rn(qn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>e.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Tn(qn)),min:()=>Math.min(...Tn(qn)),rightMostElement:()=>jn(x),scroll:()=>Math.max(qn.bodyScroll(),qn.documentElementScroll()),taggedElement:()=>jn(x)},Bn=(e,t)=>!(Math.abs(e-t)<=St);function Dn(e,t){const n=e[t](),o=e.enabled()&&void 0!==Ce?function(e){const t=Ce(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least 1`);return t}(n):n;return ge(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Wn=!1;const Fn=te(()=>Oe(X(4)));let Vn,Hn=!1;const Un=ve((e,t,o,r,a)=>{switch(ze(e),!0){case!0===rt:if(!0===Hn)break;fe("Iframe hidden - Ignored resize request"),Hn=!0,Wn=!1,cancelAnimationFrame(Vn);break;case!0===Wn&&e!==B:fe("Resize already pending - Ignored resize request");break;case!Re&&!(e in R):pe("Resizing disabled");break;default:Hn=!1,Wn=!0,Pe=performance.now(),Ae=!0,Vn=requestAnimationFrame(()=>{Wn=!1,ze("requestAnimationFrame"),he(`Reset sendPending: %c${e}`,n)}),function(e,t,o,r,a){const i=o??Dn(Ln,et),s=r??Dn(qn,kt),c=Ue&&Bn(Ke,i)||Je&&Bn(Mt,s)?P:e;switch(fe(`Resize event: %c${t}`,n),c){case l:case A:case P:Ke=i,Mt=s;case L:Jn(Ke,Mt,e,a);break;case B:case D:case q:case W:fe(F);break;default:pe(F)}Ae=!1}(e,t,o,r,a)}ye()});function Zn(e){Ke=Ln[et](),Mt=qn[kt](),_n(Ke,Mt,e)}function Jn(e,t,o,a,i){st<-1||(void 0!==i?fe(`Message targetOrigin: %c${i}`,n):i=$t,function(){const s=`${ft}:${e}:${t}:${o}${void 0===a?"":`:${a}`}`;if(ht)try{window.parent.iframeParentListener(V+s)}catch(e){if(1!==st)throw e;return void Fn()}else bt.postMessage(V+s,i);Ae&&fe(function(){const e=oe(performance.now()-Pe);return o===l?`Initialised iframe in %c${e}ms`:`Size calculated in %c${e}ms`}(),n),pe(`Sending message to parent page via ${ht?"sameOrigin":"postMessage"}: %c%c${s}`,r,n)}())}const _n=ve((e,t,n,o,r)=>{ze(n),Jn(e,t,n,o,r),ye()}),Qn=ve(function(e){ze("onMessage");const{freeze:t}=Object,{parse:o}=JSON,r=e=>t(o(e)),a=e=>_n(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void fe("Page not ready, ignoring init message");const t=e.data.slice(13).split(c);bt=e.source,je=e.origin,Rt(t),_e=!1,setTimeout(()=>{nt=!1},128)},reset(){nt?fe("Page reset ignored by init"):(fe("Page size reset by host page"),Zn("resetPage"))},resize(){fe("Resize requested by host page"),Un(C,"Parent window requested size check")},moveToAnchor(){ot.findTarget(d())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=d();fe("PageInfo received from parent:",r(e)),Pt?ee(Pt,o(e)):a(m)},parentInfo(){const e=r(d());fe("ParentInfo received from parent:",e),Nt?ee(Nt,e):a(f)},message(){const e=d();fe("onMessage called from parent:%c",n,r(e)),ee(It,o(e))}},s=()=>e.data.split("]")[1].split(c)[0],d=()=>e.data.slice(e.data.indexOf(c)+1),u=()=>e.data.split(c)[2]in{true:1,false:1};function p(){const t=s();ze(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||u()||Se(`Unexpected message (${e.data})`)}V===`${e.data}`.slice(0,13)&&function(){if(!1!==_e)return u()?(we(s()),ze(l),void i.init()):void fe(`Ignored message of type "${s()}". Received before initialization.`);p()}()});let Yn=!1;const Gn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function Xn(){if("loading"===document.readyState||!_e||Yn)return;const{parent:e,top:t}=window;ze("ready"),fe("Sending%c ready%c to parent from",n,o,window.location.href),Gn(e),e!==t&&Gn(t),Yn=!0}"iframeChildListener"in window?Se("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Qn({data:e,sameOrigin:!0})),U(window,d,Qn),U(document,j,Xn),Xn())}();
21
21
  //# sourceMappingURL=index.esm.js.map