iframe-resizer
Advanced tools
Comparing version 5.3.3-beta.1 to 5.3.3-beta.2
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/legacy 5.3.3-beta.1 (cjs) - 2024-10-23 | ||
* @module iframe-resizer/legacy 5.3.3-beta.2 (cjs) - 2025-02-02 | ||
* | ||
@@ -16,3 +16,3 @@ * @license GPL-3.0 for non-commercial use only. | ||
* | ||
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved. | ||
* @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. | ||
*/ | ||
@@ -19,0 +19,0 @@ |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/legacy 5.3.3-beta.1 (esm) - 2024-10-23 | ||
* @module iframe-resizer/legacy 5.3.3-beta.2 (esm) - 2025-02-02 | ||
* | ||
@@ -16,3 +16,3 @@ * @license GPL-3.0 for non-commercial use only. | ||
* | ||
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved. | ||
* @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. | ||
*/ | ||
@@ -19,0 +19,0 @@ |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/legacy (child) 5.3.3-beta.1 (iife) | ||
* @module iframe-resizer/legacy (child) 5.3.3-beta.2 (iife) | ||
* | ||
@@ -16,7 +16,7 @@ * @license GPL-3.0 for non-commercial use only. | ||
* | ||
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved. | ||
* @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. | ||
*/ | ||
!function(){"use strict";const e="5.3.3-beta.1",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...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)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I=null,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(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?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}()}(); | ||
!function(){"use strict";const e="5.3.3-beta.2",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...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)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;const a=J?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}()}(); | ||
//# sourceMappingURL=iframeResizer.contentWindow.js.map |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/legacy (child) 5.3.3-beta.1 (iife) | ||
* @module iframe-resizer/legacy (child) 5.3.3-beta.2 (iife) | ||
* | ||
@@ -16,7 +16,7 @@ * @license GPL-3.0 for non-commercial use only. | ||
* | ||
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved. | ||
* @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. | ||
*/ | ||
!function(){"use strict";const e="5.3.3-beta.1",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...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)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I=null,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(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?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}()}(); | ||
!function(){"use strict";const e="5.3.3-beta.2",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...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)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&S("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;const a=J?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}()}(); | ||
//# sourceMappingURL=iframeResizer.contentWindow.min.js.map |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/legacy (parent) 5.3.3-beta.1 (umd) - 2024-10-23 | ||
* @module iframe-resizer/legacy (parent) 5.3.3-beta.2 (umd) - 2025-02-02 | ||
* | ||
@@ -16,7 +16,7 @@ * @license GPL-3.0 for non-commercial use only. | ||
* | ||
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved. | ||
* @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. | ||
*/ | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=i()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="[iframe-resizer]";let i={},t=!1;const n=i=>`${e}[${function(e){return window.top===window.self?`Parent page: ${e}`:window?.parentIFrame?.getId?`${window.parentIFrame.getId()}: ${e}`:`Nested parent page: ${e}`}(i)}]`,o=(e,i,...t)=>window?.console[e](n(i),...t),r=(e,...n)=>!0===(e=>i[e]?i[e].log:t)(e)?o("log",e,...n):null,a=(e,...i)=>o("warn",e,...i),s=(i,t)=>console?.warn((e=>i=>window.chrome?e(i.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(i.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))((i=>(...t)=>[`${e}[${i}]`,...t].join(" "))(i))(t)),l="5.3.3-beta.1",c="[iFrameSizer]",d=c.length,u=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),f=(e,i,t,n)=>e.addEventListener(i,t,n||!1),p=(e,i,t)=>e.removeEventListener(i,t,!1),m=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},h=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),g=["<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</>."],y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],w=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,i)=>[e,Math.max(0,i-1)]))),b=e=>h(g[e]),v=e=>{const i=e[h("spjluzl")];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=m(h(e));return t in w&&(i=w[t]),i}(t[0]);return 0===n||(e=>e[2]===m(e[0]+e[1]))(t)||(n=-2),n},z={},$=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof z[e.id].onInit&&(s(e.id,"\n[31;1mDeprecated Option[m\n\nThe [1monInit()[m function is deprecated and has been replaced with [1monReady()[m. It will be removed in a future version of iFrame Resizer.\n "),z[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),j={position:null,version:l};function k(e){function i(){E(D),M(H),L("onResized",D)}function t(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const o=e=>P.slice(P.indexOf(":")+7+e);const u=(e,i)=>(t,n)=>{const o={};var r,a;r=function(){C(`Send ${e} (${t})`,`${e}:${i()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},m=(e,i)=>()=>{let t=!1;const n=i=>()=>{z[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame((()=>{t=!1}))):l()},o=n("scroll"),a=n("resize window");function s(e,t){r(c,`${e} listeners for send${i}`),t(window,"scroll",o),t(window,"resize",a)}function l(){s("Remove ",p),d.disconnect(),u.disconnect()}const c=H,d=new ResizeObserver(n("page observed")),u=new ResizeObserver(n("iframe observed"));s("Add ",f),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(z[c].iframe,{attributes:!0,childList:!1,subtree:!1}),z[c]&&(z[c][`stop${i}`]=l)},h=e=>()=>{e in z[H]&&(z[H][e](),delete z[H][e])},g=u("pageInfo",(function(){const e=document.body.getBoundingClientRect(),i=D.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),y=u("parentInfo",(function(){const{iframe:e}=D,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),w=m(g,"PageInfo"),b=m(y,"ParentInfo"),v=h("stopPageInfo"),$=h("stopParentInfo");function k(e){const i=e.getBoundingClientRect();return S(H),{x:Number(i.left)+Number(j.position.x),y:Number(i.top)+Number(j.position.y)}}function R(e){const i=e?k(D.iframe):{x:0,y:0};r(H,`Reposition requested from iFrame (offset x:${i.x} y:${i.y})`);const t=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(D,i),n=window.parentIframe||window.parentIFrame;n?function(i,t){i["scrollTo"+(e?"Offset":"")](t.x,t.y)}(n,t):function(e){j.position=e,N(H),r(H,"---")}(t)}function N(e){const{x:i,y:t}=j.position,n=z[e]?.iframe;!1!==L("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?M(e):x()}function O(e){let i={};if(0===D.width&&0===D.height){const e=o(9).split(":");i={x:e[1],y:e[0]}}else i={x:D.width,y:D.height};L(e,{iframe:D.iframe,screenX:Number(i.x),screenY:Number(i.y),type:D.type})}const L=(e,i)=>T(H,e,i);let P=e.data,D={},H=null;"[iFrameResizerChild]Ready"!==P?c===`${P}`.slice(0,d)&&P.slice(d).split(":")[0]in z?(D=function(){const e=P.slice(d).split(":"),i=e[1]?Number(e[1]):0,o=z[e[0]]?.iframe,r=getComputedStyle(o);return{iframe:o,id:e[0],height:i+t(r)+n(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),H=D.id,H?(function(e){if(!z[e])throw new Error(`${D.type} No settings for ${e}. Message was: ${P}`)}(H),function(){const e=D.type in{true:1,false:1,undefined:1};return e&&r(H,"Ignoring init message from meta parent page"),e}()||(r(H,`Received: ${P}`),z[H].loaded=!0,(null!==D.iframe||(a(H,`The iframe (${D.id}) was not found.`),0))&&function(){const{origin:i,sameDomain:t}=e;if(t)return!0;let n=z[H]?.checkOrigin;if(n&&"null"!=`${i}`&&!(n.constructor===Array?function(){let e=0,t=!1;for(r(H,`Checking connection is from allowed list of origins: ${n}`);e<n.length;e++)if(n[e]===i){t=!0;break}return t}():function(){const e=z[H]?.remoteHost;return r(H,`Checking connection is from: ${e}`),i===e}()))throw new Error(`Unexpected message received from: ${i} for ${D.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(z[H]?.firstRun&&z[H]&&(z[H].firstRun=!1),D.type){case"close":I(D.iframe);break;case"message":t=o(6),r(H,`onMessage passed: {iframe: ${D.iframe.id}, message: ${t}}`),L("onMessage",{iframe:D.iframe,message:JSON.parse(t)}),r(H,"---");break;case"mouseenter":O("onMouseEnter");break;case"mouseleave":O("onMouseLeave");break;case"autoResize":z[H].autoResize=JSON.parse(o(9));break;case"scrollBy":!function(){const e=D.width,i=D.height,t=window.parentIframe||window;r(H,`Scroll request received by parent: x: ${e} y: ${i}`),t.scrollBy(e,i)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case"pageInfo":g("start",H),w();break;case"parentInfo":y("start",H),b();break;case"pageInfoStop":v();break;case"parentInfoStop":$();break;case"inPageLink":!function(e){const i=e.split("#")[1]||"",t=decodeURIComponent(i);let n=document.getElementById(t)||document.getElementsByName(t)[0];n?function(){const e=k(n);r(H,`Moving to in page link (#${i}) at x: ${e.x} y: ${e.y}`),j.position={x:e.x,y:e.y},N(H),window.location.hash=i,r(H,"--")}():window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(i):r(H,`In page link #${i} not found and window.parentIFrame not found`):r(H,`In page link #${i} not found`)}(o(9));break;case"title":!function(e,i){z[i]?.syncTitle&&(z[i].iframe.title=e,r(i,`Set title attribute to: ${e}`))}(D.msg,H);break;case"reset":F(D);break;case"init":i(),function(e){try{z[e].sameDomain=!!z[e]?.iframe?.contentWindow?.iframeChildListener}catch(i){z[e].sameDomain=!1}r(e,`sameDomain: ${z[e].sameDomain}`)}(H),(e=D.msg)!==l&&(void 0!==e?r(H,`Version mismatch (Child: ${e} !== Parent: ${l})`):s(H,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),A=!0,L("onReady",D.iframe);break;default:if(0===D.width&&0===D.height)return void a(H,`Unsupported message received (${D.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===D.width||0===D.height)return void r(H,"Ignoring message with 0 height or width");if(document.hidden)return void r(H,"Page hidden - ignored resize request");i()}var e,t}())):a("","iframeResizer received messageData without id, message was: ",P)):null!==H&&r(H,"Ignored:",P):Object.keys(z).forEach((e=>{z[e].mode>=0&&C("iFrame requested init",W(e),e)}))}function T(e,i,t){let n=null,o=null;if(z[e]){if(n=z[e][i],"function"!=typeof n)throw new TypeError(`${i} on iFrame[${e}] is not a function`);"onClose"===i||"onScroll"===i?o=n(t):setTimeout((()=>n(t)))}return o}function R(e){const{id:i}=e;delete z[i],r(i,"Disconnected from iframe")}function I(e){const{id:i}=e;if(!1!==T(i,"onClose",i)){r(i,`Removing iFrame: ${i}`);try{e.parentNode&&e.remove()}catch(e){a(i,e)}T(i,"onClosed",i),r(i,"---"),R(e)}else r(i,"Close iframe cancelled by onClose event")}function S(e){null===j.position&&(j.position={x:window.scrollX,y:window.scrollY},r(e,`Get page position: ${j.position.x}, ${j.position.y}`))}function x(){j.position=null}function M(e){null!==j.position&&(window.scrollTo(j.position.x,j.position.y),r(e,`Set page position: ${j.position.x}, ${j.position.y}`),x())}function F(e){r(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),S(e.id),E(e),C("reset","reset",e.id)}function E(e){function i(i){const n=`${e[i]}px`;e.iframe.style[i]=n,r(t,`IFrame (${t}) ${i} set to ${n}`)}const{id:t}=e,{sizeHeight:n,sizeWidth:o}=z[t];n&&i("height"),o&&i("width")}function C(e,i,t,n){z[t]&&(z[t]?.postMessageTarget?function(){const{iframe:n,postMessageTarget:o,sameDomain:a,targetOrigin:s}=z[t];if(a)try{return n.contentWindow.iframeChildListener(c+i),void r(t,`[${e}] Sending message to iframe[${t}] (${i}) via sameDomain`)}catch(e){r(t,"Same domain connection failed. Trying cross domain")}r(t,`[${e}] Sending message to iframe[${t}] (${i}) targetOrigin: ${s}`),o.postMessage(c+i,s)}():a(t,`[${e}] IFrame(${t}) not found`),n&&z[t]?.warningTimeout&&(z[t].msgTimeout=setTimeout((function(){if(void 0===z[t])return;const{iframe:e,loaded:i,loadErrorShown:n,waitForLoad:o}=z[t],{sandbox:r}=e;i||n||(z[t].loadErrorShown=!0,s(t,`\n<rb>No response from iFrame</>\n \nThe iframe (<i>${t}</>) has not responded within ${z[t].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}\n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values."}\n\nThis message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),z[t].warningTimeout)))}function W(e){const i=z[e];return[e,"8",i.sizeWidth,i.log,"32",!0,i.autoResize,i.bodyMargin,i.heightCalculationMethod,i.bodyBackground,i.bodyPadding,i.tolerance,i.inPageLinks,"child",i.widthCalculationMethod,i.mouseEvents,i.offsetHeight,i.offsetWidth,i.sizeHeight,i.license,j.version,i.mode].join(":")}i=z;let N=0,A=!1,O=!1;const L=e=>i=>{function n(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&s(c,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function o(e){const i=z[e]?.iframe?.title;return""===i||void 0===i}const c=function(n){if(n&&"string"!=typeof n)throw new TypeError("Invalid id for iFrame. Expected String");var o;return""!==n&&n||(n=function(){let i=e?.id||$.id+N++;return null!==document.getElementById(i)&&(i+=N++),i}(),i.id=n,o=(e||{}).log,t=o,r(n,`Added missing iframe ID: ${n} (${i.src})`)),n}(i.id);return c in z&&"iFrameResizer"in i?a(c,"Ignored iFrame, already setup."):(function(e){var t,a;z[c]={iframe:i,firstRun:!0,remoteHost:i?.src.split("/").slice(0,3).join("/"),...$,...n(e),mode:v(e),syncTitle:o(c)},function(){const{direction:e}=z[c];if("horizontal"===e)return z[c].sizeWidth=!0,z[c].sizeHeight=!1,void r(c,'Direction set to "horizontal"');if("none"===e)return z[c].sizeWidth=!1,z[c].sizeHeight=!1,z[c].autoResize=!1,void r(c,'Direction set to "none"');if("vertical"!==e)throw new TypeError(c,`Direction value of "${e}" is not valid`);r(c,'Direction set to "vertical"')}(),(t=e?.offsetSize||e?.offset)&&("vertical"===z[c].direction?(z[c].offsetHeight=t,r(c,`Offset height set to ${t}`)):(z[c].offsetWidth=t,r(c,`Offset width set to ${t}`))),e?.offset&&s(c,"<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</>."),null===z[c].postMessageTarget&&(z[c].postMessageTarget=i.contentWindow),z[c].targetOrigin=!0===z[c].checkOrigin?""===(a=z[c].remoteHost)||null!==a.match(/^(about:blank|javascript:|file:\/\/)/)?"*":a:"*"}(e),function(){const{mode:e}=z[c];e<0&&s("Parent",`${b(e+2)}${b(2)}`),O||e<0||(O=!0,(e=>{console.info(`%c[iframe-resizer] ${e}`,"font-weight: bold;")})(`v${l} (${(e=>h(y[e]))(e)})`),e<1&&s("Parent",b(3)))}(),D(),function(){switch(r(c,`IFrame scrolling ${z[c]?.scrolling?"enabled":"disabled"} for ${c}`),i.style.overflow=!1===z[c]?.scrolling?"hidden":"auto",z[c]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=z[c]?z[c].scrolling:"no"}}(),function(){const{bodyMargin:e}=z[c];"number"!=typeof e&&"0"!==e||(z[c].bodyMargin=`${e}px`)}(),function(e){const{id:t}=i,{mode:n,waitForLoad:o}=z[t];-1!==n&&-2!==n&&(f(i,"load",(function(){C("iFrame.onload",`${e}:${A}`,t,!0),function(){const e=z[c]?.firstRun,t=z[c]?.heightCalculationMethod in u;!e&&t&&F({iframe:i,height:0,width:0,type:"init"})}()})),!1===o&&C("init",`${e}:${A}`,t,!0))}(W(c)),function(){if(z[c]){const{iframe:e}=z[c],i={close:I.bind(null,e),disconnect:R.bind(null,e),removeListeners(){s(c,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:C.bind(null,"Window resize","resize",c),moveToAnchor(e){C("Move to anchor",`moveToAnchor:${e}`,c)},sendMessage(e){C("Send Message",`message:${e=JSON.stringify(e)}`,c)}};e.iframeResizer=i,e.iFrameResizer=i}}()),i?.iFrameResizer};function P(){!1===document.hidden&&(r("document","Trigger event: Visibility change"),function(e,i){const t=e=>z[e]?.autoResize&&!z[e]?.firstRun;Object.keys(z).forEach((function(n){t(n)&&C(e,i,n)}))}("Tab Visible","resize"))}const D=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})((()=>{f(window,"message",k),f(document,"visibilitychange",P),window.iframeParentListener=e=>setTimeout((()=>k({data:e,sameDomain:!0})))})),H="[iframeResizer] ";const B=function(){function e(e){switch(!0){case!e:throw new TypeError(`${H}iframe is not defined`);case!e.tagName:throw new TypeError(`${H}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${H}Expected <IFRAME> tag, found <${e.tagName}>`);default:i(e),t.push(e)}}let i,t;return function(n,o){if("undefined"==typeof window)return[];switch(i=L(n),t=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${H}Unexpected data type (${typeof o})`)}return Object.freeze(t)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){s("","Deprecated: iFrameResize(), please use iframeResize()"),B(...e)}),B})); | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=i()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="[iframe-resizer]";let i={},t=!1;const n=i=>`${e}[${function(e){return window.top===window.self?`Parent page: ${e}`:window?.parentIFrame?.getId?`${window.parentIFrame.getId()}: ${e}`:`Nested parent page: ${e}`}(i)}]`,o=(e,i,...t)=>window?.console[e](n(i),...t),r=(e,...n)=>!0===(e=>i[e]?i[e].log:t)(e)?o("log",e,...n):null,a=(e,...i)=>o("warn",e,...i),s=(i,t)=>console?.warn((e=>i=>window.chrome?e(i.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(i.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))((i=>(...t)=>[`${e}[${i}]`,...t].join(" "))(i))(t)),l="5.3.3-beta.2",c="[iFrameSizer]",d=c.length,u=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),f=(e,i,t,n)=>e.addEventListener(i,t,n||!1),p=(e,i,t)=>e.removeEventListener(i,t,!1),m=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},h=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),g=["<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</>."],y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],w=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,i)=>[e,Math.max(0,i-1)]))),b=e=>h(g[e]),v=e=>{const i=e[h("spjluzl")];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=m(h(e));return t in w&&(i=w[t]),i}(t[0]);return 0===n||(e=>e[2]===m(e[0]+e[1]))(t)||(n=-2),n},z={},$=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof z[e.id].onInit&&(s(e.id,"\n[31;1mDeprecated Option[m\n\nThe [1monInit()[m function is deprecated and has been replaced with [1monReady()[m. It will be removed in a future version of iFrame Resizer.\n "),z[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),j={position:null,version:l};function k(e){function i(){E(D),M(H),L("onResized",D)}function t(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const o=e=>P.slice(P.indexOf(":")+7+e);const u=(e,i)=>(t,n)=>{const o={};var r,a;r=function(){C(`Send ${e} (${t})`,`${e}:${i()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},m=(e,i)=>()=>{let t=!1;const n=i=>()=>{z[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame((()=>{t=!1}))):l()},o=n("scroll"),a=n("resize window");function s(e,t){r(c,`${e} listeners for send${i}`),t(window,"scroll",o),t(window,"resize",a)}function l(){s("Remove ",p),d.disconnect(),u.disconnect()}const c=H,d=new ResizeObserver(n("page observed")),u=new ResizeObserver(n("iframe observed"));s("Add ",f),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(z[c].iframe,{attributes:!0,childList:!1,subtree:!1}),z[c]&&(z[c][`stop${i}`]=l)},h=e=>()=>{e in z[H]&&(z[H][e](),delete z[H][e])},g=u("pageInfo",(function(){const e=document.body.getBoundingClientRect(),i=D.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),y=u("parentInfo",(function(){const{iframe:e}=D,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),w=m(g,"PageInfo"),b=m(y,"ParentInfo"),v=h("stopPageInfo"),$=h("stopParentInfo");function k(e){const i=e.getBoundingClientRect();return S(H),{x:Number(i.left)+Number(j.position.x),y:Number(i.top)+Number(j.position.y)}}function R(e){const i=e?k(D.iframe):{x:0,y:0};r(H,`Reposition requested from iFrame (offset x:${i.x} y:${i.y})`);const t=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(D,i),n=window.parentIframe||window.parentIFrame;n?function(i,t){i["scrollTo"+(e?"Offset":"")](t.x,t.y)}(n,t):function(e){j.position=e,N(H),r(H,"---")}(t)}function N(e){const{x:i,y:t}=j.position,n=z[e]?.iframe;!1!==L("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?M(e):x()}function O(e){let i={};if(0===D.width&&0===D.height){const e=o(9).split(":");i={x:e[1],y:e[0]}}else i={x:D.width,y:D.height};L(e,{iframe:D.iframe,screenX:Number(i.x),screenY:Number(i.y),type:D.type})}const L=(e,i)=>T(H,e,i);let P=e.data,D={},H=null;"[iFrameResizerChild]Ready"!==P?c===`${P}`.slice(0,d)&&P.slice(d).split(":")[0]in z?(D=function(){const e=P.slice(d).split(":"),i=e[1]?Number(e[1]):0,o=z[e[0]]?.iframe,r=getComputedStyle(o);return{iframe:o,id:e[0],height:i+t(r)+n(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),H=D.id,H?(function(e){if(!z[e])throw new Error(`${D.type} No settings for ${e}. Message was: ${P}`)}(H),function(){const e=D.type in{true:1,false:1,undefined:1};return e&&r(H,"Ignoring init message from meta parent page"),e}()||(r(H,`Received: ${P}`),z[H].loaded=!0,(null!==D.iframe||(a(H,`The iframe (${D.id}) was not found.`),0))&&function(){const{origin:i,sameDomain:t}=e;if(t)return!0;let n=z[H]?.checkOrigin;if(n&&"null"!=`${i}`&&!(n.constructor===Array?function(){let e=0,t=!1;for(r(H,`Checking connection is from allowed list of origins: ${n}`);e<n.length;e++)if(n[e]===i){t=!0;break}return t}():function(){const e=z[H]?.remoteHost;return r(H,`Checking connection is from: ${e}`),i===e}()))throw new Error(`Unexpected message received from: ${i} for ${D.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(z[H]?.firstRun&&z[H]&&(z[H].firstRun=!1),D.type){case"close":I(D.iframe);break;case"message":t=o(6),r(H,`onMessage passed: {iframe: ${D.iframe.id}, message: ${t}}`),L("onMessage",{iframe:D.iframe,message:JSON.parse(t)}),r(H,"---");break;case"mouseenter":O("onMouseEnter");break;case"mouseleave":O("onMouseLeave");break;case"autoResize":z[H].autoResize=JSON.parse(o(9));break;case"scrollBy":!function(){const e=D.width,i=D.height,t=window.parentIframe||window;r(H,`Scroll request received by parent: x: ${e} y: ${i}`),t.scrollBy(e,i)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case"pageInfo":g("start",H),w();break;case"parentInfo":y("start",H),b();break;case"pageInfoStop":v();break;case"parentInfoStop":$();break;case"inPageLink":!function(e){const i=e.split("#")[1]||"",t=decodeURIComponent(i);let n=document.getElementById(t)||document.getElementsByName(t)[0];n?function(){const e=k(n);r(H,`Moving to in page link (#${i}) at x: ${e.x} y: ${e.y}`),j.position={x:e.x,y:e.y},N(H),window.location.hash=i,r(H,"--")}():window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(i):r(H,`In page link #${i} not found and window.parentIFrame not found`):r(H,`In page link #${i} not found`)}(o(9));break;case"title":!function(e,i){z[i]?.syncTitle&&(z[i].iframe.title=e,r(i,`Set title attribute to: ${e}`))}(D.msg,H);break;case"reset":F(D);break;case"init":i(),function(e){try{z[e].sameDomain=!!z[e]?.iframe?.contentWindow?.iframeChildListener}catch(i){z[e].sameDomain=!1}r(e,`sameDomain: ${z[e].sameDomain}`)}(H),(e=D.msg)!==l&&(void 0!==e?r(H,`Version mismatch (Child: ${e} !== Parent: ${l})`):s(H,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),A=!0,L("onReady",D.iframe);break;default:if(0===D.width&&0===D.height)return void a(H,`Unsupported message received (${D.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===D.width||0===D.height)return void r(H,"Ignoring message with 0 height or width");if(document.hidden)return void r(H,"Page hidden - ignored resize request");i()}var e,t}())):a("","iframeResizer received messageData without id, message was: ",P)):null!==H&&r(H,"Ignored:",P):Object.keys(z).forEach((e=>{z[e].mode>=0&&C("iFrame requested init",W(e),e)}))}function T(e,i,t){let n=null,o=null;if(z[e]){if(n=z[e][i],"function"!=typeof n)throw new TypeError(`${i} on iFrame[${e}] is not a function`);"onClose"===i||"onScroll"===i?o=n(t):setTimeout((()=>n(t)))}return o}function R(e){const{id:i}=e;delete z[i],r(i,"Disconnected from iframe")}function I(e){const{id:i}=e;if(!1!==T(i,"onClose",i)){r(i,`Removing iFrame: ${i}`);try{e.parentNode&&e.remove()}catch(e){a(i,e)}T(i,"onClosed",i),r(i,"---"),R(e)}else r(i,"Close iframe cancelled by onClose event")}function S(e){null===j.position&&(j.position={x:window.scrollX,y:window.scrollY},r(e,`Get page position: ${j.position.x}, ${j.position.y}`))}function x(){j.position=null}function M(e){null!==j.position&&(window.scrollTo(j.position.x,j.position.y),r(e,`Set page position: ${j.position.x}, ${j.position.y}`),x())}function F(e){r(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),S(e.id),E(e),C("reset","reset",e.id)}function E(e){function i(i){const n=`${e[i]}px`;e.iframe.style[i]=n,r(t,`IFrame (${t}) ${i} set to ${n}`)}const{id:t}=e,{sizeHeight:n,sizeWidth:o}=z[t];n&&i("height"),o&&i("width")}function C(e,i,t,n){z[t]&&(z[t]?.postMessageTarget?function(){const{iframe:n,postMessageTarget:o,sameDomain:a,targetOrigin:s}=z[t];if(a)try{return n.contentWindow.iframeChildListener(c+i),void r(t,`[${e}] Sending message to iframe[${t}] (${i}) via sameDomain`)}catch(e){r(t,"Same domain connection failed. Trying cross domain")}r(t,`[${e}] Sending message to iframe[${t}] (${i}) targetOrigin: ${s}`),o.postMessage(c+i,s)}():a(t,`[${e}] IFrame(${t}) not found`),n&&z[t]?.warningTimeout&&(z[t].msgTimeout=setTimeout((function(){if(void 0===z[t])return;const{iframe:e,loaded:i,loadErrorShown:n,waitForLoad:o}=z[t],{sandbox:r}=e;i||n||(z[t].loadErrorShown=!0,s(t,`\n<rb>No response from iFrame</>\n \nThe iframe (<i>${t}</>) has not responded within ${z[t].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}\n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values."}\n\nThis message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),z[t].warningTimeout)))}function W(e){const i=z[e];return[e,"8",i.sizeWidth,i.log,"32",!0,i.autoResize,i.bodyMargin,i.heightCalculationMethod,i.bodyBackground,i.bodyPadding,i.tolerance,i.inPageLinks,"child",i.widthCalculationMethod,i.mouseEvents,i.offsetHeight,i.offsetWidth,i.sizeHeight,i.license,j.version,i.mode].join(":")}i=z;let N=0,A=!1,O=!1;const L=e=>i=>{function n(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&s(c,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function o(e){const i=z[e]?.iframe?.title;return""===i||void 0===i}const c=function(n){if(n&&"string"!=typeof n)throw new TypeError("Invalid id for iFrame. Expected String");var o;return""!==n&&n||(n=function(){let i=e?.id||$.id+N++;return null!==document.getElementById(i)&&(i+=N++),i}(),i.id=n,o=(e||{}).log,t=o,r(n,`Added missing iframe ID: ${n} (${i.src})`)),n}(i.id);return c in z&&"iFrameResizer"in i?a(c,"Ignored iFrame, already setup."):(function(e){var t,a;z[c]={iframe:i,firstRun:!0,remoteHost:i?.src.split("/").slice(0,3).join("/"),...$,...n(e),mode:v(e),syncTitle:o(c)},function(){const{direction:e}=z[c];if("horizontal"===e)return z[c].sizeWidth=!0,z[c].sizeHeight=!1,void r(c,'Direction set to "horizontal"');if("none"===e)return z[c].sizeWidth=!1,z[c].sizeHeight=!1,z[c].autoResize=!1,void r(c,'Direction set to "none"');if("vertical"!==e)throw new TypeError(c,`Direction value of "${e}" is not valid`);r(c,'Direction set to "vertical"')}(),(t=e?.offsetSize||e?.offset)&&("vertical"===z[c].direction?(z[c].offsetHeight=t,r(c,`Offset height set to ${t}`)):(z[c].offsetWidth=t,r(c,`Offset width set to ${t}`))),e?.offset&&s(c,"<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</>."),null===z[c].postMessageTarget&&(z[c].postMessageTarget=i.contentWindow),z[c].targetOrigin=!0===z[c].checkOrigin?""===(a=z[c].remoteHost)||null!==a.match(/^(about:blank|javascript:|file:\/\/)/)?"*":a:"*"}(e),function(){const{mode:e}=z[c];e<0&&s("Parent",`${b(e+2)}${b(2)}`),O||e<0||(O=!0,(e=>{console.info(`%c[iframe-resizer] ${e}`,"font-weight: bold;")})(`v${l} (${(e=>h(y[e]))(e)})`),e<1&&s("Parent",b(3)))}(),D(),function(){switch(r(c,`IFrame scrolling ${z[c]?.scrolling?"enabled":"disabled"} for ${c}`),i.style.overflow=!1===z[c]?.scrolling?"hidden":"auto",z[c]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=z[c]?z[c].scrolling:"no"}}(),function(){const{bodyMargin:e}=z[c];"number"!=typeof e&&"0"!==e||(z[c].bodyMargin=`${e}px`)}(),function(e){const{id:t}=i,{mode:n,waitForLoad:o}=z[t];-1!==n&&-2!==n&&(f(i,"load",(function(){C("iFrame.onload",`${e}:${A}`,t,!0),function(){const e=z[c]?.firstRun,t=z[c]?.heightCalculationMethod in u;!e&&t&&F({iframe:i,height:0,width:0,type:"init"})}()})),!1===o&&C("init",`${e}:${A}`,t,!0))}(W(c)),function(){if(z[c]){const{iframe:e}=z[c],i={close:I.bind(null,e),disconnect:R.bind(null,e),removeListeners(){s(c,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:C.bind(null,"Window resize","resize",c),moveToAnchor(e){C("Move to anchor",`moveToAnchor:${e}`,c)},sendMessage(e){C("Send Message",`message:${e=JSON.stringify(e)}`,c)}};e.iframeResizer=i,e.iFrameResizer=i}}()),i?.iFrameResizer};function P(){!1===document.hidden&&(r("document","Trigger event: Visibility change"),function(e,i){const t=e=>z[e]?.autoResize&&!z[e]?.firstRun;Object.keys(z).forEach((function(n){t(n)&&C(e,i,n)}))}("Tab Visible","resize"))}const D=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})((()=>{f(window,"message",k),f(document,"visibilitychange",P),window.iframeParentListener=e=>setTimeout((()=>k({data:e,sameDomain:!0})))})),H="[iframeResizer] ";const B=function(){function e(e){switch(!0){case!e:throw new TypeError(`${H}iframe is not defined`);case!e.tagName:throw new TypeError(`${H}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${H}Expected <IFRAME> tag, found <${e.tagName}>`);default:i(e),t.push(e)}}let i,t;return function(n,o){if("undefined"==typeof window)return[];switch(i=L(n),t=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${H}Unexpected data type (${typeof o})`)}return Object.freeze(t)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){s("","Deprecated: iFrameResize(), please use iframeResize()"),B(...e)}),B})); | ||
//# sourceMappingURL=iframeResizer.js.map |
/*! | ||
* @preserve | ||
* | ||
* @module iframe-resizer/legacy (parent) 5.3.3-beta.1 (umd) - 2024-10-23 | ||
* @module iframe-resizer/legacy (parent) 5.3.3-beta.2 (umd) - 2025-02-02 | ||
* | ||
@@ -16,7 +16,7 @@ * @license GPL-3.0 for non-commercial use only. | ||
* | ||
* @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved. | ||
* @copyright (c) 2013 - 2025, David J. Bradshaw. All rights reserved. | ||
*/ | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=i()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="[iframe-resizer]";let i={},t=!1;const n=i=>`${e}[${function(e){return window.top===window.self?`Parent page: ${e}`:window?.parentIFrame?.getId?`${window.parentIFrame.getId()}: ${e}`:`Nested parent page: ${e}`}(i)}]`,o=(e,i,...t)=>window?.console[e](n(i),...t),r=(e,...n)=>!0===(e=>i[e]?i[e].log:t)(e)?o("log",e,...n):null,a=(e,...i)=>o("warn",e,...i),s=(i,t)=>console?.warn((e=>i=>window.chrome?e(i.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(i.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))((i=>(...t)=>[`${e}[${i}]`,...t].join(" "))(i))(t)),l="5.3.3-beta.1",c="[iFrameSizer]",d=c.length,u=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),f=(e,i,t,n)=>e.addEventListener(i,t,n||!1),p=(e,i,t)=>e.removeEventListener(i,t,!1),m=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},h=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),g=["<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</>."],y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],w=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,i)=>[e,Math.max(0,i-1)]))),b=e=>h(g[e]),v=e=>{const i=e[h("spjluzl")];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=m(h(e));return t in w&&(i=w[t]),i}(t[0]);return 0===n||(e=>e[2]===m(e[0]+e[1]))(t)||(n=-2),n},z={},$=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof z[e.id].onInit&&(s(e.id,"\n[31;1mDeprecated Option[m\n\nThe [1monInit()[m function is deprecated and has been replaced with [1monReady()[m. It will be removed in a future version of iFrame Resizer.\n "),z[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),j={position:null,version:l};function k(e){function i(){E(D),M(H),L("onResized",D)}function t(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const o=e=>P.slice(P.indexOf(":")+7+e);const u=(e,i)=>(t,n)=>{const o={};var r,a;r=function(){C(`Send ${e} (${t})`,`${e}:${i()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},m=(e,i)=>()=>{let t=!1;const n=i=>()=>{z[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame((()=>{t=!1}))):l()},o=n("scroll"),a=n("resize window");function s(e,t){r(c,`${e} listeners for send${i}`),t(window,"scroll",o),t(window,"resize",a)}function l(){s("Remove ",p),d.disconnect(),u.disconnect()}const c=H,d=new ResizeObserver(n("page observed")),u=new ResizeObserver(n("iframe observed"));s("Add ",f),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(z[c].iframe,{attributes:!0,childList:!1,subtree:!1}),z[c]&&(z[c][`stop${i}`]=l)},h=e=>()=>{e in z[H]&&(z[H][e](),delete z[H][e])},g=u("pageInfo",(function(){const e=document.body.getBoundingClientRect(),i=D.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),y=u("parentInfo",(function(){const{iframe:e}=D,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),w=m(g,"PageInfo"),b=m(y,"ParentInfo"),v=h("stopPageInfo"),$=h("stopParentInfo");function k(e){const i=e.getBoundingClientRect();return S(H),{x:Number(i.left)+Number(j.position.x),y:Number(i.top)+Number(j.position.y)}}function R(e){const i=e?k(D.iframe):{x:0,y:0};r(H,`Reposition requested from iFrame (offset x:${i.x} y:${i.y})`);const t=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(D,i),n=window.parentIframe||window.parentIFrame;n?function(i,t){i["scrollTo"+(e?"Offset":"")](t.x,t.y)}(n,t):function(e){j.position=e,N(H),r(H,"---")}(t)}function N(e){const{x:i,y:t}=j.position,n=z[e]?.iframe;!1!==L("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?M(e):x()}function O(e){let i={};if(0===D.width&&0===D.height){const e=o(9).split(":");i={x:e[1],y:e[0]}}else i={x:D.width,y:D.height};L(e,{iframe:D.iframe,screenX:Number(i.x),screenY:Number(i.y),type:D.type})}const L=(e,i)=>T(H,e,i);let P=e.data,D={},H=null;"[iFrameResizerChild]Ready"!==P?c===`${P}`.slice(0,d)&&P.slice(d).split(":")[0]in z?(D=function(){const e=P.slice(d).split(":"),i=e[1]?Number(e[1]):0,o=z[e[0]]?.iframe,r=getComputedStyle(o);return{iframe:o,id:e[0],height:i+t(r)+n(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),H=D.id,H?(function(e){if(!z[e])throw new Error(`${D.type} No settings for ${e}. Message was: ${P}`)}(H),function(){const e=D.type in{true:1,false:1,undefined:1};return e&&r(H,"Ignoring init message from meta parent page"),e}()||(r(H,`Received: ${P}`),z[H].loaded=!0,(null!==D.iframe||(a(H,`The iframe (${D.id}) was not found.`),0))&&function(){const{origin:i,sameDomain:t}=e;if(t)return!0;let n=z[H]?.checkOrigin;if(n&&"null"!=`${i}`&&!(n.constructor===Array?function(){let e=0,t=!1;for(r(H,`Checking connection is from allowed list of origins: ${n}`);e<n.length;e++)if(n[e]===i){t=!0;break}return t}():function(){const e=z[H]?.remoteHost;return r(H,`Checking connection is from: ${e}`),i===e}()))throw new Error(`Unexpected message received from: ${i} for ${D.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(z[H]?.firstRun&&z[H]&&(z[H].firstRun=!1),D.type){case"close":I(D.iframe);break;case"message":t=o(6),r(H,`onMessage passed: {iframe: ${D.iframe.id}, message: ${t}}`),L("onMessage",{iframe:D.iframe,message:JSON.parse(t)}),r(H,"---");break;case"mouseenter":O("onMouseEnter");break;case"mouseleave":O("onMouseLeave");break;case"autoResize":z[H].autoResize=JSON.parse(o(9));break;case"scrollBy":!function(){const e=D.width,i=D.height,t=window.parentIframe||window;r(H,`Scroll request received by parent: x: ${e} y: ${i}`),t.scrollBy(e,i)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case"pageInfo":g("start",H),w();break;case"parentInfo":y("start",H),b();break;case"pageInfoStop":v();break;case"parentInfoStop":$();break;case"inPageLink":!function(e){const i=e.split("#")[1]||"",t=decodeURIComponent(i);let n=document.getElementById(t)||document.getElementsByName(t)[0];n?function(){const e=k(n);r(H,`Moving to in page link (#${i}) at x: ${e.x} y: ${e.y}`),j.position={x:e.x,y:e.y},N(H),window.location.hash=i,r(H,"--")}():window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(i):r(H,`In page link #${i} not found and window.parentIFrame not found`):r(H,`In page link #${i} not found`)}(o(9));break;case"title":!function(e,i){z[i]?.syncTitle&&(z[i].iframe.title=e,r(i,`Set title attribute to: ${e}`))}(D.msg,H);break;case"reset":F(D);break;case"init":i(),function(e){try{z[e].sameDomain=!!z[e]?.iframe?.contentWindow?.iframeChildListener}catch(i){z[e].sameDomain=!1}r(e,`sameDomain: ${z[e].sameDomain}`)}(H),(e=D.msg)!==l&&(void 0!==e?r(H,`Version mismatch (Child: ${e} !== Parent: ${l})`):s(H,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),A=!0,L("onReady",D.iframe);break;default:if(0===D.width&&0===D.height)return void a(H,`Unsupported message received (${D.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===D.width||0===D.height)return void r(H,"Ignoring message with 0 height or width");if(document.hidden)return void r(H,"Page hidden - ignored resize request");i()}var e,t}())):a("","iframeResizer received messageData without id, message was: ",P)):null!==H&&r(H,"Ignored:",P):Object.keys(z).forEach((e=>{z[e].mode>=0&&C("iFrame requested init",W(e),e)}))}function T(e,i,t){let n=null,o=null;if(z[e]){if(n=z[e][i],"function"!=typeof n)throw new TypeError(`${i} on iFrame[${e}] is not a function`);"onClose"===i||"onScroll"===i?o=n(t):setTimeout((()=>n(t)))}return o}function R(e){const{id:i}=e;delete z[i],r(i,"Disconnected from iframe")}function I(e){const{id:i}=e;if(!1!==T(i,"onClose",i)){r(i,`Removing iFrame: ${i}`);try{e.parentNode&&e.remove()}catch(e){a(i,e)}T(i,"onClosed",i),r(i,"---"),R(e)}else r(i,"Close iframe cancelled by onClose event")}function S(e){null===j.position&&(j.position={x:window.scrollX,y:window.scrollY},r(e,`Get page position: ${j.position.x}, ${j.position.y}`))}function x(){j.position=null}function M(e){null!==j.position&&(window.scrollTo(j.position.x,j.position.y),r(e,`Set page position: ${j.position.x}, ${j.position.y}`),x())}function F(e){r(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),S(e.id),E(e),C("reset","reset",e.id)}function E(e){function i(i){const n=`${e[i]}px`;e.iframe.style[i]=n,r(t,`IFrame (${t}) ${i} set to ${n}`)}const{id:t}=e,{sizeHeight:n,sizeWidth:o}=z[t];n&&i("height"),o&&i("width")}function C(e,i,t,n){z[t]&&(z[t]?.postMessageTarget?function(){const{iframe:n,postMessageTarget:o,sameDomain:a,targetOrigin:s}=z[t];if(a)try{return n.contentWindow.iframeChildListener(c+i),void r(t,`[${e}] Sending message to iframe[${t}] (${i}) via sameDomain`)}catch(e){r(t,"Same domain connection failed. Trying cross domain")}r(t,`[${e}] Sending message to iframe[${t}] (${i}) targetOrigin: ${s}`),o.postMessage(c+i,s)}():a(t,`[${e}] IFrame(${t}) not found`),n&&z[t]?.warningTimeout&&(z[t].msgTimeout=setTimeout((function(){if(void 0===z[t])return;const{iframe:e,loaded:i,loadErrorShown:n,waitForLoad:o}=z[t],{sandbox:r}=e;i||n||(z[t].loadErrorShown=!0,s(t,`\n<rb>No response from iFrame</>\n \nThe iframe (<i>${t}</>) has not responded within ${z[t].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}\n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values."}\n\nThis message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),z[t].warningTimeout)))}function W(e){const i=z[e];return[e,"8",i.sizeWidth,i.log,"32",!0,i.autoResize,i.bodyMargin,i.heightCalculationMethod,i.bodyBackground,i.bodyPadding,i.tolerance,i.inPageLinks,"child",i.widthCalculationMethod,i.mouseEvents,i.offsetHeight,i.offsetWidth,i.sizeHeight,i.license,j.version,i.mode].join(":")}i=z;let N=0,A=!1,O=!1;const L=e=>i=>{function n(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&s(c,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function o(e){const i=z[e]?.iframe?.title;return""===i||void 0===i}const c=function(n){if(n&&"string"!=typeof n)throw new TypeError("Invalid id for iFrame. Expected String");var o;return""!==n&&n||(n=function(){let i=e?.id||$.id+N++;return null!==document.getElementById(i)&&(i+=N++),i}(),i.id=n,o=(e||{}).log,t=o,r(n,`Added missing iframe ID: ${n} (${i.src})`)),n}(i.id);return c in z&&"iFrameResizer"in i?a(c,"Ignored iFrame, already setup."):(function(e){var t,a;z[c]={iframe:i,firstRun:!0,remoteHost:i?.src.split("/").slice(0,3).join("/"),...$,...n(e),mode:v(e),syncTitle:o(c)},function(){const{direction:e}=z[c];if("horizontal"===e)return z[c].sizeWidth=!0,z[c].sizeHeight=!1,void r(c,'Direction set to "horizontal"');if("none"===e)return z[c].sizeWidth=!1,z[c].sizeHeight=!1,z[c].autoResize=!1,void r(c,'Direction set to "none"');if("vertical"!==e)throw new TypeError(c,`Direction value of "${e}" is not valid`);r(c,'Direction set to "vertical"')}(),(t=e?.offsetSize||e?.offset)&&("vertical"===z[c].direction?(z[c].offsetHeight=t,r(c,`Offset height set to ${t}`)):(z[c].offsetWidth=t,r(c,`Offset width set to ${t}`))),e?.offset&&s(c,"<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</>."),null===z[c].postMessageTarget&&(z[c].postMessageTarget=i.contentWindow),z[c].targetOrigin=!0===z[c].checkOrigin?""===(a=z[c].remoteHost)||null!==a.match(/^(about:blank|javascript:|file:\/\/)/)?"*":a:"*"}(e),function(){const{mode:e}=z[c];e<0&&s("Parent",`${b(e+2)}${b(2)}`),O||e<0||(O=!0,(e=>{console.info(`%c[iframe-resizer] ${e}`,"font-weight: bold;")})(`v${l} (${(e=>h(y[e]))(e)})`),e<1&&s("Parent",b(3)))}(),D(),function(){switch(r(c,`IFrame scrolling ${z[c]?.scrolling?"enabled":"disabled"} for ${c}`),i.style.overflow=!1===z[c]?.scrolling?"hidden":"auto",z[c]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=z[c]?z[c].scrolling:"no"}}(),function(){const{bodyMargin:e}=z[c];"number"!=typeof e&&"0"!==e||(z[c].bodyMargin=`${e}px`)}(),function(e){const{id:t}=i,{mode:n,waitForLoad:o}=z[t];-1!==n&&-2!==n&&(f(i,"load",(function(){C("iFrame.onload",`${e}:${A}`,t,!0),function(){const e=z[c]?.firstRun,t=z[c]?.heightCalculationMethod in u;!e&&t&&F({iframe:i,height:0,width:0,type:"init"})}()})),!1===o&&C("init",`${e}:${A}`,t,!0))}(W(c)),function(){if(z[c]){const{iframe:e}=z[c],i={close:I.bind(null,e),disconnect:R.bind(null,e),removeListeners(){s(c,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:C.bind(null,"Window resize","resize",c),moveToAnchor(e){C("Move to anchor",`moveToAnchor:${e}`,c)},sendMessage(e){C("Send Message",`message:${e=JSON.stringify(e)}`,c)}};e.iframeResizer=i,e.iFrameResizer=i}}()),i?.iFrameResizer};function P(){!1===document.hidden&&(r("document","Trigger event: Visibility change"),function(e,i){const t=e=>z[e]?.autoResize&&!z[e]?.firstRun;Object.keys(z).forEach((function(n){t(n)&&C(e,i,n)}))}("Tab Visible","resize"))}const D=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})((()=>{f(window,"message",k),f(document,"visibilitychange",P),window.iframeParentListener=e=>setTimeout((()=>k({data:e,sameDomain:!0})))})),H="[iframeResizer] ";const B=function(){function e(e){switch(!0){case!e:throw new TypeError(`${H}iframe is not defined`);case!e.tagName:throw new TypeError(`${H}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${H}Expected <IFRAME> tag, found <${e.tagName}>`);default:i(e),t.push(e)}}let i,t;return function(n,o){if("undefined"==typeof window)return[];switch(i=L(n),t=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${H}Unexpected data type (${typeof o})`)}return Object.freeze(t)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){s("","Deprecated: iFrameResize(), please use iframeResize()"),B(...e)}),B})); | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=i()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="[iframe-resizer]";let i={},t=!1;const n=i=>`${e}[${function(e){return window.top===window.self?`Parent page: ${e}`:window?.parentIFrame?.getId?`${window.parentIFrame.getId()}: ${e}`:`Nested parent page: ${e}`}(i)}]`,o=(e,i,...t)=>window?.console[e](n(i),...t),r=(e,...n)=>!0===(e=>i[e]?i[e].log:t)(e)?o("log",e,...n):null,a=(e,...i)=>o("warn",e,...i),s=(i,t)=>console?.warn((e=>i=>window.chrome?e(i.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(i.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))((i=>(...t)=>[`${e}[${i}]`,...t].join(" "))(i))(t)),l="5.3.3-beta.2",c="[iFrameSizer]",d=c.length,u=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),f=(e,i,t,n)=>e.addEventListener(i,t,n||!1),p=(e,i,t)=>e.removeEventListener(i,t,!1),m=e=>{if(!e)return"";let i=-559038744,t=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),i=Math.imul(i^n,2246822519),t=Math.imul(t^n,3266489917);return i^=Math.imul(i^t>>>15,1935289751),t^=Math.imul(t^i>>>15,3405138345),i^=t>>>16,t^=i>>>16,(2097152*(t>>>0)+(i>>>11)).toString(36)},h=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),g=["<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</>."],y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],w=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,i)=>[e,Math.max(0,i-1)]))),b=e=>h(g[e]),v=e=>{const i=e[h("spjluzl")];if(!i)return-1;const t=i.split("-");let n=function(e=""){let i=-2;const t=m(h(e));return t in w&&(i=w[t]),i}(t[0]);return 0===n||(e=>e[2]===m(e[0]+e[1]))(t)||(n=-2),n},z={},$=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof z[e.id].onInit&&(s(e.id,"\n[31;1mDeprecated Option[m\n\nThe [1monInit()[m function is deprecated and has been replaced with [1monReady()[m. It will be removed in a future version of iFrame Resizer.\n "),z[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),j={position:null,version:l};function k(e){function i(){E(D),M(H),L("onResized",D)}function t(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const o=e=>P.slice(P.indexOf(":")+7+e);const u=(e,i)=>(t,n)=>{const o={};var r,a;r=function(){C(`Send ${e} (${t})`,`${e}:${i()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},m=(e,i)=>()=>{let t=!1;const n=i=>()=>{z[c]?t&&t!==i||(e(i,c),t=i,requestAnimationFrame((()=>{t=!1}))):l()},o=n("scroll"),a=n("resize window");function s(e,t){r(c,`${e} listeners for send${i}`),t(window,"scroll",o),t(window,"resize",a)}function l(){s("Remove ",p),d.disconnect(),u.disconnect()}const c=H,d=new ResizeObserver(n("page observed")),u=new ResizeObserver(n("iframe observed"));s("Add ",f),d.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(z[c].iframe,{attributes:!0,childList:!1,subtree:!1}),z[c]&&(z[c][`stop${i}`]=l)},h=e=>()=>{e in z[H]&&(z[H][e](),delete z[H][e])},g=u("pageInfo",(function(){const e=document.body.getBoundingClientRect(),i=D.iframe.getBoundingClientRect(),{scrollY:t,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(i.top-e.top,10),offsetLeft:parseInt(i.left-e.left,10),scrollTop:t,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),y=u("parentInfo",(function(){const{iframe:e}=D,{scrollWidth:i,scrollHeight:t}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:i,scrollHeight:t},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),w=m(g,"PageInfo"),b=m(y,"ParentInfo"),v=h("stopPageInfo"),$=h("stopParentInfo");function k(e){const i=e.getBoundingClientRect();return S(H),{x:Number(i.left)+Number(j.position.x),y:Number(i.top)+Number(j.position.y)}}function R(e){const i=e?k(D.iframe):{x:0,y:0};r(H,`Reposition requested from iFrame (offset x:${i.x} y:${i.y})`);const t=((e,i)=>({x:e.width+i.x,y:e.height+i.y}))(D,i),n=window.parentIframe||window.parentIFrame;n?function(i,t){i["scrollTo"+(e?"Offset":"")](t.x,t.y)}(n,t):function(e){j.position=e,N(H),r(H,"---")}(t)}function N(e){const{x:i,y:t}=j.position,n=z[e]?.iframe;!1!==L("onScroll",{iframe:n,top:t,left:i,x:i,y:t})?M(e):x()}function O(e){let i={};if(0===D.width&&0===D.height){const e=o(9).split(":");i={x:e[1],y:e[0]}}else i={x:D.width,y:D.height};L(e,{iframe:D.iframe,screenX:Number(i.x),screenY:Number(i.y),type:D.type})}const L=(e,i)=>T(H,e,i);let P=e.data,D={},H=null;"[iFrameResizerChild]Ready"!==P?c===`${P}`.slice(0,d)&&P.slice(d).split(":")[0]in z?(D=function(){const e=P.slice(d).split(":"),i=e[1]?Number(e[1]):0,o=z[e[0]]?.iframe,r=getComputedStyle(o);return{iframe:o,id:e[0],height:i+t(r)+n(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),H=D.id,H?(function(e){if(!z[e])throw new Error(`${D.type} No settings for ${e}. Message was: ${P}`)}(H),function(){const e=D.type in{true:1,false:1,undefined:1};return e&&r(H,"Ignoring init message from meta parent page"),e}()||(r(H,`Received: ${P}`),z[H].loaded=!0,(null!==D.iframe||(a(H,`The iframe (${D.id}) was not found.`),0))&&function(){const{origin:i,sameDomain:t}=e;if(t)return!0;let n=z[H]?.checkOrigin;if(n&&"null"!=`${i}`&&!(n.constructor===Array?function(){let e=0,t=!1;for(r(H,`Checking connection is from allowed list of origins: ${n}`);e<n.length;e++)if(n[e]===i){t=!0;break}return t}():function(){const e=z[H]?.remoteHost;return r(H,`Checking connection is from: ${e}`),i===e}()))throw new Error(`Unexpected message received from: ${i} for ${D.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(z[H]?.firstRun&&z[H]&&(z[H].firstRun=!1),D.type){case"close":I(D.iframe);break;case"message":t=o(6),r(H,`onMessage passed: {iframe: ${D.iframe.id}, message: ${t}}`),L("onMessage",{iframe:D.iframe,message:JSON.parse(t)}),r(H,"---");break;case"mouseenter":O("onMouseEnter");break;case"mouseleave":O("onMouseLeave");break;case"autoResize":z[H].autoResize=JSON.parse(o(9));break;case"scrollBy":!function(){const e=D.width,i=D.height,t=window.parentIframe||window;r(H,`Scroll request received by parent: x: ${e} y: ${i}`),t.scrollBy(e,i)}();break;case"scrollTo":R(!1);break;case"scrollToOffset":R(!0);break;case"pageInfo":g("start",H),w();break;case"parentInfo":y("start",H),b();break;case"pageInfoStop":v();break;case"parentInfoStop":$();break;case"inPageLink":!function(e){const i=e.split("#")[1]||"",t=decodeURIComponent(i);let n=document.getElementById(t)||document.getElementsByName(t)[0];n?function(){const e=k(n);r(H,`Moving to in page link (#${i}) at x: ${e.x} y: ${e.y}`),j.position={x:e.x,y:e.y},N(H),window.location.hash=i,r(H,"--")}():window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(i):r(H,`In page link #${i} not found and window.parentIFrame not found`):r(H,`In page link #${i} not found`)}(o(9));break;case"title":!function(e,i){z[i]?.syncTitle&&(z[i].iframe.title=e,r(i,`Set title attribute to: ${e}`))}(D.msg,H);break;case"reset":F(D);break;case"init":i(),function(e){try{z[e].sameDomain=!!z[e]?.iframe?.contentWindow?.iframeChildListener}catch(i){z[e].sameDomain=!1}r(e,`sameDomain: ${z[e].sameDomain}`)}(H),(e=D.msg)!==l&&(void 0!==e?r(H,`Version mismatch (Child: ${e} !== Parent: ${l})`):s(H,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),A=!0,L("onReady",D.iframe);break;default:if(0===D.width&&0===D.height)return void a(H,`Unsupported message received (${D.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===D.width||0===D.height)return void r(H,"Ignoring message with 0 height or width");if(document.hidden)return void r(H,"Page hidden - ignored resize request");i()}var e,t}())):a("","iframeResizer received messageData without id, message was: ",P)):null!==H&&r(H,"Ignored:",P):Object.keys(z).forEach((e=>{z[e].mode>=0&&C("iFrame requested init",W(e),e)}))}function T(e,i,t){let n=null,o=null;if(z[e]){if(n=z[e][i],"function"!=typeof n)throw new TypeError(`${i} on iFrame[${e}] is not a function`);"onClose"===i||"onScroll"===i?o=n(t):setTimeout((()=>n(t)))}return o}function R(e){const{id:i}=e;delete z[i],r(i,"Disconnected from iframe")}function I(e){const{id:i}=e;if(!1!==T(i,"onClose",i)){r(i,`Removing iFrame: ${i}`);try{e.parentNode&&e.remove()}catch(e){a(i,e)}T(i,"onClosed",i),r(i,"---"),R(e)}else r(i,"Close iframe cancelled by onClose event")}function S(e){null===j.position&&(j.position={x:window.scrollX,y:window.scrollY},r(e,`Get page position: ${j.position.x}, ${j.position.y}`))}function x(){j.position=null}function M(e){null!==j.position&&(window.scrollTo(j.position.x,j.position.y),r(e,`Set page position: ${j.position.x}, ${j.position.y}`),x())}function F(e){r(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),S(e.id),E(e),C("reset","reset",e.id)}function E(e){function i(i){const n=`${e[i]}px`;e.iframe.style[i]=n,r(t,`IFrame (${t}) ${i} set to ${n}`)}const{id:t}=e,{sizeHeight:n,sizeWidth:o}=z[t];n&&i("height"),o&&i("width")}function C(e,i,t,n){z[t]&&(z[t]?.postMessageTarget?function(){const{iframe:n,postMessageTarget:o,sameDomain:a,targetOrigin:s}=z[t];if(a)try{return n.contentWindow.iframeChildListener(c+i),void r(t,`[${e}] Sending message to iframe[${t}] (${i}) via sameDomain`)}catch(e){r(t,"Same domain connection failed. Trying cross domain")}r(t,`[${e}] Sending message to iframe[${t}] (${i}) targetOrigin: ${s}`),o.postMessage(c+i,s)}():a(t,`[${e}] IFrame(${t}) not found`),n&&z[t]?.warningTimeout&&(z[t].msgTimeout=setTimeout((function(){if(void 0===z[t])return;const{iframe:e,loaded:i,loadErrorShown:n,waitForLoad:o}=z[t],{sandbox:r}=e;i||n||(z[t].loadErrorShown=!0,s(t,`\n<rb>No response from iFrame</>\n \nThe iframe (<i>${t}</>) has not responded within ${z[t].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}\n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values."}\n\nThis message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),z[t].warningTimeout)))}function W(e){const i=z[e];return[e,"8",i.sizeWidth,i.log,"32",!0,i.autoResize,i.bodyMargin,i.heightCalculationMethod,i.bodyBackground,i.bodyPadding,i.tolerance,i.inPageLinks,"child",i.widthCalculationMethod,i.mouseEvents,i.offsetHeight,i.offsetWidth,i.sizeHeight,i.license,j.version,i.mode].join(":")}i=z;let N=0,A=!1,O=!1;const L=e=>i=>{function n(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&s(c,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function o(e){const i=z[e]?.iframe?.title;return""===i||void 0===i}const c=function(n){if(n&&"string"!=typeof n)throw new TypeError("Invalid id for iFrame. Expected String");var o;return""!==n&&n||(n=function(){let i=e?.id||$.id+N++;return null!==document.getElementById(i)&&(i+=N++),i}(),i.id=n,o=(e||{}).log,t=o,r(n,`Added missing iframe ID: ${n} (${i.src})`)),n}(i.id);return c in z&&"iFrameResizer"in i?a(c,"Ignored iFrame, already setup."):(function(e){var t,a;z[c]={iframe:i,firstRun:!0,remoteHost:i?.src.split("/").slice(0,3).join("/"),...$,...n(e),mode:v(e),syncTitle:o(c)},function(){const{direction:e}=z[c];if("horizontal"===e)return z[c].sizeWidth=!0,z[c].sizeHeight=!1,void r(c,'Direction set to "horizontal"');if("none"===e)return z[c].sizeWidth=!1,z[c].sizeHeight=!1,z[c].autoResize=!1,void r(c,'Direction set to "none"');if("vertical"!==e)throw new TypeError(c,`Direction value of "${e}" is not valid`);r(c,'Direction set to "vertical"')}(),(t=e?.offsetSize||e?.offset)&&("vertical"===z[c].direction?(z[c].offsetHeight=t,r(c,`Offset height set to ${t}`)):(z[c].offsetWidth=t,r(c,`Offset width set to ${t}`))),e?.offset&&s(c,"<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</>."),null===z[c].postMessageTarget&&(z[c].postMessageTarget=i.contentWindow),z[c].targetOrigin=!0===z[c].checkOrigin?""===(a=z[c].remoteHost)||null!==a.match(/^(about:blank|javascript:|file:\/\/)/)?"*":a:"*"}(e),function(){const{mode:e}=z[c];e<0&&s("Parent",`${b(e+2)}${b(2)}`),O||e<0||(O=!0,(e=>{console.info(`%c[iframe-resizer] ${e}`,"font-weight: bold;")})(`v${l} (${(e=>h(y[e]))(e)})`),e<1&&s("Parent",b(3)))}(),D(),function(){switch(r(c,`IFrame scrolling ${z[c]?.scrolling?"enabled":"disabled"} for ${c}`),i.style.overflow=!1===z[c]?.scrolling?"hidden":"auto",z[c]?.scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=z[c]?z[c].scrolling:"no"}}(),function(){const{bodyMargin:e}=z[c];"number"!=typeof e&&"0"!==e||(z[c].bodyMargin=`${e}px`)}(),function(e){const{id:t}=i,{mode:n,waitForLoad:o}=z[t];-1!==n&&-2!==n&&(f(i,"load",(function(){C("iFrame.onload",`${e}:${A}`,t,!0),function(){const e=z[c]?.firstRun,t=z[c]?.heightCalculationMethod in u;!e&&t&&F({iframe:i,height:0,width:0,type:"init"})}()})),!1===o&&C("init",`${e}:${A}`,t,!0))}(W(c)),function(){if(z[c]){const{iframe:e}=z[c],i={close:I.bind(null,e),disconnect:R.bind(null,e),removeListeners(){s(c,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:C.bind(null,"Window resize","resize",c),moveToAnchor(e){C("Move to anchor",`moveToAnchor:${e}`,c)},sendMessage(e){C("Send Message",`message:${e=JSON.stringify(e)}`,c)}};e.iframeResizer=i,e.iFrameResizer=i}}()),i?.iFrameResizer};function P(){!1===document.hidden&&(r("document","Trigger event: Visibility change"),function(e,i){const t=e=>z[e]?.autoResize&&!z[e]?.firstRun;Object.keys(z).forEach((function(n){t(n)&&C(e,i,n)}))}("Tab Visible","resize"))}const D=(e=>{let i=!1;return function(){return i?void 0:(i=!0,Reflect.apply(e,this,arguments))}})((()=>{f(window,"message",k),f(document,"visibilitychange",P),window.iframeParentListener=e=>setTimeout((()=>k({data:e,sameDomain:!0})))})),H="[iframeResizer] ";const B=function(){function e(e){switch(!0){case!e:throw new TypeError(`${H}iframe is not defined`);case!e.tagName:throw new TypeError(`${H}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${H}Expected <IFRAME> tag, found <${e.tagName}>`);default:i(e),t.push(e)}}let i,t;return function(n,o){if("undefined"==typeof window)return[];switch(i=L(n),t=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${H}Unexpected data type (${typeof o})`)}return Object.freeze(t)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){s("","Deprecated: iFrameResize(), please use iframeResize()"),B(...e)}),B})); | ||
//# sourceMappingURL=iframeResizer.min.js.map |
{ | ||
"name": "iframe-resizer", | ||
"version": "5.3.3-beta.1", | ||
"version": "5.3.3-beta.2", | ||
"license": "GPL-3.0", | ||
@@ -41,6 +41,6 @@ "homepage": "https://iframe-resizer.com", | ||
"dependencies": { | ||
"@iframe-resizer/child": "5.3.3-beta.1", | ||
"@iframe-resizer/jquery": "5.3.3-beta.1", | ||
"@iframe-resizer/parent": "5.3.3-beta.1" | ||
"@iframe-resizer/child": "5.3.3-beta.2", | ||
"@iframe-resizer/jquery": "5.3.3-beta.2", | ||
"@iframe-resizer/parent": "5.3.3-beta.2" | ||
} | ||
} |
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
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
394122
+ Added@iframe-resizer/child@5.3.3-beta.2(transitive)
+ Added@iframe-resizer/core@5.3.3-beta.2(transitive)
+ Added@iframe-resizer/jquery@5.3.3-beta.2(transitive)
+ Added@iframe-resizer/parent@5.3.3-beta.2(transitive)
- Removed@iframe-resizer/child@5.3.3-beta.1(transitive)
- Removed@iframe-resizer/jquery@5.3.3-beta.1(transitive)
- Removed@iframe-resizer/parent@5.3.3-beta.1(transitive)