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