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