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