@iframe-resizer/child 5.4.0-beta.4 → 5.4.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/child
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.4.0-beta.4 2025-03-24 - 17:19:03.774Z_
25
+ _iframe-resizer version 5.4.0-beta.5 2025-03-24 - 17:42:56.020Z_
@@ -18,6 +18,12 @@ declare module '@iframe-resizer/child' {
18
18
  */
19
19
  targetOrigin?: string | undefined
20
20
 
21
+ offsetSize?: number | undefined
22
+
23
+ sizeSeparator?: string | undefined
24
+
25
+ ignoreSelector?: string | undefined
26
+
21
27
  /**
22
28
  * Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method.
23
29
  */
@@ -60,6 +66,16 @@ declare module '@iframe-resizer/child' {
60
66
  */
61
67
  getParentProps(callback: (data: ParentProps) => void): () => void
62
68
 
69
+ /**
70
+ * Move to anchor in parent page.
71
+ */
72
+ moveToAnchor(hash: string): void
73
+
74
+ /**
75
+ * Set offsetSize.
76
+ */
77
+ setOffsetSize(offsetSize: number): void
78
+
63
79
  /**
64
80
  * Scroll the parent page by x and y
65
81
  */
@@ -91,7 +107,7 @@ declare module '@iframe-resizer/child' {
91
107
  * Manually force iFrame to resize. To use passed arguments you need first to disable the `autoResize` option to
92
108
  * prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.
93
109
  */
94
- size(customHeight?: string, customWidth?: string): void
110
+ resize(customHeight?: string, customWidth?: string): void
95
111
  }
96
112
 
97
113
  interface ParentProps {
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.4.0-beta.4 (cjs) - 2025-03-24
4
+ * @module iframe-resizer/child 5.4.0-beta.5 (cjs) - 2025-03-24
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- "use strict";const e=require("auto-console-group"),t="5.4.0-beta.4",n=10,o="data-iframe-size",i="data-iframe-overflowed",r="data-iframe-ignore",a="bottom",l="right",s="resizeParent",c="setOffsetSize",d="font-weight: bold;",u="font-weight: normal;",m=(e,t,n,o)=>e.addEventListener(t,n,o||!1),f=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const p=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(f[e]),h=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},g=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,y=e=>e,v=e=>Math.round(1e3*e)/1e3,b=e=>e.charAt(0).toUpperCase()+e.slice(1),z=e=>""!=`${e}`&&void 0!==e;function w(e){switch(!0){case!z(e):return"";case z(e.id):return`${e.nodeName}#${e.id}`;case z(e.name):return`${e.nodeName} (${e.name}`;case z(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let $=!0;const S=e({label:"iframeResizer(child)"});const M=e=>(...t)=>!$||S[e](...t),j=M("log"),E=M("info"),{event:O,assert:k,debug:P,endAutoGroup:A,error:C,purge:T,warn:I}=S,N=(...e)=>{return S.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},R=N,x=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,...t)=>N(...t))),q=x("Method"),L=x("Method","replaced with"),B=x("Option"),F=requestAnimationFrame,W="--ifr-start",D="--ifr-end",V=[],H=new WeakSet,U=e=>"object"==typeof e&&H.add(e);let Z={},J=0;const Q=setInterval((()=>{if(V.length<10)return;if(Z.hasTags&&Z.len<25)return;V.sort();const e=Math.min(V.reduce(((e,t)=>e+t),0)/V.length,V[Math.floor(V.length/2)]),t=v(e);t>J&&(J=t,j("%cPage size calculation timings:",d),j(" Mean time:",v(V[Math.floor(V.length/2)])),j(" Median time:",v(V.reduce(((e,t)=>e+t),0)/V.length)),j(" Average time:",t),j(" Max time:",v(Math.max(...V)))),e<=4||(clearInterval(Q),N(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${v(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Z.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function _(e){e.getEntries().forEach((e=>{if(e.name===D){const{duration:t}=performance.measure("--ifr-measure",W,D);Z=e.detail,V.push(t),V.length>100&&V.shift()}}))}function G(){new PerformanceObserver(_).observe({entryTypes:["mark"]}),U(document.documentElement),U(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",G):G());const X=g()?"color: #A9C7FB;":"color: #135CD2;",Y=g()?"color: #E3E3E3;":"color: black;";"undefined"!=typeof window&&function(){const e={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},f={height:()=>(I("Custom height calculation function not defined"),rt.auto()),width:()=>(I("Custom width calculation function not defined"),at.auto())},g={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},z={},M="checkVisibility"in window,k="auto",C="[iFrameSizer]",T={max:1,min:1,bodyScroll:1,documentElementScroll:1},x="scroll";let V,H,U,Z,J,Q=!0,_="",G=0,K="",ee="",te=!0,ne=!1,oe=!0,ie=!1,re=!1,ae=!1,le=1,se=k,ce="",de=!0,ue="",me={},fe=!1,pe=0,he=!1,ge="",ye=y,ve=[],be="child",ze=null,we=!1,$e="",Se=[],Me=window.parent,je="*",Ee=0,Oe=!1,ke="",Pe=1,Ae=x,Ce=window,Te=()=>{I("onMessage function not defined")},Ie=()=>{},Ne=null,Re=null;function xe(){var e,r,d,u;!function(){const e=e=>"true"===e,t=ue.slice(13).split(":");ge=t[0],G=void 0===t[1]?G:Number(t[1]),ne=void 0===t[2]?ne:e(t[2]),fe=void 0===t[3]?fe:e(t[3]),Q=void 0===t[6]?Q:e(t[6]),K=t[7],se=void 0===t[8]?se:t[8],_=t[9],ee=t[10],Ee=void 0===t[11]?Ee:Number(t[11]),me.enable=void 0!==t[12]&&e(t[12]),be=void 0===t[13]?be:t[13],Ae=void 0===t[14]?Ae:t[14],he=void 0===t[15]?he:e(t[15]),V=void 0===t[16]?V:Number(t[16]),H=void 0===t[17]?H:Number(t[17]),te=void 0===t[18]?te:e(t[18]),t[19],ke=t[20]||ke,pe=void 0===t[21]?pe:Number(t[21])}(),e={id:ge,enabled:fe},S.label(`${e.id}`),$=e.enabled,j(`Initialising iframe v${t} ${window.location.href}`),function(){function e(e){j("Reading data from page:",e),Te=e?.onMessage||Te,Ie=e?.onReady||Ie,"number"==typeof e?.offset&&(B("offset","offsetSize"),te&&(V=e?.offset),ne&&(H=e?.offset)),"number"==typeof e?.offsetSize&&(te&&(V=e?.offsetSize),ne&&(H=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&($e=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(ce=e.ignoreSelector),je=e?.targetOrigin||je,se=e?.heightCalculationMethod||se,Ae=e?.widthCalculationMethod||Ae}function t(e,t){return"function"==typeof e&&(j(`Setup custom ${t}CalcMethod`),f[t]=e,e="custom"),e}if(1===pe)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),se=t(se,"height"),Ae=t(Ae,"width"),E(`Set TargetOrigin for parent: %c${je}`,X))}(),He(),function(){try{we=1===pe||"iframeParentListener"in window.parent}catch(e){j("Cross domain iframe detected")}}(),pe<0?R(`${p(pe+2)}${p(2)}`):ke.codePointAt(0)>4||pe<2&&R(p(3)),ke&&""!==ke&&"false"!==ke?ke!==t&&N(`<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`):N("<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"),Je(),Qe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(o,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&N("<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</>.")}(),"BackCompat"===document.compatMode&&N("<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"),Le(),1!==pe&&(Ce.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===Q?(Q=!0,dt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===Q&&(Q=!1),ft(0,0,"autoResize",JSON.stringify(Q)),Q),close(){ft(0,0,"close")},getId:()=>ge,getOrigin:()=>(q("getOrigin()","getParentOrigin()"),U),getParentOrigin:()=>U,getPageInfo(e){if("function"==typeof e)return Ne=e,ft(0,0,"pageInfo"),void L("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Ne=null,ft(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Re=e,ft(0,0,"parentInfo"),()=>{Re=null,ft(0,0,"parentInfoStop")}},getParentProperties(e){q("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){me.findTarget(e)},reset(){mt("parentIframe.reset")},setOffsetSize(e){V=e,H=e,dt(c,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){ft(t,e,"scrollBy")},scrollTo(e,t){ft(t,e,"scrollTo")},scrollToOffset(e,t){ft(t,e,"scrollToOffset")},sendMessage(e,t){ft(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){se=e,Je()},setWidthCalculationMethod(e){Ae=e,Qe()},setTargetOrigin(e){j(`Set targetOrigin: %c${e}`,X),je=e},resize(e,t){dt(s,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){q("size()","resize()"),this.resize(e,t)}}),Ce.parentIFrame=Ce.parentIframe),function(){function e(e){ft(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){j(`Add event listener: %c${n}`,X),m(window.document,t,e)}!0===he&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),me=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const o=t.getBoundingClientRect(),i=e();return{x:parseInt(o.left,n)+parseInt(i.x,n),y:parseInt(o.top,n)+parseInt(i.y,n)}}function o(e){function n(e){const n=t(e);j(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,X,Y,X,Y,X),ft(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(j(`In page link (#${o}) not found in iFrame, so sending to parent`),ft(0,0,"inPageLink",`#${o}`)):n(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&m(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){m(window,"hashchange",i)}function l(){setTimeout(i,128)}function s(){j("Setting up location.hash handlers"),r(),a(),l()}return me.enable?1===pe?N("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():j("In page linking not enabled"),{findTarget:o}}(),void 0===K&&(K=`${G}px`),De("margin",(d="margin",(u=K).includes("-")&&(I(`Negative CSS value ignored for ${d}`),u=""),u)),De("background",_),De("padding",ee),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),j("Set HTML & body height: %cauto !important",X)}(),!0!==Q&&j("Auto Resize disabled"),Ue({method:r="add",eventType:"After Print",eventName:"afterprint"}),Ue({method:r,eventType:"Before Print",eventName:"beforeprint"}),Ue({method:r,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function c(){j("MutationObserver: processMutations");const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return j(`MutationObserver delay: %c${u}ms > ${m}ms`,X),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(He(),Le(),Be(e),e.forEach(Xe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return j("Setup <body> MutationObserver"),e.observe(t,n),e}u()}(),j("Setup ResizeObserver"),ze=new ResizeObserver(_e),ze.observe(document.body),Ge.add(document.body),Xe(document.body),te!==ne&&(j("Setup OverflowObserver"),ye=(e=>{const t=e.side||a,n=e.onChange||y,o={root:e.root,rootMargin:"0px",threshold:1},r=()=>n(document.querySelectorAll(`[${i}]`)),l=(e,t)=>e.toggleAttribute(i,t),s=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:o,target:i}=n,r=e[t],a=0===r||r>o[t];l(i,a)}F(r)}),o),c=new WeakSet;return function(e){j("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||c.has(t)||(s.observe(t),c.add(t))}})({onChange:qe,root:document.documentElement,side:te?a:l})),Be(et(document)()),queueMicrotask(Ie),j("Initialization complete"),dt("init","Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&ft(0,0,"title",document.title)}function qe(e){j("Overflowed Elements:",e.length),ve=e,re=ve.length>0,dt("overflowObserver","Overflow updated")}function Le(){Se=document.querySelectorAll(`[${o}]`),ae=Se.length>0,j(`Tagged elements found: %c${ae}`,ae?X:Y)}function Be(e){ae||ye(e)}let Fe=0;function We(){const e=document.querySelectorAll(`*[${r}]`);ie=e.length>0,ie&&e.length!==Fe&&(function(e){const t=1===e.length?"":"s";I(`%c[${r}]%c found on %c${e.length}%c element${t}`,d,u,d,u)}(e),Fe=e.length)}function De(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),E(`Set body ${e}: %c${t}`,X))}function Ve(e,t,n){if(""!==n){j(`${e}: %c${n}`,X);for(const e of document.querySelectorAll(n))j(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function He(){Ve("sizeSelector",o,$e),Ve("ignoreSelector",r,ce)}function Ue(e){({add(t){function n(){dt(e.eventName,e.eventType)}z[t]=n,m(window,t,n,{passive:!0})},remove(e){const t=z[e];var n,o;delete z[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),j(`${b(e.method)} event listener: %c${e.eventType}`,X)}function Ze(e,t,n,o){return t!==e&&(e in n||(I(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in g&&N(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),j(`Set ${o} calculation method: %c${e}`,X)),e}function Je(){se=Ze(se,k,rt,"height")}function Qe(){Ae=Ze(Ae,x,at,"width")}function _e(e){Array.isArray(e)&&0!==e.length&&dt("resizeObserver",`Element resized <${w(e[0].target)}>`)}const Ge=new WeakSet;function Xe(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ge.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ze.observe(e),Ge.add(e),j(`Attached resizeObserver: %c${w(e)}`,X))}const t=et(e)();for(const e of t){if(Ge.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ze.observe(e),Ge.add(e),j(`Attached resizeObserver: %c${w(e)}`,X))}}function Ye(t){performance.mark(W);const n=b(t);let o=0,i=document.documentElement,r=ae?0:document.documentElement.getBoundingClientRect().bottom;const a=ae?Se:re?ve:et(document)();let l=a.length;for(const n of a)ae||!M||n.checkVisibility(e)?(o=n.getBoundingClientRect()[t]+parseFloat(getComputedStyle(n).getPropertyValue(`margin-${t}`)),o>r&&(r=o,i=n)):l-=1;return E(`${n} position calculated from:`,i),performance.mark(D,{detail:{Side:n,len:l,hasTags:ae,logging:fe}}),r}const Ke=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],et=e=>()=>{We();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return ie&&t.push(`not([${r}])`,`not([${r}] *)`),e.querySelectorAll(t.join(":"))},tt={height:0,width:0},nt={height:0,width:0},ot=[X,Y,X];function it(e){function t(){return nt[o]=i,tt[o]=l,i}const n=e===rt,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case ae:E("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!re&&0===nt[o]&&0===tt[o]:E(`Initial page size values: ${s}`,...ot),c=t();break;case Oe&&i===nt[o]&&l===tt[o]:E(`Size unchanged: ${s}`,...ot),c=Math.max(i,l);break;case 0===i:E(`Page is hidden: ${s}`,...ot),c=l;break;case!re&&i!==nt[o]&&l<=tt[o]:E(`New <html> size: ${s} `,...ot),E(`Previous <html> size: %c${nt[o]}px`,X),c=t();break;case!n:c=e.taggedElement();break;case!re&&i<nt[o]:E(`<html> size decreased: ${s}`,...ot),c=t();break;case l===a||l===r:E(`<html> size equals page size: ${s}`,...ot),c=t();break;case i>l:E(`Page size < <html> size: ${s}`,...ot),c=t();break;case re:E("Found element overflowing <html> "),c=e.taggedElement();break;default:c=t()}return E(`Content ${o}: %c${c}px`,X),c+=function(e){const t=e.getOffset();return 0!==t&&E(`Page offsetSize: %c${t}px`,X),t}(e),c}const rt={enabled:()=>te,getOffset:()=>V,auto:()=>it(rt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>rt.bodyOffset(),custom:()=>f.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ke(rt)),min:()=>Math.min(...Ke(rt)),grow:()=>rt.max(),lowestElement:()=>Ye(a),taggedElement:()=>Ye(a)},at={enabled:()=>ne,getOffset:()=>H,auto:()=>it(at),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>f.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ke(at)),min:()=>Math.min(...Ke(at)),rightMostElement:()=>Ye(l),scroll:()=>Math.max(at.bodyScroll(),at.documentElementScroll()),taggedElement:()=>Ye(l)},lt=(e,t)=>!(Math.abs(e-t)<=Ee);let st=!1;const ct=h((()=>R(p(4))));function dt(e,t,n,o,i){J=performance.now(),O(e),Q||e===s?document.hidden?j("Page hidden - Ignored resize request"):(st||(j(`Resize event: %c${t}`,X),Z=!0,function(e,t,n,o,i){const r=void 0===n?rt[se]():n,a=void 0===o?at[Ae]():o;te&&lt(le,r)||ne&&lt(Pe,a)||"init"===e?(le=r,Pe=a,ft(le,Pe,e,i)):!e!==s&&(te&&se in T||ne&&Ae in T)?mt(t):e===c?ft(le,Pe,e):(j("No change in content size detected"),Z=!1)}(e,t,n,o,i),requestAnimationFrame((()=>{st=!1}))),st=!0):E("Resizing disabled")}function ut(e){le=rt[se](),Pe=at[Ae](),ft(le,Pe,e)}function mt(e){const t=se;se=k,j(`Reset trigger event: %c${e}`,X),Oe?j("TriggerLock blocked calculation"):(Oe=!0,P("Trigger event lock on"),requestAnimationFrame((()=>{Oe=!1,P("Trigger event lock off")}))),ut("reset"),se=t}function ft(e,t,n,o,i){pe<-1||(O(n),void 0!==i?j(`Message targetOrigin: %c${i}`,X):i=je,function(){const r=`${ge}:${e}:${t}:${n}${void 0===o?"":`:${o}`}`;if(we)try{window.parent.iframeParentListener(C+r)}catch(e){if(1!==pe)throw e;return void ct()}else Me.postMessage(C+r,i);Z&&E(function(){const e=v(performance.now()-J);return"init"===n?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),X),Z=!1,E("Sending message to host page via "+(we?"sameDomain":"postMessage")),E(`%c${r}`,"font-style: italic;")}(),A())}function pt(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>ft(0,0,`${e}Stop`),i={init:function(){ue=e.data,Me=e.source,U=e.origin,xe(),oe=!1,setTimeout((()=>{de=!1}),128)},reset(){de?j("Page reset ignored by init"):(j("Page size reset by host page"),ut("resetPage"))},resize(){dt(s,"Parent window requested size check")},moveToAnchor(){me.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();j(`PageInfo received from parent: ${e}`),Ne?setTimeout((()=>Ne(n(e)))):o("pageInfo")},parentInfo(){const e=a();j(`ParentInfo received from parent: ${e}`),Re?setTimeout((()=>Re(t(n(e))))):o("parentInfo")},message(){const e=a();j(`onMessage called from parent: ${e}`),setTimeout((()=>Te(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function c(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||I(`Unexpected message (${e.data})`)}C===`${e.data}`.slice(0,13)&&(O(r()),!1!==oe?l()?i.init():j(`Ignored message of type "${r()}". Received before initialization.`):c())}function ht(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?I("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>pt({data:e}))),m(window,"message",pt),m(window,"readystatechange",ht),ht())}();
20
+ "use strict";const e=require("auto-console-group"),t="5.4.0-beta.5",n=10,o="data-iframe-size",i="data-iframe-overflowed",r="data-iframe-ignore",a="bottom",l="right",s="resizeParent",c="setOffsetSize",d=(e,t,n,o)=>e.addEventListener(t,n,o||!1),u=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const m=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(u[e]),f=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},p=e=>e,h=e=>Math.round(1e3*e)/1e3,g=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function v(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName}#${e.id}`;case y(e.name):return`${e.nodeName} (${e.name}`;case y(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let b=!0;const z=e({label:"iframeResizer(child)"});const w=e=>(...t)=>!b||z[e](...t),$=w("log"),I=w("info"),{event:S,assert:H,debug:O,endAutoGroup:T,error:M,purge:E,warn:j}=z,k=(...e)=>{return z.warn((t=p,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},P=k,A=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,...t)=>k(...t))),G=A("Method"),L=A("Method","replaced with"),C=A("Option"),R=requestAnimationFrame,N="--ifr-start",x="--ifr-end",q=[],B=new WeakSet,D=e=>"object"==typeof e&&B.add(e);let F={},W=0;const U=setInterval((()=>{if(q.length<10)return;if(F.hasTags&&F.len<25)return;q.sort();const e=Math.min(q.reduce(((e,t)=>e+t),0)/q.length,q[Math.floor(q.length/2)]),t=h(e);t>W&&(W=t,$("%cPage size calculation timings:","font-weight: bold;"),$(" Mean time:",h(q[Math.floor(q.length/2)])),$(" Median time:",h(q.reduce(((e,t)=>e+t),0)/q.length)),$(" Average time:",t),$(" Max time:",h(Math.max(...q)))),e<=4||(clearInterval(U),k(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${h(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${F.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function V(e){e.getEntries().forEach((e=>{if(e.name===x){const{duration:t}=performance.measure("--ifr-measure",N,x);F=e.detail,q.push(t),q.length>100&&q.shift()}}))}function Z(){new PerformanceObserver(V).observe({entryTypes:["mark"]}),D(document.documentElement),D(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",Z):Z()),"undefined"!=typeof window&&function(){const u={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},y={height:()=>(j("Custom height calculation function not defined"),nt.auto()),width:()=>(j("Custom width calculation function not defined"),ot.auto())},w={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},H={},M="checkVisibility"in window,E="auto",A="[iFrameSizer]",q={max:1,min:1,bodyScroll:1,documentElementScroll:1},B="scroll";let D,F,W,U,V,Z=!0,J="",Q=0,_="",X="",Y=!0,K=!1,ee=!0,te=!1,ne=!1,oe=!1,ie=1,re=E,ae="",le=!0,se="",ce={},de=!1,ue=0,me=!1,fe="",pe=p,he=[],ge="child",ye=null,ve=!1,be="",ze=[],we=window.parent,$e="*",Ie=0,Se=!1,He="",Oe=1,Te=B,Me=window,Ee=()=>{j("onMessage function not defined")},je=()=>{},ke=null,Pe=null;function Ae(){var r,u,f,h;!function(){const e=e=>"true"===e,t=se.slice(13).split(":");fe=t[0],Q=void 0===t[1]?Q:Number(t[1]),K=void 0===t[2]?K:e(t[2]),de=void 0===t[3]?de:e(t[3]),Z=void 0===t[6]?Z:e(t[6]),_=t[7],re=void 0===t[8]?re:t[8],J=t[9],X=t[10],Ie=void 0===t[11]?Ie:Number(t[11]),ce.enable=void 0!==t[12]&&e(t[12]),ge=void 0===t[13]?ge:t[13],Te=void 0===t[14]?Te:t[14],me=void 0===t[15]?me:e(t[15]),D=void 0===t[16]?D:Number(t[16]),F=void 0===t[17]?F:Number(t[17]),Y=void 0===t[18]?Y:e(t[18]),t[19],He=t[20]||He,ue=void 0===t[21]?ue:Number(t[21])}(),r={id:fe,enabled:de},z.label(`${r.id}`),b=r.enabled,$(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){$("Reading data from page:",e),Ee=e?.onMessage||Ee,je=e?.onReady||je,"number"==typeof e?.offset&&(C("offset","offsetSize"),Y&&(D=e?.offset),K&&(F=e?.offset)),"number"==typeof e?.offsetSize&&(Y&&(D=e?.offsetSize),K&&(F=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(be=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(ae=e.ignoreSelector),$e=e?.targetOrigin||$e,re=e?.heightCalculationMethod||re,Te=e?.widthCalculationMethod||Te}function n(e,t){return"function"==typeof e&&($(`Setup custom ${t}CalcMethod`),y[t]=e,e="custom"),e}if(1===ue)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),re=n(re,"height"),Te=n(Te,"width"),I(`Set TargetOrigin for parent: %c${$e}`,e.HIGHLIGHT))}(),Be(),function(){try{ve=1===ue||"iframeParentListener"in window.parent}catch(e){$("Cross domain iframe detected")}}(),ue<0?P(`${m(ue+2)}${m(2)}`):He.codePointAt(0)>4||ue<2&&P(m(3)),He&&""!==He&&"false"!==He?He!==t&&k(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${He} - Child page: ${t}.\n`):k("<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"),We(),Ue(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(o,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&k("<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</>.")}(),"BackCompat"===document.compatMode&&k("<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"),Le(),1!==ue&&(Me.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===Z?(Z=!0,lt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===Z&&(Z=!1),dt(0,0,"autoResize",JSON.stringify(Z)),Z),close(){dt(0,0,"close")},getId:()=>fe,getOrigin:()=>(G("getOrigin()","getParentOrigin()"),W),getParentOrigin:()=>W,getPageInfo(e){if("function"==typeof e)return ke=e,dt(0,0,"pageInfo"),void L("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");ke=null,dt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Pe=e,dt(0,0,"parentInfo"),()=>{Pe=null,dt(0,0,"parentInfoStop")}},getParentProperties(e){G("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){ce.findTarget(e)},reset(){ct("parentIframe.reset")},setOffsetSize(e){D=e,F=e,lt(c,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){dt(t,e,"scrollBy")},scrollTo(e,t){dt(t,e,"scrollTo")},scrollToOffset(e,t){dt(t,e,"scrollToOffset")},sendMessage(e,t){dt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){re=e,We()},setWidthCalculationMethod(e){Te=e,Ue()},setTargetOrigin(t){$(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),$e=t},resize(e,t){lt(s,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){G("size()","resize()"),this.resize(e,t)}}),Me.parentIFrame=Me.parentIframe),function(){function t(e){dt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){$(`Add event listener: %c${o}`,e.HIGHLIGHT),d(window.document,n,t)}!0===me&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),ce=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(e){const o=e.getBoundingClientRect(),i=t();return{x:parseInt(o.left,n)+parseInt(i.x,n),y:parseInt(o.top,n)+parseInt(i.y,n)}}function i(t){function n(t){const n=o(t);$(`Moving to in page link (%c#${i}%c) at x: %c${n.x}%c y: %c${n.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),dt(n.y,n.x,"scrollToOffset")}const i=t.split("#")[1]||t,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];void 0===a?($(`In page link (#${i}) not found in iFrame, so sending to parent`),dt(0,0,"inPageLink",`#${i}`)):n(a)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&d(e,"click",(t=>{t.preventDefault(),i(e.getAttribute("href"))}))}function l(){d(window,"hashchange",r)}function s(){setTimeout(r,128)}function c(){$("Setting up location.hash handlers"),a(),l(),s()}return ce.enable?1===ue?k("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():$("In page linking not enabled"),{findTarget:i}}(),void 0===_&&(_=`${Q}px`),xe("margin",(f="margin",(h=_).includes("-")&&(j(`Negative CSS value ignored for ${f}`),h=""),h)),xe("background",J),xe("padding",X),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),$("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==Z&&$("Auto Resize disabled"),De({method:u="add",eventType:"After Print",eventName:"afterprint"}),De({method:u,eventType:"Before Print",eventName:"beforeprint"}),De({method:u,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const t=new Set;let n=!1,o=0,i=[];const r=e=>{for(const n of e){const{addedNodes:e,removedNodes:o}=n;for(const n of e)t.add(n);for(const e of o)t.delete(e)}},a=16,l=2,s=200;let c=1;function d(){$("MutationObserver: processMutations");const u=performance.now(),m=u-o,f=a*c+++l;if(m>f&&m<s)return $(`MutationObserver delay: %c${m}ms > ${f}ms`,e.HIGHLIGHT),setTimeout(d,a*c),void(o=u);c=1,i.forEach(r),i=[],0!==t.size?(Be(),Le(),Ce(t),t.forEach(Je),t.clear(),n=!1):n=!1}function u(e){i.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(d))}function m(){const e=new window.MutationObserver(u),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return $("Setup <body> MutationObserver"),e.observe(t,n),e}m()}(),$("Setup ResizeObserver"),ye=new ResizeObserver(Ve),ye.observe(document.body),Ze.add(document.body),Je(document.body),Y!==K&&($("Setup OverflowObserver"),pe=(e=>{const t=e.side||a,n=e.onChange||p,o={root:e.root,rootMargin:"0px",threshold:1},r=()=>n(document.querySelectorAll(`[${i}]`)),l=(e,t)=>e.toggleAttribute(i,t),s=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:o,target:i}=n,r=e[t],a=0===r||r>o[t];l(i,a)}R(r)}),o),c=new WeakSet;return function(e){$("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||c.has(t)||(s.observe(t),c.add(t))}})({onChange:Ge,root:document.documentElement,side:Y?a:l})),Ce(Xe(document)()),queueMicrotask(je),$("Initialization complete"),lt("init","Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&dt(0,0,"title",document.title)}function Ge(e){$("Overflowed Elements:",e.length),he=e,ne=he.length>0,lt("overflowObserver","Overflow updated")}function Le(){ze=document.querySelectorAll(`[${o}]`),oe=ze.length>0,$(`Tagged elements found: %c${oe}`,oe?e.HIGHLIGHT:e.FOREGROUND)}function Ce(e){oe||pe(e)}let Re=0;function Ne(){const t=document.querySelectorAll(`*[${r}]`);te=t.length>0,te&&t.length!==Re&&(function(t){const n=1===t.length?"":"s";j(`%c[${r}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),Re=t.length)}function xe(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),I(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function qe(t,n,o){if(""!==o){$(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))$(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function Be(){qe("sizeSelector",o,be),qe("ignoreSelector",r,ae)}function De(t){({add(e){function n(){lt(t.eventName,t.eventType)}H[e]=n,d(window,e,n,{passive:!0})},remove(e){const t=H[e];var n,o;delete H[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),$(`${g(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Fe(t,n,o,i){return n!==t&&(t in o||(j(`${t} is not a valid option for ${i}CalculationMethod.`),t=n),t in w&&k(`<rb>Deprecated ${i}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${i} calculation method. It is recommended that you remove this option.`),$(`Set ${i} calculation method: %c${t}`,e.HIGHLIGHT)),t}function We(){re=Fe(re,E,nt,"height")}function Ue(){Te=Fe(Te,B,ot,"width")}function Ve(e){Array.isArray(e)&&0!==e.length&&lt("resizeObserver",`Element resized <${v(e[0].target)}>`)}const Ze=new WeakSet;function Je(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!Ze.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(ye.observe(t),Ze.add(t),$(`Attached resizeObserver: %c${v(t)}`,e.HIGHLIGHT))}const n=Xe(t)();for(const t of n){if(Ze.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(ye.observe(t),Ze.add(t),$(`Attached resizeObserver: %c${v(t)}`,e.HIGHLIGHT))}}function Qe(e){performance.mark(N);const t=g(e);let n=0,o=document.documentElement,i=oe?0:document.documentElement.getBoundingClientRect().bottom;const r=oe?ze:ne?he:Xe(document)();let a=r.length;for(const t of r)oe||!M||t.checkVisibility(u)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,o=t)):a-=1;return I(`${t} position calculated from:`,o),performance.mark(x,{detail:{Side:t,len:a,hasTags:oe,logging:de}}),i}const _e=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],Xe=e=>()=>{Ne();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return te&&t.push(`not([${r}])`,`not([${r}] *)`),e.querySelectorAll(t.join(":"))},Ye={height:0,width:0},Ke={height:0,width:0},et=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function tt(t){function n(){return Ke[i]=r,Ye[i]=s,r}const o=t===nt,i=o?"height":"width",r=t.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${r}px %cPage: %c${s}px`;let d=0;switch(!0){case!t.enabled():return s;case oe:I("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!ne&&0===Ke[i]&&0===Ye[i]:I(`Initial page size values: ${c}`,...et),d=n();break;case Se&&r===Ke[i]&&s===Ye[i]:I(`Size unchanged: ${c}`,...et),d=Math.max(r,s);break;case 0===r:I(`Page is hidden: ${c}`,...et),d=s;break;case!ne&&r!==Ke[i]&&s<=Ye[i]:I(`New <html> size: ${c} `,...et),I(`Previous <html> size: %c${Ke[i]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!ne&&r<Ke[i]:I(`<html> size decreased: ${c}`,...et),d=n();break;case s===l||s===a:I(`<html> size equals page size: ${c}`,...et),d=n();break;case r>s:I(`Page size < <html> size: ${c}`,...et),d=n();break;case ne:I("Found element overflowing <html> "),d=t.taggedElement();break;default:d=n()}return I(`Content ${i}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&I(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const nt={enabled:()=>Y,getOffset:()=>D,auto:()=>tt(nt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>nt.bodyOffset(),custom:()=>y.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(..._e(nt)),min:()=>Math.min(..._e(nt)),grow:()=>nt.max(),lowestElement:()=>Qe(a),taggedElement:()=>Qe(a)},ot={enabled:()=>K,getOffset:()=>F,auto:()=>tt(ot),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>y.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(..._e(ot)),min:()=>Math.min(..._e(ot)),rightMostElement:()=>Qe(l),scroll:()=>Math.max(ot.bodyScroll(),ot.documentElementScroll()),taggedElement:()=>Qe(l)},it=(e,t)=>!(Math.abs(e-t)<=Ie);let rt=!1;const at=f((()=>P(m(4))));function lt(t,n,o,i,r){V=performance.now(),S(t),Z||t===s?document.hidden?$("Page hidden - Ignored resize request"):(rt||($(`Resize event: %c${n}`,e.HIGHLIGHT),U=!0,function(e,t,n,o,i){const r=void 0===n?nt[re]():n,a=void 0===o?ot[Te]():o;Y&&it(ie,r)||K&&it(Oe,a)||"init"===e?(ie=r,Oe=a,dt(ie,Oe,e,i)):!e!==s&&(Y&&re in q||K&&Te in q)?ct(t):e===c?dt(ie,Oe,e):($("No change in content size detected"),U=!1)}(t,n,o,i,r),requestAnimationFrame((()=>{rt=!1}))),rt=!0):I("Resizing disabled")}function st(e){ie=nt[re](),Oe=ot[Te](),dt(ie,Oe,e)}function ct(t){const n=re;re=E,$(`Reset trigger event: %c${t}`,e.HIGHLIGHT),Se?$("TriggerLock blocked calculation"):(Se=!0,O("Trigger event lock on"),requestAnimationFrame((()=>{Se=!1,O("Trigger event lock off")}))),st("reset"),re=n}function dt(t,n,o,i,r){ue<-1||(S(o),void 0!==r?$(`Message targetOrigin: %c${r}`,e.HIGHLIGHT):r=$e,function(){const a=`${fe}:${t}:${n}:${o}${void 0===i?"":`:${i}`}`;if(ve)try{window.parent.iframeParentListener(A+a)}catch(e){if(1!==ue)throw e;return void at()}else we.postMessage(A+a,r);U&&I(function(){const e=h(performance.now()-V);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),U=!1,I("Sending message to host page via "+(ve?"sameDomain":"postMessage")),I(`%c${a}`,e.ITALIC)}(),T())}function ut(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>dt(0,0,`${e}Stop`),i={init:function(){se=e.data,we=e.source,W=e.origin,Ae(),ee=!1,setTimeout((()=>{le=!1}),128)},reset(){le?$("Page reset ignored by init"):($("Page size reset by host page"),st("resetPage"))},resize(){lt(s,"Parent window requested size check")},moveToAnchor(){ce.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();$(`PageInfo received from parent: ${e}`),ke?setTimeout((()=>ke(n(e)))):o("pageInfo")},parentInfo(){const e=a();$(`ParentInfo received from parent: ${e}`),Pe?setTimeout((()=>Pe(t(n(e))))):o("parentInfo")},message(){const e=a();$(`onMessage called from parent: ${e}`),setTimeout((()=>Ee(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function c(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||j(`Unexpected message (${e.data})`)}A===`${e.data}`.slice(0,13)&&(S(r()),!1!==ee?l()?i.init():$(`Ignored message of type "${r()}". Received before initialization.`):c())}function mt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?j("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>ut({data:e}))),d(window,"message",ut),d(window,"readystatechange",mt),mt())}();
21
21
  //# sourceMappingURL=index.cjs.js.map