@iframe-resizer/child
Advanced tools
Comparing version 5.2.4-beta.2 to 5.2.4-beta.3
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/child 5.2.4-beta.2 (cjs) - 2024-08-13 | ||
* @module iframe-resizer/child 5.2.4-beta.3 (cjs) - 2024-08-14 | ||
* | ||
@@ -20,3 +20,3 @@ * @license GPL-3.0 for non-commercial use only. | ||
"use strict";const e="5.2.4-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 c=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]),d=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m="",f=!1;const p=e=>{m=e.id,f=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>""!=`${e}`&&void 0!==e;function y(e){switch(!0){case!g(e):return"";case g(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case g(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(g(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${m}]`,...e].join(" "),b=(...e)=>f&&console?.log(v(...e)),z=(...e)=>console?.info(`[iframe-resizer][${m}]`,...e),w=(...e)=>console?.warn(v(...e)),$=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),S=e=>$(e);let E=[];const M=e=>{const t=e.side||i,n=e.onChange||u,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),E=document.querySelectorAll(`[${o}]`),b("overflowedElements:",E.length),n()}),r);function s(e){if(e&&!a.has(e))try{l.observe(e),a.add(e)}catch(t){w("overflowObserver error:",t),w("element:",e,`(${typeof e})`)}}return e=>e.forEach(s)},j=()=>E.length>0,P=1e5,T="--ifr-start",O="--ifr-end",C="--ifr-measure",A=[],I=new WeakSet,k=e=>"object"==typeof e&&I.add(e),R=e=>Math.floor(e*P)/P;let N=null,x=null,L={};const q=setInterval((()=>{if(A.length<10)return;if(L.hasTags&&L.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);b("Max time:",Math.max(...A)),e<=4||(clearInterval(q),$(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${L.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function B(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(C,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;L=e,I.has(x)||N===x||i&&o<=1||(r||k(x),N=x,z(`\n${n} position calculated from:`,x,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${R(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function F(){new PerformanceObserver(B).observe({entryTypes:["mark"]}),k(document.documentElement),k(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",F):F()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(w("Custom height calculation function not defined"),He.auto()),width:()=>(w("Custom width calculation function not defined"),Ue.auto())},m={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,g={},v="checkVisibility"in window,z="auto",P={reset:1,resetPage:1,init:1},C="[iFrameSizer]",A=C.length,I={max:1,min:1,bodyScroll:1,documentElementScroll:1},k=["body"],R="scroll";let N,L,q=!0,B="",F=0,W="",D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=z,X=!0,Y="",G={},K=!1,_=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,ce="*",de=0,ue=!1,me="",fe=1,pe=R,he=window,ge=()=>{w("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,a;!function(){const e=e=>"true"===e,t=Y.slice(A).split(":");te=t[0],F=void 0===t[1]?F:Number(t[1]),U=void 0===t[2]?U:e(t[2]),K=void 0===t[3]?K:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],Q=void 0===t[8]?Q:t[8],B=t[9],D=t[10],de=void 0===t[11]?de:Number(t[11]),G.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]),L=void 0===t[17]?L:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;b(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&($("<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&&(L=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(L=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),ce=e?.targetOrigin||ce,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(b(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}1!==_&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),b(`TargetOrigin for parent set to: ${ce}`))}(),b(`Initialising iFrame v${e} (${window.location.href})`),p({id:te,logging:K}),function(){try{re="iframeParentListener"in window.parent}catch(e){b("Cross domain iframe detected.")}}(),_<0?S(`${c(_+2)}${c(2)}`):me.codePointAt(0)>4||_<2&&S(c(3)),me&&""!==me&&"false"!==me?me!==e&&$(`<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`):$("<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"),Te(),Oe(),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&&$("<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</>.")}(),$e(),H!==U&&(ne=M({onChange:d(we),side:H?i:r})),1!==_&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Je("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Ye(0,0,"autoResize",JSON.stringify(q)),q),close(){Ye(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ye(0,0,"pageInfo"),void $("<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");ve=null,Ye(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ye(0,0,"parentInfo"),()=>{be=null,Ye(0,0,"parentInfoStop")}},getParentProperties(e){$("<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){G.findTarget(e)},reset(){Xe("parentIFrame.reset")},scrollBy(e,t){Ye(t,e,"scrollBy")},scrollTo(e,t){Ye(t,e,"scrollTo")},scrollToOffset(e,t){Ye(t,e,"scrollToOffset")},sendMessage(e,t){Ye(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Te()},setWidthCalculationMethod(e){pe=e,Oe()},setTargetOrigin(e){b(`Set targetOrigin: ${e}`),ce=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){$("<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)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ye(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){b(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),G=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);b(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ye(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?(b(`In page link (#${o}) not found in iFrame, so sending to parent`),Ye(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&l(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){b("Setting up location.hash handlers"),r(),a(),s()}return G.enable?1===_?$("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():b("In page linking not enabled"),{findTarget:o}}(),Se(Be(document)()),void 0===W&&(W=`${F}px`),Ee("margin",(o="margin",(a=W).includes("-")&&(w(`Negative CSS value ignored for ${o}`),a=""),a)),Ee("background",B),Ee("padding",D),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),b('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{var t;Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ye(0,0,"title",document.title),!0!==q&&b("Auto Resize disabled"),je({method:t="add",eventType:"After Print",eventName:"afterprint"}),je({method:t,eventType:"Before Print",eventName:"beforeprint"}),je({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&b("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return b(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(xe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return b("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ae),xe(window.document),ye(),b("Initialization complete"),b("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,b(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),b(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(b(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{b(`Applying data-iframe-size to: ${y(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Je(e.eventName,e.eventType)}g[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=g[e];var n,o;delete g[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),b(`${h(e.method)} event listener: ${e.eventType}`)}function Pe(e,t,n,o){return t!==e&&(e in n||(w(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in m&&$(`<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.`),b(`${o} calculation method set to "${e}"`)),e}function Te(){Q=Pe(Q,z,He,"height")}function Oe(){pe=Pe(pe,R,Ue,"width")}let Ce;function Ae(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ce=()=>Je("resizeObserver",`Resize Observed: ${y(t)}`),setTimeout((()=>{Ce&&Ce(),Ce=void 0}),0)}const Ie=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...Be(document)()].filter(Ie),Re=new WeakSet;function Ne(e){e&&!Re.has(e)&&(ie.observe(e),Re.add(e),b(`Attached resizeObserver: ${y(e)}`))}function xe(e){[...ke(),...k.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function Le(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?le:j()?E:Be(document)();let l=a.length;return a.forEach((t=>{J||!v||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),x=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:K}}),r}const qe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Be=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)"),Fe={height:0,width:0},We={height:0,width:0};function De(e){function t(){return We[i]=r,Fe[i]=s,r}const n=j(),o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===We[i]&&0===Fe[i]:return b(`Initial page size values: ${c}`),t();case ue&&r===We[i]&&s===Fe[i]:return b(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return b(`Page is hidden: ${c}`),s;case!n&&r!==We[i]&&s<=Fe[i]:return b(`New HTML bounding size: ${c}`,"Previous bounding size:",We[i]),t();case!o:return e.taggedElement();case!n&&r<We[i]:return b("HTML bounding size decreased:",c),t();case s===l||s===a:return b("HTML bounding size equals page size:",c),t();case r>s:return b(`Page size < HTML bounding size: ${c}`),t();default:b(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const He={enabled:()=>H,getOffset:()=>N,auto:()=>De(He),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...qe(He)),min:()=>Math.min(...qe(He)),grow:()=>He.max(),lowestElement:()=>Le(i),taggedElement:()=>Le(i)},Ue={enabled:()=>U,getOffset:()=>L,auto:()=>De(Ue),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...qe(Ue)),min:()=>Math.min(...qe(Ue)),rightMostElement:()=>Le(r),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>Le(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=de);return r=void 0===n?He[Q]():n,a=void 0===o?Ue[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in I||U&&pe in I)&&Xe(t):(Ze(),Z=r,fe=a,Ye(Z,fe,e,i))}function Je(e,t,n,o,i){q||e===a?document.hidden?b("Page hidden - Ignored resize request"):(e in P||b(`Trigger event: ${t}`),Ve(e,t,n,o,i)):b("Resizing disabled")}function Ze(){ue||(ue=!0,b("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,b("Trigger event lock off"),b("--")})))}function Qe(e){Z=He[Q](),fe=Ue[pe](),Ye(Z,fe,e)}function Xe(e){const t=Q;Q=z,b(`Reset trigger event: ${e}`),Ze(),Qe("reset"),Q=t}function Ye(e,t,n,o,i){_<-1||(void 0!==i?b(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(N||0)}:${t+(L||0)}:${n}${void 0===o?"":`:${o}`}`;b(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(C+r):se.postMessage(C+r,i)}())}function Ge(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),f)},reset(){X?b("Page reset ignored by init"):(b("Page size reset by host page"),Qe("resetPage"))},resize(){Je(a,"Parent window requested size check")},moveToAnchor(){G.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();b(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ye(0,0,"pageInfoStop"),b(" --")},parentInfo(){const e=o();b(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ye(0,0,"parentInfoStop"),b(" --")},message(){const e=o();b(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),b(" --")}},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};C===`${e.data}`.slice(0,A)&&(!1!==V?r()?t.init():b(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||w(`Unexpected message (${e.data})`)}())}function Ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ge({data:e,sameDomain:!0}),l(window,"message",Ge),l(window,"readystatechange",Ke),Ke()}(); | ||
"use strict";const e="5.2.4-beta.3",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=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m="",f=!1;const p=e=>{m=e.id,f=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>""!=`${e}`&&void 0!==e;function y(e){switch(!0){case!g(e):return"";case g(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case g(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(g(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${m}]`,...e].join(" "),b=(...e)=>f&&console?.log(v(...e)),z=(...e)=>console?.info(`[iframe-resizer][${m}]`,...e),w=(...e)=>console?.warn(v(...e)),$=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),S=e=>$(e);let E=[];const M=e=>{const t=e.side||i,n=e.onChange||u,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),E=document.querySelectorAll(`[${o}]`),b("overflowedElements:",E.length),n()}),r);function s(e){e?.nodeType===Node.ELEMENT_NODE&&(a.has(e)||(l.observe(e),a.add(e)))}return e=>e.forEach(s)},j=()=>E.length>0,P=1e5,T="--ifr-start",O="--ifr-end",C="--ifr-measure",A=[],I=new WeakSet,k=e=>"object"==typeof e&&I.add(e),R=e=>Math.floor(e*P)/P;let N=null,x=null,L={};const q=setInterval((()=>{if(A.length<10)return;if(L.hasTags&&L.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);b("Max time:",Math.max(...A)),e<=4||(clearInterval(q),$(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${L.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function B(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(C,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;L=e,I.has(x)||N===x||i&&o<=1||(r||k(x),N=x,z(`\n${n} position calculated from:`,x,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${R(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function F(){new PerformanceObserver(B).observe({entryTypes:["mark"]}),k(document.documentElement),k(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",F):F()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(w("Custom height calculation function not defined"),He.auto()),width:()=>(w("Custom width calculation function not defined"),Ue.auto())},m={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,g={},v="checkVisibility"in window,z="auto",P={reset:1,resetPage:1,init:1},C="[iFrameSizer]",A=C.length,I={max:1,min:1,bodyScroll:1,documentElementScroll:1},k=["body"],R="scroll";let N,L,q=!0,B="",F=0,W="",D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=z,X=!0,Y="",_={},G=!1,K=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=R,he=window,ge=()=>{w("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,a;!function(){const e=e=>"true"===e,t=Y.slice(A).split(":");te=t[0],F=void 0===t[1]?F: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],Q=void 0===t[8]?Q:t[8],B=t[9],D=t[10],ce=void 0===t[11]?ce:Number(t[11]),_.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]),L=void 0===t[17]?L: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])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;b(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&($("<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&&(L=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(L=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(b(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}1!==K&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),b(`TargetOrigin for parent set to: ${de}`))}(),b(`Initialising iFrame v${e} (${window.location.href})`),p({id:te,logging:G}),function(){try{re="iframeParentListener"in window.parent}catch(e){b("Cross domain iframe detected.")}}(),K<0?S(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&S(d(3)),me&&""!==me&&"false"!==me?me!==e&&$(`<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`):$("<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"),Te(),Oe(),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&&$("<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</>.")}(),$e(),H!==U&&(ne=M({onChange:c(we),side:H?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Je("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Ye(0,0,"autoResize",JSON.stringify(q)),q),close(){Ye(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ye(0,0,"pageInfo"),void $("<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");ve=null,Ye(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ye(0,0,"parentInfo"),()=>{be=null,Ye(0,0,"parentInfoStop")}},getParentProperties(e){$("<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){_.findTarget(e)},reset(){Xe("parentIFrame.reset")},scrollBy(e,t){Ye(t,e,"scrollBy")},scrollTo(e,t){Ye(t,e,"scrollTo")},scrollToOffset(e,t){Ye(t,e,"scrollToOffset")},sendMessage(e,t){Ye(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Te()},setWidthCalculationMethod(e){pe=e,Oe()},setTargetOrigin(e){b(`Set targetOrigin: ${e}`),de=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){$("<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)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ye(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){b(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),_=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);b(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ye(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?(b(`In page link (#${o}) not found in iFrame, so sending to parent`),Ye(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&l(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){b("Setting up location.hash handlers"),r(),a(),s()}return _.enable?1===K?$("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():b("In page linking not enabled"),{findTarget:o}}(),Se(Be(document)()),void 0===W&&(W=`${F}px`),Ee("margin",(o="margin",(a=W).includes("-")&&(w(`Negative CSS value ignored for ${o}`),a=""),a)),Ee("background",B),Ee("padding",D),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),b('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{var t;Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ye(0,0,"title",document.title),!0!==q&&b("Auto Resize disabled"),je({method:t="add",eventType:"After Print",eventName:"afterprint"}),je({method:t,eventType:"Before Print",eventName:"beforeprint"}),je({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&b("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function d(){const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return b(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(xe),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 b("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ae),xe(window.document),ye(),b("Initialization complete"),b("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,b(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),b(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(b(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{b(`Applying data-iframe-size to: ${y(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Je(e.eventName,e.eventType)}g[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=g[e];var n,o;delete g[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),b(`${h(e.method)} event listener: ${e.eventType}`)}function Pe(e,t,n,o){return t!==e&&(e in n||(w(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in m&&$(`<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.`),b(`${o} calculation method set to "${e}"`)),e}function Te(){Q=Pe(Q,z,He,"height")}function Oe(){pe=Pe(pe,R,Ue,"width")}let Ce;function Ae(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ce=()=>Je("resizeObserver",`Resize Observed: ${y(t)}`),setTimeout((()=>{Ce&&Ce(),Ce=void 0}),0)}const Ie=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...Be(document)()].filter(Ie),Re=new WeakSet;function Ne(e){e&&!Re.has(e)&&(ie.observe(e),Re.add(e),b(`Attached resizeObserver: ${y(e)}`))}function xe(e){[...ke(),...k.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function Le(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?le:j()?E:Be(document)();let l=a.length;return a.forEach((t=>{J||!v||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),x=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const qe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Be=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)"),Fe={height:0,width:0},We={height:0,width:0};function De(e){function t(){return We[i]=r,Fe[i]=s,r}const n=j(),o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),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===We[i]&&0===Fe[i]:return b(`Initial page size values: ${d}`),t();case ue&&r===We[i]&&s===Fe[i]:return b(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return b(`Page is hidden: ${d}`),s;case!n&&r!==We[i]&&s<=Fe[i]:return b(`New HTML bounding size: ${d}`,"Previous bounding size:",We[i]),t();case!o:return e.taggedElement();case!n&&r<We[i]:return b("HTML bounding size decreased:",d),t();case s===l||s===a:return b("HTML bounding size equals page size:",d),t();case r>s:return b(`Page size < HTML bounding size: ${d}`),t();default:b(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const He={enabled:()=>H,getOffset:()=>N,auto:()=>De(He),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...qe(He)),min:()=>Math.min(...qe(He)),grow:()=>He.max(),lowestElement:()=>Le(i),taggedElement:()=>Le(i)},Ue={enabled:()=>U,getOffset:()=>L,auto:()=>De(Ue),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...qe(Ue)),min:()=>Math.min(...qe(Ue)),rightMostElement:()=>Le(r),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>Le(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=ce);return r=void 0===n?He[Q]():n,a=void 0===o?Ue[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in I||U&&pe in I)&&Xe(t):(Ze(),Z=r,fe=a,Ye(Z,fe,e,i))}function Je(e,t,n,o,i){q||e===a?document.hidden?b("Page hidden - Ignored resize request"):(e in P||b(`Trigger event: ${t}`),Ve(e,t,n,o,i)):b("Resizing disabled")}function Ze(){ue||(ue=!0,b("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,b("Trigger event lock off"),b("--")})))}function Qe(e){Z=He[Q](),fe=Ue[pe](),Ye(Z,fe,e)}function Xe(e){const t=Q;Q=z,b(`Reset trigger event: ${e}`),Ze(),Qe("reset"),Q=t}function Ye(e,t,n,o,i){K<-1||(void 0!==i?b(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(L||0)}:${n}${void 0===o?"":`:${o}`}`;b(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(C+r):se.postMessage(C+r,i)}())}function _e(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),f)},reset(){X?b("Page reset ignored by init"):(b("Page size reset by host page"),Qe("resetPage"))},resize(){Je(a,"Parent window requested size check")},moveToAnchor(){_.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();b(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ye(0,0,"pageInfoStop"),b(" --")},parentInfo(){const e=o();b(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ye(0,0,"parentInfoStop"),b(" --")},message(){const e=o();b(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),b(" --")}},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};C===`${e.data}`.slice(0,A)&&(!1!==V?r()?t.init():b(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||w(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>_e({data:e,sameDomain:!0}),l(window,"message",_e),l(window,"readystatechange",Ge),Ge()}(); | ||
//# sourceMappingURL=index.cjs.js.map |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/child 5.2.4-beta.2 (esm) - 2024-08-13 | ||
* @module iframe-resizer/child 5.2.4-beta.3 (esm) - 2024-08-14 | ||
* | ||
@@ -20,3 +20,3 @@ * @license GPL-3.0 for non-commercial use only. | ||
const e="5.2.4-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 c=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]),d=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m="",f=!1;const p=e=>{m=e.id,f=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>""!=`${e}`&&void 0!==e;function y(e){switch(!0){case!g(e):return"";case g(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case g(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(g(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${m}]`,...e].join(" "),b=(...e)=>f&&console?.log(v(...e)),z=(...e)=>console?.info(`[iframe-resizer][${m}]`,...e),w=(...e)=>console?.warn(v(...e)),$=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),S=e=>$(e);let E=[];const M=e=>{const t=e.side||i,n=e.onChange||u,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),E=document.querySelectorAll(`[${o}]`),b("overflowedElements:",E.length),n()}),r);function s(e){if(e&&!a.has(e))try{l.observe(e),a.add(e)}catch(t){w("overflowObserver error:",t),w("element:",e,`(${typeof e})`)}}return e=>e.forEach(s)},j=()=>E.length>0,P=1e5,T="--ifr-start",O="--ifr-end",C="--ifr-measure",A=[],I=new WeakSet,k=e=>"object"==typeof e&&I.add(e),R=e=>Math.floor(e*P)/P;let N=null,x=null,L={};const q=setInterval((()=>{if(A.length<10)return;if(L.hasTags&&L.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);b("Max time:",Math.max(...A)),e<=4||(clearInterval(q),$(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${L.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function B(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(C,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;L=e,I.has(x)||N===x||i&&o<=1||(r||k(x),N=x,z(`\n${n} position calculated from:`,x,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${R(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function F(){new PerformanceObserver(B).observe({entryTypes:["mark"]}),k(document.documentElement),k(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",F):F()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(w("Custom height calculation function not defined"),He.auto()),width:()=>(w("Custom width calculation function not defined"),Ue.auto())},m={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,g={},v="checkVisibility"in window,z="auto",P={reset:1,resetPage:1,init:1},C="[iFrameSizer]",A=C.length,I={max:1,min:1,bodyScroll:1,documentElementScroll:1},k=["body"],R="scroll";let N,L,q=!0,B="",F=0,W="",D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=z,X=!0,Y="",G={},K=!1,_=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,ce="*",de=0,ue=!1,me="",fe=1,pe=R,he=window,ge=()=>{w("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,a;!function(){const e=e=>"true"===e,t=Y.slice(A).split(":");te=t[0],F=void 0===t[1]?F:Number(t[1]),U=void 0===t[2]?U:e(t[2]),K=void 0===t[3]?K:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],Q=void 0===t[8]?Q:t[8],B=t[9],D=t[10],de=void 0===t[11]?de:Number(t[11]),G.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]),L=void 0===t[17]?L:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;b(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&($("<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&&(L=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(L=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),ce=e?.targetOrigin||ce,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(b(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}1!==_&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),b(`TargetOrigin for parent set to: ${ce}`))}(),b(`Initialising iFrame v${e} (${window.location.href})`),p({id:te,logging:K}),function(){try{re="iframeParentListener"in window.parent}catch(e){b("Cross domain iframe detected.")}}(),_<0?S(`${c(_+2)}${c(2)}`):me.codePointAt(0)>4||_<2&&S(c(3)),me&&""!==me&&"false"!==me?me!==e&&$(`<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`):$("<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"),Te(),Oe(),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&&$("<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</>.")}(),$e(),H!==U&&(ne=M({onChange:d(we),side:H?i:r})),1!==_&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Je("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Ye(0,0,"autoResize",JSON.stringify(q)),q),close(){Ye(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ye(0,0,"pageInfo"),void $("<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");ve=null,Ye(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ye(0,0,"parentInfo"),()=>{be=null,Ye(0,0,"parentInfoStop")}},getParentProperties(e){$("<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){G.findTarget(e)},reset(){Xe("parentIFrame.reset")},scrollBy(e,t){Ye(t,e,"scrollBy")},scrollTo(e,t){Ye(t,e,"scrollTo")},scrollToOffset(e,t){Ye(t,e,"scrollToOffset")},sendMessage(e,t){Ye(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Te()},setWidthCalculationMethod(e){pe=e,Oe()},setTargetOrigin(e){b(`Set targetOrigin: ${e}`),ce=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){$("<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)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ye(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){b(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),G=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);b(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ye(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?(b(`In page link (#${o}) not found in iFrame, so sending to parent`),Ye(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&l(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){b("Setting up location.hash handlers"),r(),a(),s()}return G.enable?1===_?$("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():b("In page linking not enabled"),{findTarget:o}}(),Se(Be(document)()),void 0===W&&(W=`${F}px`),Ee("margin",(o="margin",(a=W).includes("-")&&(w(`Negative CSS value ignored for ${o}`),a=""),a)),Ee("background",B),Ee("padding",D),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),b('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{var t;Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ye(0,0,"title",document.title),!0!==q&&b("Auto Resize disabled"),je({method:t="add",eventType:"After Print",eventName:"afterprint"}),je({method:t,eventType:"Before Print",eventName:"beforeprint"}),je({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&b("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return b(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(xe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return b("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ae),xe(window.document),ye(),b("Initialization complete"),b("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,b(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),b(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(b(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{b(`Applying data-iframe-size to: ${y(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Je(e.eventName,e.eventType)}g[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=g[e];var n,o;delete g[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),b(`${h(e.method)} event listener: ${e.eventType}`)}function Pe(e,t,n,o){return t!==e&&(e in n||(w(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in m&&$(`<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.`),b(`${o} calculation method set to "${e}"`)),e}function Te(){Q=Pe(Q,z,He,"height")}function Oe(){pe=Pe(pe,R,Ue,"width")}let Ce;function Ae(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ce=()=>Je("resizeObserver",`Resize Observed: ${y(t)}`),setTimeout((()=>{Ce&&Ce(),Ce=void 0}),0)}const Ie=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...Be(document)()].filter(Ie),Re=new WeakSet;function Ne(e){e&&!Re.has(e)&&(ie.observe(e),Re.add(e),b(`Attached resizeObserver: ${y(e)}`))}function xe(e){[...ke(),...k.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function Le(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?le:j()?E:Be(document)();let l=a.length;return a.forEach((t=>{J||!v||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),x=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:K}}),r}const qe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Be=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)"),Fe={height:0,width:0},We={height:0,width:0};function De(e){function t(){return We[i]=r,Fe[i]=s,r}const n=j(),o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===We[i]&&0===Fe[i]:return b(`Initial page size values: ${c}`),t();case ue&&r===We[i]&&s===Fe[i]:return b(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return b(`Page is hidden: ${c}`),s;case!n&&r!==We[i]&&s<=Fe[i]:return b(`New HTML bounding size: ${c}`,"Previous bounding size:",We[i]),t();case!o:return e.taggedElement();case!n&&r<We[i]:return b("HTML bounding size decreased:",c),t();case s===l||s===a:return b("HTML bounding size equals page size:",c),t();case r>s:return b(`Page size < HTML bounding size: ${c}`),t();default:b(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const He={enabled:()=>H,getOffset:()=>N,auto:()=>De(He),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...qe(He)),min:()=>Math.min(...qe(He)),grow:()=>He.max(),lowestElement:()=>Le(i),taggedElement:()=>Le(i)},Ue={enabled:()=>U,getOffset:()=>L,auto:()=>De(Ue),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...qe(Ue)),min:()=>Math.min(...qe(Ue)),rightMostElement:()=>Le(r),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>Le(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=de);return r=void 0===n?He[Q]():n,a=void 0===o?Ue[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in I||U&&pe in I)&&Xe(t):(Ze(),Z=r,fe=a,Ye(Z,fe,e,i))}function Je(e,t,n,o,i){q||e===a?document.hidden?b("Page hidden - Ignored resize request"):(e in P||b(`Trigger event: ${t}`),Ve(e,t,n,o,i)):b("Resizing disabled")}function Ze(){ue||(ue=!0,b("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,b("Trigger event lock off"),b("--")})))}function Qe(e){Z=He[Q](),fe=Ue[pe](),Ye(Z,fe,e)}function Xe(e){const t=Q;Q=z,b(`Reset trigger event: ${e}`),Ze(),Qe("reset"),Q=t}function Ye(e,t,n,o,i){_<-1||(void 0!==i?b(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(N||0)}:${t+(L||0)}:${n}${void 0===o?"":`:${o}`}`;b(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(C+r):se.postMessage(C+r,i)}())}function Ge(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),f)},reset(){X?b("Page reset ignored by init"):(b("Page size reset by host page"),Qe("resetPage"))},resize(){Je(a,"Parent window requested size check")},moveToAnchor(){G.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();b(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ye(0,0,"pageInfoStop"),b(" --")},parentInfo(){const e=o();b(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ye(0,0,"parentInfoStop"),b(" --")},message(){const e=o();b(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),b(" --")}},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};C===`${e.data}`.slice(0,A)&&(!1!==V?r()?t.init():b(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||w(`Unexpected message (${e.data})`)}())}function Ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ge({data:e,sameDomain:!0}),l(window,"message",Ge),l(window,"readystatechange",Ke),Ke()}(); | ||
const e="5.2.4-beta.3",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=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m="",f=!1;const p=e=>{m=e.id,f=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>""!=`${e}`&&void 0!==e;function y(e){switch(!0){case!g(e):return"";case g(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case g(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(g(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${m}]`,...e].join(" "),b=(...e)=>f&&console?.log(v(...e)),z=(...e)=>console?.info(`[iframe-resizer][${m}]`,...e),w=(...e)=>console?.warn(v(...e)),$=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),S=e=>$(e);let E=[];const M=e=>{const t=e.side||i,n=e.onChange||u,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),E=document.querySelectorAll(`[${o}]`),b("overflowedElements:",E.length),n()}),r);function s(e){e?.nodeType===Node.ELEMENT_NODE&&(a.has(e)||(l.observe(e),a.add(e)))}return e=>e.forEach(s)},j=()=>E.length>0,P=1e5,T="--ifr-start",O="--ifr-end",C="--ifr-measure",A=[],I=new WeakSet,k=e=>"object"==typeof e&&I.add(e),R=e=>Math.floor(e*P)/P;let N=null,x=null,L={};const q=setInterval((()=>{if(A.length<10)return;if(L.hasTags&&L.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);b("Max time:",Math.max(...A)),e<=4||(clearInterval(q),$(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${L.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function B(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(C,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;L=e,I.has(x)||N===x||i&&o<=1||(r||k(x),N=x,z(`\n${n} position calculated from:`,x,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${R(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function F(){new PerformanceObserver(B).observe({entryTypes:["mark"]}),k(document.documentElement),k(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",F):F()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(w("Custom height calculation function not defined"),He.auto()),width:()=>(w("Custom width calculation function not defined"),Ue.auto())},m={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,g={},v="checkVisibility"in window,z="auto",P={reset:1,resetPage:1,init:1},C="[iFrameSizer]",A=C.length,I={max:1,min:1,bodyScroll:1,documentElementScroll:1},k=["body"],R="scroll";let N,L,q=!0,B="",F=0,W="",D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=z,X=!0,Y="",_={},G=!1,K=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=R,he=window,ge=()=>{w("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,a;!function(){const e=e=>"true"===e,t=Y.slice(A).split(":");te=t[0],F=void 0===t[1]?F: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],Q=void 0===t[8]?Q:t[8],B=t[9],D=t[10],ce=void 0===t[11]?ce:Number(t[11]),_.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]),L=void 0===t[17]?L: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])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;b(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&($("<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&&(L=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(L=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(b(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}1!==K&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),b(`TargetOrigin for parent set to: ${de}`))}(),b(`Initialising iFrame v${e} (${window.location.href})`),p({id:te,logging:G}),function(){try{re="iframeParentListener"in window.parent}catch(e){b("Cross domain iframe detected.")}}(),K<0?S(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&S(d(3)),me&&""!==me&&"false"!==me?me!==e&&$(`<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`):$("<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"),Te(),Oe(),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&&$("<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</>.")}(),$e(),H!==U&&(ne=M({onChange:c(we),side:H?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Je("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Ye(0,0,"autoResize",JSON.stringify(q)),q),close(){Ye(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ye(0,0,"pageInfo"),void $("<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");ve=null,Ye(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ye(0,0,"parentInfo"),()=>{be=null,Ye(0,0,"parentInfoStop")}},getParentProperties(e){$("<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){_.findTarget(e)},reset(){Xe("parentIFrame.reset")},scrollBy(e,t){Ye(t,e,"scrollBy")},scrollTo(e,t){Ye(t,e,"scrollTo")},scrollToOffset(e,t){Ye(t,e,"scrollToOffset")},sendMessage(e,t){Ye(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Te()},setWidthCalculationMethod(e){pe=e,Oe()},setTargetOrigin(e){b(`Set targetOrigin: ${e}`),de=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){$("<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)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ye(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){b(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),_=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);b(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ye(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?(b(`In page link (#${o}) not found in iFrame, so sending to parent`),Ye(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&l(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){b("Setting up location.hash handlers"),r(),a(),s()}return _.enable?1===K?$("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():b("In page linking not enabled"),{findTarget:o}}(),Se(Be(document)()),void 0===W&&(W=`${F}px`),Ee("margin",(o="margin",(a=W).includes("-")&&(w(`Negative CSS value ignored for ${o}`),a=""),a)),Ee("background",B),Ee("padding",D),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),b('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{var t;Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ye(0,0,"title",document.title),!0!==q&&b("Auto Resize disabled"),je({method:t="add",eventType:"After Print",eventName:"afterprint"}),je({method:t,eventType:"Before Print",eventName:"beforeprint"}),je({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&b("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function d(){const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return b(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(xe),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 b("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ae),xe(window.document),ye(),b("Initialization complete"),b("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,b(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),b(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(b(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{b(`Applying data-iframe-size to: ${y(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Je(e.eventName,e.eventType)}g[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=g[e];var n,o;delete g[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),b(`${h(e.method)} event listener: ${e.eventType}`)}function Pe(e,t,n,o){return t!==e&&(e in n||(w(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in m&&$(`<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.`),b(`${o} calculation method set to "${e}"`)),e}function Te(){Q=Pe(Q,z,He,"height")}function Oe(){pe=Pe(pe,R,Ue,"width")}let Ce;function Ae(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ce=()=>Je("resizeObserver",`Resize Observed: ${y(t)}`),setTimeout((()=>{Ce&&Ce(),Ce=void 0}),0)}const Ie=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...Be(document)()].filter(Ie),Re=new WeakSet;function Ne(e){e&&!Re.has(e)&&(ie.observe(e),Re.add(e),b(`Attached resizeObserver: ${y(e)}`))}function xe(e){[...ke(),...k.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function Le(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?le:j()?E:Be(document)();let l=a.length;return a.forEach((t=>{J||!v||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),x=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const qe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Be=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)"),Fe={height:0,width:0},We={height:0,width:0};function De(e){function t(){return We[i]=r,Fe[i]=s,r}const n=j(),o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),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===We[i]&&0===Fe[i]:return b(`Initial page size values: ${d}`),t();case ue&&r===We[i]&&s===Fe[i]:return b(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return b(`Page is hidden: ${d}`),s;case!n&&r!==We[i]&&s<=Fe[i]:return b(`New HTML bounding size: ${d}`,"Previous bounding size:",We[i]),t();case!o:return e.taggedElement();case!n&&r<We[i]:return b("HTML bounding size decreased:",d),t();case s===l||s===a:return b("HTML bounding size equals page size:",d),t();case r>s:return b(`Page size < HTML bounding size: ${d}`),t();default:b(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const He={enabled:()=>H,getOffset:()=>N,auto:()=>De(He),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...qe(He)),min:()=>Math.min(...qe(He)),grow:()=>He.max(),lowestElement:()=>Le(i),taggedElement:()=>Le(i)},Ue={enabled:()=>U,getOffset:()=>L,auto:()=>De(Ue),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...qe(Ue)),min:()=>Math.min(...qe(Ue)),rightMostElement:()=>Le(r),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>Le(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=ce);return r=void 0===n?He[Q]():n,a=void 0===o?Ue[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in I||U&&pe in I)&&Xe(t):(Ze(),Z=r,fe=a,Ye(Z,fe,e,i))}function Je(e,t,n,o,i){q||e===a?document.hidden?b("Page hidden - Ignored resize request"):(e in P||b(`Trigger event: ${t}`),Ve(e,t,n,o,i)):b("Resizing disabled")}function Ze(){ue||(ue=!0,b("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,b("Trigger event lock off"),b("--")})))}function Qe(e){Z=He[Q](),fe=Ue[pe](),Ye(Z,fe,e)}function Xe(e){const t=Q;Q=z,b(`Reset trigger event: ${e}`),Ze(),Qe("reset"),Q=t}function Ye(e,t,n,o,i){K<-1||(void 0!==i?b(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(L||0)}:${n}${void 0===o?"":`:${o}`}`;b(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(C+r):se.postMessage(C+r,i)}())}function _e(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),f)},reset(){X?b("Page reset ignored by init"):(b("Page size reset by host page"),Qe("resetPage"))},resize(){Je(a,"Parent window requested size check")},moveToAnchor(){_.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();b(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ye(0,0,"pageInfoStop"),b(" --")},parentInfo(){const e=o();b(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ye(0,0,"parentInfoStop"),b(" --")},message(){const e=o();b(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),b(" --")}},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};C===`${e.data}`.slice(0,A)&&(!1!==V?r()?t.init():b(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||w(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>_e({data:e,sameDomain:!0}),l(window,"message",_e),l(window,"readystatechange",Ge),Ge()}(); | ||
//# sourceMappingURL=index.esm.js.map |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/child 5.2.4-beta.2 (umd) - 2024-08-13 | ||
* @module iframe-resizer/child 5.2.4-beta.3 (umd) - 2024-08-14 | ||
* | ||
@@ -20,3 +20,3 @@ * @license GPL-3.0 for non-commercial use only. | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.2.4-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 c=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]),d=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m="",f=!1;const p=e=>{m=e.id,f=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>""!=`${e}`&&void 0!==e;function y(e){switch(!0){case!g(e):return"";case g(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case g(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(g(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${m}]`,...e].join(" "),b=(...e)=>f&&console?.log(v(...e)),z=(...e)=>console?.info(`[iframe-resizer][${m}]`,...e),w=(...e)=>console?.warn(v(...e)),$=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),S=e=>$(e);let E=[];const M=e=>{const t=e.side||i,n=e.onChange||u,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),E=document.querySelectorAll(`[${o}]`),b("overflowedElements:",E.length),n()}),r);function s(e){if(e&&!a.has(e))try{l.observe(e),a.add(e)}catch(t){w("overflowObserver error:",t),w("element:",e,`(${typeof e})`)}}return e=>e.forEach(s)},j=()=>E.length>0,P=1e5,T="--ifr-start",O="--ifr-end",C="--ifr-measure",A=[],I=new WeakSet,k=e=>"object"==typeof e&&I.add(e),R=e=>Math.floor(e*P)/P;let N=null,x=null,L={};const q=setInterval((()=>{if(A.length<10)return;if(L.hasTags&&L.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);b("Max time:",Math.max(...A)),e<=4||(clearInterval(q),$(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${L.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function B(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(C,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;L=e,I.has(x)||N===x||i&&o<=1||(r||k(x),N=x,z(`\n${n} position calculated from:`,x,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${R(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function F(){new PerformanceObserver(B).observe({entryTypes:["mark"]}),k(document.documentElement),k(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",F):F()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(w("Custom height calculation function not defined"),He.auto()),width:()=>(w("Custom width calculation function not defined"),Ue.auto())},m={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,g={},v="checkVisibility"in window,z="auto",P={reset:1,resetPage:1,init:1},C="[iFrameSizer]",A=C.length,I={max:1,min:1,bodyScroll:1,documentElementScroll:1},k=["body"],R="scroll";let N,L,q=!0,B="",F=0,W="",D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=z,X=!0,Y="",G={},K=!1,_=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,ce="*",de=0,ue=!1,me="",fe=1,pe=R,he=window,ge=()=>{w("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,a;!function(){const e=e=>"true"===e,t=Y.slice(A).split(":");te=t[0],F=void 0===t[1]?F:Number(t[1]),U=void 0===t[2]?U:e(t[2]),K=void 0===t[3]?K:e(t[3]),q=void 0===t[6]?q:e(t[6]),W=t[7],Q=void 0===t[8]?Q:t[8],B=t[9],D=t[10],de=void 0===t[11]?de:Number(t[11]),G.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]),L=void 0===t[17]?L:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;b(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&($("<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&&(L=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(L=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),ce=e?.targetOrigin||ce,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(b(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}1!==_&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),b(`TargetOrigin for parent set to: ${ce}`))}(),b(`Initialising iFrame v${e} (${window.location.href})`),p({id:te,logging:K}),function(){try{re="iframeParentListener"in window.parent}catch(e){b("Cross domain iframe detected.")}}(),_<0?S(`${c(_+2)}${c(2)}`):me.codePointAt(0)>4||_<2&&S(c(3)),me&&""!==me&&"false"!==me?me!==e&&$(`<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`):$("<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"),Te(),Oe(),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&&$("<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</>.")}(),$e(),H!==U&&(ne=M({onChange:d(we),side:H?i:r})),1!==_&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Je("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Ye(0,0,"autoResize",JSON.stringify(q)),q),close(){Ye(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ye(0,0,"pageInfo"),void $("<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");ve=null,Ye(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ye(0,0,"parentInfo"),()=>{be=null,Ye(0,0,"parentInfoStop")}},getParentProperties(e){$("<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){G.findTarget(e)},reset(){Xe("parentIFrame.reset")},scrollBy(e,t){Ye(t,e,"scrollBy")},scrollTo(e,t){Ye(t,e,"scrollTo")},scrollToOffset(e,t){Ye(t,e,"scrollToOffset")},sendMessage(e,t){Ye(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Te()},setWidthCalculationMethod(e){pe=e,Oe()},setTargetOrigin(e){b(`Set targetOrigin: ${e}`),ce=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){$("<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)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ye(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){b(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),G=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);b(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ye(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?(b(`In page link (#${o}) not found in iFrame, so sending to parent`),Ye(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&l(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){b("Setting up location.hash handlers"),r(),a(),s()}return G.enable?1===_?$("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():b("In page linking not enabled"),{findTarget:o}}(),Se(Be(document)()),void 0===W&&(W=`${F}px`),Ee("margin",(o="margin",(a=W).includes("-")&&(w(`Negative CSS value ignored for ${o}`),a=""),a)),Ee("background",B),Ee("padding",D),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),b('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{var t;Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ye(0,0,"title",document.title),!0!==q&&b("Auto Resize disabled"),je({method:t="add",eventType:"After Print",eventName:"afterprint"}),je({method:t,eventType:"Before Print",eventName:"beforeprint"}),je({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&b("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return b(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(xe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return b("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ae),xe(window.document),ye(),b("Initialization complete"),b("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,b(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),b(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(b(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{b(`Applying data-iframe-size to: ${y(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Je(e.eventName,e.eventType)}g[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=g[e];var n,o;delete g[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),b(`${h(e.method)} event listener: ${e.eventType}`)}function Pe(e,t,n,o){return t!==e&&(e in n||(w(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in m&&$(`<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.`),b(`${o} calculation method set to "${e}"`)),e}function Te(){Q=Pe(Q,z,He,"height")}function Oe(){pe=Pe(pe,R,Ue,"width")}let Ce;function Ae(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ce=()=>Je("resizeObserver",`Resize Observed: ${y(t)}`),setTimeout((()=>{Ce&&Ce(),Ce=void 0}),0)}const Ie=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...Be(document)()].filter(Ie),Re=new WeakSet;function Ne(e){e&&!Re.has(e)&&(ie.observe(e),Re.add(e),b(`Attached resizeObserver: ${y(e)}`))}function xe(e){[...ke(),...k.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function Le(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?le:j()?E:Be(document)();let l=a.length;return a.forEach((t=>{J||!v||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),x=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:K}}),r}const qe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Be=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)"),Fe={height:0,width:0},We={height:0,width:0};function De(e){function t(){return We[i]=r,Fe[i]=s,r}const n=j(),o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===We[i]&&0===Fe[i]:return b(`Initial page size values: ${c}`),t();case ue&&r===We[i]&&s===Fe[i]:return b(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return b(`Page is hidden: ${c}`),s;case!n&&r!==We[i]&&s<=Fe[i]:return b(`New HTML bounding size: ${c}`,"Previous bounding size:",We[i]),t();case!o:return e.taggedElement();case!n&&r<We[i]:return b("HTML bounding size decreased:",c),t();case s===l||s===a:return b("HTML bounding size equals page size:",c),t();case r>s:return b(`Page size < HTML bounding size: ${c}`),t();default:b(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const He={enabled:()=>H,getOffset:()=>N,auto:()=>De(He),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...qe(He)),min:()=>Math.min(...qe(He)),grow:()=>He.max(),lowestElement:()=>Le(i),taggedElement:()=>Le(i)},Ue={enabled:()=>U,getOffset:()=>L,auto:()=>De(Ue),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...qe(Ue)),min:()=>Math.min(...qe(Ue)),rightMostElement:()=>Le(r),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>Le(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=de);return r=void 0===n?He[Q]():n,a=void 0===o?Ue[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in I||U&&pe in I)&&Xe(t):(Ze(),Z=r,fe=a,Ye(Z,fe,e,i))}function Je(e,t,n,o,i){q||e===a?document.hidden?b("Page hidden - Ignored resize request"):(e in P||b(`Trigger event: ${t}`),Ve(e,t,n,o,i)):b("Resizing disabled")}function Ze(){ue||(ue=!0,b("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,b("Trigger event lock off"),b("--")})))}function Qe(e){Z=He[Q](),fe=Ue[pe](),Ye(Z,fe,e)}function Xe(e){const t=Q;Q=z,b(`Reset trigger event: ${e}`),Ze(),Qe("reset"),Q=t}function Ye(e,t,n,o,i){_<-1||(void 0!==i?b(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(N||0)}:${t+(L||0)}:${n}${void 0===o?"":`:${o}`}`;b(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(C+r):se.postMessage(C+r,i)}())}function Ge(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),f)},reset(){X?b("Page reset ignored by init"):(b("Page size reset by host page"),Qe("resetPage"))},resize(){Je(a,"Parent window requested size check")},moveToAnchor(){G.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();b(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ye(0,0,"pageInfoStop"),b(" --")},parentInfo(){const e=o();b(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ye(0,0,"parentInfoStop"),b(" --")},message(){const e=o();b(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),b(" --")}},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};C===`${e.data}`.slice(0,A)&&(!1!==V?r()?t.init():b(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||w(`Unexpected message (${e.data})`)}())}function Ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ge({data:e,sameDomain:!0}),l(window,"message",Ge),l(window,"readystatechange",Ke),Ke()}()})); | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.2.4-beta.3",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=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m="",f=!1;const p=e=>{m=e.id,f=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>""!=`${e}`&&void 0!==e;function y(e){switch(!0){case!g(e):return"";case g(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case g(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(g(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${m}]`,...e].join(" "),b=(...e)=>f&&console?.log(v(...e)),z=(...e)=>console?.info(`[iframe-resizer][${m}]`,...e),w=(...e)=>console?.warn(v(...e)),$=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),S=e=>$(e);let E=[];const M=e=>{const t=e.side||i,n=e.onChange||u,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),E=document.querySelectorAll(`[${o}]`),b("overflowedElements:",E.length),n()}),r);function s(e){e?.nodeType===Node.ELEMENT_NODE&&(a.has(e)||(l.observe(e),a.add(e)))}return e=>e.forEach(s)},j=()=>E.length>0,P=1e5,T="--ifr-start",O="--ifr-end",C="--ifr-measure",A=[],I=new WeakSet,k=e=>"object"==typeof e&&I.add(e),R=e=>Math.floor(e*P)/P;let N=null,x=null,L={};const q=setInterval((()=>{if(A.length<10)return;if(L.hasTags&&L.len<25)return;A.sort();const e=Math.min(A.reduce(((e,t)=>e+t),0)/A.length,A[Math.floor(A.length/2)]);b("Max time:",Math.max(...A)),e<=4||(clearInterval(q),$(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${L.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function B(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(C,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;L=e,I.has(x)||N===x||i&&o<=1||(r||k(x),N=x,z(`\n${n} position calculated from:`,x,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${R(t)}ms`))}(e.detail,t),A.push(t),A.length>100&&A.shift()}}))}function F(){new PerformanceObserver(B).observe({entryTypes:["mark"]}),k(document.documentElement),k(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",F):F()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(w("Custom height calculation function not defined"),He.auto()),width:()=>(w("Custom width calculation function not defined"),Ue.auto())},m={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,g={},v="checkVisibility"in window,z="auto",P={reset:1,resetPage:1,init:1},C="[iFrameSizer]",A=C.length,I={max:1,min:1,bodyScroll:1,documentElementScroll:1},k=["body"],R="scroll";let N,L,q=!0,B="",F=0,W="",D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=z,X=!0,Y="",_={},G=!1,K=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,de="*",ce=0,ue=!1,me="",fe=1,pe=R,he=window,ge=()=>{w("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,a;!function(){const e=e=>"true"===e,t=Y.slice(A).split(":");te=t[0],F=void 0===t[1]?F: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],Q=void 0===t[8]?Q:t[8],B=t[9],D=t[10],ce=void 0===t[11]?ce:Number(t[11]),_.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]),L=void 0===t[17]?L: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])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;b(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&($("<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&&(L=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(N=e?.offsetSize),U&&(L=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),de=e?.targetOrigin||de,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(b(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}1!==K&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),b(`TargetOrigin for parent set to: ${de}`))}(),b(`Initialising iFrame v${e} (${window.location.href})`),p({id:te,logging:G}),function(){try{re="iframeParentListener"in window.parent}catch(e){b("Cross domain iframe detected.")}}(),K<0?S(`${d(K+2)}${d(2)}`):me.codePointAt(0)>4||K<2&&S(d(3)),me&&""!==me&&"false"!==me?me!==e&&$(`<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`):$("<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"),Te(),Oe(),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&&$("<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</>.")}(),$e(),H!==U&&(ne=M({onChange:c(we),side:H?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===q?(q=!0,Je("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===q&&(q=!1),Ye(0,0,"autoResize",JSON.stringify(q)),q),close(){Ye(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ye(0,0,"pageInfo"),void $("<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");ve=null,Ye(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ye(0,0,"parentInfo"),()=>{be=null,Ye(0,0,"parentInfoStop")}},getParentProperties(e){$("<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){_.findTarget(e)},reset(){Xe("parentIFrame.reset")},scrollBy(e,t){Ye(t,e,"scrollBy")},scrollTo(e,t){Ye(t,e,"scrollTo")},scrollToOffset(e,t){Ye(t,e,"scrollToOffset")},sendMessage(e,t){Ye(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Te()},setWidthCalculationMethod(e){pe=e,Oe()},setTargetOrigin(e){b(`Set targetOrigin: ${e}`),de=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){$("<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)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ye(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){b(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),_=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);b(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ye(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?(b(`In page link (#${o}) not found in iFrame, so sending to parent`),Ye(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&l(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){b("Setting up location.hash handlers"),r(),a(),s()}return _.enable?1===K?$("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():b("In page linking not enabled"),{findTarget:o}}(),Se(Be(document)()),void 0===W&&(W=`${F}px`),Ee("margin",(o="margin",(a=W).includes("-")&&(w(`Negative CSS value ignored for ${o}`),a=""),a)),Ee("background",B),Ee("padding",D),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),b('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{var t;Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ye(0,0,"title",document.title),!0!==q&&b("Auto Resize disabled"),je({method:t="add",eventType:"After Print",eventName:"afterprint"}),je({method:t,eventType:"Before Print",eventName:"beforeprint"}),je({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&b("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function d(){const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return b(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(xe),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 b("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),ie=new ResizeObserver(Ae),xe(window.document),ye(),b("Initialization complete"),b("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,b(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),b(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(b(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{b(`Applying data-iframe-size to: ${y(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Je(e.eventName,e.eventType)}g[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=g[e];var n,o;delete g[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),b(`${h(e.method)} event listener: ${e.eventType}`)}function Pe(e,t,n,o){return t!==e&&(e in n||(w(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in m&&$(`<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.`),b(`${o} calculation method set to "${e}"`)),e}function Te(){Q=Pe(Q,z,He,"height")}function Oe(){pe=Pe(pe,R,Ue,"width")}let Ce;function Ae(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ce=()=>Je("resizeObserver",`Resize Observed: ${y(t)}`),setTimeout((()=>{Ce&&Ce(),Ce=void 0}),0)}const Ie=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...Be(document)()].filter(Ie),Re=new WeakSet;function Ne(e){e&&!Re.has(e)&&(ie.observe(e),Re.add(e),b(`Attached resizeObserver: ${y(e)}`))}function xe(e){[...ke(),...k.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function Le(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?le:j()?E:Be(document)();let l=a.length;return a.forEach((t=>{J||!v||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),x=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const qe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Be=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)"),Fe={height:0,width:0},We={height:0,width:0};function De(e){function t(){return We[i]=r,Fe[i]=s,r}const n=j(),o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),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===We[i]&&0===Fe[i]:return b(`Initial page size values: ${d}`),t();case ue&&r===We[i]&&s===Fe[i]:return b(`Size unchanged: ${d}`),Math.max(r,s);case 0===r:return b(`Page is hidden: ${d}`),s;case!n&&r!==We[i]&&s<=Fe[i]:return b(`New HTML bounding size: ${d}`,"Previous bounding size:",We[i]),t();case!o:return e.taggedElement();case!n&&r<We[i]:return b("HTML bounding size decreased:",d),t();case s===l||s===a:return b("HTML bounding size equals page size:",d),t();case r>s:return b(`Page size < HTML bounding size: ${d}`),t();default:b(`Content overflowing HTML element: ${d}`)}return Math.max(e.taggedElement(),t())}const He={enabled:()=>H,getOffset:()=>N,auto:()=>De(He),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...qe(He)),min:()=>Math.min(...qe(He)),grow:()=>He.max(),lowestElement:()=>Le(i),taggedElement:()=>Le(i)},Ue={enabled:()=>U,getOffset:()=>L,auto:()=>De(Ue),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...qe(Ue)),min:()=>Math.min(...qe(Ue)),rightMostElement:()=>Le(r),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>Le(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=ce);return r=void 0===n?He[Q]():n,a=void 0===o?Ue[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in I||U&&pe in I)&&Xe(t):(Ze(),Z=r,fe=a,Ye(Z,fe,e,i))}function Je(e,t,n,o,i){q||e===a?document.hidden?b("Page hidden - Ignored resize request"):(e in P||b(`Trigger event: ${t}`),Ve(e,t,n,o,i)):b("Resizing disabled")}function Ze(){ue||(ue=!0,b("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,b("Trigger event lock off"),b("--")})))}function Qe(e){Z=He[Q](),fe=Ue[pe](),Ye(Z,fe,e)}function Xe(e){const t=Q;Q=z,b(`Reset trigger event: ${e}`),Ze(),Qe("reset"),Q=t}function Ye(e,t,n,o,i){K<-1||(void 0!==i?b(`Message targetOrigin: ${i}`):i=de,function(){const r=`${te}:${e+(N||0)}:${t+(L||0)}:${n}${void 0===o?"":`:${o}`}`;b(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(C+r):se.postMessage(C+r,i)}())}function _e(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),f)},reset(){X?b("Page reset ignored by init"):(b("Page size reset by host page"),Qe("resetPage"))},resize(){Je(a,"Parent window requested size check")},moveToAnchor(){_.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();b(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ye(0,0,"pageInfoStop"),b(" --")},parentInfo(){const e=o();b(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ye(0,0,"parentInfoStop"),b(" --")},message(){const e=o();b(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),b(" --")}},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};C===`${e.data}`.slice(0,A)&&(!1!==V?r()?t.init():b(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||w(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>_e({data:e,sameDomain:!0}),l(window,"message",_e),l(window,"readystatechange",Ge),Ge()}()})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@iframe-resizer/child", | ||
"version": "5.2.4-beta.2", | ||
"version": "5.2.4-beta.3", | ||
"license": "GPL-3.0", | ||
@@ -5,0 +5,0 @@ "homepage": "https://iframe-resizer.com", |
@@ -25,2 +25,2 @@ [<img src="https://iframe-resizer.com/logo-full.svg" alt="" title="" style="margin-bottom: -20px">](https://iframe-resizer.com) | ||
_iframe-resizer version 5.2.4-beta.2 2024-08-13 - 17:38:24.908Z_ | ||
_iframe-resizer version 5.2.4-beta.3 2024-08-14 - 12:08:29.662Z_ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
325833
396