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