@iframe-resizer/child 5.5.1-beta.1 → 5.5.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.cjs.js +2 -2
- package/index.cjs.js.map +1 -1
- package/index.esm.js +2 -2
- package/index.esm.js.map +1 -1
- package/index.umd.js +2 -2
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.5.
|
|
4
|
+
* @module iframe-resizer/child 5.5.2-beta.1 (cjs) - 2025-08-03
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
"use strict";const e=require("auto-console-group"),t="5.5.1-beta.1",n="iframeResizer",o=10,r="data-iframe-size",i="data-iframe-overflowed",a="data-iframe-ignore",s="bottom",l="right",c="autoResizeEnabled",u=Symbol("sizeChanged"),d="manualResize",f={},m="setOffsetSize",p="resizeObserver",h="overflowObserver",g="mutationObserver",y="visibilityObserver",b="none",v="No change in content size detected",z="init",w=(e,t,n,o)=>e.addEventListener(t,n,o||!1),$=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)},I=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),O=["spjluzl","rlf","clyzpvu"],S=["<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."],T=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],H=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),M=e=>I(S[e]),E=e=>{const t=e[I(O[0])]||e[I(O[1])]||e[I(O[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=$(I(e));return n in H&&(t=H[n]),t}(n[0]);return 0===o||(e=>e[2]===$(e[0]+e[1]))(n)||(o=-2),o},k=(e,...t)=>setTimeout(()=>e(...t),0),j=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,R=e=>Math.round(1e3*e)/1e3,G=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>""!=`${e}`&&void 0!==e;const L=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${G(t)}`)};let x=!0,P=n;var C;const q=(C=e,C?.__esModule?C.default:C)({label:`${n}(child)`});const B=(D="log",(...e)=>!x||q[D](...e));var D;const F=B;const{assert:W,debug:U,endAutoGroup:V,error:Z,errorBoundary:J,event:_,label:Q,purge:Y,warn:X}=q,K=e=>{return q.warn((t=A,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},ee=K,te=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>K(t)),ne=te("Method"),oe=te("Method","replaced with"),re=te("Option"),ie=["min-height","min-width","max-height","max-width"],ae=new Set,se=e=>e.tagName?e.tagName.toLowerCase():"unknown",le=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ce=(e,t)=>{return(n=le(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function ue({href:e}){ae.has(e)||(B("Unable to access stylesheet:",e),ae.add(e))}const de=(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){ue(n)}return{source:"cross-origin stylesheet",value:le(e,t)}}(e,t),fe=(e,t)=>{const{source:n,value:o}=de(e,t),r=se(e);K(`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 me(){for(const e of[document.documentElement,document.body])for(const t of ie)B(`Checking <${se(e)}> for blocking CSS: ${t}`),ce(e,t)&&fe(e,t)}const pe=e=>t=>void 0===t?void 0:e(t),he=pe(e=>"true"===e),ge=pe(Number),ye=new Set,be=new Set,ve=[];let ze,we=1,$e=!1,Ie=0;const Oe=e=>{B("Mutations:",e);for(const t of e){const{addedNodes:e,removedNodes:n}=t;for(const t of e)ye.add(t);for(const e of n)ye.has(e)?ye.delete(e):be.add(e)}};function Se(e){ve.push(e),$e||(Ie=performance.now(),$e=!0,requestAnimationFrame(ze))}function Te(t){const n=new window.MutationObserver(Se),o=document.querySelector("body"),i={attributes:!0,attributeFilter:[a,r],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return ze=(t=>()=>{const n=performance.now(),o=n-Ie,r=16*we+++2;if(o>r&&o<200)return _("MutationDelay"),F("Update delayed due to heavy workload on the callStack"),F(`EventLoop busy time: %c${R(o)}ms %c> Max wait: %c${r-2}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(ze,16*we),void(Ie=n);we=1,ve.forEach(Oe),ve.length=0,t({addedMutations:ye,removedMutations:be}),$e=!1,ye.clear(),be.clear()})(t),n.observe(o,i),F("Attached MutationObserver to body"),n}const He=(t,n=!0)=>o=>{o>0&&F(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,e.HIGHLIGHT,e.NORMAL)},Me=(e,t,n)=>e=>{let o=0;for(const r of e)n.has(r)&&(t.unobserve(r),n.delete(r),o+=1);return o},Ee=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,ke=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||A,a=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[n],l=(e,t)=>e.toggleAttribute(i,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t,i=e[n],a=s(i,o)&&!Ee(r);l(r,a)}r(a)},o),u=new WeakSet;return{attachObservers:function(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=u.has(n);e&&(W(!o,"Node already observed for overflow",n),o||(c.observe(n),u.add(n),t+=1))}return t},detachObservers:Me(0,c,u)}},je="--ifr-start",Ae="--ifr-end",Re=[],Ge=new WeakSet,Ne=e=>"object"==typeof e&&Ge.add(e);let Le={},xe=0;function Pe(e){e.getEntries().forEach(e=>{if(e.name===Ae){const{duration:t}=performance.measure("--ifr-measure",je,Ae);Le=e.detail,Re.push(t),Re.length>100&&Re.shift()}})}function Ce(){F("Attached PerformanceObserver to page");new PerformanceObserver(Pe).observe({entryTypes:["mark"]}),Ne(document.documentElement),Ne(document.body),function(){const e=setInterval(()=>{if(Re.length<10)return;if(Le.hasTags&&Le.len<25)return;Re.sort();const t=Math.min(Re.reduce((e,t)=>e+t,0)/Re.length,Re[Math.floor(Re.length/2)]),n=R(t);n>xe&&(xe=n,_("performanceObserver"),B("Mean time:",R(Re[Math.floor(Re.length/2)])),B("Median time:",R(Re.reduce((e,t)=>e+t,0)/Re.length)),B("Average time:",n),B("Max time:",R(Math.max(...Re)))),t<=4||(clearInterval(e),K(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(t)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Le.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3)}()}const qe=He("Resize"),Be=new WeakSet;let De;function Fe(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=Be.has(n);if(!e)continue;const r=getComputedStyle(n)?.position;""!==r&&"static"!==r&&(W(!o,"Node already observed for resize",n),o||(De.observe(n),Be.add(n),t+=1))}qe(t)}const We=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ue=We("function"),Ve=We("number"),Ze=We("string");"undefined"!=typeof window&&function(){const $={height:()=>(X("Custom height calculation function not defined"),Bt.auto()),width:()=>(X("Custom width calculation function not defined"),Dt.auto())},S={},H={},A="auto",C="[iFrameSizer]",D="scroll";let W,Z,Y,te,ie,ae,se,le,ce,ue,de,fe=!0,pe="",ye=0,be="",ve="",ze=!1,we=!0,$e=!1,Ie=!0,Oe=!1,Se=!1,Ee=!1,Re=1,Ge=A,Ne="",Le=!0,xe={},Pe=!1,qe=!0,We=!1,Je=0,_e=!1,Qe=[],Ye="",Xe="child",Ke=!1,et="",tt=[],nt=window.parent,ot="*",rt=0,it=!1,at=1,st=D,lt=window,ct=()=>{X("onMessage function not defined")},ut=()=>{},dt=null,ft=null;function mt(i){var a,u,f;!function(e){Ye=e[0]??Ye,ye=ge(e[1])??ye,$e=he(e[2])??$e,We=he(e[3])??We,fe=he(e[6])??fe,be=e[7]??be,Ge=e[8]??Ge,pe=e[9]??pe,ve=e[10]??ve,rt=ge(e[11])??rt,xe.enable=he(e[12])??!1,Xe=e[13]??Xe,st=e[14]??st,_e=he(e[15])??_e,Y=ge(e[16])??Y,te=ge(e[17])??te,we=he(e[18])??we,W=e[19]??W,ue=e[20]??ue,Je=ge(e[21])??Je,qe=he(e[23])??qe}(i),P=(a={id:Ye,enabled:We,expand:qe}).id||n,q.label(`${P}`),q.expand(a.expand),x=a.enabled,B(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){B("Reading data from page:",Object.keys(e)),de=Ue(e,"onBeforeResize")??de,ct=Ue(e,"onMessage")??ct,ut=Ue(e,"onReady")??ut,"number"==typeof e?.offset&&(re("offset","offsetSize"),we&&(Y=Ve(e,"offset")??Y),$e&&(te=Ve(e,"offset")??te)),"number"==typeof e?.offsetSize&&(we&&(Y=Ve(e,"offsetSize")??Y),$e&&(te=Ve(e,"offsetSize")??te)),Z=Ze(e,I(O[0]))??Z,Ne=Ze(e,"ignoreSelector")??Ne,et=Ze(e,"sizeSelector")??et,ot=Ze(e,"targetOrigin")??ot,Ge=e?.heightCalculationMethod||Ge,st=e?.widthCalculationMethod||st}function n(e,t){return"function"==typeof e&&(K(`<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.`),$[t]=e,e="custom"),e}if(1===Je)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),Ge=n(Ge,"height"),st=n(st,"width"),F(`Set targetOrigin for parent: %c${ot}`,e.HIGHLIGHT))}(),zt(),function(){try{Ke=1===Je||"iframeParentListener"in window.parent}catch(e){B("Cross domain iframe detected")}}(),$e===we&&(ze=!0),function(){const n=Je,o=E({key:W}),r=E({key:Z});if(Je=Math.max(o,r),Je<0){if(Je=Math.min(o,r),K(`${M(Je+2)}${M(2)}`),N(ue))throw M(Je+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!N(ue)||n>-1&&Je>n)&&(sessionStorage.getItem("ifr")!==t&&function(t,n){console.info(`${P} %ciframe-resizer ${t}`,x||n<1?"font-weight: bold;":e.NORMAL)}(`v${t} (${(e=>I(T[e]))(Je)})`,Je),Je<2&&ee(M(3)),sessionStorage.setItem("ifr",t))}(),ue&&""!==ue&&"false"!==ue?ue!==t&&K(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - Child page: ${t}.\n`):K("<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"),It(),Ot(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(r,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&K("<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</>.")}(),"BackCompat"===document.compatMode&&K("<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"),ht(),ze||me(),1!==Je&&(lt.parentIframe=Object.freeze({autoResize:e=>(L(e,"boolean","parentIframe.autoResize(enable) enable"),!1===$e&&!1===we?(_(c),K(`Auto Resize can not be changed when <b>direction</> is set to '${b}'.`),!1):(!0===e&&!1===fe?(fe=!0,queueMicrotask(()=>Jt(c,"Auto Resize enabled"))):!1===e&&!0===fe&&(fe=!1),Qt(0,0,"autoResize",JSON.stringify(fe)),fe)),close(){Qt(0,0,"close")},getId:()=>Ye,getOrigin:()=>(ne("getOrigin()","getParentOrigin()"),ie),getParentOrigin:()=>ie,getPageInfo(e){if("function"==typeof e)return dt=e,Qt(0,0,"pageInfo"),void oe("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");dt=null,Qt(0,0,"pageInfoStop")},getParentProps:e=>(L(e,"function","parentIframe.getParentProps(callback) callback"),ft=e,Qt(0,0,"parentInfo"),()=>{ft=null,Qt(0,0,"parentInfoStop")}),getParentProperties(e){ne("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){L(e,"string","parentIframe.moveToAnchor(anchor) anchor"),xe.findTarget(e)},reset(){!function(){const t=Ge;Ge=A,B("Reset trigger event: %cparentIframe.reset",e.HIGHLIGHT),it?B("TriggerLock blocked calculation"):(it=!0,U("Trigger event lock on"),requestAnimationFrame(()=>{it=!1,U("Trigger event lock off")})),_t("reset"),Ge=t}()},setOffsetSize(e){L(e,"number","parentIframe.setOffsetSize(offset) offset"),Y=e,te=e,Jt(m,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){L(e,"number","parentIframe.scrollBy(x, y) x"),L(t,"number","parentIframe.scrollBy(x, y) y"),Qt(t,e,"scrollBy")},scrollTo(e,t){L(e,"number","parentIframe.scrollTo(x, y) x"),L(t,"number","parentIframe.scrollTo(x, y) y"),Qt(t,e,"scrollTo")},scrollToOffset(e,t){L(e,"number","parentIframe.scrollToOffset(x, y) x"),L(t,"number","parentIframe.scrollToOffset(x, y) y"),Qt(t,e,"scrollToOffset")},sendMessage(e,t){t&&L(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Qt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Ge=e,It()},setWidthCalculationMethod(e){st=e,Ot()},setTargetOrigin(t){L(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),B(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),ot=t},resize(e,t){e&&L(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&L(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Jt(d,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ne("size()","resize()"),this.resize(e,t)}}),lt.parentIFrame=lt.parentIframe),function(){function t(e){Qt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){B(`Add event listener: %c${o}`,e.HIGHLIGHT),w(window.document,n,t)}!0===_e&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),xe=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(e){const n=e.getBoundingClientRect(),r=t();return{x:parseInt(n.left,o)+parseInt(r.x,o),y:parseInt(n.top,o)+parseInt(r.y,o)}}function r(t){function o(t){const o=n(t);B(`Moving to in page link (%c#${r}%c) at x: %c${o.x}%c y: %c${o.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Qt(o.y,o.x,"scrollToOffset")}const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(B(`In page link (#${r}) not found in iFrame, so sending to parent`),Qt(0,0,"inPageLink",`#${r}`)):o(a)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&r(t)}function a(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&w(e,"click",t=>{t.preventDefault(),r(e.getAttribute("href"))})}function s(){w(window,"hashchange",i)}function l(){setTimeout(i,128)}function c(){B("Setting up location.hash handlers"),a(),s(),l()}return xe.enable?1===Je?K("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():B("In page linking not enabled"),{findTarget:r}}(),void 0===be&&(be=`${ye}px`),bt("margin",(u="margin",(f=be).includes("-")&&(X(`Negative CSS value ignored for ${u}`),f=""),f)),bt("background",pe),bt("padding",ve),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),ze||function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),B("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==fe&&B("Auto Resize disabled"),function(e){wt({method:e,eventType:"After Print",eventName:"afterprint"}),wt({method:e,eventType:"Before Print",eventName:"beforeprint"}),wt({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=Lt(document.documentElement)();B("Attaching Observers"),Te(Rt),function(e){const t={root:document.documentElement,side:we?s:l};ae=ke(Tt,t),ae.attachObservers(e)}(e),Ce(),function(e){De=new ResizeObserver(Ht),De.observe(document.body),Be.add(document.body),F("Attached ResizeObserver to body"),se={attachObserverToNonStaticElements:Fe,detachObservers:Me(0,De,Be)},se.attachObserverToNonStaticElements(e)}(e),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n),F("Attached VisibilityObserver to page")}(Mt)}(),pt(j(ut)),B("Initialization complete"),Jt(z,"Init message from host page",void 0,void 0,`${t}:${Je}`),document.title&&""!==document.title&&Qt(0,0,"title",document.title)}function pt(e){"complete"===document.readyState?k(e):w(document,"readystatechange",()=>pt(e))}function ht(){tt=document.querySelectorAll(`[${r}]`),Ee=tt.length>0,B(`Tagged elements found: %c${Ee}`,e.HIGHLIGHT)}let gt=0;function yt(){const t=document.querySelectorAll(`*[${a}]`);Oe=t.length>0,Oe&&t.length!==gt&&(function(t){const n=1===t.length?"":"s";X(`%c[${a}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),gt=t.length)}function bt(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),F(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function vt(t,n,o){if(""!==o){B(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))B(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function zt(){vt("sizeSelector",r,et),vt("ignoreSelector",a,Ne)}function wt(t){({add(e){function n(){Jt(t.eventName,t.eventType)}H[e]=n,w(window,e,n,{passive:!0})},remove(e){const t=H[e];var n,o;delete H[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),B(`${G(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function $t(t,n,o,r){return n!==t&&(t in o||(X(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in S)&&K(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${ue?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),B(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function It(){Ge=$t(Ge,A,Bt,"height")}function Ot(){st=$t(st,D,Dt,"width")}function St(){const e=document.querySelectorAll(`[${i}]`);Qe=Array.from(e).filter(e=>!e.closest(`[${a}]`)),Se=Qe.length>0}function Tt(e){St(),(Se||e)&&(Qe.length>1?F("Overflowed Elements:",...Qe):Se||F("Overflow removed"),Jt(h,"Overflow updated"))}function Ht(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Jt(p,`Element resized <${function(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Mt(t){B(`Visible: %c${t}`,e.HIGHLIGHT),Pe=!t,Jt(y,"Visibility changed")}const Et=He("Overflow"),kt=He("Overflow",!1),jt=He("Resize"),At=He("Resize",!1);function Rt(e){!function({addedMutations:e,removedMutations:t}){_("contentMutated"),zt(),ht(),St();let n=0,o=0,r=0,i=0;for(const e of t){const t=Lt(e)();o+=ae.detachObservers(t),i+=se.detachObservers(t)}for(const t of e){const e=Lt(t)();n+=ae.attachObservers(e),r+=se.attachObserverToNonStaticElements(e)}kt(o),At(i),Et(n),jt(r),V()}(e),Jt(g,"Mutation Observed")}function Gt(e){performance.mark(je);const t=G(e);let n=0,o=document.documentElement,r=Ee?0:document.documentElement.getBoundingClientRect().bottom;const i=Ee?tt:Se?Qe:Lt(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return F(`${t} position calculated from:`,o),performance.mark(Ae,{detail:{hasTags:Ee,len:i.length,logging:We,Side:t}}),r}const Nt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],Lt=e=>()=>{if(B("node:",e),B("node type:",e?.nodeType),!(e=>e.nodeType===Node.ELEMENT_NODE)(e))return[e];const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return yt(),Oe&&t.push(`not([${a}])`,`not([${a}] *)`),[e,...e.querySelectorAll(t.join(":"))]},xt={height:0,width:0},Pt={height:0,width:0},Ct=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function qt(t){function n(){return Pt[r]=i,xt[r]=l,i}const o=t===Bt,r=o?"height":"width",i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${i}px %cPage: %c${l}px`;let u=0;switch(!0){case!t.enabled():return l;case Ee:F("Found element with data-iframe-size attribute"),u=t.taggedElement();break;case!Se&&0===Pt[r]&&0===xt[r]:F(`Initial page size values: ${c}`,...Ct),u=n();break;case it&&i===Pt[r]&&l===xt[r]:F(`Size unchanged: ${c}`,...Ct),u=Math.max(i,l);break;case 0===i:F(`Page is hidden: ${c}`,...Ct),u=l;break;case!Se&&i!==Pt[r]&&l<=xt[r]:F(`New <html> size: ${c} `,...Ct),F(`Previous <html> size: %c${Pt[r]}px`,e.HIGHLIGHT),u=n();break;case!o:u=t.taggedElement();break;case!Se&&i<Pt[r]:F(`<html> size decreased: ${c}`,...Ct),u=n();break;case l===s||l===a:F(`<html> size equals page size: ${c}`,...Ct),u=n();break;case i>l:F(`Page size < <html> size: ${c}`,...Ct),u=n();break;case Se:F("Found element overflowing <html> "),u=t.taggedElement();break;default:F(`Using <html> size: ${c}`,...Ct),u=n()}return F(`Content ${r}: %c${u}px`,e.HIGHLIGHT),u+=function(t){const n=t.getOffset();return 0!==n&&F(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),u}const Bt={enabled:()=>we,getOffset:()=>Y,auto:()=>qt(Bt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,o)+parseInt(t.marginBottom,o)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Bt.bodyOffset(),custom:()=>$.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Nt(Bt)),min:()=>Math.min(...Nt(Bt)),grow:()=>Bt.max(),lowestElement:()=>Gt(s),taggedElement:()=>Gt(s)},Dt={enabled:()=>$e,getOffset:()=>te,auto:()=>qt(Dt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>$.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Nt(Dt)),min:()=>Math.min(...Nt(Dt)),rightMostElement:()=>Gt(l),scroll:()=>Math.max(Dt.bodyScroll(),Dt.documentElementScroll()),taggedElement:()=>Gt(l)},Ft=(e,t)=>!(Math.abs(e-t)<=rt);function Wt(e,t){const n=e[t]();return e.enabled()&&void 0!==de?function(e){const t=de(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`);return t}(n):n}let Ut=!1;const Vt=j(()=>ee(M(4)));let Zt=!1;const Jt=J((t,n,o,r,i)=>{if(ce=performance.now(),le=!0,_(t),!0!==Ut){if(!fe&&!(t in f))return F("Resizing disabled"),void V();if(Pe){if(!0===Zt)return;return B("Iframe hidden - Ignored resize request"),void(Zt=!0)}Zt=!1,Ut=!0,requestAnimationFrame(()=>{Ut=!1}),function(t,n,o,r,i){const a=o??Wt(Bt,Ge),s=r??Wt(Dt,st),l=we&&Ft(Re,a)||$e&&Ft(at,s)?u:t;switch(B(`Resize event: %c${n}`,e.HIGHLIGHT),l){case z:case c:case u:Re=a,at=s;case m:Qt(Re,at,t,i);break;case h:case g:case p:case y:B(v);break;default:F(v)}le=!1}(t,n,o,r,i)}});function _t(e){Re=Bt[Ge](),at=Dt[st](),Qt(Re,at,e)}const Qt=J(function(t,n,o,r,i){Je<-1||(_(o),void 0!==i?B(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=ot,function(){const a=`${Ye}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(Ke)try{window.parent.iframeParentListener(C+a)}catch(e){if(1!==Je)throw e;return void Vt()}else nt.postMessage(C+a,i);le&&B(function(){const e=R(performance.now()-ce);return o===z?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),F(`Sending message to parent page via ${Ke?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),V())}),Yt=J(function(t){_("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>Qt(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void B("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");nt=t.source,ie=t.origin,mt(e),Ie=!1,setTimeout(()=>{Le=!1},128)},reset(){Le?B("Page reset ignored by init"):(B("Page size reset by host page"),_t("resetPage"))},resize(){B("Resize requested by host page"),Jt("parentResize","Parent window requested size check")},moveToAnchor(){xe.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();B("PageInfo received from parent:",r(e)),dt?k(dt,o(e)):i("pageInfo")},parentInfo(){const e=r(l());B("ParentInfo received from parent:",e),ft?k(ft,e):i("parentInfo")},message(){const t=l();B("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),k(ct,o(t))}},s=()=>t.data.split("]")[1].split(":")[0],l=()=>t.data.slice(t.data.indexOf(":")+1),c=()=>t.data.split(":")[2]in{true:1,false:1};function u(){const e=s();_(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||X(`Unexpected message (${t.data})`)}C===`${t.data}`.slice(0,13)&&function(){if(!1!==Ie)return c()?(Q(s()),_(z),void a.init()):void B(`Ignored message of type "${s()}". Received before initialization.`);u()}()});function Xt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?X("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Yt({data:e,sameOrigin:!0})),w(window,"message",Yt),w(window,"readystatechange",Xt),Xt())}();
|
|
20
|
+
"use strict";const e=require("auto-console-group"),t="5.5.2-beta.1",n="iframeResizer",o=10,r="data-iframe-size",i="data-iframe-overflowed",a="data-iframe-ignore",s="bottom",l="right",c="autoResizeEnabled",u=Symbol("sizeChanged"),d="manualResize",m={},f="setOffsetSize",p="resizeObserver",h="overflowObserver",g="mutationObserver",y="visibilityObserver",v="none",b="No change in content size detected",z="init",w=new Set(["head","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),$=(e,t,n,o)=>e.addEventListener(t,n,o||!1),I=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)},O=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),H=["spjluzl","rlf","clyzpvu"],T=["<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."],S=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],M=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),E=e=>O(T[e]),k=e=>{const t=e[O(H[0])]||e[O(H[1])]||e[O(H[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=I(O(e));return n in M&&(t=M[n]),t}(n[0]);return 0===o||(e=>e[2]===I(e[0]+e[1]))(n)||(o=-2),o},G=e=>e.nodeType===Node.ELEMENT_NODE,j=(e,...t)=>setTimeout(()=>e(...t),0),R=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,N=e=>Math.round(1e3*e)/1e3,L=e=>e.charAt(0).toUpperCase()+e.slice(1),x=e=>""!=`${e}`&&void 0!==e;const P=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${L(t)}`)};let C=!0,q=n;var B;const D=(B=e,B?.__esModule?B.default:B)({label:`${n}(child)`});const F=(W="log",(...e)=>!C||D[W](...e));var W;const U=F;const{assert:V,debug:Z,endAutoGroup:J,error:_,errorBoundary:Q,event:Y,label:X,purge:K,warn:ee}=D,te=e=>{return D.warn((t=A,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},ne=te,oe=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>te(t)),re=oe("Method"),ie=oe("Method","replaced with"),ae=oe("Option"),se=["min-height","min-width","max-height","max-width"],le=new Set,ce=e=>e.tagName?e.tagName.toLowerCase():"unknown",ue=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),de=(e,t)=>{return(n=ue(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function me({href:e}){le.has(e)||(F("Unable to access stylesheet:",e),le.add(e))}const fe=(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){me(n)}return{source:"cross-origin stylesheet",value:ue(e,t)}}(e,t),pe=(e,t)=>{const{source:n,value:o}=fe(e,t),r=ce(e);te(`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 he(){for(const e of[document.documentElement,document.body])for(const t of se)F(`Checking <${ce(e)}> for blocking CSS: ${t}`),de(e,t)&&pe(e,t)}const ge=e=>t=>void 0===t?void 0:e(t),ye=ge(e=>"true"===e),ve=ge(Number),be=new Set,ze=new Set,we=[],$e={attributes:!0,attributeFilter:[a,r],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ie,Oe=1,He=!1,Te=0;const Se=t=>{U("Mutations:",t);for(const e of t){const{addedNodes:t,removedNodes:n}=e;for(const e of t)G(e)&&(w.has(e.tagName.toLowerCase())||be.add(e));for(const e of n)G(e)&&(w.has(e.tagName.toLowerCase())||(be.has(e)?be.delete(e):ze.add(e)))}ze.size>0&&F(`Detected %c${ze.size} %cremoved element${ze.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),be.size>0&&F(`Found %c${be.size} %cnew element${be.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND)};function Me(e){we.push(e),He||(Te=performance.now(),He=!0,requestAnimationFrame(Ie))}function Ee(t){const n=new window.MutationObserver(Me),o=document.body||document.documentElement;return Ie=(t=>()=>{const n=performance.now(),o=n-Te,r=16*Oe+++2;if(o>r&&o<200)return Y("mutationThrottled"),U("Update delayed due to heavy workload on the callStack"),U(`EventLoop busy time: %c${N(o)}ms %c> Max wait: %c${r-2}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(Ie,16*Oe),void(Te=n);Oe=1,we.forEach(Se),we.length=0,t({addedMutations:be,removedMutations:ze}),He=!1,be.clear(),ze.clear()})(t),n.observe(o,$e),U("Attached MutationObserver to body"),n}const ke=(t,n=!0)=>o=>{o>0&&U(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,e.HIGHLIGHT,e.NORMAL)},Ge=(e,t,n)=>e=>{let o=0;for(const r of e)n.has(r)&&(t.unobserve(r),n.delete(r),o+=1);return o},je=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,Re=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||A,a=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[n],l=(e,t)=>e.toggleAttribute(i,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t,i=e[n],a=s(i,o)&&!je(r);l(r,a)}r(a)},o),u=new WeakSet;return{attachObservers:function(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=u.has(n);e&&(V(!o,"Node already observed for overflow",n),o||(c.observe(n),u.add(n),t+=1))}return t},detachObservers:Ge(0,c,u)}},Ae="--ifr-start",Ne="--ifr-end",Le=[],xe=new WeakSet,Pe=e=>"object"==typeof e&&xe.add(e);let Ce={},qe=0;function Be(e){e.getEntries().forEach(e=>{if(e.name===Ne){const{duration:t}=performance.measure("--ifr-measure",Ae,Ne);Ce=e.detail,Le.push(t),Le.length>100&&Le.shift()}})}function De(){U("Attached PerformanceObserver to page");new PerformanceObserver(Be).observe({entryTypes:["mark"]}),Pe(document.documentElement),Pe(document.body),function(){const e=setInterval(()=>{if(Le.length<10)return;if(Ce.hasTags&&Ce.len<25)return;Le.sort();const t=Math.min(Le.reduce((e,t)=>e+t,0)/Le.length,Le[Math.floor(Le.length/2)]),n=N(t);n>qe&&(qe=n,Y("performanceObserver"),F("Mean time:",N(Le[Math.floor(Le.length/2)])),F("Median time:",N(Le.reduce((e,t)=>e+t,0)/Le.length)),F("Average time:",n),F("Max time:",N(Math.max(...Le)))),t<=4||(clearInterval(e),te(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${N(t)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Ce.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3)}()}const Fe=new WeakSet;let We;function Ue(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=Fe.has(n);if(!e)continue;const r=getComputedStyle(n)?.position;""!==r&&"static"!==r&&(V(!o,"Node already observed for resize",n),o||(We.observe(n),Fe.add(n),t+=1))}return t}const Ve=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ze=Ve("function"),Je=Ve("number"),_e=Ve("string");"undefined"!=typeof window&&function(){const I={height:()=>(ee("Custom height calculation function not defined"),Wt.auto()),width:()=>(ee("Custom width calculation function not defined"),Ut.auto())},T={},M={},A="auto",B="[iFrameSizer]",W="scroll";let _,K,oe,se,le,ce,ue,de,me,fe,pe,ge=!0,be="",ze=0,we="",$e="",Ie=!1,Oe=!0,He=!1,Te=!0,Se=!1,Me=!1,je=!1,Le=1,xe=A,Pe="",Ce=!0,qe={},Be=!1,Ve=!0,Qe=!1,Ye=0,Xe=!1,Ke=[],et="",tt="child",nt=!1,ot="",rt=[],it=window.parent,at="*",st=0,lt=!1,ct=1,ut=W,dt=window,mt=()=>{ee("onMessage function not defined")},ft=()=>{},pt=null,ht=null;function gt(i){var a,u,m;!function(e){et=e[0]??et,ze=ve(e[1])??ze,He=ye(e[2])??He,Qe=ye(e[3])??Qe,ge=ye(e[6])??ge,we=e[7]??we,xe=e[8]??xe,be=e[9]??be,$e=e[10]??$e,st=ve(e[11])??st,qe.enable=ye(e[12])??!1,tt=e[13]??tt,ut=e[14]??ut,Xe=ye(e[15])??Xe,oe=ve(e[16])??oe,se=ve(e[17])??se,Oe=ye(e[18])??Oe,_=e[19]??_,fe=e[20]??fe,Ye=ve(e[21])??Ye,Ve=ye(e[23])??Ve}(i),q=(a={id:et,enabled:Qe,expand:Ve}).id||n,D.label(`${q}`),D.expand(a.expand),C=a.enabled,F(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){F("Reading data from page:",Object.keys(e)),pe=Ze(e,"onBeforeResize")??pe,mt=Ze(e,"onMessage")??mt,ft=Ze(e,"onReady")??ft,"number"==typeof e?.offset&&(ae("offset","offsetSize"),Oe&&(oe=Je(e,"offset")??oe),He&&(se=Je(e,"offset")??se)),"number"==typeof e?.offsetSize&&(Oe&&(oe=Je(e,"offsetSize")??oe),He&&(se=Je(e,"offsetSize")??se)),K=_e(e,O(H[0]))??K,Pe=_e(e,"ignoreSelector")??Pe,ot=_e(e,"sizeSelector")??ot,at=_e(e,"targetOrigin")??at,xe=e?.heightCalculationMethod||xe,ut=e?.widthCalculationMethod||ut}function n(e,t){return"function"==typeof e&&(te(`<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.`),I[t]=e,e="custom"),e}if(1===Ye)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),xe=n(xe,"height"),ut=n(ut,"width"),U(`Set targetOrigin for parent: %c${at}`,e.HIGHLIGHT))}(),It(),function(){try{nt=1===Ye||"iframeParentListener"in window.parent}catch(e){F("Cross domain iframe detected")}}(),He===Oe&&(Ie=!0),function(){const n=Ye,o=k({key:_}),r=k({key:K});if(Ye=Math.max(o,r),Ye<0){if(Ye=Math.min(o,r),te(`${E(Ye+2)}${E(2)}`),x(fe))throw E(Ye+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!x(fe)||n>-1&&Ye>n)&&(sessionStorage.getItem("ifr")!==t&&function(t,n){console.info(`${q} %ciframe-resizer ${t}`,C||n<1?"font-weight: bold;":e.NORMAL)}(`v${t} (${(e=>O(S[e]))(Ye)})`,Ye),Ye<2&&ne(E(3)),sessionStorage.setItem("ifr",t))}(),fe&&""!==fe&&"false"!==fe?fe!==t&&te(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${t}.\n`):te("<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"),Tt(),St(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(r,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&te("<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</>.")}(),"BackCompat"===document.compatMode&&te("<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"),vt(),Ie||he(),1!==Ye&&(dt.parentIframe=Object.freeze({autoResize:e=>(P(e,"boolean","parentIframe.autoResize(enable) enable"),!1===He&&!1===Oe?(Y(c),te(`Auto Resize can not be changed when <b>direction</> is set to '${v}'.`),!1):(!0===e&&!1===ge?(ge=!0,queueMicrotask(()=>Yt(c,"Auto Resize enabled"))):!1===e&&!0===ge&&(ge=!1),Kt(0,0,"autoResize",JSON.stringify(ge)),ge)),close(){Kt(0,0,"close")},getId:()=>et,getOrigin:()=>(re("getOrigin()","getParentOrigin()"),le),getParentOrigin:()=>le,getPageInfo(e){if("function"==typeof e)return pt=e,Kt(0,0,"pageInfo"),void ie("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");pt=null,Kt(0,0,"pageInfoStop")},getParentProps:e=>(P(e,"function","parentIframe.getParentProps(callback) callback"),ht=e,Kt(0,0,"parentInfo"),()=>{ht=null,Kt(0,0,"parentInfoStop")}),getParentProperties(e){re("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){P(e,"string","parentIframe.moveToAnchor(anchor) anchor"),qe.findTarget(e)},reset(){!function(){const t=xe;xe=A,F("Reset trigger event: %cparentIframe.reset",e.HIGHLIGHT),lt?F("TriggerLock blocked calculation"):(lt=!0,Z("Trigger event lock on"),requestAnimationFrame(()=>{lt=!1,Z("Trigger event lock off")})),Xt("reset"),xe=t}()},setOffsetSize(e){P(e,"number","parentIframe.setOffsetSize(offset) offset"),oe=e,se=e,Yt(f,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){P(e,"number","parentIframe.scrollBy(x, y) x"),P(t,"number","parentIframe.scrollBy(x, y) y"),Kt(t,e,"scrollBy")},scrollTo(e,t){P(e,"number","parentIframe.scrollTo(x, y) x"),P(t,"number","parentIframe.scrollTo(x, y) y"),Kt(t,e,"scrollTo")},scrollToOffset(e,t){P(e,"number","parentIframe.scrollToOffset(x, y) x"),P(t,"number","parentIframe.scrollToOffset(x, y) y"),Kt(t,e,"scrollToOffset")},sendMessage(e,t){t&&P(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Kt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){xe=e,Tt()},setWidthCalculationMethod(e){ut=e,St()},setTargetOrigin(t){P(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),F(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),at=t},resize(e,t){e&&P(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&P(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Yt(d,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){re("size()","resize()"),this.resize(e,t)}}),dt.parentIFrame=dt.parentIframe),function(){function t(e){Kt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){F(`Add event listener: %c${o}`,e.HIGHLIGHT),$(window.document,n,t)}!0===Xe&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),qe=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(e){const n=e.getBoundingClientRect(),r=t();return{x:parseInt(n.left,o)+parseInt(r.x,o),y:parseInt(n.top,o)+parseInt(r.y,o)}}function r(t){function o(t){const o=n(t);F(`Moving to in page link (%c#${r}%c) at x: %c${o.x}%c y: %c${o.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Kt(o.y,o.x,"scrollToOffset")}const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(F(`In page link (#${r}) not found in iFrame, so sending to parent`),Kt(0,0,"inPageLink",`#${r}`)):o(a)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&r(t)}function a(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&$(e,"click",t=>{t.preventDefault(),r(e.getAttribute("href"))})}function s(){$(window,"hashchange",i)}function l(){setTimeout(i,128)}function c(){F("Setting up location.hash handlers"),a(),s(),l()}return qe.enable?1===Ye?te("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():F("In page linking not enabled"),{findTarget:r}}(),void 0===we&&(we=`${ze}px`),wt("margin",(u="margin",(m=we).includes("-")&&(ee(`Negative CSS value ignored for ${u}`),m=""),m)),wt("background",be),wt("padding",$e),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),Ie||function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),F("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==ge&&F("Auto Resize disabled"),function(e){Ot({method:e,eventType:"After Print",eventName:"afterprint"}),Ot({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ot({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=Ct(document.documentElement)();F("Attaching Observers"),Ee(Lt),function(e){const t={root:document.documentElement,side:Oe?s:l};ce=Re(Rt,t);const n=ce.attachObservers(e);Mt(n)}(e),De(),function(e){We=new ResizeObserver(At),We.observe(document.body),Fe.add(document.body),U("Attached ResizeObserver to body"),ue={attachObserverToNonStaticElements:Ue,detachObservers:Ge(0,We,Fe)};const t=ue.attachObserverToNonStaticElements(e);kt(t)}(e),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n),U("Attached VisibilityObserver to page")}(Nt)}(),yt(R(ft)),F("Initialization complete"),Yt(z,"Init message from host page",void 0,void 0,`${t}:${Ye}`),document.title&&""!==document.title&&Kt(0,0,"title",document.title)}function yt(e){"complete"===document.readyState?j(e):$(document,"readystatechange",()=>yt(e))}function vt(){rt=document.querySelectorAll(`[${r}]`),je=rt.length>0,F(`Tagged elements found: %c${je}`,e.HIGHLIGHT)}let bt=0;function zt(){const t=document.querySelectorAll(`*[${a}]`);return Se=t.length>0,Se&&t.length!==bt&&(function(t){const n=1===t.length?"":"s";ee(`%c[${a}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),bt=t.length),Se}function wt(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),U(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function $t(t,n,o){if(""!==o){F(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))F(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function It(){$t("sizeSelector",r,ot),$t("ignoreSelector",a,Pe)}function Ot(t){({add(e){function n(){Yt(t.eventName,t.eventType)}M[e]=n,$(window,e,n,{passive:!0})},remove(e){const t=M[e];var n,o;delete M[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),F(`${L(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Ht(t,n,o,r){return n!==t&&(t in o||(ee(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in T)&&te(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${fe?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),F(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function Tt(){xe=Ht(xe,A,Wt,"height")}function St(){ut=Ht(ut,W,Ut,"width")}const Mt=ke("Overflow"),Et=ke("Overflow",!1),kt=ke("Resize"),Gt=ke("Resize",!1);function jt(){const e=document.querySelectorAll(`[${i}]`);Ke=Array.from(e).filter(e=>!e.closest(`[${a}]`)),Me=Ke.length>0}function Rt(e){jt(),(Me||e)&&(Ke.length>1?U("Overflowed Elements:",...Ke):Me||U("Overflow removed"),Yt(h,"Overflow updated"))}function At(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Yt(p,`Element resized <${function(e){switch(!0){case!x(e):return"";case x(e.id):return`${e.nodeName}#${e.id}`;case x(e.name):return`${e.nodeName} (${e.name}`;case x(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Nt(t){F(`Visible: %c${t}`,e.HIGHLIGHT),Be=!t,Yt(y,"Visibility changed")}function Lt(e){!function({addedMutations:e,removedMutations:t}){Y("contentMutated"),It(),vt(),jt();let n=0,o=0,r=0,i=0;for(const e of t){const t=Ct(e)();o+=ce.detachObservers(t),i+=ue.detachObservers(t)}for(const t of e){const e=Ct(t)();n+=ce.attachObservers(e),r+=ue.attachObserverToNonStaticElements(e)}Et(o),Gt(i),Mt(n),kt(r),J()}(e),Yt(g,"Mutation Observed")}function xt(e){performance.mark(Ae);const t=L(e);let n=0,o=document.documentElement,r=je?0:document.documentElement.getBoundingClientRect().bottom;const i=je?rt:Me?Ke:Ct(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return U(`${t} position calculated from:`,o),performance.mark(Ne,{detail:{hasTags:je,len:i.length,logging:Qe,Side:t}}),r}const Pt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],Ct=e=>()=>{V(G(e),"getAllElements() requires a DOM element");const t=["* ",...[...w].map(e=>`not(${e})`)];return zt()&&t.push(`not([${a}])`,`not([${a}] *)`),[e,...e.querySelectorAll(t.join(":"))]},qt={height:0,width:0},Bt={height:0,width:0},Dt=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function Ft(t){function n(){return Bt[r]=i,qt[r]=l,i}const o=t===Wt,r=o?"height":"width",i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${i}px %cPage: %c${l}px`;let u=0;switch(!0){case!t.enabled():return l;case je:U("Found element with data-iframe-size attribute"),u=t.taggedElement();break;case!Me&&0===Bt[r]&&0===qt[r]:U(`Initial page size values: ${c}`,...Dt),u=n();break;case lt&&i===Bt[r]&&l===qt[r]:U(`Size unchanged: ${c}`,...Dt),u=Math.max(i,l);break;case 0===i:U(`Page is hidden: ${c}`,...Dt),u=l;break;case!Me&&i!==Bt[r]&&l<=qt[r]:U(`New <html> size: ${c} `,...Dt),U(`Previous <html> size: %c${Bt[r]}px`,e.HIGHLIGHT),u=n();break;case!o:u=t.taggedElement();break;case!Me&&i<Bt[r]:U(`<html> size decreased: ${c}`,...Dt),u=n();break;case l===s||l===a:U(`<html> size equals page size: ${c}`,...Dt),u=n();break;case i>l:U(`Page size < <html> size: ${c}`,...Dt),u=n();break;case Me:U("Found element overflowing <html> "),u=t.taggedElement();break;default:U(`Using <html> size: ${c}`,...Dt),u=n()}return U(`Content ${r}: %c${u}px`,e.HIGHLIGHT),u+=function(t){const n=t.getOffset();return 0!==n&&U(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),u}const Wt={enabled:()=>Oe,getOffset:()=>oe,auto:()=>Ft(Wt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,o)+parseInt(t.marginBottom,o)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Wt.bodyOffset(),custom:()=>I.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Pt(Wt)),min:()=>Math.min(...Pt(Wt)),grow:()=>Wt.max(),lowestElement:()=>xt(s),taggedElement:()=>xt(s)},Ut={enabled:()=>He,getOffset:()=>se,auto:()=>Ft(Ut),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>I.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Pt(Ut)),min:()=>Math.min(...Pt(Ut)),rightMostElement:()=>xt(l),scroll:()=>Math.max(Ut.bodyScroll(),Ut.documentElementScroll()),taggedElement:()=>xt(l)},Vt=(e,t)=>!(Math.abs(e-t)<=st);function Zt(e,t){const n=e[t]();return e.enabled()&&void 0!==pe?function(e){const t=pe(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`);return t}(n):n}let Jt=!1;const _t=R(()=>ne(E(4)));let Qt=!1;const Yt=Q((t,n,o,r,i)=>{if(me=performance.now(),de=!0,Y(t),!0!==Jt){if(!ge&&!(t in m))return U("Resizing disabled"),void J();if(Be){if(!0===Qt)return;return F("Iframe hidden - Ignored resize request"),void(Qt=!0)}Qt=!1,Jt=!0,requestAnimationFrame(()=>{Jt=!1}),function(t,n,o,r,i){const a=o??Zt(Wt,xe),s=r??Zt(Ut,ut),l=Oe&&Vt(Le,a)||He&&Vt(ct,s)?u:t;switch(F(`Resize event: %c${n}`,e.HIGHLIGHT),l){case z:case c:case u:Le=a,ct=s;case f:Kt(Le,ct,t,i);break;case h:case g:case p:case y:F(b);break;default:U(b)}de=!1}(t,n,o,r,i)}});function Xt(e){Le=Wt[xe](),ct=Ut[ut](),Kt(Le,ct,e)}const Kt=Q(function(t,n,o,r,i){Ye<-1||(Y(o),void 0!==i?F(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=at,function(){const a=`${et}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(nt)try{window.parent.iframeParentListener(B+a)}catch(e){if(1!==Ye)throw e;return void _t()}else it.postMessage(B+a,i);de&&F(function(){const e=N(performance.now()-me);return o===z?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),U(`Sending message to parent page via ${nt?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),J())}),en=Q(function(t){Y("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>Kt(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void F("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");it=t.source,le=t.origin,gt(e),Te=!1,setTimeout(()=>{Ce=!1},128)},reset(){Ce?F("Page reset ignored by init"):(F("Page size reset by host page"),Xt("resetPage"))},resize(){F("Resize requested by host page"),Yt("parentResize","Parent window requested size check")},moveToAnchor(){qe.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();F("PageInfo received from parent:",r(e)),pt?j(pt,o(e)):i("pageInfo")},parentInfo(){const e=r(l());F("ParentInfo received from parent:",e),ht?j(ht,e):i("parentInfo")},message(){const t=l();F("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),j(mt,o(t))}},s=()=>t.data.split("]")[1].split(":")[0],l=()=>t.data.slice(t.data.indexOf(":")+1),c=()=>t.data.split(":")[2]in{true:1,false:1};function u(){const e=s();Y(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||ee(`Unexpected message (${t.data})`)}B===`${t.data}`.slice(0,13)&&function(){if(!1!==Te)return c()?(X(s()),Y(z),void a.init()):void F(`Ignored message of type "${s()}". Received before initialization.`);u()}()});function tn(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?ee("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>en({data:e,sameOrigin:!0})),$(window,"message",en),$(window,"readystatechange",tn),tn())}();
|
|
21
21
|
//# sourceMappingURL=index.cjs.js.map
|