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