@iframe-resizer/child 5.5.9 → 6.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,20 +1,1454 @@
1
- /*!
2
- * @preserve
3
- *
4
- * @module iframe-resizer/child 5.5.9 (esm) - 2026-02-06
5
- *
6
- * @license GPL-3.0 for non-commercial use only.
7
- * For commercial use, you must purchase a license from
8
- * https://iframe-resizer.com/pricing
9
- *
10
- * @description Keep same and cross domain iFrames sized to their content
11
- *
12
- * @author David J. Bradshaw <info@iframe-resizer.com>
13
- *
14
- * @see {@link https://iframe-resizer.com}
15
- *
16
- * @copyright (c) 2013 - 2026, David J. Bradshaw. All rights reserved.
17
- */
18
-
19
-
20
- import e,{NORMAL as t,HIGHLIGHT as n,FOREGROUND as o,ITALIC as r,BOLD as a}from"auto-console-group";const i="5.5.9",s="iframeResizer",c=":",l="init",d="message",u="pageHide",m="pageInfo",f="parentInfo",p="scrollToOffset",h="title",y=10,g="data-iframe-size",b="data-iframe-overflowed",v="data-iframe-ignore",z="height",w="width",$="offset",S="offsetSize",O="string",E="number",M="object",j="function",k="auto",x="readystatechange",T="bottom",I="right",N="autoResizeEnabled",C=Symbol("sizeChanged"),P="manualResize",A="parentResize",R={[P]:1,[A]:1},B="setOffsetSize",L="resizeObserver",q="overflowObserver",D="mutationObserver",W="visibilityObserver",F="[iFrameSizer]",V=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),H=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)},U=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),Z=["spjluzl","rlf","clyzpvu"],J=["<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.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],_=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],Q=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),Y=e=>U(J[e]),G=e=>{const t=e[U(Z[0])]||e[U(Z[1])]||e[U(Z[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=H(U(e));return n in Q&&(t=Q[n]),t>4?t-4:t}(n[0]);return 0===o||(e=>e[2]===H(e[0]+e[1]))(n)||(o=-2),o},X=(e,...t)=>setTimeout(()=>e(...t),0),K=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},ee=e=>e,te=e=>Math.round(1e3*e)/1e3,ne=e=>e.charAt(0).toUpperCase()+e.slice(1),oe=e=>""!=`${e}`&&void 0!==e,re=e=>e();const ae=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${ne(t)}`)},ie={br:"\n",rb:"",bb:"",b:"",i:"",u:"","/":""},se=Object.keys(ie),ce=new RegExp(`<(${se.join("|")})>`,"gi"),le=(e,t)=>ie[t]??"";let de=!0,ue=s;var me;const fe=(me=e,me?.__esModule?me.default:me)({label:`${s}(child)`,expand:!1});var pe;const he=(pe="log",(...e)=>!de||fe[pe](...e));const{assert:ye,endAutoGroup:ge,error:be,errorBoundary:ve,event:ze,label:we,purge:$e,warn:Se}=fe,Oe=(Ee=ee,e=>Ee(typeof e===O?window.chrome?e.replace(ce,le):(e=>e.replaceAll("<br>","\n").replaceAll(/<\/?[^>]+>/gi,""))(e):e));var Ee;const Me=(...e)=>fe.warn(...e.map(Oe)),je=(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)=>Me(t)),ke=je("Method"),xe=je("Method","replaced with"),Te=je("Option"),Ie=["min-height","min-width","max-height","max-width"],Ne=new Set,Ce=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Pe=(e,t)=>{return(n=Ce(e,t))&&"0px"!==n&&n!==k&&"none"!==n;var n};function Ae({href:e}){Ne.has(e)||Ne.add(e)}const Re=(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){Ae(n)}return{source:"cross-origin stylesheet",value:Ce(e,t)}}(e,t),Be=(e,t)=>{const{source:n,value:o}=Re(e,t),r=(e=>e.tagName?e.tagName.toLowerCase():"unknown")(e);Me(`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 Le(){for(const e of[document.documentElement,document.body])for(const t of Ie)Pe(e,t)&&Be(e,t)}const qe=e=>t=>void 0===t?void 0:e(t),De=qe(e=>"true"===e),We=qe(Number),Fe=[],Ve=(e,t,n,o)=>{e.removeEventListener(t,n,o)},He=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Fe.push(()=>Ve(e,t,n,o))},Ue=e=>e=>{e.size},Ze=((e="")=>t=>n=>{n.size>0&&be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Je=e=>e=>{e.size},_e=(e,o=!0)=>r=>{r>0&&he(`${o?"At":"De"}tached %c${e}Observer%c ${o?"to":"from"} %c${r}%c element${1===r?"":"s"}`,n,t,n,t)},Qe=(e,t,n,o)=>{const r=Je(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()}},Ye=new Set,Ge=new Set,Xe=new Set,Ke=[],et={attributes:!0,attributeFilter:[v,g],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let tt,nt=1,ot=!1,rt=0;const at=e=>{e.size},it=e=>{e.size},st=e=>{e.size},ct=e=>e.nodeType!==Node.ELEMENT_NODE||V.has(e.tagName.toLowerCase());function lt(e){const t=e.addedNodes;for(const e of t)ct(e)||Ye.add(e)}function dt(e){const t=e.removedNodes;for(const e of t)ct(e)||(Ye.has(e)?(Ye.delete(e),Xe.add(e)):Ge.add(e))}const ut=e=>{he("Mutations:",e);for(const t of e)lt(t),dt(t);at(Ye),it(Ge),st(Xe),Xe.clear()};const mt=e=>()=>{const t=performance.now(),r=t-rt,a=16*nt+++2;if(r>a&&r<200)return ze("mutationThrottled"),he("Update delayed due to heavy workload on the callStack"),he(`EventLoop busy time: %c${te(r)}ms %c> Max wait: %c${a-2}ms`,n,o,n),setTimeout(tt,16*nt),void(rt=t);nt=1,Ke.forEach(ut),Ke.length=0,ot=!1,Ge.size,Ye.size,e({addedNodes:Ye,removedNodes:Ge}),Ye.clear(),Ge.clear()};function ft(e){Ke.push(e),ot||(rt=performance.now(),ot=!0,requestAnimationFrame(tt))}function pt(e){const t=new window.MutationObserver(ft),r=document.body||document.documentElement;return tt=mt(e),t.observe(r,et),he("Attached%c MutationObserver%c to body",n,o),{...t,disconnect:()=>{Ye.clear(),Ge.clear(),Ke.length=0,t.disconnect(),he("Detached%c MutationObserver",n)}}}const ht="Overflow",yt=_e(ht),gt=_e(ht,!1),bt=Ue(ht),vt=Ze(ht),zt=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,wt=(e,t)=>{const o=t.side,r={root:t.root,rootMargin:"0px",threshold:1},a=window?.requestAnimationFrame||ee,i=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[o],c=(e,t)=>e.toggleAttribute(b,t);const l=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:n,target:r}=t;if(!n)continue;const a=e[o],i=s(a,n)&&!zt(r);c(r,i)}a(i)},r),d=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&&(d.has(r)?t.add(r):(l.observe(r),d.add(r),n.add(r),o+=1));vt(t),bt(n),yt(o),n.clear(),t.clear()},detachObservers:Qe(ht,l,d,gt),disconnect:()=>{l.disconnect(),he("Detached%c OverflowObserver",n)}}},$t="--ifr-start",St="--ifr-end",Ot="--ifr-measure",Et=[];let Mt,jt={},kt=0;function xt(){try{performance.clearMarks($t),performance.clearMarks(St),performance.clearMeasures(Ot)}catch{}}function Tt(e){e.getEntries().forEach(e=>{if(e.name===St)try{const{duration:t}=performance.measure(Ot,$t,St);jt=e.detail,Et.push(t),Et.length>100&&Et.shift()}catch{}})}function It(){he("Attached%c PerformanceObserver%c to page",n,o);const e=new PerformanceObserver(Tt);return e.observe({entryTypes:["mark"]}),Mt=setInterval(()=>{if(Et.length<10)return;if(jt.hasTags&&jt.len<25)return;Et.sort();const e=Math.min(Et.reduce((e,t)=>e+t,0)/Et.length,Et[Math.floor(Et.length/2)]),t=te(e);t>kt&&(kt=t,ze("performanceObserver")),xt(),e<=4||(clearInterval(Mt),Me(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${te(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${jt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{xt(),clearInterval(Mt),e.disconnect(),he("Detached%c PerformanceObserver",n)}}}const Nt="Resize",Ct=_e(Nt),Pt=_e(Nt,!1),At=Ue(Nt),Rt=Ze(Nt),Bt=new WeakSet,Lt=new Set,qt=new Set;let Dt;function Wt(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(Bt.has(n)?Lt.add(n):(Dt.observe(n),Bt.add(n),qt.add(n),t+=1))}Rt(Lt),At(qt),Ct(t),qt.clear(),Lt.clear()}function Ft(e){const t=new IntersectionObserver(t=>e(t.at(-1).isIntersecting),{threshold:0}),r=document.documentElement;return t.observe(r),he("Attached%c VisibilityObserver%c to page",n,o),{disconnect:()=>{t.disconnect(),he("Detached%c VisibilityObserver",n)}}}const Vt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ht=Vt(j),Ut=Vt(E),Zt=Vt(O);"undefined"!=typeof window&&function(){const e={height:()=>(Se("Custom height calculation function not defined"),Cn.auto()),width:()=>(Se("Custom width calculation function not defined"),Pn.auto())},H={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},J={},Q=k,te="scroll";let ie,se,ce,le,me,pe,Oe,Ee=!0,je="",Ie=0,Ne="",Ce="",Pe=!1,Ae=!0,Re=!1,Be=!0,qe=!1,Ue=!1,Ze=!0,Je=!1,_e=1,Ye=Q,Ge="",Xe=!0,Ke={},et=!1,tt=!1,nt=!1,ot=0,rt=!1,at=0,it=0,st=new Set,ct="",lt="child",dt=!1,ut="",mt=[],ft=window.parent,ht="*",yt=0,gt=!1,bt=1,vt=te,zt=window,Ot=()=>{Se("onMessage function not defined")},Et=()=>{},Mt=null,jt=null;function kt(t){var o;!function(e){ct=e[0]??ct,Ie=We(e[1])??Ie,Re=De(e[2])??Re,nt=De(e[3])??nt,Ee=De(e[6])??Ee,Ne=e[7]??Ne,Ye=e[8]??Ye,je=e[9]??je,Ce=e[10]??Ce,yt=We(e[11])??yt,Ke.enable=De(e[12])??!1,lt=e[13]??lt,vt=e[14]??vt,rt=De(e[15])??rt,at=We(e[16])??at,it=We(e[17])??it,Ae=De(e[18])??Ae,ie=e[19]??ie,pe=e[20]??pe,ot=We(e[21])??ot,tt=De(e[23])??tt}(t),ue=(o={id:ct,enabled:nt,expand:tt}).id||s,fe.label(`${ue}`),fe.expand(o.expand),de=o.enabled,ze("initReceived"),function(){function t(e){Oe=Ht(e,"onBeforeResize")??Oe,Ot=Ht(e,"onMessage")??Ot,Et=Ht(e,"onReady")??Et,typeof e?.offset===E&&(Te($,S),Ae&&(at=Ut(e,$)??at),Re&&(it=Ut(e,$)??it)),typeof e?.offsetSize===E&&(Ae&&(at=Ut(e,S)??at),Re&&(it=Ut(e,S)??it)),se=Zt(e,U(Z[0]))??se,Ge=Zt(e,"ignoreSelector")??Ge,ut=Zt(e,"sizeSelector")??ut,ht=Zt(e,"targetOrigin")??ht,Ye=e?.heightCalculationMethod||Ye,vt=e?.widthCalculationMethod||vt}function o(t,n){return typeof t===j&&(Me(`<rb>Deprecated Option(${n}CalculationMethod)</>\n\nThe use of <b>${n}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.`),e[n]=t,t="custom"),t}if(1===ot)return;const r=window.iframeResizer||window.iFrameResizer;typeof r===M&&(t(r),Ye=o(Ye,z),vt=o(vt,w),he(`Set targetOrigin for parent: %c${ht}`,n))}(),[Jt,Qt,sn,qt,_t,rn,an,nn,Vt,Rt,Pe?ee:Le,Kt,()=>Yt("background",je),()=>Yt("padding",Ce),Pe?ee:en,ln,Xt,On,dn,cn,un,Tt,mn].forEach(e=>{try{e()}catch(e){if(ot<0)throw e;Me("<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</>"),be(e)}}),At(K(Et)),ge(),Wn(l,"Init message from host page",void 0,void 0,`${i}:${ot}`),document.title&&""!==document.title&&Hn(0,0,h,document.title)}function xt({persisted:e}){e||Hn(0,0,"beforeUnload"),ze(u),he("Page persisted:",e),e||Fe.forEach(re)}const Tt=()=>He(window,u.toLowerCase(),xt);let Ct=!1;function At(e){"complete"===document.readyState?X(e):Ct||He(document,x,()=>At(e)),Ct=!0}function Rt(){mt=document.querySelectorAll(`[${g}]`),Je=mt.length>0}let Lt=0;function qt(){const e=document.querySelectorAll(`*[${v}]`);return qe=e.length>0,qe&&e.length!==Lt&&(function(e){const n=1===e.length?"":"s";Se(`%c[${v}]%c found on %c${e.length}%c element${n}`,a,t,a,t)}(e),Lt=e.length),qe}function Vt(){"BackCompat"===document.compatMode&&Me("<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 Jt(){pe&&""!==pe&&"false"!==pe?pe!==i&&Me(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${pe} - Child page: ${i}.\n`):Me("<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 _t(){try{dt=1===ot||"iframeParentListener"in window.parent}catch(e){}}function Qt(){Re===Ae&&(Pe=!0)}function Yt(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),he(`Set body ${e}: %c${t}`,n))}function Gt(e,t,n){if(""!==n)for(const e of document.querySelectorAll(n))e.toggleAttribute(t,!0)}function Xt(){Gt(0,g,ut),Gt(0,v,Ge)}function Kt(){var e,t;void 0===Ne&&(Ne=`${Ie}px`),Yt("margin",(e="margin",(t=Ne).includes("-")&&(Se(`Negative CSS value ignored for ${e}`),t=""),t))}function en(){const e=e=>e.style.setProperty(z,k,"important");e(document.documentElement),e(document.body)}function tn(e){({add(t){function n(){Wn(e.eventName,e.eventType)}J[t]=n,He(window,t,n,{passive:!0})},remove(e){const t=J[e];delete J[e],Ve(window,e,t)}})[e.method](e.eventName)}function nn(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&Me("<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 on(e,t,n){const{label:o}=n;return t!==e&&(e in n||(Se(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in H)&&Me(`<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 ${pe?"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: '${k}',\n}\n`}\n`),e}function rn(){Ye=on(Ye,Q,Cn)}function an(){vt=on(vt,te,Pn)}function sn(){const e=ot,n=G({key:ie}),o=G({key:se});if(ot=Math.max(n,o),ot<0){if(ot=Math.min(n,o),$e(),Me(`${Y(ot+2)}${Y(2)}`),oe(pe))throw Y(ot+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!oe(pe)||e>-1&&ot>e)&&(sessionStorage.getItem("ifr")!==i&&function(e,n){console.info(`${ue} %ciframe-resizer ${e}`,de||n<1?"font-weight: bold;":t)}(`v${i} (${(e=>U(_[e]))(ot)})`,ot),ot<2&&Me(Y(3)),sessionStorage.setItem("ifr",i))}function cn(){!function(e){tn({method:e,eventType:"After Print",eventName:"afterprint"}),tn({method:e,eventType:"Before Print",eventName:"beforeprint"})}("add")}function ln(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function dn(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,y)+parseInt(n.x,y),y:parseInt(t.top,y)+parseInt(n.y,y)}}function t(t){const n=t.split("#")[1]||t,o=decodeURIComponent(n),r=document.getElementById(o)||document.getElementsByName(o)[0];void 0===r?Hn(0,0,"inPageLink",`#${n}`):function(t){const n=e(t);Hn(n.y,n.x,p)}(r)}function n(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}const{enable:o}=Ke;o&&(1===ot?Me(Y(5)):(function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&He(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),He(window,"hashchange",n),setTimeout(n,128))),Ke={...Ke,findTarget:t}}function un(){function e(e){Hn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){He(window.document,t,e)}!0===rt&&(t("mouseenter"),t("mouseleave"))}function mn(){1!==ot&&(zt.parentIframe=Object.freeze({autoResize:e=>(ae(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Re&&!1===Ae?(ze(N),Me("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Ee?(Ee=!0,queueMicrotask(()=>Wn(N,"Auto Resize enabled"))):!1===e&&!0===Ee&&(Ee=!1),Hn(0,0,"autoResize",JSON.stringify(Ee)),Ee)),close(){Hn(0,0,"close")},getId:()=>ct,getOrigin:()=>(ze("getOrigin"),ke("getOrigin()","getParentOrigin()"),ce),getParentOrigin:()=>ce,getPageInfo(e){if(typeof e===j)return Mt=e,Hn(0,0,m),void xe("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Mt=null,Hn(0,0,"pageInfoStop")},getParentProps:e=>(ae(e,j,"parentIframe.getParentProps(callback) callback"),jt=e,Hn(0,0,f),()=>{jt=null,Hn(0,0,"parentInfoStop")}),getParentProperties(e){ke("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){ae(e,O,"parentIframe.moveToAnchor(anchor) anchor"),Ke.findTarget(e)},reset(){!function(){const e=Ye;Ye=Q,gt||(gt=!0,requestAnimationFrame(()=>{gt=!1})),Fn("reset"),Ye=e}()},setOffsetSize(e){ae(e,E,"parentIframe.setOffsetSize(offset) offset"),at=e,it=e,Wn(B,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){ae(e,E,"parentIframe.scrollBy(x, y) x"),ae(t,E,"parentIframe.scrollBy(x, y) y"),Hn(t,e,"scrollBy")},scrollTo(e,t){ae(e,E,"parentIframe.scrollTo(x, y) x"),ae(t,E,"parentIframe.scrollTo(x, y) y"),Hn(t,e,"scrollTo")},scrollToOffset(e,t){ae(e,E,"parentIframe.scrollToOffset(x, y) x"),ae(t,E,"parentIframe.scrollToOffset(x, y) y"),Hn(t,e,p)},sendMessage(e,t){t&&ae(t,O,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Hn(0,0,d,JSON.stringify(e),t)},setHeightCalculationMethod(e){Ye=e,rn()},setWidthCalculationMethod(e){vt=e,an()},setTargetOrigin(e){ae(e,O,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),ht=e},resize(e,t){void 0!==e&&ae(e,E,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&ae(t,E,"parentIframe.resize(customHeight, customWidth) customWidth"),Wn(P,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ke("size()","resize()"),this.resize(e,t)}}),zt.parentIFrame=zt.parentIframe)}let fn=new Set;function pn(){const e=document.querySelectorAll(`[${b}]`);st=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${v}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{ze("overflowIgnored"),he("Ignoring elements with [data-iframe-ignore] > *:\n",n),ge()}),t}(e),Ue=st.size>0,typeof Set.prototype.symmetricDifference===j&&(Ze=st.symmetricDifference(fn).size>0),fn=st}function hn(){switch(pn(),!0){case!Ze:return;case st.size>1:he("Overflowed Elements:",st);break;case Ue:break;default:he("No overflow detected")}Wn(q,"Overflow updated")}function yn(e){const t={root:document.documentElement,side:Ae?T:I};return le=wt(hn,t),le.attachObservers(e),le}function gn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Wn(L,`Element resized <${function(e){switch(!0){case!oe(e):return"";case oe(e.id):return`${e.nodeName}#${e.id}`;case oe(e.name):return`${e.nodeName} (${e.name}`;case oe(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function bn(e){return Dt=new ResizeObserver(gn),Dt.observe(document.body),Bt.add(document.body),he("Attached%c ResizeObserver%c to body",n,o),me={attachObserverToNonStaticElements:Wt,detachObservers:Qe(Nt,Dt,Bt,Pt),disconnect:()=>{Dt.disconnect(),he("Detached%c ResizeObserver",n)}},me.attachObserverToNonStaticElements(e),me}function vn(e){et=!e,Wn(W,"Visibility changed")}const zn=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of kn(n))t.add(e)}return he("Inspecting:\n",t),t},wn=e=>{if(0===e.size)return;ze("addObservers");const t=zn(e);le.attachObservers(t),me.attachObserverToNonStaticElements(t),ge()},$n=e=>{if(0===e.size)return;ze("removeObservers");const t=zn(e);le.detachObservers(t),me.detachObservers(t),ge()};function Sn(e){!function({addedNodes:e,removedNodes:t}){ze("contentMutated"),Xt(),Rt(),pn(),ge(),$n(t),wn(e)}(e),Wn(D,"Mutation Observed")}function On(){const e=kn(document.documentElement);var t;t=[pt(Sn),yn(e),It(),bn(e),Ft(vn)],Fe.push(...t.map(e=>e.disconnect))}function En(e){performance.mark($t);const t=ne(e);let r=1,a=document.documentElement,i=Je?0:document.documentElement.getBoundingClientRect().bottom;const s=Je?mt:Ue?Array.from(st):kn(document.documentElement);for(const t of s)r=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),r>i&&(i=r,a=t);return he(`${t} position calculated from:`,a),he(`Checked %c${s.length}%c elements`,n,o),performance.mark(St,{detail:{hasTags:Je,len:s.length,logging:nt,Side:t}}),i}const Mn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],jn=`* ${Array.from(V).map(e=>`:not(${e})`).join("")}`,kn=e=>e.querySelectorAll(jn),xn={height:0,width:0},Tn={height:0,width:0},In=[n,o,n];function Nn(e){function t(){return Tn[r]=a,xn[r]=c,Math.max(a,1)}const o=e===Cn,r=e.label,a=e.boundingClientRect(),i=Math.ceil(a),s=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${a}px %cPage: %c${c}px`;let d=1;switch(!0){case!e.enabled():return Math.max(c,1);case Je:he("Found element with data-iframe-size attribute"),d=e.taggedElement();break;case!Ue&&Be&&0===Tn[r]&&0===xn[r]:he(`Initial page size values: ${l}`,...In),d=t();break;case gt&&a===Tn[r]&&c===xn[r]:he(`Size unchanged: ${l}`,...In),d=Math.max(a,c);break;case 0===a&&0!==c:he(`Page is hidden: ${l}`,...In),d=c;break;case!Ue&&a!==Tn[r]&&c<=xn[r]:he(`New <html> size: ${l} `,...In),he(`Previous <html> size: %c${Tn[r]}px`,n),d=t();break;case!o:d=e.taggedElement();break;case!Ue&&a<Tn[r]:he(`<html> size decreased: ${l}`,...In),d=t();break;case c===s||c===i:he(`<html> size equals page size: ${l}`,...In),d=t();break;case a>c:he(`Page size < <html> size: ${l}`,...In),d=t();break;case Ue:he("Found elements possibly overflowing <html> "),d=e.taggedElement();break;default:he(`Using <html> size: ${l}`,...In),d=t()}return he(`Content ${r}: %c${d}px`,n),d+=function(e){const t=e.getOffset();return 0!==t&&he(`Page offsetSize: %c${t}px`,n),t}(e),Math.max(d,1)}const Cn={label:z,enabled:()=>Ae,getOffset:()=>at,auto:()=>Nn(Cn),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Cn.bodyOffset(),custom:()=>e.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Mn(Cn)),min:()=>Math.min(...Mn(Cn)),grow:()=>Cn.max(),lowestElement:()=>En(T),taggedElement:()=>En(T)},Pn={label:w,enabled:()=>Re,getOffset:()=>it,auto:()=>Nn(Pn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>e.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Mn(Pn)),min:()=>Math.min(...Mn(Pn)),rightMostElement:()=>En(I),scroll:()=>Math.max(Pn.bodyScroll(),Pn.documentElementScroll()),taggedElement:()=>En(I)},An=(e,t)=>!(Math.abs(e-t)<=yt);function Rn(e,t){const n=e[t](),o=e.enabled()&&void 0!==Oe?function(e){const t=Oe(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 ye(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Bn=!1;const Ln=K(()=>Me(Y(4)));let qn,Dn=!1;const Wn=ve((e,t,n,o,r)=>{switch(ze(e),!0){case!0===et:if(!0===Dn)break;Dn=!0,Bn=!1,cancelAnimationFrame(qn),qn=null;break;case!0===Bn&&e!==q:$e();break;case!Ee&&!(e in R):he("Resizing disabled");break;default:Dn=!1,Bn=!0,performance.now(),qn||(qn=requestAnimationFrame(()=>{Bn=!1,qn=null,ze("requestAnimationFrame")})),function(e,t,n,o,r){const a=n??Rn(Cn,Ye),i=o??Rn(Pn,vt);switch(Ae&&An(_e,a)||Re&&An(bt,i)?C:e){case l:case N:case C:_e=a,bt=i;case B:Vn(_e,bt,e,r);break;case q:case D:case L:case W:$e();break;default:$e(),he("No change in content size detected")}}(e,0,n,o,r)}ge()});function Fn(e){_e=Cn[Ye](),bt=Pn[vt](),Hn(_e,bt,e)}function Vn(e,t,o,a,i){ot<-1||(void 0!==i||(i=ht),function(){const s=`${ct}:${e}:${t}:${o}${void 0===a?"":`:${a}`}`;if(dt)try{window.parent.iframeParentListener(F+s)}catch(e){if(1!==ot)throw e;return void Ln()}else ft.postMessage(F+s,i);he(`Sending message to parent page via ${dt?"sameOrigin":"postMessage"}: %c%c${s}`,r,n)}())}const Hn=ve((e,t,n,o,r)=>{ze(n),Vn(e,t,n,o,r),ge()}),Un=ve(function(e){ze("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>Hn(0,0,`${e}Stop`),r={init:function(){if("loading"===document.readyState)return;const t=e.data.slice(13).split(c);ft=e.source,ce=e.origin,kt(t),Be=!1,setTimeout(()=>{Xe=!1},128)},reset(){Xe||Fn("resetPage")},resize(){Wn(A,"Parent window requested size check")},moveToAnchor(){Ke.findTarget(i())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=i();Mt?X(Mt,n(e)):o(m)},parentInfo(){const e=(r=i(),t(n(r)));var r;jt?X(jt,e):o(f)},message(){const e=i();X(Ot,n(e))}},a=()=>e.data.split("]")[1].split(c)[0],i=()=>e.data.slice(e.data.indexOf(c)+1),s=()=>e.data.split(c)[2]in{true:1,false:1};function d(){const t=a();ze(t),t in r?r[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||s()||Se(`Unexpected message (${e.data})`)}F===`${e.data}`.slice(0,13)&&function(){if(!1!==Be)return s()?(we(a()),ze(l),void r.init()):void 0;d()}()});let Zn=!1;const Jn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function _n(){if("loading"===document.readyState||!Be||Zn)return;const{parent:e,top:t}=window;ze("ready"),Jn(e),e!==t&&Jn(t),Zn=!0}"iframeChildListener"in window?Se("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Un({data:e,sameOrigin:!0})),ze("listen"),He(window,d,Un),He(document,x,_n),_n())}();
1
+ import Ln, { NORMAL as K, HIGHLIGHT as c, FOREGROUND as w, BOLD as ft, ITALIC as jn } from "auto-console-group";
2
+ const D = "6.0.0-beta.0", Ve = "iframeResizer", Ee = ":", xn = "[iFrameResizerChild]Ready", _n = "autoResize", Dn = "beforeUnload", Bn = "close", Hn = "inPageLink", Se = "init", je = "message", Fn = "mouseenter", Wn = "mouseleave", Bt = "pageHide", Ht = "pageInfo", Ft = "parentInfo", Un = "pageInfoStop", Gn = "parentInfoStop", Vn = "scrollBy", qn = "scrollTo", Wt = "scrollToOffset", Zn = "title", W = 10, X = 1, Oe = "data-iframe-size", Ut = "data-iframe-overflowed", te = "data-iframe-ignore", ne = "height", Gt = "width", Ie = "offset", Ae = "offsetSize", Yn = "scroll", qe = `
3
+ `, oe = "string", L = "number", Qn = "boolean", Jn = "object", re = "function", Kn = "undefined", Xn = "false", eo = "null", Me = "auto", Vt = "readystatechange", xe = "bottom", _e = "right", De = "autoResizeEnabled", mt = /* @__PURE__ */ Symbol("sizeChanged"), Ze = "manualResize", Ye = "parentResize", ht = {
4
+ [Ze]: 1,
5
+ [Ye]: 1
6
+ }, qt = "setOffsetSize", Zt = "resizeObserver", Qe = "overflowObserver", Yt = "mutationObserver", Qt = "visibilityObserver", to = "font-weight: bold;", Je = "none", gt = "No change in content size detected", he = "[iFrameSizer]", Jt = he.length, Ke = Me, Kt = Yn, Xt = 128, en = /* @__PURE__ */ new Set([
7
+ "head",
8
+ "body",
9
+ "meta",
10
+ "base",
11
+ "title",
12
+ "script",
13
+ "link",
14
+ "style",
15
+ "map",
16
+ "area",
17
+ "option",
18
+ "optgroup",
19
+ "template",
20
+ "track",
21
+ "wbr",
22
+ "nobr"
23
+ ]), no = (e) => (t, n = "renamed to") => (o, r, u = "", l = "") => e(
24
+ l,
25
+ `<rb>Deprecated ${t}(${o.replace("()", "")})</>
26
+
27
+ The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${u}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`
28
+ ), oo = (e) => typeof e === oe, Re = (e, ...t) => setTimeout(() => e(...t), 0), tn = (e) => {
29
+ let t = !1;
30
+ return function(...n) {
31
+ return t ? void 0 : (t = !0, e.apply(this, n));
32
+ };
33
+ }, ge = (e) => e, pt = 1e3, _ = (e) => Math.round(e * pt) / pt, nn = (e) => e.charAt(0).toUpperCase() + e.slice(1), U = (e) => `${e}` != "" && e !== void 0, ro = (e) => e(), so = (e) => e.toLowerCase();
34
+ function io(e) {
35
+ switch (!0) {
36
+ case !U(e):
37
+ return "";
38
+ case U(e.id):
39
+ return `${e.nodeName}#${e.id}`;
40
+ case U(e.name):
41
+ return `${e.nodeName} (${e.name}`;
42
+ case U(e.className):
43
+ return `${e.nodeName}.${e.className}`;
44
+ default:
45
+ return e.nodeName;
46
+ }
47
+ }
48
+ const co = (e) => (
49
+ // eslint-disable-next-line no-underscore-dangle
50
+ e?.__esModule ? e.default : e
51
+ ), $ = (e, t, n) => {
52
+ if (typeof e !== t)
53
+ throw new TypeError(`${n} is not a ${nn(t)}`);
54
+ }, on = {
55
+ br: `
56
+ `,
57
+ rb: "\x1B[31;1m",
58
+ // red bold
59
+ bb: "\x1B[34;1m",
60
+ // blue bold
61
+ b: "\x1B[1m",
62
+ // bold
63
+ i: "\x1B[3m",
64
+ // italic
65
+ u: "\x1B[4m",
66
+ // underline
67
+ "/": "\x1B[m"
68
+ // reset
69
+ }, ao = Object.keys(on), lo = new RegExp(`<(${ao.join("|")})>`, "gi"), uo = (e, t) => on[t] ?? "", fo = (e) => e.replace(lo, uo), mo = (e) => e.replaceAll("<br>", qe).replaceAll(/<\/?[^>]+>/gi, ""), ho = (e) => (t) => e(
70
+ oo(t) ? window.chrome ? fo(t) : mo(t) : t
71
+ );
72
+ let Xe = !0, Be = Ve;
73
+ const go = co(Ln), ee = go({
74
+ label: `${Ve}(child)`,
75
+ expand: !1
76
+ });
77
+ function po(e) {
78
+ Be = e.id || Ve, ee.label(`${Be}`), ee.expand(e.expand), Xe = e.enabled;
79
+ }
80
+ const rn = (e) => (...t) => Xe ? ee[e](...t) : !0, a = rn("log"), d = a, pe = rn("debug");
81
+ function yo(e, t) {
82
+ console.info(
83
+ `${Be} %ciframe-resizer ${e}`,
84
+ Xe || t < 1 ? to : K
85
+ );
86
+ }
87
+ const {
88
+ assert: Ai,
89
+ endAutoGroup: B,
90
+ error: sn,
91
+ errorBoundary: et,
92
+ event: m,
93
+ label: Ci,
94
+ purge: ki,
95
+ warn: T
96
+ } = ee, bo = ho(ge), g = (...e) => ee.warn(...e.map(bo)), tt = no((e, t) => g(t)), cn = tt("Method"), vo = tt("Method", "replaced with"), wo = tt("Option"), nt = [];
97
+ function an(e, t) {
98
+ a(`${e} event listener: %c${t}`, c);
99
+ }
100
+ const ln = (e, t, n, o) => {
101
+ e.removeEventListener(t, n, o), an("Removed", t);
102
+ }, j = (e, t, n, o = !1) => {
103
+ e.addEventListener(t, n, o), nt.push(() => ln(e, t, n, o)), an("Added", t);
104
+ }, i = {
105
+ applySelectors: null,
106
+ firstRun: !0,
107
+ hasTags: !1,
108
+ hasOverflow: !1,
109
+ height: 0,
110
+ isHidden: !1,
111
+ initLock: !0,
112
+ inPageLinks: {},
113
+ origin: void 0,
114
+ hasOverflowUpdated: !0,
115
+ overflowedNodeSet: /* @__PURE__ */ new Set(),
116
+ sameOrigin: !1,
117
+ taggedElements: [],
118
+ target: window?.parent,
119
+ timerActive: !1,
120
+ totalTime: 0,
121
+ triggerLocked: !1,
122
+ width: 0,
123
+ win: window,
124
+ onPageInfo: null,
125
+ onParentInfo: null
126
+ };
127
+ let yt = !1;
128
+ const bt = (e) => e.postMessage(
129
+ xn,
130
+ window?.iframeResizer?.targetOrigin || "*"
131
+ );
132
+ function vt() {
133
+ if (document.readyState === "loading" || !i.firstRun || yt) return;
134
+ const { parent: e, top: t } = window;
135
+ m("ready"), a(
136
+ "Sending%c ready%c to parent from",
137
+ c,
138
+ w,
139
+ window.location.href
140
+ ), bt(e), e !== t && bt(t), yt = !0;
141
+ }
142
+ const wt = "iframeResize", zo = (e) => he === `${e.data}`.slice(0, Jt), Eo = () => wt in window || window.jQuery !== void 0 && wt in window.jQuery.prototype, So = (e) => e.data.split(Ee)[2] in { true: 1, false: 1 }, Oo = () => [document.documentElement, document.body], Mo = ["min-height", "min-width", "max-height", "max-width"], zt = /* @__PURE__ */ new Set(), Ro = (e) => !!e && e !== "0px" && e !== Me && e !== Je, dn = (e) => e.tagName ? e.tagName.toLowerCase() : "unknown", un = (e, t) => window.getComputedStyle(e).getPropertyValue(t), $o = (e, t) => Ro(un(e, t));
143
+ function To(e, t) {
144
+ const n = e.style[t];
145
+ return n ? { source: "an inline style attribute", value: n } : null;
146
+ }
147
+ function Io({ href: e }) {
148
+ zt.has(e) || (a("Unable to access stylesheet:", e), zt.add(e));
149
+ }
150
+ function Ao(e, t) {
151
+ for (const n of document.styleSheets)
152
+ try {
153
+ for (const o of n.cssRules || [])
154
+ if (o.selectorText && e.matches(o.selectorText)) {
155
+ const r = o.style[t];
156
+ if (r)
157
+ return {
158
+ source: n.ownerNode.tagName === "STYLE" ? "an inline <style> block" : `stylesheet (${n.href})`,
159
+ value: r
160
+ };
161
+ }
162
+ } catch {
163
+ Io(n);
164
+ }
165
+ return {
166
+ source: "cross-origin stylesheet",
167
+ value: un(e, t)
168
+ };
169
+ }
170
+ const Co = (e, t) => To(e, t) || Ao(e, t), ko = (e, t) => {
171
+ const { source: n, value: o } = Co(e, t), r = dn(e);
172
+ g(
173
+ `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</>.
174
+
175
+ If 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.`
176
+ );
177
+ };
178
+ function No() {
179
+ for (const e of Oo())
180
+ for (const t of Mo)
181
+ a(`Checking <${dn(e)}> for blocking CSS: ${t}`), $o(e, t) && ko(e, t);
182
+ }
183
+ const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
184
+ autoResize: !0,
185
+ bodyBackground: "",
186
+ bodyMargin: 0,
187
+ // For V1 compatibility
188
+ bodyMarginStr: "",
189
+ bodyPadding: "",
190
+ calculateHeight: !0,
191
+ calculateWidth: !1,
192
+ heightCalcMode: Ke,
193
+ ignoreSelector: "",
194
+ inPageLinks: !1,
195
+ logging: !1,
196
+ logExpand: !1,
197
+ mode: 0,
198
+ mouseEvents: !1,
199
+ offsetHeight: 0,
200
+ offsetWidth: 0,
201
+ sizeSelector: "",
202
+ targetOrigin: "*",
203
+ tolerance: 0,
204
+ widthCalcMode: Kt,
205
+ onBeforeResize: void 0,
206
+ onMessage: () => {
207
+ T("onMessage function not defined");
208
+ },
209
+ onReady: () => {
210
+ }
211
+ }, Lo = (e) => `:not(${e})`, jo = `* ${Array.from(en).map(Lo).join("")}`, ot = (e) => e.querySelectorAll(jo), ye = (e) => [
212
+ e.bodyOffset(),
213
+ e.bodyScroll(),
214
+ e.documentElementOffset(),
215
+ e.documentElementScroll(),
216
+ e.boundingClientRect()
217
+ ], k = [c, w, c], fe = {
218
+ height: 0,
219
+ width: 0
220
+ }, F = {
221
+ height: 0,
222
+ width: 0
223
+ };
224
+ function H(e, t, n) {
225
+ return F[e] = t, fe[e] = n, t;
226
+ }
227
+ function xo(e) {
228
+ const t = e.getOffset();
229
+ return t !== 0 && d(`Page offsetSize: %c${t}px`, c), t;
230
+ }
231
+ const _o = (e) => e.documentElementScroll() + Math.max(0, e.getOffset());
232
+ function fn(e) {
233
+ const { hasOverflow: t, hasTags: n, triggerLocked: o } = i, r = e.label, u = r === ne, l = e.boundingClientRect(), p = Math.ceil(l), v = Math.floor(l), f = _o(e), z = `HTML: %c${l}px %cPage: %c${f}px`;
234
+ let h;
235
+ switch (!0) {
236
+ case !e.enabled():
237
+ return Math.max(f, X);
238
+ case n:
239
+ d("Found element with data-iframe-size attribute"), h = e.taggedElement();
240
+ break;
241
+ case (!t && i.firstRun && F[r] === 0 && fe[r] === 0):
242
+ d(`Initial page size values: ${z}`, ...k), h = H(
243
+ r,
244
+ l,
245
+ f
246
+ );
247
+ break;
248
+ case (o && l === F[r] && f === fe[r]):
249
+ d(`Size unchanged: ${z}`, ...k), h = Math.max(l, f);
250
+ break;
251
+ case (l === 0 && f !== 0):
252
+ d(`Page is hidden: ${z}`, ...k), h = f;
253
+ break;
254
+ case (!t && l !== F[r] && f <= fe[r]):
255
+ d(`New <html> size: ${z} `, ...k), d(
256
+ `Previous <html> size: %c${F[r]}px`,
257
+ c
258
+ ), h = H(
259
+ r,
260
+ l,
261
+ f
262
+ );
263
+ break;
264
+ case !u:
265
+ h = e.taggedElement();
266
+ break;
267
+ case (!t && l < F[r]):
268
+ d(`<html> size decreased: ${z}`, ...k), h = H(
269
+ r,
270
+ l,
271
+ f
272
+ );
273
+ break;
274
+ case (f === v || f === p):
275
+ d(`<html> size equals page size: ${z}`, ...k), h = H(
276
+ r,
277
+ l,
278
+ f
279
+ );
280
+ break;
281
+ case l > f:
282
+ d(`Page size < <html> size: ${z}`, ...k), h = H(
283
+ r,
284
+ l,
285
+ f
286
+ );
287
+ break;
288
+ case t:
289
+ d("Found elements possibly overflowing <html> "), h = e.taggedElement();
290
+ break;
291
+ default:
292
+ d(`Using <html> size: ${z}`, ...k), h = H(
293
+ r,
294
+ l,
295
+ f
296
+ );
297
+ }
298
+ return d(`Content ${r}: %c${h}px`, c), h += xo(e), Math.max(h, X);
299
+ }
300
+ const Do = () => {
301
+ const { body: e } = document, t = getComputedStyle(e);
302
+ return e.offsetHeight + parseInt(t.marginTop, W) + parseInt(t.marginBottom, W);
303
+ }, Bo = 1e3, Ho = 5 * Bo, Fo = 4, Wo = 10, Uo = 100, rt = "--ifr-start", be = "--ifr-end", mn = "--ifr-measure", b = [];
304
+ let me = {}, Et = 0, He;
305
+ function hn() {
306
+ try {
307
+ performance.clearMarks(rt), performance.clearMarks(be), performance.clearMeasures(mn);
308
+ } catch {
309
+ }
310
+ }
311
+ function Go() {
312
+ He = setInterval(() => {
313
+ if (b.length < Wo || me.hasTags && me.len < 25) return;
314
+ b.sort();
315
+ const e = Math.min(
316
+ b.reduce((n, o) => n + o, 0) / b.length,
317
+ b[Math.floor(b.length / 2)]
318
+ ), t = _(e);
319
+ t > Et && (Et = t, m("performanceObserver"), a("Mean time:", _(b[Math.floor(b.length / 2)])), a(
320
+ "Median time:",
321
+ _(b.reduce((n, o) => n + o, 0) / b.length)
322
+ ), a("Average time:", t), a("Max time:", _(Math.max(...b)))), hn(), !(e <= Fo) && (clearInterval(He), g(
323
+ `<rb>Performance Warning</>
324
+
325
+ Calculating the page size is taking an excessive amount of time (${_(e)}ms).
326
+
327
+ To improve performance add the <b>data-iframe-size</> attribute to the ${me.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`
328
+ ));
329
+ }, Ho);
330
+ }
331
+ function Vo(e) {
332
+ e.getEntries().forEach((t) => {
333
+ if (t.name === be)
334
+ try {
335
+ const { duration: n } = performance.measure(
336
+ mn,
337
+ rt,
338
+ be
339
+ );
340
+ me = t.detail, b.push(n), b.length > Uo && b.shift();
341
+ } catch {
342
+ }
343
+ });
344
+ }
345
+ function qo() {
346
+ d("Attached%c PerformanceObserver%c to page", c, w);
347
+ const e = new PerformanceObserver(Vo);
348
+ return e.observe({ entryTypes: ["mark"] }), Go(), {
349
+ disconnect: () => {
350
+ hn(), clearInterval(He), e.disconnect(), d("Detached%c PerformanceObserver", c);
351
+ }
352
+ };
353
+ }
354
+ function Zo() {
355
+ const { hasOverflow: e, hasTags: t, overflowedNodeSet: n, taggedElements: o } = i;
356
+ return t ? o : e ? Array.from(n) : ot(document.documentElement);
357
+ }
358
+ function Yo(e, t) {
359
+ const n = `margin-${t}`;
360
+ let o, r = document.documentElement, u = i.hasTags ? X : document.documentElement.getBoundingClientRect().bottom;
361
+ for (const l of e)
362
+ o = l.getBoundingClientRect()[t] + parseFloat(getComputedStyle(l).getPropertyValue(n)), o > u && (u = o, r = l);
363
+ return { maxEl: r, maxVal: u };
364
+ }
365
+ function ve(e) {
366
+ performance.mark(rt);
367
+ const t = nn(e), { logging: n } = s, { hasTags: o } = i, r = Zo(), { maxEl: u, maxVal: l } = Yo(r, e);
368
+ return d(`${t} position calculated from:`, u), d(`Checked %c${r.length}%c elements`, c, w), performance.mark(be, {
369
+ detail: {
370
+ hasTags: o,
371
+ len: r.length,
372
+ logging: n,
373
+ Side: t
374
+ }
375
+ }), l;
376
+ }
377
+ const S = {
378
+ label: ne,
379
+ enabled: () => s.calculateHeight,
380
+ getOffset: () => s.offsetHeight,
381
+ auto: () => fn(S),
382
+ bodyOffset: Do,
383
+ bodyScroll: () => document.body.scrollHeight,
384
+ offset: () => S.bodyOffset(),
385
+ // Backwards compatibility
386
+ documentElementOffset: () => document.documentElement.offsetHeight,
387
+ documentElementScroll: () => document.documentElement.scrollHeight,
388
+ boundingClientRect: () => Math.max(
389
+ document.documentElement.getBoundingClientRect().bottom,
390
+ document.body.getBoundingClientRect().bottom
391
+ ),
392
+ max: () => Math.max(...ye(S)),
393
+ min: () => Math.min(...ye(S)),
394
+ grow: () => S.max(),
395
+ lowestElement: () => ve(xe),
396
+ taggedElement: () => ve(xe),
397
+ custom: () => (T("Custom height calculation function not defined"), S.auto())
398
+ }, O = {
399
+ label: Gt,
400
+ enabled: () => s.calculateWidth,
401
+ getOffset: () => s.offsetWidth,
402
+ auto: () => fn(O),
403
+ bodyScroll: () => document.body.scrollWidth,
404
+ bodyOffset: () => document.body.offsetWidth,
405
+ documentElementScroll: () => document.documentElement.scrollWidth,
406
+ documentElementOffset: () => document.documentElement.offsetWidth,
407
+ boundingClientRect: () => Math.max(
408
+ document.documentElement.getBoundingClientRect().right,
409
+ document.body.getBoundingClientRect().right
410
+ ),
411
+ max: () => Math.max(...ye(O)),
412
+ min: () => Math.min(...ye(O)),
413
+ rightMostElement: () => ve(_e),
414
+ scroll: () => Math.max(O.bodyScroll(), O.documentElementScroll()),
415
+ taggedElement: () => ve(_e),
416
+ custom: () => (T("Custom width calculation function not defined"), O.auto())
417
+ }, Qo = {
418
+ bodyOffset: 1,
419
+ bodyScroll: 1,
420
+ offset: 1,
421
+ documentElementOffset: 1,
422
+ documentElementScroll: 1,
423
+ boundingClientRect: 1,
424
+ max: 1,
425
+ min: 1,
426
+ grow: 1,
427
+ lowestElement: 1
428
+ }, Jo = (e) => `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:
429
+
430
+ window.iframeResizer = {
431
+ license: 'xxxx',
432
+ ${e}CalculationMethod: '${Me}',
433
+ }
434
+ `;
435
+ function Ko(e, t) {
436
+ const n = s.version ? "remove this option." : Jo(e);
437
+ g(
438
+ `<rb>Deprecated ${e}CalculationMethod (${t})</>
439
+
440
+ This version of <i>iframe-resizer</> can auto detect the most suitable ${e} calculation method. It is recommended that you ${n}
441
+ `
442
+ );
443
+ }
444
+ function gn(e, t, n) {
445
+ const { label: o } = n;
446
+ return t !== e && (e in n || (T(`${e} is not a valid option for ${o}CalculationMethod.`), e = t), e in Qo && Ko(o, e)), a(`Set ${o} calculation method: %c${e}`, c), e;
447
+ }
448
+ function pn() {
449
+ s.heightCalcMode = gn(
450
+ s.heightCalcMode,
451
+ Ke,
452
+ S
453
+ );
454
+ }
455
+ function yn() {
456
+ s.widthCalcMode = gn(
457
+ s.widthCalcMode,
458
+ Kt,
459
+ O
460
+ );
461
+ }
462
+ function Xo() {
463
+ try {
464
+ i.sameOrigin = s.mode === 1 || "iframeParentListener" in window.parent;
465
+ } catch {
466
+ a("Cross domain iframe detected");
467
+ }
468
+ }
469
+ const er = `<rb>Deprecated Attributes</>
470
+
471
+ The <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</>.`;
472
+ function tr() {
473
+ let e = !1;
474
+ const t = (n) => document.querySelectorAll(`[${n}]`).forEach((o) => {
475
+ o.toggleAttribute(Oe, !0), o.removeAttribute(n), e = !0;
476
+ });
477
+ t("data-iframe-height"), t("data-iframe-width"), e && g(er);
478
+ }
479
+ let St = 0;
480
+ function nr(e) {
481
+ const t = e.length === 1 ? "" : "s";
482
+ T(
483
+ `%c[${te}]%c found on %c${e.length}%c element${t}`,
484
+ ft,
485
+ K,
486
+ ft,
487
+ K
488
+ );
489
+ }
490
+ function or() {
491
+ const e = document.querySelectorAll(`*[${te}]`), t = e.length > 0;
492
+ return t && e.length !== St && (nr(e), St = e.length), t;
493
+ }
494
+ const Ot = (e) => {
495
+ if (!e) return "";
496
+ let t = -559038744, n = 1103547984;
497
+ for (let o, r = 0; r < e.length; r++)
498
+ o = e.codePointAt(r), t = Math.imul(t ^ o, 2246822519), n = Math.imul(n ^ o, 3266489917);
499
+ 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);
500
+ }, N = (e) => e.replace(
501
+ /[A-Za-z]/g,
502
+ (t) => String.fromCodePoint(
503
+ (t <= "Z" ? 90 : 122) >= (t = t.codePointAt(0) + 19) ? t : t - 26
504
+ )
505
+ ), Q = ["spjluzl", "rlf", "clyzpvu", "rlf2"], rr = [
506
+ "<yi>Puchspk Spjluzl Rlf</><iy><iy>",
507
+ "<yi>Tpzzpun Spjluzl Rlf</><iy><iy>",
508
+ "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</>",
509
+ "<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</>.",
510
+ "<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.",
511
+ "Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."
512
+ ], sr = ["NWSc3", "zvsv", "wyv", "ibzpulzz", "vlt"], Mt = Object.fromEntries(
513
+ [
514
+ "2cgs7fdf4xb",
515
+ "1c9ctcccr4z",
516
+ "1q2pc4eebgb",
517
+ "ueokt0969w",
518
+ "w2zxchhgqz",
519
+ "1umuxblj2e5",
520
+ "2b5sdlfhbev",
521
+ "zo4ui3arjo",
522
+ "oclbb4thgl"
523
+ ].map((e, t) => [e, Math.max(0, t - 1)])
524
+ ), G = (e) => N(rr[e]), ir = (e) => N(sr[e]), cr = (e) => N(Q[e]), Rt = (e) => {
525
+ const t = e[N(Q[0])] || e[N(Q[1])] || e[N(Q[2])] || e[N(Q[3])];
526
+ if (!t) return -1;
527
+ const n = t.split("-");
528
+ let o = (function(r = "") {
529
+ let u = -2;
530
+ const l = Ot(N(r));
531
+ return l in Mt && (u = Mt[l]), u > 4 ? u - 4 : u;
532
+ })(n[0]);
533
+ return o === 0 || ((r) => r[2] === Ot(r[0] + r[1]))(n) || (o = -2), o;
534
+ };
535
+ function ar({ key: e, key2: t, mode: n, version: o }) {
536
+ const r = n, u = Rt({ key: e }), l = Rt({ key2: t });
537
+ if (s.mode = n = Math.max(u, l), n < 0) {
538
+ if (n = Math.min(u, l), g(`${G(n + 2)}${G(2)}`), U(o))
539
+ throw i.firstRun = !1, G(n + 2).replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
540
+ } else (!U(o) || r > -1 && n > r) && (sessionStorage.getItem("ifr") !== D && yo(`v${D} (${ir(n)})`, n), n < 2 && g(G(3)), sessionStorage.setItem("ifr", D));
541
+ }
542
+ const lr = "BackCompat", dr = `<rb>Quirks Mode Detected</>
543
+
544
+ This 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</>.
545
+
546
+ For more information see <u>https://iframe-resizer.com/quirks-mode</>.
547
+ `;
548
+ function ur() {
549
+ document.compatMode === lr && g(dr);
550
+ }
551
+ const fr = "complete";
552
+ let $t = !1;
553
+ function bn(e) {
554
+ document.readyState === fr ? Re(e) : $t || j(
555
+ document,
556
+ Vt,
557
+ () => bn(e)
558
+ ), $t = !0;
559
+ }
560
+ const mr = () => {
561
+ d(`Set targetOrigin for parent: %c${s.targetOrigin}`, c), s.autoResize !== !0 && a("Auto Resize disabled");
562
+ };
563
+ function vn() {
564
+ i.taggedElements = document.querySelectorAll(`[${Oe}]`), i.hasTags = i.taggedElements.length > 0, a(`Tagged elements found: %c${i.hasTags}`, c);
565
+ }
566
+ const hr = `<rb>Legacy version detected on parent page</>
567
+
568
+ Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
569
+
570
+ See <u>https://iframe-resizer.com/setup/</> for more details.
571
+ `, gr = (e) => `<b>Version mismatch</>
572
+
573
+ The parent and child pages are running different versions of <i>iframe resizer</>.
574
+
575
+ Parent page: ${e} - Child page: ${D}.
576
+ `;
577
+ function pr({ version: e }) {
578
+ !e || e === "" || e === Xn ? g(hr) : e !== D && g(gr(e));
579
+ }
580
+ const yr = tn(() => g(G(4)));
581
+ function br(e) {
582
+ if (!i.timerActive) return;
583
+ const t = _(performance.now() - i.totalTime), n = e === Se ? `Initialised iframe in %c${t}ms` : `Size calculated in %c${t}ms`;
584
+ a(n, c);
585
+ }
586
+ function vr(e) {
587
+ return e === void 0 ? e = s.targetOrigin : a(`Message targetOrigin: %c${e}`, c), e;
588
+ }
589
+ function wr(e, t) {
590
+ const { mode: n } = s, { sameOrigin: o, target: r } = i;
591
+ if (o)
592
+ try {
593
+ window.parent.iframeParentListener(he + e);
594
+ } catch (u) {
595
+ if (n === 1) yr();
596
+ else throw u;
597
+ return !1;
598
+ }
599
+ else r.postMessage(he + e, vr(t));
600
+ return !0;
601
+ }
602
+ function wn(e, t, n, o, r) {
603
+ const { parentId: u } = s, { sameOrigin: l } = i, p = `${e}:${t}`, v = `${u}:${p}:${n}${o === void 0 ? "" : `:${o}`}`;
604
+ s.mode < -1 || !wr(v, r) || (br(n), d(
605
+ `Sending message to parent page via ${l ? "sameOrigin" : "postMessage"}: %c%c${v}`,
606
+ jn,
607
+ c
608
+ ));
609
+ }
610
+ const y = et(
611
+ (e, t, n, o, r) => {
612
+ m(n), wn(e, t, n, o, r), B();
613
+ }
614
+ ), zr = (e) => y(0, 0, e.type, `${e.screenY}:${e.screenX}`);
615
+ function Tt(e, t) {
616
+ a(`Add event listener: %c${t}`, c), j(window.document, e, zr);
617
+ }
618
+ function Er({ mouseEvents: e }) {
619
+ e === !0 && (Tt(Fn, "Mouse Enter"), Tt(Wn, "Mouse Leave"));
620
+ }
621
+ const Sr = () => y(0, 0, Dn);
622
+ function Or({ persisted: e }) {
623
+ e || Sr(), m(Bt), d("Page persisted:", e), !e && nt.forEach(ro);
624
+ }
625
+ const Mr = () => j(window, so(Bt), Or), It = (e, t) => !(Math.abs(e - t) <= s.tolerance);
626
+ function Rr(e, t) {
627
+ const { calculateHeight: n, calculateWidth: o } = s, { height: r, width: u } = i;
628
+ return n && It(r, e) || o && It(u, t);
629
+ }
630
+ function $r(e) {
631
+ const t = s.onBeforeResize(e);
632
+ if (t === void 0)
633
+ throw new TypeError(
634
+ "No value returned from onBeforeResize(), expected a numeric value"
635
+ );
636
+ if (Number.isNaN(t))
637
+ throw new TypeError(
638
+ `Invalid value returned from onBeforeResize(): ${t}, expected Number`
639
+ );
640
+ if (t < X)
641
+ throw new RangeError(
642
+ `Out of range value returned from onBeforeResize(): ${t}, must be at least ${X}`
643
+ );
644
+ return t;
645
+ }
646
+ const zn = (e) => (t) => {
647
+ const n = e[t]();
648
+ return e.enabled() && s.onBeforeResize !== void 0 ? $r(n) : n;
649
+ }, Tr = zn(S), Ir = zn(O);
650
+ function Ar(e, t, n, o) {
651
+ const { heightCalcMode: r, widthCalcMode: u } = s, l = n ?? Tr(r), p = o ?? Ir(u), v = Rr(l, p) ? mt : e;
652
+ switch (a(`Resize event: %c${t}`, c), v) {
653
+ case Se:
654
+ case De:
655
+ case mt:
656
+ case Ze:
657
+ case Ye:
658
+ i.height = l, i.width = p;
659
+ // eslint-disable-next-line no-fallthrough
660
+ case qt:
661
+ return i;
662
+ // the following case needs {} to prevent a compile error on Next.js
663
+ case Qe:
664
+ case Yt:
665
+ case Zt:
666
+ case Qt: {
667
+ a(gt);
668
+ break;
669
+ }
670
+ default:
671
+ d(gt);
672
+ }
673
+ return null;
674
+ }
675
+ let ae = !1, Ce = !1, Z = null;
676
+ function Cr(e, t, n, o, r) {
677
+ const { autoResize: u } = s, { isHidden: l } = i;
678
+ switch (m(e), !0) {
679
+ case l === !0: {
680
+ if (Ce === !0) break;
681
+ a("Iframe hidden - Ignored resize request"), Ce = !0, ae = !1, cancelAnimationFrame(Z), Z = null;
682
+ break;
683
+ }
684
+ // Ignore overflowObserver here, as more efficient than using
685
+ // mutationObserver to detect OVERFLOW_ATTR changes
686
+ // Also allow manual and parent resize requests to bypass the pending check
687
+ case (ae === !0 && e !== Qe && !(e in ht)): {
688
+ a("Resize already pending - Ignored resize request");
689
+ break;
690
+ }
691
+ case (!u && !(e in ht)): {
692
+ d("Resizing disabled");
693
+ break;
694
+ }
695
+ default: {
696
+ Ce = !1, ae = !0, i.totalTime = performance.now(), i.timerActive = !0;
697
+ const p = Ar(
698
+ e,
699
+ t,
700
+ n,
701
+ o
702
+ );
703
+ p && wn(p.height, p.width, e, r), Z || (Z = requestAnimationFrame(() => {
704
+ ae = !1, Z = null, m("requestAnimationFrame"), pe(`Reset sendPending: %c${e}`, c);
705
+ })), i.timerActive = !1;
706
+ }
707
+ }
708
+ B();
709
+ }
710
+ const I = et(Cr);
711
+ function At({ eventType: e, eventName: t }) {
712
+ j(window, t, () => I(t, e), { passive: !0 });
713
+ }
714
+ function kr() {
715
+ At({
716
+ eventType: "After Print",
717
+ eventName: "afterprint"
718
+ }), At({
719
+ eventType: "Before Print",
720
+ eventName: "beforeprint"
721
+ });
722
+ }
723
+ function Nr() {
724
+ if (i.triggerLocked) {
725
+ a("TriggerLock blocked calculation");
726
+ return;
727
+ }
728
+ i.triggerLocked = !0, pe("Trigger event lock on"), requestAnimationFrame(() => {
729
+ i.triggerLocked = !1, pe("Trigger event lock off");
730
+ });
731
+ }
732
+ function En(e) {
733
+ const { heightCalcMode: t, widthCalcMode: n } = s, o = S[t](), r = O[n]();
734
+ a(`Reset trigger event: %c${e}`, c), y(o, r, e);
735
+ }
736
+ function Pr(e) {
737
+ const t = s.heightCalcMode;
738
+ a(`Reset trigger event: %c${e}`, c), s.heightCalcMode = Ke, Nr(), En("reset"), s.heightCalcMode = t;
739
+ }
740
+ const Lr = `Auto Resize can not be changed when <b>direction</> is set to '${Je}'.`;
741
+ function jr(e) {
742
+ $(e, Qn, "parentIframe.autoResize(enable) enable");
743
+ const { autoResize: t, calculateHeight: n, calculateWidth: o } = s;
744
+ return o === !1 && n === !1 ? (m(De), g(Lr), !1) : (e === !0 && t === !1 ? (s.autoResize = !0, queueMicrotask(() => I(De, "Auto Resize enabled"))) : e === !1 && t === !0 && (s.autoResize = !1), y(0, 0, _n, JSON.stringify(s.autoResize)), s.autoResize);
745
+ }
746
+ function xr(e) {
747
+ s.heightCalcMode = e, pn();
748
+ }
749
+ function _r(e) {
750
+ s.widthCalcMode = e, yn();
751
+ }
752
+ function Dr(e) {
753
+ $(e, oe, "parentIframe.moveToAnchor(anchor) anchor"), i.inPageLinks.findTarget(e);
754
+ }
755
+ function Br(e) {
756
+ $(e, L, "parentIframe.setOffsetSize(offset) offset"), s.offsetHeight = e, s.offsetWidth = e, I(qt, `parentIframe.setOffsetSize(${e})`);
757
+ }
758
+ function Hr() {
759
+ return m("getOrigin"), cn("getOrigin()", "getParentOrigin()"), i.origin;
760
+ }
761
+ const Fr = () => i.origin;
762
+ function Wr(e) {
763
+ $(
764
+ e,
765
+ oe,
766
+ "parentIframe.setTargetOrigin(targetOrigin) targetOrigin"
767
+ ), a(`Set targetOrigin: %c${e}`, c), s.targetOrigin = e;
768
+ }
769
+ function Ur(e) {
770
+ if (typeof e === re) {
771
+ i.onPageInfo = e, y(0, 0, Ht), vo(
772
+ "getPageInfo()",
773
+ "getParentProps()",
774
+ "See <u>https://iframe-resizer.com/upgrade</> for details. "
775
+ );
776
+ return;
777
+ }
778
+ i.onPageInfo = null, y(0, 0, Un);
779
+ }
780
+ function Sn(e) {
781
+ return $(
782
+ e,
783
+ re,
784
+ "parentIframe.getParentProps(callback) callback"
785
+ ), i.onParentInfo = e, y(0, 0, Ft), () => {
786
+ i.onParentInfo = null, y(0, 0, Gn);
787
+ };
788
+ }
789
+ function Gr(e) {
790
+ cn("getParentProperties()", "getParentProps()"), Sn(e);
791
+ }
792
+ const Vr = (e) => `<rb>Deprecated API object name</>
793
+ The <b>window.parentIFrame</> object has been renamed to <b>window.parentIframe</>. Please update your code as the old object will be removed in a future version.
794
+
795
+ Called property: '${String(e)}'
796
+ `;
797
+ function qr(e) {
798
+ const t = /* @__PURE__ */ new Set();
799
+ return new Proxy(e, {
800
+ get(n, o) {
801
+ t.has(o) || (g(Vr(o)), t.add(o));
802
+ const r = n[o], u = Object.getOwnPropertyDescriptor(n, o);
803
+ return u && !u.configurable && !u.writable ? r : typeof r == "function" ? r.bind(n) : r;
804
+ }
805
+ });
806
+ }
807
+ function Zr(e, t) {
808
+ e !== void 0 && $(
809
+ e,
810
+ L,
811
+ "parentIframe.resize(customHeight, customWidth) customHeight"
812
+ ), t !== void 0 && $(
813
+ t,
814
+ L,
815
+ "parentIframe.resize(customHeight, customWidth) customWidth"
816
+ );
817
+ const n = `${e || ""}${t ? `,${t}` : ""}`;
818
+ I(
819
+ Ze,
820
+ `parentIframe.resize(${n})`,
821
+ e,
822
+ t
823
+ );
824
+ }
825
+ const st = (e) => (t, n) => {
826
+ $(t, L, `parentIframe.${e}(x, y) x`), $(n, L, `parentIframe.${e}(x, y) y`), y(n, t, e);
827
+ }, Yr = st(Vn), Qr = st(qn), Jr = st(Wt);
828
+ function Kr(e, t) {
829
+ t && $(
830
+ t,
831
+ oe,
832
+ "parentIframe.sendMessage(msg, targetOrigin) targetOrigin"
833
+ ), y(0, 0, je, JSON.stringify(e), t);
834
+ }
835
+ const Xr = () => y(0, 0, Bn), es = () => s.parentId, ts = () => Pr("parentIframe.reset"), ns = () => T("parentIframe.size() has been renamed parentIframe.resize()");
836
+ function os() {
837
+ const { win: e } = i;
838
+ s.mode !== 1 && (e.parentIframe = Object.freeze({
839
+ autoResize: jr,
840
+ close: Xr,
841
+ getId: es,
842
+ getOrigin: Hr,
843
+ // TODO Remove in V6
844
+ getParentOrigin: Fr,
845
+ getPageInfo: Ur,
846
+ // TODO Remove in V6
847
+ getParentProps: Sn,
848
+ getParentProperties: Gr,
849
+ // TODO Remove in V6
850
+ moveToAnchor: Dr,
851
+ reset: ts,
852
+ setOffsetSize: Br,
853
+ scrollBy: Yr,
854
+ scrollTo: Qr,
855
+ scrollToOffset: Jr,
856
+ sendMessage: Kr,
857
+ setHeightCalculationMethod: xr,
858
+ setWidthCalculationMethod: _r,
859
+ setTargetOrigin: Wr,
860
+ resize: Zr,
861
+ size: ns
862
+ // TODO Remove in V6
863
+ }), e.parentIFrame = qr(e.parentIframe));
864
+ }
865
+ const se = (e = "") => (t) => (n) => {
866
+ n.size > 0 && pe(
867
+ `${t}Observer ${e}:`,
868
+ ...Array.from(n).flatMap((o) => [qe, o])
869
+ );
870
+ }, rs = (e = "") => (t) => (n) => {
871
+ n.size > 0 && sn(
872
+ `${t}Observer ${e}:`,
873
+ ...Array.from(n).flatMap((o) => [qe, o])
874
+ );
875
+ }, On = se("attached to"), Mn = rs("already attached"), ss = se("detached from"), $e = (e, t = !0) => (n) => {
876
+ n > 0 && d(
877
+ `${t ? "At" : "De"}tached %c${e}Observer%c ${t ? "to" : "from"} %c${n}%c element${n === 1 ? "" : "s"}`,
878
+ c,
879
+ K,
880
+ c,
881
+ K
882
+ );
883
+ }, Rn = (e, t, n, o) => {
884
+ const r = ss(e);
885
+ return (u) => {
886
+ const l = /* @__PURE__ */ new Set();
887
+ let p = 0;
888
+ for (const v of u)
889
+ n.has(v) && (t.unobserve(v), n.delete(v), l.add(v), p += 1);
890
+ r(l), o(p), l.clear();
891
+ };
892
+ }, Ct = 16, kt = 2, is = 200, it = "Mutation", M = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set(), Fe = /* @__PURE__ */ new Set(), we = [], cs = {
893
+ attributes: !0,
894
+ attributeFilter: [te, Oe],
895
+ attributeOldValue: !1,
896
+ characterData: !1,
897
+ characterDataOldValue: !1,
898
+ childList: !0,
899
+ subtree: !0
900
+ };
901
+ let ke = 1, ct, We = !1, Ue = 0;
902
+ const as = se("added")(it), ls = se("removed (page)")(it), ds = se("removed (added)")(it), $n = (e) => e.nodeType !== Node.ELEMENT_NODE || en.has(e.tagName.toLowerCase());
903
+ function us(e) {
904
+ const t = e.addedNodes;
905
+ for (const n of t)
906
+ $n(n) || M.add(n);
907
+ }
908
+ function fs(e) {
909
+ const t = e.removedNodes;
910
+ for (const n of t)
911
+ $n(n) || (M.has(n) ? (M.delete(n), Fe.add(n)) : P.add(n));
912
+ }
913
+ const ms = (e) => {
914
+ d("Mutations:", e);
915
+ for (const t of e)
916
+ us(t), fs(t);
917
+ as(M), ls(P), ds(Fe), Fe.clear();
918
+ };
919
+ function hs() {
920
+ P.size > 0 && a(
921
+ `Detected %c${P.size} %cremoved element${P.size > 1 ? "s" : ""}`,
922
+ c,
923
+ w
924
+ ), M.size > 0 && a(
925
+ `Found %c${M.size} %cnew element${M.size > 1 ? "s" : ""}`,
926
+ c,
927
+ w
928
+ );
929
+ }
930
+ const gs = (e) => () => {
931
+ const t = performance.now(), n = t - Ue, o = Ct * ke++ + kt;
932
+ if (n > o && n < is) {
933
+ m("mutationThrottled"), d("Update delayed due to heavy workload on the callStack"), d(
934
+ `EventLoop busy time: %c${_(n)}ms %c> Max wait: %c${o - kt}ms`,
935
+ c,
936
+ w,
937
+ c
938
+ ), setTimeout(ct, Ct * ke), Ue = t;
939
+ return;
940
+ }
941
+ ke = 1, we.forEach(ms), we.length = 0, We = !1, hs(), e({ addedNodes: M, removedNodes: P }), M.clear(), P.clear();
942
+ };
943
+ function ps(e) {
944
+ we.push(e), !We && (Ue = performance.now(), We = !0, requestAnimationFrame(ct));
945
+ }
946
+ function ys(e) {
947
+ const t = new window.MutationObserver(ps), n = document.body || document.documentElement;
948
+ return ct = gs(e), t.observe(n, cs), d("Attached%c MutationObserver%c to body", c, w), {
949
+ ...t,
950
+ disconnect: () => {
951
+ M.clear(), P.clear(), we.length = 0, t.disconnect(), d("Detached%c MutationObserver", c);
952
+ }
953
+ };
954
+ }
955
+ const bs = {
956
+ characterData: !0,
957
+ childList: !0,
958
+ subtree: !0
959
+ };
960
+ function vs(e) {
961
+ const t = document.querySelector("title") ?? document.head ?? document.documentElement, n = new MutationObserver(e);
962
+ return n.observe(t, bs), d("Attached%c TitleObserver%c to head", c, w), setTimeout(e), {
963
+ disconnect: () => {
964
+ n.disconnect(), d("Detached%c TitleObserver", c);
965
+ }
966
+ };
967
+ }
968
+ function ws(e) {
969
+ const t = new IntersectionObserver(
970
+ (o) => e(o.at(-1)?.isIntersecting ?? !1),
971
+ {
972
+ threshold: 0
973
+ }
974
+ ), n = document.documentElement;
975
+ return t.observe(n), d("Attached%c VisibilityObserver%c to page", c, w), {
976
+ disconnect: () => {
977
+ t.disconnect(), d("Detached%c VisibilityObserver", c);
978
+ }
979
+ };
980
+ }
981
+ let Nt = /* @__PURE__ */ new Set();
982
+ function zs(e) {
983
+ const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
984
+ for (const o of e)
985
+ o.closest(`[${te}]`) ? n.add(o) : t.add(o);
986
+ return n.size > 0 && queueMicrotask(() => {
987
+ m("overflowIgnored"), d(`Ignoring elements with [data-iframe-ignore] > *:
988
+ `, n), B();
989
+ }), t;
990
+ }
991
+ function Tn() {
992
+ const e = document.querySelectorAll(`[${Ut}]`), t = zs(e);
993
+ let n = !1;
994
+ return typeof Set.prototype.symmetricDifference === re && (n = t.symmetricDifference(Nt).size > 0), Nt = t, i.overflowedNodeSet = t, i.hasOverflow = t.size > 0, { hasOverflowUpdated: n, overflowedNodeSet: t };
995
+ }
996
+ const R = {}, In = (e) => {
997
+ const t = /* @__PURE__ */ new Set();
998
+ for (const n of e) {
999
+ t.add(n);
1000
+ for (const o of ot(n)) t.add(o);
1001
+ }
1002
+ return d(`Inspecting:
1003
+ `, t), t;
1004
+ }, Es = (e) => {
1005
+ if (e.size === 0) return;
1006
+ m("addObservers");
1007
+ const t = In(e);
1008
+ R.overflow.attachObservers(t), R.resize.attachObserverToNonStaticElements(t), B();
1009
+ }, Ss = (e) => {
1010
+ if (e.size === 0) return;
1011
+ m("removeObservers");
1012
+ const t = In(e);
1013
+ R.overflow.detachObservers(t), R.resize.detachObservers(t), B();
1014
+ };
1015
+ function Os({ addedNodes: e, removedNodes: t }) {
1016
+ m("contentMutated"), i.applySelectors(), vn(), Tn(), B(), Ss(t), Es(e);
1017
+ }
1018
+ function Ms(e) {
1019
+ Os(e), I(Yt, "Mutation Observed");
1020
+ }
1021
+ const ie = "Overflow", Rs = $e(ie), $s = $e(ie, !1), Ts = On(ie), Is = Mn(ie), As = (e) => e.hidden || e.offsetParent === null || e.style.display === Je, Cs = (e, t) => {
1022
+ const n = t.side, o = {
1023
+ root: t.root,
1024
+ rootMargin: "0px",
1025
+ threshold: 1
1026
+ }, r = window?.requestAnimationFrame || ge, u = (E = !1) => e(E), l = (E, A) => E === 0 || E > A[n], p = (E, A) => E.toggleAttribute(Ut, A);
1027
+ function v(E) {
1028
+ for (const A of E) {
1029
+ const { boundingClientRect: V, rootBounds: q, target: C } = A;
1030
+ if (!q) continue;
1031
+ const Nn = V[n], Pn = l(Nn, q) && !As(C);
1032
+ p(C, Pn);
1033
+ }
1034
+ r(u);
1035
+ }
1036
+ const f = new IntersectionObserver(v, o), z = /* @__PURE__ */ new WeakSet();
1037
+ function h(E) {
1038
+ const A = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set();
1039
+ let q = 0;
1040
+ for (const C of E)
1041
+ if (C.nodeType === Node.ELEMENT_NODE) {
1042
+ if (z.has(C)) {
1043
+ A.add(C);
1044
+ continue;
1045
+ }
1046
+ f.observe(C), z.add(C), V.add(C), q += 1;
1047
+ }
1048
+ Is(A), Ts(V), Rs(q), V.clear(), A.clear();
1049
+ }
1050
+ return {
1051
+ attachObservers: h,
1052
+ detachObservers: Rn(
1053
+ ie,
1054
+ f,
1055
+ z,
1056
+ $s
1057
+ ),
1058
+ disconnect: () => {
1059
+ f.disconnect(), d("Detached%c OverflowObserver", c);
1060
+ }
1061
+ };
1062
+ };
1063
+ function ks() {
1064
+ const { hasOverflow: e } = i, { hasOverflowUpdated: t, overflowedNodeSet: n } = Tn();
1065
+ switch (!0) {
1066
+ case !t:
1067
+ return;
1068
+ case n.size > 1:
1069
+ d("Overflowed Elements:", n);
1070
+ break;
1071
+ case e:
1072
+ break;
1073
+ default:
1074
+ d("No overflow detected");
1075
+ }
1076
+ I(Qe, "Overflow updated");
1077
+ }
1078
+ function Ns(e) {
1079
+ const t = {
1080
+ root: document.documentElement,
1081
+ side: s.calculateHeight ? xe : _e
1082
+ };
1083
+ return R.overflow = Cs(ks, t), R.overflow.attachObservers(e), R.overflow;
1084
+ }
1085
+ const ce = "Resize", Ps = $e(ce), Ls = $e(ce, !1), js = On(ce), xs = Mn(ce), ze = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Set();
1086
+ let J;
1087
+ function _s(e) {
1088
+ let t = 0;
1089
+ for (const n of e) {
1090
+ if (n.nodeType !== Node.ELEMENT_NODE) continue;
1091
+ const o = getComputedStyle(n)?.position;
1092
+ if (!(o === "" || o === "static")) {
1093
+ if (ze.has(n)) {
1094
+ Ne.add(n);
1095
+ continue;
1096
+ }
1097
+ J.observe(n), ze.add(n), Pe.add(n), t += 1;
1098
+ }
1099
+ }
1100
+ xs(Ne), js(Pe), Ps(t), Pe.clear(), Ne.clear();
1101
+ }
1102
+ const Ds = (e) => (J = new ResizeObserver(e), J.observe(document.body), ze.add(document.body), d("Attached%c ResizeObserver%c to body", c, w), {
1103
+ attachObserverToNonStaticElements: _s,
1104
+ detachObservers: Rn(
1105
+ ce,
1106
+ J,
1107
+ ze,
1108
+ Ls
1109
+ ),
1110
+ disconnect: () => {
1111
+ J.disconnect(), d("Detached%c ResizeObserver", c);
1112
+ }
1113
+ });
1114
+ function Bs(e) {
1115
+ if (!Array.isArray(e) || e.length === 0) return;
1116
+ const t = e[0].target;
1117
+ I(Zt, `Element resized <${io(t)}>`);
1118
+ }
1119
+ function Hs(e) {
1120
+ return R.resize = Ds(Bs), R.resize.attachObserverToNonStaticElements(e), R.resize;
1121
+ }
1122
+ let Pt;
1123
+ function Fs() {
1124
+ const e = document.title;
1125
+ e !== Pt && (Pt = e, a(`Title: %c${e}`, c), e && y(0, 0, Zn, e));
1126
+ }
1127
+ function Ws(e) {
1128
+ a(`Visible: %c${e}`, c), i.isHidden = !e, I(Qt, "Visibility changed");
1129
+ }
1130
+ function Us(e) {
1131
+ nt.push(...e.map((t) => t.disconnect));
1132
+ }
1133
+ function Gs() {
1134
+ m("attachObservers");
1135
+ const e = ot(document.documentElement), t = [
1136
+ ys(Ms),
1137
+ Ns(e),
1138
+ qo(),
1139
+ Hs(e),
1140
+ vs(Fs),
1141
+ ws(Ws)
1142
+ ];
1143
+ Us(t);
1144
+ }
1145
+ const Lt = (e, t, n) => {
1146
+ if (n !== "") {
1147
+ a(`${e}: %c${n}`, c);
1148
+ for (const o of document.querySelectorAll(n))
1149
+ a(`Applying ${t} to:`, o), o.toggleAttribute(t, !0);
1150
+ }
1151
+ };
1152
+ function Vs({ sizeSelector: e, ignoreSelector: t }) {
1153
+ return () => {
1154
+ Lt("sizeSelector", Oe, e), Lt("ignoreSelector", te, t);
1155
+ };
1156
+ }
1157
+ function qs() {
1158
+ const e = document.createElement("div");
1159
+ e.style.clear = "both", e.style.display = "block", e.style.height = "0", document.body.append(e);
1160
+ }
1161
+ function Zs(e, t) {
1162
+ return t.includes("-") && (T(`Negative CSS value ignored for ${e}`), t = ""), t;
1163
+ }
1164
+ function Ge(e, t) {
1165
+ t === void 0 || t === "" || t === eo || (document.body.style.setProperty(e, t), d(`Set body ${e}: %c${t}`, c));
1166
+ }
1167
+ function Ys({ bodyMarginStr: e, bodyMargin: t }) {
1168
+ e === void 0 && (e = `${t}px`), Ge("margin", Zs("margin", e));
1169
+ }
1170
+ const Qs = () => ({
1171
+ x: document.documentElement.scrollLeft,
1172
+ y: document.documentElement.scrollTop
1173
+ });
1174
+ function Js(e) {
1175
+ const t = e.getBoundingClientRect(), n = Qs();
1176
+ return {
1177
+ x: parseInt(t.left, W) + parseInt(n.x, W),
1178
+ y: parseInt(t.top, W) + parseInt(n.y, W)
1179
+ };
1180
+ }
1181
+ function Ks(e, t) {
1182
+ const n = Js(t);
1183
+ a(
1184
+ `Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,
1185
+ c,
1186
+ w,
1187
+ c,
1188
+ w,
1189
+ c
1190
+ ), y(n.y, n.x, Wt);
1191
+ }
1192
+ function at(e) {
1193
+ const t = e.split("#")[1] || e, n = decodeURIComponent(t), o = document.getElementById(n) || document.getElementsByName(n)[0];
1194
+ if (o !== void 0) {
1195
+ Ks(t, o);
1196
+ return;
1197
+ }
1198
+ a(`In page link (#${t}) not found in iframe, so sending to parent`), y(0, 0, Hn, `#${t}`);
1199
+ }
1200
+ function An() {
1201
+ const { hash: e, href: t } = window.location;
1202
+ e !== "" && e !== "#" && at(t);
1203
+ }
1204
+ function Xs() {
1205
+ for (const e of document.querySelectorAll('a[href^="#"]'))
1206
+ e.getAttribute("href") !== "#" && j(e, "click", (t) => {
1207
+ t.preventDefault(), at(e.getAttribute("href"));
1208
+ });
1209
+ }
1210
+ function ei() {
1211
+ j(window, "hashchange", An);
1212
+ }
1213
+ function ti() {
1214
+ setTimeout(An, Xt);
1215
+ }
1216
+ function ni() {
1217
+ a("Setting up location.hash handlers"), Xs(), ei(), ti(), i.inPageLinks = {
1218
+ findTarget: at
1219
+ };
1220
+ }
1221
+ function oi(e) {
1222
+ const { mode: t } = s;
1223
+ e ? t === 1 ? g(G(5)) : ni() : a("In page linking not enabled");
1224
+ }
1225
+ const ri = "important";
1226
+ function si() {
1227
+ const e = (t) => t.style.setProperty(ne, Me, ri);
1228
+ e(document.documentElement), e(document.body), a("Set HTML & body height: %cauto !important", c);
1229
+ }
1230
+ const ii = "custom", ci = (e) => `<rb>Deprecated Option(${e}CalculationMethod)</>
1231
+
1232
+ The use of <b>${e}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.
1233
+
1234
+ See <u>https://iframe-resizer.com/api/child</> for more details.
1235
+ `;
1236
+ function jt(e, t) {
1237
+ return typeof e !== re ? e : (g(ci(t)), t === ne ? S.custom = e : O.custom = e, ii);
1238
+ }
1239
+ const lt = (e) => (t, n) => {
1240
+ if (n in t) {
1241
+ if (typeof t[n] === e) return t[n];
1242
+ throw new TypeError(`${n} is not a ${e}.`);
1243
+ }
1244
+ }, Le = lt(re), le = lt(L), de = lt(oe), ai = (e) => e !== null && typeof e === Jn && !Array.isArray(e);
1245
+ function li(e) {
1246
+ const { calculateHeight: t, calculateWidth: n } = s;
1247
+ let o, r;
1248
+ return typeof e?.offset === L && (wo(Ie, Ae), t && (o = le(e, Ie)), n && (r = le(e, Ie))), typeof e?.offsetSize === L && (t && (o = le(e, Ae)), n && (r = le(e, Ae))), { offsetHeight: o, offsetWidth: r };
1249
+ }
1250
+ function di(e) {
1251
+ a("Reading data from page:", Object.keys(e));
1252
+ const { offsetHeight: t, offsetWidth: n } = li(e);
1253
+ return {
1254
+ offsetHeight: t,
1255
+ offsetWidth: n,
1256
+ ignoreSelector: de(e, "ignoreSelector"),
1257
+ key2: de(e, cr(0)),
1258
+ sizeSelector: de(e, "sizeSelector"),
1259
+ targetOrigin: de(e, "targetOrigin"),
1260
+ heightCalcMode: jt(
1261
+ e?.heightCalculationMethod,
1262
+ ne
1263
+ ),
1264
+ widthCalcMode: jt(e?.widthCalculationMethod, Gt),
1265
+ onBeforeResize: Le(e, "onBeforeResize"),
1266
+ onMessage: Le(e, "onMessage"),
1267
+ onReady: Le(e, "onReady")
1268
+ };
1269
+ }
1270
+ function ui() {
1271
+ const { mode: e } = s;
1272
+ if (e === 1) return {};
1273
+ const t = window.iframeResizer || window.iFrameResizer;
1274
+ return ai(t) ? di(t) : {};
1275
+ }
1276
+ const fi = (e) => e === "true", Cn = (e) => (t) => t === void 0 ? void 0 : e(t), x = Cn(fi), Y = Cn(Number), mi = (e) => ({
1277
+ parentId: e[0],
1278
+ bodyMargin: Y(e[1]),
1279
+ calculateWidth: x(e[2]),
1280
+ logging: x(e[3]),
1281
+ // data[4] no longer used (was intervalTimer)
1282
+ autoResize: x(e[6]),
1283
+ bodyMarginStr: e[7],
1284
+ heightCalcMode: e[8],
1285
+ bodyBackground: e[9],
1286
+ bodyPadding: e[10],
1287
+ tolerance: Y(e[11]),
1288
+ inPageLinks: x(e[12]),
1289
+ // data[13] no longer used (was resizeFrom)
1290
+ widthCalcMode: e[14],
1291
+ mouseEvents: x(e[15]),
1292
+ offsetHeight: Y(e[16]),
1293
+ offsetWidth: Y(e[17]),
1294
+ calculateHeight: x(e[18]),
1295
+ key: e[19],
1296
+ version: e[20],
1297
+ mode: Y(e[21]),
1298
+ // sizeSelector: data[22] // Now only available via page settings
1299
+ logExpand: x(e[23])
1300
+ });
1301
+ function hi(e) {
1302
+ const { mode: t } = s;
1303
+ e.forEach((n) => {
1304
+ try {
1305
+ n();
1306
+ } catch (o) {
1307
+ if (t < 0) throw o;
1308
+ g(
1309
+ `<rb>Error in setup function</>
1310
+ <i>iframe-resizer</> detected an error during setup.
1311
+
1312
+ Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`
1313
+ ), sn(o);
1314
+ }
1315
+ });
1316
+ }
1317
+ function xt(e) {
1318
+ for (const [t, n] of Object.entries(e))
1319
+ n !== void 0 && (s[t] = n);
1320
+ }
1321
+ function gi({
1322
+ logExpand: e,
1323
+ logging: t,
1324
+ parentId: n
1325
+ }) {
1326
+ po({ id: n, enabled: t, expand: e }), m("initReceived"), a(`Initialising iframe v${D} ${window.location.href}`);
1327
+ }
1328
+ function pi(e) {
1329
+ m("ready"), bn(tn(e)), a("Initialization complete", (({ key: t, key2: n, ...o }) => o)(s));
1330
+ }
1331
+ function yi({
1332
+ bodyBackground: e,
1333
+ bodyPadding: t,
1334
+ inPageLinks: n,
1335
+ onReady: o
1336
+ }) {
1337
+ const r = Po(s), u = [
1338
+ () => pr(s),
1339
+ () => ar(s),
1340
+ or,
1341
+ Xo,
1342
+ pn,
1343
+ yn,
1344
+ tr,
1345
+ ur,
1346
+ vn,
1347
+ mr,
1348
+ r ? ge : No,
1349
+ () => Ys(s),
1350
+ () => Ge("background", e),
1351
+ () => Ge("padding", t),
1352
+ r ? ge : si,
1353
+ qs,
1354
+ i.applySelectors,
1355
+ () => oi(n),
1356
+ kr,
1357
+ () => Er(s),
1358
+ Mr,
1359
+ () => os(),
1360
+ () => I(
1361
+ Se,
1362
+ "Init message from host page",
1363
+ void 0,
1364
+ void 0,
1365
+ `${D}:${s.mode}`
1366
+ ),
1367
+ Gs,
1368
+ B
1369
+ ];
1370
+ hi(u), pi(o);
1371
+ }
1372
+ function bi(e) {
1373
+ i.firstRun && (xt(mi(e)), gi(s), xt(ui()), i.applySelectors = Vs(s), yi(s));
1374
+ }
1375
+ function vi(e) {
1376
+ if (document.readyState === "loading") {
1377
+ a("Page not ready, ignoring init message");
1378
+ return;
1379
+ }
1380
+ const t = e.data.slice(Jt).split(Ee);
1381
+ i.target = e.source, i.origin = e.origin, bi(t), i.firstRun = !1, setTimeout(() => {
1382
+ i.initLock = !1;
1383
+ }, Xt);
1384
+ }
1385
+ const { freeze: wi } = Object, { parse: dt } = JSON, ut = (e) => wi(dt(e)), kn = (e) => y(0, 0, `${e}Stop`), Te = (e) => e.data.slice(e.data.indexOf(Ee) + 1), zi = (e) => So(e) ? Se : e.data.split("]")[1].split(Ee)[0];
1386
+ function Ei(e) {
1387
+ const t = Te(e);
1388
+ a("onMessage called from parent:%c", c, ut(t)), Re(s.onMessage, dt(t));
1389
+ }
1390
+ function Si(e) {
1391
+ const { onPageInfo: t } = i, n = Te(e);
1392
+ a("PageInfo received from parent:", ut(n)), t ? Re(t, dt(n)) : kn(Ht);
1393
+ }
1394
+ function Oi(e) {
1395
+ const { onParentInfo: t } = i, n = ut(Te(e));
1396
+ a("ParentInfo received from parent:", n), t ? Re(t, n) : kn(Ft);
1397
+ }
1398
+ function Mi() {
1399
+ if (i.initLock) {
1400
+ a("Page reset ignored by init");
1401
+ return;
1402
+ }
1403
+ a("Page size reset by host page"), En("resetPage");
1404
+ }
1405
+ function Ri() {
1406
+ a("Resize requested by host page"), I(Ye, "Parent window requested size check");
1407
+ }
1408
+ const _t = (e) => i.inPageLinks.findTarget(Te(e)), Dt = {
1409
+ init: vi,
1410
+ reset: Mi,
1411
+ resize: Ri,
1412
+ moveToAnchor: _t,
1413
+ inPageLink: _t,
1414
+ // Backward compatibility
1415
+ pageInfo: Si,
1416
+ parentInfo: Oi,
1417
+ message: Ei
1418
+ };
1419
+ function $i(e) {
1420
+ const { firstRun: t } = i, n = zi(e);
1421
+ switch (m(n), !0) {
1422
+ case n in Dt:
1423
+ Dt[n](e);
1424
+ break;
1425
+ case (t && Eo()):
1426
+ T(
1427
+ `Ignored message of type "${n}". Received before initialization.`
1428
+ );
1429
+ break;
1430
+ default:
1431
+ T(
1432
+ `Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`
1433
+ );
1434
+ }
1435
+ }
1436
+ const ue = et((e) => {
1437
+ zo(e) && $i(e);
1438
+ });
1439
+ function Ti() {
1440
+ if ("iframeChildListener" in window) {
1441
+ T("Already setup");
1442
+ return;
1443
+ }
1444
+ window.iframeChildListener = (t) => setTimeout(() => ue({ data: t, sameOrigin: !0 })), m("listen"), j(window, je, ue), j(document, Vt, vt), vt();
1445
+ function e(t) {
1446
+ return ue(t), i.win;
1447
+ }
1448
+ try {
1449
+ top?.document?.getElementById("banner") && (i.win = {}, window.mockMsgListener = e, ln(window, je, ue), typeof window.define == "function" && window.define([], () => e));
1450
+ } catch {
1451
+ }
1452
+ }
1453
+ typeof window !== Kn && Ti();
1454
+ //# sourceMappingURL=index.esm.js.map