@iframe-resizer/child 5.5.0-beta.2 → 5.5.0-beta.3

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