@iframe-resizer/child 5.5.7-beta.1 → 5.5.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/index.cjs.js +3 -3
- package/index.cjs.js.map +1 -1
- package/index.esm.js +3 -3
- package/index.esm.js.map +1 -1
- package/index.umd.js +3 -3
- 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
|
+
* @module iframe-resizer/child 5.5.8-beta.1 (esm) - 2026-01-22
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @see {@link https://iframe-resizer.com}
|
|
15
15
|
*
|
|
16
|
-
* @copyright (c) 2013 -
|
|
16
|
+
* @copyright (c) 2013 - 2026, David J. Bradshaw. All rights reserved.
|
|
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.7-beta.1",s="iframeResizer",c=":",l="init",d="message",u="pageHide",m="pageInfo",f="parentInfo",p="scrollToOffset",h="title",g=10,y="data-iframe-size",b="data-iframe-overflowed",v="data-iframe-ignore",z="height",w="width",$="offset",S="offsetSize",O="string",M="number",k="object",E="function",I="auto",j="readystatechange",T="bottom",x="right",A="autoResizeEnabled",P=Symbol("sizeChanged"),N="manualResize",C="parentResize",R={[N]:1,[C]:1},L="setOffsetSize",q="resizeObserver",B="overflowObserver",D="mutationObserver",W="visibilityObserver",F="No change in content size detected",V="[iFrameSizer]",H=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),U=(e,t,n,o)=>e.addEventListener(t,n,o||!1),Z=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)},J=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),_=["spjluzl","rlf","clyzpvu"],Q=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],Y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],G=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),X=e=>J(Q[e]),K=e=>{const t=e[J(_[0])]||e[J(_[1])]||e[J(_[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=Z(J(e));return n in G&&(t=G[n]),t}(n[0]);return 0===o||(e=>e[2]===Z(e[0]+e[1]))(n)||(o=-2),o},ee=(e,...t)=>setTimeout(()=>e(...t),0),te=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},ne=e=>e,oe=e=>Math.round(1e3*e)/1e3,re=e=>e.charAt(0).toUpperCase()+e.slice(1),ae=e=>""!=`${e}`&&void 0!==e,ie=e=>e();const se=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${re(t)}`)};let ce=!0,le=s;var de;const ue=(de=e,de?.__esModule?de.default:de)({label:`${s}(child)`,expand:!1});const me=e=>(...t)=>!ce||ue[e](...t),fe=me("log"),pe=fe,he=me("debug");const{assert:ge,endAutoGroup:ye,error:be,errorBoundary:ve,event:ze,label:we,purge:$e,warn:Se}=ue,Oe=e=>{return ue.warn((t=ne,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},Me=(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)=>Oe(t)),ke=Me("Method"),Ee=Me("Method","replaced with"),Ie=Me("Option"),je=["min-height","min-width","max-height","max-width"],Te=new Set,xe=e=>e.tagName?e.tagName.toLowerCase():"unknown",Ae=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Pe=(e,t)=>{return(n=Ae(e,t))&&"0px"!==n&&n!==I&&"none"!==n;var n};function Ne({href:e}){Te.has(e)||(fe("Unable to access stylesheet:",e),Te.add(e))}const Ce=(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){Ne(n)}return{source:"cross-origin stylesheet",value:Ae(e,t)}}(e,t),Re=(e,t)=>{const{source:n,value:o}=Ce(e,t),r=xe(e);Oe(`The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${r}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.\n\nIf you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function Le(){for(const e of[document.documentElement,document.body])for(const t of je)fe(`Checking <${xe(e)}> for blocking CSS: ${t}`),Pe(e,t)&&Re(e,t)}const qe=e=>t=>void 0===t?void 0:e(t),Be=qe(e=>"true"===e),De=qe(Number),We=(e="")=>t=>n=>{n.size>0&&he(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Fe=We("attached to"),Ve=((e="")=>t=>n=>{n.size>0&&be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),He=We("detached from"),Ue=(e,o=!0)=>r=>{r>0&&pe(`${o?"At":"De"}tached ${e}Observer ${o?"to":"from"} %c${r}%c element${1===r?"":"s"}`,n,t)},Ze=(e,t,n,o)=>{const r=He(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()}},Je="Mutation",_e=new Set,Qe=new Set,Ye=new Set,Ge=[],Xe={attributes:!0,attributeFilter:[v,y],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ke,et=1,tt=!1,nt=0;const ot=We("added")(Je),rt=We("removed (page)")(Je),at=We("removed (added)")(Je),it=e=>e.nodeType!==Node.ELEMENT_NODE||H.has(e.tagName.toLowerCase());function st(e){const t=e.addedNodes;for(const e of t)it(e)||_e.add(e)}function ct(e){const t=e.removedNodes;for(const e of t)it(e)||(_e.has(e)?(_e.delete(e),Ye.add(e)):Qe.add(e))}const lt=e=>{pe("Mutations:",e);for(const t of e)st(t),ct(t);ot(_e),rt(Qe),at(Ye),Ye.clear()};const dt=e=>()=>{const t=performance.now(),r=t-nt,a=16*et+++2;if(r>a&&r<200)return ze("mutationThrottled"),pe("Update delayed due to heavy workload on the callStack"),pe(`EventLoop busy time: %c${oe(r)}ms %c> Max wait: %c${a-2}ms`,n,o,n),setTimeout(Ke,16*et),void(nt=t);et=1,Ge.forEach(lt),Ge.length=0,tt=!1,Qe.size>0&&fe(`Detected %c${Qe.size} %cremoved element${Qe.size>1?"s":""}`,n,o),_e.size>0&&fe(`Found %c${_e.size} %cnew element${_e.size>1?"s":""}`,n,o),e({addedNodes:_e,removedNodes:Qe}),_e.clear(),Qe.clear()};function ut(e){Ge.push(e),tt||(nt=performance.now(),tt=!0,requestAnimationFrame(Ke))}function mt(e){const t=new window.MutationObserver(ut),n=document.body||document.documentElement;return Ke=dt(e),t.observe(n,Xe),pe("Attached MutationObserver to body"),{...t,disconnect:()=>{_e.clear(),Qe.clear(),Ge.length=0,t.disconnect(),pe("Detached MutationObserver")}}}const ft="Overflow",pt=Ue(ft),ht=Ue(ft,!1),gt=Fe(ft),yt=Ve(ft),bt=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,vt=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||ne,a=(t=!1)=>e(t),i=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(b,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)&&!bt(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));yt(t),gt(n),pt(o),n.clear(),t.clear()},detachObservers:Ze(ft,c,l,ht),disconnect:()=>{c.disconnect(),pe("Detached OverflowObserver")}}},zt="--ifr-start",wt="--ifr-end",$t="--ifr-measure",St=[];let Ot,Mt={},kt=0;function Et(){try{performance.clearMarks(zt),performance.clearMarks(wt),performance.clearMeasures($t)}catch{}}function It(e){e.getEntries().forEach(e=>{if(e.name===wt)try{const{duration:t}=performance.measure($t,zt,wt);Mt=e.detail,St.push(t),St.length>100&&St.shift()}catch{}})}function jt(){pe("Attached PerformanceObserver to page");const e=new PerformanceObserver(It);return e.observe({entryTypes:["mark"]}),Ot=setInterval(()=>{if(St.length<10)return;if(Mt.hasTags&&Mt.len<25)return;St.sort();const e=Math.min(St.reduce((e,t)=>e+t,0)/St.length,St[Math.floor(St.length/2)]),t=oe(e);t>kt&&(kt=t,ze("performanceObserver"),fe("Mean time:",oe(St[Math.floor(St.length/2)])),fe("Median time:",oe(St.reduce((e,t)=>e+t,0)/St.length)),fe("Average time:",t),fe("Max time:",oe(Math.max(...St)))),Et(),e<=4||(clearInterval(Ot),Oe(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${oe(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Mt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{Et(),clearInterval(Ot),e.disconnect(),pe("Detached PerformanceObserver")}}}const Tt="Resize",xt=Ue(Tt),At=Ue(Tt,!1),Pt=Fe(Tt),Nt=Ve(Tt),Ct=new WeakSet,Rt=new Set,Lt=new Set;let qt;function Bt(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(Ct.has(n)?Rt.add(n):(qt.observe(n),Ct.add(n),Lt.add(n),t+=1))}Nt(Rt),Pt(Lt),xt(t),Lt.clear(),Rt.clear()}function Dt(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;return t.observe(n),pe("Attached VisibilityObserver to page"),{disconnect:()=>{t.disconnect(),pe("Detached VisibilityObserver")}}}const Wt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ft=Wt(E),Vt=Wt(M),Ht=Wt(O);"undefined"!=typeof window&&function(){const e={height:()=>(Se("Custom height calculation function not defined"),Ln.auto()),width:()=>(Se("Custom width calculation function not defined"),qn.auto())},Z={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},Q={},G=I,de=[],me="scroll";let $e,Me,je,Te,xe,Ae,Pe,Ne,Ce,Re=!0,qe="",We=0,Fe="",Ve="",He=!1,Ue=!0,Je=!1,_e=!0,Qe=!1,Ye=!1,Ge=!0,Xe=!1,Ke=1,et=G,tt="",nt=!0,ot={},rt=!1,at=!1,it=!1,st=0,ct=!1,lt=0,dt=0,ut=new Set,ft="",pt="child",ht=!1,gt="",yt=[],bt=window.parent,$t="*",St=0,Ot=!1,Mt=1,kt=me,Et=window,It=()=>{Se("onMessage function not defined")},xt=()=>{},Pt=null,Nt=null;function Rt(t){var o;!function(e){ft=e[0]??ft,We=De(e[1])??We,Je=Be(e[2])??Je,it=Be(e[3])??it,Re=Be(e[6])??Re,Fe=e[7]??Fe,et=e[8]??et,qe=e[9]??qe,Ve=e[10]??Ve,St=De(e[11])??St,ot.enable=Be(e[12])??!1,pt=e[13]??pt,kt=e[14]??kt,ct=Be(e[15])??ct,lt=De(e[16])??lt,dt=De(e[17])??dt,Ue=Be(e[18])??Ue,$e=e[19]??$e,Ne=e[20]??Ne,st=De(e[21])??st,at=Be(e[23])??at}(t),le=(o={id:ft,enabled:it,expand:at}).id||s,ue.label(`${le}`),ue.expand(o.expand),ce=o.enabled,fe(`Initialising iframe v${i} ${window.location.href}`),function(){function t(e){fe("Reading data from page:",Object.keys(e)),Ce=Ft(e,"onBeforeResize")??Ce,It=Ft(e,"onMessage")??It,xt=Ft(e,"onReady")??xt,typeof e?.offset===M&&(Ie($,S),Ue&&(lt=Vt(e,$)??lt),Je&&(dt=Vt(e,$)??dt)),typeof e?.offsetSize===M&&(Ue&&(lt=Vt(e,S)??lt),Je&&(dt=Vt(e,S)??dt)),Me=Ht(e,J(_[0]))??Me,tt=Ht(e,"ignoreSelector")??tt,gt=Ht(e,"sizeSelector")??gt,$t=Ht(e,"targetOrigin")??$t,et=e?.heightCalculationMethod||et,kt=e?.widthCalculationMethod||kt}function o(t,n){return typeof t===E&&(Oe(`<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===st)return;const r=window.iframeResizer||window.iFrameResizer;typeof r===k&&(t(r),et=o(et,z),kt=o(kt,w),pe(`Set targetOrigin for parent: %c${$t}`,n))}(),[Yt,Xt,un,_t,Gt,ln,dn,sn,Qt,Zt,He?ne:Le,tn,gn,hn,pn,nn,()=>Kt("background",qe),()=>Kt("padding",Ve),He?ne:on,fn,mn,In,Wt].forEach(e=>{try{e()}catch(e){if(st<0)throw e;Oe("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),be(e)}}),Ut(te(xt)),fe("Initialization complete"),Un(l,"Init message from host page",void 0,void 0,`${i}:${st}`),document.title&&""!==document.title&&_n(0,0,h,document.title)}function Lt({persisted:e}){e||_n(0,0,"beforeUnload"),ze(u),pe("Page persisted:",e),e||de.forEach(ie)}const Wt=()=>U(window,u.toLowerCase(),Lt);function Ut(e){"complete"===document.readyState?ee(e):U(document,j,()=>Ut(e))}function Zt(){yt=document.querySelectorAll(`[${y}]`),Xe=yt.length>0,fe(`Tagged elements found: %c${Xe}`,n)}let Jt=0;function _t(){const e=document.querySelectorAll(`*[${v}]`);return Qe=e.length>0,Qe&&e.length!==Jt&&(function(e){const n=1===e.length?"":"s";Se(`%c[${v}]%c found on %c${e.length}%c element${n}`,a,t,a,t)}(e),Jt=e.length),Qe}function Qt(){"BackCompat"===document.compatMode&&Oe("<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 Yt(){Ne&&""!==Ne&&"false"!==Ne?Ne!==i&&Oe(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ne} - Child page: ${i}.\n`):Oe("<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 Gt(){try{ht=1===st||"iframeParentListener"in window.parent}catch(e){fe("Cross domain iframe detected")}}function Xt(){Je===Ue&&(He=!0)}function Kt(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),pe(`Set body ${e}: %c${t}`,n))}function en(e,t,o){if(""!==o){fe(`${e}: %c${o}`,n);for(const e of document.querySelectorAll(o))fe(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function tn(){en("sizeSelector",y,gt),en("ignoreSelector",v,tt)}function nn(){var e,t;void 0===Fe&&(Fe=`${We}px`),Kt("margin",(e="margin",(t=Fe).includes("-")&&(Se(`Negative CSS value ignored for ${e}`),t=""),t))}function on(){const e=e=>e.style.setProperty(z,I,"important");e(document.documentElement),e(document.body),fe("Set HTML & body height: %cauto !important",n)}function rn(e){({add(t){function n(){Un(e.eventName,e.eventType)}Q[t]=n,U(window,t,n,{passive:!0})},remove(e){const t=Q[e];var n,o;delete Q[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),fe(`${re(e.method)} event listener: %c${e.eventType}`,n)}function an(e){rn({method:e,eventType:"After Print",eventName:"afterprint"}),rn({method:e,eventType:"Before Print",eventName:"beforeprint"}),rn({method:e,eventType:"Ready State Change",eventName:j})}function sn(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(y,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&Oe("<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 cn(e,t,o){const{label:r}=o;return t!==e&&(e in o||(Se(`${e} is not a valid option for ${r}CalculationMethod.`),e=t),e in Z)&&Oe(`<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 ${Ne?"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`),fe(`Set ${r} calculation method: %c${e}`,n),e}function ln(){et=cn(et,G,Ln)}function dn(){kt=cn(kt,me,qn)}function un(){const e=st,n=K({key:$e}),o=K({key:Me});if(st=Math.max(n,o),st<0){if(st=Math.min(n,o),Oe(`${X(st+2)}${X(2)}`),ae(Ne))throw X(st+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!ae(Ne)||e>-1&&st>e)&&(sessionStorage.getItem("ifr")!==i&&function(e,n){console.info(`${le} %ciframe-resizer ${e}`,ce||n<1?"font-weight: bold;":t)}(`v${i} (${(e=>J(Y[e]))(st)})`,st),st<2&&Oe(X(3)),sessionStorage.setItem("ifr",i))}function mn(){!0!==Re&&fe("Auto Resize disabled"),an("add"),de.push(()=>an("remove"))}function fn(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function pn(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,g)+parseInt(n.x,g),y:parseInt(t.top,g)+parseInt(n.y,g)}}function t(t){const r=t.split("#")[1]||t,a=decodeURIComponent(r),i=document.getElementById(a)||document.getElementsByName(a)[0];void 0===i?(fe(`In page link (#${r}) not found in iframe, so sending to parent`),_n(0,0,"inPageLink",`#${r}`)):function(t){const a=e(t);fe(`Moving to in page link (%c#${r}%c) at x: %c${a.x}%c y: %c${a.y}`,n,o,n,o,n),_n(a.y,a.x,p)}(i)}function r(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}const{enable:a}=ot;a?1===st?Oe(X(5)):(fe("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&U(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),U(window,"hashchange",r),setTimeout(r,128)):fe("In page linking not enabled"),ot={...ot,findTarget:t}}function hn(){function e(e){_n(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){fe(`Add event listener: %c${o}`,n),U(window.document,t,e)}!0===ct&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}function gn(){1!==st&&(Et.parentIframe=Object.freeze({autoResize:e=>(se(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Je&&!1===Ue?(ze(A),Oe("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Re?(Re=!0,queueMicrotask(()=>Un(A,"Auto Resize enabled"))):!1===e&&!0===Re&&(Re=!1),_n(0,0,"autoResize",JSON.stringify(Re)),Re)),close(){_n(0,0,"close")},getId:()=>ft,getOrigin:()=>(ze("getOrigin"),ke("getOrigin()","getParentOrigin()"),je),getParentOrigin:()=>je,getPageInfo(e){if(typeof e===E)return Pt=e,_n(0,0,m),void Ee("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Pt=null,_n(0,0,"pageInfoStop")},getParentProps:e=>(se(e,E,"parentIframe.getParentProps(callback) callback"),Nt=e,_n(0,0,f),()=>{Nt=null,_n(0,0,"parentInfoStop")}),getParentProperties(e){ke("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){se(e,O,"parentIframe.moveToAnchor(anchor) anchor"),ot.findTarget(e)},reset(){!function(){const e=et;et=G,fe(`Reset trigger event: %c${"parentIframe.reset"}`,n),Ot?fe("TriggerLock blocked calculation"):(Ot=!0,he("Trigger event lock on"),requestAnimationFrame(()=>{Ot=!1,he("Trigger event lock off")})),Zn("reset"),et=e}()},setOffsetSize(e){se(e,M,"parentIframe.setOffsetSize(offset) offset"),lt=e,dt=e,Un(L,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){se(e,M,"parentIframe.scrollBy(x, y) x"),se(t,M,"parentIframe.scrollBy(x, y) y"),_n(t,e,"scrollBy")},scrollTo(e,t){se(e,M,"parentIframe.scrollTo(x, y) x"),se(t,M,"parentIframe.scrollTo(x, y) y"),_n(t,e,"scrollTo")},scrollToOffset(e,t){se(e,M,"parentIframe.scrollToOffset(x, y) x"),se(t,M,"parentIframe.scrollToOffset(x, y) y"),_n(t,e,p)},sendMessage(e,t){t&&se(t,O,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),_n(0,0,d,JSON.stringify(e),t)},setHeightCalculationMethod(e){et=e,ln()},setWidthCalculationMethod(e){kt=e,dn()},setTargetOrigin(e){se(e,O,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),fe(`Set targetOrigin: %c${e}`,n),$t=e},resize(e,t){void 0!==e&&se(e,M,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&se(t,M,"parentIframe.resize(customHeight, customWidth) customWidth"),Un(N,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ke("size()","resize()"),this.resize(e,t)}}),Et.parentIFrame=Et.parentIframe)}let yn=new Set;function bn(){const e=document.querySelectorAll(`[${b}]`);ut=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${v}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{ze("overflowIgnored"),pe("Ignoring elements with [data-iframe-ignore] > *:\n",n),ye()}),t}(e),Ye=ut.size>0,typeof Set.prototype.symmetricDifference===E&&(Ge=ut.symmetricDifference(yn).size>0),yn=ut}function vn(){switch(bn(),!0){case!Ge:return;case ut.size>1:pe("Overflowed Elements:",ut);break;case Ye:break;default:pe("No overflow detected")}Un(B,"Overflow updated")}function zn(e){const t={root:document.documentElement,side:Ue?T:x};return Te=vt(vn,t),Te.attachObservers(e),Te}function wn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Un(q,`Element resized <${function(e){switch(!0){case!ae(e):return"";case ae(e.id):return`${e.nodeName}#${e.id}`;case ae(e.name):return`${e.nodeName} (${e.name}`;case ae(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function $n(e){return qt=new ResizeObserver(wn),qt.observe(document.body),Ct.add(document.body),pe("Attached ResizeObserver to body"),xe={attachObserverToNonStaticElements:Bt,detachObservers:Ze(Tt,qt,Ct,At),disconnect:()=>{qt.disconnect(),pe("Detached ResizeObserver")}},xe.attachObserverToNonStaticElements(e),xe}function Sn(e){fe(`Visible: %c${e}`,n),rt=!e,Un(W,"Visibility changed")}const On=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of An(n))t.add(e)}return pe("Inspecting:\n",t),t},Mn=e=>{if(0===e.size)return;ze("addObservers");const t=On(e);Te.attachObservers(t),xe.attachObserverToNonStaticElements(t),ye()},kn=e=>{if(0===e.size)return;ze("removeObservers");const t=On(e);Te.detachObservers(t),xe.detachObservers(t),ye()};function En(e){!function({addedNodes:e,removedNodes:t}){ze("contentMutated"),tn(),Zt(),bn(),ye(),kn(t),Mn(e)}(e),Un(D,"Mutation Observed")}function In(){const e=An(document.documentElement);var t;fe("Attaching Observers"),t=[mt(En),zn(e),jt(),$n(e),Dt(Sn)],de.push(...t.map(e=>e.disconnect))}function jn(e){performance.mark(zt);const t=re(e);let r=1,a=document.documentElement,i=Xe?0:document.documentElement.getBoundingClientRect().bottom;const s=Xe?yt:Ye?Array.from(ut):An(document.documentElement);for(const t of s)r=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),r>i&&(i=r,a=t);return pe(`${t} position calculated from:`,a),pe(`Checked %c${s.length}%c elements`,n,o),performance.mark(wt,{detail:{hasTags:Xe,len:s.length,logging:it,Side:t}}),i}const Tn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xn=`* ${Array.from(H).map(e=>`:not(${e})`).join("")}`,An=e=>e.querySelectorAll(xn),Pn={height:0,width:0},Nn={height:0,width:0},Cn=[n,o,n];function Rn(e){function t(){return Nn[r]=a,Pn[r]=c,Math.max(a,1)}const o=e===Ln,r=e.label,a=e.boundingClientRect(),i=Math.ceil(a),s=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${a}px %cPage: %c${c}px`;let d=1;switch(!0){case!e.enabled():return Math.max(c,1);case Xe:pe("Found element with data-iframe-size attribute"),d=e.taggedElement();break;case!Ye&&_e&&0===Nn[r]&&0===Pn[r]:pe(`Initial page size values: ${l}`,...Cn),d=t();break;case Ot&&a===Nn[r]&&c===Pn[r]:pe(`Size unchanged: ${l}`,...Cn),d=Math.max(a,c);break;case 0===a&&0!==c:pe(`Page is hidden: ${l}`,...Cn),d=c;break;case!Ye&&a!==Nn[r]&&c<=Pn[r]:pe(`New <html> size: ${l} `,...Cn),pe(`Previous <html> size: %c${Nn[r]}px`,n),d=t();break;case!o:d=e.taggedElement();break;case!Ye&&a<Nn[r]:pe(`<html> size decreased: ${l}`,...Cn),d=t();break;case c===s||c===i:pe(`<html> size equals page size: ${l}`,...Cn),d=t();break;case a>c:pe(`Page size < <html> size: ${l}`,...Cn),d=t();break;case Ye:pe("Found elements possibly overflowing <html> "),d=e.taggedElement();break;default:pe(`Using <html> size: ${l}`,...Cn),d=t()}return pe(`Content ${r}: %c${d}px`,n),d+=function(e){const t=e.getOffset();return 0!==t&&pe(`Page offsetSize: %c${t}px`,n),t}(e),Math.max(d,1)}const Ln={label:z,enabled:()=>Ue,getOffset:()=>lt,auto:()=>Rn(Ln),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,g)+parseInt(t.marginBottom,g)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ln.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(...Tn(Ln)),min:()=>Math.min(...Tn(Ln)),grow:()=>Ln.max(),lowestElement:()=>jn(T),taggedElement:()=>jn(T)},qn={label:w,enabled:()=>Je,getOffset:()=>dt,auto:()=>Rn(qn),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(...Tn(qn)),min:()=>Math.min(...Tn(qn)),rightMostElement:()=>jn(x),scroll:()=>Math.max(qn.bodyScroll(),qn.documentElementScroll()),taggedElement:()=>jn(x)},Bn=(e,t)=>!(Math.abs(e-t)<=St);function Dn(e,t){const n=e[t](),o=e.enabled()&&void 0!==Ce?function(e){const t=Ce(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 ge(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Wn=!1;const Fn=te(()=>Oe(X(4)));let Vn,Hn=!1;const Un=ve((e,t,o,r,a)=>{switch(ze(e),!0){case!0===rt:if(!0===Hn)break;fe("Iframe hidden - Ignored resize request"),Hn=!0,Wn=!1,cancelAnimationFrame(Vn);break;case!0===Wn&&e!==B:fe("Resize already pending - Ignored resize request");break;case!Re&&!(e in R):pe("Resizing disabled");break;default:Hn=!1,Wn=!0,Pe=performance.now(),Ae=!0,Vn=requestAnimationFrame(()=>{Wn=!1,ze("requestAnimationFrame"),he(`Reset sendPending: %c${e}`,n)}),function(e,t,o,r,a){const i=o??Dn(Ln,et),s=r??Dn(qn,kt),c=Ue&&Bn(Ke,i)||Je&&Bn(Mt,s)?P:e;switch(fe(`Resize event: %c${t}`,n),c){case l:case A:case P:Ke=i,Mt=s;case L:Jn(Ke,Mt,e,a);break;case B:case D:case q:case W:fe(F);break;default:pe(F)}Ae=!1}(e,t,o,r,a)}ye()});function Zn(e){Ke=Ln[et](),Mt=qn[kt](),_n(Ke,Mt,e)}function Jn(e,t,o,a,i){st<-1||(void 0!==i?fe(`Message targetOrigin: %c${i}`,n):i=$t,function(){const s=`${ft}:${e}:${t}:${o}${void 0===a?"":`:${a}`}`;if(ht)try{window.parent.iframeParentListener(V+s)}catch(e){if(1!==st)throw e;return void Fn()}else bt.postMessage(V+s,i);Ae&&fe(function(){const e=oe(performance.now()-Pe);return o===l?`Initialised iframe in %c${e}ms`:`Size calculated in %c${e}ms`}(),n),pe(`Sending message to parent page via ${ht?"sameOrigin":"postMessage"}: %c%c${s}`,r,n)}())}const _n=ve((e,t,n,o,r)=>{ze(n),Jn(e,t,n,o,r),ye()}),Qn=ve(function(e){ze("onMessage");const{freeze:t}=Object,{parse:o}=JSON,r=e=>t(o(e)),a=e=>_n(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void fe("Page not ready, ignoring init message");const t=e.data.slice(13).split(c);bt=e.source,je=e.origin,Rt(t),_e=!1,setTimeout(()=>{nt=!1},128)},reset(){nt?fe("Page reset ignored by init"):(fe("Page size reset by host page"),Zn("resetPage"))},resize(){fe("Resize requested by host page"),Un(C,"Parent window requested size check")},moveToAnchor(){ot.findTarget(d())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=d();fe("PageInfo received from parent:",r(e)),Pt?ee(Pt,o(e)):a(m)},parentInfo(){const e=r(d());fe("ParentInfo received from parent:",e),Nt?ee(Nt,e):a(f)},message(){const e=d();fe("onMessage called from parent:%c",n,r(e)),ee(It,o(e))}},s=()=>e.data.split("]")[1].split(c)[0],d=()=>e.data.slice(e.data.indexOf(c)+1),u=()=>e.data.split(c)[2]in{true:1,false:1};function p(){const t=s();ze(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||u()||Se(`Unexpected message (${e.data})`)}V===`${e.data}`.slice(0,13)&&function(){if(!1!==_e)return u()?(we(s()),ze(l),void i.init()):void fe(`Ignored message of type "${s()}". Received before initialization.`);p()}()});let Yn=!1;const Gn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function Xn(){if("loading"===document.readyState||!_e||Yn)return;const{parent:e,top:t}=window;ze("ready"),fe("Sending%c ready%c to parent from",n,o,window.location.href),Gn(e),e!==t&&Gn(t),Yn=!0}"iframeChildListener"in window?Se("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Qn({data:e,sameOrigin:!0})),U(window,d,Qn),U(document,j,Xn),Xn())}();
|
|
20
|
+
import e,{NORMAL as t,HIGHLIGHT as n,FOREGROUND as o,ITALIC as r,BOLD as i}from"auto-console-group";const a="5.5.8-beta.1",s="iframeResizer",c=":",l="init",d="message",u="pageHide",m="pageInfo",f="parentInfo",p="scrollToOffset",h="title",g=10,y="data-iframe-size",b="data-iframe-overflowed",v="data-iframe-ignore",z="height",w="width",$="offset",S="offsetSize",O="string",M="number",k="object",E="function",j="auto",I="readystatechange",x="bottom",T="right",A="autoResizeEnabled",P=Symbol("sizeChanged"),R="manualResize",N="parentResize",C={[R]:1,[N]:1},L="setOffsetSize",q="resizeObserver",B="overflowObserver",D="mutationObserver",W="visibilityObserver",F="No change in content size detected",V="[iFrameSizer]",H=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),U=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)},Z=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"],_=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],Q=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],Y=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),G=e=>Z(_[e]),X=e=>{const t=e[Z(J[0])]||e[Z(J[1])]||e[Z(J[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=U(Z(e));return n in Y&&(t=Y[n]),t}(n[0]);return 0===o||(e=>e[2]===U(e[0]+e[1]))(n)||(o=-2),o},K=(e,...t)=>setTimeout(()=>e(...t),0),ee=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},te=e=>e,ne=e=>Math.round(1e3*e)/1e3,oe=e=>e.charAt(0).toUpperCase()+e.slice(1),re=e=>""!=`${e}`&&void 0!==e,ie=e=>e();const ae=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${oe(t)}`)},se={br:"\n",rb:"[31;1m",bb:"[34;1m",b:"[1m",i:"[3m",u:"[4m","/":"[m"},ce=Object.keys(se),le=new RegExp(`<(${ce.join("|")})>`,"gi"),de=(e,t)=>se[t]??"";let ue=!0,me=s;var fe;const pe=(fe=e,fe?.__esModule?fe.default:fe)({label:`${s}(child)`,expand:!1});const he=e=>(...t)=>!ue||pe[e](...t),ge=he("log"),ye=ge,be=he("debug");const{assert:ve,endAutoGroup:ze,error:we,errorBoundary:$e,event:Se,label:Oe,purge:Me,warn:ke}=pe,Ee=(je=te,e=>je(typeof e===O?window.chrome?e.replace(le,de):(e=>e.replaceAll("<br>","\n").replaceAll(/<\/?[^>]+>/gi,""))(e):e));var je;const Ie=(...e)=>pe.warn(...e.map(Ee)),xe=(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)=>Ie(t)),Te=xe("Method"),Ae=xe("Method","replaced with"),Pe=xe("Option"),Re=["min-height","min-width","max-height","max-width"],Ne=new Set,Ce=e=>e.tagName?e.tagName.toLowerCase():"unknown",Le=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),qe=(e,t)=>{return(n=Le(e,t))&&"0px"!==n&&n!==j&&"none"!==n;var n};function Be({href:e}){Ne.has(e)||(ge("Unable to access stylesheet:",e),Ne.add(e))}const De=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){Be(n)}return{source:"cross-origin stylesheet",value:Le(e,t)}}(e,t),We=(e,t)=>{const{source:n,value:o}=De(e,t),r=Ce(e);Ie(`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 Fe(){for(const e of[document.documentElement,document.body])for(const t of Re)ge(`Checking <${Ce(e)}> for blocking CSS: ${t}`),qe(e,t)&&We(e,t)}const Ve=e=>t=>void 0===t?void 0:e(t),He=Ve(e=>"true"===e),Ue=Ve(Number),Ze=[];function Je(e,t){ge(`${e} event listener: %c${t}`,n)}const _e=(e,t,n,o)=>{e.removeEventListener(t,n,o),Je("Removed",t)},Qe=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Ze.push(()=>_e(e,t,n,o)),Je("Added",t)},Ye=(e="")=>t=>n=>{n.size>0&&be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Ge=Ye("attached to"),Xe=((e="")=>t=>n=>{n.size>0&&we(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Ke=Ye("detached from"),et=(e,o=!0)=>r=>{r>0&&ye(`${o?"At":"De"}tached %c${e}Observer%c ${o?"to":"from"} %c${r}%c element${1===r?"":"s"}`,n,t,n,t)},tt=(e,t,n,o)=>{const r=Ke(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()}},nt="Mutation",ot=new Set,rt=new Set,it=new Set,at=[],st={attributes:!0,attributeFilter:[v,y],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let ct,lt=1,dt=!1,ut=0;const mt=Ye("added")(nt),ft=Ye("removed (page)")(nt),pt=Ye("removed (added)")(nt),ht=e=>e.nodeType!==Node.ELEMENT_NODE||H.has(e.tagName.toLowerCase());function gt(e){const t=e.addedNodes;for(const e of t)ht(e)||ot.add(e)}function yt(e){const t=e.removedNodes;for(const e of t)ht(e)||(ot.has(e)?(ot.delete(e),it.add(e)):rt.add(e))}const bt=e=>{ye("Mutations:",e);for(const t of e)gt(t),yt(t);mt(ot),ft(rt),pt(it),it.clear()};const vt=e=>()=>{const t=performance.now(),r=t-ut,i=16*lt+++2;if(r>i&&r<200)return Se("mutationThrottled"),ye("Update delayed due to heavy workload on the callStack"),ye(`EventLoop busy time: %c${ne(r)}ms %c> Max wait: %c${i-2}ms`,n,o,n),setTimeout(ct,16*lt),void(ut=t);lt=1,at.forEach(bt),at.length=0,dt=!1,rt.size>0&&ge(`Detected %c${rt.size} %cremoved element${rt.size>1?"s":""}`,n,o),ot.size>0&&ge(`Found %c${ot.size} %cnew element${ot.size>1?"s":""}`,n,o),e({addedNodes:ot,removedNodes:rt}),ot.clear(),rt.clear()};function zt(e){at.push(e),dt||(ut=performance.now(),dt=!0,requestAnimationFrame(ct))}function wt(e){const t=new window.MutationObserver(zt),r=document.body||document.documentElement;return ct=vt(e),t.observe(r,st),ye("Attached%c MutationObserver%c to body",n,o),{...t,disconnect:()=>{ot.clear(),rt.clear(),at.length=0,t.disconnect(),ye("Detached%c MutationObserver",n)}}}const $t="Overflow",St=et($t),Ot=et($t,!1),Mt=Ge($t),kt=Xe($t),Et=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,jt=(e,t)=>{const o=t.side,r={root:t.root,rootMargin:"0px",threshold:1},i=window?.requestAnimationFrame||te,a=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[o],c=(e,t)=>e.toggleAttribute(b,t);const l=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:n,target:r}=t;if(!n)continue;const i=e[o],a=s(i,n)&&!Et(r);c(r,a)}i(a)},r),d=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(d.has(r)?t.add(r):(l.observe(r),d.add(r),n.add(r),o+=1));kt(t),Mt(n),St(o),n.clear(),t.clear()},detachObservers:tt($t,l,d,Ot),disconnect:()=>{l.disconnect(),ye("Detached%c OverflowObserver",n)}}},It="--ifr-start",xt="--ifr-end",Tt="--ifr-measure",At=[];let Pt,Rt={},Nt=0;function Ct(){try{performance.clearMarks(It),performance.clearMarks(xt),performance.clearMeasures(Tt)}catch{}}function Lt(e){e.getEntries().forEach(e=>{if(e.name===xt)try{const{duration:t}=performance.measure(Tt,It,xt);Rt=e.detail,At.push(t),At.length>100&&At.shift()}catch{}})}function qt(){ye("Attached%c PerformanceObserver%c to page",n,o);const e=new PerformanceObserver(Lt);return e.observe({entryTypes:["mark"]}),Pt=setInterval(()=>{if(At.length<10)return;if(Rt.hasTags&&Rt.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=ne(e);t>Nt&&(Nt=t,Se("performanceObserver"),ge("Mean time:",ne(At[Math.floor(At.length/2)])),ge("Median time:",ne(At.reduce((e,t)=>e+t,0)/At.length)),ge("Average time:",t),ge("Max time:",ne(Math.max(...At)))),Ct(),e<=4||(clearInterval(Pt),Ie(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${ne(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Rt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{Ct(),clearInterval(Pt),e.disconnect(),ye("Detached%c PerformanceObserver",n)}}}const Bt="Resize",Dt=et(Bt),Wt=et(Bt,!1),Ft=Ge(Bt),Vt=Xe(Bt),Ht=new WeakSet,Ut=new Set,Zt=new Set;let Jt;function _t(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(Ht.has(n)?Ut.add(n):(Jt.observe(n),Ht.add(n),Zt.add(n),t+=1))}Vt(Ut),Ft(Zt),Dt(t),Zt.clear(),Ut.clear()}function Qt(e){const t=new IntersectionObserver(t=>e(t.at(-1).isIntersecting),{threshold:0}),r=document.documentElement;return t.observe(r),ye("Attached%c VisibilityObserver%c to page",n,o),{disconnect:()=>{t.disconnect(),ye("Detached%c VisibilityObserver",n)}}}const Yt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Gt=Yt(E),Xt=Yt(M),Kt=Yt(O);"undefined"!=typeof window&&function(){const e={height:()=>(ke("Custom height calculation function not defined"),qn.auto()),width:()=>(ke("Custom width calculation function not defined"),Bn.auto())},U={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},_={},Y=j,se="scroll";let ce,le,de,fe,he,Me,Ee,je,xe,Re=!0,Ne="",Ce=0,Le="",qe="",Be=!1,De=!0,We=!1,Ve=!0,Je=!1,Ye=!1,Ge=!0,Xe=!1,Ke=1,et=Y,nt="",ot=!0,rt={},it=!1,at=!1,st=!1,ct=0,lt=!1,dt=0,ut=0,mt=new Set,ft="",pt="child",ht=!1,gt="",yt=[],bt=window.parent,vt="*",zt=0,$t=!1,St=1,Ot=se,Mt=window,kt=()=>{ke("onMessage function not defined")},Et=()=>{},Tt=null,At=null;function Pt(t){var o;!function(e){ft=e[0]??ft,Ce=Ue(e[1])??Ce,We=He(e[2])??We,st=He(e[3])??st,Re=He(e[6])??Re,Le=e[7]??Le,et=e[8]??et,Ne=e[9]??Ne,qe=e[10]??qe,zt=Ue(e[11])??zt,rt.enable=He(e[12])??!1,pt=e[13]??pt,Ot=e[14]??Ot,lt=He(e[15])??lt,dt=Ue(e[16])??dt,ut=Ue(e[17])??ut,De=He(e[18])??De,ce=e[19]??ce,je=e[20]??je,ct=Ue(e[21])??ct,at=He(e[23])??at}(t),me=(o={id:ft,enabled:st,expand:at}).id||s,pe.label(`${me}`),pe.expand(o.expand),ue=o.enabled,Se("initReceived"),ge(`Initialising iframe v${a} ${window.location.href}`),function(){function t(e){ge("Reading data from page:",Object.keys(e)),xe=Gt(e,"onBeforeResize")??xe,kt=Gt(e,"onMessage")??kt,Et=Gt(e,"onReady")??Et,typeof e?.offset===M&&(Pe($,S),De&&(dt=Xt(e,$)??dt),We&&(ut=Xt(e,$)??ut)),typeof e?.offsetSize===M&&(De&&(dt=Xt(e,S)??dt),We&&(ut=Xt(e,S)??ut)),le=Kt(e,Z(J[0]))??le,nt=Kt(e,"ignoreSelector")??nt,gt=Kt(e,"sizeSelector")??gt,vt=Kt(e,"targetOrigin")??vt,et=e?.heightCalculationMethod||et,Ot=e?.widthCalculationMethod||Ot}function o(t,n){return typeof t===E&&(Ie(`<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===ct)return;const r=window.iframeResizer||window.iFrameResizer;typeof r===k&&(t(r),et=o(et,z),Ot=o(Ot,w),ye(`Set targetOrigin for parent: %c${vt}`,n))}(),[Zt,en,mn,Vt,Yt,dn,un,cn,Ut,Dt,Be?te:Fe,rn,()=>tn("background",Ne),()=>tn("padding",qe),Be?te:an,pn,on,In,hn,fn,gn,Nt,yn].forEach(e=>{try{e()}catch(e){if(ct<0)throw e;Ie("<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</>"),we(e)}}),Lt(ee(Et)),ge("Initialization complete"),ze(),Zn(l,"Init message from host page",void 0,void 0,`${a}:${ct}`),document.title&&""!==document.title&&Qn(0,0,h,document.title)}function Rt({persisted:e}){e||Qn(0,0,"beforeUnload"),Se(u),ye("Page persisted:",e),e||Ze.forEach(ie)}const Nt=()=>Qe(window,u.toLowerCase(),Rt);let Ct=!1;function Lt(e){"complete"===document.readyState?K(e):Ct||Qe(document,I,()=>Lt(e)),Ct=!0}function Dt(){yt=document.querySelectorAll(`[${y}]`),Xe=yt.length>0,ge(`Tagged elements found: %c${Xe}`,n)}let Ft=0;function Vt(){const e=document.querySelectorAll(`*[${v}]`);return Je=e.length>0,Je&&e.length!==Ft&&(function(e){const n=1===e.length?"":"s";ke(`%c[${v}]%c found on %c${e.length}%c element${n}`,i,t,i,t)}(e),Ft=e.length),Je}function Ut(){"BackCompat"===document.compatMode&&Ie("<rb>Quirks Mode Detected</>\n\nThis iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n")}function Zt(){je&&""!==je&&"false"!==je?je!==a&&Ie(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${je} - Child page: ${a}.\n`):Ie("<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 Yt(){try{ht=1===ct||"iframeParentListener"in window.parent}catch(e){ge("Cross domain iframe detected")}}function en(){We===De&&(Be=!0)}function tn(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),ye(`Set body ${e}: %c${t}`,n))}function nn(e,t,o){if(""!==o){ge(`${e}: %c${o}`,n);for(const e of document.querySelectorAll(o))ge(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function on(){nn("sizeSelector",y,gt),nn("ignoreSelector",v,nt)}function rn(){var e,t;void 0===Le&&(Le=`${Ce}px`),tn("margin",(e="margin",(t=Le).includes("-")&&(ke(`Negative CSS value ignored for ${e}`),t=""),t))}function an(){const e=e=>e.style.setProperty(z,j,"important");e(document.documentElement),e(document.body),ge("Set HTML & body height: %cauto !important",n)}function sn(e){({add(t){function n(){Zn(e.eventName,e.eventType)}_[t]=n,Qe(window,t,n,{passive:!0})},remove(e){const t=_[e];delete _[e],_e(window,e,t)}})[e.method](e.eventName)}function cn(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(y,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&Ie("<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 ln(e,t,o){const{label:r}=o;return t!==e&&(e in o||(ke(`${e} is not a valid option for ${r}CalculationMethod.`),e=t),e in U)&&Ie(`<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 ${je?"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`),ge(`Set ${r} calculation method: %c${e}`,n),e}function dn(){et=ln(et,Y,qn)}function un(){Ot=ln(Ot,se,Bn)}function mn(){const e=ct,n=X({key:ce}),o=X({key:le});if(ct=Math.max(n,o),ct<0){if(ct=Math.min(n,o),Ie(`${G(ct+2)}${G(2)}`),re(je))throw G(ct+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!re(je)||e>-1&&ct>e)&&(sessionStorage.getItem("ifr")!==a&&function(e,n){console.info(`${me} %ciframe-resizer ${e}`,ue||n<1?"font-weight: bold;":t)}(`v${a} (${(e=>Z(Q[e]))(ct)})`,ct),ct<2&&Ie(G(3)),sessionStorage.setItem("ifr",a))}function fn(){var e;!0!==Re&&ge("Auto Resize disabled"),sn({method:e="add",eventType:"After Print",eventName:"afterprint"}),sn({method:e,eventType:"Before Print",eventName:"beforeprint"})}function pn(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function hn(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,g)+parseInt(n.x,g),y:parseInt(t.top,g)+parseInt(n.y,g)}}function t(t){const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(ge(`In page link (#${r}) not found in iframe, so sending to parent`),Qn(0,0,"inPageLink",`#${r}`)):function(t){const i=e(t);ge(`Moving to in page link (%c#${r}%c) at x: %c${i.x}%c y: %c${i.y}`,n,o,n,o,n),Qn(i.y,i.x,p)}(a)}function r(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}const{enable:i}=rt;i?1===ct?Ie(G(5)):(ge("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&Qe(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),Qe(window,"hashchange",r),setTimeout(r,128)):ge("In page linking not enabled"),rt={...rt,findTarget:t}}function gn(){function e(e){Qn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,o){ge(`Add event listener: %c${o}`,n),Qe(window.document,t,e)}!0===lt&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}function yn(){1!==ct&&(Mt.parentIframe=Object.freeze({autoResize:e=>(ae(e,"boolean","parentIframe.autoResize(enable) enable"),!1===We&&!1===De?(Se(A),Ie("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Re?(Re=!0,queueMicrotask(()=>Zn(A,"Auto Resize enabled"))):!1===e&&!0===Re&&(Re=!1),Qn(0,0,"autoResize",JSON.stringify(Re)),Re)),close(){Qn(0,0,"close")},getId:()=>ft,getOrigin:()=>(Se("getOrigin"),Te("getOrigin()","getParentOrigin()"),de),getParentOrigin:()=>de,getPageInfo(e){if(typeof e===E)return Tt=e,Qn(0,0,m),void Ae("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Tt=null,Qn(0,0,"pageInfoStop")},getParentProps:e=>(ae(e,E,"parentIframe.getParentProps(callback) callback"),At=e,Qn(0,0,f),()=>{At=null,Qn(0,0,"parentInfoStop")}),getParentProperties(e){Te("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){ae(e,O,"parentIframe.moveToAnchor(anchor) anchor"),rt.findTarget(e)},reset(){!function(){const e=et;et=Y,ge(`Reset trigger event: %c${"parentIframe.reset"}`,n),$t?ge("TriggerLock blocked calculation"):($t=!0,be("Trigger event lock on"),requestAnimationFrame(()=>{$t=!1,be("Trigger event lock off")})),Jn("reset"),et=e}()},setOffsetSize(e){ae(e,M,"parentIframe.setOffsetSize(offset) offset"),dt=e,ut=e,Zn(L,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){ae(e,M,"parentIframe.scrollBy(x, y) x"),ae(t,M,"parentIframe.scrollBy(x, y) y"),Qn(t,e,"scrollBy")},scrollTo(e,t){ae(e,M,"parentIframe.scrollTo(x, y) x"),ae(t,M,"parentIframe.scrollTo(x, y) y"),Qn(t,e,"scrollTo")},scrollToOffset(e,t){ae(e,M,"parentIframe.scrollToOffset(x, y) x"),ae(t,M,"parentIframe.scrollToOffset(x, y) y"),Qn(t,e,p)},sendMessage(e,t){t&&ae(t,O,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Qn(0,0,d,JSON.stringify(e),t)},setHeightCalculationMethod(e){et=e,dn()},setWidthCalculationMethod(e){Ot=e,un()},setTargetOrigin(e){ae(e,O,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),ge(`Set targetOrigin: %c${e}`,n),vt=e},resize(e,t){void 0!==e&&ae(e,M,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&ae(t,M,"parentIframe.resize(customHeight, customWidth) customWidth"),Zn(R,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){Te("size()","resize()"),this.resize(e,t)}}),Mt.parentIFrame=Mt.parentIframe)}let bn=new Set;function vn(){const e=document.querySelectorAll(`[${b}]`);mt=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${v}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{Se("overflowIgnored"),ye("Ignoring elements with [data-iframe-ignore] > *:\n",n),ze()}),t}(e),Ye=mt.size>0,typeof Set.prototype.symmetricDifference===E&&(Ge=mt.symmetricDifference(bn).size>0),bn=mt}function zn(){switch(vn(),!0){case!Ge:return;case mt.size>1:ye("Overflowed Elements:",mt);break;case Ye:break;default:ye("No overflow detected")}Zn(B,"Overflow updated")}function wn(e){const t={root:document.documentElement,side:De?x:T};return fe=jt(zn,t),fe.attachObservers(e),fe}function $n(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Zn(q,`Element resized <${function(e){switch(!0){case!re(e):return"";case re(e.id):return`${e.nodeName}#${e.id}`;case re(e.name):return`${e.nodeName} (${e.name}`;case re(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Sn(e){return Jt=new ResizeObserver($n),Jt.observe(document.body),Ht.add(document.body),ye("Attached%c ResizeObserver%c to body",n,o),he={attachObserverToNonStaticElements:_t,detachObservers:tt(Bt,Jt,Ht,Wt),disconnect:()=>{Jt.disconnect(),ye("Detached%c ResizeObserver",n)}},he.attachObserverToNonStaticElements(e),he}function On(e){ge(`Visible: %c${e}`,n),it=!e,Zn(W,"Visibility changed")}const Mn=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of Pn(n))t.add(e)}return ye("Inspecting:\n",t),t},kn=e=>{if(0===e.size)return;Se("addObservers");const t=Mn(e);fe.attachObservers(t),he.attachObserverToNonStaticElements(t),ze()},En=e=>{if(0===e.size)return;Se("removeObservers");const t=Mn(e);fe.detachObservers(t),he.detachObservers(t),ze()};function jn(e){!function({addedNodes:e,removedNodes:t}){Se("contentMutated"),on(),Dt(),vn(),ze(),En(t),kn(e)}(e),Zn(D,"Mutation Observed")}function In(){const e=Pn(document.documentElement);var t;t=[wt(jn),wn(e),qt(),Sn(e),Qt(On)],Ze.push(...t.map(e=>e.disconnect))}function xn(e){performance.mark(It);const t=oe(e);let r=1,i=document.documentElement,a=Xe?0:document.documentElement.getBoundingClientRect().bottom;const s=Xe?yt:Ye?Array.from(mt):Pn(document.documentElement);for(const t of s)r=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),r>a&&(a=r,i=t);return ye(`${t} position calculated from:`,i),ye(`Checked %c${s.length}%c elements`,n,o),performance.mark(xt,{detail:{hasTags:Xe,len:s.length,logging:st,Side:t}}),a}const Tn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],An=`* ${Array.from(H).map(e=>`:not(${e})`).join("")}`,Pn=e=>e.querySelectorAll(An),Rn={height:0,width:0},Nn={height:0,width:0},Cn=[n,o,n];function Ln(e){function t(){return Nn[r]=i,Rn[r]=c,Math.max(i,1)}const o=e===qn,r=e.label,i=e.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${i}px %cPage: %c${c}px`;let d=1;switch(!0){case!e.enabled():return Math.max(c,1);case Xe:ye("Found element with data-iframe-size attribute"),d=e.taggedElement();break;case!Ye&&Ve&&0===Nn[r]&&0===Rn[r]:ye(`Initial page size values: ${l}`,...Cn),d=t();break;case $t&&i===Nn[r]&&c===Rn[r]:ye(`Size unchanged: ${l}`,...Cn),d=Math.max(i,c);break;case 0===i&&0!==c:ye(`Page is hidden: ${l}`,...Cn),d=c;break;case!Ye&&i!==Nn[r]&&c<=Rn[r]:ye(`New <html> size: ${l} `,...Cn),ye(`Previous <html> size: %c${Nn[r]}px`,n),d=t();break;case!o:d=e.taggedElement();break;case!Ye&&i<Nn[r]:ye(`<html> size decreased: ${l}`,...Cn),d=t();break;case c===s||c===a:ye(`<html> size equals page size: ${l}`,...Cn),d=t();break;case i>c:ye(`Page size < <html> size: ${l}`,...Cn),d=t();break;case Ye:ye("Found elements possibly overflowing <html> "),d=e.taggedElement();break;default:ye(`Using <html> size: ${l}`,...Cn),d=t()}return ye(`Content ${r}: %c${d}px`,n),d+=function(e){const t=e.getOffset();return 0!==t&&ye(`Page offsetSize: %c${t}px`,n),t}(e),Math.max(d,1)}const qn={label:z,enabled:()=>De,getOffset:()=>dt,auto:()=>Ln(qn),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,g)+parseInt(t.marginBottom,g)},bodyScroll:()=>document.body.scrollHeight,offset:()=>qn.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(...Tn(qn)),min:()=>Math.min(...Tn(qn)),grow:()=>qn.max(),lowestElement:()=>xn(x),taggedElement:()=>xn(x)},Bn={label:w,enabled:()=>We,getOffset:()=>ut,auto:()=>Ln(Bn),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(...Tn(Bn)),min:()=>Math.min(...Tn(Bn)),rightMostElement:()=>xn(T),scroll:()=>Math.max(Bn.bodyScroll(),Bn.documentElementScroll()),taggedElement:()=>xn(T)},Dn=(e,t)=>!(Math.abs(e-t)<=zt);function Wn(e,t){const n=e[t](),o=e.enabled()&&void 0!==xe?function(e){const t=xe(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 ve(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Fn=!1;const Vn=ee(()=>Ie(G(4)));let Hn,Un=!1;const Zn=$e((e,t,o,r,i)=>{switch(Se(e),!0){case!0===it:if(!0===Un)break;ge("Iframe hidden - Ignored resize request"),Un=!0,Fn=!1,cancelAnimationFrame(Hn);break;case!0===Fn&&e!==B:ge("Resize already pending - Ignored resize request");break;case!Re&&!(e in C):ye("Resizing disabled");break;default:Un=!1,Fn=!0,Ee=performance.now(),Me=!0,Hn||(Hn=requestAnimationFrame(()=>{Fn=!1,Hn=null,Se("requestAnimationFrame"),be(`Reset sendPending: %c${e}`,n)})),function(e,t,o,r,i){const a=o??Wn(qn,et),s=r??Wn(Bn,Ot),c=De&&Dn(Ke,a)||We&&Dn(St,s)?P:e;switch(ge(`Resize event: %c${t}`,n),c){case l:case A:case P:Ke=a,St=s;case L:_n(Ke,St,e,i);break;case B:case D:case q:case W:ge(F);break;default:ye(F)}Me=!1}(e,t,o,r,i)}ze()});function Jn(e){Ke=qn[et](),St=Bn[Ot](),Qn(Ke,St,e)}function _n(e,t,o,i,a){ct<-1||(void 0!==a?ge(`Message targetOrigin: %c${a}`,n):a=vt,function(){const s=`${ft}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(ht)try{window.parent.iframeParentListener(V+s)}catch(e){if(1!==ct)throw e;return void Vn()}else bt.postMessage(V+s,a);Me&&ge(function(){const e=ne(performance.now()-Ee);return o===l?`Initialised iframe in %c${e}ms`:`Size calculated in %c${e}ms`}(),n),ye(`Sending message to parent page via ${ht?"sameOrigin":"postMessage"}: %c%c${s}`,r,n)}())}const Qn=$e((e,t,n,o,r)=>{Se(n),_n(e,t,n,o,r),ze()}),Yn=$e(function(e){Se("onMessage");const{freeze:t}=Object,{parse:o}=JSON,r=e=>t(o(e)),i=e=>Qn(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void ge("Page not ready, ignoring init message");const t=e.data.slice(13).split(c);bt=e.source,de=e.origin,Pt(t),Ve=!1,setTimeout(()=>{ot=!1},128)},reset(){ot?ge("Page reset ignored by init"):(ge("Page size reset by host page"),Jn("resetPage"))},resize(){ge("Resize requested by host page"),Zn(N,"Parent window requested size check")},moveToAnchor(){rt.findTarget(d())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=d();ge("PageInfo received from parent:",r(e)),Tt?K(Tt,o(e)):i(m)},parentInfo(){const e=r(d());ge("ParentInfo received from parent:",e),At?K(At,e):i(f)},message(){const e=d();ge("onMessage called from parent:%c",n,r(e)),K(kt,o(e))}},s=()=>e.data.split("]")[1].split(c)[0],d=()=>e.data.slice(e.data.indexOf(c)+1),u=()=>e.data.split(c)[2]in{true:1,false:1};function p(){const t=s();Se(t),t in a?a[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||u()||ke(`Unexpected message (${e.data})`)}V===`${e.data}`.slice(0,13)&&function(){if(!1!==Ve)return u()?(Oe(s()),Se(l),void a.init()):void ge(`Ignored message of type "${s()}". Received before initialization.`);p()}()});let Gn=!1;const Xn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function Kn(){if("loading"===document.readyState||!Ve||Gn)return;const{parent:e,top:t}=window;Se("ready"),ge("Sending%c ready%c to parent from",n,o,window.location.href),Xn(e),e!==t&&Xn(t),Gn=!0}"iframeChildListener"in window?ke("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Yn({data:e,sameOrigin:!0})),Se("listen"),Qe(window,d,Yn),Qe(document,I,Kn),Kn())}();
|
|
21
21
|
//# sourceMappingURL=index.esm.js.map
|