@iframe-resizer/child 5.3.0-beta.2 → 5.3.1-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/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/child
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.3.0-beta.2 2024-09-03 - 18:55:18.269Z_
25
+ _iframe-resizer version 5.3.1-beta.1 2024-09-09 - 13:39:53.793Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.3.0-beta.2 (cjs) - 2024-09-03
4
+ * @module iframe-resizer/child 5.3.1-beta.1 (cjs) - 2024-09-09
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="5.3.0-beta.2",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),E=e=>S(e);let M=[];const T=e=>{const t=e.side||i,n=e.onChange||c,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){M=document.querySelectorAll(`[${o}]`),z("overflowedElements:",M.length),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>M.length>0,P="--ifr-start",C="--ifr-end",O="--ifr-measure",A=[],I=new WeakSet,N=e=>"object"==typeof e&&I.add(e);let k=null,R=null,x={};const L=setInterval((()=>{if(A.length<10)return;if(x.hasTags&&x.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);z("Max time:",Math.max(...A)),e<=4||(clearInterval(L),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===C){const{duration:t}=performance.measure(O,P,C);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,I.has(R)||k===R||i&&o<=1||(r||N(R),k=R,w(`\n${n} position calculated from:`,R,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),N(document.documentElement),N(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),qe.auto()),width:()=>($("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",O=w.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="scroll";let N,k,x,L,q=!0,B="",D=0,W="",F="",H=!0,U=!1,V=!0,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=I,ge=window,he=()=>{$("onMessage function not defined")},ye=()=>{},be=null,ve=null;function ze(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(O).split(":");te=t[0],D=void 0===t[1]?D:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],_=void 0===t[8]?_:t[8],B=t[9],F=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),N=void 0===t[16]?N:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ye=e?.onReady||ye,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(N=e?.offset),U&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,_=e?.heightCalculationMethod||_,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),pe=t(pe,"width"),z(`TargetOrigin for parent set to: ${de}`))}(),function(){try{re="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?E(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&E(d(3)),me&&""!==me&&"false"!==me?me!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):S("<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(),Pe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<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</>.")}(),we(),H!==U&&(ne=T({onChange:()=>Fe("overflowChanged","Overflow updated"),side:H?i:r})),1!==K&&(ge.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Fe("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Je(0,0,"autoResize",JSON.stringify(q)),q),close(){Je(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return be=e,Je(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");be=null,Je(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ve=e,Je(0,0,"parentInfo"),()=>{ve=null,Je(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ve("parentIframe.reset")},scrollBy(e,t){Je(t,e,"scrollBy")},scrollTo(e,t){Je(t,e,"scrollTo")},scrollToOffset(e,t){Je(t,e,"scrollToOffset")},sendMessage(e,t){Je(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,je()},setWidthCalculationMethod(e){pe=e,Pe()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),de=e},resize(e,t){Fe(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),ge.parentIFrame=ge.parentIframe),function(){function e(e){Je(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Je(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),Je(0,0,"inPageLink",`#${o}`)):t(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")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),$e(ke(document)()),void 0===W&&(W=`${D}px`),Se("margin",(c="margin",(u=W).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Se("background",B),Se("padding",F),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),z('HTML & body height set to "auto !important"')}(),Ee(),Fe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Je(0,0,"title",document.title),!0!==q&&z("Auto Resize disabled"),Me({method:o="add",eventType:"After Print",eventName:"afterprint"}),Me({method:o,eventType:"Before Print",eventName:"beforeprint"}),Me({method:o,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 d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Ee(),we(),$e(e),e.forEach(Ae),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ce),ie.observe(document.body),Oe.add(document.body),Ae(document.body),setTimeout(ye),z("Initialization complete"),z("---")}function we(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,z(`Tagged elements found: ${J}`)}function $e(e){J||ne(e)}function Se(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Ee(){if(""!==ae){z(`Applying sizeSelector: ${ae}`);for(const e of document.querySelectorAll(ae))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Me(e){({add(t){function n(){Fe(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function Te(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function je(){_=Te(_,v,qe,"height")}function Pe(){pe=Te(pe,I,Be,"width")}function Ce(e){Array.isArray(e)&&0!==e.length&&Fe("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Oe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Oe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=ke(e)();for(const e of t){if(Oe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function Ie(e){performance.mark(P);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:j()?M:ke(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return R=i,performance.mark(C,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=e=>()=>e.querySelectorAll("* :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)"),Re={height:0,width:0},xe={height:0,width:0};function Le(e){function t(){return xe[i]=r,Re[i]=s,r}const n=j(),o=e===qe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===xe[i]&&0===Re[i]:return z(`Initial page size values: ${d}`),t();case ue&&r===xe[i]&&s===Re[i]:return z(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return z(`Page is hidden: ${d}`),s;case!n&&r!==xe[i]&&s<=Re[i]:return z(`New HTML bounding size: ${d}`,"Previous bounding size:",xe[i]),t();case!o:return e.taggedElement();case!n&&r<xe[i]:return z("HTML bounding size decreased:",d),t();case s===l||s===a:return z("HTML bounding size equals page size:",d),t();case r>s:return z(`Page size < HTML bounding size: ${d}`),t();default:z(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const qe={enabled:()=>H,getOffset:()=>N,auto:()=>Le(qe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ne(qe)),min:()=>Math.min(...Ne(qe)),grow:()=>qe.max(),lowestElement:()=>Ie(i),taggedElement:()=>Ie(i)},Be={enabled:()=>U,getOffset:()=>k,auto:()=>Le(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ne(Be)),min:()=>Math.min(...Ne(Be)),rightMostElement:()=>Ie(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ie(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Fe(e,t,n,o,i){L=performance.now(),q||e===a?document.hidden?z("Page hidden - Ignored resize request"):(We||(z(`Resize event: ${t}`),x=!0,function(e,t,n,o,i){const r=void 0===n?qe[_]():n,l=void 0===o?Be[pe]():o;H&&De(Z,r)||U&&De(fe,l)||"init"===e?(He(),Z=r,fe=l,Je(Z,fe,e,i)):!e!==a&&(H&&_ in A||U&&pe in A)?Ve(t):x=!1}(e,t,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0):z("Resizing disabled")}function He(){ue||(ue=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,z("Trigger event lock off"),z("--")})))}function Ue(e){Z=qe[_](),fe=Be[pe](),Je(Z,fe,e)}function Ve(e){const t=_;_=v,z(`Reset trigger event: ${e}`),He(),Ue("reset"),_=t}function Je(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(k||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(re?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),x&&console.info(function(){const e=m(performance.now()-L);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),x=!1,re?window.parent.iframeParentListener(w+r):se.postMessage(w+r,i)}())}function Ze(e){const t={init:function(){X=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Ue("resetPage"))},resize(){Fe(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),be?setTimeout((()=>be(JSON.parse(e)))):Je(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ve?setTimeout(ve(Object.freeze(JSON.parse(e)))):Je(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),he(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,O)&&(!1!==V?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}();
20
+ "use strict";const e="5.3.1-beta.1",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),E=e=>S(e);let M=[];const T=e=>{const t=e.side||i,n=e.onChange||c,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){M=document.querySelectorAll(`[${o}]`),z("overflowedElements:",M.length),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>M.length>0,P="--ifr-start",C="--ifr-end",O="--ifr-measure",A=[],I=new WeakSet,N=e=>"object"==typeof e&&I.add(e);let k=null,R=null,x={};const L=setInterval((()=>{if(A.length<10)return;if(x.hasTags&&x.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);z("Max time:",Math.max(...A)),e<=4||(clearInterval(L),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===C){const{duration:t}=performance.measure(O,P,C);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,I.has(R)||k===R||i&&o<=1||(r||N(R),k=R,w(`\n${n} position calculated from:`,R,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),N(document.documentElement),N(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),qe.auto()),width:()=>($("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",O=w.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="scroll";let N,k,x,L,q=!0,B="",D=0,W="",F="",H=!0,U=!1,V=!0,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=I,ge=window,he=()=>{$("onMessage function not defined")},ye=()=>{},be=null,ve=null;function ze(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(O).split(":");te=t[0],D=void 0===t[1]?D:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],_=void 0===t[8]?_:t[8],B=t[9],F=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),N=void 0===t[16]?N:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ye=e?.onReady||ye,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(N=e?.offset),U&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,_=e?.heightCalculationMethod||_,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),pe=t(pe,"width"),z(`TargetOrigin for parent set to: ${de}`))}(),function(){try{re="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?E(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&E(d(3)),me&&""!==me&&"false"!==me?me!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):S("<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(),Pe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<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</>.")}(),we(),H!==U&&(ne=T({onChange:()=>Fe("overflowChanged","Overflow updated"),side:H?i:r})),1!==K&&(ge.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Fe("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Je(0,0,"autoResize",JSON.stringify(q)),q),close(){Je(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return be=e,Je(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");be=null,Je(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ve=e,Je(0,0,"parentInfo"),()=>{ve=null,Je(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ve("parentIframe.reset")},scrollBy(e,t){Je(t,e,"scrollBy")},scrollTo(e,t){Je(t,e,"scrollTo")},scrollToOffset(e,t){Je(t,e,"scrollToOffset")},sendMessage(e,t){Je(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,je()},setWidthCalculationMethod(e){pe=e,Pe()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),de=e},resize(e,t){Fe(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),ge.parentIFrame=ge.parentIframe),function(){function e(e){Je(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Je(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),Je(0,0,"inPageLink",`#${o}`)):t(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")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),$e(ke(document)()),void 0===W&&(W=`${D}px`),Se("margin",(c="margin",(u=W).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Se("background",B),Se("padding",F),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),z('HTML & body height set to "auto !important"')}(),Ee(),Fe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Je(0,0,"title",document.title),!0!==q&&z("Auto Resize disabled"),Me({method:o="add",eventType:"After Print",eventName:"afterprint"}),Me({method:o,eventType:"Before Print",eventName:"beforeprint"}),Me({method:o,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 d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Ee(),we(),$e(e),e.forEach(Ae),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ce),ie.observe(document.body),Oe.add(document.body),Ae(document.body),setTimeout(ye),z("Initialization complete"),z("---")}function we(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,z(`Tagged elements found: ${J}`)}function $e(e){J||ne(e)}function Se(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Ee(){if(""!==ae){z(`Applying sizeSelector: ${ae}`);for(const e of document.querySelectorAll(ae))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Me(e){({add(t){function n(){Fe(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function Te(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function je(){_=Te(_,v,qe,"height")}function Pe(){pe=Te(pe,I,Be,"width")}function Ce(e){Array.isArray(e)&&0!==e.length&&Fe("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Oe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Oe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=ke(e)();for(const e of t){if(Oe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function Ie(e){performance.mark(P);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:j()?M:ke(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return R=i,performance.mark(C,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=e=>()=>e.querySelectorAll("* :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)"),Re={height:0,width:0},xe={height:0,width:0};function Le(e){function t(){return xe[i]=r,Re[i]=s,r}const n=j(),o=e===qe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===xe[i]&&0===Re[i]:return z(`Initial page size values: ${d}`),t();case ue&&r===xe[i]&&s===Re[i]:return z(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return z(`Page is hidden: ${d}`),s;case!n&&r!==xe[i]&&s<=Re[i]:return z(`New HTML bounding size: ${d}`,"Previous bounding size:",xe[i]),t();case!o:return e.taggedElement();case!n&&r<xe[i]:return z("HTML bounding size decreased:",d),t();case s===l||s===a:return z("HTML bounding size equals page size:",d),t();case r>s:return z(`Page size < HTML bounding size: ${d}`),t();default:z(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const qe={enabled:()=>H,getOffset:()=>N,auto:()=>Le(qe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ne(qe)),min:()=>Math.min(...Ne(qe)),grow:()=>qe.max(),lowestElement:()=>Ie(i),taggedElement:()=>Ie(i)},Be={enabled:()=>U,getOffset:()=>k,auto:()=>Le(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ne(Be)),min:()=>Math.min(...Ne(Be)),rightMostElement:()=>Ie(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ie(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Fe(e,t,n,o,i){L=performance.now(),q||e===a?document.hidden?z("Page hidden - Ignored resize request"):(We||(z(`Resize event: ${t}`),x=!0,function(e,t,n,o,i){const r=void 0===n?qe[_]():n,l=void 0===o?Be[pe]():o;H&&De(Z,r)||U&&De(fe,l)||"init"===e?(He(),Z=r,fe=l,Je(Z,fe,e,i)):!e!==a&&(H&&_ in A||U&&pe in A)?Ve(t):x=!1}(e,t,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0):z("Resizing disabled")}function He(){ue||(ue=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,z("Trigger event lock off"),z("--")})))}function Ue(e){Z=qe[_](),fe=Be[pe](),Je(Z,fe,e)}function Ve(e){const t=_;_=v,z(`Reset trigger event: ${e}`),He(),Ue("reset"),_=t}function Je(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(k||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(re?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),x&&console.info(function(){const e=m(performance.now()-L);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),x=!1,re?window.parent.iframeParentListener(w+r):se.postMessage(w+r,i)}())}function Ze(e){const t={init:function(){X=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Ue("resetPage"))},resize(){Fe(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),be?setTimeout((()=>be(JSON.parse(e)))):Je(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ve?setTimeout(ve(Object.freeze(JSON.parse(e)))):Je(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),he(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,O)&&(!1!==V?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}();
21
21
  //# sourceMappingURL=index.cjs.js.map
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.3.0-beta.2 (esm) - 2024-09-03
4
+ * @module iframe-resizer/child 5.3.1-beta.1 (esm) - 2024-09-09
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
- const e="5.3.0-beta.2",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),E=e=>S(e);let M=[];const T=e=>{const t=e.side||i,n=e.onChange||c,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){M=document.querySelectorAll(`[${o}]`),z("overflowedElements:",M.length),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>M.length>0,P="--ifr-start",C="--ifr-end",O="--ifr-measure",A=[],I=new WeakSet,N=e=>"object"==typeof e&&I.add(e);let k=null,R=null,x={};const L=setInterval((()=>{if(A.length<10)return;if(x.hasTags&&x.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);z("Max time:",Math.max(...A)),e<=4||(clearInterval(L),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===C){const{duration:t}=performance.measure(O,P,C);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,I.has(R)||k===R||i&&o<=1||(r||N(R),k=R,w(`\n${n} position calculated from:`,R,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),N(document.documentElement),N(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),qe.auto()),width:()=>($("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",O=w.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="scroll";let N,k,x,L,q=!0,B="",D=0,W="",F="",H=!0,U=!1,V=!0,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=I,ge=window,he=()=>{$("onMessage function not defined")},ye=()=>{},be=null,ve=null;function ze(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(O).split(":");te=t[0],D=void 0===t[1]?D:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],_=void 0===t[8]?_:t[8],B=t[9],F=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),N=void 0===t[16]?N:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ye=e?.onReady||ye,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(N=e?.offset),U&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,_=e?.heightCalculationMethod||_,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),pe=t(pe,"width"),z(`TargetOrigin for parent set to: ${de}`))}(),function(){try{re="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?E(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&E(d(3)),me&&""!==me&&"false"!==me?me!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):S("<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(),Pe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<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</>.")}(),we(),H!==U&&(ne=T({onChange:()=>Fe("overflowChanged","Overflow updated"),side:H?i:r})),1!==K&&(ge.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Fe("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Je(0,0,"autoResize",JSON.stringify(q)),q),close(){Je(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return be=e,Je(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");be=null,Je(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ve=e,Je(0,0,"parentInfo"),()=>{ve=null,Je(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ve("parentIframe.reset")},scrollBy(e,t){Je(t,e,"scrollBy")},scrollTo(e,t){Je(t,e,"scrollTo")},scrollToOffset(e,t){Je(t,e,"scrollToOffset")},sendMessage(e,t){Je(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,je()},setWidthCalculationMethod(e){pe=e,Pe()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),de=e},resize(e,t){Fe(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),ge.parentIFrame=ge.parentIframe),function(){function e(e){Je(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Je(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),Je(0,0,"inPageLink",`#${o}`)):t(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")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),$e(ke(document)()),void 0===W&&(W=`${D}px`),Se("margin",(c="margin",(u=W).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Se("background",B),Se("padding",F),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),z('HTML & body height set to "auto !important"')}(),Ee(),Fe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Je(0,0,"title",document.title),!0!==q&&z("Auto Resize disabled"),Me({method:o="add",eventType:"After Print",eventName:"afterprint"}),Me({method:o,eventType:"Before Print",eventName:"beforeprint"}),Me({method:o,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 d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Ee(),we(),$e(e),e.forEach(Ae),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ce),ie.observe(document.body),Oe.add(document.body),Ae(document.body),setTimeout(ye),z("Initialization complete"),z("---")}function we(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,z(`Tagged elements found: ${J}`)}function $e(e){J||ne(e)}function Se(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Ee(){if(""!==ae){z(`Applying sizeSelector: ${ae}`);for(const e of document.querySelectorAll(ae))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Me(e){({add(t){function n(){Fe(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function Te(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function je(){_=Te(_,v,qe,"height")}function Pe(){pe=Te(pe,I,Be,"width")}function Ce(e){Array.isArray(e)&&0!==e.length&&Fe("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Oe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Oe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=ke(e)();for(const e of t){if(Oe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function Ie(e){performance.mark(P);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:j()?M:ke(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return R=i,performance.mark(C,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=e=>()=>e.querySelectorAll("* :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)"),Re={height:0,width:0},xe={height:0,width:0};function Le(e){function t(){return xe[i]=r,Re[i]=s,r}const n=j(),o=e===qe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===xe[i]&&0===Re[i]:return z(`Initial page size values: ${d}`),t();case ue&&r===xe[i]&&s===Re[i]:return z(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return z(`Page is hidden: ${d}`),s;case!n&&r!==xe[i]&&s<=Re[i]:return z(`New HTML bounding size: ${d}`,"Previous bounding size:",xe[i]),t();case!o:return e.taggedElement();case!n&&r<xe[i]:return z("HTML bounding size decreased:",d),t();case s===l||s===a:return z("HTML bounding size equals page size:",d),t();case r>s:return z(`Page size < HTML bounding size: ${d}`),t();default:z(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const qe={enabled:()=>H,getOffset:()=>N,auto:()=>Le(qe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ne(qe)),min:()=>Math.min(...Ne(qe)),grow:()=>qe.max(),lowestElement:()=>Ie(i),taggedElement:()=>Ie(i)},Be={enabled:()=>U,getOffset:()=>k,auto:()=>Le(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ne(Be)),min:()=>Math.min(...Ne(Be)),rightMostElement:()=>Ie(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ie(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Fe(e,t,n,o,i){L=performance.now(),q||e===a?document.hidden?z("Page hidden - Ignored resize request"):(We||(z(`Resize event: ${t}`),x=!0,function(e,t,n,o,i){const r=void 0===n?qe[_]():n,l=void 0===o?Be[pe]():o;H&&De(Z,r)||U&&De(fe,l)||"init"===e?(He(),Z=r,fe=l,Je(Z,fe,e,i)):!e!==a&&(H&&_ in A||U&&pe in A)?Ve(t):x=!1}(e,t,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0):z("Resizing disabled")}function He(){ue||(ue=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,z("Trigger event lock off"),z("--")})))}function Ue(e){Z=qe[_](),fe=Be[pe](),Je(Z,fe,e)}function Ve(e){const t=_;_=v,z(`Reset trigger event: ${e}`),He(),Ue("reset"),_=t}function Je(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(k||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(re?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),x&&console.info(function(){const e=m(performance.now()-L);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),x=!1,re?window.parent.iframeParentListener(w+r):se.postMessage(w+r,i)}())}function Ze(e){const t={init:function(){X=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Ue("resetPage"))},resize(){Fe(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),be?setTimeout((()=>be(JSON.parse(e)))):Je(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ve?setTimeout(ve(Object.freeze(JSON.parse(e)))):Je(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),he(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,O)&&(!1!==V?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}();
20
+ const e="5.3.1-beta.1",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),E=e=>S(e);let M=[];const T=e=>{const t=e.side||i,n=e.onChange||c,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){M=document.querySelectorAll(`[${o}]`),z("overflowedElements:",M.length),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>M.length>0,P="--ifr-start",C="--ifr-end",O="--ifr-measure",A=[],I=new WeakSet,N=e=>"object"==typeof e&&I.add(e);let k=null,R=null,x={};const L=setInterval((()=>{if(A.length<10)return;if(x.hasTags&&x.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);z("Max time:",Math.max(...A)),e<=4||(clearInterval(L),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===C){const{duration:t}=performance.measure(O,P,C);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,I.has(R)||k===R||i&&o<=1||(r||N(R),k=R,w(`\n${n} position calculated from:`,R,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),N(document.documentElement),N(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),qe.auto()),width:()=>($("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",O=w.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="scroll";let N,k,x,L,q=!0,B="",D=0,W="",F="",H=!0,U=!1,V=!0,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=I,ge=window,he=()=>{$("onMessage function not defined")},ye=()=>{},be=null,ve=null;function ze(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(O).split(":");te=t[0],D=void 0===t[1]?D:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],_=void 0===t[8]?_:t[8],B=t[9],F=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),N=void 0===t[16]?N:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ye=e?.onReady||ye,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(N=e?.offset),U&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,_=e?.heightCalculationMethod||_,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),pe=t(pe,"width"),z(`TargetOrigin for parent set to: ${de}`))}(),function(){try{re="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?E(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&E(d(3)),me&&""!==me&&"false"!==me?me!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):S("<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(),Pe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<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</>.")}(),we(),H!==U&&(ne=T({onChange:()=>Fe("overflowChanged","Overflow updated"),side:H?i:r})),1!==K&&(ge.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Fe("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Je(0,0,"autoResize",JSON.stringify(q)),q),close(){Je(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return be=e,Je(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");be=null,Je(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ve=e,Je(0,0,"parentInfo"),()=>{ve=null,Je(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ve("parentIframe.reset")},scrollBy(e,t){Je(t,e,"scrollBy")},scrollTo(e,t){Je(t,e,"scrollTo")},scrollToOffset(e,t){Je(t,e,"scrollToOffset")},sendMessage(e,t){Je(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,je()},setWidthCalculationMethod(e){pe=e,Pe()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),de=e},resize(e,t){Fe(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),ge.parentIFrame=ge.parentIframe),function(){function e(e){Je(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Je(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),Je(0,0,"inPageLink",`#${o}`)):t(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")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),$e(ke(document)()),void 0===W&&(W=`${D}px`),Se("margin",(c="margin",(u=W).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Se("background",B),Se("padding",F),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),z('HTML & body height set to "auto !important"')}(),Ee(),Fe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Je(0,0,"title",document.title),!0!==q&&z("Auto Resize disabled"),Me({method:o="add",eventType:"After Print",eventName:"afterprint"}),Me({method:o,eventType:"Before Print",eventName:"beforeprint"}),Me({method:o,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 d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Ee(),we(),$e(e),e.forEach(Ae),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ce),ie.observe(document.body),Oe.add(document.body),Ae(document.body),setTimeout(ye),z("Initialization complete"),z("---")}function we(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,z(`Tagged elements found: ${J}`)}function $e(e){J||ne(e)}function Se(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Ee(){if(""!==ae){z(`Applying sizeSelector: ${ae}`);for(const e of document.querySelectorAll(ae))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Me(e){({add(t){function n(){Fe(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function Te(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function je(){_=Te(_,v,qe,"height")}function Pe(){pe=Te(pe,I,Be,"width")}function Ce(e){Array.isArray(e)&&0!==e.length&&Fe("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Oe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Oe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=ke(e)();for(const e of t){if(Oe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function Ie(e){performance.mark(P);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:j()?M:ke(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return R=i,performance.mark(C,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=e=>()=>e.querySelectorAll("* :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)"),Re={height:0,width:0},xe={height:0,width:0};function Le(e){function t(){return xe[i]=r,Re[i]=s,r}const n=j(),o=e===qe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===xe[i]&&0===Re[i]:return z(`Initial page size values: ${d}`),t();case ue&&r===xe[i]&&s===Re[i]:return z(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return z(`Page is hidden: ${d}`),s;case!n&&r!==xe[i]&&s<=Re[i]:return z(`New HTML bounding size: ${d}`,"Previous bounding size:",xe[i]),t();case!o:return e.taggedElement();case!n&&r<xe[i]:return z("HTML bounding size decreased:",d),t();case s===l||s===a:return z("HTML bounding size equals page size:",d),t();case r>s:return z(`Page size < HTML bounding size: ${d}`),t();default:z(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const qe={enabled:()=>H,getOffset:()=>N,auto:()=>Le(qe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ne(qe)),min:()=>Math.min(...Ne(qe)),grow:()=>qe.max(),lowestElement:()=>Ie(i),taggedElement:()=>Ie(i)},Be={enabled:()=>U,getOffset:()=>k,auto:()=>Le(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ne(Be)),min:()=>Math.min(...Ne(Be)),rightMostElement:()=>Ie(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ie(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Fe(e,t,n,o,i){L=performance.now(),q||e===a?document.hidden?z("Page hidden - Ignored resize request"):(We||(z(`Resize event: ${t}`),x=!0,function(e,t,n,o,i){const r=void 0===n?qe[_]():n,l=void 0===o?Be[pe]():o;H&&De(Z,r)||U&&De(fe,l)||"init"===e?(He(),Z=r,fe=l,Je(Z,fe,e,i)):!e!==a&&(H&&_ in A||U&&pe in A)?Ve(t):x=!1}(e,t,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0):z("Resizing disabled")}function He(){ue||(ue=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,z("Trigger event lock off"),z("--")})))}function Ue(e){Z=qe[_](),fe=Be[pe](),Je(Z,fe,e)}function Ve(e){const t=_;_=v,z(`Reset trigger event: ${e}`),He(),Ue("reset"),_=t}function Je(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(k||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(re?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),x&&console.info(function(){const e=m(performance.now()-L);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),x=!1,re?window.parent.iframeParentListener(w+r):se.postMessage(w+r,i)}())}function Ze(e){const t={init:function(){X=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Ue("resetPage"))},resize(){Fe(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),be?setTimeout((()=>be(JSON.parse(e)))):Je(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ve?setTimeout(ve(Object.freeze(JSON.parse(e)))):Je(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),he(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,O)&&(!1!==V?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}();
21
21
  //# sourceMappingURL=index.esm.js.map
package/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.3.0-beta.2 (umd) - 2024-09-03
4
+ * @module iframe-resizer/child 5.3.1-beta.1 (umd) - 2024-09-09
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
- !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.3.0-beta.2",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),E=e=>S(e);let M=[];const T=e=>{const t=e.side||i,n=e.onChange||c,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){M=document.querySelectorAll(`[${o}]`),z("overflowedElements:",M.length),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>M.length>0,P="--ifr-start",C="--ifr-end",O="--ifr-measure",A=[],I=new WeakSet,N=e=>"object"==typeof e&&I.add(e);let k=null,R=null,x={};const L=setInterval((()=>{if(A.length<10)return;if(x.hasTags&&x.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);z("Max time:",Math.max(...A)),e<=4||(clearInterval(L),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===C){const{duration:t}=performance.measure(O,P,C);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,I.has(R)||k===R||i&&o<=1||(r||N(R),k=R,w(`\n${n} position calculated from:`,R,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),N(document.documentElement),N(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),qe.auto()),width:()=>($("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",O=w.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="scroll";let N,k,x,L,q=!0,B="",D=0,W="",F="",H=!0,U=!1,V=!0,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=I,ge=window,he=()=>{$("onMessage function not defined")},ye=()=>{},be=null,ve=null;function ze(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(O).split(":");te=t[0],D=void 0===t[1]?D:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],_=void 0===t[8]?_:t[8],B=t[9],F=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),N=void 0===t[16]?N:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ye=e?.onReady||ye,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(N=e?.offset),U&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,_=e?.heightCalculationMethod||_,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),pe=t(pe,"width"),z(`TargetOrigin for parent set to: ${de}`))}(),function(){try{re="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?E(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&E(d(3)),me&&""!==me&&"false"!==me?me!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):S("<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(),Pe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<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</>.")}(),we(),H!==U&&(ne=T({onChange:()=>Fe("overflowChanged","Overflow updated"),side:H?i:r})),1!==K&&(ge.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Fe("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Je(0,0,"autoResize",JSON.stringify(q)),q),close(){Je(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return be=e,Je(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");be=null,Je(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ve=e,Je(0,0,"parentInfo"),()=>{ve=null,Je(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ve("parentIframe.reset")},scrollBy(e,t){Je(t,e,"scrollBy")},scrollTo(e,t){Je(t,e,"scrollTo")},scrollToOffset(e,t){Je(t,e,"scrollToOffset")},sendMessage(e,t){Je(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,je()},setWidthCalculationMethod(e){pe=e,Pe()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),de=e},resize(e,t){Fe(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),ge.parentIFrame=ge.parentIframe),function(){function e(e){Je(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Je(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),Je(0,0,"inPageLink",`#${o}`)):t(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")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),$e(ke(document)()),void 0===W&&(W=`${D}px`),Se("margin",(c="margin",(u=W).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Se("background",B),Se("padding",F),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),z('HTML & body height set to "auto !important"')}(),Ee(),Fe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Je(0,0,"title",document.title),!0!==q&&z("Auto Resize disabled"),Me({method:o="add",eventType:"After Print",eventName:"afterprint"}),Me({method:o,eventType:"Before Print",eventName:"beforeprint"}),Me({method:o,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 d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Ee(),we(),$e(e),e.forEach(Ae),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ce),ie.observe(document.body),Oe.add(document.body),Ae(document.body),setTimeout(ye),z("Initialization complete"),z("---")}function we(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,z(`Tagged elements found: ${J}`)}function $e(e){J||ne(e)}function Se(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Ee(){if(""!==ae){z(`Applying sizeSelector: ${ae}`);for(const e of document.querySelectorAll(ae))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Me(e){({add(t){function n(){Fe(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function Te(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function je(){_=Te(_,v,qe,"height")}function Pe(){pe=Te(pe,I,Be,"width")}function Ce(e){Array.isArray(e)&&0!==e.length&&Fe("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Oe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Oe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=ke(e)();for(const e of t){if(Oe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function Ie(e){performance.mark(P);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:j()?M:ke(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return R=i,performance.mark(C,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=e=>()=>e.querySelectorAll("* :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)"),Re={height:0,width:0},xe={height:0,width:0};function Le(e){function t(){return xe[i]=r,Re[i]=s,r}const n=j(),o=e===qe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===xe[i]&&0===Re[i]:return z(`Initial page size values: ${d}`),t();case ue&&r===xe[i]&&s===Re[i]:return z(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return z(`Page is hidden: ${d}`),s;case!n&&r!==xe[i]&&s<=Re[i]:return z(`New HTML bounding size: ${d}`,"Previous bounding size:",xe[i]),t();case!o:return e.taggedElement();case!n&&r<xe[i]:return z("HTML bounding size decreased:",d),t();case s===l||s===a:return z("HTML bounding size equals page size:",d),t();case r>s:return z(`Page size < HTML bounding size: ${d}`),t();default:z(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const qe={enabled:()=>H,getOffset:()=>N,auto:()=>Le(qe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ne(qe)),min:()=>Math.min(...Ne(qe)),grow:()=>qe.max(),lowestElement:()=>Ie(i),taggedElement:()=>Ie(i)},Be={enabled:()=>U,getOffset:()=>k,auto:()=>Le(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ne(Be)),min:()=>Math.min(...Ne(Be)),rightMostElement:()=>Ie(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ie(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Fe(e,t,n,o,i){L=performance.now(),q||e===a?document.hidden?z("Page hidden - Ignored resize request"):(We||(z(`Resize event: ${t}`),x=!0,function(e,t,n,o,i){const r=void 0===n?qe[_]():n,l=void 0===o?Be[pe]():o;H&&De(Z,r)||U&&De(fe,l)||"init"===e?(He(),Z=r,fe=l,Je(Z,fe,e,i)):!e!==a&&(H&&_ in A||U&&pe in A)?Ve(t):x=!1}(e,t,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0):z("Resizing disabled")}function He(){ue||(ue=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,z("Trigger event lock off"),z("--")})))}function Ue(e){Z=qe[_](),fe=Be[pe](),Je(Z,fe,e)}function Ve(e){const t=_;_=v,z(`Reset trigger event: ${e}`),He(),Ue("reset"),_=t}function Je(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(k||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(re?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),x&&console.info(function(){const e=m(performance.now()-L);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),x=!1,re?window.parent.iframeParentListener(w+r):se.postMessage(w+r,i)}())}function Ze(e){const t={init:function(){X=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Ue("resetPage"))},resize(){Fe(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),be?setTimeout((()=>be(JSON.parse(e)))):Je(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ve?setTimeout(ve(Object.freeze(JSON.parse(e)))):Je(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),he(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,O)&&(!1!==V?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}()}));
20
+ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.3.1-beta.1",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),E=e=>S(e);let M=[];const T=e=>{const t=e.side||i,n=e.onChange||c,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){M=document.querySelectorAll(`[${o}]`),z("overflowedElements:",M.length),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>M.length>0,P="--ifr-start",C="--ifr-end",O="--ifr-measure",A=[],I=new WeakSet,N=e=>"object"==typeof e&&I.add(e);let k=null,R=null,x={};const L=setInterval((()=>{if(A.length<10)return;if(x.hasTags&&x.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);z("Max time:",Math.max(...A)),e<=4||(clearInterval(L),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===C){const{duration:t}=performance.measure(O,P,C);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,I.has(R)||k===R||i&&o<=1||(r||N(R),k=R,w(`\n${n} position calculated from:`,R,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),N(document.documentElement),N(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),qe.auto()),width:()=>($("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",O=w.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="scroll";let N,k,x,L,q=!0,B="",D=0,W="",F="",H=!0,U=!1,V=!0,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=I,ge=window,he=()=>{$("onMessage function not defined")},ye=()=>{},be=null,ve=null;function ze(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(O).split(":");te=t[0],D=void 0===t[1]?D:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],_=void 0===t[8]?_:t[8],B=t[9],F=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),N=void 0===t[16]?N:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ye=e?.onReady||ye,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(N=e?.offset),U&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,_=e?.heightCalculationMethod||_,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),pe=t(pe,"width"),z(`TargetOrigin for parent set to: ${de}`))}(),function(){try{re="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?E(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&E(d(3)),me&&""!==me&&"false"!==me?me!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):S("<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(),Pe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<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</>.")}(),we(),H!==U&&(ne=T({onChange:()=>Fe("overflowChanged","Overflow updated"),side:H?i:r})),1!==K&&(ge.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Fe("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Je(0,0,"autoResize",JSON.stringify(q)),q),close(){Je(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return be=e,Je(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");be=null,Je(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ve=e,Je(0,0,"parentInfo"),()=>{ve=null,Je(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ve("parentIframe.reset")},scrollBy(e,t){Je(t,e,"scrollBy")},scrollTo(e,t){Je(t,e,"scrollTo")},scrollToOffset(e,t){Je(t,e,"scrollToOffset")},sendMessage(e,t){Je(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,je()},setWidthCalculationMethod(e){pe=e,Pe()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),de=e},resize(e,t){Fe(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),ge.parentIFrame=ge.parentIframe),function(){function e(e){Je(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Je(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),Je(0,0,"inPageLink",`#${o}`)):t(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")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),$e(ke(document)()),void 0===W&&(W=`${D}px`),Se("margin",(c="margin",(u=W).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Se("background",B),Se("padding",F),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),z('HTML & body height set to "auto !important"')}(),Ee(),Fe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Je(0,0,"title",document.title),!0!==q&&z("Auto Resize disabled"),Me({method:o="add",eventType:"After Print",eventName:"afterprint"}),Me({method:o,eventType:"Before Print",eventName:"beforeprint"}),Me({method:o,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 d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Ee(),we(),$e(e),e.forEach(Ae),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ce),ie.observe(document.body),Oe.add(document.body),Ae(document.body),setTimeout(ye),z("Initialization complete"),z("---")}function we(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,z(`Tagged elements found: ${J}`)}function $e(e){J||ne(e)}function Se(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Ee(){if(""!==ae){z(`Applying sizeSelector: ${ae}`);for(const e of document.querySelectorAll(ae))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Me(e){({add(t){function n(){Fe(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function Te(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function je(){_=Te(_,v,qe,"height")}function Pe(){pe=Te(pe,I,Be,"width")}function Ce(e){Array.isArray(e)&&0!==e.length&&Fe("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Oe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Oe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=ke(e)();for(const e of t){if(Oe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ie.observe(e),Oe.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function Ie(e){performance.mark(P);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:j()?M:ke(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return R=i,performance.mark(C,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=e=>()=>e.querySelectorAll("* :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)"),Re={height:0,width:0},xe={height:0,width:0};function Le(e){function t(){return xe[i]=r,Re[i]=s,r}const n=j(),o=e===qe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===xe[i]&&0===Re[i]:return z(`Initial page size values: ${d}`),t();case ue&&r===xe[i]&&s===Re[i]:return z(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return z(`Page is hidden: ${d}`),s;case!n&&r!==xe[i]&&s<=Re[i]:return z(`New HTML bounding size: ${d}`,"Previous bounding size:",xe[i]),t();case!o:return e.taggedElement();case!n&&r<xe[i]:return z("HTML bounding size decreased:",d),t();case s===l||s===a:return z("HTML bounding size equals page size:",d),t();case r>s:return z(`Page size < HTML bounding size: ${d}`),t();default:z(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const qe={enabled:()=>H,getOffset:()=>N,auto:()=>Le(qe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ne(qe)),min:()=>Math.min(...Ne(qe)),grow:()=>qe.max(),lowestElement:()=>Ie(i),taggedElement:()=>Ie(i)},Be={enabled:()=>U,getOffset:()=>k,auto:()=>Le(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ne(Be)),min:()=>Math.min(...Ne(Be)),rightMostElement:()=>Ie(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ie(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Fe(e,t,n,o,i){L=performance.now(),q||e===a?document.hidden?z("Page hidden - Ignored resize request"):(We||(z(`Resize event: ${t}`),x=!0,function(e,t,n,o,i){const r=void 0===n?qe[_]():n,l=void 0===o?Be[pe]():o;H&&De(Z,r)||U&&De(fe,l)||"init"===e?(He(),Z=r,fe=l,Je(Z,fe,e,i)):!e!==a&&(H&&_ in A||U&&pe in A)?Ve(t):x=!1}(e,t,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0):z("Resizing disabled")}function He(){ue||(ue=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,z("Trigger event lock off"),z("--")})))}function Ue(e){Z=qe[_](),fe=Be[pe](),Je(Z,fe,e)}function Ve(e){const t=_;_=v,z(`Reset trigger event: ${e}`),He(),Ue("reset"),_=t}function Je(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(k||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(re?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),x&&console.info(function(){const e=m(performance.now()-L);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),x=!1,re?window.parent.iframeParentListener(w+r):se.postMessage(w+r,i)}())}function Ze(e){const t={init:function(){X=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Ue("resetPage"))},resize(){Fe(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),be?setTimeout((()=>be(JSON.parse(e)))):Je(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ve?setTimeout(ve(Object.freeze(JSON.parse(e)))):Je(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),he(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,O)&&(!1!==V?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}()}));
21
21
  //# sourceMappingURL=index.umd.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/child",
3
- "version": "5.3.0-beta.2",
3
+ "version": "5.3.1-beta.1",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {